commonlibsse_ng\rex/
kernel32.rs

1use std::ffi::c_void;
2
3use windows::Win32::{Foundation::HMODULE, System::SystemServices::IMAGE_DOS_HEADER};
4
5unsafe extern "C" {
6    /// The memory-mapped first relative position address of the dll, which is automatically assigned by ms linker to
7    /// the dll created by this library.
8    /// - see: https://devblogs.microsoft.com/oldnewthing/20041025-00/?p=37483
9    pub static __ImageBase: IMAGE_DOS_HEADER;
10}
11
12pub fn get_current_module() -> HMODULE {
13    unsafe { HMODULE((&__ImageBase) as *const IMAGE_DOS_HEADER as *mut c_void) }
14}