Skip to content

Instantly share code, notes, and snippets.

@plowsec
Created January 27, 2022 14:18
Show Gist options
  • Select an option

  • Save plowsec/d65cce016311071f73ac63446f50dfb1 to your computer and use it in GitHub Desktop.

Select an option

Save plowsec/d65cce016311071f73ac63446f50dfb1 to your computer and use it in GitHub Desktop.
Get own module base address without GetModuleHandle

Get own module base address without GetModuleHandle

_PEB* peb = (_PEB*)__readgsqword(0x60); // 0x30 for x86
LPVOID ImageBase2 = (LPVOID)peb->lpImageBaseAddress;
LPVOID ImageBase = (LPVOID)GetModuleHandleA(NULL);
std::cout << "Image base 1 vs 2 : " << std::hex << ImageBase << " " << ImageBase2 << std::endl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment