RaiseFailFastException函数

引发绕过所有异常处理程序(基于帧或矢量)的异常。引发此异常将终止应用程序并调用Windows错误报告(如果Windows错误报告正在运行)。

原型:

VOID WINAPI RaiseFailFastException(
  __in_opt  PEXCEPTION_RECORD pExceptionRecord,
  __in_opt  PCONTEXT pContextRecord,
  __in      DWORD dwFlags
);

参数:

  • pExceptionRecord [in, optional]
    指向包含异常信息的异常记录结构的指针。必须指定ExceptionAddress和ExceptionCode成员。如果此参数为空,则函数将创建异常记录,并将ExceptionCode成员设置为STATUS_FAIL_FAST_EXCEPTION。如果dwFlags参数包含FAIL_FAST_GENERATE_EXCEPTION_ADDRESS标志,则该函数还将设置ExceptionAddress成员。
  • pContextRecord [in, optional]
    指向包含上下文信息的上下文结构的指针。如果为空,此函数将生成上下文(但是,上下文将与调用方的上下文不匹配)。
  • dwFlags [in]
    可以指定零个或一个或多个以下标志来控制此函数的行为:
    ValueMeaning
    FAIL_FAST_GENERATE_EXCEPTION_ADDRESS 0x1

    Causes RaiseFailFastException to set the ExceptionAddress of EXCEPTION_RECORD to the return address of this function (the next instruction in the caller after the call to RaiseFailFastException). This function will set the exception address only if ExceptionAddress is NULL.

    FAIL_FAST_NO_HARD_ERROR_DLG 0x2

    If the Windows Error Report service is not running when an unhandled exception occurs, a message box is diplayed to the user that identifies the address where the exception occurred. To prevent the message box from being displayed to the user, and to fail silently, set this flag.

返回值:无

通常,如果应用程序处于错误状态,并且希望立即终止并创建Windows错误报告,则调用此函数。 如果WER服务未运行或没有任何调试器附加到进程,则该进程将被终止。此函数引发第二次机会异常。如果启用了JIT调试,则调试器将附加到进程。

支持环境:

Minimum supported client Windows 7
Minimum supported server Windows Server 2008 R2
Header Winbase.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll
原文地址:https://www.cnblogs.com/yilang/p/11822080.html