Skip to content

Commit 17148e5

Browse files
committedFeb 22, 2024
Use Win32 typedefs for new Win32 API decls.
1 parent 891e91b commit 17148e5

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed
 

‎src/dbghelp.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ mod dbghelp {
7171
pub fn SymGetSearchPathW(
7272
hprocess: HANDLE,
7373
searchpatha: PWSTR,
74-
searchpathlength: u32,
74+
searchpathlength: DWORD,
7575
) -> BOOL;
7676
pub fn SymSetSearchPathW(hprocess: HANDLE, searchpatha: PCWSTR) -> BOOL;
7777
pub fn EnumerateLoadedModulesW64(
7878
hprocess: HANDLE,
7979
enumloadedmodulescallback: PENUMLOADED_MODULES_CALLBACKW64,
80-
usercontext: *const c_void,
80+
usercontext: PVOID,
8181
) -> BOOL;
8282
}
8383

@@ -191,7 +191,7 @@ dbghelp! {
191191
fn SymGetSearchPathW(
192192
hprocess: HANDLE,
193193
searchpatha: PWSTR,
194-
searchpathlength: u32
194+
searchpathlength: DWORD
195195
) -> BOOL;
196196
fn SymSetSearchPathW(
197197
hprocess: HANDLE,
@@ -200,7 +200,7 @@ dbghelp! {
200200
fn EnumerateLoadedModulesW64(
201201
hprocess: HANDLE,
202202
enumloadedmodulescallback: PENUMLOADED_MODULES_CALLBACKW64,
203-
usercontext: *const c_void
203+
usercontext: PVOID
204204
) -> BOOL;
205205
fn StackWalk64(
206206
MachineType: DWORD,
@@ -436,7 +436,7 @@ pub fn init() -> Result<Init, ()> {
436436
DBGHELP.EnumerateLoadedModulesW64().unwrap()(
437437
GetCurrentProcess(),
438438
Some(enum_loaded_modules_callback),
439-
&mut search_path as *mut _ as *mut _,
439+
((&mut search_path) as *mut SearchPath) as *mut c_void,
440440
);
441441

442442
let new_search_path = search_path.finalize();
@@ -495,9 +495,9 @@ impl SearchPath {
495495

496496
extern "system" fn enum_loaded_modules_callback(
497497
module_name: PCWSTR,
498-
_: u64,
499-
_: u32,
500-
user_context: *const c_void,
498+
_: DWORD64,
499+
_: ULONG,
500+
user_context: PVOID,
501501
) -> BOOL {
502502
// `module_name` is an absolute path like `C:\path\to\module.dll`
503503
// or `C:\path\to\module.exe`

‎src/windows.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ cfg_if::cfg_if! {
5959
pub type PENUMLOADED_MODULES_CALLBACKW64 = Option<
6060
unsafe extern "system" fn(
6161
modulename: PCWSTR,
62-
modulebase: u64,
63-
modulesize: u32,
64-
usercontext: *const c_void,
62+
modulebase: DWORD64,
63+
modulesize: ULONG,
64+
usercontext: PVOID,
6565
) -> BOOL,
6666
>;
6767
}
@@ -301,7 +301,7 @@ ffi! {
301301
pub type PTRANSLATE_ADDRESS_ROUTINE64 = Option<
302302
unsafe extern "system" fn(hProcess: HANDLE, hThread: HANDLE, lpaddr: LPADDRESS64) -> DWORD64,
303303
>;
304-
pub type PENUMLOADED_MODULES_CALLBACKW64 = Option<unsafe extern "system" fn(modulename: PCWSTR, modulebase: u64, modulesize: u32, usercontext: *const c_void) -> BOOL>;
304+
pub type PENUMLOADED_MODULES_CALLBACKW64 = Option<unsafe extern "system" fn(modulename: PCWSTR, modulebase: DWORD64, modulesize: ULONG, usercontext: PVOID) -> BOOL>;
305305
pub type PGET_MODULE_BASE_ROUTINE64 =
306306
Option<unsafe extern "system" fn(hProcess: HANDLE, Address: DWORD64) -> DWORD64>;
307307
pub type PFUNCTION_TABLE_ACCESS_ROUTINE64 =

0 commit comments

Comments
 (0)
Please sign in to comment.