EXPAND_STACK_CALLOUT callback function

The ExpandedStackCall routine executes with a guaranteed stack size.



VOID() ExpandStackCallout(
  PVOID Parameter



The value passed to the KeExpandKernelStackAndCallout routine that executed ExpandedStackCall.

Return Value



The ExpandedStackCall routine must handle all exceptions. Any unhandled exception causes the system to bug check with Bug Check 0x1E: KMODE_EXCEPTION_NOT_HANDLED.

If the ExpandedStackCall changes the current IRQL, it must restore the original value before returning.


To define an ExpandedStackCall callback routine, you must first provide a function declaration that identifies the type of callback routine you're defining. Windows provides a set of callback function types for drivers. Declaring a function using the callback function types helps Code Analysis for Drivers, Static Driver Verifier (SDV), and other verification tools find errors, and it's a requirement for writing drivers for the Windows operating system.

For example, to define an ExpandedStackCall callback routine that is named MyExpandedStackCall, use the EXPAND_STACK_CALLOUT type as shown in this code example:

Then, implement your callback routine as follows:
    PVOID  Parameter
      // Function body
The EXPAND_STACK_CALLOUT function type is defined in the Wdm.h header file. To more accurately identify errors when you run the code analysis tools, be sure to add the _Use_decl_annotations_ annotation to your function definition. The _Use_decl_annotations_ annotation ensures that the annotations that are applied to the EXPAND_STACK_CALLOUT function type in the header file are used. For more information about the requirements for function declarations, see Declaring Functions by Using Function Role Types for WDM Drivers. For information about _Use_decl_annotations_, see Annotating Function Behavior.


Minimum supported client Drivers can implement ExpandedStackCall routines on Windows Server 2003 for an x64-based processor, and on Windows Vista and later versions of Windows for all processors.
Target Platform Desktop
Header ntddk.h (include Ntddk.h, Ntifs.h)

See Also