CS:GO getting module base address
I'm currently writing a wallhack for my friend.I have problem with getting module base address.(It returns with different address.)
Code:
DWORD GetModuleBaseAddress(DWORD pid, TCHAR *szModuleName)
{
DWORD dwModuleBaseAddress = 0;
HANDLE hs = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid);
if (hs != INVALID_HANDLE_VALUE)
{
MODULEENTRY32 modentry;
modentry.dwSize = sizeof(modentry);
if (Module32First(hs, &modentry))
{
do
{
if (_tcsicmp(modentry.szModule, szModuleName) == 0)
{
dwModuleBaseAddress = (DWORD)modentry.modBaseAddr;
break;
}
} while (Module32Next(hs, &modentry));
}
CloseHandle(hs);
}
return dwModuleBaseAddress;
}
please Tell me where I'm doing wrong
I get process id with similar function
(sorry for my bad english)