msvcrt: Resync cxx.h with msvcp90.

This commit is contained in:
Alexandre Julliard 2024-05-17 09:36:19 +02:00
parent d2c11cdd94
commit 9680ef7ea9
11 changed files with 240 additions and 259 deletions

View file

@ -91,7 +91,7 @@ __ASM_VTABLE(range_error,
VTABLE_ADD_FUNC(exception_what));
__ASM_BLOCK_END
DEFINE_CXX_EXCEPTION0( exception, exception_dtor )
DEFINE_CXX_DATA0( exception, exception_dtor )
DEFINE_RTTI_DATA1(runtime_error, 0, &exception_rtti_base_descriptor, ".?AVruntime_error@std@@")
DEFINE_CXX_TYPE_INFO(runtime_error)
DEFINE_RTTI_DATA2(range_error, 0, &runtime_error_rtti_base_descriptor,

View file

@ -20,7 +20,7 @@
#include <stdlib.h>
#include "windef.h"
#include "winternl.h"
#include "cxx.h"
#include "cppexcept.h"
void* __cdecl operator_new(size_t);
void __cdecl operator_delete(void*);

View file

@ -99,7 +99,7 @@ static const cxx_type_info type ## _cxx_type_info = { \
& type ##_type_info, \
{ 0, -1, 0 }, \
sizeof(type), \
(cxx_copy_ctor)THISCALL(type ##_copy_ctor) \
THISCALL(type ##_copy_ctor) \
};
#define DEFINE_CXX_DATA(type, base_no, cl1, cl2, cl3, cl4, dtor) \
@ -116,9 +116,9 @@ static const cxx_type_info_table type ## _cxx_type_table = { \
} \
}; \
\
static const cxx_exception_type type ## _cxx_type = { \
static const cxx_exception_type type ## _exception_type = { \
0, \
(cxx_copy_ctor)THISCALL(dtor), \
THISCALL(dtor), \
NULL, \
& type ## _cxx_type_table \
};
@ -230,7 +230,7 @@ static cxx_type_info_table type ## _cxx_type_table = { \
} \
}; \
\
static cxx_exception_type type ##_cxx_type = { \
static cxx_exception_type type ##_exception_type = { \
0, \
0xdeadbeef, \
0, \
@ -245,8 +245,8 @@ static void init_ ## type ## _cxx(char *base) \
type ## _cxx_type_table.info[2] = (char *)cl2 - base; \
type ## _cxx_type_table.info[3] = (char *)cl3 - base; \
type ## _cxx_type_table.info[4] = (char *)cl4 - base; \
type ## _cxx_type.destructor = (char *)dtor - base; \
type ## _cxx_type.type_info_table = (char *)&type ## _cxx_type_table - base; \
type ## _exception_type.destructor = (char *)dtor - base; \
type ## _exception_type.type_info_table = (char *)&type ## _cxx_type_table - base; \
}
#endif
@ -322,8 +322,6 @@ typedef struct __type_info
char mangled[128]; /* Variable length, but we declare it large enough for static RTTI */
} type_info;
extern const vtable_ptr type_info_vtable;
/* offsets for computing the this pointer */
typedef struct
{
@ -332,9 +330,6 @@ typedef struct
int vbase_offset; /* offset of this pointer offset in virtual base class descriptor */
} this_ptr_offsets;
/* dlls/msvcrt/cppexcept.h */
typedef void (*cxx_copy_ctor)(void);
#ifndef __x86_64__
typedef struct _rtti_base_descriptor
@ -373,7 +368,7 @@ typedef struct
const type_info *type_info;
this_ptr_offsets offsets;
unsigned int size;
cxx_copy_ctor copy_ctor;
void *copy_ctor;
} cxx_type_info;
typedef struct
@ -385,8 +380,8 @@ typedef struct
typedef struct
{
UINT flags;
void (*destructor)(void);
void* /*cxx_exc_custom_handler*/ custom_handler;
void *destructor;
void *custom_handler;
const cxx_type_info_table *type_info_table;
} cxx_exception_type;
@ -448,6 +443,8 @@ typedef struct
#endif
extern const vtable_ptr type_info_vtable;
#define CREATE_TYPE_INFO_VTABLE \
DEFINE_THISCALL_WRAPPER(type_info_vector_dtor,8) \
void * __thiscall type_info_vector_dtor(type_info * _this, unsigned int flags) \

