1 /* 2 Copyright (c) 2004/2005 KJK::Hyperion 3 4 Permission is hereby granted, free of charge, to any person obtaining a 5 copy of this software and associated documentation files (the "Software"), 6 to deal in the Software without restriction, including without limitation 7 the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 and/or sell copies of the Software, and to permit persons to whom the 9 Software is furnished to do so, subject to the following conditions: 10 11 The above copyright notice and this permission notice shall be included in 12 all copies or substantial portions of the Software. 13 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 DEALINGS IN THE SOFTWARE. 21 */ 22 23 #ifndef KJK_PSEH_FRAMEBASED_INTERNAL_H_ 24 #define KJK_PSEH_FRAMEBASED_INTERNAL_H_ 25 26 #define _SEH_DO_TRACE_ENTER_LEAVE (1 << 0) 27 #define _SEH_DO_TRACE_EXCEPTION_RECORD (1 << 1) 28 #define _SEH_DO_TRACE_CONTEXT (1 << 2) 29 #define _SEH_DO_TRACE_UNWIND (1 << 3) 30 #define _SEH_DO_TRACE_TRYLEVEL (1 << 4) 31 #define _SEH_DO_TRACE_CALL_FILTER (1 << 5) 32 #define _SEH_DO_TRACE_FILTER (1 << 6) 33 #define _SEH_DO_TRACE_CALL_HANDLER (1 << 7) 34 #define _SEH_DO_TRACE_CALL_FINALLY (1 << 8) 35 36 #define _SEH_DO_TRACE_NONE (0) 37 #define _SEH_DO_TRACE_ALL (-1) 38 39 #ifndef _SEH_DO_DEFAULT_TRACING 40 #define _SEH_DO_DEFAULT_TRACING _SEH_DO_TRACE_NONE 41 #endif 42 43 struct _EXCEPTION_RECORD; 44 struct _EXCEPTION_POINTERS; 45 struct _CONTEXT; 46 47 typedef int (__cdecl * _SEHFrameHandler_t) 48 ( 49 struct _EXCEPTION_RECORD *, 50 void *, 51 struct _CONTEXT *, 52 void * 53 ); 54 55 typedef struct __SEHRegistration 56 { 57 struct __SEHRegistration * SER_Prev; 58 _SEHFrameHandler_t SER_Handler; 59 } 60 _SEHRegistration_t; 61 62 struct __SEHPortableFrame; 63 struct __SEHPortableTryLevel; 64 65 typedef long (__stdcall * _SEHFilter_t) 66 ( 67 struct _EXCEPTION_POINTERS *, 68 struct __SEHPortableFrame * 69 ); 70 71 typedef void (__stdcall * _SEHHandler_t) 72 ( 73 struct __SEHPortableTryLevel * 74 ); 75 76 typedef void (__stdcall * _SEHFinally_t) 77 ( 78 struct __SEHPortableFrame * 79 ); 80 81 typedef struct __SEHHandlers 82 { 83 _SEHFilter_t SH_Filter; 84 _SEHFinally_t SH_Finally; 85 } 86 _SEHHandlers_t; 87 88 typedef struct __SEHPortableTryLevel 89 { 90 struct __SEHPortableTryLevel * volatile SPT_Next; 91 volatile _SEHHandlers_t SPT_Handlers; 92 } 93 _SEHPortableTryLevel_t; 94 95 typedef struct __SEHPortableFrame 96 { 97 _SEHRegistration_t SPF_Registration; 98 unsigned long SPF_Code; 99 volatile _SEHHandler_t SPF_Handler; 100 _SEHPortableTryLevel_t * volatile SPF_TopTryLevel; 101 volatile int SPF_Tracing; 102 } 103 _SEHPortableFrame_t; 104 105 #ifdef __cplusplus 106 extern "C" 107 { 108 #endif 109 110 extern void __stdcall _SEHEnterFrame_s(_SEHPortableFrame_t *); 111 extern void __stdcall _SEHLeaveFrame_s(void); 112 extern void __stdcall _SEHReturn_s(void); 113 114 #if !defined(_SEH_NO_FASTCALL) 115 # ifdef _M_IX86 116 # define _SEH_FASTCALL __fastcall 117 # else 118 # define _SEH_FASTCALL __stdcall 119 # endif 120 121 extern void _SEH_FASTCALL _SEHEnterFrame_f(_SEHPortableFrame_t *); 122 extern void _SEH_FASTCALL _SEHLeaveFrame_f(void); 123 extern void _SEH_FASTCALL _SEHReturn_f(void); 124 125 # define _SEHEnterFrame _SEHEnterFrame_f 126 # define _SEHLeaveFrame _SEHLeaveFrame_f 127 # define _SEHReturn _SEHReturn_f 128 #else 129 # define _SEHEnterFrame _SEHEnterFrame_s 130 # define _SEHLeaveFrame _SEHLeaveFrame_s 131 # define _SEHReturn _SEHReturn_s 132 #endif 133 134 #ifdef __cplusplus 135 } 136 #endif 137 138 #endif 139 140 /* EOF */ 141