23 lines
626 B
Rust
23 lines
626 B
Rust
|
|
#[link(name = "kernel32")]
|
|
extern "C" {
|
|
pub fn GetModuleHandleA(module_name: *const i8) -> &'static x::win32::ImageBase;
|
|
}
|
|
|
|
|
|
#[test]
|
|
#[cfg(feature = "win32")]
|
|
pub fn test_image_base() {
|
|
let a = unsafe { GetModuleHandleA(std::ptr::null()) } as *const _ as usize;
|
|
let b = x::win32::image_base() as *const _ as usize;
|
|
assert_eq!(a, b, "image_base didn't match");
|
|
|
|
}
|
|
|
|
#[test]
|
|
#[cfg(feature = "win32")]
|
|
pub fn test_image_base2() {
|
|
let a = unsafe { x::win32::process_executable() } as *const _ as usize;
|
|
let b = x::win32::image_base() as *const _ as usize;
|
|
assert_eq!(a, b, "image_base didn't match");
|
|
} |