为什么 Cheat Engine 中的模块地址与 x32dbg 中的不同?
我正在尝试阅读以下内容:
我的 C++ 尝试:
#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;
}
从 C++ 我可以找到这个模块地址:
我不确定我是否正在阅读正确的地址,我的代码是否有效...