| View previous topic :: View next topic |
| Author |
Message |
theatom How do I cheat?
Reputation: 0
Joined: 23 Apr 2012 Posts: 3
|
Posted: Mon Apr 23, 2012 12:09 pm Post subject: Get value of pointer [C++]? |
|
|
I have been looking for a while after a code that lets you get the value of a pointer. I have found the pointer in Cheat Engine and it works when I restart the program. But now to the question... How can I get the value into C++.
I have found a way to get the value of the dynamic address, but it changes all the time and therefore itīs no use.
I have a photo:
hxxp://yeyfiles.net/1057152502/this.jpg
(change the xx to tt obviously
And the value I want to get is 27 (of course it changes, but just so you know what I mean). I want to get the value of 004828B0 into a int. How do I do that?
Can someone please give me the code to do that and explain how it works.
[/img]
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Mon Apr 23, 2012 1:42 pm Post subject: |
|
|
- Read 4 bytes at the pointer's address.
- Add the offset to the accepted value.
- Read 4 bytes from that address and you got you're value
_________________
Stylo |
|
| Back to top |
|
 |
theatom How do I cheat?
Reputation: 0
Joined: 23 Apr 2012 Posts: 3
|
Posted: Mon Apr 23, 2012 1:52 pm Post subject: |
|
|
Can you write the code to me? I have tried to make it work with ReadProcessMemory but it isīnt working. Like I said I would like the value to be put in a variable. Thanks for the answer so far.
|
|
| Back to top |
|
 |
661089799107 Expert Cheater
Reputation: 3
Joined: 25 Jan 2009 Posts: 186
|
Posted: Tue Apr 24, 2012 10:44 pm Post subject: |
|
|
| Code: |
template <typename T>
T readMemory(HANDLE hProcess, unsigned int address, int size=4) {
// 'buffer' will be of whatever type we specify using <> (Ex: <unsigned int> making it unsigned int buffer;)
T buffer;
if(!ReadProcessMemory(hProcess, (LPVOID) address, &buffer, size, 0))
return 0;
return buffer;
}
|
| Code: |
// Read address, add offset
unsigned int address = readMemory<unsigned int>(hProcess, 0x004828B0) + 0x454; // 'address' would now be 0x01E54D78
int x = readMemory<int>(hProcess, address); // this will give you the value you want ('26' in your pic)
|
|
|
| Back to top |
|
 |
theatom How do I cheat?
Reputation: 0
Joined: 23 Apr 2012 Posts: 3
|
Posted: Tue Apr 24, 2012 11:13 pm Post subject: |
|
|
Thank you so much!!! Now itīs working.
|
|
| Back to top |
|
 |
|