Ok basically what I am trying to do is this. There is a game and it has an address that changes but always contains the same value. So what I'm trying to do is enumerate from a starting address of this running process in this case 0x0120DE13 and read what value is stored at address 0x0120DE13 and then increment to 0x0120DE14 etc... (scanning a memory region). However it's not working properly. When I cout the value it's a constant integer number and not the value of the next address. When 2198867081u is found I want to replace that value with 22072894885u. Everything is working except what's in my for loop where I'm cycling through what I was hoping to be 40,000 addresses. I'm going about this wrong I am sure.
Any help would be very appreciated. Thank you !
int main()
{
system("title Battle Gear");
if(hwndDC == 0)
{
MessageBox(0,"Error","Handle Error",0);
SendMessage(hwndDC,0,0,WM_CLOSE);
return 0;
};
//////////LIGHT HACK///////////////////////////
unsigned long pID;
GetWindowThreadProcessId(hwndDC,&pID);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE,pID);
int x;
int x2 = 22072894885u;
DWORD LH;
for(int i = 0; i <= 40000;i++)
{
LH = 0x0120DE13 + 1;
cout<<LH;
system("pause");
ReadProcessMemory(hProcess, (LPVOID)LH,&x, 4, NULL);
if(x == 2198867081u)
{
WriteProcessMemory(hProcess, (LPVOID)LH, &x2, 4, NULL);
};
};
system("pause");
return 0;
};