Is there a way to get the size of the callstack (in bytes) in C++?
Or at least the bottom address of it (and then I can subtract it from the ESP register?
Is there a way to get the size of the callstack (in bytes) in
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can try using VirtualQuery twice.
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.