MCPcopy Create free account
hub / github.com/NoMercy-ac/NoMercy / FindModuleFromAddress

Method FindModuleFromAddress

Source/Client/NM_Engine/DynamicWinapi.cpp:257–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255 return nullptr;
256}
257LPVOID CDynamicWinapi::FindModuleFromAddress(DWORD_PTR dwAddress)
258{
259 auto pPEB = GetCurrentPEB();
260 auto CurrentEntry = pPEB->LoaderData->InLoadOrderModuleList.Flink;
261 while (CurrentEntry != &pPEB->LoaderData->InLoadOrderModuleList && CurrentEntry != NULL)
262 {
263 auto Current = CONTAINING_RECORD(CurrentEntry, _LDR_MODULE, InLoadOrderModuleList);
264 if (dwAddress >= reinterpret_cast<DWORD_PTR>(Current->BaseAddress) && dwAddress <= (reinterpret_cast<DWORD_PTR>(Current->BaseAddress) + Current->SizeOfImage))
265 {
266 return Current;
267 }
268
269 CurrentEntry = CurrentEntry->Flink;
270 }
271 return nullptr;
272}
273
274static HMODULE WINAPI MyGetModuleHandleA(_In_ LPCSTR lpModuleName)
275{

Callers 2

GetModuleBaseAddressMethod · 0.80
GetModuleSizeMethod · 0.80

Calls 1

GetCurrentPEBFunction · 0.85

Tested by

no test coverage detected