Advertisement
captmicro

Unknown

Oct 20th, 2010
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. void remote_listmodules(HANDLE proc, void *_peb)
  2. {
  3.     void *peb;
  4.     if (_peb == NULL) return;
  5.     else peb = _peb;
  6.     DWORD bytesRead = 0;
  7.  
  8.     void *ldr = NULL;
  9.     ReadProcessMemory(proc, (void*)((ULONG)peb + 0x0C), ldr, sizeof(ldr), &bytesRead);
  10.     void *flink = NULL;
  11.     ReadProcessMemory(proc, (void*)((ULONG)ldr + 0x14), flink, sizeof(flink), &bytesRead);
  12.     void *cmod = flink;
  13.     void *_BaseAddress = 0;
  14.     void *_BaseDllName = 0;
  15.     void *modulebase = 0;
  16.     do
  17.     {
  18.         ReadProcessMemory(proc, (void*)((ULONG)cmod + 0x10), _BaseAddress, sizeof(_BaseAddress), &bytesRead);
  19.         ReadProcessMemory(proc, (void*)((ULONG)cmod + 0x28), _BaseDllName, sizeof(_BaseDllName), &bytesRead);
  20.         if (_BaseAddress != 0)
  21.             wprintf(L"%s @ 0x%X\n", (WCHAR*)_BaseDllName, (ULONG)_BaseAddress);
  22.         cmod = *((void**)cmod);
  23.     } while (flink != cmod);
  24.  
  25.     return;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement