Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[HELP]c++ ReadProcessMemory not working?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
PsychicSymphony
Newbie cheater
Reputation: 0

Joined: 17 May 2011
Posts: 13
Location: Ontario

PostPosted: Fri Jun 10, 2011 2:44 pm    Post subject: [HELP]c++ ReadProcessMemory not working? Reply with quote

I have this address that im trying to findout the value for by using ReadProcessMemory()

Heres how I use it:

[code]
#define base 0x00CBDBDC
#define X (LPDWORD)base + 0x3B9C

int xval = 0;

char msg[255];
sprintf(msg, "Address = %i", X);
MessageBox(0, msg, "addy", 0);

ReadProcessMemory(hProc, X, &x, sizeof(int). NULL);

char cx[255];
itoa(xval, cx, 255);
MessageBox(0, cxMob, "X", 0);
[/code]

When I run this code it returns the address as 13421132
and the value as 12C□□ I know this isnt the proper value it should return a number around 0 to 2000 am I doing something wrong? Also I think the address is wrong.

_________________
Psychic Symphony
////
// Very Happy //
// //
////
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Fri Jun 10, 2011 4:09 pm    Post subject: Reply with quote

You are doing so many castings for no reason...

Firstly, don't define an address. Give it a variable.

Something such as this will suffice:
Code:
DWORD dwAddress = 0x00CBDBDC + 0x3B9C;  // Just combine the values anyway since they are both static.


Next keep in mind that if you use Visual Studio, sprintf is depreciated and you should use the secure function instead, sprintf_s. %i is a decimal integer, if you want to show the address as hex, use %x instead, a formatted address can use: 0x%08X

Your last message box uses itoa for no reason, you can just sprintf again like before.

And if the address is wrong, nothing we can do to help you, that's up to you to figure out while debugging/hacking the game.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
PsychicSymphony
Newbie cheater
Reputation: 0

Joined: 17 May 2011
Posts: 13
Location: Ontario

PostPosted: Fri Jun 10, 2011 4:19 pm    Post subject: Reply with quote

Very Happy thanks it works Smile also the address was wrong because of sprintf so it works now with %x thanks so much
_________________
Psychic Symphony
////
// Very Happy //
// //
////
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites