I want to get a value from a Proccess, here it's a simple test with "Calculator". First, I get the address with CheatEngine. Secondly I put it in ReadProcessMemory. But ReadProcessMemory return 0, I think I miss something, I've found something with BaseAddress, but I still have bad results. Google is out of results for me, so I ask you!
#include <windows.h>
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int value;
DWORD pid;
HWND hwnd = FindWindow(NULL,"Calculatrice");
if(!hwnd)
{
cout << "Window not found!";
}
else
{
GetWindowThreadProcessId(hwnd,&pid);
HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS,0,pid);
if(!phandle)
{
cout <<"Could not get handle!";
}
else
{
cout << ReadProcessMemory(phandle,(LPVOID)0xC71657E900,&value,sizeof(value),0) << endl;
cout << value;
getch();
return 0;
}
}
}
Resolved ! When the address is too big, because it's a 64bit address, the program change to a 32bit address, that's why it don't work.
So, in Visual Studio, set to x64.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.