RtGetThreadStack

RtGetThreadStack retrieves the thread stack parameters for an existing thread object.

Syntax

Copy
bool RtGetThreadStack(
   HANDLE hThread,
   PDWORD StackSize,
   PDWORD StackAvailable,
   PULONG_PTR StackBaseAddress,
   PULONG_PTR StackLimitAddress,
   PULONG_PTR CurrentStackTopAddress
);

Parameters

hThread

The identifier of the thread.

StackSize

The size, in bytes, of the thread stack. This parameter is optional and can be NULL.

StackAvailable

The size, in bytes, of available free thread stack. This parameter is optional and can be NULL.

StackBaseAddress

A pointer variable that receives the lower boundary of the thread stack. This parameter is optional and can be NULL.

StackLimitAddress

A pointer variable that receives the upper boundary of the thread stack. This parameter is optional and can be NULL.

CurrentStackTopAddress

A pointer to the current stack location. This parameter is optional and can be NULL.

Return Value

If the function succeeds, it returns true. If the function fails, it returns false. Call GetLastError for additional error information.

Remarks

The thread stack grows downwards from StackBaseAddress to StackLimitAddress.

RtGetThreadStack will fail if all the optional parameters are NULL.

This function is used to retrieve thread stack parameters within the process environment. You cannot retrieve valid thread stack parameters of a running thread. Use the SuspendThread function to suspend the thread before calling RtGetThreadStack.

If you call RtGetThreadStack for the current thread, the function returns successfully with valid thread stack parameters.

Requirements

Minimum supported version Header Library

eRTOS 1.0 SDK

RtssApi.h rtkrnl.lib

See Also: