ReactOS  0.4.15-dev-1171-gab82533
exception.h
Go to the documentation of this file.
1 #ifndef __WINE_WINE_EXCEPTION_H
2 #define __WINE_WINE_EXCEPTION_H
3 
4 #include <setjmp.h>
5 #include <intrin.h>
6 #include <pseh/pseh2.h>
7 #include <pseh/excpt.h>
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /* Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD */
14 #define EH_NONCONTINUABLE 0x01
15 #define EH_UNWINDING 0x02
16 #define EH_EXIT_UNWIND 0x04
17 #define EH_STACK_INVALID 0x08
18 #define EH_NESTED_CALL 0x10
19 #define EH_TARGET_UNWIND 0x20
20 #define EH_COLLIDED_UNWIND 0x40
21 
22 #define EXCEPTION_WINE_STUB 0x80000100
23 #define EXCEPTION_WINE_ASSERTION 0x80000101
24 
25 #define EXCEPTION_VM86_INTx 0x80000110
26 #define EXCEPTION_VM86_STI 0x80000111
27 #define EXCEPTION_VM86_PICRETURN 0x80000112
28 
29 #ifndef _RTLTYPES_H
31 
32 typedef
33 DWORD
35  struct _EXCEPTION_RECORD*,
37  struct _CONTEXT*,
39 
41 
43 {
46 };
47 #else
48 typedef struct _WINE_EXCEPTION_REGISTRATION_RECORD
49 {
50  PVOID Prev;
52 } WINE_EXCEPTION_REGISTRATION_RECORD, *PWINE_EXCEPTION_REGISTRATION_RECORD;
53 
54 #define _EXCEPTION_REGISTRATION_RECORD _WINE_EXCEPTION_REGISTRATION_RECORD
55 #define EXCEPTION_REGISTRATION_RECORD WINE_EXCEPTION_REGISTRATION_RECORD
56 #define PEXCEPTION_REGISTRATION_RECORD PWINE_EXCEPTION_REGISTRATION_RECORD
57 #endif
58 
59 #define __TRY _SEH2_TRY
60 #define __EXCEPT(func) _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation()))
61 #define __EXCEPT_CTX(func, ctx) _SEH2_EXCEPT((func)(GetExceptionInformation(), ctx))
62 #define __EXCEPT_PAGE_FAULT _SEH2_EXCEPT(_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION)
63 #define __EXCEPT_ALL _SEH2_EXCEPT(_SEH_EXECUTE_HANDLER)
64 #define __ENDTRY _SEH2_END
65 #define __FINALLY(func) _SEH2_FINALLY { func(!_SEH2_AbnormalTermination()); }
66 #define __FINALLY_CTX(func, ctx) _SEH2_FINALLY { func(!_SEH2_AbnormalTermination(), ctx); }; _SEH2_END
67 
68 #ifndef GetExceptionCode
69 #define GetExceptionCode() _SEH2_GetExceptionCode()
70 #endif
71 
72 #ifndef GetExceptionInformation
73 #define GetExceptionInformation() _SEH2_GetExceptionInformation()
74 #endif
75 
76 #ifndef AbnormalTermination
77 #define AbnormalTermination() _SEH2_AbnormalTermination()
78 #endif
79 
80 
81 #if defined(__MINGW32__) || defined(__CYGWIN__)
82 #define sigjmp_buf jmp_buf
83 #define sigsetjmp(buf,sigs) setjmp(buf)
84 #define siglongjmp(buf,val) longjmp(buf,val)
85 #endif
86 
87 #ifdef _MSC_VER
88 #pragma warning(push)
89 #pragma warning(disable:4733)
90 #endif
91 
93 {
94 #ifdef __i386__
96  __writefsdword(0, (unsigned long)frame);
97  return frame->Prev;
98 #else
99  NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
100  frame->Prev = teb->ExceptionList;
101  teb->ExceptionList = (PVOID)frame;
102  return frame->Prev;
103 #endif
104 }
105 
107 {
108 #ifdef __i386__
109  __writefsdword(0, (unsigned long)frame->Prev);
110  return frame->Prev;
111 #else
112  NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
113  frame->Prev = teb->ExceptionList;
114  teb->ExceptionList = (PVOID)frame;
115  return frame->Prev;
116 #endif
117 }
118 
119 #ifdef _MSC_VER
120 #pragma warning(pop)
121 #endif
122 
123 extern void __wine_enter_vm86( CONTEXT *context );
124 
125 #ifdef __cplusplus
126 }
127 #endif
128 
129 #endif
Definition: http.c:7094
struct _EXCEPTION_REGISTRATION_RECORD * PEXCEPTION_REGISTRATION_RECORD
Definition: exception.h:40
#define DWORD
Definition: nt_native.h:44
static EXCEPTION_REGISTRATION_RECORD * __wine_push_frame(EXCEPTION_REGISTRATION_RECORD *frame)
Definition: exception.h:92
PPC_QUAL unsigned long __readfsdword(const unsigned long Offset)
Definition: intrin_ppc.h:382
void * PVOID
Definition: retypes.h:9
EXCEPTION_ROUTINE * PEXCEPTION_ROUTINE
Definition: compat.h:457
struct _EXCEPTION_REGISTRATION_RECORD * ExceptionList
Definition: compat.h:459
PEXCEPTION_HANDLER Handler
Definition: exception.h:45
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:668
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
PPC_QUAL void __writefsdword(const unsigned long Offset, const unsigned long Data)
Definition: intrin_ppc.h:354
DWORD(* PEXCEPTION_HANDLER)(struct _EXCEPTION_RECORD *, struct _EXCEPTION_REGISTRATION_RECORD *, struct _CONTEXT *, struct _EXCEPTION_REGISTRATION_RECORD **)
Definition: exception.h:34
static EXCEPTION_REGISTRATION_RECORD * __wine_pop_frame(EXCEPTION_REGISTRATION_RECORD *frame)
Definition: exception.h:106
struct _EXCEPTION_REGISTRATION_RECORD * Prev
Definition: exception.h:44
void __wine_enter_vm86(CONTEXT *context)