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 


C++ WritingProcessMemory with mutli level pointers?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
BruceM
How do I cheat?
Reputation: 0

Joined: 05 Aug 2013
Posts: 2

PostPosted: Mon Aug 05, 2013 8:59 am    Post subject: C++ WritingProcessMemory with mutli level pointers? Reply with quote

I have some code below that would write over a memory location of a pointer+offset,

Would anyone be able to push me in the right direction of a multi level pointer?

The pointer proceeds in this manner:
0396A39C+118 = 0396A4B4
[0396AE18+24] -> 0396A39C
[0396A39C+5B0 -> 00396AE18
[0396EA60+3E0] -> 0396A39C
[0489101C+140] -> 0396EA60
"THREADSTACK0"-00000318 -> 0489101C

Also using the pointer scanner on CE the last offset of the pointer is:
" "THREADSTACK0"-00000318 -> 0489101C "
I'm not quite sure how I would incorporate this as well?

Code:

DWORD Pointer = 0x0396A39C;
DWORD Pointed;
WORD Offset = 0x0118
int CurrentCash = 0;
int newValue = 0;

ReadProcessMemory(hProc,(LPCVOID)(Pointer), &Pointed, 4, NULL);
ReadProcessMemory(hProc,(LPCVOID)(Pointed+Offset), &CurrentCash, 4, NULL);
WriteProcessMemory(hProc,(LPCVOID)(Pointed+Offset), &newValue, (DWORD)sizeof(newValue), NULL);



Any help/suggestions is appreciated.

Thanks,
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25823
Location: The netherlands

PostPosted: Mon Aug 05, 2013 1:35 pm    Post subject: Reply with quote

I explained threadstack# addressing in this post: http://forum.cheatengine.org/viewtopic.php?p=5487976#5487976

Basically, find the real start of the stack by looking for the first real stack entry that makes it to the running program (So no pre-launch stack variables)

http://code.google.com/p/cheat-engine/source/browse/trunk/Cheat%20Engine/CEFuncProc.pas#3717 contains my code to find the thread stack base

(You could also try a different pointer if this one is too difficult to use in your own program)

_________________
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
Back to top
View user's profile Send private message MSN Messenger
BruceM
How do I cheat?
Reputation: 0

Joined: 05 Aug 2013
Posts: 2

PostPosted: Thu Aug 15, 2013 2:53 pm    Post subject: Reply with quote

Sorry for the reply I actually had to read it a few times before i understood it.

I appreciate the help DB.
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