This commit is contained in:
numbers
2023-09-04 06:26:35 -04:00
commit a5fe71ebb3
26 changed files with 1186 additions and 0 deletions

24
tests/test_image_base.rs Normal file
View File

@@ -0,0 +1,24 @@
#[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");
}