winedump: Dump MSC's S_UNAMESPACE entries.
[wine.git] / dlls / vcruntime140_1 / cppexcept.h
blob067df35a3de53c434aa9304dea57afbead142b38
1 /*
2 * vcruntime140_1 x86_64 C++ exception handling
4 * Copyright 2002 Alexandre Julliard
5 * Copyright 2020 Piotr Caban
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 typedef void (*vtable_ptr)(void);
24 /* type_info object, see cpp.c for implementation */
25 typedef struct __type_info
27 const vtable_ptr *vtable;
28 char *name; /* Unmangled name, allocated lazily */
29 char mangled[64]; /* Variable length, but we declare it large enough for static RTTI */
30 } type_info;
32 typedef struct
34 int this_offset; /* offset of base class this pointer from start of object */
35 int vbase_descr; /* offset of virtual base class descriptor */
36 int vbase_offset; /* offset of this pointer offset in virtual base class descriptor */
37 } this_ptr_offsets;
39 /* complete information about a C++ type */
40 typedef struct __cxx_type_info
42 UINT flags;
43 unsigned int type_info;
44 this_ptr_offsets offsets;
45 unsigned int size;
46 unsigned int copy_ctor;
47 } cxx_type_info;
49 #define CLASS_IS_SIMPLE_TYPE 1
50 #define CLASS_HAS_VIRTUAL_BASE_CLASS 4
52 /* table of C++ types that apply for a given object */
53 typedef struct __cxx_type_info_table
55 UINT count;
56 unsigned int info[3];
57 } cxx_type_info_table;
59 struct __cxx_exception_frame;
60 struct __cxx_function_descr;
62 /* type information for an exception object */
63 typedef struct
65 UINT flags;
66 unsigned int destructor;
67 unsigned int custom_handler;
68 unsigned int type_info_table;
69 } cxx_exception_type;
71 static inline const char *dbgstr_type_info( const type_info *info )
73 if (!info) return "{}";
74 return wine_dbg_sprintf( "{vtable=%p name=%s (%s)}",
75 info->vtable, info->mangled, info->name ? info->name : "" );
78 /* compute the this pointer for a base class of a given type */
79 static inline void *get_this_pointer( const this_ptr_offsets *off, void *object )
81 if (!object) return NULL;
83 if (off->vbase_descr >= 0)
85 int *offset_ptr;
87 /* move this ptr to vbase descriptor */
88 object = (char *)object + off->vbase_descr;
89 /* and fetch additional offset from vbase descriptor */
90 offset_ptr = (int *)(*(char **)object + off->vbase_offset);
91 object = (char *)object + *offset_ptr;
94 object = (char *)object + off->this_offset;
95 return object;
98 typedef void (__cdecl *_se_translator_function)(unsigned int code, struct _EXCEPTION_POINTERS *info);
100 typedef struct _frame_info
102 void *object;
103 struct _frame_info *next;
104 } frame_info;
106 typedef struct
108 frame_info frame_info;
109 EXCEPTION_RECORD *rec;
110 CONTEXT *context;
111 } cxx_frame_info;
113 BOOL __cdecl __CxxRegisterExceptionObject(EXCEPTION_POINTERS*, cxx_frame_info*);
114 void __cdecl __CxxUnregisterExceptionObject(cxx_frame_info*, BOOL);
115 void __cdecl __DestructExceptionObject(EXCEPTION_RECORD *rec);
117 void** __cdecl __current_exception(void);
118 int* __cdecl __processing_throw(void);
119 void __cdecl terminate(void);