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 


Stack corruption question

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

Joined: 22 Oct 2017
Posts: 3

PostPosted: Thu Nov 09, 2017 12:33 pm    Post subject: Stack corruption question Reply with quote

Can the stack be corrupted if I use the add and sub commands?

In disgaea2 the influence value is moved from the stack into edx (mov edx, [esp+28]

I want to modify it by doing this:

Add esp, 28
Pop edx
Mov edx, 64
Sub esp, 28

Will this corrupt the stack?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 342

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

PostPosted: Thu Nov 09, 2017 12:54 pm    Post subject: Reply with quote

yes, after that esp will be at -4 as pop edx will decrease esp with 4 (unless you have a push somewhere earlier)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Back to top
View user's profile Send private message MSN Messenger
Jaara
How do I cheat?
Reputation: 0

Joined: 22 Oct 2017
Posts: 3

PostPosted: Thu Nov 09, 2017 4:01 pm    Post subject: Reply with quote

Whoops. Forgot to write Push edx before I subtracted the offset.

In this game, the change in influence is permanent(ish). However, I found that I wasn't changing how the program saw it. The program was calculating the change somewhere in the code and added this to the stack. Then it was used elsewhere to modify the influence for the senators themselves. Changing the cheat table value didn't do that (since the program just popped the influence from the stack somewhere else in code). I figured that if I modify the stack, then the program will always pull the value I put on the stack (rather than just modifying the temporary value in edx).

Thank you. I just wasn't sure if adding an offset to esp would fill the old values with garbage or not (which is why I subtracted the same offset after I pushed the new value in).
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 342

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

PostPosted: Thu Nov 09, 2017 4:47 pm    Post subject: Reply with quote

also, don't increase ESP.
While I don't think windows uses usermode interrupts, you never know. (they can randomly modify the bytes before ESP)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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