RaiseException

RaiseException raises an exception in the calling thread.

Syntax

VOID RaiseException(
    DWORD ExceptionCode,
    DWORD ExceptionFlags,
    DWORD nNumberOfArguments,
    CONST DWORD* lpArguments
);

Parameters

ExceptionCode

The application-defined exception code of the exception being raised. The filter expression and exception-handler block of an exception handler can use GetExceptionCode to retrieve this value.

Note that the system will clear bit 28 of ExceptionCode. This bit is a reserved exception bit, used by the system for its own purposes. For example, after calling RaiseException with an ExceptionCode value of 0XFFFFFFFF, Windows displays a message indicating that the exception number is 0XEFFFFFFF.

ExceptionFlags

The exception flags. This can be either zero to indicate a continuable exception, or EXCEPTION_NONCONTINUABLE to indicate a non-continuable exception.

A non-continuable exception causes the process to unload or freeze with a "Non-continuable Exception" message to prevent a stack fault in RTSS.

The Win32 behavior differs; it continues re-raising EXCEPTION_NONCONTINUABLE_EXCEPTION.

nNumberOfArguments

The number of arguments in the lpArguments array. This value must not exceed EXCEPTION_MAXIMUM_PARAMETERS. This parameter is ignored if lpArguments is NULL.

lpArguments

A pointer to an array of 32-bit arguments. This parameter can be NULL. These arguments can contain any application-defined data that needs to be passed to the filter expression of the exception handler.

Return Value

This function does not return a value.

Remarks

RaiseException enables a process to use structured exception handling to handle private, software-generated, application-defined exceptions. Raising an exception causes the exception dispatcher to go through the following search for an exception handler:

  1. The system attempts to locate a frame-based exception handler by searching the stack frames of the thread in which the exception occurred. The system searches the current stack frame first, then proceeds backward through preceding stack frames.
  2. If no frame-based handler can be found, or no frame-based handler handles the exception, the system provides default handling based on the exception type. For most exceptions, the default action is to call ExitProcess.

The values specified in the ExceptionCode, ExceptionFlags, nNumberOfArguments, and lpArguments parameters can be retrieved in the filter expression of a try-except frame-based exception handler by calling GetExceptionInformation.

Requirements

Library Rtx_Rtss.lib

See Also:

ExitProcess

GetExceptionCode

GetExceptionInformation