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
use ;
/*
/// Get the handle of the current executable or DLL.
///
/// Ref: https://github.com/compio-rs/winio/issues/35
pub fn get_current_module_handle() -> HMODULE {
let mut module = HMODULE::default();
_ = unsafe {
GetModuleHandleExW(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
PCWSTR(get_current_module_handle as *const _),
&mut module,
)
};
module
}
*/
/// A Windows handle wrapper
///
/// # Safety
///
/// This type automatically closes the handle when dropped.
unsafe
unsafe