Piotr Caban : msvcrt: Fixed exception information on 64-bit systems.
Alexandre Julliard
julliard at winehq.org
Thu Oct 11 15:25:16 CDT 2012
Module: wine
Branch: master
Commit: 488693e4075bbd85525a2a9c9ce68cf5fe92aa50
URL: http://source.winehq.org/git/wine.git/?a=commit;h=488693e4075bbd85525a2a9c9ce68cf5fe92aa50
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu Oct 11 13:20:03 2012 +0200
msvcrt: Fixed exception information on 64-bit systems.
---
dlls/msvcrt/cpp.c | 33 ++-------------
dlls/msvcrt/cppexcept.h | 97 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 102 insertions(+), 28 deletions(-)
diff --git a/dlls/msvcrt/cpp.c b/dlls/msvcrt/cpp.c
index 8a8af42..ed5f751 100644
--- a/dlls/msvcrt/cpp.c
+++ b/dlls/msvcrt/cpp.c
@@ -666,34 +666,6 @@ __ASM_VTABLE(__non_rtti_object,
}
#endif
-#define DEFINE_EXCEPTION_TYPE_INFO(name, base_classes, cl1, cl2) \
-static const cxx_type_info name ## _cxx_type_info = \
-{ \
- 0, \
- &name ## _type_info, \
- { 0, -1, 0 }, \
- sizeof(name), \
- (cxx_copy_ctor)THISCALL(MSVCRT_ ## name ## _copy_ctor) \
-}; \
-\
-static const cxx_type_info_table name ## _type_info_table = \
-{ \
- base_classes+1, \
- { \
- &name ## _cxx_type_info, \
- cl1, \
- cl2 \
- } \
-}; \
-\
-const cxx_exception_type name ## _exception_type = \
-{ \
- 0, \
- (void *)THISCALL(MSVCRT_ ## name ## _dtor), \
- NULL, \
- &name ## _type_info_table \
-}
-
DEFINE_RTTI_DATA0( type_info, 0, ".?AVtype_info@@" );
DEFINE_RTTI_DATA0( exception, 0, ".?AVexception@@" );
DEFINE_RTTI_DATA1( bad_typeid, 0, &exception_rtti_base_descriptor, ".?AVbad_typeid@@" );
@@ -713,6 +685,11 @@ void msvcrt_init_exception(void *base)
init_bad_typeid_rtti(base);
init_bad_cast_rtti(base);
init___non_rtti_object_rtti(base);
+
+ init_exception_cxx(base);
+ init_bad_typeid_cxx(base);
+ init_bad_cast_cxx(base);
+ init___non_rtti_object_cxx(base);
#endif
}
diff --git a/dlls/msvcrt/cppexcept.h b/dlls/msvcrt/cppexcept.h
index 81066bf..d9ed2fa 100644
--- a/dlls/msvcrt/cppexcept.h
+++ b/dlls/msvcrt/cppexcept.h
@@ -55,6 +55,7 @@ typedef struct
} this_ptr_offsets;
/* complete information about a C++ type */
+#ifndef __x86_64__
typedef struct __cxx_type_info
{
UINT flags; /* flags (see CLASS_* flags below) */
@@ -63,15 +64,34 @@ typedef struct __cxx_type_info
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;
@@ -82,6 +102,7 @@ typedef DWORD (*cxx_exc_custom_handler)( PEXCEPTION_RECORD, struct __cxx_excepti
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 */
@@ -89,6 +110,15 @@ typedef struct __cxx_exception_type
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(exception*,const cxx_exception_type*);
int CDECL _XcptFilter(NTSTATUS, PEXCEPTION_POINTERS);
@@ -119,4 +149,71 @@ static inline void *get_this_pointer( const this_ptr_offsets *off, void *object
return this_ptr;
}
+#ifndef __x86_64__
+#define DEFINE_EXCEPTION_TYPE_INFO(type, base_no, cl1, cl2) \
+\
+static const cxx_type_info type ## _cxx_type_info = { \
+ 0, \
+ & type ##_type_info, \
+ { 0, -1, 0 }, \
+ sizeof(type), \
+ (cxx_copy_ctor)THISCALL(MSVCRT_ ## type ##_copy_ctor) \
+}; \
+\
+static const cxx_type_info_table type ## _type_info_table = { \
+ base_no+1, \
+ { \
+ & type ## _cxx_type_info, \
+ cl1, \
+ cl2 \
+ } \
+}; \
+\
+static const cxx_exception_type type ## _exception_type = { \
+ 0, \
+ (cxx_copy_ctor)THISCALL(MSVCRT_ ## type ## _dtor), \
+ NULL, \
+ & type ## _type_info_table \
+};
+
+#else
+
+#define DEFINE_EXCEPTION_TYPE_INFO(type, base_no, cl1, cl2) \
+\
+static cxx_type_info type ## _cxx_type_info = { \
+ 0, \
+ 0xdeadbeef, \
+ { 0, -1, 0 }, \
+ sizeof(type), \
+ 0xdeadbeef \
+}; \
+\
+static cxx_type_info_table type ## _type_info_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) \
+{ \
+ type ## _cxx_type_info.type_info = (char *)&type ## _type_info - base; \
+ type ## _cxx_type_info.copy_ctor = (char *)MSVCRT_ ## type ## _copy_ctor - base; \
+ type ## _type_info_table.info[0] = (char *)&type ## _cxx_type_info - base; \
+ type ## _type_info_table.info[1] = (char *)cl1 - base; \
+ type ## _type_info_table.info[2] = (char *)cl2 - base; \
+ type ## _exception_type.destructor = (char *)MSVCRT_ ## type ## _dtor - base; \
+ type ## _exception_type.type_info_table = (char *)&type ## _type_info_table - base; \
+}
+#endif
+
#endif /* __MSVCRT_CPPEXCEPT_H */
More information about the wine-cvs
mailing list