A PEB walker that resolves function addresses via runtime hash comparison, avoiding static imports.
Flow
Calculates hash for target module & function
Access process environment block (PEB)
Walk loaded module list
Match module via hash
Parses module exports
Resolves functions via hash
Returns function pointer of target
Profit
Detections
At the time of writing, no engines detect this code snippet as malicious, as it is really not by itself.
Example Usage
//Create UTF-16 hash for module
lettarget_lib: Vec<u16>="ntdll.dll".encode_utf16().collect();letlib_sum=calc_wide_checksum(&target_lib);//Create hash for target function
lettarget_func=calc_checksum(b"NtAllocateVirtualMemory");//Resolve func pointer
letroutine_ptr=find_routine(lib_sum,target_func);