我试图做一个程序,读取扫雷定时器的值。 (OS是Windows 7的64位)
使用作弊引擎,我发现该变量的基地址,但它改变了我每次运行扫雷时间。
我需要做什么做自动摸清底数的地址?
它有什么做的可执行文件的基址?
这里是我的代码:
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
DWORD baseAddress = 0xFF1DAA38;//always changing
DWORD offset1 = 0x18;
DWORD offset2 = 0x20;
DWORD pAddress1;
DWORD pAddress2;
float value = 0;
DWORD pid;
HWND hwnd;
hwnd = FindWindow(NULL,"Minesweeper");
if(!hwnd)//didn't find the window
{
cout <<"Window not found!\n";
cin.get();
}
else
{
GetWindowThreadProcessId(hwnd,&pid);
HANDLE phandle = OpenProcess(PROCESS_VM_READ,0,pid);//get permission to read
if(!phandle)//failed to get permission
{
cout <<"Could not get handle!\n";
cin.get();
}
else
{
ReadProcessMemory(phandle,(void*)(baseAddress),&pAddress1,sizeof(pAddress1),0);
ReadProcessMemory(phandle,(void*)(pAddress1 + offset1),&pAddress2,sizeof(pAddress2),0);
while(1)
{
ReadProcessMemory(phandle,(void*)(pAddress2 + offset2),&value,sizeof(value),0);
cout << value << "\n";
Sleep(1000);
}
}
}
}