RtGetThreadStack

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

Syntax

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

The function returns true if it succeeds. Otherwise, it returns false. Call GetLastError for additional error information.

Remarks

The thread stack grows downwards from StackBaseAddress to StackLimitAddress.

RtGetThreadStack will fail if all of the optional parameters are NULL.

This function is used to retrieve thread stack parameters within the RTSS process environment. You cannot retrieve valid thread stack parameters of a running thread. Use the SuspendThread function to suspend the thread before calling RtGetThreadStack. For more information on the various thread states, see About Thread Flags and Process Flags.

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

Requirements

Minimum Required Version RTX64 3.3
Header RtssApi.h
Library Rtx_Rtss.lib

See Also:

SuspendThread

About Thread Flags and Process Flags