brodeur235 How do I cheat?
Reputation: 0
Joined: 10 May 2009 Posts: 4 Location: Texas, US
|
Posted: Sun May 10, 2009 7:19 pm Post subject: ReadProcessMemory |
|
|
I actually have a couple of questions that I suspect are related. I'll start with the simplest question I have:
I recently downloaded cheat engine (awesome BTW, DB) and opened up call of duty 4 to begin testing. In doing so I found several addresses that hold values such as my score, the number of kills I have, and the number of times I've died in the game. I changed these values suspecting that if I ever wanted to change them again, they'd be stored in at new locations in memory. Interestingly enough, when I closed cod4 and cheat engine, started some extra processes, and closed other processes, and finally restarted cod4 and cheat engine, the same addresses were used to save the same values. Why is that? Logically, if 50,000 bytes of memory were being used at the time call of duty started up, cod4 itself would get addresses 50001-50001+x, x being however much it needs... Troubling...
The other question I have is more specific and possibly related to my last question. Here is a source I have:
| Code: |
#include <windows.h>
#include <Strings.h>
#include <fstream>
#include <iostream>
using namespace std;
void writeMemToFile(const char* title, const char* fileName);
int main()
{
const char *a = "Minesweeper";
const char *b = "file";
writeMemToFile(a, b);
cout << "Done." << endl;
system("PAUSE");
return 0;
}
void writeMemToFile(const char* title, const char* fileName)
{
ofstream file;
file.open(fileName);
DWORD pID;
HWND window = FindWindow(NULL,title);
if(!window)
return;
GetWindowThreadProcessId(window,&pID);
HANDLE processHandle = OpenProcess(PROCESS_ALL_ACCESS,false,pID);
if(!processHandle)
return;
int current;
for(int address = 0x00000000; address < 0xFFFFFFFF; address+=0x4)
{
if( ReadProcessMemory(processHandle, (LPCVOID)address, ¤t, 4, NULL) )
file << current << endl;
}
}
|
This code works, but running it takes forever as I have to loop from 0x00000000 to 0xFFFFFFFF. My question is, given the process handle, how do I know where it's memory segment begins and ends?
All help is appreciated,
Brodeur235
[/code]
_________________
No trees were hurt in the transmissionof this message, however a few thousand electrons were terribly inconvenienced. |
|