Source code of Windows XP (NT5)
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.

177 lines
3.7 KiB

  1. /***
  2. *excpt.h - defines exception values, types and routines
  3. *
  4. * Copyright (c) 1990-1995, 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. ****/
  14. #ifndef _INC_EXCPT
  15. #define _INC_EXCPT
  16. #if !defined(_WIN32) && !defined(_MAC)
  17. #error ERROR: Only Mac or Win32 targets supported!
  18. #endif
  19. #ifdef _MSC_VER
  20. /*
  21. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  22. * alignment.
  23. */
  24. #pragma pack(push,8)
  25. #endif /* _MSC_VER */
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  30. #ifndef _CRTAPI1
  31. #if _MSC_VER >= 800 && _M_IX86 >= 300
  32. #define _CRTAPI1 __cdecl
  33. #else
  34. #define _CRTAPI1
  35. #endif
  36. #endif
  37. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  38. #ifndef _CRTAPI2
  39. #if _MSC_VER >= 800 && _M_IX86 >= 300
  40. #define _CRTAPI2 __cdecl
  41. #else
  42. #define _CRTAPI2
  43. #endif
  44. #endif
  45. /* Define _CRTIMP */
  46. #ifndef _CRTIMP
  47. #ifdef _NTSDK
  48. /* definition compatible with NT SDK */
  49. #define _CRTIMP
  50. #else /* ndef _NTSDK */
  51. /* current definition */
  52. #ifdef _DLL
  53. #define _CRTIMP __declspec(dllimport)
  54. #else /* ndef _DLL */
  55. #define _CRTIMP
  56. #endif /* _DLL */
  57. #endif /* _NTSDK */
  58. #endif /* _CRTIMP */
  59. /* Define __cdecl for non-Microsoft compilers */
  60. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  61. #define __cdecl
  62. #endif
  63. /*
  64. * Exception disposition return values.
  65. */
  66. typedef enum _EXCEPTION_DISPOSITION {
  67. ExceptionContinueExecution,
  68. ExceptionContinueSearch,
  69. ExceptionNestedException,
  70. ExceptionCollidedUnwind
  71. } EXCEPTION_DISPOSITION;
  72. /*
  73. * Prototype for SEH support function.
  74. */
  75. #ifdef _M_IX86
  76. /*
  77. * Declarations to keep MS C 8 (386/486) compiler happy
  78. */
  79. struct _EXCEPTION_RECORD;
  80. struct _CONTEXT;
  81. EXCEPTION_DISPOSITION __cdecl _except_handler (
  82. struct _EXCEPTION_RECORD *ExceptionRecord,
  83. void * EstablisherFrame,
  84. struct _CONTEXT *ContextRecord,
  85. void * DispatcherContext
  86. );
  87. #elif defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC)
  88. /*
  89. * Declarations to keep MIPS, ALPHA, and PPC compiler happy
  90. */
  91. typedef struct _EXCEPTION_POINTERS *Exception_info_ptr;
  92. struct _EXCEPTION_RECORD;
  93. struct _CONTEXT;
  94. struct _DISPATCHER_CONTEXT;
  95. _CRTIMP EXCEPTION_DISPOSITION __C_specific_handler (
  96. struct _EXCEPTION_RECORD *ExceptionRecord,
  97. void *EstablisherFrame,
  98. struct _CONTEXT *ContextRecord,
  99. struct _DISPATCHER_CONTEXT *DispatcherContext
  100. );
  101. #endif
  102. /*
  103. * Keywords and intrinsics for SEH
  104. */
  105. #ifdef _MSC_VER
  106. #if defined(_NTSDK) && !defined(__cplusplus)
  107. #define try __try
  108. #define except __except
  109. #define finally __finally
  110. #define leave __leave
  111. #endif /* _NTSDK */
  112. #define GetExceptionCode _exception_code
  113. #define exception_code _exception_code
  114. #define GetExceptionInformation (struct _EXCEPTION_POINTERS *)_exception_info
  115. #define exception_info (struct _EXCEPTION_POINTERS *)_exception_info
  116. #define AbnormalTermination _abnormal_termination
  117. #define abnormal_termination _abnormal_termination
  118. unsigned long __cdecl _exception_code(void);
  119. void * __cdecl _exception_info(void);
  120. int __cdecl _abnormal_termination(void);
  121. #endif
  122. /*
  123. * Legal values for expression in except().
  124. */
  125. #define EXCEPTION_EXECUTE_HANDLER 1
  126. #define EXCEPTION_CONTINUE_SEARCH 0
  127. #define EXCEPTION_CONTINUE_EXECUTION -1
  128. #ifdef __cplusplus
  129. }
  130. #endif
  131. #ifdef _MSC_VER
  132. #pragma pack(pop)
  133. #endif /* _MSC_VER */
  134. #endif /* _INC_EXCPT */