Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Feb 14, 2024
1 parent ba6bc99 commit 5e051ad
Show file tree
Hide file tree
Showing 23 changed files with 1,078 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
0xe09cb12b_b13c_5139_8c99_6140bf80deb9
);
#[repr(C)]
#[doc(hidden)]
pub struct IJsonValidator_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub Validate: unsafe extern "system" fn(
Expand All @@ -28,7 +27,6 @@ pub struct IJsonValidator_Vtbl {
0x1cf4464e_ae9e_55d5_9539_0af4d8fc35aa
);
#[repr(C)]
#[doc(hidden)]
pub struct IJsonValidatorFactory_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub CreateInstance: unsafe extern "system" fn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
0xe09cb12b_b13c_5139_8c99_6140bf80deb9
);
#[repr(C)]
#[doc(hidden)]
pub struct IJsonValidator_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub Validate: unsafe extern "system" fn(
Expand All @@ -28,7 +27,6 @@ pub struct IJsonValidator_Vtbl {
0x1cf4464e_ae9e_55d5_9539_0af4d8fc35aa
);
#[repr(C)]
#[doc(hidden)]
pub struct IJsonValidatorFactory_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub CreateInstance: unsafe extern "system" fn(
Expand Down
3 changes: 0 additions & 3 deletions crates/tests/component/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ pub mod Nested {
::windows_core::imp::ConstBuffer::for_interface::<Self>();
}
#[repr(C)]
#[doc(hidden)]
pub struct IThing_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub Method: unsafe extern "system" fn(*mut ::core::ffi::c_void) -> ::windows_core::HRESULT,
Expand Down Expand Up @@ -74,7 +73,6 @@ pub mod Nested {
}
::windows_core::imp::com_interface!(IClass, IClass_Vtbl, 0x97540591_1323_59c0_9ae0_f510cae62e54);
#[repr(C)]
#[doc(hidden)]
pub struct IClass_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub Property:
Expand Down Expand Up @@ -407,7 +405,6 @@ impl ::windows_core::RuntimeType for Callback {
::windows_core::imp::ConstBuffer::for_interface::<Self>();
}
#[repr(C)]
#[doc(hidden)]
pub struct Callback_Vtbl {
pub base__: ::windows_core::IUnknown_Vtbl,
pub Invoke: unsafe extern "system" fn(
Expand Down
3 changes: 0 additions & 3 deletions crates/tests/component_client/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ pub mod Nested {
::windows_core::imp::ConstBuffer::for_interface::<Self>();
}
#[repr(C)]
#[doc(hidden)]
pub struct IThing_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub Method: unsafe extern "system" fn(*mut ::core::ffi::c_void) -> ::windows_core::HRESULT,
}
}
::windows_core::imp::com_interface!(IClass, IClass_Vtbl, 0x97540591_1323_59c0_9ae0_f510cae62e54);
#[repr(C)]
#[doc(hidden)]
pub struct IClass_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub Property:
Expand Down Expand Up @@ -375,7 +373,6 @@ impl ::windows_core::RuntimeType for Callback {
::windows_core::imp::ConstBuffer::for_interface::<Self>();
}
#[repr(C)]
#[doc(hidden)]
pub struct Callback_Vtbl {
pub base__: ::windows_core::IUnknown_Vtbl,
pub Invoke: unsafe extern "system" fn(
Expand Down
4 changes: 0 additions & 4 deletions crates/tests/riddle/src/generic_interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ unsafe impl<T: ::windows_core::RuntimeType + 'static> ::windows_core::Interface
::windows_core::GUID::from_signature(<Self as ::windows_core::RuntimeType>::SIGNATURE);
}
#[repr(C)]
#[doc(hidden)]
pub struct IIterable_Vtbl<T>
where
T: ::windows_core::RuntimeType + 'static,
Expand Down Expand Up @@ -125,7 +124,6 @@ unsafe impl<T: ::windows_core::RuntimeType + 'static> ::windows_core::Interface
::windows_core::GUID::from_signature(<Self as ::windows_core::RuntimeType>::SIGNATURE);
}
#[repr(C)]
#[doc(hidden)]
pub struct IIterator_Vtbl<T>
where
T: ::windows_core::RuntimeType + 'static,
Expand Down Expand Up @@ -207,7 +205,6 @@ unsafe impl<K: ::windows_core::RuntimeType + 'static, V: ::windows_core::Runtime
::windows_core::GUID::from_signature(<Self as ::windows_core::RuntimeType>::SIGNATURE);
}
#[repr(C)]
#[doc(hidden)]
pub struct IKeyValuePair_Vtbl<K, V>
where
K: ::windows_core::RuntimeType + 'static,
Expand Down Expand Up @@ -332,7 +329,6 @@ unsafe impl<K: ::windows_core::RuntimeType + 'static, V: ::windows_core::Runtime
::windows_core::GUID::from_signature(<Self as ::windows_core::RuntimeType>::SIGNATURE);
}
#[repr(C)]
#[doc(hidden)]
pub struct IMapView_Vtbl<K, V>
where
K: ::windows_core::RuntimeType + 'static,
Expand Down
1 change: 0 additions & 1 deletion crates/tests/riddle/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ impl ::windows_core::RuntimeType for IParams {
::windows_core::imp::ConstBuffer::for_interface::<Self>();
}
#[repr(C)]
#[doc(hidden)]
pub struct IParams_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub Nothing: unsafe extern "system" fn(*mut ::core::ffi::c_void) -> ::windows_core::HRESULT,
Expand Down
10 changes: 10 additions & 0 deletions crates/tests/standalone/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ fn main() {
"src/b_variant.rs",
&["Windows.Win32.System.Variant.VARIANT"],
);

