diff --git a/src/win32/importer.rs b/src/win32/importer.rs index ab1fd72..592a7a7 100644 --- a/src/win32/importer.rs +++ b/src/win32/importer.rs @@ -22,8 +22,8 @@ macro_rules! lazy_import { extern "C" fn __initial($($pname: $ptype),*) $(-> $rtype)? { unsafe { let import = $crate::win32::importer::find_import_hashed( - $crate::hash_utf8($module.as_bytes()), - $crate::hash_utf8(stringify!($name).as_bytes()) + const { $crate::hash_utf8($module.as_bytes()) }, + const { $crate::hash_utf8(stringify!($name).as_bytes()) } ).unwrap_or(0); FUNC = core::mem::transmute(import); FUNC($($pname),*) @@ -48,8 +48,8 @@ macro_rules! lazy_import { Some(function) => function, None => unsafe { let import = core::mem::transmute($crate::win32::importer::find_import_hashed( - x::hash_utf8($module.as_bytes()), - x::hash_utf8(stringify!($name).as_bytes()) + const { x::hash_utf8($module.as_bytes()) }, + const { x::hash_utf8(stringify!($name).as_bytes()) } ).unwrap_or(0)); FUNC = Some(import); import diff --git a/src/win32/pe_image.rs b/src/win32/pe_image.rs index 6a869a7..4807ad0 100644 --- a/src/win32/pe_image.rs +++ b/src/win32/pe_image.rs @@ -130,17 +130,17 @@ pub struct ImageBaseRelocation { #[repr(C)] pub struct ImageExportDirectory { - pub export_flags: u32, - pub timestamp: u32, - pub major_version: u16, - pub minor_version: u16, - pub name_rva: u32, - pub ordinal_base: u32, - pub address_table_entries: u32, - pub number_of_name_pointers: u32, - pub export_address_table_rva: u32, - pub name_pointer_rva: u32, - pub ordinal_table_rva: u32, + /* 0x00 */pub export_flags: u32, + /* 0x04 */pub timestamp: u32, + /* 0x06 */pub major_version: u16, + /* 0x08 */pub minor_version: u16, + /* 0x0C */pub name_rva: u32, + /* 0x10 */pub ordinal_base: u32, + /* 0x14 */pub address_table_entries: u32, + /* 0x18 */pub number_of_name_pointers: u32, + /* 0x1C */pub export_address_table_rva: u32, + /* 0x20 */pub name_pointer_rva: u32, + /* 0x24 */pub ordinal_table_rva: u32, } #[repr(C)] diff --git a/tests/test_data.rs b/tests/test_data.rs index 3f0a850..5293fec 100644 --- a/tests/test_data.rs +++ b/tests/test_data.rs @@ -1,3 +1,6 @@ +use std::mem::offset_of; +use x::win32::ImageOptionalHeader64; + #[test] pub fn test_distance() { let _ = x::dur![ 5 days 4 hours 7 minutes 2 seconds 2 minutes ]; @@ -24,4 +27,4 @@ pub fn test_distance() { x::iterate(b).cloned().take_while(|&c| c != 0)) .filter_map(|_r| _r.ok()).collect(); assert_eq!("Hello World", hello_world); -} \ No newline at end of file +} diff --git a/tests/test_lazy_import.rs b/tests/test_lazy_import.rs index 0e2bef2..4bc6212 100644 --- a/tests/test_lazy_import.rs +++ b/tests/test_lazy_import.rs @@ -11,5 +11,5 @@ x::lazy_import! { "kernel32.dll" #[cfg(feature = "win32")] pub fn test_exports() { let a = LoadLibraryA(x::cstr!("user32.dll")); - println!("{} -> {}",a.into_usize(), unsafe { a.nt_header().optional_header.size_of_image }); + println!("{:X} -> {:X}",a.into_usize(), unsafe { a.nt_header().optional_header.size_of_image }); } \ No newline at end of file