Home > Archive > VC Language > November 2005 > Is there any function that I can use to check the current stack size in VC6.0
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Is there any function that I can use to check the current stack size in VC6.0
|
|
| kimso.zhao@gmail.com 2005-11-26, 7:01 pm |
| Hi,
I have a multi-thread programs, and if I want to check the size of
memory that has been allocated in the stack in one of the thread. Is
there any fucntion avaiable in VC6.0?
Thanks in advance!
| |
| Scherbina Vladimir 2005-11-26, 7:01 pm |
| Hello, Kimso.
Nope, AFAIR there is no documented way to retrieve stack size. As for
undocumented ways, information about stack is stored in Thread Environment
Block (TEB). For more information take a look at:
http://undocumented.ntinternals.net...Thread/TEB.html
On how to retrieve TEB you may find in this article:
http://www.codeproject.com/win32/Remote.asp
--
Scherbina Vladimir
<kimso.zhao@gmail.com> wrote in message
news:1133046510.283537.194150@g43g2000cwa.googlegroups.com...
> Hi,
>
> I have a multi-thread programs, and if I want to check the size of
> memory that has been allocated in the stack in one of the thread. Is
> there any fucntion avaiable in VC6.0?
>
> Thanks in advance!
>
| |
| kimso.zhao@gmail.com 2005-11-26, 7:01 pm |
| Thanks for your links.
Now I can use the code "struct _TEB* pTEB = NtCurrentTeb();" to get
the current TEB.
But when I tried to access any member of struct _TEB (e.g.
"pTEB->DeallocationStack;"), I can't get the code compiled. And get an
error like "error C2227: left of '->DeallocationStack' must point to
class/struct/union". How to get through this?
And here is the struct _TEB declaration I found from the link you
provided, only the member I think related to stack information are
listed. I can't find any furthur information about each member. Do you
have any idea about which is what I want (current stack size), and how
to print it? Sorry I don't know much about "PVOID".
typedef struct _TEB {
....
PVOID DeallocationStack;
....
PVOID StackCommit;
PVOID StackCommitMax;
PVOID StackReserved;
....
}TEB, *PTEB;
Thanks very much!
|
|
|
|
|