View previous topic :: View next topic |
Author |
Message |
Dark Byte Site Admin
Reputation: 468
Joined: 09 May 2003 Posts: 25706 Location: The netherlands
|
Posted: Sun May 24, 2009 5:16 pm Post subject: FAQ: How to use a pointer |
|
|
Because this question comes back almost every week I'll try to explain how to work with pointers
I'm not going to tell you how to code it, but I will tell you what you have to do
Let's start with something easy, a level-1 pointer
you have a pointer where people say : 0048123C+10C , first off, this notation is wrong, the actual notation should be [0048123C]+10C, anyhow,
to get to the real address you have to READ the "4 BYTES" at 0048123C as a value, and add the value 10C to it. (Don't forget that the notation I use is in hexadecimal, even for offsets)
Now interpret this new value as an address, and you have the address that actually contains the address you need. Using this address you can now Write or Read from the specific item the pointer points to.
Now a little bit more complicated, a level-8 pointer:
Let's say you now have a pointer as noted down in ce:
Code: |
address offset
xxxxxxxx 108
xxxxxxxx 1c
xxxxxxxx 0
xxxxxxxx 118
xxxxxxxx 2c4
xxxxxxxx 34
xxxxxxxx c0
0049aadc 16
|
Note that an alternative method of writing this down would be:
[[[[[[[[0049aadc]+16]+c0]+34]+2c4]+118]+0]+1c]+108
So, first read the "4-Bytes" value at 0049aadc
Now add to that result the first offset (16)
then interpret the new value as an address and read the 4 Bytes at that address
Add to that the 2nd offset (c0) to the value you just read
Again, interpret the value as address and read the 4 bytes there
and add the 3th offset (34) to the new value
Read 4 bytes
Add 4th offset (2c4)
Read 4 bytes
Add 5th offset (118)
Read 4 Bytes
Add 6th offset (0) Yes, 0 can be an offset, it's nothing special
Read 4 Bytes
Add 7th offset (1c)
Read 4 bytes
Add 8th offset (108)
You now finally have the final address.
This final address points to the address you want to modify. E.g add +10, or freeze(write in a in a loop), or just simply read out for stats
I hope this clears up the most common questions from people trying to add pointers to their trainer
(also check out http://forum.cheatengine.org/viewtopic.php?p=5280115#5280115 for help on how to deal with modulename+offset notations)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
Last edited by Dark Byte on Mon Dec 05, 2011 9:16 am; edited 1 time in total |
|
Back to top |
|
 |
talkerzero Grandmaster Cheater
Reputation: 1
Joined: 24 Jul 2008 Posts: 560 Location: California
|
Posted: Mon May 25, 2009 3:40 pm Post subject: |
|
|
Thanks, this helped me with understanding multilevel pointers better. (never really understood it)
|
|
Back to top |
|
 |
Sneak Grandmaster Cheater Supreme
Reputation: 0
Joined: 05 Nov 2008 Posts: 1895
|
Posted: Mon May 25, 2009 9:38 pm Post subject: |
|
|
nice darkbyte. Now i can start ma hax xD
_________________
|
|
Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Tue May 26, 2009 4:56 am Post subject: |
|
|
Thanks Dark Byte, I agree with talker0 this really helped me understand how to work with multilevel pointers.
|
|
Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Tue May 26, 2009 4:59 am Post subject: |
|
|
I'll check it out when after I get my mcts.
_________________
Intel over amd yes. |
|
Back to top |
|
 |
gunminiho Expert Cheater
Reputation: 0
Joined: 15 Dec 2008 Posts: 144 Location: peru
|
Posted: Sun Jun 14, 2009 7:45 pm Post subject: |
|
|
Plop... it wasnt hard -.-!!! i really thought that i was gonna be hard,its just as read a 1 level pointer -.-!!!!
|
|
Back to top |
|
 |
Destrod16 Newbie cheater
Reputation: 0
Joined: 03 Aug 2009 Posts: 21
|
Posted: Mon Aug 10, 2009 12:14 am Post subject: |
|
|
This is really useful, thanks. I would also like to add how you would use multi-level pointers in C++. Here is an example:
Let's say you have 4 pointers, this is how you would do it.
Code: | DWORD *thefirst = (DWORD*)(*(DWORD*)0x0040014F + 0x1378);
DWORD *thesecond = (DWORD*)(*(DWORD*)thefirst + 0x18);
DWORD *thethird = (DWORD*)(*(DWORD*)thesecond + 0x974);
DWORD *thefourth = (DWORD*)(*(DWORD*)thethird + 0x34); |
So there it is reading from them, but now to actually write to them you would add this simple line:
I hope I helped at all!
|
|
Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Mon Aug 10, 2009 1:08 am Post subject: |
|
|
Destrod16 wrote: | This is really useful, thanks. I would also like to add how you would use multi-level pointers in C++. Here is an example:
Let's say you have 4 pointers, this is how you would do it.
Code: | DWORD *thefirst = (DWORD*)(*(DWORD*)0x0040014F + 0x1378);
DWORD *thesecond = (DWORD*)(*(DWORD*)thefirst + 0x18);
DWORD *thethird = (DWORD*)(*(DWORD*)thesecond + 0x974);
DWORD *thefourth = (DWORD*)(*(DWORD*)thethird + 0x34); |
So there it is reading from them, but now to actually write to them you would add this simple line:
I hope I helped at all! |
Rather than making 4 local variables, you could just reuse the first one.
Works nonetheless.
|
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Aug 10, 2009 1:39 am Post subject: |
|
|
smartz993 wrote: | Rather than making 4 local variables, you could just reuse the first one.
Works nonetheless. |
The extras will likely just get optimized away.
|
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Mon Aug 10, 2009 2:11 am Post subject: |
|
|
there's no harm in good code practice. it's better practice to write good code than to depend on the compiler to fix your messes
|
|
Back to top |
|
 |
Destrod16 Newbie cheater
Reputation: 0
Joined: 03 Aug 2009 Posts: 21
|
Posted: Mon Aug 10, 2009 2:15 am Post subject: |
|
|
Oh so you mean like this:
Code: | DWORD *thefirst = (DWORD*)(*(DWORD*)0x0040014F + 0x1378);
*thefirst = (DWORD*)(*(DWORD*)thefirst + 0x18);
*thefirst = (DWORD*)(*(DWORD*)thefirst+ 0x974);
*thefirst = (DWORD*)(*(DWORD*)thefirst+ 0x34);
*thefirst = 100; |
|
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Mon Aug 10, 2009 2:16 am Post subject: |
|
|
yes he does mean that, that way makes it nice and readable as well. better still, change 'thefirst' to a more meaningful name and it'd be great
i'd find that a lot easier to understand than reading the initial code. i get confused when i see people putting in obsolete/superfluous variables since i'm waiting to see their use elsewhere further in the program, etc.
|
|
Back to top |
|
 |
Destrod16 Newbie cheater
Reputation: 0
Joined: 03 Aug 2009 Posts: 21
|
Posted: Mon Aug 10, 2009 2:36 am Post subject: |
|
|
Ok, oh and could I have that speedhack you wrote and possibly the source of it? If you don't want to give the source then that's fine.
|
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Mon Aug 10, 2009 2:46 am Post subject: |
|
|
yes, at work right now. i'll post it when i get home in like 10 more hours..
|
|
Back to top |
|
 |
talkerzero Grandmaster Cheater
Reputation: 1
Joined: 24 Jul 2008 Posts: 560 Location: California
|
Posted: Sat Sep 05, 2009 9:52 am Post subject: |
|
|
Quote: | to get to the real address you have to READ the "4 BYTES" at 0048123C as a value, and add the value 10C to it. |
What if it's not a 4-byte pointer?
|
|
Back to top |
|
 |
|