View file

@ -913,7 +913,7 @@ void __cdecl DECLSPEC_NORETURN _Nomemory(void)
TRACE("()\n");
MSVCP_bad_alloc_default_ctor(&e);
_CxxThrowException(&e, &bad_alloc_cxx_type);
_CxxThrowException(&e, &bad_alloc_exception_type);
}
/* ?_Xmem@tr1@std@@YAXXZ */
@ -924,7 +924,7 @@ void __cdecl DECLSPEC_NORETURN _Xmem(void)
TRACE("()\n");
MSVCP_bad_alloc_default_ctor(&e);
_CxxThrowException(&e, &bad_alloc_cxx_type);
_CxxThrowException(&e, &bad_alloc_exception_type);
}
/* ?_Xinvalid_argument@std@@YAXPBD@Z */
@ -937,7 +937,7 @@ void __cdecl DECLSPEC_NORETURN _Xinvalid_argument(const char *str)
TRACE("(%s)\n", debugstr_a(str));
MSVCP_invalid_argument_ctor(&e, name);
_CxxThrowException(&e, &invalid_argument_cxx_type);
_CxxThrowException(&e, &invalid_argument_exception_type);
}
/* ?_Xlength_error@std@@YAXPBD@Z */
@ -950,7 +950,7 @@ void __cdecl DECLSPEC_NORETURN _Xlength_error(const char *str)
TRACE("(%s)\n", debugstr_a(str));
MSVCP_length_error_ctor(&e, name);
_CxxThrowException(&e, &length_error_cxx_type);
_CxxThrowException(&e, &length_error_exception_type);
}
/* ?_Xout_of_range@std@@YAXPBD@Z */
@ -963,7 +963,7 @@ void __cdecl DECLSPEC_NORETURN _Xout_of_range(const char *str)
TRACE("(%s)\n", debugstr_a(str));
MSVCP_out_of_range_ctor(&e, name);
_CxxThrowException(&e, &out_of_range_cxx_type);
_CxxThrowException(&e, &out_of_range_exception_type);
}
/* ?_Xruntime_error@std@@YAXPBD@Z */
@ -976,7 +976,7 @@ void __cdecl DECLSPEC_NORETURN _Xruntime_error(const char *str)
TRACE("(%s)\n", debugstr_a(str));
MSVCP_runtime_error_ctor(&e, name);
_CxxThrowException(&e, &runtime_error_cxx_type);
_CxxThrowException(&e, &runtime_error_exception_type);
}
#if _MSVCP_VER > 90
@ -988,7 +988,7 @@ void __cdecl _Xbad_function_call(void)
TRACE("()\n");
MSVCP_bad_function_call_ctor(&e);
_CxxThrowException(&e, &bad_function_call_cxx_type);
_CxxThrowException(&e, &bad_function_call_exception_type);
}
#endif
@ -1014,7 +1014,7 @@ void __cdecl _XGetLastError(void)
se.code.category = std_system_category();
se.base.e.vtable = &system_error_vtable;
_CxxThrowException(&se, &system_error_cxx_type);
_CxxThrowException(&se, &system_error_exception_type);
}
#endif
@ -1072,7 +1072,7 @@ void __cdecl DECLSPEC_NORETURN _Throw_future_error( const error_code *error_code
MSVCP_logic_error_ctor(&e.base, EXCEPTION_NAME(name));
e.code = *error_code;
e.base.e.vtable = &future_error_vtable;
_CxxThrowException(&e, &future_error_cxx_type);
_CxxThrowException(&e, &future_error_exception_type);
}
typedef struct
@ -1091,7 +1091,7 @@ static void exception_ptr_rethrow(const exception_ptr *ep)
exception e;
MSVCP_exception_ctor(&e, &exception_msg);
_CxxThrowException(&e, &exception_cxx_type);
_CxxThrowException(&e, &exception_exception_type);
return;
}
@ -1140,7 +1140,7 @@ void __cdecl _Throw_C_error(int code)
se.code.category = std_generic_category();
se.base.e.vtable = &system_error_vtable;
_CxxThrowException(&se, &system_error_cxx_type);
_CxxThrowException(&se, &system_error_exception_type);
}
#endif
@ -1562,7 +1562,7 @@ void DECLSPEC_NORETURN throw_exception(const char *str)
exception e;
MSVCP_exception_ctor(&e, name);
_CxxThrowException(&e, &exception_cxx_type);
_CxxThrowException(&e, &exception_exception_type);
}
/* Internal: throws range_error exception */
@ -1572,7 +1572,7 @@ void DECLSPEC_NORETURN throw_range_error(const char *str)
range_error e;
MSVCP_range_error_ctor(&e, name);
_CxxThrowException(&e, &range_error_cxx_type);
_CxxThrowException(&e, &range_error_exception_type);
}
/* Internal: throws failure exception */
@ -1582,7 +1582,7 @@ void DECLSPEC_NORETURN throw_failure(const char *str)
failure e;
MSVCP_failure_ctor(&e, name);
_CxxThrowException(&e, &failure_cxx_type);
_CxxThrowException(&e, &failure_exception_type);
}
void init_exception(void *base)

