-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathunknown.rs
46 lines (44 loc) · 2.41 KB
/
unknown.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#[cfg(not(windows))]
use crate::os::HRESULT;
use com::{interfaces, interfaces::IUnknown};
#[cfg(not(windows))]
interfaces! {
/// Insert complete object and deleting destructor on non-Windows platforms, where Dxc shims IUnknown in WinAdapter.
/// This requires a virtual destructor (delete is actually used on the base class) which unfortunately makes the struct
/// binary incompatible.
///
/// See the third and fourth entry:
/// ```cmd
/// vtable for 'DxcLibrary' @ 0x7ffff7cbc5f8 (subobject @ 0x5555556bb9e0):
/// [0]: 0x7ffff6a56d40 <DxcLibrary::QueryInterface(_GUID const&, void**)>
/// [1]: 0x7ffff6a56d20 <DxcLibrary::AddRef()>
/// [2]: 0x7ffff6a56d30 <DxcLibrary::Release()>
/// [3]: 0x7ffff6b36bc0 <IUnknown::~IUnknown()>
/// [4]: 0x7ffff6a57130 <DxcLibrary::~DxcLibrary()>
/// [5]: 0x7ffff6a56d50 <DxcLibrary::SetMalloc(IMalloc*)>
/// [6]: 0x7ffff6a56d60 <DxcLibrary::CreateBlobFromBlob(IDxcBlob*, unsigned int, unsigned int, IDxcBlob**)>
/// [7]: 0x7ffff6a56d70 <DxcLibrary::CreateBlobFromFile(wchar_t const*, unsigned int*, IDxcBlobEncoding**)>
/// [8]: 0x7ffff6a56d80 <DxcLibrary::CreateBlobWithEncodingFromPinned(void const*, unsigned int, unsigned int, IDxcBlobEncoding**)>
/// [9]: 0x7ffff6a56d90 <DxcLibrary::CreateBlobWithEncodingOnHeapCopy(void const*, unsigned int, unsigned int, IDxcBlobEncoding**)>
/// [10]: 0x7ffff6a56da0 <DxcLibrary::CreateBlobWithEncodingOnMalloc(void const*, IMalloc*, unsigned int, unsigned int, IDxcBlobEncoding**)>
/// [11]: 0x7ffff6a56db0 <DxcLibrary::CreateIncludeHandler(IDxcIncludeHandler**)>
/// [12]: 0x7ffff6a56dc0 <DxcLibrary::CreateStreamFromBlobReadOnly(IDxcBlob*, IStream**)>
/// [13]: 0x7ffff6a56dd0 <DxcLibrary::GetBlobAsUtf8(IDxcBlob*, IDxcBlobEncoding**)>
/// [14]: 0x7ffff6a56e90 <DxcLibrary::GetBlobAsUtf16(IDxcBlob*, IDxcBlobEncoding**)>
/// ```
// Steal the interface ID from IUnknown:
#[uuid("00000000-0000-0000-C000-000000000046")]
pub(crate) unsafe interface IDxcUnknownShim: IUnknown {
fn complete_object_destructor(&self) -> HRESULT;
fn deleting_destructor(&self) -> HRESULT;
}
}
#[cfg(windows)]
// pub(crate) type IDxcUnknownShim = IUnknown;
interfaces! {
/// Forwards to IUnknown. No-op on Windows
// Steal the interface ID from IUnknown:
#[uuid("00000000-0000-0000-C000-000000000046")]
pub(crate) unsafe interface IDxcUnknownShim: IUnknown {
}
}