I can get helth, jump, etc. But when I try to get the address of engine.dll I always get 0x0.
Help me, please. Here's the source code.
Code:
clientDLL_ = 0;
do {
clientDLL_ = GetModuleBaseAddress(PID_, L"client.dll");
} while(clientDLL_ == 0);
printf("client.dll: 0x%X\n", clientDLL_); // it's okay, works
engineDLL_ = 0;
do {
engineDLL_ = GetModuleBaseAddress(PID_, L"engine.dll");
} while(engineDLL_ = 0);
printf("engine.dll: 0x%X\n", engineDLL_); // 0x0
Code:
DWORD GetModuleBaseAddress(DWORD processId, TCHAR *szModuleName)
{
DWORD moduleBase = 0;
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, processId);
if(hSnapshot != INVALID_HANDLE_VALUE) {
MODULEENTRY32 moduleEntry;
moduleEntry.dwSize = sizeof(MODULEENTRY32);
if(Module32First(hSnapshot, &moduleEntry)) {
do {
if(wcscmp(moduleEntry.szModule, szModuleName) == 0) {
moduleBase = (DWORD)moduleEntry.modBaseAddr;
break;
}
} while (Module32Next(hSnapshot, &moduleEntry));
}
CloseHandle(hSnapshot);
}
return moduleBase;
}
!! Admin's please delete the thread. Fixed it. In while loop engineDll_ = 0, should be engineDll_ == 0