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 


what is the rigth way to get the stack size? is it..

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

Joined: 11 Sep 2013
Posts: 5

PostPosted: Thu Oct 10, 2013 3:08 am    Post subject: what is the rigth way to get the stack size? is it.. Reply with quote

I am wondering how to get the stack size of ESP where as i know the address?

bty i did search and i found this answer, somehow i do not get his meaning, here is what he said

The first time you can use the address of any value on the stack to get the base address and size (in bytes) of the committed stack space.

Subtract the size from the base address and call VirtualQuery again. This way you get the space reserved for the stack.

Adding the two sizes you obtain the total stack size.


assuming i have this.. what i should do next?

Code:
virtualqueryex(Process,address,Mbi,sizeof(Mbi));
address = mbi.baseaddress-mbi.regionsize;
virtualqueryex(Process,address,Mbi,sizeof(Mbi)); << ???
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Thu Oct 10, 2013 4:18 am    Post subject: Reply with quote

The stacksize is mbi.baseaddress+mbi.stacksize

But for what purpose do you need the stacksize? (You can't use it for pointers as windows tends to fill in the start of the stack with a random amount of data)

_________________
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
JoneLe86
How do I cheat?
Reputation: 0

Joined: 11 Sep 2013
Posts: 5

PostPosted: Thu Oct 10, 2013 1:34 pm    Post subject: Thanks for answering my question! Reply with quote

You can't use it for pointers as windows tends to fill in the start of the stack with a random amount of data (interesting!)

hmm I just want to know how some debuggers show that in (Stack window) which has the lowest address of stack and the highest address,,,

maybe i asked a wrong question, cuz one i add mbi.baseaddress+mbi.stacksize a different value than those debugger show?


Ex

stack window show this range 0022E000 to 0022FFFC so now by subtracting
= 1FFC.. 8188

if use
Code:
virtualqueryex(Process,address,Mbi,sizeof(Mbi));

i Will get

Code:
mbi.baseaddress =  0022FFFC
mbi.AllocationBase = 30000
mbi.regionsize = 4096
mbi.state = 4096


what i do not get it, How the debugger showed this lower value 0022E000 and highest value 0022FFFC????
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Thu Oct 10, 2013 4:26 pm    Post subject: Reply with quote

ah yes, I forgot that virtualqueryex returns the base from the base you gave
virtualquerryex on 22fffc will get the region of 22f000 and later

virtualqueryex on 22e000 will get the region of 22e000 and later (that includes 22f000, so at least 8192)

You need to do a virtualqueryex from address 0 and loop till you encounter a region that the target address belongs to

_________________
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
JoneLe86
How do I cheat?
Reputation: 0

Joined: 11 Sep 2013
Posts: 5

PostPosted: Thu Oct 10, 2013 5:01 pm    Post subject: Reply with quote

it makes me feel better once i ask in a forum and i get an answer within hours, honestly i know why the hek Dark Byte is a Site Admin.. cuz he is amazing!!! and awesome!!! dude why there are no such people like you in other forums?

Got it thanks!!
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