ReactOS  0.4.14-dev-854-gb9426a3
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 
20 #define EXCEPTION_WINE_STUB 0x80000100
21 #define EXCEPTION_WINE_ASSERTION 0x80000101
22 
23 #define EXCEPTION_VM86_INTx 0x80000110
24 #define EXCEPTION_VM86_STI 0x80000111
25 #define EXCEPTION_VM86_PICRETURN 0x80000112
26 
27 #ifndef _RTLTYPES_H
29 
30 typedef
31 DWORD
33  struct _EXCEPTION_RECORD*,
35  struct _CONTEXT*,
37 
39 
41 {
44 };
45 #else
46 typedef struct _WINE_EXCEPTION_REGISTRATION_RECORD
47 {
48  PVOID Prev;
50 } WINE_EXCEPTION_REGISTRATION_RECORD, *PWINE_EXCEPTION_REGISTRATION_RECORD;
51 
52 #define _EXCEPTION_REGISTRATION_RECORD _WINE_EXCEPTION_REGISTRATION_RECORD
53 #define EXCEPTION_REGISTRATION_RECORD WINE_EXCEPTION_REGISTRATION_RECORD
54 #define PEXCEPTION_REGISTRATION_RECORD PWINE_EXCEPTION_REGISTRATION_RECORD
55 #endif
56 
57 #define __TRY _SEH2_TRY
58 #define __EXCEPT(func) _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation()))
59 #define __EXCEPT_PAGE_FAULT _SEH2_EXCEPT(_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION)
60 #define __EXCEPT_ALL _SEH2_EXCEPT(_SEH_EXECUTE_HANDLER)
61 #define __ENDTRY _SEH2_END
62 #define __FINALLY(func) _SEH2_FINALLY { func(!_SEH2_AbnormalTermination()); }
63 #define __FINALLY_CTX(func, ctx) _SEH2_FINALLY { func(!_SEH2_AbnormalTermination(), ctx); }; _SEH2_END
64 
65 #ifndef GetExceptionCode
66 #define GetExceptionCode() _SEH2_GetExceptionCode()
67 #endif
68 
69 #ifndef GetExceptionInformation
70 #define GetExceptionInformation() _SEH2_GetExceptionInformation()
71 #endif
72 
73 #ifndef AbnormalTermination
74 #define AbnormalTermination() _SEH2_AbnormalTermination()
75 #endif
76 
77 
78 #if defined(__MINGW32__) || defined(__CYGWIN__)
79 #define sigjmp_buf jmp_buf
80 #define sigsetjmp(buf,sigs) setjmp(buf)
81 #define siglongjmp(buf,val) longjmp(buf,val)
82 #endif
83 
84 #ifdef _MSC_VER
85 #pragma warning(push)
86 #pragma warning(disable:4733)
87 #endif
88 
90 {
91 #ifdef __i386__
93  __writefsdword(0, (unsigned long)frame);
94  return frame->Prev;
95 #else
96  NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
97  frame->Prev = teb->ExceptionList;
98  teb->ExceptionList = (PVOID)frame;
99  return frame->Prev;
100 #endif
101 }
102 
104 {
105 #ifdef __i386__
106  __writefsdword(0, (unsigned long)frame->Prev);
107  return frame->Prev;
108 #else
109  NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
110  frame->Prev = teb->ExceptionList;
111  teb->ExceptionList = (PVOID)frame;
112  return frame->Prev;
113 #endif
114 }
115 
116 #ifdef _MSC_VER
117 #pragma warning(pop)
118 #endif
119 
120 extern void __wine_enter_vm86( CONTEXT *context );
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif
Definition: http.c:7094
struct _EXCEPTION_REGISTRATION_RECORD * PEXCEPTION_REGISTRATION_RECORD
Definition: exception.h:38
#define DWORD
Definition: nt_native.h:44
static EXCEPTION_REGISTRATION_RECORD * __wine_push_frame(EXCEPTION_REGISTRATION_RECORD *frame)
Definition: exception.h:89
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:377
struct _EXCEPTION_REGISTRATION_RECORD * ExceptionList
Definition: compat.h:379
PEXCEPTION_HANDLER Handler
Definition: exception.h:43
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:32
static EXCEPTION_REGISTRATION_RECORD * __wine_pop_frame(EXCEPTION_REGISTRATION_RECORD *frame)
Definition: exception.h:103
struct _EXCEPTION_REGISTRATION_RECORD * Prev
Definition: exception.h:42
void __wine_enter_vm86(CONTEXT *context)