Hello! Noob here.
I am trying to find the base address of a module from the process id, but I have having trouble actually returning the address once it is found.
fn get_module_base_address(procid: u32) -> usize {
let mut address_return: usize = 0x0;
env_logger::init();
for_each_module(procid, |(address, size), name| {
println!("{}", name.display().to_string());
if name.display().to_string().contains("ac_client.exe"){
println!("address found = {}", address);
let mut address_return= address;
}
})
.unwrap();
return address_return;
}
I am trying to make a function that finds the process ac_client.exe, then return the address of it in address_return. If no module is found, it returns the address, 0x0.
It won't let me return in the loop becuase it says "expected (), found usize". If I set address_return to the address, it says that variable is unused and returns 0x0, even though the address prints fine inside the loop.