- How to distinguish stack frame from dataseg?
- Posted by Duh Pohmelja on August 1st, 2003
Hi, All!
Suppose I want to check, for testing purposes, if the object was
created statically or allocated on the stack (say in the thread
function). How to do this?
For example:
struct SomeStruct
{
// shareable data.
// ...
// lock
KSPINLOCK lock;
};
BOOL InitSomeStruct(SomeStruct& someStruct)
{
ASSERT_STATICALLY_ALLOCATED(someStruct);
KeInititalizeSpinLock(&someStruct.lock);
}
I want ASSERT_STATICALLY_ALLOCATED macro not to ASSERT when someStruct
is allocated on the dataseg and ASSERT, when it is allocated on the
stack (i.e. not accessible from other threads).
- Posted by Nick Ryan on August 1st, 2003
Call IoGetStackLimits() and check if the struct address is between the
two returned values.
Duh Pohmelja wrote:
--
- Nick Ryan (MVP for DDK)
Similar Posts
- How to tell an application to use a custom tcp/ip stack instead of tcp/ip stack from linux? (Programming) by CDP
- Distinguish vty sessions on routers. (Routers) by AM
- Can burners distinguish 1X from 2X media? (CD/DVD) by Mike S.
- ASP - how to distinguish browser windows. (Programming) by tedqn@yahoo.com
- How does gcc-2.95.3 layout the stack frame on Zaurus? (Handhelds & Wireless) by Dr. Nikolaus Schaller

