diff --git a/crates/libs/bindgen/src/rust/delegates.rs b/crates/libs/bindgen/src/rust/delegates.rs index bcb7bcdf87..f601c303f6 100644 --- a/crates/libs/bindgen/src/rust/delegates.rs +++ b/crates/libs/bindgen/src/rust/delegates.rs @@ -105,6 +105,10 @@ fn gen_win_delegate(writer: &Writer, def: TypeDef) -> TokenStream { unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); // E_POINTER + } + *interface = if *iid == <#ident as ::windows_core::ComInterface>::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { diff --git a/crates/libs/core/src/imp/weak_ref_count.rs b/crates/libs/core/src/imp/weak_ref_count.rs index ee46a6bc33..1f6a70a28a 100644 --- a/crates/libs/core/src/imp/weak_ref_count.rs +++ b/crates/libs/core/src/imp/weak_ref_count.rs @@ -126,6 +126,10 @@ impl TearOff { unsafe extern "system" fn StrongQueryInterface(ptr: *mut std::ffi::c_void, iid: *const crate::GUID, interface: *mut *mut std::ffi::c_void) -> crate::HRESULT { let this = Self::from_strong_ptr(ptr); + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); // E_POINTER + } + // Only directly respond to queries for the the tear-off's strong interface. This is // effectively a self-query. if *iid == IWeakReferenceSource::IID { @@ -142,6 +146,10 @@ impl TearOff { unsafe extern "system" fn WeakQueryInterface(ptr: *mut std::ffi::c_void, iid: *const crate::GUID, interface: *mut *mut std::ffi::c_void) -> crate::HRESULT { let this = Self::from_weak_ptr(ptr); + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); // E_POINTER + } + // While the weak vtable is packed into the same allocation as the strong vtable and // tear-off, it represents a distinct COM identity and thus does not share or delegate to // the object. diff --git a/crates/libs/implement/src/lib.rs b/crates/libs/implement/src/lib.rs index e26f8fc5a2..095a854d38 100644 --- a/crates/libs/implement/src/lib.rs +++ b/crates/libs/implement/src/lib.rs @@ -64,16 +64,14 @@ pub fn implement(attributes: proc_macro::TokenStream, original_type: proc_macro: } } impl #generics ::windows::core::AsImpl<#original_ident::#generics> for #interface_ident where #constraints { + // SAFETY: the offset is guranteed to be in bounds, and the implementation struct + // is guaranteed to live at least as long as `self`. unsafe fn as_impl(&self) -> &#original_ident::#generics { let this = ::windows::core::Interface::as_raw(self); - // SAFETY: the offset is guranteed to be in bounds, and the implementation struct - // is guaranteed to live at least as long as `self`. - unsafe { - // Subtract away the vtable offset plus 1, for the `identity` field, to get - // to the impl struct which contains that original implementation type. - let this = (this as *mut *mut ::core::ffi::c_void).sub(1 + #offset) as *mut #impl_ident::#generics; - &(*this).this - } + // Subtract away the vtable offset plus 1, for the `identity` field, to get + // to the impl struct which contains that original implementation type. + let this = (this as *mut *mut ::core::ffi::c_void).sub(1 + #offset) as *mut #impl_ident::#generics; + &(*this).this } } } @@ -105,27 +103,29 @@ pub fn implement(attributes: proc_macro::TokenStream, original_type: proc_macro: &self.this } unsafe fn QueryInterface(&self, iid: *const ::windows::core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT { - unsafe { - *interface = if *iid == <::windows::core::IUnknown as ::windows::core::ComInterface>::IID - || *iid == <::windows::core::IInspectable as ::windows::core::ComInterface>::IID - || *iid == <::windows::core::imp::IAgileObject as ::windows::core::ComInterface>::IID { - &self.identity as *const _ as *mut _ - } #(#queries)* else { - ::core::ptr::null_mut() - }; - - if !(*interface).is_null() { - self.count.add_ref(); - return ::windows::core::HRESULT(0); - } + if iid.is_null() || interface.is_null() { + return ::windows::core::HRESULT(-2147467261); // E_POINTER + } - *interface = self.count.query(iid, &self.identity as *const _ as *mut _); + *interface = if *iid == <::windows::core::IUnknown as ::windows::core::ComInterface>::IID + || *iid == <::windows::core::IInspectable as ::windows::core::ComInterface>::IID + || *iid == <::windows::core::imp::IAgileObject as ::windows::core::ComInterface>::IID { + &self.identity as *const _ as *mut _ + } #(#queries)* else { + ::core::ptr::null_mut() + }; - if (*interface).is_null() { - ::windows::core::HRESULT(0x8000_4002) // E_NOINTERFACE - } else { - ::windows::core::HRESULT(0) - } + if !(*interface).is_null() { + self.count.add_ref(); + return ::windows::core::HRESULT(0); + } + + *interface = self.count.query(iid, &self.identity as *const _ as *mut _); + + if (*interface).is_null() { + ::windows::core::HRESULT(-2147467262) // E_NOINTERFACE + } else { + ::windows::core::HRESULT(0) } } fn AddRef(&self) -> u32 { @@ -134,9 +134,7 @@ pub fn implement(attributes: proc_macro::TokenStream, original_type: proc_macro: unsafe fn Release(&self) -> u32 { let remaining = self.count.release(); if remaining == 0 { - unsafe { - _ = ::std::boxed::Box::from_raw(self as *const Self as *mut Self); - } + _ = ::std::boxed::Box::from_raw(self as *const Self as *mut Self); } remaining } diff --git a/crates/libs/windows/src/Windows/ApplicationModel/Background/mod.rs b/crates/libs/windows/src/Windows/ApplicationModel/Background/mod.rs index b9101f746e..f853263d55 100644 --- a/crates/libs/windows/src/Windows/ApplicationModel/Background/mod.rs +++ b/crates/libs/windows/src/Windows/ApplicationModel/Background/mod.rs @@ -5826,6 +5826,9 @@ impl, BackgroundTaskCa }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -5897,6 +5900,9 @@ impl, ::core::optio }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -5968,6 +5974,9 @@ impl, ::core::optio }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/ApplicationModel/DataTransfer/mod.rs b/crates/libs/windows/src/Windows/ApplicationModel/DataTransfer/mod.rs index 60513d3649..c66edc4d9b 100644 --- a/crates/libs/windows/src/Windows/ApplicationModel/DataTransfer/mod.rs +++ b/crates/libs/windows/src/Windows/ApplicationModel/DataTransfer/mod.rs @@ -3304,6 +3304,9 @@ impl) -> ::windows_core::R }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -3374,6 +3377,9 @@ impl) -> ::windows_core }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/ApplicationModel/Payments/mod.rs b/crates/libs/windows/src/Windows/ApplicationModel/Payments/mod.rs index 53f6f257aa..87ff5172cd 100644 --- a/crates/libs/windows/src/Windows/ApplicationModel/Payments/mod.rs +++ b/crates/libs/windows/src/Windows/ApplicationModel/Payments/mod.rs @@ -2249,6 +2249,9 @@ impl, ::core::option::Option<&P }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/ApplicationModel/Store/mod.rs b/crates/libs/windows/src/Windows/ApplicationModel/Store/mod.rs index f59d9363a4..a2744dd5ca 100644 --- a/crates/libs/windows/src/Windows/ApplicationModel/Store/mod.rs +++ b/crates/libs/windows/src/Windows/ApplicationModel/Store/mod.rs @@ -1496,6 +1496,9 @@ impl ::windows_core::Result<()> + ::core::marker::Send + 'static> }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Data/Text/mod.rs b/crates/libs/windows/src/Windows/Data/Text/mod.rs index 67138675c1..841a96a960 100644 --- a/crates/libs/windows/src/Windows/Data/Text/mod.rs +++ b/crates/libs/windows/src/Windows/Data/Text/mod.rs @@ -1334,6 +1334,9 @@ impl ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -1418,6 +1421,9 @@ impl ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Devices/SmartCards/mod.rs b/crates/libs/windows/src/Windows/Devices/SmartCards/mod.rs index 998e2f94e8..3a9bc4dc4b 100644 --- a/crates/libs/windows/src/Windows/Devices/SmartCards/mod.rs +++ b/crates/libs/windows/src/Windows/Devices/SmartCards/mod.rs @@ -4530,6 +4530,9 @@ impl, ::core::option::Op }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Devices/Sms/mod.rs b/crates/libs/windows/src/Windows/Devices/Sms/mod.rs index c8d39b624e..ce18f0407c 100644 --- a/crates/libs/windows/src/Windows/Devices/Sms/mod.rs +++ b/crates/libs/windows/src/Windows/Devices/Sms/mod.rs @@ -4413,6 +4413,9 @@ impl) -> ::windows_core::Result<()> }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -4497,6 +4500,9 @@ impl, ::core::option::Option<&SmsMes }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Foundation/Collections/mod.rs b/crates/libs/windows/src/Windows/Foundation/Collections/mod.rs index 230bccc736..8f818e0398 100644 --- a/crates/libs/windows/src/Windows/Foundation/Collections/mod.rs +++ b/crates/libs/windows/src/Windows/Foundation/Collections/mod.rs @@ -1488,6 +1488,9 @@ impl ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == as ::windows_core::ComInterface>::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -1571,6 +1574,9 @@ impl ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == as ::windows_core::ComInterface>::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Foundation/mod.rs b/crates/libs/windows/src/Windows/Foundation/mod.rs index 590f5a2830..8f78a6630a 100644 --- a/crates/libs/windows/src/Windows/Foundation/mod.rs +++ b/crates/libs/windows/src/Windows/Foundation/mod.rs @@ -2801,6 +2801,9 @@ impl, AsyncStatus) -> ::windows_c }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -2878,6 +2881,9 @@ impl ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == as ::windows_core::ComInterface>::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -2958,6 +2964,9 @@ impl ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == as ::windows_core::ComInterface>::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -3038,6 +3047,9 @@ impl ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == as ::windows_core::ComInterface>::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -3122,6 +3134,9 @@ impl ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == as ::windows_core::ComInterface>::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -3207,6 +3222,9 @@ impl ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == as ::windows_core::ComInterface>::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -3280,6 +3298,9 @@ impl ::windows_core::Result<()> + ::core::marker::Send + 'static> }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -3357,6 +3378,9 @@ impl ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == as ::windows_core::ComInterface>::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -3441,6 +3465,9 @@ impl ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == as ::windows_core::ComInterface>::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Gaming/Preview/GamesEnumeration/mod.rs b/crates/libs/windows/src/Windows/Gaming/Preview/GamesEnumeration/mod.rs index 5f44a27f43..198c443e74 100644 --- a/crates/libs/windows/src/Windows/Gaming/Preview/GamesEnumeration/mod.rs +++ b/crates/libs/windows/src/Windows/Gaming/Preview/GamesEnumeration/mod.rs @@ -849,6 +849,9 @@ impl) -> ::windows_core::Result< }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -916,6 +919,9 @@ impl ::windows_core::Result<()> + ::core:: }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Graphics/Display/mod.rs b/crates/libs/windows/src/Windows/Graphics/Display/mod.rs index 0138aae6fb..914efd4603 100644 --- a/crates/libs/windows/src/Windows/Graphics/Display/mod.rs +++ b/crates/libs/windows/src/Windows/Graphics/Display/mod.rs @@ -1950,6 +1950,9 @@ impl) -> ::window }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Graphics/Printing/mod.rs b/crates/libs/windows/src/Windows/Graphics/Printing/mod.rs index d43953eb37..888be7a4d6 100644 --- a/crates/libs/windows/src/Windows/Graphics/Printing/mod.rs +++ b/crates/libs/windows/src/Windows/Graphics/Printing/mod.rs @@ -2392,6 +2392,9 @@ impl) -> ::window }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Graphics/Printing3D/mod.rs b/crates/libs/windows/src/Windows/Graphics/Printing3D/mod.rs index 3c15de37ec..fb5a755c54 100644 --- a/crates/libs/windows/src/Windows/Graphics/Printing3D/mod.rs +++ b/crates/libs/windows/src/Windows/Graphics/Printing3D/mod.rs @@ -3068,6 +3068,9 @@ impl) -> ::wind }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Media/Capture/mod.rs b/crates/libs/windows/src/Windows/Media/Capture/mod.rs index 6ec87ff165..495703207c 100644 --- a/crates/libs/windows/src/Windows/Media/Capture/mod.rs +++ b/crates/libs/windows/src/Windows/Media/Capture/mod.rs @@ -10823,6 +10823,9 @@ impl, ::core::option::Option<&Med }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -10893,6 +10896,9 @@ impl) -> ::windows_core::Result<( }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Media/Devices/mod.rs b/crates/libs/windows/src/Windows/Media/Devices/mod.rs index 2996c71c57..72e92dfb43 100644 --- a/crates/libs/windows/src/Windows/Media/Devices/mod.rs +++ b/crates/libs/windows/src/Windows/Media/Devices/mod.rs @@ -5870,6 +5870,9 @@ impl) -> ::windows_core::Result<() }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -5941,6 +5944,9 @@ impl, ::core::option::Option<&Dial }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -6012,6 +6018,9 @@ impl, ::core::option::Option<&Keyp }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -6083,6 +6092,9 @@ impl, ::core::option::Option<&Redi }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Media/Protection/mod.rs b/crates/libs/windows/src/Windows/Media/Protection/mod.rs index c7334bdfac..a3e9bfbe78 100644 --- a/crates/libs/windows/src/Windows/Media/Protection/mod.rs +++ b/crates/libs/windows/src/Windows/Media/Protection/mod.rs @@ -1025,6 +1025,9 @@ impl, ::core::option::O }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -1095,6 +1098,9 @@ impl) -> ::windows_core }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -1166,6 +1172,9 @@ impl, ::core::option::O }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Networking/Connectivity/mod.rs b/crates/libs/windows/src/Windows/Networking/Connectivity/mod.rs index 773eac2264..4806a8f622 100644 --- a/crates/libs/windows/src/Windows/Networking/Connectivity/mod.rs +++ b/crates/libs/windows/src/Windows/Networking/Connectivity/mod.rs @@ -3077,6 +3077,9 @@ impl) -> ::window }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Networking/Proximity/mod.rs b/crates/libs/windows/src/Windows/Networking/Proximity/mod.rs index 41fca96b10..0b0fcca67f 100644 --- a/crates/libs/windows/src/Windows/Networking/Proximity/mod.rs +++ b/crates/libs/windows/src/Windows/Networking/Proximity/mod.rs @@ -1166,6 +1166,9 @@ impl) -> ::windows_core::Resul }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -1236,6 +1239,9 @@ impl) -> ::windows_core::Resul }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -1307,6 +1313,9 @@ impl, ::core::option::Option<& }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -1377,6 +1386,9 @@ impl, i64) -> ::windows_core:: }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Security/Isolation/mod.rs b/crates/libs/windows/src/Windows/Security/Isolation/mod.rs index 9deb9b6741..37ab588174 100644 --- a/crates/libs/windows/src/Windows/Security/Isolation/mod.rs +++ b/crates/libs/windows/src/Windows/Security/Isolation/mod.rs @@ -2402,6 +2402,9 @@ impl ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -2485,6 +2488,9 @@ impl ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/Storage/mod.rs b/crates/libs/windows/src/Windows/Storage/mod.rs index 183c0e3dbb..063151c983 100644 --- a/crates/libs/windows/src/Windows/Storage/mod.rs +++ b/crates/libs/windows/src/Windows/Storage/mod.rs @@ -6691,6 +6691,9 @@ impl) -> ::windows_core::Res }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -6767,6 +6770,9 @@ impl) -> ::windows_cor }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/System/RemoteDesktop/Input/mod.rs b/crates/libs/windows/src/Windows/System/RemoteDesktop/Input/mod.rs index b7278abd78..26de519ba1 100644 --- a/crates/libs/windows/src/Windows/System/RemoteDesktop/Input/mod.rs +++ b/crates/libs/windows/src/Windows/System/RemoteDesktop/Input/mod.rs @@ -130,6 +130,9 @@ impl ::windows_core::Result + ::core::marker::Send + 's }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/System/Threading/Core/mod.rs b/crates/libs/windows/src/Windows/System/Threading/Core/mod.rs index 908a6aeb3a..ee21f88534 100644 --- a/crates/libs/windows/src/Windows/System/Threading/Core/mod.rs +++ b/crates/libs/windows/src/Windows/System/Threading/Core/mod.rs @@ -258,6 +258,9 @@ impl, bool) -> ::windows_core:: }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/System/Threading/mod.rs b/crates/libs/windows/src/Windows/System/Threading/mod.rs index 67749a34d2..44168d341c 100644 --- a/crates/libs/windows/src/Windows/System/Threading/mod.rs +++ b/crates/libs/windows/src/Windows/System/Threading/mod.rs @@ -345,6 +345,9 @@ impl) -> ::windows_core::Resul }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -415,6 +418,9 @@ impl) -> ::windows_core::Resul }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -491,6 +497,9 @@ impl) - }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/System/mod.rs b/crates/libs/windows/src/Windows/System/mod.rs index 351796e4ad..a4511338c7 100644 --- a/crates/libs/windows/src/Windows/System/mod.rs +++ b/crates/libs/windows/src/Windows/System/mod.rs @@ -6140,6 +6140,9 @@ impl ::windows_core::Result<()> + ::core::marker::Send + 'static> }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/UI/ApplicationSettings/mod.rs b/crates/libs/windows/src/Windows/UI/ApplicationSettings/mod.rs index b5ea41c562..bf5f08f41e 100644 --- a/crates/libs/windows/src/Windows/UI/ApplicationSettings/mod.rs +++ b/crates/libs/windows/src/Windows/UI/ApplicationSettings/mod.rs @@ -1255,6 +1255,9 @@ impl) -> ::windows_core::Res }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -1326,6 +1329,9 @@ impl, ::core::option::Option }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -1396,6 +1402,9 @@ impl) -> ::windows_c }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/UI/Core/mod.rs b/crates/libs/windows/src/Windows/UI/Core/mod.rs index 5ef8ce627c..5e48c7b2be 100644 --- a/crates/libs/windows/src/Windows/UI/Core/mod.rs +++ b/crates/libs/windows/src/Windows/UI/Core/mod.rs @@ -5579,6 +5579,9 @@ impl ::windows_core::Result<()> + ::core::marker::Send + 'static> }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -5649,6 +5652,9 @@ impl) -> ::windows_c }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/UI/Popups/mod.rs b/crates/libs/windows/src/Windows/UI/Popups/mod.rs index 53fe8cd826..bbae6beba4 100644 --- a/crates/libs/windows/src/Windows/UI/Popups/mod.rs +++ b/crates/libs/windows/src/Windows/UI/Popups/mod.rs @@ -626,6 +626,9 @@ impl) -> ::windows_core::Result<()> }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/UI/WebUI/Core/mod.rs b/crates/libs/windows/src/Windows/UI/WebUI/Core/mod.rs index 5ea3b9f468..cc00d79a2b 100644 --- a/crates/libs/windows/src/Windows/UI/WebUI/Core/mod.rs +++ b/crates/libs/windows/src/Windows/UI/WebUI/Core/mod.rs @@ -857,6 +857,9 @@ impl ::windows_core::Result<()> + ::core::marker::Send + 'static> }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -924,6 +927,9 @@ impl ::windows_core::Result<()> + ::core::marker::Send + 'static> }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -994,6 +1000,9 @@ impl) -> : }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/libs/windows/src/Windows/UI/WebUI/mod.rs b/crates/libs/windows/src/Windows/UI/WebUI/mod.rs index 03f84634dc..7d9d516396 100644 --- a/crates/libs/windows/src/Windows/UI/WebUI/mod.rs +++ b/crates/libs/windows/src/Windows/UI/WebUI/mod.rs @@ -6250,6 +6250,9 @@ impl, ::core::opt }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -6334,6 +6337,9 @@ impl, ::core::opt }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -6418,6 +6424,9 @@ impl, ::core::opt }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -6502,6 +6511,9 @@ impl, ::core::opt }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -6580,6 +6592,9 @@ impl, ::core::opt }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -6650,6 +6665,9 @@ impl) -> ::window }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) @@ -6727,6 +6745,9 @@ impl, ::core::opt }; unsafe extern "system" fn QueryInterface(this: *mut ::core::ffi::c_void, iid: *const ::windows_core::GUID, interface: *mut *mut ::core::ffi::c_void) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows_core::HRESULT(-2147467262) diff --git a/crates/tests/component/src/bindings.rs b/crates/tests/component/src/bindings.rs index 4ba48a1b39..a327809a66 100644 --- a/crates/tests/component/src/bindings.rs +++ b/crates/tests/component/src/bindings.rs @@ -386,6 +386,9 @@ impl ::windows_core::Result + ::core::marker::Send + 'stat interface: *mut *mut ::core::ffi::c_void, ) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID diff --git a/crates/tests/component_client/src/bindings.rs b/crates/tests/component_client/src/bindings.rs index ba52fcd11e..0d8d3b0aa0 100644 --- a/crates/tests/component_client/src/bindings.rs +++ b/crates/tests/component_client/src/bindings.rs @@ -354,6 +354,9 @@ impl ::windows_core::Result + ::core::marker::Send + 'stat interface: *mut *mut ::core::ffi::c_void, ) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; + if iid.is_null() || interface.is_null() { + return ::windows_core::HRESULT(-2147467261); + } *interface = if *iid == ::IID || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID diff --git a/crates/tests/implement/tests/query.rs b/crates/tests/implement/tests/query.rs new file mode 100644 index 0000000000..dc01b93e33 --- /dev/null +++ b/crates/tests/implement/tests/query.rs @@ -0,0 +1,63 @@ +use windows::{core::*, Foundation::*, Win32::Foundation::*, Win32::System::WinRT::*}; + +#[implement(IStringable)] +struct Stringable; + +impl IStringable_Impl for Stringable { + fn ToString(&self) -> Result { + todo!() + } +} + +#[test] +fn test() { + unsafe { + // This covers the four distinct implementations of QueryInterface. + + let delegate: EventHandler = EventHandler::::new(move |_, _| todo!()); + test_query(&delegate); + + let interface: IStringable = Stringable.into(); + test_query(&interface); + + let source: IWeakReferenceSource = interface.cast().unwrap(); + test_query(&source); + + let weak = source.GetWeakReference().unwrap(); + test_query(&weak); + } +} + +fn test_query(interface: &I) { + unsafe { + // Successful query + { + let mut unknown: Option = None; + let hr = interface.query(&IUnknown::IID, &mut unknown as *mut _ as *mut _); + assert_eq!(hr, S_OK); + assert_eq!(interface.cast::().unwrap(), unknown.unwrap()); + } + + // Unsuccessful query + { + let mut closable: Option = None; + let hr = interface.query(&IClosable::IID, &mut closable as *mut _ as *mut _); + assert_eq!(hr, E_NOINTERFACE); + assert_eq!(closable, None); + } + + // iid param is null + { + let mut unknown: Option = None; + let hr = interface.query(std::ptr::null(), &mut unknown as *mut _ as *mut _); + assert_eq!(hr, E_POINTER); + assert_eq!(unknown, None); + } + + // interface param is null + { + let hr = interface.query(&IUnknown::IID, std::ptr::null_mut()); + assert_eq!(hr, E_POINTER); + } + } +}