mirror of
https://github.com/vxunderground/VX-API
synced 2026-06-06 16:54:55 +00:00
Rename Windows API/RfGetModuleHandle.cpp to Windows API/Library Loading/RfGetModuleHandle.cpp
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
HMODULE RfGetModuleHandleA(LPCSTR lpModuleName)
|
||||
{
|
||||
PPEB Peb = GetPeb();
|
||||
PLDR_MODULE Module = NULL;
|
||||
CHAR wDllName[64] = { 0 };
|
||||
|
||||
Module = (PLDR_MODULE)((PBYTE)Peb->LoaderData->InMemoryOrderModuleList.Flink - 16);
|
||||
|
||||
while (Module != NULL)
|
||||
{
|
||||
Module = (PLDR_MODULE)((PBYTE)Module->InMemoryOrderModuleList.Flink - 16);
|
||||
if (Module->BaseDllName.Buffer != NULL)
|
||||
{
|
||||
RfZeroMemory(wDllName, sizeof(wDllName));
|
||||
WCharStringToCharString(wDllName, Module->BaseDllName.Buffer, 64);
|
||||
if (StringCompareA(lpModuleName, wDllName) == 0)
|
||||
return (HMODULE)Module->BaseAddress;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HMODULE RfGetModuleHandleW(LPCWSTR lpModuleName)
|
||||
{
|
||||
PPEB Peb = GetPeb();
|
||||
PLDR_MODULE Module = NULL;
|
||||
|
||||
Module = (PLDR_MODULE)((PBYTE)Peb->LoaderData->InMemoryOrderModuleList.Flink - 16);
|
||||
|
||||
while (Module != NULL)
|
||||
{
|
||||
Module = (PLDR_MODULE)((PBYTE)Module->InMemoryOrderModuleList.Flink - 16);
|
||||
if (Module->BaseDllName.Buffer != NULL)
|
||||
{
|
||||
if (StringCompareW(lpModuleName, Module->BaseDllName.Buffer) == 0)
|
||||
return (HMODULE)Module->BaseAddress;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
Reference in New Issue
Block a user