| View previous topic :: View next topic |
| Author |
Message |
Ganoes Paran How do I cheat?
Reputation: 0
Joined: 08 Apr 2009 Posts: 8
|
Posted: Fri Sep 18, 2009 11:53 pm Post subject: [C++] Pointers.. |
|
|
I've serached for this question too and found a topic with an example source code but attempting to use it gives me errors unfortuantly =\
I have a pointer that is 0x01dc4c60 and offset of 0x051C. How do I add those together? I'm guessing find what 0x01dc4c60 is pointing too and then add 0x051C to it, but i'm kinda failing on this. any advice would be appreciated =) |
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Sat Sep 19, 2009 12:17 am Post subject: |
|
|
Reading the basics helps.
Int* is a pointer, so read your pointer there: int* x = 0xDEADBABE; Then, read the value from there and add the offset to it: int* y = static_cast<int*>( (*x)+0xBEEF ); And then just read the value from y: int z = *y;
Sure you can write all those on one line, but I'm trying to teach you here how to actually read the pointer, not just copy paste. |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sat Sep 19, 2009 1:11 am Post subject: Re: [C++] Pointers.. |
|
|
| Ganoes Paran wrote: | I've serached for this question too and found a topic with an example source code but attempting to use it gives me errors unfortuantly =\
I have a pointer that is 0x01dc4c60 and offset of 0x051C. How do I add those together? I'm guessing find what 0x01dc4c60 is pointing too and then add 0x051C to it, but i'm kinda failing on this. any advice would be appreciated =) |
Yes, read 0x01DC4C60 with ReadProcessMemory then just add the offset to what you get back or if you have access to its memory, you can just do something like:
| Code: | DWORD* ptr1 = 0x01DC4C60;
DWORD val = *ptr1 + 0x051C; |
val is the memory location, etc etc. |
|
| Back to top |
|
 |
NooBpluSS Cheater
Reputation: 0
Joined: 24 Jun 2007 Posts: 37
|
Posted: Sat Sep 19, 2009 2:13 pm Post subject: |
|
|
Simple...
Read value of 0x01dc4c60 (ex: readprocessmemory for read), add 0x051C (offset) and get ur pointer hack.
(: _________________
Newbie cheater ;] |
|
| Back to top |
|
 |
Ganoes Paran How do I cheat?
Reputation: 0
Joined: 08 Apr 2009 Posts: 8
|
Posted: Sat Sep 19, 2009 8:23 pm Post subject: |
|
|
well ReadProcessMemory does help me get the address of pointer but I hav eto add offset to it (so no problem..)
however the pointer address is put inside the LPVOID value and I can not add anyhting to it since it's basicly a "void" value of sorts =\
can anyone help me on this? thanks =) |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sat Sep 19, 2009 10:35 pm Post subject: |
|
|
show whatever code you have.
though i imagine this is just going to be a case of "just type cast it" |
|
| Back to top |
|
 |
igoticecream Grandmaster Cheater Supreme
Reputation: 0
Joined: 23 Apr 2006 Posts: 1807 Location: 0x00400000
|
Posted: Sun Sep 20, 2009 11:45 pm Post subject: |
|
|
| Ganoes Paran wrote: | well ReadProcessMemory does help me get the address of pointer but I hav eto add offset to it (so no problem..)
however the pointer address is put inside the LPVOID value and I can not add anyhting to it since it's basicly a "void" value of sorts =\
can anyone help me on this? thanks =) |
Just a simple question, are you in the context of the application?
If so you simply do:
(*(DWORD*)BaseAddress)+Offset //Get address's pointer or...
*(DWORD*) (*(DWORD*)BaseAddress)+Offset // to get value of the pointer
If you are not on the context then use ReadProcessMemory:
ReadProcessMemory(hProcess,(LPCVOID)(*(DWORD*)BaseAddress)+Offset,aBuffer,vSize,NULL);
LPVOID aBuffer = malloc(vSize+1);
hProcess can be found by OpenProcess
then if you need to read the Buffer as an unsigned long then cast it:
(unsigned long)aBuffer
Hope this helps you |
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Mon Sep 21, 2009 7:58 am Post subject: |
|
|
| igoticecream wrote: | If you are not on the context then use ReadProcessMemory:
ReadProcessMemory(hProcess,(LPCVOID)(*(DWORD*)BaseAddress)+Offset,aBuffer,vSize,NULL); | Does that really work? I doubt it.. It'd read the value at your own program's context (the BaseAddress) and then add the offset and then read the value from the other context. So, it'd be something along these lines, too lazy to check the typecasts, but you get the idea where igoticecream got it wrong: | Code: | void *ptr = NULL;
ReadProcessMemory(hProcess, (LPCVOID)BaseAddress, &ptr, sizeof(void*), NULL);
ReadProcessMemory(hProcess, (LPCVOID)ptr+offset, buf, bufSize, NULL); |
|
|
| Back to top |
|
 |
igoticecream Grandmaster Cheater Supreme
Reputation: 0
Joined: 23 Apr 2006 Posts: 1807 Location: 0x00400000
|
Posted: Mon Sep 21, 2009 10:15 pm Post subject: |
|
|
| Yea you need first the Base of the pointer, i'm sorry, you are right |
|
| Back to top |
|
 |
|