Retrieves the base address of a module loaded in the current process. In case that the module can't be found in the current process, it will return 0. # Examples ``` let ntdll = dinvoke::get_module_base_address("ntdll.dll"); if ntdll != 0 { println!("The base address of ntdll.dll is 0x{:X}.", ntdll); } ```
(module_name: &str)
| 28 | /// } |
| 29 | /// ``` |
| 30 | pub fn get_module_base_address (module_name: &str) -> isize |
| 31 | { |
| 32 | let process = Process::current(); |
| 33 | let modules = process.module_list().unwrap(); |
| 34 | for m in modules |
| 35 | { |
| 36 | if m.name().unwrap().to_lowercase() == module_name.to_ascii_lowercase() |
| 37 | { |
| 38 | let handle = m.handle(); |
| 39 | return handle as isize; |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | 0 |
| 44 | } |
| 45 | |
| 46 | /// Retrieves the address of an exported function from the specified module. |
| 47 | /// |
no outgoing calls
no test coverage detected