diff --git a/ghost-core/src/hooks.rs b/ghost-core/src/hooks.rs index d267c87..090a8a8 100644 --- a/ghost-core/src/hooks.rs +++ b/ghost-core/src/hooks.rs @@ -181,9 +181,9 @@ mod platform { // Check each critical API for hooks for (module_name, func_name) in CRITICAL_APIS { // Find the module in target process - for i in 0..module_count { + for module in modules.iter().take(module_count) { let mut name_buffer = [0u16; 256]; - if GetModuleBaseNameW(handle, modules[i], &mut name_buffer) == 0 { + if GetModuleBaseNameW(handle, *module, &mut name_buffer) == 0 { continue; } diff --git a/ghost-core/src/memory.rs b/ghost-core/src/memory.rs index 3b3b758..1d6b8d6 100644 --- a/ghost-core/src/memory.rs +++ b/ghost-core/src/memory.rs @@ -468,9 +468,7 @@ mod platform { }); } - address = (mbi.BaseAddress as usize) - .checked_add(mbi.RegionSize) - .unwrap_or(usize::MAX); + address = (mbi.BaseAddress as usize).saturating_add(mbi.RegionSize); if address == usize::MAX { break;