Pointers
The 1st parameter to the exception handler points to the EXCEPTIONREPORTRECORD.
The 2nd parameter to the exception handler points to the EXCEPTIONREGISTRATIONRECORD.
The 3nd parameter to the exception handler points to the CONTEXTRECORD.
CONTEXTRECORD Exception handler context record.
┌────────────────┬──────┬──────┬────┬────────────────────────────────────────┐│Field Name │Offset│Length│Type│Description │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ContextFlags │+0 │4 │D │Flags │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ │+4 │6c │S │Floating point section │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_env │+4 │1c │D │Floating point environment │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_stack │+20 │50 │S │Floating point register stack (8 FPREG │ │ │ │ │ │structures) │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ │+70 │10 │S │Segment Register section │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_SegGs │+70 │4 │D │GS segment register │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_SegFs │+74 │4 │D │FS segment register │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_SegEs │+78 │4 │D │ES segment register │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_SegDs │+7c │4 │D │DS segment register │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ │+80 │18 │S │Integer Register section │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_RegEdi │+80 │4 │D │EDI register │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_RegEsi │+84 │4 │D │ESI register │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_RegEax │+88 │4 │D │EAX register │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_RegEbx │+8c │4 │D │EBX register │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_RegEcx │+90 │4 │D │ECX register │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_RegEdx │+94 │4 │D │EDX register │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ │+98 │18 │S │Control Register section │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_RegEbp │+98 │4 │D │EBP register │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_RegEip │+9c │4 │D │EIP register │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_SegCs │+a0 │4 │D │CS selector │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_EFlags │+a4 │4 │D │Processor Flags register │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_RegEsp │+a8 │4 │D │ESP register │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ctx_SegSs │+ac │4 │D │SS segment register │ └────────────────┴──────┴──────┴────┴────────────────────────────────────────┘
FPREG Floating Point Register Stack Element
┌────────────────┬──────┬──────┬────┬────────────────────────────────────────┐ │Field Name │Offset│Length│Type│Description │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │losig │+0 │4 │D │Low significance double-word │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │hisig │+4 │4 │D │High significance double-word │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │signexp │+8 │2 │W │Exponent │ └────────────────┴──────┴──────┴────┴────────────────────────────────────────┘
ContextFlags flag definitions:
┌──────────────────────┬───────────┬────────────────────────────┐ │Name │Bit Mask │Description │ ├──────────────────────┼───────────┼────────────────────────────┤ │CONTEXT_CONTROL │0x00000001L│SS:ESP, CS:EIP, EFLAGS, EBP │ ├──────────────────────┼───────────┼────────────────────────────┤ │CONTEXT_INTEGER │0x00000002L│EAX, EBX, ECX, EDX, ESI, EDI│ ├──────────────────────┼───────────┼────────────────────────────┤ │CONTEXT_SEGMENTS │0x00000004L│DS, ES, FS, GS │ ├──────────────────────┼───────────┼────────────────────────────┤ │CONTEXT_FLOATING_POINT│0x00000008L│Numeric coprocessor state │ └──────────────────────┴───────────┴────────────────────────────┘
EXCEPTIONREPORTRECORD Exception Handler Report Record.
┌────────────────────────────┬──────┬──────┬────┬────────────────────────────────────────┐ │Field Name │Offset│Length│Type│Description │ ├────────────────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ExceptionNum │+0 │4 │D │Exception number │ ├────────────────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │fHandlerFlags │+4 │4 │D │Exception attributes │ ├────────────────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │NestedExceptionReportRecord │+8 │4 │D │Preceding exception's report record if │ │ │ │ │ │nested exception │ ├────────────────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ExceptionAddress │+c │4 │D │Exception address │ ├────────────────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │cParameters │+10 │4 │D │Size of exception specific information │ ├────────────────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ExceptionInfo │+14 │10 │D │Exception specfic information │ └────────────────────────────┴──────┴──────┴────┴────────────────────────────────────────┘
fHandlerFlags flag definitions:
┌─────────────────┬────────┬────────────────────────────────┐ │Name │Bit Mask│Description │ ├─────────────────┼────────┼────────────────────────────────┤ │EH_NONCONTINUABLE│0x1 │Noncontinuable exception │ ├─────────────────┼────────┼────────────────────────────────┤ │EH_UNWINDING │0x2 │Unwind is in progress │ ├─────────────────┼────────┼────────────────────────────────┤ │EH_EXIT_UNWIND │0x4 │Exit unwind is in progress │ ├─────────────────┼────────┼────────────────────────────────┤ │EH_STACK_INVALID │0x8 │Stack out of limits or unaligned│ ├─────────────────┼────────┼────────────────────────────────┤ │EH_NESTED_CALL │0x10 │Nested exception handler call │ └─────────────────┴────────┴────────────────────────────────┘
EXCEPTIONREGISTRATIONRECORD Exception Handler Registration Record.
┌────────────────┬──────┬──────┬────┬────────────────────────────────────────┐ │Field Name │Offset│Length│Type│Description │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │prev_structure │+0 │4 │D │Previously registered exception handler │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │ExceptionHandler│+4 │4 │D │Exception handler entry point address or│ │ │ │ │ │-1 if end of chain │ └────────────────┴──────┴──────┴────┴────────────────────────────────────────┘