Leaked source code of windows server 2003
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

  1. #ifndef _EXCEPT_
  2. #define _EXCEPT_
  3. typedef LONG (*PFNUNHANDLEDEXCEPTION)(struct _EXCEPTION_POINTERS *ExceptionInfo);
  4. #define EXCEPTION_MAXIMUM_PARAMETERS 15 // maximum number of exception parameters
  5. #define SIZE_OF_80387_REGISTERS 80
  6. #define MAXIMUM_SUPPORTED_EXTENSION 512
  7. #define BREAKPOINT_BREAK 0
  8. typedef struct _FLOATING_SAVE_AREA {
  9. DWORD ControlWord;
  10. DWORD StatusWord;
  11. DWORD TagWord;
  12. DWORD ErrorOffset;
  13. DWORD ErrorSelector;
  14. DWORD DataOffset;
  15. DWORD DataSelector;
  16. BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
  17. DWORD Cr0NpxState;
  18. } FLOATING_SAVE_AREA;
  19. typedef FLOATING_SAVE_AREA *PFLOATING_SAVE_AREA;
  20. //
  21. // Context Frame
  22. //
  23. typedef struct _CONTEXT {
  24. //
  25. // The flags values within this flag control the contents of
  26. // a CONTEXT record.
  27. //
  28. // If the context record is used as an input parameter, then
  29. // for each portion of the context record controlled by a flag
  30. // whose value is set, it is assumed that that portion of the
  31. // context record contains valid context. If the context record
  32. // is being used to modify a threads context, then only that
  33. // portion of the threads context will be modified.
  34. //
  35. // If the context record is used as an IN OUT parameter to capture
  36. // the context of a thread, then only those portions of the thread's
  37. // context corresponding to set flags will be returned.
  38. //
  39. // The context record is never used as an OUT only parameter.
  40. //
  41. DWORD ContextFlags;
  42. //
  43. // This section is specified/returned if CONTEXT_DEBUG_REGISTERS is
  44. // set in ContextFlags. Note that CONTEXT_DEBUG_REGISTERS is NOT
  45. // included in CONTEXT_FULL.
  46. //
  47. DWORD Dr0;
  48. DWORD Dr1;
  49. DWORD Dr2;
  50. DWORD Dr3;
  51. DWORD Dr6;
  52. DWORD Dr7;
  53. //
  54. // This section is specified/returned if the
  55. // ContextFlags word contians the flag CONTEXT_FLOATING_POINT.
  56. //
  57. FLOATING_SAVE_AREA FloatSave;
  58. //
  59. // This section is specified/returned if the
  60. // ContextFlags word contians the flag CONTEXT_SEGMENTS.
  61. //
  62. DWORD SegGs;
  63. DWORD SegFs;
  64. DWORD SegEs;
  65. DWORD SegDs;
  66. //
  67. // This section is specified/returned if the
  68. // ContextFlags word contians the flag CONTEXT_INTEGER.
  69. //
  70. DWORD Edi;
  71. DWORD Esi;
  72. DWORD Ebx;
  73. DWORD Edx;
  74. DWORD Ecx;
  75. DWORD Eax;
  76. //
  77. // This section is specified/returned if the
  78. // ContextFlags word contians the flag CONTEXT_CONTROL.
  79. //
  80. DWORD Ebp;
  81. DWORD Eip;
  82. DWORD SegCs; // MUST BE SANITIZED
  83. DWORD EFlags; // MUST BE SANITIZED
  84. DWORD Esp;
  85. DWORD SegSs;
  86. //
  87. // This section is specified/returned if the ContextFlags word
  88. // contains the flag CONTEXT_EXTENDED_REGISTERS.
  89. // The format and contexts are processor specific
  90. //
  91. BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
  92. } CONTEXT;
  93. typedef CONTEXT *PCONTEXT;
  94. //
  95. // Exception record definition.
  96. //
  97. typedef struct _EXCEPTION_RECORD {
  98. DWORD ExceptionCode;
  99. DWORD ExceptionFlags;
  100. struct _EXCEPTION_RECORD *ExceptionRecord;
  101. PVOID ExceptionAddress;
  102. DWORD NumberParameters;
  103. UINT ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
  104. } EXCEPTION_RECORD;
  105. typedef EXCEPTION_RECORD *PEXCEPTION_RECORD;
  106. typedef struct _EXCEPTION_POINTERS {
  107. PEXCEPTION_RECORD ExceptionRecord;
  108. PCONTEXT ContextRecord;
  109. } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
  110. typedef struct _STACKFRAME {
  111. PVOID RetAddress;
  112. PVOID pExceptPointers;
  113. EXCEPTION_POINTERS ExceptPointers;
  114. } STACKFRAME, *PSTACKFRAME;
  115. #define STATUS_WAIT_0 ((DWORD )0x00000000L)
  116. #define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L)
  117. #define STATUS_USER_APC ((DWORD )0x000000C0L)
  118. #define STATUS_TIMEOUT ((DWORD )0x00000102L)
  119. #define STATUS_PENDING ((DWORD )0x00000103L)
  120. #define STATUS_SEGMENT_NOTIFICATION ((DWORD )0x40000005L)
  121. #define STATUS_GUARD_PAGE_VIOLATION ((DWORD )0x80000001L)
  122. #define STATUS_DATATYPE_MISALIGNMENT ((DWORD )0x80000002L)
  123. #define STATUS_BREAKPOINT ((DWORD )0x80000003L)
  124. #define STATUS_SINGLE_STEP ((DWORD )0x80000004L)
  125. #define STATUS_ACCESS_VIOLATION ((DWORD )0xC0000005L)
  126. #define STATUS_IN_PAGE_ERROR ((DWORD )0xC0000006L)
  127. #define STATUS_INVALID_HANDLE ((DWORD )0xC0000008L)
  128. #define STATUS_NO_MEMORY ((DWORD )0xC0000017L)
  129. #define STATUS_ILLEGAL_INSTRUCTION ((DWORD )0xC000001DL)
  130. #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD )0xC0000025L)
  131. #define STATUS_INVALID_DISPOSITION ((DWORD )0xC0000026L)
  132. #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD )0xC000008CL)
  133. #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD )0xC000008DL)
  134. #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD )0xC000008EL)
  135. #define STATUS_FLOAT_INEXACT_RESULT ((DWORD )0xC000008FL)
  136. #define STATUS_FLOAT_INVALID_OPERATION ((DWORD )0xC0000090L)
  137. #define STATUS_FLOAT_OVERFLOW ((DWORD )0xC0000091L)
  138. #define STATUS_FLOAT_STACK_CHECK ((DWORD )0xC0000092L)
  139. #define STATUS_FLOAT_UNDERFLOW ((DWORD )0xC0000093L)
  140. #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD )0xC0000094L)
  141. #define STATUS_INTEGER_OVERFLOW ((DWORD )0xC0000095L)
  142. #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD )0xC0000096L)
  143. #define STATUS_STACK_OVERFLOW ((DWORD )0xC00000FDL)
  144. #define STATUS_CONTROL_C_EXIT ((DWORD )0xC000013AL)
  145. #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD )0xC00002B4L)
  146. #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD )0xC00002B5L)
  147. #define STATUS_ILLEGAL_VLM_REFERENCE ((DWORD )0xC00002C0L)
  148. /*
  149. * EFLAGs bit assignments
  150. */
  151. #define CF_BIT 0
  152. #define CF_MASK (1 << CF_BIT)
  153. #define PF_BIT 2
  154. #define PF_MASK (1 << PF_BIT)
  155. #define AF_BIT 4
  156. #define AF_MASK (1 << AF_BIT)
  157. #define ZF_BIT 6
  158. #define ZF_MASK (1 << ZF_BIT)
  159. #define SF_BIT 7
  160. #define SF_MASK (1 << SF_BIT)
  161. #define TF_BIT 8
  162. #define TF_MASK (1 << TF_BIT)
  163. #define IF_BIT 9
  164. #define IF_MASK (1 << IF_BIT)
  165. #define DF_BIT 10
  166. #define DF_MASK (1 << DF_BIT)
  167. #define OF_BIT 11 /* Overflow flag */
  168. #define OF_MASK (1 << OF_BIT)
  169. #define IOPL_MASK 0x3000 /* IOPL flags */
  170. #define IOPL_BIT0 12
  171. #define IOPL_BIT1 13
  172. #define NT_BIT 14 /* Nested task flag */
  173. #define NT_MASK (1 << NT_BIT)
  174. #define RF_BIT 16 /* Resume flag */
  175. #define RF_MASK (1 << RF_BIT)
  176. #define VM_BIT 17 /* Virtual Mode flag */
  177. #define VM_MASK (1 << VM_BIT)
  178. #define AC_BIT 18 /* Alignment check */
  179. #define AC_MASK (1 << AC_BIT)
  180. #define VIF_BIT 19 /* Virtual Interrupt flag */
  181. #define VIF_MASK (1 << VIF_BIT)
  182. #define VIP_BIT 20 /* Virtual Interrupt pending */
  183. #define VIP_MASK (1 << VIP_BIT)
  184. #endif //_EXCEPT_