25#define WIN32_LEAN_AND_MEAN
36#ifdef _SEH_ENABLE_TRACE
39#define _SEH_TRACE_HEADER_(FRAME_) \
40 DbgPrint("[PSEH:%p]%s:%d:", FRAME_, __FILE__, __LINE__);
42#define _SEH_TRACE_TRAILER_ \
45#define _SEH_FILTER_RET_STRING_(RET_) \
46 (((int)(RET_) < 0) ? "_SEH_CONTINUE_EXECUTION" : (((int)(RET_) > 0) ? "_SEH_EXECUTE_HANDLER" : "_SEH_CONTINUE_SEARCH"))
48#define _SEH_TRACE_LINE_(FRAME_, ARGS_) \
50 _SEH_TRACE_HEADER_(FRAME_); \
52 _SEH_TRACE_TRAILER_; \
55#define _SEH_TRACE_ENTER(FRAME_, FUNCNAME_, ARGS_) \
57 if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_ENTER_LEAVE) \
59 _SEH_TRACE_HEADER_(FRAME_); \
60 DbgPrint(">>> %s(", (FUNCNAME_)); \
63 _SEH_TRACE_TRAILER_; \
67#define _SEH_TRACE_LEAVE(FRAME_, FUNCNAME_, ARGS_) \
69 if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_ENTER_LEAVE) \
71 _SEH_TRACE_HEADER_(FRAME_); \
72 DbgPrint("<<< %s => ", (FUNCNAME_)); \
74 _SEH_TRACE_TRAILER_; \
78#define _SEH_TRACE_EXCEPTION_RECORD(FRAME_, ER_) \
80 if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_EXCEPTION_RECORD) \
86 "ExceptionRecord %p = { ExceptionCode : %08X, ExceptionFlags : %08X, ExceptionRecord : %p, ExceptionAddress : %p }", \
88 (ER_)->ExceptionCode, \
89 (ER_)->ExceptionFlags, \
90 (ER_)->ExceptionRecord, \
91 (ER_)->ExceptionAddress \
98#define _SEH_TRACE_CONTEXT(FRAME_, CONTEXT_) \
100 if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_CONTEXT) \
102 if(((CONTEXT_)->ContextFlags & CONTEXT_INTEGER) == CONTEXT_INTEGER) \
108 "eax=%08X ebx=%08X ecx=%08X edx=%08X esi=%08X edi=%08X", \
119 if(((CONTEXT_)->ContextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL) \
125 "eip=%08X esp=%08X ebp=%08X efl=%08X cs=%08X ss=%08X", \
129 (CONTEXT_)->EFlags, \
136 if(((CONTEXT_)->ContextFlags & CONTEXT_SEGMENTS) == CONTEXT_SEGMENTS) \
142 "ds=%08X es=%08X fs=%08X gs=%08X", \
153#define _SEH_TRACE_CONTEXT(FRAME_, CONTEXT_)
156#define _SEH_TRACE_UNWIND(FRAME_, ARGS_) \
158 if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_UNWIND) \
160 _SEH_TRACE_LINE_((FRAME_), ARGS_); \
164#define _SEH_TRACE_TRYLEVEL(FRAME_, TRYLEVEL_) \
166 if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_TRYLEVEL) \
168 _SEH_TRACE_LINE_((FRAME_), ("trylevel %p, filter %p", (TRYLEVEL_), (TRYLEVEL_)->SPT_Handlers.SH_Filter)); \
172#define _SEH_TRACE_ENTER_CALL_FILTER(FRAME_, TRYLEVEL_, ER_) \
174 if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_CALL_FILTER) \
180 "trylevel %p, calling filter %p, ExceptionCode %08X", \
182 (TRYLEVEL_)->SPT_Handlers.SH_Filter, \
183 (ER_)->ExceptionCode \
189#define _SEH_TRACE_LEAVE_CALL_FILTER(FRAME_, TRYLEVEL_, RET_) \
191 if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_CALL_FILTER) \
197 "trylevel %p, filter %p => %s", \
199 (TRYLEVEL_)->SPT_Handlers.SH_Filter, \
200 _SEH_FILTER_RET_STRING_(RET_) \
206#define _SEH_TRACE_FILTER(FRAME_, TRYLEVEL_, RET_) \
208 if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_FILTER) \
214 "trylevel %p => %s", \
216 _SEH_FILTER_RET_STRING_(RET_) \
222#define _SEH_TRACE_ENTER_CALL_HANDLER(FRAME_, TRYLEVEL_) \
224 if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_CALL_HANDLER) \
226 _SEH_TRACE_LINE_((FRAME_), ("trylevel %p, handling", (TRYLEVEL_))); \
230#define _SEH_TRACE_ENTER_CALL_FINALLY(FRAME_, TRYLEVEL_) \
232 if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_CALL_FINALLY) \
238 "trylevel %p, calling exit routine %p", \
240 (TRYLEVEL_)->SPT_Handlers.SH_Finally \
246#define _SEH_TRACE_LEAVE_CALL_FINALLY(FRAME_, TRYLEVEL_) \
248 if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_CALL_FINALLY) \
254 "trylevel %p, exit routine %p returned", \
256 (TRYLEVEL_)->SPT_Handlers.SH_Finally \
263#define _SEH_TRACE_ENTER(FRAME_, FUNCNAME_, ARGS_)
264#define _SEH_TRACE_LEAVE(FRAME_, FUNCNAME_, ARGS_)
265#define _SEH_TRACE_EXCEPTION_RECORD(FRAME_, ER_)
266#define _SEH_TRACE_CONTEXT(FRAME_, CONTEXT_)
267#define _SEH_TRACE_UNWIND(FRAME_, ARGS_)
268#define _SEH_TRACE_TRYLEVEL(FRAME_, TRYLEVEL_)
269#define _SEH_TRACE_ENTER_CALL_FILTER(FRAME_, TRYLEVEL_, ER_)
270#define _SEH_TRACE_LEAVE_CALL_FILTER(FRAME_, TRYLEVEL_, RET_)
271#define _SEH_TRACE_FILTER(FRAME_, TRYLEVEL_, RET_)
272#define _SEH_TRACE_ENTER_CALL_HANDLER(FRAME_, TRYLEVEL_)
273#define _SEH_TRACE_ENTER_CALL_FINALLY(FRAME_, TRYLEVEL_)
274#define _SEH_TRACE_LEAVE_CALL_FINALLY(FRAME_, TRYLEVEL_)
301 trylevel != dsttrylevel;
414 ret = pfnFilter(&ep, frame);
429 _SEH_TRACE_LEAVE(frame,
"_SEHFrameHandler", (
"ExceptionContinueExecution"));
@ ExceptionContinueSearch
@ ExceptionContinueExecution
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
void __stdcall _SEHReturn_s(void)
#define _SEH_TRACE_ENTER_CALL_FILTER(FRAME_, TRYLEVEL_, ER_)
void _SEH_FASTCALL _SEHEnterFrame_f(_SEHPortableFrame_t *frame)
static void __cdecl _SEHCallHandler(_SEHPortableFrame_t *frame, _SEHPortableTryLevel_t *trylevel)
#define _SEH_TRACE_ENTER_CALL_HANDLER(FRAME_, TRYLEVEL_)
void __stdcall _SEHEnterFrame_s(_SEHPortableFrame_t *frame)
void _SEH_FASTCALL _SEHLeaveFrame_f(void)
void const * _SEHRtlUnwind
void _SEH_FASTCALL _SEHReturn_f(void)
void __cdecl _SEHCleanHandlerEnvironment(void)
#define _SEH_TRACE_LEAVE_CALL_FINALLY(FRAME_, TRYLEVEL_)
#define _SEH_TRACE_EXCEPTION_RECORD(FRAME_, ER_)
static int __cdecl _SEHFrameHandler(struct _EXCEPTION_RECORD *ExceptionRecord, void *EstablisherFrame, struct _CONTEXT *ContextRecord, void *DispatcherContext)
#define _SEH_TRACE_ENTER_CALL_FINALLY(FRAME_, TRYLEVEL_)
void __stdcall RtlUnwind(void *, void *, PEXCEPTION_RECORD, void *)
void __cdecl _SEHGlobalUnwind(_SEHPortableFrame_t *)
static void __stdcall _SEHLocalUnwind(_SEHPortableFrame_t *frame, _SEHPortableTryLevel_t *dsttrylevel)
#define _SEH_TRACE_UNWIND(FRAME_, ARGS_)
_SEHRegistration_t *__cdecl _SEHCurrentRegistration(void)
#define _SEH_TRACE_ENTER(FRAME_, FUNCNAME_, ARGS_)
#define _SEH_TRACE_TRYLEVEL(FRAME_, TRYLEVEL_)
struct __SEHRegistration *__cdecl _SEHRegisterFrame(_SEHRegistration_t *)
void __cdecl _SEHUnregisterFrame(void)
void __stdcall _SEHLeaveFrame_s(void)
#define _SEH_TRACE_LEAVE_CALL_FILTER(FRAME_, TRYLEVEL_, RET_)
#define _SEH_TRACE_LEAVE(FRAME_, FUNCNAME_, ARGS_)
#define _SEH_TRACE_FILTER(FRAME_, TRYLEVEL_, RET_)
#define _SEH_TRACE_CONTEXT(FRAME_, CONTEXT_)
#define _SEH_STATIC_FILTER(ACTION_)
#define _SEH_CONTINUE_SEARCH
#define _SEH_CONTINUE_EXECUTION
#define _SEH_EXECUTE_HANDLER
unsigned __int3264 UINT_PTR
_IRQL_requires_same_ _In_ PVOID EstablisherFrame
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT * ContextRecord
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT _In_ PVOID DispatcherContext
#define _SEH_CONTAINING_RECORD(ADDR_, TYPE_, FIELD_)
void(__stdcall * _SEHFinally_t)(struct __SEHPortableFrame *)
long(__stdcall * _SEHFilter_t)(struct _EXCEPTION_POINTERS *, struct __SEHPortableFrame *)
PEXCEPTION_RECORD ExceptionRecord
volatile _SEHHandler_t SPF_Handler
_SEHRegistration_t SPF_Registration
_SEHPortableTryLevel_t *volatile SPF_TopTryLevel
struct __SEHPortableTryLevel *volatile SPT_Next
volatile _SEHHandlers_t SPT_Handlers
_SEHFrameHandler_t SER_Handler