KeExpandKernelStackAndCallout function

The KeExpandKernelStackAndCallout routine calls a routine with a guaranteed amount of stack space.

Syntax

NTSTATUS KeExpandKernelStackAndCallout(
  PEXPAND_STACK_CALLOUT Callout,
  PVOID                 Size,
  SIZE_T                Parameter
);

Parameters

Callout

Pointer to an ExpandedStackCall routine.

Size

Specifies the number of bytes on the stack to provide to the ExpandedStackCall routine. This value must be large enough to accommodate the stack usage of the ExpandedStackCall routine and any call that this routine might make. This value must not exceed MAXIMUM_EXPANSION_SIZE.

Parameter

Specifies the parameter to pass to the ExpandedStackCall routine.

Return Value

KeExpandKernelStackAndCallout returns STATUS_SUCCESS if the operation succeeds or an appropriate NTSTATUS value if the operation fails.

Remarks

KeExpandKernelStackAndCallout expands the kernel stack by Size bytes for use by the ExpandedStackCall routine. If there is not enough space available on the stack, KeExpandKernelStackAndCallout allocates a new kernel stack segment. The routine then calls the ExpandedStackCall routine.

In Windows 7, Windows Server 2008 R2, and later versions of Windows, consider using the KeExpandKernelStackAndCalloutEx routine instead of KeExpandKernelStackAndCallout. KeExpandKernelStackAndCalloutEx is similar to KeExpandKernelStackAndCallout but has additional parameters and can be called at IRQL <= DISPATCH_LEVEL.

The calling thread must not call the PsTerminateSystemThread routine until the thread's ExpandedStackCall routine returns. PsTerminateSystemThread checks to determine if the ExpandedStackCall routine is still active and, if it is, causes a bug check.

Requirements

   
Minimum supported client Available starting with Windows Server 2003 on x64-based processors, and starting with Windows Vista on all processors.
Target Platform Universal
Header ntddk.h (include Ntddk.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= APC_LEVEL

See Also

ExpandedStackCall

KeExpandKernelStackAndCalloutEx

PsTerminateSystemThread