| View previous topic :: View next topic |
| Author |
Message |
Obitio Advanced Cheater
Reputation: 0
Joined: 09 Apr 2012 Posts: 68 Location: null
|
Posted: Mon Jul 30, 2012 5:24 pm Post subject: How to Read/Write to a address? |
|
|
I know in delphi you can read memory by:
var
a:dword;
a:=pdword($address)^;
but how do I read memory like that in c++?
I do not want anyone saying use:
readprocessmemory as I don't need it because I am making a DLL hack and thus I have direct access to the game's memory.I would prefer a example but if you have a MSDN link I would like it.
note:
I've tried using the example from here:
http://www.cplusplus.com/forum/general/42132/
but it didn't work.And the address I am writing to does have the correct access so I do not need virtualprotect.
note:
I've also read up on this:
http://www.nextgenupdate.com/forums/computer-hacking-programming/343456-c-read-memory.html
but it doesn't work...I am new to c++ so don't give me something that's hard to understand.
T_T and call me a noob for asking but.What is virutalalloc?
edit:
i've tried searching for c++ read memory address in google+cheat engine search.Returned nothing helpful T_T
edit:
I've tried this but it didn't work :
| Code: |
#define ADR_Mapaddy1 0x3452E973
#define ADR_Mapaddy2 0x3452E974
#define ADR_Mapaddy3 0x3452E975
#define ADR_Mapaddy4 0x3452E976
|
| Code: |
long mv1,mv2,mv3,mv4;
long int * Mapaddress1 = (long int*)ADR_Mapaddy1;
long int * Mapaddress2 = (long int*)ADR_Mapaddy2;
long int * Mapaddress3 = (long int*)ADR_Mapaddy3;
long int * Mapaddress4 = (long int*)ADR_Mapaddy4;
|
reading:
| Code: |
DWORD mv1 = *(DWORD*)0x3452E973;
DWORD mv2 = *(DWORD*)0x3452E974;
DWORD mv3 = *(DWORD*)0x3452E975;
DWORD mv4 = *(DWORD*)0x3452E976;
|
writing:
| Code: |
*Mapaddress1=mv1;
*Mapaddress2=mv2;
*Mapaddress3=mv3;
*Mapaddress4=mv4;
|
|
|
| Back to top |
|
 |
Obitio Advanced Cheater
Reputation: 0
Joined: 09 Apr 2012 Posts: 68 Location: null
|
Posted: Thu Aug 02, 2012 12:04 pm Post subject: |
|
|
T_T I've been searching for 12 days...
anyone have a clue how to do it?
Last edited by Obitio on Mon Aug 06, 2012 5:34 pm; edited 1 time in total |
|
| Back to top |
|
 |
Obitio Advanced Cheater
Reputation: 0
Joined: 09 Apr 2012 Posts: 68 Location: null
|
Posted: Mon Aug 06, 2012 5:32 pm Post subject: |
|
|
| T_T if noone wants to help can someone send me a link to figure this out?I know delphi way better than in 2010.but I am just starting to learn c++.
|
|
| Back to top |
|
 |
n0 m3rcY Cheater
Reputation: 0
Joined: 18 Jun 2012 Posts: 42
|
Posted: Thu Aug 09, 2012 2:00 pm Post subject: |
|
|
| Code: | long int * Mapaddress1 = (long int*)ADR_Mapaddy1;
long int * Mapaddress2 = (long int*)ADR_Mapaddy2;
long int * Mapaddress3 = (long int*)ADR_Mapaddy3;
long int * Mapaddress4 = (long int*)ADR_Mapaddy4; |
Think about what you're assigning it to for a second. You're assigning a value to a pointer, not a pointer to a value to a pointer. In short, don't cast your value as a pointer, just assign it to the address (&).
Also, Windows provides the DWORD_PTR data type specifically for storing addresses, use it.
|
|
| Back to top |
|
 |
Obitio Advanced Cheater
Reputation: 0
Joined: 09 Apr 2012 Posts: 68 Location: null
|
Posted: Thu Aug 16, 2012 2:30 pm Post subject: |
|
|
| n0 m3rcY wrote: | | Code: | long int * Mapaddress1 = (long int*)ADR_Mapaddy1;
long int * Mapaddress2 = (long int*)ADR_Mapaddy2;
long int * Mapaddress3 = (long int*)ADR_Mapaddy3;
long int * Mapaddress4 = (long int*)ADR_Mapaddy4; |
Think about what you're assigning it to for a second. You're assigning a value to a pointer, not a pointer to a value to a pointer. In short, don't cast your value as a pointer, just assign it to the address (&).
Also, Windows provides the DWORD_PTR data type specifically for storing addresses, use it. |
lol...I have no clue what your saying...But do you mean this?
Value=&addy
Sorry I am noob in c++ xD I just use google to figure things usually but...well there aren't that many topics that I could find >.<
edit:
nvm.I finally found a google link that helped me.
This is what I did:
int* p =(int*)0x0002C724;
int *addy =(int*)0x34300000;
int a;
a=*p;
*addy=a+5;
|
|
| Back to top |
|
 |
|