Why the module address is different in Cheat Engine than in x32dbg?
I'm trying to read this:
My c++ attempt:
#include "pch.h"
#include "Functions.h"
#include "offsets.h"
#include <iostream>
using namespace std;
DWORD WINAPI HackThread(HMODULE hModule)
{
//Create Console
AllocConsole();
FILE* f;
freopen_s(&f, "CONOUT$", "w", stdout);
cout << "We're injected!\n";
uintptr_t module = (uintptr_t)GetModuleHandle(NULL);
int addr = module + 0x04939F0;
while (true)
{
if (GetAsyncKeyState(VK_END) & 1)
{
cout << "Reading: " << hex << addr << endl;
cout << *(int*)addr << endl;
}
Sleep(5);
}
fclose(f);
FreeConsole();
FreeLibraryAndExitThread(hModule, 0);
return 0;
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
CloseHandle(CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)HackThread, hModule, 0, nullptr));
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
From c++ I can find this module address:
I'm not sure if I was reading the correct address my code will work...