From 5e051ad057c0de000915a5141869b0de4549b85e Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Tue, 13 Feb 2024 20:07:36 -0600 Subject: [PATCH] tests --- .../json_validator_winrt/src/bindings.rs | 2 - .../src/bindings.rs | 2 - crates/tests/component/src/bindings.rs | 3 - crates/tests/component_client/src/bindings.rs | 3 - crates/tests/riddle/src/generic_interfaces.rs | 4 - crates/tests/riddle/src/params.rs | 1 - crates/tests/standalone/build.rs | 10 + crates/tests/standalone/src/b_calendar.rs | 7 - crates/tests/standalone/src/b_hstring.rs | 3 +- crates/tests/standalone/src/b_inspectable.rs | 4 +- crates/tests/standalone/src/b_nested.rs | 3 +- crates/tests/standalone/src/b_stringable.rs | 1 - crates/tests/standalone/src/b_test.rs | 3 +- crates/tests/standalone/src/b_unknown.rs | 3 +- crates/tests/standalone/src/b_uri.rs | 11 - crates/tests/standalone/src/b_variant.rs | 5 +- crates/tests/standalone/src/b_vtbl.rs | 70 ++ crates/tests/standalone/src/b_vtbl_0.rs | 49 ++ crates/tests/standalone/src/b_vtbl_1.rs | 735 ++++++++++++++++++ crates/tests/standalone/src/b_vtbl_2.rs | 69 ++ crates/tests/standalone/src/b_vtbl_3.rs | 69 ++ crates/tests/standalone/src/b_vtbl_4.rs | 64 ++ crates/tests/standalone/src/lib.rs | 5 + 23 files changed, 1078 insertions(+), 48 deletions(-) create mode 100644 crates/tests/standalone/src/b_vtbl.rs create mode 100644 crates/tests/standalone/src/b_vtbl_0.rs create mode 100644 crates/tests/standalone/src/b_vtbl_1.rs create mode 100644 crates/tests/standalone/src/b_vtbl_2.rs create mode 100644 crates/tests/standalone/src/b_vtbl_3.rs create mode 100644 crates/tests/standalone/src/b_vtbl_4.rs diff --git a/crates/samples/components/json_validator_winrt/src/bindings.rs b/crates/samples/components/json_validator_winrt/src/bindings.rs index 51a0823418..d297ddc4cb 100644 --- a/crates/samples/components/json_validator_winrt/src/bindings.rs +++ b/crates/samples/components/json_validator_winrt/src/bindings.rs @@ -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( @@ -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( diff --git a/crates/samples/components/json_validator_winrt_client/src/bindings.rs b/crates/samples/components/json_validator_winrt_client/src/bindings.rs index 7e7f26bb09..1ed73cd270 100644 --- a/crates/samples/components/json_validator_winrt_client/src/bindings.rs +++ b/crates/samples/components/json_validator_winrt_client/src/bindings.rs @@ -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( @@ -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( diff --git a/crates/tests/component/src/bindings.rs b/crates/tests/component/src/bindings.rs index a4eb094c30..07794b4e1d 100644 --- a/crates/tests/component/src/bindings.rs +++ b/crates/tests/component/src/bindings.rs @@ -34,7 +34,6 @@ pub mod Nested { ::windows_core::imp::ConstBuffer::for_interface::(); } #[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, @@ -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: @@ -407,7 +405,6 @@ impl ::windows_core::RuntimeType for Callback { ::windows_core::imp::ConstBuffer::for_interface::(); } #[repr(C)] -#[doc(hidden)] pub struct Callback_Vtbl { pub base__: ::windows_core::IUnknown_Vtbl, pub Invoke: unsafe extern "system" fn( diff --git a/crates/tests/component_client/src/bindings.rs b/crates/tests/component_client/src/bindings.rs index 2c149184f3..ff78b8f147 100644 --- a/crates/tests/component_client/src/bindings.rs +++ b/crates/tests/component_client/src/bindings.rs @@ -34,7 +34,6 @@ pub mod Nested { ::windows_core::imp::ConstBuffer::for_interface::(); } #[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, @@ -42,7 +41,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: @@ -375,7 +373,6 @@ impl ::windows_core::RuntimeType for Callback { ::windows_core::imp::ConstBuffer::for_interface::(); } #[repr(C)] -#[doc(hidden)] pub struct Callback_Vtbl { pub base__: ::windows_core::IUnknown_Vtbl, pub Invoke: unsafe extern "system" fn( diff --git a/crates/tests/riddle/src/generic_interfaces.rs b/crates/tests/riddle/src/generic_interfaces.rs index f31a0f947b..1f1f25b79e 100644 --- a/crates/tests/riddle/src/generic_interfaces.rs +++ b/crates/tests/riddle/src/generic_interfaces.rs @@ -49,7 +49,6 @@ unsafe impl ::windows_core::Interface ::windows_core::GUID::from_signature(::SIGNATURE); } #[repr(C)] -#[doc(hidden)] pub struct IIterable_Vtbl where T: ::windows_core::RuntimeType + 'static, @@ -125,7 +124,6 @@ unsafe impl ::windows_core::Interface ::windows_core::GUID::from_signature(::SIGNATURE); } #[repr(C)] -#[doc(hidden)] pub struct IIterator_Vtbl where T: ::windows_core::RuntimeType + 'static, @@ -207,7 +205,6 @@ unsafe impl::SIGNATURE); } #[repr(C)] -#[doc(hidden)] pub struct IKeyValuePair_Vtbl where K: ::windows_core::RuntimeType + 'static, @@ -332,7 +329,6 @@ unsafe impl::SIGNATURE); } #[repr(C)] -#[doc(hidden)] pub struct IMapView_Vtbl where K: ::windows_core::RuntimeType + 'static, diff --git a/crates/tests/riddle/src/params.rs b/crates/tests/riddle/src/params.rs index ec75fbe308..772b775d9f 100644 --- a/crates/tests/riddle/src/params.rs +++ b/crates/tests/riddle/src/params.rs @@ -198,7 +198,6 @@ impl ::windows_core::RuntimeType for IParams { ::windows_core::imp::ConstBuffer::for_interface::(); } #[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, diff --git a/crates/tests/standalone/build.rs b/crates/tests/standalone/build.rs index ba1b452a67..b7736d880f 100644 --- a/crates/tests/standalone/build.rs +++ b/crates/tests/standalone/build.rs @@ -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]) { @@ -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. diff --git a/crates/tests/standalone/src/b_calendar.rs b/crates/tests/standalone/src/b_calendar.rs index 2baa71d617..5347ebe301 100644 --- a/crates/tests/standalone/src/b_calendar.rs +++ b/crates/tests/standalone/src/b_calendar.rs @@ -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( @@ -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( @@ -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( @@ -1742,7 +1739,6 @@ unsafe impl ::windows_core::Interface ::windows_core::GUID::from_signature(::SIGNATURE); } #[repr(C)] -#[doc(hidden)] pub struct IIterable_Vtbl where T: ::windows_core::RuntimeType + 'static, @@ -1844,7 +1840,6 @@ unsafe impl ::windows_core::Interface ::windows_core::GUID::from_signature(::SIGNATURE); } #[repr(C)] -#[doc(hidden)] pub struct IIterator_Vtbl where T: ::windows_core::RuntimeType + 'static, @@ -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( @@ -2034,7 +2028,6 @@ unsafe impl ::windows_core::Interface ::windows_core::GUID::from_signature(::SIGNATURE); } #[repr(C)] -#[doc(hidden)] pub struct IVectorView_Vtbl where T: ::windows_core::RuntimeType + 'static, diff --git a/crates/tests/standalone/src/b_hstring.rs b/crates/tests/standalone/src/b_hstring.rs index 2bfecba1ec..e7a7d3de30 100644 --- a/crates/tests/standalone/src/b_hstring.rs +++ b/crates/tests/standalone/src/b_hstring.rs @@ -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); diff --git a/crates/tests/standalone/src/b_inspectable.rs b/crates/tests/standalone/src/b_inspectable.rs index b3341a67b7..98c23f7185 100644 --- a/crates/tests/standalone/src/b_inspectable.rs +++ b/crates/tests/standalone/src/b_inspectable.rs @@ -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; diff --git a/crates/tests/standalone/src/b_nested.rs b/crates/tests/standalone/src/b_nested.rs index c69d785191..9fd8aabdfc 100644 --- a/crates/tests/standalone/src/b_nested.rs +++ b/crates/tests/standalone/src/b_nested.rs @@ -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 { @@ -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 { diff --git a/crates/tests/standalone/src/b_stringable.rs b/crates/tests/standalone/src/b_stringable.rs index 5447b3c668..d62996e638 100644 --- a/crates/tests/standalone/src/b_stringable.rs +++ b/crates/tests/standalone/src/b_stringable.rs @@ -35,7 +35,6 @@ impl ::windows_core::RuntimeType for IStringable { ::windows_core::imp::ConstBuffer::for_interface::(); } #[repr(C)] -#[doc(hidden)] pub struct IStringable_Vtbl { pub base__: ::windows_core::IInspectable_Vtbl, pub ToString: unsafe extern "system" fn( diff --git a/crates/tests/standalone/src/b_test.rs b/crates/tests/standalone/src/b_test.rs index 18b70ae3b8..074d517648 100644 --- a/crates/tests/standalone/src/b_test.rs +++ b/crates/tests/standalone/src/b_test.rs @@ -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; @@ -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; diff --git a/crates/tests/standalone/src/b_unknown.rs b/crates/tests/standalone/src/b_unknown.rs index 7ce5c1c595..042bf899d1 100644 --- a/crates/tests/standalone/src/b_unknown.rs +++ b/crates/tests/standalone/src/b_unknown.rs @@ -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; diff --git a/crates/tests/standalone/src/b_uri.rs b/crates/tests/standalone/src/b_uri.rs index 8ee713176c..9300284f8b 100644 --- a/crates/tests/standalone/src/b_uri.rs +++ b/crates/tests/standalone/src/b_uri.rs @@ -63,7 +63,6 @@ unsafe impl ::windows_core::Interface ::windows_core::GUID::from_signature(::SIGNATURE); } #[repr(C)] -#[doc(hidden)] pub struct IIterable_Vtbl where T: ::windows_core::RuntimeType + 'static, @@ -165,7 +164,6 @@ unsafe impl ::windows_core::Interface ::windows_core::GUID::from_signature(::SIGNATURE); } #[repr(C)] -#[doc(hidden)] pub struct IIterator_Vtbl where T: ::windows_core::RuntimeType + 'static, @@ -215,7 +213,6 @@ impl ::windows_core::RuntimeType for IStringable { ::windows_core::imp::ConstBuffer::for_interface::(); } #[repr(C)] -#[doc(hidden)] pub struct IStringable_Vtbl { pub base__: ::windows_core::IInspectable_Vtbl, pub ToString: unsafe extern "system" fn( @@ -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( @@ -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( @@ -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( @@ -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( @@ -499,7 +492,6 @@ unsafe impl ::windows_core::Interface ::windows_core::GUID::from_signature(::SIGNATURE); } #[repr(C)] -#[doc(hidden)] pub struct IVectorView_Vtbl where T: ::windows_core::RuntimeType + 'static, @@ -566,7 +558,6 @@ impl ::windows_core::RuntimeType for IWwwFormUrlDecoderEntry { ::windows_core::imp::ConstBuffer::for_interface::(); } #[repr(C)] -#[doc(hidden)] pub struct IWwwFormUrlDecoderEntry_Vtbl { pub base__: ::windows_core::IInspectable_Vtbl, pub Name: unsafe extern "system" fn( @@ -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( @@ -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( diff --git a/crates/tests/standalone/src/b_variant.rs b/crates/tests/standalone/src/b_variant.rs index 414e78d240..92e1609092 100644 --- a/crates/tests/standalone/src/b_variant.rs +++ b/crates/tests/standalone/src/b_variant.rs @@ -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 HRESULT>; #[repr(C)] @@ -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, @@ -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, diff --git a/crates/tests/standalone/src/b_vtbl.rs b/crates/tests/standalone/src/b_vtbl.rs new file mode 100644 index 0000000000..c8721454af --- /dev/null +++ b/crates/tests/standalone/src/b_vtbl.rs @@ -0,0 +1,70 @@ +// Bindings generated by `windows-bindgen` 0.52.0 + +#![allow( + non_snake_case, + non_upper_case_globals, + non_camel_case_types, + dead_code, + clippy::all +)] +#[repr(C)] +pub struct GUID { + pub data1: u32, + pub data2: u16, + pub data3: u16, + pub data4: [u8; 8], +} +impl ::core::marker::Copy for GUID {} +impl ::core::clone::Clone for GUID { + fn clone(&self) -> Self { + *self + } +} +impl GUID { + pub const fn from_u128(uuid: u128) -> Self { + Self { + data1: (uuid >> 96) as u32, + data2: (uuid >> 80 & 0xffff) as u16, + data3: (uuid >> 64 & 0xffff) as u16, + data4: (uuid as u64).to_be_bytes(), + } + } +} +pub type HRESULT = i32; +pub const IID_IActivationFactory: GUID = GUID::from_u128(0x00000035_0000_0000_c000_000000000046); +#[repr(C)] +#[doc(hidden)] +pub struct IActivationFactory_Vtbl { + pub base__: IInspectable_Vtbl, + pub ActivateInstance: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, +} +pub const IID_IInspectable: GUID = GUID::from_u128(0xaf86e2e0_b12d_4c6a_9c5a_d7aa65101e90); +#[repr(C)] +pub struct IInspectable_Vtbl { + pub base: IUnknown_Vtbl, + pub GetIids: unsafe extern "system" fn( + this: *mut std::ffi::c_void, + count: *mut u32, + values: *mut *mut GUID, + ) -> HRESULT, + pub GetRuntimeClassName: unsafe extern "system" fn( + this: *mut std::ffi::c_void, + value: *mut *mut std::ffi::c_void, + ) -> HRESULT, + pub GetTrustLevel: + unsafe extern "system" fn(this: *mut std::ffi::c_void, value: *mut i32) -> HRESULT, +} +pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IUnknown_Vtbl { + pub QueryInterface: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + iid: *const GUID, + interface: *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub AddRef: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> u32, + pub Release: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> u32, +} diff --git a/crates/tests/standalone/src/b_vtbl_0.rs b/crates/tests/standalone/src/b_vtbl_0.rs new file mode 100644 index 0000000000..b491176c58 --- /dev/null +++ b/crates/tests/standalone/src/b_vtbl_0.rs @@ -0,0 +1,49 @@ +// Bindings generated by `windows-bindgen` 0.52.0 + +#![allow( + non_snake_case, + non_upper_case_globals, + non_camel_case_types, + dead_code, + clippy::all +)] +#[repr(C)] +pub struct GUID { + pub data1: u32, + pub data2: u16, + pub data3: u16, + pub data4: [u8; 8], +} +impl ::core::marker::Copy for GUID {} +impl ::core::clone::Clone for GUID { + fn clone(&self) -> Self { + *self + } +} +impl GUID { + pub const fn from_u128(uuid: u128) -> Self { + Self { + data1: (uuid >> 96) as u32, + data2: (uuid >> 80 & 0xffff) as u16, + data3: (uuid >> 64 & 0xffff) as u16, + data4: (uuid as u64).to_be_bytes(), + } + } +} +pub type HRESULT = i32; +pub const IID_IAgileObject: GUID = GUID::from_u128(0x94ea2b94_e9cc_49e0_c0ff_ee64ca8f5b90); +#[repr(C)] +pub struct IAgileObject_Vtbl { + pub base__: IUnknown_Vtbl, +} +pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IUnknown_Vtbl { + pub QueryInterface: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + iid: *const GUID, + interface: *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub AddRef: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> u32, + pub Release: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> u32, +} diff --git a/crates/tests/standalone/src/b_vtbl_1.rs b/crates/tests/standalone/src/b_vtbl_1.rs new file mode 100644 index 0000000000..b99724dfa2 --- /dev/null +++ b/crates/tests/standalone/src/b_vtbl_1.rs @@ -0,0 +1,735 @@ +// Bindings generated by `windows-bindgen` 0.52.0 + +#![allow( + non_snake_case, + non_upper_case_globals, + non_camel_case_types, + dead_code, + clippy::all +)] +pub type ADVANCED_FEATURE_FLAGS = u16; +#[repr(C)] +pub struct ARRAYDESC { + pub tdescElem: TYPEDESC, + pub cDims: u16, + pub rgbounds: [SAFEARRAYBOUND; 1], +} +impl ::core::marker::Copy for ARRAYDESC {} +impl ::core::clone::Clone for ARRAYDESC { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub union BINDPTR { + pub lpfuncdesc: *mut FUNCDESC, + pub lpvardesc: *mut VARDESC, + pub lptcomp: *mut ::core::ffi::c_void, +} +impl ::core::marker::Copy for BINDPTR {} +impl ::core::clone::Clone for BINDPTR { + fn clone(&self) -> Self { + *self + } +} +pub type BOOL = i32; +pub type BSTR = *const u16; +pub type CALLCONV = i32; +#[repr(C)] +pub union CY { + pub Anonymous: CY_0, + pub int64: i64, +} +impl ::core::marker::Copy for CY {} +impl ::core::clone::Clone for CY { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct CY_0 { + pub Lo: u32, + pub Hi: i32, +} +impl ::core::marker::Copy for CY_0 {} +impl ::core::clone::Clone for CY_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct DECIMAL { + pub wReserved: u16, + pub Anonymous1: DECIMAL_0, + pub Hi32: u32, + pub Anonymous2: DECIMAL_1, +} +impl ::core::marker::Copy for DECIMAL {} +impl ::core::clone::Clone for DECIMAL { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub union DECIMAL_0 { + pub Anonymous: DECIMAL_0_0, + pub signscale: u16, +} +impl ::core::marker::Copy for DECIMAL_0 {} +impl ::core::clone::Clone for DECIMAL_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct DECIMAL_0_0 { + pub scale: u8, + pub sign: u8, +} +impl ::core::marker::Copy for DECIMAL_0_0 {} +impl ::core::clone::Clone for DECIMAL_0_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub union DECIMAL_1 { + pub Anonymous: DECIMAL_1_0, + pub Lo64: u64, +} +impl ::core::marker::Copy for DECIMAL_1 {} +impl ::core::clone::Clone for DECIMAL_1 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct DECIMAL_1_0 { + pub Lo32: u32, + pub Mid32: u32, +} +impl ::core::marker::Copy for DECIMAL_1_0 {} +impl ::core::clone::Clone for DECIMAL_1_0 { + fn clone(&self) -> Self { + *self + } +} +pub type DESCKIND = i32; +pub type DISPATCH_FLAGS = u16; +#[repr(C)] +pub struct DISPPARAMS { + pub rgvarg: *mut VARIANT, + pub rgdispidNamedArgs: *mut i32, + pub cArgs: u32, + pub cNamedArgs: u32, +} +impl ::core::marker::Copy for DISPPARAMS {} +impl ::core::clone::Clone for DISPPARAMS { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct ELEMDESC { + pub tdesc: TYPEDESC, + pub Anonymous: ELEMDESC_0, +} +impl ::core::marker::Copy for ELEMDESC {} +impl ::core::clone::Clone for ELEMDESC { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub union ELEMDESC_0 { + pub idldesc: IDLDESC, + pub paramdesc: PARAMDESC, +} +impl ::core::marker::Copy for ELEMDESC_0 {} +impl ::core::clone::Clone for ELEMDESC_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct EXCEPINFO { + pub wCode: u16, + pub wReserved: u16, + pub bstrSource: BSTR, + pub bstrDescription: BSTR, + pub bstrHelpFile: BSTR, + pub dwHelpContext: u32, + pub pvReserved: *mut ::core::ffi::c_void, + pub pfnDeferredFillIn: LPEXCEPFINO_DEFERRED_FILLIN, + pub scode: i32, +} +impl ::core::marker::Copy for EXCEPINFO {} +impl ::core::clone::Clone for EXCEPINFO { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct FUNCDESC { + pub memid: i32, + pub lprgscode: *mut i32, + pub lprgelemdescParam: *mut ELEMDESC, + pub funckind: FUNCKIND, + pub invkind: INVOKEKIND, + pub callconv: CALLCONV, + pub cParams: i16, + pub cParamsOpt: i16, + pub oVft: i16, + pub cScodes: i16, + pub elemdescFunc: ELEMDESC, + pub wFuncFlags: FUNCFLAGS, +} +impl ::core::marker::Copy for FUNCDESC {} +impl ::core::clone::Clone for FUNCDESC { + fn clone(&self) -> Self { + *self + } +} +pub type FUNCFLAGS = u16; +pub type FUNCKIND = i32; +#[repr(C)] +pub struct GUID { + pub data1: u32, + pub data2: u16, + pub data3: u16, + pub data4: [u8; 8], +} +impl ::core::marker::Copy for GUID {} +impl ::core::clone::Clone for GUID { + fn clone(&self) -> Self { + *self + } +} +impl GUID { + pub const fn from_u128(uuid: u128) -> Self { + Self { + data1: (uuid >> 96) as u32, + data2: (uuid >> 80 & 0xffff) as u16, + data3: (uuid >> 64 & 0xffff) as u16, + data4: (uuid as u64).to_be_bytes(), + } + } +} +pub type HRESULT = i32; +#[repr(C)] +pub struct IDLDESC { + pub dwReserved: usize, + pub wIDLFlags: IDLFLAGS, +} +impl ::core::marker::Copy for IDLDESC {} +impl ::core::clone::Clone for IDLDESC { + fn clone(&self) -> Self { + *self + } +} +pub type IDLFLAGS = u16; +pub const IID_IDispatch: GUID = GUID::from_u128(0x00020400_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IDispatch_Vtbl { + pub base__: IUnknown_Vtbl, + pub GetTypeInfoCount: unsafe extern "system" fn(*mut ::core::ffi::c_void, *mut u32) -> HRESULT, + pub GetTypeInfo: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + u32, + u32, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub GetIDsOfNames: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *const GUID, + *const PCWSTR, + u32, + u32, + *mut i32, + ) -> HRESULT, + pub Invoke: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + i32, + *const GUID, + u32, + DISPATCH_FLAGS, + *const DISPPARAMS, + *mut VARIANT, + *mut EXCEPINFO, + *mut u32, + ) -> HRESULT, +} +pub type IMPLTYPEFLAGS = i32; +pub type INVOKEKIND = i32; +pub const IID_IRecordInfo: GUID = GUID::from_u128(0x0000002f_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IRecordInfo_Vtbl { + pub base__: IUnknown_Vtbl, + pub RecordInit: + unsafe extern "system" fn(*mut ::core::ffi::c_void, *mut ::core::ffi::c_void) -> HRESULT, + pub RecordClear: + unsafe extern "system" fn(*mut ::core::ffi::c_void, *const ::core::ffi::c_void) -> HRESULT, + pub RecordCopy: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *const ::core::ffi::c_void, + *mut ::core::ffi::c_void, + ) -> HRESULT, + pub GetGuid: unsafe extern "system" fn(*mut ::core::ffi::c_void, *mut GUID) -> HRESULT, + pub GetName: unsafe extern "system" fn(*mut ::core::ffi::c_void, *mut BSTR) -> HRESULT, + pub GetSize: unsafe extern "system" fn(*mut ::core::ffi::c_void, *mut u32) -> HRESULT, + pub GetTypeInfo: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub GetField: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *const ::core::ffi::c_void, + PCWSTR, + *mut VARIANT, + ) -> HRESULT, + pub GetFieldNoCopy: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *const ::core::ffi::c_void, + PCWSTR, + *mut VARIANT, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub PutField: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + u32, + *mut ::core::ffi::c_void, + PCWSTR, + *const VARIANT, + ) -> HRESULT, + pub PutFieldNoCopy: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + u32, + *mut ::core::ffi::c_void, + PCWSTR, + *const VARIANT, + ) -> HRESULT, + pub GetFieldNames: + unsafe extern "system" fn(*mut ::core::ffi::c_void, *mut u32, *mut BSTR) -> HRESULT, + pub IsMatchingType: + unsafe extern "system" fn(*mut ::core::ffi::c_void, *mut ::core::ffi::c_void) -> BOOL, + pub RecordCreate: + unsafe extern "system" fn(*mut ::core::ffi::c_void) -> *mut ::core::ffi::c_void, + pub RecordCreateCopy: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *const ::core::ffi::c_void, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub RecordDestroy: + unsafe extern "system" fn(*mut ::core::ffi::c_void, *const ::core::ffi::c_void) -> HRESULT, +} +pub const IID_ITypeComp: GUID = GUID::from_u128(0x00020403_0000_0000_c000_000000000046); +#[repr(C)] +pub struct ITypeComp_Vtbl { + pub base__: IUnknown_Vtbl, + pub Bind: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + PCWSTR, + u32, + u16, + *mut *mut ::core::ffi::c_void, + *mut DESCKIND, + *mut BINDPTR, + ) -> HRESULT, + pub BindType: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + PCWSTR, + u32, + *mut *mut ::core::ffi::c_void, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, +} +pub const IID_ITypeInfo: GUID = GUID::from_u128(0x00020401_0000_0000_c000_000000000046); +#[repr(C)] +pub struct ITypeInfo_Vtbl { + pub base__: IUnknown_Vtbl, + pub GetTypeAttr: + unsafe extern "system" fn(*mut ::core::ffi::c_void, *mut *mut TYPEATTR) -> HRESULT, + pub GetTypeComp: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub GetFuncDesc: + unsafe extern "system" fn(*mut ::core::ffi::c_void, u32, *mut *mut FUNCDESC) -> HRESULT, + pub GetVarDesc: + unsafe extern "system" fn(*mut ::core::ffi::c_void, u32, *mut *mut VARDESC) -> HRESULT, + pub GetNames: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + i32, + *mut BSTR, + u32, + *mut u32, + ) -> HRESULT, + pub GetRefTypeOfImplType: + unsafe extern "system" fn(*mut ::core::ffi::c_void, u32, *mut u32) -> HRESULT, + pub GetImplTypeFlags: + unsafe extern "system" fn(*mut ::core::ffi::c_void, u32, *mut IMPLTYPEFLAGS) -> HRESULT, + pub GetIDsOfNames: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *const PCWSTR, + u32, + *mut i32, + ) -> HRESULT, + pub Invoke: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *const ::core::ffi::c_void, + i32, + DISPATCH_FLAGS, + *mut DISPPARAMS, + *mut VARIANT, + *mut EXCEPINFO, + *mut u32, + ) -> HRESULT, + pub GetDocumentation: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + i32, + *mut BSTR, + *mut BSTR, + *mut u32, + *mut BSTR, + ) -> HRESULT, + pub GetDllEntry: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + i32, + INVOKEKIND, + *mut BSTR, + *mut BSTR, + *mut u16, + ) -> HRESULT, + pub GetRefTypeInfo: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + u32, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub AddressOfMember: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + i32, + INVOKEKIND, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub CreateInstance: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *mut ::core::ffi::c_void, + *const GUID, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub GetMops: unsafe extern "system" fn(*mut ::core::ffi::c_void, i32, *mut BSTR) -> HRESULT, + pub GetContainingTypeLib: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *mut *mut ::core::ffi::c_void, + *mut u32, + ) -> HRESULT, + pub ReleaseTypeAttr: unsafe extern "system" fn(*mut ::core::ffi::c_void, *const TYPEATTR), + pub ReleaseFuncDesc: unsafe extern "system" fn(*mut ::core::ffi::c_void, *const FUNCDESC), + pub ReleaseVarDesc: unsafe extern "system" fn(*mut ::core::ffi::c_void, *const VARDESC), +} +pub const IID_ITypeLib: GUID = GUID::from_u128(0x00020402_0000_0000_c000_000000000046); +#[repr(C)] +pub struct ITypeLib_Vtbl { + pub base__: IUnknown_Vtbl, + pub GetTypeInfoCount: unsafe extern "system" fn(*mut ::core::ffi::c_void) -> u32, + pub GetTypeInfo: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + u32, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub GetTypeInfoType: + unsafe extern "system" fn(*mut ::core::ffi::c_void, u32, *mut TYPEKIND) -> HRESULT, + pub GetTypeInfoOfGuid: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *const GUID, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub GetLibAttr: + unsafe extern "system" fn(*mut ::core::ffi::c_void, *mut *mut TLIBATTR) -> HRESULT, + pub GetTypeComp: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub GetDocumentation: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + i32, + *mut BSTR, + *mut BSTR, + *mut u32, + *mut BSTR, + ) -> HRESULT, + pub IsName: + unsafe extern "system" fn(*mut ::core::ffi::c_void, PWSTR, u32, *mut BOOL) -> HRESULT, + pub FindName: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + PWSTR, + u32, + *mut *mut ::core::ffi::c_void, + *mut i32, + *mut u16, + ) -> HRESULT, + pub ReleaseTLibAttr: unsafe extern "system" fn(*mut ::core::ffi::c_void, *const TLIBATTR), +} +pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IUnknown_Vtbl { + pub QueryInterface: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + iid: *const GUID, + interface: *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub AddRef: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> u32, + pub Release: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> u32, +} +pub type LPEXCEPFINO_DEFERRED_FILLIN = + ::core::option::Option HRESULT>; +#[repr(C)] +pub struct PARAMDESC { + pub pparamdescex: *mut PARAMDESCEX, + pub wParamFlags: PARAMFLAGS, +} +impl ::core::marker::Copy for PARAMDESC {} +impl ::core::clone::Clone for PARAMDESC { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct PARAMDESCEX { + pub cBytes: u32, + pub varDefaultValue: VARIANT, +} +impl ::core::marker::Copy for PARAMDESCEX {} +impl ::core::clone::Clone for PARAMDESCEX { + fn clone(&self) -> Self { + *self + } +} +pub type PARAMFLAGS = u16; +pub type PCWSTR = *const u16; +pub type PSTR = *mut u8; +pub type PWSTR = *mut u16; +#[repr(C)] +pub struct SAFEARRAY { + pub cDims: u16, + pub fFeatures: ADVANCED_FEATURE_FLAGS, + pub cbElements: u32, + pub cLocks: u32, + pub pvData: *mut ::core::ffi::c_void, + pub rgsabound: [SAFEARRAYBOUND; 1], +} +impl ::core::marker::Copy for SAFEARRAY {} +impl ::core::clone::Clone for SAFEARRAY { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct SAFEARRAYBOUND { + pub cElements: u32, + pub lLbound: i32, +} +impl ::core::marker::Copy for SAFEARRAYBOUND {} +impl ::core::clone::Clone for SAFEARRAYBOUND { + fn clone(&self) -> Self { + *self + } +} +pub type SYSKIND = i32; +#[repr(C)] +pub struct TLIBATTR { + pub guid: GUID, + pub lcid: u32, + pub syskind: SYSKIND, + pub wMajorVerNum: u16, + pub wMinorVerNum: u16, + pub wLibFlags: u16, +} +impl ::core::marker::Copy for TLIBATTR {} +impl ::core::clone::Clone for TLIBATTR { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct TYPEATTR { + pub guid: GUID, + pub lcid: u32, + pub dwReserved: u32, + pub memidConstructor: i32, + pub memidDestructor: i32, + pub lpstrSchema: PWSTR, + pub cbSizeInstance: u32, + pub typekind: TYPEKIND, + pub cFuncs: u16, + pub cVars: u16, + pub cImplTypes: u16, + pub cbSizeVft: u16, + pub cbAlignment: u16, + pub wTypeFlags: u16, + pub wMajorVerNum: u16, + pub wMinorVerNum: u16, + pub tdescAlias: TYPEDESC, + pub idldescType: IDLDESC, +} +impl ::core::marker::Copy for TYPEATTR {} +impl ::core::clone::Clone for TYPEATTR { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct TYPEDESC { + pub Anonymous: TYPEDESC_0, + pub vt: VARENUM, +} +impl ::core::marker::Copy for TYPEDESC {} +impl ::core::clone::Clone for TYPEDESC { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub union TYPEDESC_0 { + pub lptdesc: *mut TYPEDESC, + pub lpadesc: *mut ARRAYDESC, + pub hreftype: u32, +} +impl ::core::marker::Copy for TYPEDESC_0 {} +impl ::core::clone::Clone for TYPEDESC_0 { + fn clone(&self) -> Self { + *self + } +} +pub type TYPEKIND = i32; +#[repr(C)] +pub struct VARDESC { + pub memid: i32, + pub lpstrSchema: PWSTR, + pub Anonymous: VARDESC_0, + pub elemdescVar: ELEMDESC, + pub wVarFlags: VARFLAGS, + pub varkind: VARKIND, +} +impl ::core::marker::Copy for VARDESC {} +impl ::core::clone::Clone for VARDESC { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub union VARDESC_0 { + pub oInst: u32, + pub lpvarValue: *mut VARIANT, +} +impl ::core::marker::Copy for VARDESC_0 {} +impl ::core::clone::Clone for VARDESC_0 { + fn clone(&self) -> Self { + *self + } +} +pub type VARENUM = u16; +pub type VARFLAGS = u16; +#[repr(C)] +pub struct VARIANT { + pub Anonymous: VARIANT_0, +} +impl ::core::marker::Copy for VARIANT {} +impl ::core::clone::Clone for VARIANT { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub union VARIANT_0 { + pub Anonymous: VARIANT_0_0, + pub decVal: DECIMAL, +} +impl ::core::marker::Copy for VARIANT_0 {} +impl ::core::clone::Clone for VARIANT_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct VARIANT_0_0 { + pub vt: VARENUM, + pub wReserved1: u16, + pub wReserved2: u16, + pub wReserved3: u16, + pub Anonymous: VARIANT_0_0_0, +} +impl ::core::marker::Copy for VARIANT_0_0 {} +impl ::core::clone::Clone for VARIANT_0_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub union VARIANT_0_0_0 { + pub llVal: i64, + pub lVal: i32, + pub bVal: u8, + pub iVal: i16, + pub fltVal: f32, + pub dblVal: f64, + pub boolVal: VARIANT_BOOL, + pub __OBSOLETE__VARIANT_BOOL: VARIANT_BOOL, + pub scode: i32, + pub cyVal: CY, + pub date: f64, + pub bstrVal: BSTR, + pub punkVal: *mut ::core::ffi::c_void, + pub pdispVal: *mut ::core::ffi::c_void, + pub parray: *mut SAFEARRAY, + pub pbVal: *mut u8, + pub piVal: *mut i16, + pub plVal: *mut i32, + pub pllVal: *mut i64, + pub pfltVal: *mut f32, + pub pdblVal: *mut f64, + pub pboolVal: *mut VARIANT_BOOL, + pub __OBSOLETE__VARIANT_PBOOL: *mut VARIANT_BOOL, + pub pscode: *mut i32, + pub pcyVal: *mut CY, + pub pdate: *mut f64, + pub pbstrVal: *mut BSTR, + 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, + pub byref: *mut ::core::ffi::c_void, + pub cVal: i8, + pub uiVal: u16, + pub ulVal: u32, + pub ullVal: u64, + pub intVal: i32, + pub uintVal: u32, + pub pdecVal: *mut DECIMAL, + pub pcVal: PSTR, + pub puiVal: *mut u16, + pub pulVal: *mut u32, + pub pullVal: *mut u64, + pub pintVal: *mut i32, + pub puintVal: *mut u32, + pub Anonymous: VARIANT_0_0_0_0, +} +impl ::core::marker::Copy for VARIANT_0_0_0 {} +impl ::core::clone::Clone for VARIANT_0_0_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct VARIANT_0_0_0_0 { + pub pvRecord: *mut ::core::ffi::c_void, + pub pRecInfo: *mut ::core::ffi::c_void, +} +impl ::core::marker::Copy for VARIANT_0_0_0_0 {} +impl ::core::clone::Clone for VARIANT_0_0_0_0 { + fn clone(&self) -> Self { + *self + } +} +pub type VARIANT_BOOL = i16; +pub type VARKIND = i32; diff --git a/crates/tests/standalone/src/b_vtbl_2.rs b/crates/tests/standalone/src/b_vtbl_2.rs new file mode 100644 index 0000000000..eb5b02ebb1 --- /dev/null +++ b/crates/tests/standalone/src/b_vtbl_2.rs @@ -0,0 +1,69 @@ +// Bindings generated by `windows-bindgen` 0.52.0 + +#![allow( + non_snake_case, + non_upper_case_globals, + non_camel_case_types, + dead_code, + clippy::all +)] +#[repr(C)] +pub struct GUID { + pub data1: u32, + pub data2: u16, + pub data3: u16, + pub data4: [u8; 8], +} +impl ::core::marker::Copy for GUID {} +impl ::core::clone::Clone for GUID { + fn clone(&self) -> Self { + *self + } +} +impl GUID { + pub const fn from_u128(uuid: u128) -> Self { + Self { + data1: (uuid >> 96) as u32, + data2: (uuid >> 80 & 0xffff) as u16, + data3: (uuid >> 64 & 0xffff) as u16, + data4: (uuid as u64).to_be_bytes(), + } + } +} +pub type HRESULT = i32; +pub const IID_IActivationFactory: GUID = GUID::from_u128(0x00000035_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IActivationFactory_Vtbl { + pub base__: IInspectable_Vtbl, + pub ActivateInstance: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, +} +pub const IID_IInspectable: GUID = GUID::from_u128(0xaf86e2e0_b12d_4c6a_9c5a_d7aa65101e90); +#[repr(C)] +pub struct IInspectable_Vtbl { + pub base: IUnknown_Vtbl, + pub GetIids: unsafe extern "system" fn( + this: *mut std::ffi::c_void, + count: *mut u32, + values: *mut *mut GUID, + ) -> HRESULT, + pub GetRuntimeClassName: unsafe extern "system" fn( + this: *mut std::ffi::c_void, + value: *mut *mut std::ffi::c_void, + ) -> HRESULT, + pub GetTrustLevel: + unsafe extern "system" fn(this: *mut std::ffi::c_void, value: *mut i32) -> HRESULT, +} +pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IUnknown_Vtbl { + pub QueryInterface: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + iid: *const GUID, + interface: *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub AddRef: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> u32, + pub Release: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> u32, +} diff --git a/crates/tests/standalone/src/b_vtbl_3.rs b/crates/tests/standalone/src/b_vtbl_3.rs new file mode 100644 index 0000000000..d504558675 --- /dev/null +++ b/crates/tests/standalone/src/b_vtbl_3.rs @@ -0,0 +1,69 @@ +// Bindings generated by `windows-bindgen` 0.52.0 + +#![allow( + non_snake_case, + non_upper_case_globals, + non_camel_case_types, + dead_code, + clippy::all +)] +#[repr(C)] +pub struct GUID { + pub data1: u32, + pub data2: u16, + pub data3: u16, + pub data4: [u8; 8], +} +impl ::core::marker::Copy for GUID {} +impl ::core::clone::Clone for GUID { + fn clone(&self) -> Self { + *self + } +} +impl GUID { + pub const fn from_u128(uuid: u128) -> Self { + Self { + data1: (uuid >> 96) as u32, + data2: (uuid >> 80 & 0xffff) as u16, + data3: (uuid >> 64 & 0xffff) as u16, + data4: (uuid as u64).to_be_bytes(), + } + } +} +pub type HRESULT = i32; +pub const IID_IInspectable: GUID = GUID::from_u128(0xaf86e2e0_b12d_4c6a_9c5a_d7aa65101e90); +#[repr(C)] +pub struct IInspectable_Vtbl { + pub base: IUnknown_Vtbl, + pub GetIids: unsafe extern "system" fn( + this: *mut std::ffi::c_void, + count: *mut u32, + values: *mut *mut GUID, + ) -> HRESULT, + pub GetRuntimeClassName: unsafe extern "system" fn( + this: *mut std::ffi::c_void, + value: *mut *mut std::ffi::c_void, + ) -> HRESULT, + pub GetTrustLevel: + unsafe extern "system" fn(this: *mut std::ffi::c_void, value: *mut i32) -> HRESULT, +} +pub const IID_IStringable: GUID = GUID::from_u128(0x96369f54_8eb6_48f0_abce_c1b211e627c3); +#[repr(C)] +pub struct IStringable_Vtbl { + pub base__: IInspectable_Vtbl, + pub ToString: unsafe extern "system" fn( + *mut ::core::ffi::c_void, + *mut *mut ::core::ffi::c_void, + ) -> HRESULT, +} +pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IUnknown_Vtbl { + pub QueryInterface: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + iid: *const GUID, + interface: *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub AddRef: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> u32, + pub Release: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> u32, +} diff --git a/crates/tests/standalone/src/b_vtbl_4.rs b/crates/tests/standalone/src/b_vtbl_4.rs new file mode 100644 index 0000000000..1225282b18 --- /dev/null +++ b/crates/tests/standalone/src/b_vtbl_4.rs @@ -0,0 +1,64 @@ +// Bindings generated by `windows-bindgen` 0.52.0 + +#![allow( + non_snake_case, + non_upper_case_globals, + non_camel_case_types, + dead_code, + clippy::all +)] +pub type BOOL = i32; +#[repr(C)] +pub struct GUID { + pub data1: u32, + pub data2: u16, + pub data3: u16, + pub data4: [u8; 8], +} +impl ::core::marker::Copy for GUID {} +impl ::core::clone::Clone for GUID { + fn clone(&self) -> Self { + *self + } +} +impl GUID { + pub const fn from_u128(uuid: u128) -> Self { + Self { + data1: (uuid >> 96) as u32, + data2: (uuid >> 80 & 0xffff) as u16, + data3: (uuid >> 64 & 0xffff) as u16, + data4: (uuid as u64).to_be_bytes(), + } + } +} +pub type HRESULT = i32; +pub const IID_IPersist: GUID = GUID::from_u128(0x0000010c_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IPersist_Vtbl { + pub base__: IUnknown_Vtbl, + pub GetClassID: unsafe extern "system" fn(*mut ::core::ffi::c_void, *mut GUID) -> HRESULT, +} +pub const IID_IPersistFile: GUID = GUID::from_u128(0x0000010b_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IPersistFile_Vtbl { + pub base__: IPersist_Vtbl, + pub IsDirty: unsafe extern "system" fn(*mut ::core::ffi::c_void) -> HRESULT, + pub Load: unsafe extern "system" fn(*mut ::core::ffi::c_void, PCWSTR, STGM) -> HRESULT, + pub Save: unsafe extern "system" fn(*mut ::core::ffi::c_void, PCWSTR, BOOL) -> HRESULT, + pub SaveCompleted: unsafe extern "system" fn(*mut ::core::ffi::c_void, PCWSTR) -> HRESULT, + pub GetCurFile: unsafe extern "system" fn(*mut ::core::ffi::c_void, *mut PWSTR) -> HRESULT, +} +pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IUnknown_Vtbl { + pub QueryInterface: unsafe extern "system" fn( + this: *mut ::core::ffi::c_void, + iid: *const GUID, + interface: *mut *mut ::core::ffi::c_void, + ) -> HRESULT, + pub AddRef: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> u32, + pub Release: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> u32, +} +pub type PCWSTR = *const u16; +pub type PWSTR = *mut u16; +pub type STGM = u32; diff --git a/crates/tests/standalone/src/lib.rs b/crates/tests/standalone/src/lib.rs index 5ad4018b0c..973a8acb4f 100644 --- a/crates/tests/standalone/src/lib.rs +++ b/crates/tests/standalone/src/lib.rs @@ -27,6 +27,11 @@ mod b_unknown; mod b_uri; mod b_variant; mod b_win_enumerator; +mod b_vtbl_0; +mod b_vtbl_1; +mod b_vtbl_2; +mod b_vtbl_3; +mod b_vtbl_4; #[allow(non_snake_case)] mod included {