From aca667f6f8b9cedb16f18cae86e0908047f497ff Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Thu, 12 Oct 2017 15:52:45 -0700 Subject: [PATCH 1/4] msvcp90: Add std::range_error table. Signed-off-by: Daniel Lehman --- dlls/msvcp60/msvcp60.spec | 22 ++++++++--------- dlls/msvcp90/cxx.h | 1 + dlls/msvcp90/exception.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 11 deletions(-) diff --git a/dlls/msvcp60/msvcp60.spec b/dlls/msvcp60/msvcp60.spec index d9e42bd..f496430 100644 --- a/dlls/msvcp60/msvcp60.spec +++ b/dlls/msvcp60/msvcp60.spec @@ -907,10 +907,10 @@ @ stub -arch=win64 ??0overflow_error@std@@QEAA@AEBV01@@Z @ stub -arch=win32 ??0overflow_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z @ stub -arch=win64 ??0overflow_error@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z -@ stub -arch=win32 ??0range_error@std@@QAE@ABV01@@Z -@ stub -arch=win64 ??0range_error@std@@QEAA@AEBV01@@Z -@ stub -arch=win32 ??0range_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z -@ stub -arch=win64 ??0range_error@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z +@ thiscall -arch=win32 ??0range_error@std@@QAE@ABV01@@Z(ptr ptr) MSVCP_range_error_copy_ctor +@ cdecl -arch=win64 ??0range_error@std@@QEAA@AEBV01@@Z(ptr ptr) MSVCP_range_error_copy_ctor +@ thiscall -arch=win32 ??0range_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z(ptr ptr) MSVCP_range_error_ctor_bstr +@ cdecl -arch=win64 ??0range_error@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z(ptr ptr) MSVCP_range_error_ctor_bstr @ thiscall -arch=win32 ??0runtime_error@std@@QAE@ABV01@@Z(ptr ptr) MSVCP_runtime_error_copy_ctor @ cdecl -arch=win64 ??0runtime_error@std@@QEAA@AEBV01@@Z(ptr ptr) MSVCP_runtime_error_copy_ctor @ thiscall -arch=win32 ??0runtime_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z(ptr ptr) MSVCP_runtime_error_ctor_bstr @@ -1083,8 +1083,8 @@ @ cdecl -arch=win64 ??1out_of_range@std@@UEAA@XZ(ptr) MSVCP_logic_error_dtor @ stub -arch=win32 ??1overflow_error@std@@UAE@XZ @ stub -arch=win64 ??1overflow_error@std@@UEAA@XZ -@ stub -arch=win32 ??1range_error@std@@UAE@XZ -@ stub -arch=win64 ??1range_error@std@@UEAA@XZ +@ thiscall -arch=win32 ??1range_error@std@@UAE@XZ(ptr) MSVCP_runtime_error_dtor +@ cdecl -arch=win64 ??1range_error@std@@UEAA@XZ(ptr) MSVCP_runtime_error_dtor @ thiscall -arch=win32 ??1runtime_error@std@@UAE@XZ(ptr) MSVCP_logic_error_dtor @ cdecl -arch=win64 ??1runtime_error@std@@UEAA@XZ(ptr) MSVCP_logic_error_dtor @ thiscall -arch=win32 ??1strstream@std@@UAE@XZ(ptr) strstream_dtor @@ -1257,8 +1257,8 @@ @ cdecl -arch=win64 ??4out_of_range@std@@QEAAAEAV01@AEBV01@@Z(ptr ptr) MSVCP_out_of_range_assign @ stub -arch=win32 ??4overflow_error@std@@QAEAAV01@ABV01@@Z @ stub -arch=win64 ??4overflow_error@std@@QEAAAEAV01@AEBV01@@Z -@ stub -arch=win32 ??4range_error@std@@QAEAAV01@ABV01@@Z -@ stub -arch=win64 ??4range_error@std@@QEAAAEAV01@AEBV01@@Z +@ thiscall -arch=win32 ??4range_error@std@@QAEAAV01@ABV01@@Z(ptr ptr) MSVCP_range_error_assign +@ cdecl -arch=win64 ??4range_error@std@@QEAAAEAV01@AEBV01@@Z(ptr ptr) MSVCP_range_error_assign @ thiscall -arch=win32 ??4runtime_error@std@@QAEAAV01@ABV01@@Z(ptr ptr) MSVCP_runtime_error_assign @ cdecl -arch=win64 ??4runtime_error@std@@QEAAAEAV01@AEBV01@@Z(ptr ptr) MSVCP_runtime_error_assign @ stub -arch=win32 ??4underflow_error@std@@QAEAAV01@ABV01@@Z @@ -1829,7 +1829,7 @@ # extern ??_7money_base@std@@6B@ @ extern ??_7out_of_range@std@@6B@ MSVCP_out_of_range_vtable # extern ??_7overflow_error@std@@6B@ -# extern ??_7range_error@std@@6B@ +@ extern ??_7range_error@std@@6B@ MSVCP_range_error_vtable @ extern ??_7runtime_error@std@@6B@ MSVCP_runtime_error_vtable # extern ??_7time_base@std@@6B@ # extern ??_7underflow_error@std@@6B@ @@ -2045,8 +2045,8 @@ @ cdecl -arch=win64 ?_Doraise@out_of_range@std@@MEBAXXZ(ptr) MSVCP_exception__Doraise @ stub -arch=win32 ?_Doraise@overflow_error@std@@MBEXXZ @ stub -arch=win64 ?_Doraise@overflow_error@std@@MEBAXXZ -@ stub -arch=win32 ?_Doraise@range_error@std@@MBEXXZ -@ stub -arch=win64 ?_Doraise@range_error@std@@MEBAXXZ +@ thiscall -arch=win32 ?_Doraise@range_error@std@@MBEXXZ(ptr) MSVCP_exception__Doraise +@ cdecl -arch=win64 ?_Doraise@range_error@std@@MEBAXXZ(ptr) MSVCP_exception__Doraise @ thiscall -arch=win32 ?_Doraise@runtime_error@std@@MBEXXZ(ptr) MSVCP_exception__Doraise @ cdecl -arch=win64 ?_Doraise@runtime_error@std@@MEBAXXZ(ptr) MSVCP_exception__Doraise @ stub -arch=win32 ?_Doraise@underflow_error@std@@MBEXXZ diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h index 12a7f84..ddf9421 100644 --- a/dlls/msvcp90/cxx.h +++ b/dlls/msvcp90/cxx.h @@ -311,6 +311,7 @@ typedef enum __exception_type { EXCEPTION_INVALID_ARGUMENT, EXCEPTION_RUNTIME_ERROR, EXCEPTION_FAILURE, + EXCEPTION_RANGE_ERROR, } exception_type; void throw_exception(exception_type, const char *); diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c index c96f7a1..e62dfae 100644 --- a/dlls/msvcp90/exception.c +++ b/dlls/msvcp90/exception.c @@ -59,6 +59,8 @@ extern const vtable_ptr MSVCP_runtime_error_vtable; extern const vtable_ptr MSVCP_failure_vtable; /* ??_7bad_cast@std@@6B@ */ extern const vtable_ptr MSVCP_bad_cast_vtable; +/* ??_7range_error@std@@6B@ */ +extern const vtable_ptr MSVCP_range_error_vtable; static void MSVCP_type_info_dtor(type_info * _this) { @@ -195,6 +197,8 @@ exception* __thiscall MSVCP_exception_assign(exception *this, const exception *a /* ?_Doraise@runtime_error@std@@MEBAXXZ */ /* ?_Doraise@bad_cast@std@@MBEXXZ */ /* ?_Doraise@bad_cast@std@@MEBAXXZ */ +/* ?_Doraise@range_error@std@@MBEXXZ */ +/* ?_Doraise@range_error@std@@MEBAXXZ */ DEFINE_THISCALL_WRAPPER(MSVCP_exception__Doraise, 4) void __thiscall MSVCP_exception__Doraise(exception *this) { @@ -585,6 +589,8 @@ runtime_error* __thiscall MSVCP_runtime_error_ctor_bstr(runtime_error *this, con /* ??1runtime_error@std@@UAE@XZ */ /* ??1runtime_error@std@@UEAA@XZ */ +/* ??1range_error@std@@UAE@XZ */ +/* ??1range_error@std@@UEAA@XZ */ DEFINE_THISCALL_WRAPPER(MSVCP_runtime_error_dtor, 4) void __thiscall MSVCP_runtime_error_dtor(runtime_error *this) { @@ -766,6 +772,53 @@ bad_cast* __thiscall MSVCP_bad_cast_opequals(bad_cast *this, const bad_cast *rhs DEFINE_RTTI_DATA1(bad_cast, 0, &exception_rtti_base_descriptor, ".?AVbad_cast@std@@") DEFINE_CXX_DATA1(bad_cast, &exception_cxx_type_info, MSVCP_bad_cast_dtor) +/* range_error class data */ +typedef runtime_error range_error; + +static range_error* MSVCP_range_error_ctor( range_error *this, exception_name name ) +{ + TRACE("%p %s\n", this, EXCEPTION_STR(name)); + MSVCP_runtime_error_ctor(this, name); + this->e.vtable = &MSVCP_range_error_vtable; + return this; +} + +/* ??0range_error@std@@QAE@ABV01@@Z */ +/* ??0range_error@std@@QEAA@AEBV01@@Z */ +DEFINE_THISCALL_WRAPPER(MSVCP_range_error_copy_ctor, 8) +range_error* __thiscall MSVCP_range_error_copy_ctor( + range_error *this, const range_error *rhs) +{ + TRACE("%p %p\n", this, rhs); + MSVCP_runtime_error_copy_ctor(this, rhs); + this->e.vtable = &MSVCP_range_error_vtable; + return this; +} + +/* ??0range_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */ +/* ??0range_error@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */ +#ifndef _MSVCIRT +DEFINE_THISCALL_WRAPPER(MSVCP_range_error_ctor_bstr, 8) +range_error* __thiscall MSVCP_range_error_ctor_bstr(range_error *this, const basic_string_char *str) +{ + const char *name = MSVCP_basic_string_char_c_str(str); + TRACE("(%p %p %s)\n", this, str, name); + return MSVCP_range_error_ctor(this, EXCEPTION_NAME(name)); +} +#endif + +/* ??4range_error@std@@QAEAAV01@ABV01@@Z */ +/* ??4range_error@std@@QEAAAEAV01@AEBV01@@Z */ +DEFINE_THISCALL_WRAPPER(MSVCP_range_error_assign, 8) +range_error* __thiscall MSVCP_range_error_assign(range_error *this, const range_error *assign) +{ + MSVCP_runtime_error_dtor(this); + return MSVCP_range_error_copy_ctor(this, assign); +} + +DEFINE_RTTI_DATA2(range_error, 0, &runtime_error_rtti_base_descriptor, &exception_rtti_base_descriptor, ".?AVrange_error@std@@") +DEFINE_CXX_DATA2(range_error, &runtime_error_cxx_type_info, &exception_cxx_type_info, MSVCP_runtime_error_dtor) + /* ?_Nomemory@std@@YAXXZ */ void __cdecl _Nomemory(void) { @@ -856,6 +909,9 @@ void __asm_dummy_vtables(void) { EXCEPTION_VTABLE(bad_cast, VTABLE_ADD_FUNC(MSVCP_bad_cast_vector_dtor) VTABLE_ADD_FUNC(MSVCP_exception_what)); + EXCEPTION_VTABLE(range_error, + VTABLE_ADD_FUNC(MSVCP_runtime_error_vector_dtor) + VTABLE_ADD_FUNC(MSVCP_exception_what)); #ifndef __GNUC__ } #endif @@ -913,6 +969,11 @@ void throw_exception(exception_type et, const char *str) MSVCP_failure_ctor(&e, name); _CxxThrowException((exception*)&e, &failure_cxx_type); } + case EXCEPTION_RANGE_ERROR: { + range_error e; + MSVCP_range_error_ctor(&e, name); + _CxxThrowException((exception*)&e, &range_error_cxx_type); + } } } @@ -929,6 +990,7 @@ void init_exception(void *base) init_runtime_error_rtti(base); init_failure_rtti(base); init_bad_cast_rtti(base); + init_range_error_rtti(base); init_exception_cxx(base); init_bad_alloc_cxx(base); @@ -939,5 +1001,6 @@ void init_exception(void *base) init_runtime_error_cxx(base); init_failure_cxx(base); init_bad_cast_cxx(base); + init_range_error_cxx(base); #endif } -- 1.9.5