View file

@ -27,7 +27,7 @@
#include "wine/exception.h"
#include "wine/list.h"
#include "msvcrt.h"
#include "cxx.h"
#include "cppexcept.h"
#if _MSVCR_VER >= 100
@ -35,6 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
typedef exception cexception;
CREATE_EXCEPTION_OBJECT(cexception)
DEFINE_CXX_TYPE_INFO(cexception)
static LONG context_id = -1;
static LONG scheduler_id = -1;

View file

@ -31,7 +31,7 @@
#include "wine/debug.h"
#include "msvcrt.h"
#include "mtdll.h"
#include "cxx.h"
#include "cppexcept.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
@ -586,9 +586,7 @@ DEFINE_RTTI_DATA1( bad_cast, 0, &exception_rtti_base_descriptor, ".?AVbad_cast@@
DEFINE_RTTI_DATA2( __non_rtti_object, 0, &bad_typeid_rtti_base_descriptor, &exception_rtti_base_descriptor, ".?AV__non_rtti_object@@" )
#endif
#if _MSVCR_VER >= 100
DEFINE_CXX_EXCEPTION0( exception, exception_dtor )
#endif
DEFINE_CXX_DATA0( exception, exception_dtor )
DEFINE_CXX_DATA1( bad_typeid, &exception_cxx_type_info, bad_typeid_dtor )
DEFINE_CXX_DATA1( bad_cast, &exception_cxx_type_info, bad_cast_dtor )
DEFINE_CXX_DATA2( __non_rtti_object, &bad_typeid_cxx_type_info,
@ -610,11 +608,7 @@ void msvcrt_init_exception(void *base)
init_bad_cast_rtti(base);
init___non_rtti_object_rtti(base);
#if _MSVCR_VER >= 100
init_exception_cxx(base);
#else
init_exception_cxx_type_info(base);
#endif
init_bad_typeid_cxx(base);
init_bad_cast_cxx(base);
init___non_rtti_object_cxx(base);
@ -633,14 +627,12 @@ void throw_bad_alloc(void)
}
#endif
#if _MSVCR_VER >= 100
void throw_exception(const char* msg)
{
exception e;
__exception_ctor(&e, msg, &exception_vtable);
_CxxThrowException(&e, &exception_exception_type);
}
#endif
/******************************************************************
* ?set_terminate@@YAP6AXXZP6AXXZ@Z (MSVCRT.@)

View file

@ -21,7 +21,7 @@
#ifndef __MSVCRT_CPPEXCEPT_H
#define __MSVCRT_CPPEXCEPT_H
#include "wine/asm.h"
#include "cxx.h"
#define CXX_FRAME_MAGIC_VC6 0x19930520
#define CXX_FRAME_MAGIC_VC7 0x19930521
@ -31,73 +31,9 @@
#define FUNC_DESCR_SYNCHRONOUS 1 /* synchronous exceptions only (built with /EHs and /EHsc) */
#define FUNC_DESCR_NOEXCEPT 4 /* noexcept function */
typedef void (*vtable_ptr)(void);
/* type_info object, see cpp.c for implementation */
typedef struct __type_info
{
const vtable_ptr *vtable;
char *name; /* Unmangled name, allocated lazily */
char mangled[64]; /* Variable length, but we declare it large enough for static RTTI */
} type_info;
/* exception object */
typedef struct __exception
{
const vtable_ptr *vtable;
char *name; /* Name of this exception, always a new copy for each object */
BOOL do_free; /* Whether to free 'name' in our dtor */
} exception;
typedef void (*cxx_copy_ctor)(void);
/* offsets for computing the this pointer */
typedef struct
{
int this_offset; /* offset of base class this pointer from start of object */
int vbase_descr; /* offset of virtual base class descriptor */
int vbase_offset; /* offset of this pointer offset in virtual base class descriptor */
} this_ptr_offsets;
/* complete information about a C++ type */
#ifndef __x86_64__
typedef struct __cxx_type_info
{
UINT flags; /* flags (see CLASS_* flags below) */
const type_info *type_info; /* C++ type info */
this_ptr_offsets offsets; /* offsets for computing the this pointer */
unsigned int size; /* object size */
cxx_copy_ctor copy_ctor; /* copy constructor */
} cxx_type_info;
#else
typedef struct __cxx_type_info
{
UINT flags;
unsigned int type_info;
this_ptr_offsets offsets;
unsigned int size;
unsigned int copy_ctor;
} cxx_type_info;
#endif
#define CLASS_IS_SIMPLE_TYPE 1
#define CLASS_HAS_VIRTUAL_BASE_CLASS 4
/* table of C++ types that apply for a given object */
#ifndef __x86_64__
typedef struct __cxx_type_info_table
{
UINT count; /* number of types */
const cxx_type_info *info[3]; /* variable length, we declare it large enough for static RTTI */
} cxx_type_info_table;
#else
typedef struct __cxx_type_info_table
{
UINT count;
unsigned int info[3];
} cxx_type_info_table;
#endif
struct __cxx_exception_frame;
struct __cxx_function_descr;
@ -106,28 +42,24 @@ typedef DWORD (*cxx_exc_custom_handler)( PEXCEPTION_RECORD, struct __cxx_excepti
const struct __cxx_function_descr*, int nested_trylevel,
EXCEPTION_REGISTRATION_RECORD *nested_frame, DWORD unknown3 );
/* type information for an exception object */
#ifndef __x86_64__
typedef struct __cxx_exception_type
{
UINT flags; /* TYPE_FLAG flags */
void (*destructor)(void);/* exception object destructor */
cxx_exc_custom_handler custom_handler; /* custom handler for this exception */
const cxx_type_info_table *type_info_table; /* list of types for this exception object */
} cxx_exception_type;
#else
typedef struct
{
UINT flags;
unsigned int destructor;
unsigned int custom_handler;
unsigned int type_info_table;
} cxx_exception_type;
#endif
void WINAPI _CxxThrowException(void*,const cxx_exception_type*);
int CDECL _XcptFilter(NTSTATUS, PEXCEPTION_POINTERS);
typedef struct
{
EXCEPTION_RECORD *rec;
LONG *ref; /* not binary compatible with native msvcr100 */
} exception_ptr;
void throw_exception(const char*);
void exception_ptr_from_record(exception_ptr*,EXCEPTION_RECORD*);
void __cdecl __ExceptionPtrCreate(exception_ptr*);
void __cdecl __ExceptionPtrDestroy(exception_ptr*);
void __cdecl __ExceptionPtrRethrow(const exception_ptr*);
BOOL __cdecl __uncaught_exception(void);
static inline const char *dbgstr_type_info( const type_info *info )
{
if (!info) return "{}";
@ -155,93 +87,6 @@ static inline void *get_this_pointer( const this_ptr_offsets *off, void *object
return object;
}
#ifndef __x86_64__
#define DEFINE_CXX_TYPE_INFO(type) \
static const cxx_type_info type ## _cxx_type_info = { \
0, \
& type ##_type_info, \
{ 0, -1, 0 }, \
sizeof(type), \
(cxx_copy_ctor)THISCALL(type ##_copy_ctor) \
};
#define DEFINE_CXX_EXCEPTION(type, base_no, cl1, cl2, dtor) \
static const cxx_type_info_table type ## _cxx_type_table = { \
base_no+1, \
{ \
& type ## _cxx_type_info, \
cl1, \
cl2, \
} \
}; \
\
static const cxx_exception_type type ## _exception_type = { \
0, \
(cxx_copy_ctor)THISCALL(dtor), \
NULL, \
& type ## _cxx_type_table \
};
#else
#define DEFINE_CXX_TYPE_INFO(type) \
static cxx_type_info type ## _cxx_type_info = { \
0, \
0xdeadbeef, \
{ 0, -1, 0 }, \
sizeof(type), \
0xdeadbeef \
}; \
\
static void init_ ## type ## _cxx_type_info(char *base) \
{ \
type ## _cxx_type_info.type_info = (char *)&type ## _type_info - base; \
type ## _cxx_type_info.copy_ctor = (char *)type ## _copy_ctor - base; \
}
#define DEFINE_CXX_EXCEPTION(type, base_no, cl1, cl2, dtor) \
static cxx_type_info_table type ## _cxx_type_table = { \
base_no+1, \
{ \
0xdeadbeef, \
0xdeadbeef, \
0xdeadbeef, \
} \
}; \
\
static cxx_exception_type type ##_exception_type = { \
0, \
0xdeadbeef, \
0, \
0xdeadbeef \
}; \
\
static void init_ ## type ## _cxx(char *base) \
{ \
init_ ## type ## _cxx_type_info(base); \
type ## _cxx_type_table.info[0] = (char *)&type ## _cxx_type_info - base; \
type ## _cxx_type_table.info[1] = (char *)cl1 - base; \
type ## _cxx_type_table.info[2] = (char *)cl2 - base; \
type ## _exception_type.destructor = (char *)dtor - base; \
type ## _exception_type.type_info_table = (char *)&type ## _cxx_type_table - base; \
}
#endif
#define DEFINE_CXX_DATA(type, base_no, cl1, cl2, dtor) \
DEFINE_CXX_TYPE_INFO(type) \
DEFINE_CXX_EXCEPTION(type, base_no, cl1, cl2, dtor)
#define DEFINE_CXX_EXCEPTION0(name, dtor) \
DEFINE_CXX_EXCEPTION(name, 0, NULL, NULL, dtor)
#define DEFINE_CXX_DATA0(name, dtor) \
DEFINE_CXX_DATA(name, 0, NULL, NULL, dtor)
#define DEFINE_CXX_DATA1(name, cl1, dtor) \
DEFINE_CXX_DATA(name, 1, cl1, NULL, dtor)
#define DEFINE_CXX_DATA2(name, cl1, cl2, dtor) \
DEFINE_CXX_DATA(name, 2, cl1, cl2, dtor)
#if _MSVCR_VER >= 80
#define EXCEPTION_MANGLED_NAME ".?AVexception@std@@"
#else
@ -323,7 +168,6 @@ __ASM_VTABLE(exception_name, \
VTABLE_ADD_FUNC(exception_name ## _what)); \
__ASM_BLOCK_END \
\
DEFINE_RTTI_DATA0(exception_name, 0, EXCEPTION_MANGLED_NAME) \
DEFINE_CXX_TYPE_INFO(exception_name)
DEFINE_RTTI_DATA0(exception_name, 0, EXCEPTION_MANGLED_NAME)
#endif /* __MSVCRT_CPPEXCEPT_H */

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "cppexcept.h"
#include "wine/asm.h"
#ifdef _WIN64
@ -93,6 +93,36 @@ const rtti_object_locator name ## _rtti = { \
&name ## _hierarchy \
};
#define DEFINE_CXX_TYPE_INFO(type) \
static const cxx_type_info type ## _cxx_type_info = { \
0, \
& type ##_type_info, \
{ 0, -1, 0 }, \
sizeof(type), \
THISCALL(type ##_copy_ctor) \
};
#define DEFINE_CXX_DATA(type, base_no, cl1, cl2, cl3, cl4, dtor) \
DEFINE_CXX_TYPE_INFO(type) \
\
static const cxx_type_info_table type ## _cxx_type_table = { \
base_no+1, \
{ \
& type ## _cxx_type_info, \
cl1, \
cl2, \
cl3, \
cl4 \
} \
}; \
\
static const cxx_exception_type type ## _exception_type = { \
0, \
THISCALL(dtor), \
NULL, \
& type ## _cxx_type_table \
};
#else
#define __DEFINE_RTTI_BASE(name, base_classes_no, mangled_name) \
@ -170,6 +200,55 @@ static void init_ ## name ## _rtti(char *base) \
name ## _rtti.object_locator = (char*)&name ## _rtti - base; \
}
#define DEFINE_CXX_TYPE_INFO(type) \
static cxx_type_info type ## _cxx_type_info = { \
0, \
0xdeadbeef, \
{ 0, -1, 0 }, \
sizeof(type), \
0xdeadbeef \
}; \
\
static void init_ ## type ## _cxx_type_info(char *base) \
{ \
type ## _cxx_type_info.type_info = (char *)&type ## _type_info - base; \
type ## _cxx_type_info.copy_ctor = (char *)type ## _copy_ctor - base; \
}
#define DEFINE_CXX_DATA(type, base_no, cl1, cl2, cl3, cl4, dtor) \
\
DEFINE_CXX_TYPE_INFO(type) \
\
static cxx_type_info_table type ## _cxx_type_table = { \
base_no+1, \
{ \
0xdeadbeef, \
0xdeadbeef, \
0xdeadbeef, \
0xdeadbeef, \
0xdeadbeef \
} \
}; \
\
static cxx_exception_type type ##_exception_type = { \
0, \
0xdeadbeef, \
0, \
0xdeadbeef \
}; \
\
static void init_ ## type ## _cxx(char *base) \
{ \
init_ ## type ## _cxx_type_info(base); \
type ## _cxx_type_table.info[0] = (char *)&type ## _cxx_type_info - base; \
type ## _cxx_type_table.info[1] = (char *)cl1 - base; \
type ## _cxx_type_table.info[2] = (char *)cl2 - base; \
type ## _cxx_type_table.info[3] = (char *)cl3 - base; \
type ## _cxx_type_table.info[4] = (char *)cl4 - base; \
type ## _exception_type.destructor = (char *)dtor - base; \
type ## _exception_type.type_info_table = (char *)&type ## _cxx_type_table - base; \
}
#endif
#define DEFINE_RTTI_DATA0(name, off, mangled_name) \
@ -182,11 +261,75 @@ static void init_ ## name ## _rtti(char *base) \
DEFINE_RTTI_DATA(name, off, 3, cl1, cl2, cl3, NULL, NULL, NULL, NULL, NULL, NULL, mangled_name)
#define DEFINE_RTTI_DATA4(name, off, cl1, cl2, cl3, cl4, mangled_name) \
DEFINE_RTTI_DATA(name, off, 4, cl1, cl2, cl3, cl4, NULL, NULL, NULL, NULL, NULL, mangled_name)
#define DEFINE_RTTI_DATA5(name, off, cl1, cl2, cl3, cl4, cl5, mangled_name) \
DEFINE_RTTI_DATA(name, off, 5, cl1, cl2, cl3, cl4, cl5, NULL, NULL, NULL, NULL, mangled_name)
#define DEFINE_RTTI_DATA8(name, off, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, mangled_name) \
DEFINE_RTTI_DATA(name, off, 8, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, NULL, mangled_name)
#define DEFINE_RTTI_DATA9(name, off, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, cl9, mangled_name) \
DEFINE_RTTI_DATA(name, off, 9, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, cl9, mangled_name)
#define DEFINE_CXX_DATA0(name, dtor) \
DEFINE_CXX_DATA(name, 0, NULL, NULL, NULL, NULL, dtor)
#define DEFINE_CXX_DATA1(name, cl1, dtor) \
DEFINE_CXX_DATA(name, 1, cl1, NULL, NULL, NULL, dtor)
#define DEFINE_CXX_DATA2(name, cl1, cl2, dtor) \
DEFINE_CXX_DATA(name, 2, cl1, cl2, NULL, NULL, dtor)
#define DEFINE_CXX_DATA3(name, cl1, cl2, cl3, dtor) \
DEFINE_CXX_DATA(name, 3, cl1, cl2, cl3, NULL, dtor)
#define DEFINE_CXX_DATA4(name, cl1, cl2, cl3, cl4, dtor) \
DEFINE_CXX_DATA(name, 4, cl1, cl2, cl3, cl4, dtor)
#ifdef __ASM_USE_THISCALL_WRAPPER
#define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (WINAPI*)type)&vtbl_wrapper_##off)args
extern void *vtbl_wrapper_0;
extern void *vtbl_wrapper_4;
extern void *vtbl_wrapper_8;
extern void *vtbl_wrapper_12;
extern void *vtbl_wrapper_16;
extern void *vtbl_wrapper_20;
extern void *vtbl_wrapper_24;
extern void *vtbl_wrapper_28;
extern void *vtbl_wrapper_32;
extern void *vtbl_wrapper_36;
extern void *vtbl_wrapper_40;
extern void *vtbl_wrapper_44;
extern void *vtbl_wrapper_48;
extern void *vtbl_wrapper_52;
extern void *vtbl_wrapper_56;
#else
#define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (__thiscall***)type)this)[0][off/4]args
#endif
/* exception object */
typedef void (*vtable_ptr)(void);
typedef struct __exception
{
const vtable_ptr *vtable;
char *name; /* Name of this exception, always a new copy for each object */
int do_free; /* Whether to free 'name' in our dtor */
} exception;
/* rtti */
typedef struct __type_info
{
const vtable_ptr *vtable;
char *name; /* Unmangled name, allocated lazily */
char mangled[128]; /* Variable length, but we declare it large enough for static RTTI */
} type_info;
/* offsets for computing the this pointer */
typedef struct
{
int this_offset; /* offset of base class this pointer from start of object */
int vbase_descr; /* offset of virtual base class descriptor */
int vbase_offset; /* offset of this pointer offset in virtual base class descriptor */
} this_ptr_offsets;
#ifndef __x86_64__
typedef struct _rtti_base_descriptor
@ -219,6 +362,29 @@ typedef struct _rtti_object_locator
const rtti_object_hierarchy *type_hierarchy;
} rtti_object_locator;
typedef struct
{
UINT flags;
const type_info *type_info;
this_ptr_offsets offsets;
unsigned int size;
void *copy_ctor;
} cxx_type_info;
typedef struct
{
UINT count;
const cxx_type_info *info[5];
} cxx_type_info_table;
typedef struct
{
UINT flags;
void *destructor;
void *custom_handler;
const cxx_type_info_table *type_info_table;
} cxx_exception_type;
#else
typedef struct
@ -252,34 +418,31 @@ typedef struct
unsigned int object_locator;
} rtti_object_locator;
#endif
typedef struct
{
UINT flags;
unsigned int type_info;
this_ptr_offsets offsets;
unsigned int size;
unsigned int copy_ctor;
} cxx_type_info;
#ifdef __ASM_USE_THISCALL_WRAPPER
typedef struct
{
UINT count;
unsigned int info[5];
} cxx_type_info_table;
#define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (WINAPI*)type)&vtbl_wrapper_##off)args
extern void *vtbl_wrapper_0;
extern void *vtbl_wrapper_4;
extern void *vtbl_wrapper_8;
extern void *vtbl_wrapper_12;
extern void *vtbl_wrapper_16;
extern void *vtbl_wrapper_20;
extern void *vtbl_wrapper_24;
extern void *vtbl_wrapper_28;
extern void *vtbl_wrapper_32;
extern void *vtbl_wrapper_36;
extern void *vtbl_wrapper_40;
extern void *vtbl_wrapper_44;
extern void *vtbl_wrapper_48;
#else
#define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (__thiscall***)type)this)[0][off/4]args
typedef struct
{
UINT flags;
unsigned int destructor;
unsigned int custom_handler;
unsigned int type_info_table;
} cxx_exception_type;
#endif
exception* __thiscall exception_ctor(exception*, const char**);
extern const vtable_ptr type_info_vtable;
#define CREATE_TYPE_INFO_VTABLE \
@ -308,18 +471,3 @@ __ASM_BLOCK_BEGIN(type_info_vtables) \
__ASM_VTABLE(type_info, \
VTABLE_ADD_FUNC(type_info_vector_dtor)); \
__ASM_BLOCK_END
typedef struct
{
EXCEPTION_RECORD *rec;
LONG *ref; /* not binary compatible with native msvcr100 */
} exception_ptr;
void throw_exception(const char*);
void exception_ptr_from_record(exception_ptr*,EXCEPTION_RECORD*);
void __cdecl __ExceptionPtrCreate(exception_ptr*);
void __cdecl __ExceptionPtrDestroy(exception_ptr*);
void __cdecl __ExceptionPtrRethrow(const exception_ptr*);
BOOL __cdecl __uncaught_exception(void);

View file

@ -602,9 +602,10 @@ DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame
if (rec->ExceptionInformation[0] > CXX_FRAME_MAGIC_VC8 &&
exc_type->custom_handler)
{
return exc_type->custom_handler( rec, frame, context, dispatch, descr,
nested_frame ? nested_frame->trylevel : 0,
nested_frame ? &nested_frame->frame : NULL, 0 );
cxx_exc_custom_handler handler = exc_type->custom_handler;
return handler( rec, frame, context, dispatch, descr,
nested_frame ? nested_frame->trylevel : 0,
nested_frame ? &nested_frame->frame : NULL, 0 );
}
if (TRACE_ON(seh))

View file

@ -26,7 +26,7 @@
#include "wine/exception.h"
#include "wine/debug.h"
#include "msvcrt.h"
#include "cxx.h"
#include "cppexcept.h"
#ifdef __i386__

View file

@ -32,8 +32,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(seh);
#define CXX_EXCEPTION 0xe06d7363
static DWORD fls_index;
typedef struct