ReactOS  0.4.14-dev-293-g2b39b42
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 
64 #ifndef GetExceptionCode
65 #define GetExceptionCode() _SEH2_GetExceptionCode()
66 #endif
67 
68 #ifndef GetExceptionInformation
69 #define GetExceptionInformation() _SEH2_GetExceptionInformation()
70 #endif
71 
72 #ifndef AbnormalTermination
73 #define AbnormalTermination() _SEH2_AbnormalTermination()
74 #endif
75 
76 
77 #if defined(__MINGW32__) || defined(__CYGWIN__)
78 #define sigjmp_buf jmp_buf
79 #define sigsetjmp(buf,sigs) setjmp(buf)
80 #define siglongjmp(buf,val) longjmp(buf,val)
81 #endif
82 
83 #ifdef _MSC_VER
84 #pragma warning(push)
85 #pragma warning(disable:4733)
86 #endif
87 
89 {
90 #ifdef __i386__
92  __writefsdword(0, (unsigned long)frame);
93  return frame->Prev;
94 #else
95  NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
96  frame->Prev = teb->ExceptionList;
97  teb->ExceptionList = (PVOID)frame;
98  return frame->Prev;
99 #endif
100 }
101 
103 {
104 #ifdef __i386__
105  __writefsdword(0, (unsigned long)frame->Prev);
106  return frame->Prev;
107 #else
108  NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
109  frame->Prev = teb->ExceptionList;
110  teb->ExceptionList = (PVOID)frame;
111  return frame->Prev;
112 #endif
113 }
114 
115 #ifdef _MSC_VER
116 #pragma warning(pop)
117 #endif
118 
119 extern void __wine_enter_vm86( CONTEXT *context );
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif
Definition: http.c:6587
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:88
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:369
struct _EXCEPTION_REGISTRATION_RECORD * ExceptionList
Definition: compat.h:371
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:662
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:102
struct _EXCEPTION_REGISTRATION_RECORD * Prev
Definition: exception.h:42
void __wine_enter_vm86(CONTEXT *context)