Function GetProcAddress

Source
pub fn GetProcAddress<'a>(
    h_module: HMODULE,
    function: impl Into<Module<'a>>,
    hash: Option<fn(&str) -> u32>,
) -> *mut c_void
Expand description

Retrieves the address of a function exported by a given module.

Supports lookup by name (&str), hash (u32), or ordinal (u16).

§Arguments

  • h_module - Handle of the module (base address)
  • function - Can be a name, hash or ordinal
  • hash - Optional function to hash export names for hash-based matching

§Returns

  • Pointer to the resolved function

§Examples

let base = GetModuleHandle("ntdll.dll", None);
let func = GetProcAddress(base, "NtProtectVirtualMemory", None);
let func = GetProcAddress(base, 2193297120u32, Some(murmur3));
let func = GetProcAddress(base, 473u32, None);