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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
use core::{ffi::c_void, ops::Deref};
use windows_core::{GUID, Interface};
/// This struct represents the COM `IHostControl` interface.
#[repr(C)]
#[derive(Clone, Debug)]
pub struct IHostControl(windows_core::IUnknown);
/// Trait representing the implementation of the `IHostControl` interface.
pub trait IHostControl_Impl: windows_core::IUnknownImpl {
/// Requests a host-provided manager object that implements the interface specified by `riid`.
fn GetHostManager(
&self,
riid: *const GUID,
ppobject: *mut *mut c_void,
) -> windows_core::Result<()>;
/// Notifies the host that the CLR has created an `AppDomainManager` for a new AppDomain.
fn SetAppDomainManager(
&self,
dwappdomainid: u32,
punkappdomainmanager: windows_core::Ref<'_, windows_core::IUnknown>,
) -> windows_core::Result<()>;
}
impl IHostControl_Vtbl {
/// Creates a new virtual table for the `IHostControl` implementation.
///
/// This table contains function pointers for each method exposed by the interface.
pub const fn new<Identity: IHostControl_Impl, const OFFSET: isize>() -> Self {
unsafe extern "system" fn GetHostManager<
Identity: IHostControl_Impl,
const OFFSET: isize,
>(
this: *mut c_void,
riid: *const GUID,
ppobject: *mut *mut c_void,
) -> windows_core::HRESULT {
unsafe {
let this: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
IHostControl_Impl::GetHostManager(
this,
core::mem::transmute_copy(&riid),
core::mem::transmute_copy(&ppobject),
)
.into()
}
}
unsafe extern "system" fn SetAppDomainManager<
Identity: IHostControl_Impl,
const OFFSET: isize,
>(
this: *mut c_void,
dwappdomainid: u32,
punkappdomainmanager: *mut c_void,
) -> windows_core::HRESULT {
unsafe {
let this: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
IHostControl_Impl::SetAppDomainManager(
this,
core::mem::transmute_copy(&dwappdomainid),
core::mem::transmute_copy(&punkappdomainmanager),
)
.into()
}
}
Self {
base__: windows_core::IUnknown_Vtbl::new::<Identity, OFFSET>(),
GetHostManager: GetHostManager::<Identity, OFFSET>,
SetAppDomainManager: SetAppDomainManager::<Identity, OFFSET>,
}
}
/// Verifies if a given interface ID matches `IHostControl`.
pub fn matches(iid: &windows_core::GUID) -> bool {
iid == &<IHostControl as windows_core::Interface>::IID
}
}
impl windows_core::RuntimeName for IHostControl {}
unsafe impl Interface for IHostControl {
type Vtable = IHostControl_Vtbl;
/// The interface identifier (IID) for the `IHostControl` COM interface.
///
/// This GUID is used to identify the `IHostControl` interface when calling
/// COM methods like `QueryInterface`. It is defined based on the standard
/// .NET CLR IID for the `IHostControl` interface.
const IID: GUID = GUID::from_u128(0x02ca073c_7079_4860_880a_c2f7a449c991);
}
impl Deref for IHostControl {
type Target = windows_core::IUnknown;
/// The interface identifier (IID) for the `IHostControl` COM interface.
///
/// This GUID is used to identify the `IHostControl` interface when calling
/// COM methods like `QueryInterface`. It is defined based on the standard
/// .NET CLR IID for the `IHostControl` interface.
fn deref(&self) -> &Self::Target {
unsafe { core::mem::transmute(self) }
}
}
/// Raw COM vtable for the `IHostControl` interface.
#[repr(C)]
pub struct IHostControl_Vtbl {
pub base__: windows_core::IUnknown_Vtbl,
// Methods specific to the COM interface
pub GetHostManager: unsafe extern "system" fn(
this: *mut c_void,
riid: *const GUID,
ppobject: *mut *mut c_void,
) -> windows_core::HRESULT,
pub SetAppDomainManager: unsafe extern "system" fn(
this: *mut c_void,
dwappdomainid: u32,
punkappdomainmanager: *mut c_void,
) -> windows_core::HRESULT,
}