From a63171582e563bd32d24465224908aa4a38407bb Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Tue, 11 May 2021 14:04:12 +0200 Subject: [PATCH] Revert "HACK: two deletion ptrs for Linux" This reverts commit 90c19594989992bca3b9e59265a57de2775f3db5. --- crates/gen/src/types/com_interface.rs | 4 +-- src/bindings.rs | 42 +++++++++------------------ src/interfaces/unknown.rs | 2 -- src/runtime/weak.rs | 2 +- src/runtime/weak_ref_count.rs | 6 ---- 5 files changed, 16 insertions(+), 40 deletions(-) diff --git a/crates/gen/src/types/com_interface.rs b/crates/gen/src/types/com_interface.rs index aa0bf70a0f..cecdce4ea0 100644 --- a/crates/gen/src/types/com_interface.rs +++ b/crates/gen/src/types/com_interface.rs @@ -125,7 +125,7 @@ impl ComInterface { to_ident(name) }; - let vtable_offset = Literal::usize_unsuffixed(vtable_offset + 5); + let vtable_offset = Literal::usize_unsuffixed(vtable_offset + 3); if signature.has_query_interface() { let leading_params = &signature.params[..signature.params.len() - 2]; @@ -233,8 +233,6 @@ impl ComInterface { pub unsafe extern "system" fn(this: ::windows::RawPtr, iid: &::windows::Guid, interface: *mut ::windows::RawPtr) -> ::windows::HRESULT, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, - pub unsafe extern "system" fn(this: ::windows::RawPtr), - pub unsafe extern "system" fn(this: ::windows::RawPtr), #(pub unsafe extern "system" fn #abi_signatures,)* ); diff --git a/src/bindings.rs b/src/bindings.rs index 66fb32c741..9bb82bffb0 100644 --- a/src/bindings.rs +++ b/src/bindings.rs @@ -2000,8 +2000,6 @@ pub mod Windows { ) -> ::windows::HRESULT, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, - pub unsafe extern "system" fn(this: ::windows::RawPtr), - pub unsafe extern "system" fn(this: ::windows::RawPtr), ); } #[allow( @@ -2492,13 +2490,13 @@ pub mod Windows { &self, pguid: *mut ::windows::Guid, ) -> ::windows::HRESULT { - (::windows::Interface::vtable(self).5)( + (::windows::Interface::vtable(self).3)( ::windows::Abi::abi(self), ::std::mem::transmute(pguid), ) } pub unsafe fn GetSource(&self, pbstrsource: *mut BSTR) -> ::windows::HRESULT { - (::windows::Interface::vtable(self).6)( + (::windows::Interface::vtable(self).4)( ::windows::Abi::abi(self), ::std::mem::transmute(pbstrsource), ) @@ -2507,7 +2505,7 @@ pub mod Windows { &self, pbstrdescription: *mut BSTR, ) -> ::windows::HRESULT { - (::windows::Interface::vtable(self).7)( + (::windows::Interface::vtable(self).5)( ::windows::Abi::abi(self), ::std::mem::transmute(pbstrdescription), ) @@ -2516,7 +2514,7 @@ pub mod Windows { &self, pbstrhelpfile: *mut BSTR, ) -> ::windows::HRESULT { - (::windows::Interface::vtable(self).8)( + (::windows::Interface::vtable(self).6)( ::windows::Abi::abi(self), ::std::mem::transmute(pbstrhelpfile), ) @@ -2525,7 +2523,7 @@ pub mod Windows { &self, pdwhelpcontext: *mut u32, ) -> ::windows::HRESULT { - (::windows::Interface::vtable(self).9)( + (::windows::Interface::vtable(self).7)( ::windows::Abi::abi(self), ::std::mem::transmute(pdwhelpcontext), ) @@ -2574,8 +2572,6 @@ pub mod Windows { ) -> ::windows::HRESULT, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, - pub unsafe extern "system" fn(this: ::windows::RawPtr), - pub unsafe extern "system" fn(this: ::windows::RawPtr), pub unsafe extern "system" fn( this: ::windows::RawPtr, pguid: *mut ::windows::Guid, @@ -3173,7 +3169,7 @@ pub mod Windows { &self, languageexception: *mut ::std::option::Option<::windows::IUnknown>, ) -> ::windows::HRESULT { - (::windows::Interface::vtable(self).5)( + (::windows::Interface::vtable(self).3)( ::windows::Abi::abi(self), ::std::mem::transmute(languageexception), ) @@ -3222,8 +3218,6 @@ pub mod Windows { ) -> ::windows::HRESULT, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, - pub unsafe extern "system" fn(this: ::windows::RawPtr), - pub unsafe extern "system" fn(this: ::windows::RawPtr), pub unsafe extern "system" fn( this: ::windows::RawPtr, languageexception: *mut ::windows::RawPtr, @@ -3242,7 +3236,7 @@ pub mod Windows { &self, languageexception: *mut ::std::option::Option<::windows::IUnknown>, ) -> ::windows::HRESULT { - (::windows::Interface::vtable(self).5)( + (::windows::Interface::vtable(self).3)( ::windows::Abi::abi(self), ::std::mem::transmute(languageexception), ) @@ -3253,7 +3247,7 @@ pub mod Windows { ILanguageExceptionErrorInfo2, >, ) -> ::windows::HRESULT { - (::windows::Interface::vtable(self).6)( + (::windows::Interface::vtable(self).4)( ::windows::Abi::abi(self), ::std::mem::transmute(previouslanguageexceptionerrorinfo), ) @@ -3262,7 +3256,7 @@ pub mod Windows { &self, languageexception: impl ::windows::IntoParam<'a, ::windows::IUnknown>, ) -> ::windows::HRESULT { - (::windows::Interface::vtable(self).7)( + (::windows::Interface::vtable(self).5)( ::windows::Abi::abi(self), languageexception.into_param().abi(), ) @@ -3273,7 +3267,7 @@ pub mod Windows { ILanguageExceptionErrorInfo2, >, ) -> ::windows::HRESULT { - (::windows::Interface::vtable(self).8)( + (::windows::Interface::vtable(self).6)( ::windows::Abi::abi(self), ::std::mem::transmute(propagatedlanguageexceptionerrorinfohead), ) @@ -3350,8 +3344,6 @@ pub mod Windows { ) -> ::windows::HRESULT, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, - pub unsafe extern "system" fn(this: ::windows::RawPtr), - pub unsafe extern "system" fn(this: ::windows::RawPtr), pub unsafe extern "system" fn( this: ::windows::RawPtr, languageexception: *mut ::windows::RawPtr, @@ -3385,7 +3377,7 @@ pub mod Windows { restricteddescription: *mut super::OleAutomation::BSTR, capabilitysid: *mut super::OleAutomation::BSTR, ) -> ::windows::HRESULT { - (::windows::Interface::vtable(self).5)( + (::windows::Interface::vtable(self).3)( ::windows::Abi::abi(self), ::std::mem::transmute(description), ::std::mem::transmute(error), @@ -3397,7 +3389,7 @@ pub mod Windows { &self, reference: *mut super::OleAutomation::BSTR, ) -> ::windows::HRESULT { - (::windows::Interface::vtable(self).6)( + (::windows::Interface::vtable(self).4)( ::windows::Abi::abi(self), ::std::mem::transmute(reference), ) @@ -3448,8 +3440,6 @@ pub mod Windows { ) -> ::windows::HRESULT, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, - pub unsafe extern "system" fn(this: ::windows::RawPtr), - pub unsafe extern "system" fn(this: ::windows::RawPtr), pub unsafe extern "system" fn( this: ::windows::RawPtr, description: *mut super::OleAutomation::BSTR_abi, @@ -3473,7 +3463,7 @@ pub mod Windows { impl IWeakReference { pub unsafe fn Resolve(&self) -> ::windows::Result { let mut result__ = ::std::option::Option::None; - (::windows::Interface::vtable(self).5)( + (::windows::Interface::vtable(self).3)( ::windows::Abi::abi(self), &::IID, ::windows::Abi::set_abi(&mut result__), @@ -3520,8 +3510,6 @@ pub mod Windows { ) -> ::windows::HRESULT, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, - pub unsafe extern "system" fn(this: ::windows::RawPtr), - pub unsafe extern "system" fn(this: ::windows::RawPtr), pub unsafe extern "system" fn( this: ::windows::RawPtr, riid: *const ::windows::Guid, @@ -3541,7 +3529,7 @@ pub mod Windows { &self, weakreference: *mut ::std::option::Option, ) -> ::windows::HRESULT { - (::windows::Interface::vtable(self).5)( + (::windows::Interface::vtable(self).3)( ::windows::Abi::abi(self), ::std::mem::transmute(weakreference), ) @@ -3586,8 +3574,6 @@ pub mod Windows { ) -> ::windows::HRESULT, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::RawPtr) -> u32, - pub unsafe extern "system" fn(this: ::windows::RawPtr), - pub unsafe extern "system" fn(this: ::windows::RawPtr), pub unsafe extern "system" fn( this: ::windows::RawPtr, weakreference: *mut ::windows::RawPtr, diff --git a/src/interfaces/unknown.rs b/src/interfaces/unknown.rs index 7fdcf46d9e..be454ce2e6 100644 --- a/src/interfaces/unknown.rs +++ b/src/interfaces/unknown.rs @@ -12,8 +12,6 @@ pub struct IUnknown_abi( pub unsafe extern "system" fn(this: RawPtr, iid: *const Guid, interface: *mut RawPtr) -> HRESULT, pub unsafe extern "system" fn(this: RawPtr) -> u32, pub unsafe extern "system" fn(this: RawPtr) -> u32, - pub unsafe extern "system" fn(this: RawPtr), - pub unsafe extern "system" fn(this: RawPtr), ); unsafe impl Interface for IUnknown { diff --git a/src/runtime/weak.rs b/src/runtime/weak.rs index fd3b02697c..9374fccbb1 100644 --- a/src/runtime/weak.rs +++ b/src/runtime/weak.rs @@ -17,7 +17,7 @@ impl Weak { self.0.as_ref().and_then(|inner| unsafe { // Calls IWeakReference's Resolve ABI directly as the metadata incorrectly types it as returning IInspectable. let mut result = None; - let _ = (inner.vtable().5)(inner.abi(), &I::IID, &mut result as *mut _ as _); + let _ = (inner.vtable().3)(inner.abi(), &I::IID, &mut result as *mut _ as _); result }) } diff --git a/src/runtime/weak_ref_count.rs b/src/runtime/weak_ref_count.rs index 5f3570ef75..df6363ddc2 100644 --- a/src/runtime/weak_ref_count.rs +++ b/src/runtime/weak_ref_count.rs @@ -137,8 +137,6 @@ struct TearOff { weak_count: RefCount, } -unsafe extern "system" fn dummy_dtor(this: RawPtr) {} - impl TearOff { unsafe fn new(object: RawPtr, strong_count: u32) -> IWeakReferenceSource { std::mem::transmute(Box::new(TearOff { @@ -160,8 +158,6 @@ impl TearOff { Self::StrongQueryInterface, Self::StrongAddRef, Self::StrongRelease, - dummy_dtor, - dummy_dtor, Self::StrongDowngrade, ); @@ -169,8 +165,6 @@ impl TearOff { Self::WeakQueryInterface, Self::WeakAddRef, Self::WeakRelease, - dummy_dtor, - dummy_dtor, Self::WeakUpgrade, );