ReactOS 0.4.16-dev-1163-gec5b142
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
30
31typedef
34 struct _EXCEPTION_RECORD*,
36 struct _CONTEXT*,
38
40
42{
45};
46#else
47typedef struct _WINE_EXCEPTION_REGISTRATION_RECORD
48{
49 PVOID Prev;
51} WINE_EXCEPTION_REGISTRATION_RECORD, *PWINE_EXCEPTION_REGISTRATION_RECORD;
52
53#define _EXCEPTION_REGISTRATION_RECORD _WINE_EXCEPTION_REGISTRATION_RECORD
54#define EXCEPTION_REGISTRATION_RECORD WINE_EXCEPTION_REGISTRATION_RECORD
55#define PEXCEPTION_REGISTRATION_RECORD PWINE_EXCEPTION_REGISTRATION_RECORD
56#endif
57
58#define __TRY _SEH2_TRY {
59#define __EXCEPT(func) } _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation())) {
60#define __EXCEPT_CTX(func, ctx) } _SEH2_EXCEPT((func)(GetExceptionInformation(), ctx)) {
61#define __EXCEPT_PAGE_FAULT } _SEH2_EXCEPT(_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION) {
62#define __EXCEPT_ALL } _SEH2_EXCEPT(1) {
63#define __ENDTRY } _SEH2_END
64#define __FINALLY(func) } _SEH2_FINALLY { func(!_SEH2_AbnormalTermination()); } {
65#define __FINALLY_CTX(func, ctx) } _SEH2_FINALLY { func(!_SEH2_AbnormalTermination(), ctx); }; _SEH2_END
66
67#ifndef GetExceptionCode
68#define GetExceptionCode() _SEH2_GetExceptionCode()
69#endif
70
71#ifndef GetExceptionInformation
72#define GetExceptionInformation() _SEH2_GetExceptionInformation()
73#endif
74
75#ifndef AbnormalTermination
76#define AbnormalTermination() _SEH2_AbnormalTermination()
77#endif
78
79#if defined(__MINGW32__) || defined(__CYGWIN__)
80#define sigjmp_buf jmp_buf
81#define sigsetjmp(buf,sigs) setjmp(buf)
82#define siglongjmp(buf,val) longjmp(buf,val)
83#endif
84
85#ifdef _MSC_VER
86#pragma warning(push)
87#pragma warning(disable:4733)
88#endif
89
90#ifndef __wine_jmp_buf // Conflict with CRT hack
91#ifdef __i386__
92typedef struct { int reg[16]; } __wine_jmp_buf;
93#elif defined(__x86_64__)
94typedef struct { DECLSPEC_ALIGN(16) struct { unsigned __int64 Part[2]; } reg[16]; } __wine_jmp_buf;
95#elif defined(__arm__)
96typedef struct { int reg[28]; } __wine_jmp_buf;
97#elif defined(__aarch64__)
98typedef struct { __int64 reg[24]; } __wine_jmp_buf;
99#else
100typedef struct { int reg; } __wine_jmp_buf;
101#endif
102#endif
103
106 void (*target)(void) );
107
109{
110#ifdef __i386__
112 __writefsdword(0, (unsigned long)frame);
113 return frame->Prev;
114#else
115 NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
116 frame->Prev = teb->ExceptionList;
117 teb->ExceptionList = (PVOID)frame;
118 return frame->Prev;
119#endif
120}
121
123{
124#ifdef __i386__
125 __writefsdword(0, (unsigned long)frame->Prev);
126 return frame->Prev;
127#else
128 NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
129 frame->Prev = teb->ExceptionList;
130 teb->ExceptionList = (PVOID)frame;
131 return frame->Prev;
132#endif
133}
134
135#ifdef _MSC_VER
136#pragma warning(pop)
137#endif
138
140
141#ifdef __cplusplus
142}
143#endif
144
145#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
GLenum target
Definition: glext.h:7315
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
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:108
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:39
DWORD(* PEXCEPTION_HANDLER)(struct _EXCEPTION_RECORD *, struct _EXCEPTION_REGISTRATION_RECORD *, struct _CONTEXT *, struct _EXCEPTION_REGISTRATION_RECORD **)
Definition: exception.h:33
static EXCEPTION_REGISTRATION_RECORD * __wine_pop_frame(EXCEPTION_REGISTRATION_RECORD *frame)
Definition: exception.h:122
PEXCEPTION_HANDLER Handler
Definition: exception.h:44
struct _EXCEPTION_REGISTRATION_RECORD * Prev
Definition: exception.h:43
struct _EXCEPTION_REGISTRATION_RECORD * ExceptionList
Definition: compat.h:711
Definition: http.c:7252
void * PVOID
Definition: typedefs.h:50
int retval
Definition: wcstombs.cpp:91