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 


Unbalanced stack?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Wed May 18, 2016 12:33 pm    Post subject: Unbalanced stack? Reply with quote

A piece of code sometimes crashes my game, but sometimes it does not. I would like to know if the following code structure would cause unbalanced stack, thanks in advance.

Code:

push esi
push ebx
push ecx
...
...
push eax
...
...
pop eax
...
...
pushad
...
...
popad
...
...
pop ecx
pop ebx
pop esi

Back to top
View user's profile Send private message
STN
I post too much
Reputation: 42

Joined: 09 Nov 2005
Posts: 2672

PostPosted: Wed May 18, 2016 12:44 pm    Post subject: Reply with quote

No

But maybe the flags registers are modified in your code that can sometoimes cause issues. Use pushfd/ppofd see if that helps.

_________________
Cheat Requests/Tables- Fearless Cheat Engine
https://fearlessrevolution.com
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Wed May 18, 2016 1:17 pm    Post subject: This post has 1 review(s) Reply with quote

STN has written alot more hacks then I have. Still I would never recommend using Push and Pops unless you are positive that the section of code is "Solid". My experience has always been your experience - Random Crashing. Use the XMM registers available to you. 90% of the time the Last XMM registers are clear unless your in a Section of Code for the Camera. Or use a register that the Game Changes after your injection.

And if for some reason no registers are clear you can always use alloc to create a place to store the register in memory and put it back after your code has executed.

_________________
Back to top
View user's profile Send private message
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Wed May 18, 2016 1:41 pm    Post subject: Reply with quote

@STN, thanks, I will try using pushfd/popfd. One more question, do I only use them at the beginning and end of my code?

@akumakuja28,
I'm not very familiar with XMM registers, can you show me a simple example? Thanks a lot. Smile

With regard to saving the registers in memory, should I do something like this:
Code:


alloc(saveSpace,4)  //is 4 bytes enough?

mov [saveSpace],eax

//and when I am done using eax

mov eax,[saveSpace]
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Wed May 18, 2016 2:24 pm    Post subject: Reply with quote

fmanager wrote:
@STN, thanks, I will try using pushfd/popfd. One more question, do I only use them at the beginning and end of my code?

@akumakuja28,
I'm not very familiar with XMM registers, can you show me a simple example? Thanks a lot. Smile

With regard to saving the registers in memory, should I do something like this:
Code:


alloc(saveSpace,4)  //is 4 bytes enough?

mov [saveSpace],eax

//and when I am done using eax

mov eax,[saveSpace]



Yep thats correct. Use 4 bytes for a 32-Bit address 8 bytes for a 64-Bit.

Xmm Registers:
https://docs.oracle.com/cd/E26502_01/html/E28388/eojde.html

Its not quite as versatile as Eax,Ebx,Ecx registers. But you will learn the ins and outs pretty easy by Tracking a breakpoint.

For pushf and popf always do these first.

_________________
Back to top
View user's profile Send private message
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Wed May 18, 2016 3:14 pm    Post subject: Reply with quote

akumakuja28 wrote:
fmanager wrote:
@STN, thanks, I will try using pushfd/popfd. One more question, do I only use them at the beginning and end of my code?

@akumakuja28,
I'm not very familiar with XMM registers, can you show me a simple example? Thanks a lot. Smile

With regard to saving the registers in memory, should I do something like this:
Code:


alloc(saveSpace,4)  //is 4 bytes enough?

mov [saveSpace],eax

//and when I am done using eax

mov eax,[saveSpace]



Yep thats correct. Use 4 bytes for a 32-Bit address 8 bytes for a 64-Bit.

Xmm Registers:
https://docs.oracle.com/cd/E26502_01/html/E28388/eojde.html

Its not quite as versatile as Eax,Ebx,Ecx registers. But you will learn the ins and outs pretty easy by Tracking a breakpoint.

For pushf and popf always do these first.


Thanks for the info. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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