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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
回答2:
StackWalk64()
http://msdn.microsoft.com/en-us/library/ms680650