From fb30a92d3dcbe8ea868ae4f3fe88d632e395b67e Mon Sep 17 00:00:00 2001 From: midipix Date: Thu, 14 Mar 2019 15:20:47 +0000 Subject: nt_exception.h: added SEH-oriented definitions. --- include/ntapi/nt_exception.h | 47 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/ntapi/nt_exception.h b/include/ntapi/nt_exception.h index 8465d7c..75bf361 100644 --- a/include/ntapi/nt_exception.h +++ b/include/ntapi/nt_exception.h @@ -5,9 +5,27 @@ #include "nt_object.h" #include "nt_thread.h" -/* limits */ +/* exception limits */ #define NT_EXCEPTION_MAX_PARAMS (0x0F) +/* exception flags */ +#define NT_EXCEPTION_FLAG_NONCONTINUABLE (1 << 0) +#define NT_EXCEPTION_FLAG_UNWINDING (1 << 1) +#define NT_EXCEPTION_FLAG_EXIT_UNWIND (1 << 2) +#define NT_EXCEPTION_FLAG_STACK_INVALID (1 << 3) +#define NT_EXCEPTION_FLAG_NESTED_CALL (1 << 4) +#define NT_EXCEPTION_FLAG_TARGET_UNWIND (1 << 5) +#define NT_EXCEPTION_FLAG_COLLIDED_UNWIND (1 << 6) +#define NT_EXCEPTION_FLAG_UNWIND ( NT_EXCEPTION_UNWINDING \ + || NT_EXCEPTION_EXIT_UNWIND \ + || NT_EXCEPTION_TARGET_UNWIND \ + || NT_EXCEPTION_COLLIDED_UNWIND ) + +/* exception definitions */ +typedef struct _nt_exception_record nt_exception_record; +typedef struct _nt_dispatcher_context nt_dispatcher_context; +typedef struct _nt_unwind_history_table nt_unwind_history_table; + typedef enum _nt_exception_disposition { NT_EXCEPTION_CONTINUE_EXECUTION, NT_EXCEPTION_CONTINUE_SEARCH, @@ -24,6 +42,33 @@ typedef struct _nt_exception_record { uintptr_t exception_information[NT_EXCEPTION_MAX_PARAMS]; } nt_exception_record; +typedef struct _nt_runtime_function { + uint32_t raddr_fn_start; + uint32_t raddr_fn_end; + uint32_t raddr_uw_info; +} nt_runtime_function; + +typedef nt_exception_disposition (*nt_exception_routine)( + nt_exception_record *, + uintptr_t, + nt_thread_context *, + nt_dispatcher_context *); + +typedef struct _nt_dispatcher_context { + uintptr_t control_pc; + uintptr_t image_base; + nt_runtime_function * fn_entry; + uintptr_t establisher_frame; + uintptr_t target_ip; + nt_thread_context * tctx; + nt_exception_routine language_handler; + void * handler_data; + nt_unwind_history_table * history_table; + uint32_t scope_index; + uint32_t __pad; +} nt_dispatcher_context; + +/* exception interfaces */ typedef int32_t __stdcall ntapi_zw_raise_exception( __in nt_exception_record * exception_record, __in nt_thread_context * context, -- cgit v1.2.3