ReactOS 0.4.16-dev-1946-g52006dd
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 <excpt.h>
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12/* Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD */
13#define EH_NONCONTINUABLE 0x01
14#define EH_UNWINDING 0x02
15#define EH_EXIT_UNWIND 0x04
16#define EH_STACK_INVALID 0x08
17#define EH_NESTED_CALL 0x10
18#define EH_TARGET_UNWIND 0x20
19#define EH_COLLIDED_UNWIND 0x40
20
21#define EXCEPTION_WINE_STUB 0x80000100
22#define EXCEPTION_WINE_ASSERTION 0x80000101
23
24#define EXCEPTION_VM86_INTx 0x80000110
25#define EXCEPTION_VM86_STI 0x80000111
26#define EXCEPTION_VM86_PICRETURN 0x80000112
27
28#ifndef _RTLTYPES_H
29#ifndef __WINE_WINNT_EXCEPTION_REGISTRATION_RECORD
30#define __WINE_WINNT_EXCEPTION_REGISTRATION_RECORD
32
33typedef
36 struct _EXCEPTION_RECORD*,
38 struct _CONTEXT*,
40
42
44{
47};
48#endif // __WINE_WINNT_EXCEPTION_REGISTRATION_RECORD
49#else
50typedef struct _WINE_EXCEPTION_REGISTRATION_RECORD
51{
52 PVOID Prev;
54} WINE_EXCEPTION_REGISTRATION_RECORD, *PWINE_EXCEPTION_REGISTRATION_RECORD;
55
56#define _EXCEPTION_REGISTRATION_RECORD _WINE_EXCEPTION_REGISTRATION_RECORD
57#define EXCEPTION_REGISTRATION_RECORD WINE_EXCEPTION_REGISTRATION_RECORD
58#define PEXCEPTION_REGISTRATION_RECORD PWINE_EXCEPTION_REGISTRATION_RECORD
59#endif
60
61#define __TRY _SEH2_TRY {
62#define __EXCEPT(func) } _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation())) {
63#define __EXCEPT_CTX(func, ctx) } _SEH2_EXCEPT((func)(GetExceptionInformation(), ctx)) {
64#define __EXCEPT_PAGE_FAULT } _SEH2_EXCEPT(_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION) {
65#define __EXCEPT_ALL } _SEH2_EXCEPT(1) {
66#define __ENDTRY } _SEH2_END
67#define __FINALLY(func) } _SEH2_FINALLY { func(!_SEH2_AbnormalTermination()); } {
68#define __FINALLY_CTX(func, ctx) } _SEH2_FINALLY { func(!_SEH2_AbnormalTermination(), ctx); }; _SEH2_END
69
70#ifndef GetExceptionCode
71#define GetExceptionCode() _SEH2_GetExceptionCode()
72#endif
73
74#ifndef GetExceptionInformation
75#define GetExceptionInformation() _SEH2_GetExceptionInformation()
76#endif
77
78#ifndef AbnormalTermination
79#define AbnormalTermination() _SEH2_AbnormalTermination()
80#endif
81
82#if defined(__MINGW32__) || defined(__CYGWIN__)
83#define sigjmp_buf jmp_buf
84#define sigsetjmp(buf,sigs) setjmp(buf)
85#define siglongjmp(buf,val) longjmp(buf,val)
86#endif
87
88#ifdef _MSC_VER
89#pragma warning(push)
90#pragma warning(disable:4733)
91#endif
92
93#ifndef __wine_jmp_buf // Conflict with CRT hack
94#ifdef __i386__
95typedef struct { int reg[16]; } __wine_jmp_buf;
96#elif defined(__x86_64__)
97typedef struct { DECLSPEC_ALIGN(16) struct { unsigned __int64 Part[2]; } reg[16]; } __wine_jmp_buf;
98#elif defined(__arm__)
99typedef struct { int reg[28]; } __wine_jmp_buf;
100#elif defined(__aarch64__)
101typedef struct { __int64 reg[24]; } __wine_jmp_buf;
102#else
103typedef struct { int reg; } __wine_jmp_buf;
104#endif
105#endif
106
109 void (*target)(void) );
110
112{
113#ifdef __i386__
115 __writefsdword(0, (unsigned long)frame);
116 return frame->Prev;
117#else
118 NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
119 frame->Prev = teb->ExceptionList;
120 teb->ExceptionList = (PVOID)frame;
121 return frame->Prev;
122#endif
123}
124
126{
127#ifdef __i386__
128 __writefsdword(0, (unsigned long)frame->Prev);
129 return frame->Prev;
130#else
131 NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
132 frame->Prev = teb->ExceptionList;
133 teb->ExceptionList = (PVOID)frame;
134 return frame->Prev;
135#endif
136}
137
138#ifdef _MSC_VER
139#pragma warning(pop)
140#endif
141
143
144#ifdef __cplusplus
145}
146#endif
147
148#endif
#define __cdecl
Definition: accygwin.h:79
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx 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:672
#define __int64
Definition: basetyps.h:16
EXCEPTION_ROUTINE * PEXCEPTION_ROUTINE
Definition: compat.h:709
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static int reg
Definition: i386-dis.c:1290
PPC_QUAL void __writefsdword(const unsigned long Offset, const unsigned long Data)
Definition: intrin_ppc.h:354
PPC_QUAL unsigned long __readfsdword(const unsigned long Offset)
Definition: intrin_ppc.h:382
#define NtCurrentTeb
#define DWORD
Definition: nt_native.h:44
#define DECLSPEC_ALIGN(x)
Definition: ntbasedef.h:263
#define DECLSPEC_NORETURN
Definition: ntbasedef.h:179
PEXCEPTION_HANDLER Handler
Definition: exception.h:46
struct _EXCEPTION_REGISTRATION_RECORD * Prev
Definition: exception.h:45
struct _EXCEPTION_REGISTRATION_RECORD * ExceptionList
Definition: compat.h:711
Definition: http.c:7252
Definition: tools.h:99
void * PVOID
Definition: typedefs.h:50
int retval
Definition: wcstombs.cpp:91
DECLSPEC_NORETURN void __cdecl __wine_rtl_unwind(EXCEPTION_REGISTRATION_RECORD *frame, EXCEPTION_RECORD *record, void(*target)(void))
static EXCEPTION_REGISTRATION_RECORD * __wine_push_frame(EXCEPTION_REGISTRATION_RECORD *frame)
Definition: exception.h:111
void __wine_enter_vm86(CONTEXT *context)
DECLSPEC_NORETURN void __cdecl __wine_longjmp(__wine_jmp_buf *buf, int retval)
struct _EXCEPTION_REGISTRATION_RECORD * PEXCEPTION_REGISTRATION_RECORD
Definition: exception.h:41
DWORD(* PEXCEPTION_HANDLER)(struct _EXCEPTION_RECORD *, struct _EXCEPTION_REGISTRATION_RECORD *, struct _CONTEXT *, struct _EXCEPTION_REGISTRATION_RECORD **)
Definition: exception.h:35
static EXCEPTION_REGISTRATION_RECORD * __wine_pop_frame(EXCEPTION_REGISTRATION_RECORD *frame)
Definition: exception.h:125
DWORD(CDECL * PEXCEPTION_HANDLER)(PEXCEPTION_RECORD, struct _EXCEPTION_REGISTRATION_RECORD *, PCONTEXT, struct _EXCEPTION_REGISTRATION_RECORD **)
Definition: winnt.h:170