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.

267 lines
7.4 KiB

  1. /***
  2. *excpt.h - defines exception values, types and routines
  3. *
  4. * Copyright (c) 1990-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file contains the definitions and prototypes for the compiler-
  8. * dependent intrinsics, support functions and keywords which implement
  9. * the structured exception handling extensions.
  10. *
  11. * [Public]
  12. *
  13. *Revision History:
  14. * 11-01-91 GJF Module created. Basically a synthesis of except.h
  15. * and excpt.h and intended as a replacement for
  16. * both.
  17. * 12-13-91 GJF Fixed build for Win32.
  18. * 05-05-92 SRW C8 wants C6 style names for now.
  19. * 07-20-92 SRW Moved from winxcpt.h to excpt.h
  20. * 08-06-92 GJF Function calling type and variable type macros. Also
  21. * revised compiler/target processor macro usage.
  22. * 11-09-92 GJF Fixed preprocessing conditionals for MIPS. Also,
  23. * fixed some compiler warning (fix from/for RichardS).
  24. * 01-03-93 SRW Fold in ALPHA changes
  25. * 01-04-93 SRW Add leave keyword for x86
  26. * 01-09-93 SRW Remove usage of MIPS and ALPHA to conform to ANSI
  27. * Use _MIPS_ and _ALPHA_ instead.
  28. * 01-21-93 GJF Removed support for C6-386's _cdecl.
  29. * 02-18-93 GJF Changed _try to __try, etc.
  30. * 03-31-93 CFW Removed #define try, except, leave, finally for x86.
  31. * 04-06-93 SKS Replace _CRTAPI1/2 with __cdecl, _CRTVAR1 with nothing
  32. * 07-29-93 GJF Added declarations for _First_FPE_Indx and _Num_FPE.
  33. * 09-01-93 GJF Merged Cuda and NT SDK versions.
  34. * 10-04-93 SRW Fix ifdefs for MIPS and ALPHA to only check for _M_??????
  35. * defines
  36. * 10-12-93 GJF Merged again.
  37. * 10-19-93 GJF MS/MIPS compiler gets most of the same SEH defs and
  38. * decls as the MS compiler for the X86.
  39. * 10-29-93 GJF Don't #define try, et al, when compiling C++ app!
  40. * 12-09-93 GJF Alpha compiler now has MS front-end and implements
  41. * the same SEH names.
  42. * 11-03-94 GJF Ensure 8 byte alignment.
  43. * 02-11-95 CFW Add _CRTBLD to avoid users getting wrong headers.
  44. * 02-14-95 CFW Clean up Mac merge.
  45. * 12-14-95 JWM Add "#pragma once".
  46. * 02-21-97 GJF Cleaned out obsolete support for _CRTAPI* and _NTSDK.
  47. * Also, detab-ed.
  48. * 09-30-97 JWM Restored not-so-obsolete _CRTAPI1 support.
  49. * 10-07-97 RDL Added IA64.
  50. * 11-12-97 RDL __C_specific_handler() prototype change from SC.
  51. * 05-13-99 PML Remove _CRTAPI1
  52. * 05-17-99 PML Remove all Macintosh support.
  53. * 06-13-01 PML Compile clean -Za -W4 -Tc (vs7#267063)
  54. * 07-15-01 PML Remove all ALPHA, MIPS, and PPC code
  55. *
  56. ****/
  57. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  58. #pragma once
  59. #endif
  60. #ifndef _INC_EXCPT
  61. #define _INC_EXCPT
  62. #if !defined(_WIN32)
  63. #error ERROR: Only Win32 target supported!
  64. #endif
  65. #ifndef _CRTBLD
  66. /* This version of the header files is NOT for user programs.
  67. * It is intended for use when building the C runtimes ONLY.
  68. * The version intended for public use will not have this message.
  69. */
  70. #error ERROR: Use of C runtime library internal header file.
  71. #endif /* _CRTBLD */
  72. #ifdef _MSC_VER
  73. /*
  74. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  75. * alignment.
  76. */
  77. #pragma pack(push,8)
  78. #endif /* _MSC_VER */
  79. #ifdef __cplusplus
  80. extern "C" {
  81. #endif
  82. #ifndef _INTERNAL_IFSTRIP_
  83. #include <cruntime.h>
  84. #endif /* _INTERNAL_IFSTRIP_ */
  85. /* Define _CRTIMP */
  86. #ifndef _CRTIMP
  87. #ifdef CRTDLL
  88. #define _CRTIMP __declspec(dllexport)
  89. #else /* ndef CRTDLL */
  90. #ifdef _DLL
  91. #define _CRTIMP __declspec(dllimport)
  92. #else /* ndef _DLL */
  93. #define _CRTIMP
  94. #endif /* _DLL */
  95. #endif /* CRTDLL */
  96. #endif /* _CRTIMP */
  97. /* Define __cdecl for non-Microsoft compilers */
  98. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  99. #define __cdecl
  100. #endif
  101. /*
  102. * Exception disposition return values.
  103. */
  104. typedef enum _EXCEPTION_DISPOSITION {
  105. ExceptionContinueExecution,
  106. ExceptionContinueSearch,
  107. ExceptionNestedException,
  108. ExceptionCollidedUnwind
  109. } EXCEPTION_DISPOSITION;
  110. /*
  111. * Prototype for SEH support function.
  112. */
  113. #ifdef _M_IX86
  114. /*
  115. * Declarations to keep MS C 8 (386/486) compiler happy
  116. */
  117. struct _EXCEPTION_RECORD;
  118. struct _CONTEXT;
  119. EXCEPTION_DISPOSITION __cdecl _except_handler (
  120. struct _EXCEPTION_RECORD *ExceptionRecord,
  121. void * EstablisherFrame,
  122. struct _CONTEXT *ContextRecord,
  123. void * DispatcherContext
  124. );
  125. #elif defined(_M_IA64)
  126. /*
  127. * Declarations to keep IA64 compiler happy
  128. */
  129. typedef struct _EXCEPTION_POINTERS *Exception_info_ptr;
  130. struct _EXCEPTION_RECORD;
  131. struct _CONTEXT;
  132. struct _DISPATCHER_CONTEXT;
  133. _CRTIMP EXCEPTION_DISPOSITION __C_specific_handler (
  134. struct _EXCEPTION_RECORD *ExceptionRecord,
  135. unsigned __int64 MemoryStackFp,
  136. unsigned __int64 BackingStoreFp,
  137. struct _CONTEXT *ContextRecord,
  138. struct _DISPATCHER_CONTEXT *DispatcherContext,
  139. unsigned __int64 GlobalPointer
  140. );
  141. #endif
  142. /*
  143. * Keywords and intrinsics for SEH
  144. */
  145. #ifdef _MSC_VER
  146. #define GetExceptionCode _exception_code
  147. #define exception_code _exception_code
  148. #define GetExceptionInformation (struct _EXCEPTION_POINTERS *)_exception_info
  149. #define exception_info (struct _EXCEPTION_POINTERS *)_exception_info
  150. #define AbnormalTermination _abnormal_termination
  151. #define abnormal_termination _abnormal_termination
  152. unsigned long __cdecl _exception_code(void);
  153. void * __cdecl _exception_info(void);
  154. int __cdecl _abnormal_termination(void);
  155. #endif
  156. /*
  157. * Legal values for expression in except().
  158. */
  159. #define EXCEPTION_EXECUTE_HANDLER 1
  160. #define EXCEPTION_CONTINUE_SEARCH 0
  161. #define EXCEPTION_CONTINUE_EXECUTION -1
  162. #ifndef _INTERNAL_IFSTRIP_
  163. /*
  164. * for convenience, define a type name for a pointer to signal-handler
  165. */
  166. typedef void (__cdecl * _PHNDLR)(int);
  167. /*
  168. * Exception-action table used by the C runtime to identify and dispose of
  169. * exceptions corresponding to C runtime errors or C signals.
  170. */
  171. struct _XCPT_ACTION {
  172. /*
  173. * exception code or number. defined by the host OS.
  174. */
  175. unsigned long XcptNum;
  176. /*
  177. * signal code or number. defined by the C runtime.
  178. */
  179. int SigNum;
  180. /*
  181. * exception action code. either a special code or the address of
  182. * a handler function. always determines how the exception filter
  183. * should dispose of the exception.
  184. */
  185. _PHNDLR XcptAction;
  186. };
  187. extern struct _XCPT_ACTION _XcptActTab[];
  188. /*
  189. * number of entries in the exception-action table
  190. */
  191. extern int _XcptActTabCount;
  192. /*
  193. * size of exception-action table (in bytes)
  194. */
  195. extern int _XcptActTabSize;
  196. /*
  197. * index of the first floating point exception entry
  198. */
  199. extern int _First_FPE_Indx;
  200. /*
  201. * number of FPE entries
  202. */
  203. extern int _Num_FPE;
  204. /*
  205. * return values and prototype for the exception filter function used in the
  206. * C startup
  207. */
  208. int __cdecl _XcptFilter(unsigned long, struct _EXCEPTION_POINTERS *);
  209. #endif /* _INTERNAL_IFSTRIP_ */
  210. #ifdef __cplusplus
  211. }
  212. #endif
  213. #ifdef _MSC_VER
  214. #pragma pack(pop)
  215. #endif /* _MSC_VER */
  216. #endif /* _INC_EXCPT */