Skip to content

Instantly share code, notes, and snippets.

@bats3c
Last active September 4, 2020 14:32
Show Gist options
  • Save bats3c/6db32a5334c7fae5ae3131c77c72275d to your computer and use it in GitHub Desktop.
Save bats3c/6db32a5334c7fae5ae3131c77c72275d to your computer and use it in GitHub Desktop.
Locate the base address of wevtsvc.dll
DWORD_PTR dwBase;
DWORD i, dwSizeNeeded;
HMODULE hModules[102400];
TCHAR szModule[MAX_PATH];
if (EnumProcessModules(GetCurrentProcess(), hModules, sizeof(hModules), &dwSizeNeeded))
{
for (int i = 0; i < (dwSizeNeeded / sizeof(HMODULE)); i++)
{
ZeroMemory((PVOID)szModule, MAX_PATH);
if (GetModuleBaseNameA(GetCurrentProcess(), hModules[i], (LPSTR)szModule, sizeof(szModule) / sizeof(TCHAR)))
{
if (!strcmp("wevtsvc.dll", (const char*)szModule))
{
dwBase = (DWORD_PTR)hModules[i];
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment