/* * Exception support functions * * This file is part of System Informer. */ #ifndef _NTXCAPI_H #define _NTXCAPI_H NTSYSAPI BOOLEAN NTAPI RtlDispatchException( _In_ PEXCEPTION_RECORD ExceptionRecord, _In_ PCONTEXT ContextRecord ); _Analysis_noreturn_ NTSYSAPI DECLSPEC_NORETURN VOID NTAPI RtlRaiseStatus( _In_ NTSTATUS Status ); /** * Raises an exception in the calling thread. * * \param ExceptionRecord A pointer to an EXCEPTION_RECORD structure that contains the exception information. You must specify the ExceptionAddress and ExceptionCode members. * \return This function does not return a value. * \see https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-raiseexception */ NTSYSAPI VOID NTAPI RtlRaiseException( _In_ PEXCEPTION_RECORD ExceptionRecord ); #if (PHNT_VERSION >= PHNT_WINDOWS_10_20H1) // rev NTSYSAPI VOID NTAPI RtlRaiseExceptionForReturnAddressHijack( VOID ); // rev _Analysis_noreturn_ NTSYSAPI DECLSPEC_NORETURN VOID NTAPI RtlRaiseNoncontinuableException( _In_ PEXCEPTION_RECORD ExceptionRecord, _In_ PCONTEXT ContextRecord ); #endif // PHNT_VERSION >= PHNT_WINDOWS_10_20H1 NTSYSCALLAPI NTSTATUS NTAPI NtContinue( _In_ PCONTEXT ContextRecord, _In_ BOOLEAN TestAlert ); #if (PHNT_VERSION >= PHNT_WINDOWS_10) typedef enum _KCONTINUE_TYPE { KCONTINUE_UNWIND, KCONTINUE_RESUME, KCONTINUE_LONGJUMP, KCONTINUE_SET, KCONTINUE_LAST, } KCONTINUE_TYPE; typedef struct _KCONTINUE_ARGUMENT { KCONTINUE_TYPE ContinueType; ULONG ContinueFlags; ULONGLONG Reserved[2]; } KCONTINUE_ARGUMENT, *PKCONTINUE_ARGUMENT; #define KCONTINUE_FLAG_TEST_ALERT 0x00000001 // wbenny #define KCONTINUE_FLAG_DELIVER_APC 0x00000002 // wbenny NTSYSCALLAPI NTSTATUS NTAPI NtContinueEx( _In_ PCONTEXT ContextRecord, _In_ PVOID ContinueArgument // PKCONTINUE_ARGUMENT and BOOLEAN are valid ); //FORCEINLINE //NTSTATUS //NtContinue( // _In_ PCONTEXT ContextRecord, // _In_ BOOLEAN TestAlert // ) //{ // return NtContinueEx(ContextRecord, (PCONTINUE_ARGUMENT)TestAlert); //} #endif // PHNT_VERSION >= PHNT_WINDOWS_10 NTSYSCALLAPI NTSTATUS NTAPI NtRaiseException( _In_ PEXCEPTION_RECORD ExceptionRecord, _In_ PCONTEXT ContextRecord, _In_ BOOLEAN FirstChance ); _Analysis_noreturn_ NTSYSAPI DECLSPEC_NORETURN VOID NTAPI RtlAssert( _In_ PVOID VoidFailedAssertion, _In_ PVOID VoidFileName, _In_ ULONG LineNumber, _In_opt_ PCSTR MutableMessage ); #endif // _NTXCAPI_H