21#ifndef __MSVCRT_CPPEXCEPT_H
22#define __MSVCRT_CPPEXCEPT_H
26#define CXX_FRAME_MAGIC_VC6 0x19930520
27#define CXX_FRAME_MAGIC_VC7 0x19930521
28#define CXX_FRAME_MAGIC_VC8 0x19930522
29#define CXX_EXCEPTION 0xe06d7363
31#define FUNC_DESCR_SYNCHRONOUS 1
32#define FUNC_DESCR_NOEXCEPT 4
83#define CLASS_IS_SIMPLE_TYPE 1
84#define CLASS_HAS_VIRTUAL_BASE_CLASS 4
122 unsigned int destructor;
123 unsigned int custom_handler;
124 unsigned int type_info_table;
133 if (!
info)
return "{}";
141 if (!
object)
return NULL;
150 offset_ptr = (
int *)(*(
char **)
object + off->
vbase_offset);
151 object = (
char *)
object + *offset_ptr;
159#define DEFINE_CXX_TYPE_INFO(type) \
160static const cxx_type_info type ## _cxx_type_info = { \
162 & type ##_type_info, \
165 (cxx_copy_ctor)THISCALL(type ##_copy_ctor) \
168#define DEFINE_CXX_EXCEPTION(type, base_no, cl1, cl2, dtor) \
169static const cxx_type_info_table type ## _cxx_type_table = { \
172 & type ## _cxx_type_info, \
178static const cxx_exception_type type ## _exception_type = { \
180 (cxx_copy_ctor)THISCALL(dtor), \
182 & type ## _cxx_type_table \
187#define DEFINE_CXX_TYPE_INFO(type) \
188static cxx_type_info type ## _cxx_type_info = { \
196static void init_ ## type ## _cxx_type_info(char *base) \
198 type ## _cxx_type_info.type_info = (char *)&type ## _type_info - base; \
199 type ## _cxx_type_info.copy_ctor = (char *)type ## _copy_ctor - base; \
202#define DEFINE_CXX_EXCEPTION(type, base_no, cl1, cl2, dtor) \
203static cxx_type_info_table type ## _cxx_type_table = { \
212static cxx_exception_type type ##_exception_type = { \
219static void init_ ## type ## _cxx(char *base) \
221 init_ ## type ## _cxx_type_info(base); \
222 type ## _cxx_type_table.info[0] = (char *)&type ## _cxx_type_info - base; \
223 type ## _cxx_type_table.info[1] = (char *)cl1 - base; \
224 type ## _cxx_type_table.info[2] = (char *)cl2 - base; \
225 type ## _exception_type.destructor = (char *)dtor - base; \
226 type ## _exception_type.type_info_table = (char *)&type ## _cxx_type_table - base; \
231#define DEFINE_CXX_DATA(type, base_no, cl1, cl2, dtor) \
232DEFINE_CXX_TYPE_INFO(type) \
233DEFINE_CXX_EXCEPTION(type, base_no, cl1, cl2, dtor)
235#define DEFINE_CXX_EXCEPTION0(name, dtor) \
236 DEFINE_CXX_EXCEPTION(name, 0, NULL, NULL, dtor)
238#define DEFINE_CXX_DATA0(name, dtor) \
239 DEFINE_CXX_DATA(name, 0, NULL, NULL, dtor)
240#define DEFINE_CXX_DATA1(name, cl1, dtor) \
241 DEFINE_CXX_DATA(name, 1, cl1, NULL, dtor)
242#define DEFINE_CXX_DATA2(name, cl1, cl2, dtor) \
243 DEFINE_CXX_DATA(name, 2, cl1, cl2, dtor)
246#define EXCEPTION_MANGLED_NAME ".?AVexception@std@@"
248#define EXCEPTION_MANGLED_NAME ".?AVexception@@"
251#define CREATE_EXCEPTION_OBJECT(exception_name) \
252static exception* __exception_ctor(exception *this, const char *str, const vtable_ptr *vtbl) \
256 unsigned int len = strlen(str) + 1; \
257 this->name = malloc(len); \
258 memcpy(this->name, str, len); \
259 this->do_free = TRUE; \
264 this->do_free = FALSE; \
266 this->vtable = vtbl; \
270static exception* __exception_copy_ctor(exception *this, const exception *rhs, const vtable_ptr *vtbl) \
274 __exception_ctor(this, rhs->name, vtbl); \
279 this->vtable = vtbl; \
283extern const vtable_ptr exception_name ## _vtable; \
284exception* __thiscall exception_name ## _copy_ctor(exception *this, const exception *rhs); \
285DEFINE_THISCALL_WRAPPER(exception_name ## _copy_ctor,8) \
286exception* __thiscall exception_name ## _copy_ctor(exception *this, const exception *rhs) \
288 return __exception_copy_ctor(this, rhs, & exception_name ## _vtable); \
291void __thiscall exception_name ## _dtor(exception *this); \
292DEFINE_THISCALL_WRAPPER(exception_name ## _dtor,4) \
293void __thiscall exception_name ## _dtor(exception *this) \
295 if (this->do_free) free(this->name); \
298void* __thiscall exception_name ## _vector_dtor(exception *this, unsigned int flags); \
299DEFINE_THISCALL_WRAPPER(exception_name ## _vector_dtor,8) \
300void* __thiscall exception_name ## _vector_dtor(exception *this, unsigned int flags) \
304 INT_PTR i, *ptr = (INT_PTR *)this - 1; \
306 for (i = *ptr - 1; i >= 0; i--) exception_name ## _dtor(this + i); \
307 operator_delete(ptr); \
311 exception_name ## _dtor(this); \
312 if (flags & 1) operator_delete(this); \
317const char* __thiscall exception_name ## _what(exception *this); \
318DEFINE_THISCALL_WRAPPER(exception_name ## _what,4) \
319const char* __thiscall exception_name ## _what(exception *this) \
321 return this->name ? this->name : "Unknown exception"; \
324__ASM_BLOCK_BEGIN(exception_name ## _vtables) \
325__ASM_VTABLE(exception_name, \
326 VTABLE_ADD_FUNC(exception_name ## _vector_dtor) \
327 VTABLE_ADD_FUNC(exception_name ## _what)); \
330DEFINE_RTTI_DATA0(exception_name, 0, EXCEPTION_MANGLED_NAME) \
331DEFINE_CXX_TYPE_INFO(exception_name)
const char * wine_dbg_sprintf(const char *format,...)
struct _EXCEPTION_RECORD * PEXCEPTION_RECORD
int CDECL _XcptFilter(NTSTATUS, PEXCEPTION_POINTERS)
struct __type_info type_info
static const char * dbgstr_type_info(const type_info *info)
void(* cxx_copy_ctor)(void)
struct __exception exception
struct __cxx_type_info_table cxx_type_info_table
struct __cxx_exception_type cxx_exception_type
DWORD(* cxx_exc_custom_handler)(PEXCEPTION_RECORD, cxx_exception_frame *, PCONTEXT, EXCEPTION_REGISTRATION_RECORD **, const cxx_function_descr *, int nested_trylevel, EXCEPTION_REGISTRATION_RECORD *nested_frame, DWORD unknown3)
struct __cxx_type_info cxx_type_info
void WINAPI _CxxThrowException(exception *, const cxx_exception_type *)
static void * get_this_pointer(const this_ptr_offsets *off, void *object)
cxx_exc_custom_handler custom_handler
const cxx_type_info_table * type_info_table
const type_info * type_info
void(* cxx_copy_ctor)(void)
DWORD(* cxx_exc_custom_handler)(PEXCEPTION_RECORD, struct __cxx_exception_frame *, PCONTEXT, EXCEPTION_REGISTRATION_RECORD **, const struct __cxx_function_descr *, int nested_trylevel, EXCEPTION_REGISTRATION_RECORD *nested_frame, DWORD unknown3)