write_vtbl("src/b_vtbl_0.rs", &["Windows.Win32.System.Com.IAgileObject"]);
write_vtbl("src/b_vtbl_1.rs", &["Windows.Win32.System.Com.IDispatch"]);
write_vtbl("src/b_vtbl_2.rs", &["Windows.Win32.System.WinRT.IActivationFactory"]);
write_vtbl("src/b_vtbl_3.rs", &["Windows.Foundation.IStringable"]);
write_vtbl("src/b_vtbl_4.rs", &["Windows.Win32.System.Com.IPersistFile"]);
}

fn write_sys(output: &str, filter: &[&str]) {
Expand All @@ -170,6 +176,10 @@ fn write_no_inner_attr(output: &str, filter: &[&str]) {
);
}

fn write_vtbl(output: &str, filter: &[&str]) {
riddle(output, filter, &["flatten", "sys", "minimal", "vtbl"]);
}

fn riddle(output: &str, filter: &[&str], config: &[&str]) {
// Rust-analyzer may re-run build scripts whenever a source file is deleted
// which causes an endless loop if the file is deleted from a build script.
Expand Down
7 changes: 0 additions & 7 deletions crates/tests/standalone/src/b_calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,6 @@ impl ::windows_core::RuntimeType for DayOfWeek {
0xca30221d_86d9_40fb_a26b_d44eb7cf08ea
);
#[repr(C)]
#[doc(hidden)]
pub struct ICalendar_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub Clone: unsafe extern "system" fn(
Expand Down Expand Up @@ -1651,7 +1650,6 @@ pub struct ICalendar_Vtbl {
0x83f58412_e56b_4c75_a66e_0f63d57758a6
);
#[repr(C)]
#[doc(hidden)]
pub struct ICalendarFactory_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub CreateCalendarDefaultCalendarAndClock: unsafe extern "system" fn(
Expand All @@ -1674,7 +1672,6 @@ pub struct ICalendarFactory_Vtbl {
0xb44b378c_ca7e_4590_9e72_ea2bec1a5115
);
#[repr(C)]
#[doc(hidden)]
pub struct ICalendarFactory2_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub CreateCalendarWithTimeZone: unsafe extern "system" fn(
Expand Down Expand Up @@ -1742,7 +1739,6 @@ unsafe impl<T: ::windows_core::RuntimeType + 'static> ::windows_core::Interface
::windows_core::GUID::from_signature(<Self as ::windows_core::RuntimeType>::SIGNATURE);
}
#[repr(C)]
#[doc(hidden)]
pub struct IIterable_Vtbl<T>
where
T: ::windows_core::RuntimeType + 'static,
Expand Down Expand Up @@ -1844,7 +1840,6 @@ unsafe impl<T: ::windows_core::RuntimeType + 'static> ::windows_core::Interface
::windows_core::GUID::from_signature(<Self as ::windows_core::RuntimeType>::SIGNATURE);
}
#[repr(C)]
#[doc(hidden)]
pub struct IIterator_Vtbl<T>
where
T: ::windows_core::RuntimeType + 'static,
Expand Down Expand Up @@ -1872,7 +1867,6 @@ where
0xbb3c25e5_46cf_4317_a3f5_02621ad54478
);
#[repr(C)]
#[doc(hidden)]
pub struct ITimeZoneOnCalendar_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub GetTimeZone: unsafe extern "system" fn(
Expand Down Expand Up @@ -2034,7 +2028,6 @@ unsafe impl<T: ::windows_core::RuntimeType + 'static> ::windows_core::Interface
::windows_core::GUID::from_signature(<Self as ::windows_core::RuntimeType>::SIGNATURE);
}
#[repr(C)]
#[doc(hidden)]
pub struct IVectorView_Vtbl<T>
where
T: ::windows_core::RuntimeType + 'static,
Expand Down
3 changes: 1 addition & 2 deletions crates/tests/standalone/src/b_hstring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
dead_code,
clippy::all
)]
::windows_targets::link!("api-ms-win-core-winrt-string-l1-1-0.dll" "system" fn WindowsGetStringLen(string : HSTRING) -> u32);
pub type HSTRING = *mut ::core::ffi::c_void;
::windows_targets::link!("api-ms-win-core-winrt-string-l1-1-0.dll" "system" fn WindowsGetStringLen(string : * mut::core::ffi::c_void) -> u32);
4 changes: 1 addition & 3 deletions crates/tests/standalone/src/b_inspectable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@
dead_code,
clippy::all
)]
::windows_targets::link!("api-ms-win-core-winrt-l1-1-0.dll" "system" fn RoActivateInstance(activatableclassid : HSTRING, instance : *mut IInspectable) -> HRESULT);
::windows_targets::link!("api-ms-win-core-winrt-l1-1-0.dll" "system" fn RoActivateInstance(activatableclassid : * mut::core::ffi::c_void, instance : *mut * mut::core::ffi::c_void) -> HRESULT);
pub type HRESULT = i32;
pub type HSTRING = *mut ::core::ffi::c_void;
pub type IInspectable = *mut ::core::ffi::c_void;
3 changes: 1 addition & 2 deletions crates/tests/standalone/src/b_nested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ pub type HBITMAP = isize;
pub type HENHMETAFILE = isize;
pub type HGLOBAL = *mut ::core::ffi::c_void;
pub type HRESULT = i32;
pub type IUnknown = *mut ::core::ffi::c_void;
pub type PCWSTR = *const u16;
#[repr(C)]
pub struct POINTL {
Expand Down Expand Up @@ -178,7 +177,7 @@ pub type STGM = u32;
pub struct STGMEDIUM {
pub tymed: u32,
pub u: STGMEDIUM_0,
pub pUnkForRelease: IUnknown,
pub pUnkForRelease: *mut ::core::ffi::c_void,
}
impl ::core::marker::Copy for STGMEDIUM {}
impl ::core::clone::Clone for STGMEDIUM {
Expand Down
1 change: 0 additions & 1 deletion crates/tests/standalone/src/b_stringable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ impl ::windows_core::RuntimeType for IStringable {
::windows_core::imp::ConstBuffer::for_interface::<Self>();
}
#[repr(C)]
#[doc(hidden)]
pub struct IStringable_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub ToString: unsafe extern "system" fn(
Expand Down
3 changes: 1 addition & 2 deletions crates/tests/standalone/src/b_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
::windows_targets::link!("kernel32.dll" "system" fn CreateEventW(lpeventattributes : *const SECURITY_ATTRIBUTES, bmanualreset : BOOL, binitialstate : BOOL, lpname : PCWSTR) -> HANDLE);
::windows_targets::link!("kernel32.dll" "system" fn SetEvent(hevent : HANDLE) -> BOOL);
::windows_targets::link!("kernel32.dll" "system" fn WaitForSingleObject(hhandle : HANDLE, dwmilliseconds : u32) -> WAIT_EVENT);
::windows_targets::link!("ole32.dll" "system" fn CoCreateInstance(rclsid : *const GUID, punkouter : IUnknown, dwclscontext : CLSCTX, riid : *const GUID, ppv : *mut *mut ::core::ffi::c_void) -> HRESULT);
::windows_targets::link!("ole32.dll" "system" fn CoCreateInstance(rclsid : *const GUID, punkouter : * mut::core::ffi::c_void, dwclscontext : CLSCTX, riid : *const GUID, ppv : *mut *mut ::core::ffi::c_void) -> HRESULT);
::windows_targets::link!("user32.dll" "cdecl" fn wsprintfA(param0 : PSTR, param1 : PCSTR, ...) -> i32);
pub type BOOL = i32;
pub type CLSCTX = u32;
Expand Down Expand Up @@ -41,7 +41,6 @@ impl GUID {
}
pub type HANDLE = isize;
pub type HRESULT = i32;
pub type IUnknown = *mut ::core::ffi::c_void;
pub type PCSTR = *const u8;
pub type PCWSTR = *const u16;
pub type PSTR = *mut u8;
Expand Down
3 changes: 1 addition & 2 deletions crates/tests/standalone/src/b_unknown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
dead_code,
clippy::all
)]
::windows_targets::link!("ole32.dll" "system" fn CoIsHandlerConnected(punk : IUnknown) -> BOOL);
::windows_targets::link!("ole32.dll" "system" fn CoIsHandlerConnected(punk : * mut::core::ffi::c_void) -> BOOL);
pub type BOOL = i32;
pub type IUnknown = *mut ::core::ffi::c_void;
11 changes: 0 additions & 11 deletions crates/tests/standalone/src/b_uri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ unsafe impl<T: ::windows_core::RuntimeType + 'static> ::windows_core::Interface
::windows_core::GUID::from_signature(<Self as ::windows_core::RuntimeType>::SIGNATURE);
}
#[repr(C)]
#[doc(hidden)]
pub struct IIterable_Vtbl<T>
where
T: ::windows_core::RuntimeType + 'static,
Expand Down Expand Up @@ -165,7 +164,6 @@ unsafe impl<T: ::windows_core::RuntimeType + 'static> ::windows_core::Interface
::windows_core::GUID::from_signature(<Self as ::windows_core::RuntimeType>::SIGNATURE);
}
#[repr(C)]
#[doc(hidden)]
pub struct IIterator_Vtbl<T>
where
T: ::windows_core::RuntimeType + 'static,
Expand Down Expand Up @@ -215,7 +213,6 @@ impl ::windows_core::RuntimeType for IStringable {
::windows_core::imp::ConstBuffer::for_interface::<Self>();
}
#[repr(C)]
#[doc(hidden)]
pub struct IStringable_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub ToString: unsafe extern "system" fn(
Expand All @@ -229,7 +226,6 @@ pub struct IStringable_Vtbl {
0xc1d432ba_c824_4452_a7fd_512bc3bbe9a1
);
#[repr(C)]
#[doc(hidden)]
pub struct IUriEscapeStatics_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub UnescapeComponent: unsafe extern "system" fn(
Expand All @@ -249,7 +245,6 @@ pub struct IUriEscapeStatics_Vtbl {
0x9e365e57_48b2_4160_956f_c7385120bbfc
);
#[repr(C)]
#[doc(hidden)]
pub struct IUriRuntimeClass_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub AbsoluteUri: unsafe extern "system" fn(
Expand Down Expand Up @@ -325,7 +320,6 @@ pub struct IUriRuntimeClass_Vtbl {
0x44a9796f_723e_4fdf_a218_033e75b0c084
);
#[repr(C)]
#[doc(hidden)]
pub struct IUriRuntimeClassFactory_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub CreateUri: unsafe extern "system" fn(
Expand All @@ -346,7 +340,6 @@ pub struct IUriRuntimeClassFactory_Vtbl {
0x758d9661_221c_480f_a339_50656673f46f
);
#[repr(C)]
#[doc(hidden)]
pub struct IUriRuntimeClassWithAbsoluteCanonicalUri_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub AbsoluteCanonicalUri: unsafe extern "system" fn(
Expand Down Expand Up @@ -499,7 +492,6 @@ unsafe impl<T: ::windows_core::RuntimeType + 'static> ::windows_core::Interface
::windows_core::GUID::from_signature(<Self as ::windows_core::RuntimeType>::SIGNATURE);
}
#[repr(C)]
#[doc(hidden)]
pub struct IVectorView_Vtbl<T>
where
T: ::windows_core::RuntimeType + 'static,
Expand Down Expand Up @@ -566,7 +558,6 @@ impl ::windows_core::RuntimeType for IWwwFormUrlDecoderEntry {
::windows_core::imp::ConstBuffer::for_interface::<Self>();
}
#[repr(C)]
#[doc(hidden)]
pub struct IWwwFormUrlDecoderEntry_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub Name: unsafe extern "system" fn(
Expand All @@ -584,7 +575,6 @@ pub struct IWwwFormUrlDecoderEntry_Vtbl {
0xd45a0451_f225_4542_9296_0e1df5d254df
);
#[repr(C)]
#[doc(hidden)]
pub struct IWwwFormUrlDecoderRuntimeClass_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub GetFirstValueByName: unsafe extern "system" fn(
Expand All @@ -599,7 +589,6 @@ pub struct IWwwFormUrlDecoderRuntimeClass_Vtbl {
0x5b8c6b3d_24ae_41b5_a1bf_f0c3d544845b
);
#[repr(C)]
#[doc(hidden)]
pub struct IWwwFormUrlDecoderRuntimeClassFactory_Vtbl {
pub base__: ::windows_core::IInspectable_Vtbl,
pub CreateWwwFormUrlDecoder: unsafe extern "system" fn(
Expand Down
5 changes: 2 additions & 3 deletions crates/tests/standalone/src/b_variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ impl ::core::clone::Clone for IDLDESC {
pub type IDLFLAGS = u16;
pub type IMPLTYPEFLAGS = i32;
pub type INVOKEKIND = i32;
pub type IUnknown = *mut ::core::ffi::c_void;
pub type LPEXCEPFINO_DEFERRED_FILLIN =
::core::option::Option<unsafe extern "system" fn(pexcepinfo: *mut EXCEPINFO) -> HRESULT>;
#[repr(C)]
Expand Down Expand Up @@ -429,7 +428,7 @@ pub union VARIANT_0_0_0 {
pub cyVal: CY,
pub date: f64,
pub bstrVal: BSTR,
pub punkVal: IUnknown,
pub punkVal: *mut ::core::ffi::c_void,
pub pdispVal: *mut ::core::ffi::c_void,
pub parray: *mut SAFEARRAY,
pub pbVal: *mut u8,
Expand All @@ -444,7 +443,7 @@ pub union VARIANT_0_0_0 {
pub pcyVal: *mut CY,
pub pdate: *mut f64,
pub pbstrVal: *mut BSTR,
pub ppunkVal: *mut IUnknown,
pub ppunkVal: *mut *mut ::core::ffi::c_void,
pub ppdispVal: *mut *mut ::core::ffi::c_void,
pub pparray: *mut *mut SAFEARRAY,
pub pvarVal: *mut VARIANT,
Expand Down
Loading

0 comments on commit 5e051ad

Please sign in to comment.