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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
use core::{ffi::c_void, mem::transmute_copy, ops::Deref};
use windows_core::{GUID, Interface};
/// This struct represents the COM `IHostAssemblyStore` interface.
#[repr(C)]
#[derive(Clone, Debug)]
pub struct IHostAssemblyStore(windows_core::IUnknown);
/// Trait representing the implementation of the `IHostAssemblyStore` interface.
pub trait IHostAssemblyStore_Impl: windows_core::IUnknownImpl {
/// Provides an assembly image in response to a bind request.
fn ProvideAssembly(
&self,
pbindinfo: *const AssemblyBindInfo,
passemblyid: *mut u64,
pcontext: *mut u64,
ppstmassemblyimage: *mut *mut c_void,
ppstmpdb: *mut *mut c_void,
) -> windows_core::Result<()>;
/// Provides a module image in response to a bind request.
fn ProvideModule(
&self,
pbindinfo: *const ModuleBindInfo,
pdwmoduleid: *mut u32,
ppstmmoduleimage: *mut *mut c_void,
ppstmpdb: *mut *mut c_void,
) -> windows_core::Result<()>;
}
impl IHostAssemblyStore_Vtbl {
/// Creates a new virtual table for the `IHostAssemblyStore` implementation.
///
/// This table contains function pointers for each method exposed by the interface.
pub const fn new<Identity: IHostAssemblyStore_Impl, const OFFSET: isize>() -> Self {
unsafe extern "system" fn ProvideAssembly<
Identity: IHostAssemblyStore_Impl,
const OFFSET: isize,
>(
this: *mut c_void,
pbindinfo: *const AssemblyBindInfo,
passemblyid: *mut u64,
pcontext: *mut u64,
ppstmassemblyimage: *mut *mut c_void,
ppstmpdb: *mut *mut c_void,
) -> windows_core::HRESULT {
unsafe {
let this: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
IHostAssemblyStore_Impl::ProvideAssembly(
this,
transmute_copy(&pbindinfo),
transmute_copy(&passemblyid),
transmute_copy(&pcontext),
transmute_copy(&ppstmassemblyimage),
transmute_copy(&ppstmpdb),
)
.into()
}
}
unsafe extern "system" fn ProvideModule<
Identity: IHostAssemblyStore_Impl,
const OFFSET: isize,
>(
this: *mut c_void,
pbindinfo: *const ModuleBindInfo,
pdwmoduleid: *mut u32,
ppstmmoduleimage: *mut *mut c_void,
ppstmpdb: *mut *mut c_void,
) -> windows_core::HRESULT {
unsafe {
let this: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
IHostAssemblyStore_Impl::ProvideModule(
this,
transmute_copy(&pbindinfo),
transmute_copy(&pdwmoduleid),
transmute_copy(&ppstmmoduleimage),
transmute_copy(&ppstmpdb),
)
.into()
}
}
Self {
base__: windows_core::IUnknown_Vtbl::new::<Identity, OFFSET>(),
ProvideAssembly: ProvideAssembly::<Identity, OFFSET>,
ProvideModule: ProvideModule::<Identity, OFFSET>,
}
}
/// Verifies if a given interface ID matches `IHostAssemblyStore`.
pub fn matches(iid: &windows_core::GUID) -> bool {
iid == &<IHostAssemblyStore as windows_core::Interface>::IID
}
}
impl windows_core::RuntimeName for IHostAssemblyStore {}
/// Struct containing metadata needed for binding an assembly in the CLR.
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct AssemblyBindInfo {
/// Identifier of the application domain making the request.
pub dwAppDomainId: u32,
/// The identity of the referenced assembly (pre-policy).
pub lpReferencedIdentity: windows_core::PCWSTR,
/// The identity of the assembly after policy has been applied.
pub lpPostPolicyIdentity: windows_core::PCWSTR,
/// The level of policy applied (e.g., application, machine, etc).
pub ePolicyLevel: u32,
}
/// Struct containing metadata needed for binding a module in the CLR.
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct ModuleBindInfo {
/// Identifier of the application domain making the request.
pub dwAppDomainId: u32,
/// The identity of the containing assembly.
pub lpAssemblyIdentity: windows_core::PCWSTR,
/// The name of the module being requested.
pub lpModuleName: windows_core::PCWSTR,
}
unsafe impl Interface for IHostAssemblyStore {
type Vtable = IHostAssemblyStore_Vtbl;
/// The interface identifier (IID) for the `IHostAssemblyStore` COM interface.
///
/// This GUID is used to identify the `IHostAssemblyStore` interface when calling
/// COM methods like `QueryInterface`. It is defined based on the standard
/// .NET CLR IID for the `IHostAssemblyStore` interface.
const IID: GUID = GUID::from_u128(0x613dabd7_62b2_493e_9e65_c1e32a1e0c5e);
}
impl Deref for IHostAssemblyStore {
type Target = windows_core::IUnknown;
/// The interface identifier (IID) for the `IHostAssemblyStore` COM interface.
///
/// This GUID is used to identify the `IHostAssemblyStore` interface when calling
/// COM methods like `QueryInterface`. It is defined based on the standard
/// .NET CLR IID for the `IHostAssemblyStore` interface.
fn deref(&self) -> &Self::Target {
unsafe { core::mem::transmute(self) }
}
}
/// Raw COM vtable for the `IHostAssemblyStore` interface.
#[repr(C)]
pub struct IHostAssemblyStore_Vtbl {
pub base__: windows_core::IUnknown_Vtbl,
// Methods specific to the COM interface
pub ProvideAssembly: unsafe extern "system" fn(
this: *mut c_void,
pbindinfo: *const AssemblyBindInfo,
passemblyid: *mut u64,
pcontext: *mut u64,
ppstmassemblyimage: *mut *mut c_void,
ppstmpdb: *mut *mut c_void,
) -> windows_core::HRESULT,
pub ProvideModule: unsafe extern "system" fn(
this: *mut c_void,
pbindinfo: *const ModuleBindInfo,
pdwmoduleid: *mut u32,
ppstmmoduleimage: *mut *mut c_void,
ppstmpdb: *mut *mut c_void,
) -> windows_core::HRESULT,
}