Commit 7477ceb6 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcp90: Fixed RTTI structure on 64-bit systems.

parent 33937f03
......@@ -64,7 +64,9 @@
#endif /* _WIN64 */
#define DEFINE_RTTI_DATA(name, off, base_classes, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, cl9, mangled_name) \
#ifndef __x86_64__
#define DEFINE_RTTI_DATA(name, off, base_classes_no, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, cl9, mangled_name) \
static const type_info name ## _type_info = { \
&MSVCP_type_info_vtable, \
NULL, \
......@@ -73,7 +75,7 @@
\
static const rtti_base_descriptor name ## _rtti_base_descriptor = { \
&name ##_type_info, \
base_classes, \
base_classes_no, \
{ 0, -1, 0}, \
64 \
}; \
......@@ -96,7 +98,7 @@ static const rtti_base_array name ## _rtti_base_array = { \
static const rtti_object_hierarchy name ## _hierarchy = { \
0, \
0, \
base_classes+1, \
base_classes_no+1, \
&name ## _rtti_base_array \
}; \
\
......@@ -108,6 +110,74 @@ const rtti_object_locator name ## _rtti = { \
&name ## _hierarchy \
}
#else
#define DEFINE_RTTI_DATA(name, off, base_classes_no, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, cl9, mangled_name) \
static const type_info name ## _type_info = { \
&MSVCP_type_info_vtable, \
NULL, \
mangled_name \
}; \
\
static rtti_base_descriptor name ## _rtti_base_descriptor = { \
0xdeadbeef, \
base_classes_no, \
{ 0, -1, 0}, \
64 \
}; \
\
static rtti_base_array name ## _rtti_base_array = { \
{ \
0xdeadbeef, \
0xdeadbeef, \
0xdeadbeef, \
0xdeadbeef, \
0xdeadbeef, \
0xdeadbeef, \
0xdeadbeef, \
0xdeadbeef, \
0xdeadbeef, \
0xdeadbeef, \
} \
}; \
\
static rtti_object_hierarchy name ## _hierarchy = { \
0, \
0, \
base_classes_no+1, \
0xdeadbeef \
}; \
\
rtti_object_locator name ## _rtti = { \
1, \
off, \
0, \
0xdeadbeef, \
0xdeadbeef, \
0xdeadbeef \
};\
\
static void init_ ## name ## _rtti(char *base) \
{ \
name ## _rtti_base_descriptor.type_descriptor = (char*)&name ## _type_info - base; \
name ## _rtti_base_array.bases[0] = (char*)&name ## _rtti_base_descriptor - base; \
name ## _rtti_base_array.bases[1] = (char*)cl1 - base; \
name ## _rtti_base_array.bases[2] = (char*)cl2 - base; \
name ## _rtti_base_array.bases[3] = (char*)cl3 - base; \
name ## _rtti_base_array.bases[4] = (char*)cl4 - base; \
name ## _rtti_base_array.bases[5] = (char*)cl5 - base; \
name ## _rtti_base_array.bases[6] = (char*)cl6 - base; \
name ## _rtti_base_array.bases[7] = (char*)cl7 - base; \
name ## _rtti_base_array.bases[8] = (char*)cl8 - base; \
name ## _rtti_base_array.bases[9] = (char*)cl9 - base; \
name ## _hierarchy.base_classes = (char*)&name ## _rtti_base_array - base; \
name ## _rtti.type_descriptor = (char*)&name ## _type_info - base; \
name ## _rtti.type_hierarchy = (char*)&name ## _hierarchy - base; \
name ## _rtti.object_locator = (char*)&name ## _rtti - base; \
}
#endif
#define DEFINE_RTTI_DATA0(name, off, mangled_name) \
DEFINE_RTTI_DATA(name, off, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, mangled_name)
#define DEFINE_RTTI_DATA1(name, off, cl1, mangled_name) \
......@@ -191,6 +261,8 @@ typedef struct
int vbase_offset; /* offset of this pointer offset in virtual base class descriptor */
} this_ptr_offsets;
#ifndef __x86_64__
typedef struct _rtti_base_descriptor
{
const type_info *type_descriptor;
......@@ -220,3 +292,38 @@ typedef struct _rtti_object_locator
const type_info *type_descriptor;
const rtti_object_hierarchy *type_hierarchy;
} rtti_object_locator;
#else
typedef struct
{
unsigned int type_descriptor;
int num_base_classes;
this_ptr_offsets offsets; /* offsets for computing the this pointer */
unsigned int attributes;
} rtti_base_descriptor;
typedef struct
{
unsigned int bases[10]; /* First element is the class itself */
} rtti_base_array;
typedef struct
{
unsigned int signature;
unsigned int attributes;
int array_len; /* Size of the array pointed to by 'base_classes' */
unsigned int base_classes;
} rtti_object_hierarchy;
typedef struct
{
unsigned int signature;
int base_class_offset;
unsigned int flags;
unsigned int type_descriptor;
unsigned int type_hierarchy;
unsigned int object_locator;
} rtti_object_locator;
#endif
......@@ -750,3 +750,19 @@ void throw_exception(exception_type et, const char *str)
}
}
}
void init_exception(void)
{
#ifdef __x86_64__
void *base = GetModuleHandleA("msvcp90.dll");
init_type_info_rtti(base);
init_exception_rtti(base);
init_bad_alloc_rtti(base);
init_logic_error_rtti(base);
init_length_error_rtti(base);
init_out_of_range_rtti(base);
init_invalid_argument_rtti(base);
init_runtime_error_rtti(base);
init_failure_rtti(base);
#endif
}
......@@ -12923,6 +12923,52 @@ basic_ostream_wchar *_Ptr_wclog = &wclog.obj;
void init_io(void)
{
#ifdef __x86_64__
void *base = GetModuleHandleA("msvcp90.dll");
init_iosb_rtti(base);
init_ios_base_rtti(base);
init_basic_ios_char_rtti(base);
init_basic_ios_wchar_rtti(base);
init_basic_ios_short_rtti(base);
init_basic_streambuf_char_rtti(base);
init_basic_streambuf_wchar_rtti(base);
init_basic_streambuf_short_rtti(base);
init_basic_filebuf_char_rtti(base);
init_basic_filebuf_wchar_rtti(base);
init_basic_filebuf_short_rtti(base);
init_basic_stringbuf_char_rtti(base);
init_basic_stringbuf_wchar_rtti(base);
init_basic_stringbuf_short_rtti(base);
init_basic_ostream_char_rtti(base);
init_basic_ostream_wchar_rtti(base);
init_basic_ostream_short_rtti(base);
init_basic_istream_char_rtti(base);
init_basic_istream_wchar_rtti(base);
init_basic_istream_short_rtti(base);
init_basic_iostream_char_rtti(base);
init_basic_iostream_wchar_rtti(base);
init_basic_iostream_short_rtti(base);
init_basic_ofstream_char_rtti(base);
init_basic_ofstream_wchar_rtti(base);
init_basic_ofstream_short_rtti(base);
init_basic_ifstream_char_rtti(base);
init_basic_ifstream_wchar_rtti(base);
init_basic_ifstream_short_rtti(base);
init_basic_fstream_char_rtti(base);
init_basic_fstream_wchar_rtti(base);
init_basic_fstream_short_rtti(base);
init_basic_ostringstream_char_rtti(base);
init_basic_ostringstream_wchar_rtti(base);
init_basic_ostringstream_short_rtti(base);
init_basic_istringstream_char_rtti(base);
init_basic_istringstream_wchar_rtti(base);
init_basic_istringstream_short_rtti(base);
init_basic_stringstream_char_rtti(base);
init_basic_stringstream_wchar_rtti(base);
init_basic_stringstream_short_rtti(base);
init_strstreambuf_rtti(base);
#endif
basic_filebuf_char_ctor_file(&filebuf_char_stdin, stdin);
basic_istream_char_ctor(&cin.obj, &filebuf_char_stdin.base, FALSE/*FIXME*/, TRUE);
......
......@@ -8722,6 +8722,34 @@ void __asm_dummy_vtables(void) {
}
#endif
void init_locale(void)
{
#ifdef __x86_64__
void *base = GetModuleHandleA("msvcp90.dll");
init_locale_facet_rtti(base);
init_collate_char_rtti(base);
init_collate_wchar_rtti(base);
init_collate_short_rtti(base);
init_ctype_base_rtti(base);
init_ctype_char_rtti(base);
init_ctype_wchar_rtti(base);
init_ctype_short_rtti(base);
init_codecvt_base_rtti(base);
init_codecvt_char_rtti(base);
init_codecvt_wchar_rtti(base);
init_codecvt_short_rtti(base);
init_numpunct_char_rtti(base);
init_numpunct_wchar_rtti(base);
init_numpunct_short_rtti(base);
init_num_get_char_rtti(base);
init_num_get_wchar_rtti(base);
init_num_get_short_rtti(base);
init_num_put_char_rtti(base);
init_num_put_wchar_rtti(base);
init_num_put_short_rtti(base);
#endif
}
void free_locale(void)
{
facets_elem *iter, *safe;
......
......@@ -463,5 +463,7 @@ ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put*, o
ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put*, ostreambuf_iterator_wchar*,
ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool);
void init_exception(void);
void init_locale(void);
void init_io(void);
void free_io(void);
......@@ -90,6 +90,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
case DLL_PROCESS_ATTACH:
init_cxx_funcs();
init_lockit();
init_exception();
init_locale();
init_io();
break;
case DLL_PROCESS_DETACH:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment