You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
213 lines
7.1 KiB
213 lines
7.1 KiB
#ifndef _EXCEPT_
|
|
#define _EXCEPT_
|
|
|
|
typedef LONG (*PFNUNHANDLEDEXCEPTION)(struct _EXCEPTION_POINTERS *ExceptionInfo);
|
|
#define EXCEPTION_MAXIMUM_PARAMETERS 15 // maximum number of exception parameters
|
|
#define SIZE_OF_80387_REGISTERS 80
|
|
#define MAXIMUM_SUPPORTED_EXTENSION 512
|
|
#define BREAKPOINT_BREAK 0
|
|
|
|
typedef struct _FLOATING_SAVE_AREA {
|
|
DWORD ControlWord;
|
|
DWORD StatusWord;
|
|
DWORD TagWord;
|
|
DWORD ErrorOffset;
|
|
DWORD ErrorSelector;
|
|
DWORD DataOffset;
|
|
DWORD DataSelector;
|
|
BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
|
|
DWORD Cr0NpxState;
|
|
} FLOATING_SAVE_AREA;
|
|
|
|
typedef FLOATING_SAVE_AREA *PFLOATING_SAVE_AREA;
|
|
|
|
//
|
|
// Context Frame
|
|
//
|
|
|
|
typedef struct _CONTEXT {
|
|
|
|
//
|
|
// The flags values within this flag control the contents of
|
|
// a CONTEXT record.
|
|
//
|
|
// If the context record is used as an input parameter, then
|
|
// for each portion of the context record controlled by a flag
|
|
// whose value is set, it is assumed that that portion of the
|
|
// context record contains valid context. If the context record
|
|
// is being used to modify a threads context, then only that
|
|
// portion of the threads context will be modified.
|
|
//
|
|
// If the context record is used as an IN OUT parameter to capture
|
|
// the context of a thread, then only those portions of the thread's
|
|
// context corresponding to set flags will be returned.
|
|
//
|
|
// The context record is never used as an OUT only parameter.
|
|
//
|
|
|
|
DWORD ContextFlags;
|
|
|
|
//
|
|
// This section is specified/returned if CONTEXT_DEBUG_REGISTERS is
|
|
// set in ContextFlags. Note that CONTEXT_DEBUG_REGISTERS is NOT
|
|
// included in CONTEXT_FULL.
|
|
//
|
|
|
|
DWORD Dr0;
|
|
DWORD Dr1;
|
|
DWORD Dr2;
|
|
DWORD Dr3;
|
|
DWORD Dr6;
|
|
DWORD Dr7;
|
|
|
|
//
|
|
// This section is specified/returned if the
|
|
// ContextFlags word contians the flag CONTEXT_FLOATING_POINT.
|
|
//
|
|
|
|
FLOATING_SAVE_AREA FloatSave;
|
|
|
|
//
|
|
// This section is specified/returned if the
|
|
// ContextFlags word contians the flag CONTEXT_SEGMENTS.
|
|
//
|
|
|
|
DWORD SegGs;
|
|
DWORD SegFs;
|
|
DWORD SegEs;
|
|
DWORD SegDs;
|
|
|
|
//
|
|
// This section is specified/returned if the
|
|
// ContextFlags word contians the flag CONTEXT_INTEGER.
|
|
//
|
|
|
|
DWORD Edi;
|
|
DWORD Esi;
|
|
DWORD Ebx;
|
|
DWORD Edx;
|
|
DWORD Ecx;
|
|
DWORD Eax;
|
|
|
|
//
|
|
// This section is specified/returned if the
|
|
// ContextFlags word contians the flag CONTEXT_CONTROL.
|
|
//
|
|
|
|
DWORD Ebp;
|
|
DWORD Eip;
|
|
DWORD SegCs; // MUST BE SANITIZED
|
|
DWORD EFlags; // MUST BE SANITIZED
|
|
DWORD Esp;
|
|
DWORD SegSs;
|
|
|
|
//
|
|
// This section is specified/returned if the ContextFlags word
|
|
// contains the flag CONTEXT_EXTENDED_REGISTERS.
|
|
// The format and contexts are processor specific
|
|
//
|
|
|
|
BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
|
|
|
|
} CONTEXT;
|
|
|
|
typedef CONTEXT *PCONTEXT;
|
|
|
|
//
|
|
// Exception record definition.
|
|
//
|
|
|
|
typedef struct _EXCEPTION_RECORD {
|
|
DWORD ExceptionCode;
|
|
DWORD ExceptionFlags;
|
|
struct _EXCEPTION_RECORD *ExceptionRecord;
|
|
PVOID ExceptionAddress;
|
|
DWORD NumberParameters;
|
|
UINT ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
|
|
} EXCEPTION_RECORD;
|
|
|
|
typedef EXCEPTION_RECORD *PEXCEPTION_RECORD;
|
|
|
|
typedef struct _EXCEPTION_POINTERS {
|
|
PEXCEPTION_RECORD ExceptionRecord;
|
|
PCONTEXT ContextRecord;
|
|
} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
|
|
|
|
typedef struct _STACKFRAME {
|
|
PVOID RetAddress;
|
|
PVOID pExceptPointers;
|
|
EXCEPTION_POINTERS ExceptPointers;
|
|
} STACKFRAME, *PSTACKFRAME;
|
|
|
|
#define STATUS_WAIT_0 ((DWORD )0x00000000L)
|
|
#define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L)
|
|
#define STATUS_USER_APC ((DWORD )0x000000C0L)
|
|
#define STATUS_TIMEOUT ((DWORD )0x00000102L)
|
|
#define STATUS_PENDING ((DWORD )0x00000103L)
|
|
#define STATUS_SEGMENT_NOTIFICATION ((DWORD )0x40000005L)
|
|
#define STATUS_GUARD_PAGE_VIOLATION ((DWORD )0x80000001L)
|
|
#define STATUS_DATATYPE_MISALIGNMENT ((DWORD )0x80000002L)
|
|
#define STATUS_BREAKPOINT ((DWORD )0x80000003L)
|
|
#define STATUS_SINGLE_STEP ((DWORD )0x80000004L)
|
|
#define STATUS_ACCESS_VIOLATION ((DWORD )0xC0000005L)
|
|
#define STATUS_IN_PAGE_ERROR ((DWORD )0xC0000006L)
|
|
#define STATUS_INVALID_HANDLE ((DWORD )0xC0000008L)
|
|
#define STATUS_NO_MEMORY ((DWORD )0xC0000017L)
|
|
#define STATUS_ILLEGAL_INSTRUCTION ((DWORD )0xC000001DL)
|
|
#define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD )0xC0000025L)
|
|
#define STATUS_INVALID_DISPOSITION ((DWORD )0xC0000026L)
|
|
#define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD )0xC000008CL)
|
|
#define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD )0xC000008DL)
|
|
#define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD )0xC000008EL)
|
|
#define STATUS_FLOAT_INEXACT_RESULT ((DWORD )0xC000008FL)
|
|
#define STATUS_FLOAT_INVALID_OPERATION ((DWORD )0xC0000090L)
|
|
#define STATUS_FLOAT_OVERFLOW ((DWORD )0xC0000091L)
|
|
#define STATUS_FLOAT_STACK_CHECK ((DWORD )0xC0000092L)
|
|
#define STATUS_FLOAT_UNDERFLOW ((DWORD )0xC0000093L)
|
|
#define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD )0xC0000094L)
|
|
#define STATUS_INTEGER_OVERFLOW ((DWORD )0xC0000095L)
|
|
#define STATUS_PRIVILEGED_INSTRUCTION ((DWORD )0xC0000096L)
|
|
#define STATUS_STACK_OVERFLOW ((DWORD )0xC00000FDL)
|
|
#define STATUS_CONTROL_C_EXIT ((DWORD )0xC000013AL)
|
|
#define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD )0xC00002B4L)
|
|
#define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD )0xC00002B5L)
|
|
#define STATUS_ILLEGAL_VLM_REFERENCE ((DWORD )0xC00002C0L)
|
|
|
|
/*
|
|
* EFLAGs bit assignments
|
|
*/
|
|
#define CF_BIT 0
|
|
#define CF_MASK (1 << CF_BIT)
|
|
#define PF_BIT 2
|
|
#define PF_MASK (1 << PF_BIT)
|
|
#define AF_BIT 4
|
|
#define AF_MASK (1 << AF_BIT)
|
|
#define ZF_BIT 6
|
|
#define ZF_MASK (1 << ZF_BIT)
|
|
#define SF_BIT 7
|
|
#define SF_MASK (1 << SF_BIT)
|
|
#define TF_BIT 8
|
|
#define TF_MASK (1 << TF_BIT)
|
|
#define IF_BIT 9
|
|
#define IF_MASK (1 << IF_BIT)
|
|
#define DF_BIT 10
|
|
#define DF_MASK (1 << DF_BIT)
|
|
#define OF_BIT 11 /* Overflow flag */
|
|
#define OF_MASK (1 << OF_BIT)
|
|
#define IOPL_MASK 0x3000 /* IOPL flags */
|
|
#define IOPL_BIT0 12
|
|
#define IOPL_BIT1 13
|
|
#define NT_BIT 14 /* Nested task flag */
|
|
#define NT_MASK (1 << NT_BIT)
|
|
#define RF_BIT 16 /* Resume flag */
|
|
#define RF_MASK (1 << RF_BIT)
|
|
#define VM_BIT 17 /* Virtual Mode flag */
|
|
#define VM_MASK (1 << VM_BIT)
|
|
#define AC_BIT 18 /* Alignment check */
|
|
#define AC_MASK (1 << AC_BIT)
|
|
#define VIF_BIT 19 /* Virtual Interrupt flag */
|
|
#define VIF_MASK (1 << VIF_BIT)
|
|
#define VIP_BIT 20 /* Virtual Interrupt pending */
|
|
#define VIP_MASK (1 << VIP_BIT)
|
|
|
|
#endif //_EXCEPT_
|