Skip to content

Commit

Permalink
Revert "HACK: two deletion ptrs for Linux"
Browse files Browse the repository at this point in the history
This reverts commit 90c1959.
  • Loading branch information
MarijnS95 committed May 13, 2021
1 parent 1bc7c52 commit a631715
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 40 deletions.
4 changes: 1 addition & 3 deletions crates/gen/src/types/com_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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,)*
);

Expand Down
42 changes: 14 additions & 28 deletions src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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),
)
Expand All @@ -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),
)
Expand All @@ -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),
)
Expand All @@ -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),
)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
)
Expand Down Expand Up @@ -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,
Expand All @@ -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),
)
Expand All @@ -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),
)
Expand All @@ -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(),
)
Expand All @@ -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),
)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand All @@ -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),
)
Expand Down Expand Up @@ -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,
Expand All @@ -3473,7 +3463,7 @@ pub mod Windows {
impl IWeakReference {
pub unsafe fn Resolve<T: ::windows::Interface>(&self) -> ::windows::Result<T> {
let mut result__ = ::std::option::Option::None;
(::windows::Interface::vtable(self).5)(
(::windows::Interface::vtable(self).3)(
::windows::Abi::abi(self),
&<T as ::windows::Interface>::IID,
::windows::Abi::set_abi(&mut result__),
Expand Down Expand Up @@ -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,
Expand All @@ -3541,7 +3529,7 @@ pub mod Windows {
&self,
weakreference: *mut ::std::option::Option<IWeakReference>,
) -> ::windows::HRESULT {
(::windows::Interface::vtable(self).5)(
(::windows::Interface::vtable(self).3)(
::windows::Abi::abi(self),
::std::mem::transmute(weakreference),
)
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions src/interfaces/unknown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/weak.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl<I: Interface> Weak<I> {
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
})
}
Expand Down
6 changes: 0 additions & 6 deletions src/runtime/weak_ref_count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -160,17 +158,13 @@ impl TearOff {
Self::StrongQueryInterface,
Self::StrongAddRef,
Self::StrongRelease,
dummy_dtor,
dummy_dtor,
Self::StrongDowngrade,
);

const WEAK_VTABLE: IWeakReference_abi = IWeakReference_abi(
Self::WeakQueryInterface,
Self::WeakAddRef,
Self::WeakRelease,
dummy_dtor,
dummy_dtor,
Self::WeakUpgrade,
);

Expand Down

0 comments on commit a631715

Please sign in to comment.