Kernel32SetThreadStackGuarantee Method

Sets the minimum size of the stack associated with the calling thread or fiber that will be available during any stack overflow exceptions.

This is useful for handling stack overflow exceptions; the application can safely use the specified number of bytes during exception handling.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", ExactSpelling = true, SetLastError = true)]
public static bool SetThreadStackGuarantee(
	ref uint refStackSizeInBytes
)

Parameters

refStackSizeInBytes  UInt32
The size of the stack, in bytes. On return, this value is set to the size of the previous stack, in bytes.

If this parameter is 0 (zero), the function succeeds and the parameter contains the size of the current stack.

If the specified size is less than the current size, the function succeeds but ignores this request. Therefore, you cannot use this function to reduce the size of the stack.

This value cannot be larger than the reserved stack size.

Return Value

Boolean
If the function succeeds, the return value is .

If the function fails, the return value is .

Remarks

See Also