From: Piotr Caban Subject: [PATCH 1/2] msvcp110: Add _Throw_Cpp_error implementation. Message-Id: <9026fe42-3ca7-6a4b-7a51-a49f769d2ee6@codeweavers.com> Date: Thu, 11 Feb 2021 13:49:01 +0100 Implementation based on https://github.com/microsoft/STL/blob/main/stl/src/thread0.cpp Signed-off-by: Piotr Caban --- dlls/msvcp110/msvcp110.spec | 2 +- dlls/msvcp120/msvcp120.spec | 2 +- dlls/msvcp120_app/msvcp120_app.spec | 2 +- dlls/msvcp140/msvcp140.spec | 2 +- dlls/msvcp60/ios.c | 18 ++-- dlls/msvcp60/string.c | 4 +- dlls/msvcp90/cxx.h | 5 +- dlls/msvcp90/exception.c | 39 ++++++-- dlls/msvcp90/ios.c | 18 ++-- dlls/msvcp90/locale.c | 140 ++++++++++++++-------------- dlls/msvcp90/memory.c | 4 +- dlls/msvcp90/misc.c | 33 ++++++- dlls/msvcp90/msvcp_main.c | 2 +- dlls/msvcp90/string.c | 6 +- 14 files changed, 162 insertions(+), 115 deletions(-) diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec index 10c2216aebb..40cd6370dd3 100644 --- a/dlls/msvcp110/msvcp110.spec +++ b/dlls/msvcp110/msvcp110.spec @@ -1779,7 +1779,7 @@ @ cdecl -arch=win32 ?_Syserror_map@std@@YAPBDH@Z(long) _Syserror_map @ cdecl -arch=win64 ?_Syserror_map@std@@YAPEBDH@Z(long) _Syserror_map @ stub ?_Throw_C_error@std@@YAXH@Z -@ stub ?_Throw_Cpp_error@std@@YAXH@Z +@ cdecl ?_Throw_Cpp_error@std@@YAXH@Z(long) _Throw_Cpp_error @ stub -arch=win32 ?_Throw_future_error@std@@YAXABVerror_code@1@@Z @ stub -arch=win64 ?_Throw_future_error@std@@YAXAEBVerror_code@1@@Z @ stub ?_Throw_lock_error@threads@stdext@@YAXXZ diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec index 6f3e7b65f92..c21895eecf5 100644 --- a/dlls/msvcp120/msvcp120.spec +++ b/dlls/msvcp120/msvcp120.spec @@ -1740,7 +1740,7 @@ @ cdecl -arch=win32 ?_Syserror_map@std@@YAPBDH@Z(long) _Syserror_map @ cdecl -arch=win64 ?_Syserror_map@std@@YAPEBDH@Z(long) _Syserror_map @ stub ?_Throw_C_error@std@@YAXH@Z -@ stub ?_Throw_Cpp_error@std@@YAXH@Z +@ cdecl ?_Throw_Cpp_error@std@@YAXH@Z(long) _Throw_Cpp_error @ stub -arch=win32 ?_Throw_future_error@std@@YAXABVerror_code@1@@Z @ stub -arch=win64 ?_Throw_future_error@std@@YAXAEBVerror_code@1@@Z @ stub ?_Throw_lock_error@threads@stdext@@YAXXZ diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec index c35dcb2d427..00fa5592ac5 100644 --- a/dlls/msvcp120_app/msvcp120_app.spec +++ b/dlls/msvcp120_app/msvcp120_app.spec @@ -1740,7 +1740,7 @@ @ cdecl -arch=win32 ?_Syserror_map@std@@YAPBDH@Z(long) msvcp120.?_Syserror_map@std@@YAPBDH@Z @ cdecl -arch=win64 ?_Syserror_map@std@@YAPEBDH@Z(long) msvcp120.?_Syserror_map@std@@YAPEBDH@Z @ stub ?_Throw_C_error@std@@YAXH@Z -@ stub ?_Throw_Cpp_error@std@@YAXH@Z +@ cdecl ?_Throw_Cpp_error@std@@YAXH@Z(long) msvcp120.?_Throw_Cpp_error@std@@YAXH@Z @ stub -arch=win32 ?_Throw_future_error@std@@YAXABVerror_code@1@@Z @ stub -arch=win64 ?_Throw_future_error@std@@YAXAEBVerror_code@1@@Z @ stub ?_Throw_lock_error@threads@stdext@@YAXXZ diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec index dcd062aa4fc..2b0bf5ffa5e 100644 --- a/dlls/msvcp140/msvcp140.spec +++ b/dlls/msvcp140/msvcp140.spec @@ -1624,7 +1624,7 @@ @ cdecl -arch=win32 ?_Syserror_map@std@@YAPBDH@Z(long) _Syserror_map @ cdecl -arch=win64 ?_Syserror_map@std@@YAPEBDH@Z(long) _Syserror_map @ stub ?_Throw_C_error@std@@YAXH@Z -@ stub ?_Throw_Cpp_error@std@@YAXH@Z +@ cdecl ?_Throw_Cpp_error@std@@YAXH@Z(long) _Throw_Cpp_error @ stub -arch=win32 ?_Throw_future_error@std@@YAXABVerror_code@1@@Z @ stub -arch=win64 ?_Throw_future_error@std@@YAXAEBVerror_code@1@@Z @ cdecl -arch=arm ?_Tidy@?$_Yarn@D@std@@AAAXXZ(ptr) _Yarn_char__Tidy diff --git a/dlls/msvcp60/ios.c b/dlls/msvcp60/ios.c index 12222dc6260..903f5bce18f 100644 --- a/dlls/msvcp60/ios.c +++ b/dlls/msvcp60/ios.c @@ -3915,7 +3915,7 @@ void __thiscall basic_stringbuf_char__Init(basic_stringbuf_char *this, const cha char *buf = MSVCRT_operator_new(count); if(!buf) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } memcpy(buf, str, count); @@ -4053,7 +4053,7 @@ int __thiscall basic_stringbuf_char_overflow(basic_stringbuf_char *this, int met buf = MSVCRT_operator_new(size); if(!buf) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } if(!oldsize) { @@ -4292,7 +4292,7 @@ void __thiscall basic_stringbuf_wchar__Init(basic_stringbuf_wchar *this, const w wchar_t *buf = MSVCRT_operator_new(count*sizeof(wchar_t)); if(!buf) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } memcpy(buf, str, count*sizeof(wchar_t)); @@ -4466,7 +4466,7 @@ unsigned short __thiscall basic_stringbuf_wchar_overflow(basic_stringbuf_wchar * buf = MSVCRT_operator_new(size*sizeof(wchar_t)); if(!buf) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } if(!oldsize) { @@ -4863,15 +4863,15 @@ void __thiscall ios_base_clear_reraise(ios_base *this, IOSB_iostate state, bool return; if(reraise) - throw_exception(EXCEPTION_RERAISE, NULL); + throw_exception(EXCEPTION_RERAISE, 0, NULL); else if(this->state & this->except & IOSTATE_eofbit) - throw_exception(EXCEPTION_FAILURE, "eofbit is set"); + throw_exception(EXCEPTION_FAILURE, 0, "eofbit is set"); else if(this->state & this->except & IOSTATE_failbit) - throw_exception(EXCEPTION_FAILURE, "failbit is set"); + throw_exception(EXCEPTION_FAILURE, 0, "failbit is set"); else if(this->state & this->except & IOSTATE_badbit) - throw_exception(EXCEPTION_FAILURE, "badbit is set"); + throw_exception(EXCEPTION_FAILURE, 0, "badbit is set"); else if(this->state & this->except & IOSTATE__Hardfail) - throw_exception(EXCEPTION_FAILURE, "_Hardfail is set"); + throw_exception(EXCEPTION_FAILURE, 0, "_Hardfail is set"); } /* ?clear@ios_base@std@@QAEXH@Z */ diff --git a/dlls/msvcp60/string.c b/dlls/msvcp60/string.c index 8937dd35873..90f493811b5 100644 --- a/dlls/msvcp60/string.c +++ b/dlls/msvcp60/string.c @@ -49,7 +49,7 @@ void __cdecl _Xran(void) static const char msg[] = "invalid string position"; TRACE("\n"); - throw_exception(EXCEPTION_OUT_OF_RANGE, msg); + throw_exception(EXCEPTION_OUT_OF_RANGE, 0, msg); } /* ?_Xlen@std@@YAXXZ */ @@ -58,7 +58,7 @@ void __cdecl _Xlen(void) static const char msg[] = "string too long"; TRACE("\n"); - throw_exception(EXCEPTION_LENGTH_ERROR, msg); + throw_exception(EXCEPTION_LENGTH_ERROR, 0, msg); } /* ?compare@?$char_traits@D@std@@SAHPBD0I@Z */ diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h index 02735a3c168..7af11de7fe6 100644 --- a/dlls/msvcp90/cxx.h +++ b/dlls/msvcp90/cxx.h @@ -313,8 +313,11 @@ typedef enum __exception_type { EXCEPTION_RUNTIME_ERROR, EXCEPTION_FAILURE, EXCEPTION_RANGE_ERROR, +#if _MSVCP_VER > 90 + EXCEPTION_SYSTEM_ERROR +#endif } exception_type; -void throw_exception(exception_type, const char *); +void throw_exception(exception_type, int, const char *); /* rtti */ typedef struct __type_info diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c index 8ea4e132a0f..45e2ec93be4 100644 --- a/dlls/msvcp90/exception.c +++ b/dlls/msvcp90/exception.c @@ -668,6 +668,17 @@ typedef struct { typedef system_error _System_error; typedef system_error failure; +#if _MSVCP_VER > 90 +static system_error* MSVCP_system_error_ctor( system_error *this, int err, exception_name name ) +{ + TRACE("%p %d %s\n", this, err, EXCEPTION_STR(name)); + MSVCP_runtime_error_ctor(&this->base, name); + this->err = err; + this->base.e.vtable = &MSVCP_system_error_vtable; + return this; +} +#endif + static failure* MSVCP_failure_ctor( failure *this, exception_name name ) { TRACE("%p %s\n", this, EXCEPTION_STR(name)); @@ -747,7 +758,9 @@ DEFINE_RTTI_DATA4(failure, 0, &system_error_rtti_base_descriptor, &_System_error_rtti_base_descriptor, &runtime_error_rtti_base_descriptor, &exception_rtti_base_descriptor, ".?AVfailure@ios_base@std@@") DEFINE_CXX_TYPE_INFO(_System_error) -DEFINE_CXX_TYPE_INFO(system_error); +DEFINE_CXX_DATA3(system_error, &_System_error_cxx_type_info, + &runtime_error_cxx_type_info, &exception_cxx_type_info, + MSVCP_runtime_error_dtor) DEFINE_CXX_DATA4(failure, &system_error_cxx_type_info, &_System_error_cxx_type_info, &runtime_error_cxx_type_info, &exception_cxx_type_info, MSVCP_runtime_error_dtor) @@ -757,7 +770,8 @@ DEFINE_RTTI_DATA2(system_error, 0, &runtime_error_rtti_base_descriptor, DEFINE_RTTI_DATA3(failure, 0, &system_error_rtti_base_descriptor, &runtime_error_rtti_base_descriptor, &exception_rtti_base_descriptor, ".?AVfailure@ios_base@std@@") -DEFINE_CXX_TYPE_INFO(system_error); +DEFINE_CXX_DATA2(system_error, &runtime_error_cxx_type_info, + &exception_cxx_type_info, MSVCP_runtime_error_dtor) DEFINE_CXX_DATA3(failure, &system_error_cxx_type_info, &runtime_error_cxx_type_info, &exception_cxx_type_info, MSVCP_runtime_error_dtor) #else @@ -897,14 +911,14 @@ DEFINE_CXX_DATA2(range_error, &runtime_error_cxx_type_info, &exception_cxx_type_ void __cdecl _Nomemory(void) { TRACE("()\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } /* ?_Xmem@tr1@std@@YAXXZ */ void __cdecl _Xmem(void) { TRACE("()\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } /* ?_Xinvalid_argument@std@@YAXPBD@Z */ @@ -912,7 +926,7 @@ void __cdecl _Xmem(void) void __cdecl _Xinvalid_argument(const char *str) { TRACE("(%s)\n", debugstr_a(str)); - throw_exception(EXCEPTION_INVALID_ARGUMENT, str); + throw_exception(EXCEPTION_INVALID_ARGUMENT, 0, str); } /* ?_Xlength_error@std@@YAXPBD@Z */ @@ -920,7 +934,7 @@ void __cdecl _Xinvalid_argument(const char *str) void __cdecl _Xlength_error(const char *str) { TRACE("(%s)\n", debugstr_a(str)); - throw_exception(EXCEPTION_LENGTH_ERROR, str); + throw_exception(EXCEPTION_LENGTH_ERROR, 0, str); } /* ?_Xout_of_range@std@@YAXPBD@Z */ @@ -928,7 +942,7 @@ void __cdecl _Xlength_error(const char *str) void __cdecl _Xout_of_range(const char *str) { TRACE("(%s)\n", debugstr_a(str)); - throw_exception(EXCEPTION_OUT_OF_RANGE, str); + throw_exception(EXCEPTION_OUT_OF_RANGE, 0, str); } /* ?_Xruntime_error@std@@YAXPBD@Z */ @@ -936,7 +950,7 @@ void __cdecl _Xout_of_range(const char *str) void __cdecl _Xruntime_error(const char *str) { TRACE("(%s)\n", debugstr_a(str)); - throw_exception(EXCEPTION_RUNTIME_ERROR, str); + throw_exception(EXCEPTION_RUNTIME_ERROR, 0, str); } /* ?uncaught_exception@std@@YA_NXZ */ @@ -1067,7 +1081,7 @@ __ASM_BLOCK_BEGIN(exception_vtables) __ASM_BLOCK_END /* Internal: throws selected exception */ -void throw_exception(exception_type et, const char *str) +void throw_exception(exception_type et, int err, const char *str) { exception_name name = EXCEPTION_NAME(str); @@ -1124,6 +1138,13 @@ void throw_exception(exception_type et, const char *str) MSVCP_range_error_ctor(&e, name); _CxxThrowException((exception*)&e, &range_error_cxx_type); } +#if _MSVCR_VER > 90 + case EXCEPTION_SYSTEM_ERROR: { + system_error e; + MSVCP_system_error_ctor(&e, err, name); + _CxxThrowException((exception*)&e, &system_error_cxx_type); + } +#endif } } diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index 9aa72e4438e..369e5fc8ba7 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -4333,7 +4333,7 @@ void __thiscall basic_stringbuf_char__Init(basic_stringbuf_char *this, const cha char *buf = MSVCRT_operator_new(count); if(!buf) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } memcpy(buf, str, count); @@ -4471,7 +4471,7 @@ int __thiscall basic_stringbuf_char_overflow(basic_stringbuf_char *this, int met buf = MSVCRT_operator_new(size); if(!buf) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } if(!oldsize) { @@ -4710,7 +4710,7 @@ void __thiscall basic_stringbuf_wchar__Init(basic_stringbuf_wchar *this, const w wchar_t *buf = MSVCRT_operator_new(count*sizeof(wchar_t)); if(!buf) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } memcpy(buf, str, count*sizeof(wchar_t)); @@ -4884,7 +4884,7 @@ unsigned short __thiscall basic_stringbuf_wchar_overflow(basic_stringbuf_wchar * buf = MSVCRT_operator_new(size*sizeof(wchar_t)); if(!buf) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } if(!oldsize) { @@ -5280,15 +5280,15 @@ void __thiscall ios_base_clear_reraise(ios_base *this, IOSB_iostate state, bool return; if(reraise) - throw_exception(EXCEPTION_RERAISE, NULL); + throw_exception(EXCEPTION_RERAISE, 0, NULL); else if(this->state & this->except & IOSTATE_eofbit) - throw_exception(EXCEPTION_FAILURE, "eofbit is set"); + throw_exception(EXCEPTION_FAILURE, 0, "eofbit is set"); else if(this->state & this->except & IOSTATE_failbit) - throw_exception(EXCEPTION_FAILURE, "failbit is set"); + throw_exception(EXCEPTION_FAILURE, 0, "failbit is set"); else if(this->state & this->except & IOSTATE_badbit) - throw_exception(EXCEPTION_FAILURE, "badbit is set"); + throw_exception(EXCEPTION_FAILURE, 0, "badbit is set"); else if(this->state & this->except & IOSTATE__Hardfail) - throw_exception(EXCEPTION_FAILURE, "_Hardfail is set"); + throw_exception(EXCEPTION_FAILURE, 0, "_Hardfail is set"); } /* ?clear@ios_base@std@@QAEXH@Z */ diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c index 338ded0082d..3a7fc34f6b1 100644 --- a/dlls/msvcp90/locale.c +++ b/dlls/msvcp90/locale.c @@ -298,7 +298,7 @@ void __cdecl locale_facet_register(locale_facet *add) facets_elem *head = MSVCRT_operator_new(sizeof(*head)); if(!head) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } head->fac = add; @@ -525,7 +525,7 @@ _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cat_cstr(_Locinfo *locinfo, int categor FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr); if(!locstr) - throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name"); + throw_exception(EXCEPTION_RUNTIME_ERROR, 0, "bad locale name"); _Lockit_ctor_locktype(&locinfo->lock, _LOCK_LOCALE); locale_string_char_ctor(&locinfo->days); @@ -630,7 +630,7 @@ _Locinfo* __cdecl _Locinfo__Locinfo_Addcats(_Locinfo *locinfo, int category, con /* This function is probably modifying more global objects */ FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr); if(!locstr) - throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name"); + throw_exception(EXCEPTION_RUNTIME_ERROR, 0, "bad locale name"); locale_string_char_dtor(&locinfo->newlocname); @@ -712,7 +712,7 @@ _Ctypevec* __cdecl _Getctype(_Ctypevec *ret) if((name = ___lc_locale_name_func()[LC_COLLATE])) { size = wcslen(name)+1; ret->name = malloc(size*sizeof(*name)); - if(!ret->name) throw_exception(EXCEPTION_BAD_ALLOC, NULL); + if(!ret->name) throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); memcpy(ret->name, name, size*sizeof(*name)); } else { ret->name = NULL; @@ -720,7 +720,7 @@ _Ctypevec* __cdecl _Getctype(_Ctypevec *ret) #endif ret->delfl = TRUE; table = malloc(sizeof(short[256])); - if(!table) throw_exception(EXCEPTION_BAD_ALLOC, NULL); + if(!table) throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); memcpy(table, __pctype_func(), sizeof(short[256])); ret->table = table; return ret; @@ -1063,7 +1063,7 @@ size_t __cdecl collate_char__Getcat(const locale_facet **facet, const locale *lo *facet = MSVCRT_operator_new(sizeof(collate)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } collate_char_ctor_name((collate*)*facet, @@ -1355,7 +1355,7 @@ size_t __cdecl collate_wchar__Getcat(const locale_facet **facet, const locale *l *facet = MSVCRT_operator_new(sizeof(collate)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } collate_wchar_ctor_name((collate*)*facet, @@ -1611,7 +1611,7 @@ ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int fla /* ?_Xran@ctype_base@std@@KAXXZ */ void __cdecl ctype_base__Xran(void) { - throw_exception(EXCEPTION_OUT_OF_RANGE, "out of range in ctype"); + throw_exception(EXCEPTION_OUT_OF_RANGE, 0, "out of range in ctype"); } /* ?id@?$ctype@D@std@@2V0locale@2@A */ @@ -1919,7 +1919,7 @@ size_t __cdecl ctype_char__Getcat(const locale_facet **facet, const locale *loc) *facet = MSVCRT_operator_new(sizeof(ctype_char)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } @@ -2724,7 +2724,7 @@ size_t __cdecl ctype_wchar__Getcat(const locale_facet **facet, const locale *loc *facet = MSVCRT_operator_new(sizeof(ctype_wchar)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } @@ -3317,7 +3317,7 @@ size_t __cdecl codecvt_char__Getcat(const locale_facet **facet, const locale *lo *facet = MSVCRT_operator_new(sizeof(codecvt_char)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } codecvt_char_ctor((codecvt_char*)*facet); @@ -3656,7 +3656,7 @@ size_t __cdecl codecvt_wchar__Getcat(const locale_facet **facet, const locale *l *facet = MSVCRT_operator_new(sizeof(codecvt_wchar)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } @@ -3715,7 +3715,7 @@ size_t __cdecl codecvt_short__Getcat(const locale_facet **facet, const locale *l *facet = MSVCRT_operator_new(sizeof(codecvt_wchar)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } @@ -4073,7 +4073,7 @@ void __thiscall numpunct_char__Init(numpunct_char *this, const _Locinfo *locinfo MSVCRT_operator_delete((char*)this->true_name); ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } } @@ -4178,7 +4178,7 @@ size_t __cdecl numpunct_char__Getcat(const locale_facet **facet, const locale *l *facet = MSVCRT_operator_new(sizeof(numpunct_char)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } numpunct_char_ctor_name((numpunct_char*)*facet, @@ -4416,7 +4416,7 @@ void __thiscall numpunct_wchar__Init(numpunct_wchar *this, MSVCRT_operator_delete((wchar_t*)this->true_name); ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } } @@ -4565,7 +4565,7 @@ size_t __cdecl numpunct_wchar__Getcat(const locale_facet **facet, const locale * *facet = MSVCRT_operator_new(sizeof(numpunct_wchar)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } numpunct_wchar_ctor_name((numpunct_wchar*)*facet, @@ -4620,7 +4620,7 @@ size_t __cdecl numpunct_short__Getcat(const locale_facet **facet, const locale * *facet = MSVCRT_operator_new(sizeof(numpunct_wchar)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } numpunct_short_ctor_name((numpunct_wchar*)*facet, @@ -5047,7 +5047,7 @@ size_t __cdecl num_get_wchar__Getcat(const locale_facet **facet, const locale *l *facet = MSVCRT_operator_new(sizeof(num_get)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } @@ -6297,7 +6297,7 @@ size_t __cdecl num_get_char__Getcat(const locale_facet **facet, const locale *lo *facet = MSVCRT_operator_new(sizeof(num_get)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } @@ -7248,7 +7248,7 @@ size_t __cdecl num_put_char__Getcat(const locale_facet **facet, const locale *lo *facet = MSVCRT_operator_new(sizeof(num_put)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } @@ -7674,7 +7674,7 @@ ostreambuf_iterator_char* __thiscall num_put_char_do_put_double(const num_put *t tmp = MSVCRT_operator_new(size*2); if(!tmp) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } num_put_char_fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v)); MSVCRT_operator_delete(tmp); @@ -8025,7 +8025,7 @@ size_t __cdecl num_put_wchar__Getcat(const locale_facet **facet, const locale *l *facet = MSVCRT_operator_new(sizeof(num_put)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } @@ -8056,7 +8056,7 @@ size_t __cdecl num_put_short__Getcat(const locale_facet **facet, const locale *l *facet = MSVCRT_operator_new(sizeof(num_put)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } @@ -8623,7 +8623,7 @@ ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_double(const num_put tmp = MSVCRT_operator_new(size*2); if(!tmp) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v), numpunct_wchar_use_facet(IOS_LOCALE(base))); @@ -8658,7 +8658,7 @@ ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_double(const num_put tmp = MSVCRT_operator_new(size*2); if(!tmp) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v), numpunct_short_use_facet(IOS_LOCALE(base))); @@ -9078,7 +9078,7 @@ size_t __cdecl time_put_char__Getcat(const locale_facet **facet, const locale *l *facet = MSVCRT_operator_new(sizeof(time_put)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } @@ -9448,7 +9448,7 @@ size_t __cdecl time_put_wchar__Getcat(const locale_facet **facet, const locale * *facet = MSVCRT_operator_new(sizeof(time_put)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } time_put_wchar_ctor_name((time_put*)*facet, @@ -9503,7 +9503,7 @@ size_t __cdecl time_put_short__Getcat(const locale_facet **facet, const locale * *facet = MSVCRT_operator_new(sizeof(time_put)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } time_put_short_ctor_name((time_put*)*facet, @@ -9782,7 +9782,7 @@ void __thiscall time_get_char__Init(time_get_char *this, const _Locinfo *locinfo if(!this->days) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } memcpy((char*)this->days, days, len); @@ -9794,7 +9794,7 @@ void __thiscall time_get_char__Init(time_get_char *this, const _Locinfo *locinfo MSVCRT_operator_delete((char*)this->days); ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } memcpy((char*)this->months, months, len); @@ -9906,7 +9906,7 @@ unsigned int __cdecl time_get_char__Getcat(const locale_facet **facet, const loc *facet = MSVCRT_operator_new(sizeof(time_get_char)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } @@ -10683,7 +10683,7 @@ void __thiscall time_get_wchar__Init(time_get_wchar *this, const _Locinfo *locin if(!this->days) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } #if _MSVCP_VER >=110 @@ -10696,7 +10696,7 @@ void __thiscall time_get_wchar__Init(time_get_wchar *this, const _Locinfo *locin MSVCRT_operator_delete((wchar_t*)this->days); ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } this->dateorder = _Locinfo__Getdateorder(locinfo); @@ -10807,7 +10807,7 @@ unsigned int __cdecl time_get_wchar__Getcat(const locale_facet **facet, const lo *facet = MSVCRT_operator_new(sizeof(time_get_wchar)); if(!*facet) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return 0; } @@ -11580,7 +11580,7 @@ locale__Locimp* __thiscall locale__Locimp_copy_ctor(locale__Locimp *this, const if(!this->facetvec) { _Lockit_dtor(&lock); ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return NULL; } for(i=0; ifacet_cnt; i++) @@ -11658,7 +11658,7 @@ locale__Locimp* __cdecl locale__Locimp__New_Locimp(const locale__Locimp *copy) ret = MSVCRT_operator_new(sizeof(locale__Locimp)); if(!ret) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return NULL; } return locale__Locimp_copy_ctor(ret, copy); @@ -11675,7 +11675,7 @@ locale__Locimp* __cdecl locale__Locimp__New_Locimp_transparent(bool transparent) ret = MSVCRT_operator_new(sizeof(locale__Locimp)); if(!ret) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return NULL; } return locale__Locimp_ctor_transparent(ret, transparent); @@ -11701,7 +11701,7 @@ void __cdecl locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet if(!new_facetvec) { _Lockit_dtor(&lock); ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return; } @@ -11755,7 +11755,7 @@ void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, l ctype = MSVCRT_operator_new(sizeof(ctype_wchar)); if(!ctype) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } ctype_short_ctor_locinfo(ctype, locinfo, 0); } @@ -11771,7 +11771,7 @@ void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, l numget = MSVCRT_operator_new(sizeof(num_get)); if(!numget) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } num_get_short_ctor_locinfo(numget, locinfo, 0); } @@ -11787,7 +11787,7 @@ void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, l numput = MSVCRT_operator_new(sizeof(num_put)); if(!numput) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } num_put_short_ctor_locinfo(numput, locinfo, 0); } @@ -11803,7 +11803,7 @@ void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, l numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar)); if(!numpunct) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } numpunct_short_ctor_locinfo(numpunct, locinfo, 0, FALSE); } @@ -11819,7 +11819,7 @@ void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, l c = MSVCRT_operator_new(sizeof(collate)); if(!c) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } collate_short_ctor_locinfo(c, locinfo, 0); } @@ -11835,7 +11835,7 @@ void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, l t = MSVCRT_operator_new(sizeof(time_put)); if(!t) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } time_put_short_ctor_locinfo(t, locinfo, 0); } @@ -11851,7 +11851,7 @@ void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, l codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar)); if(!codecvt) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } codecvt_short_ctor_locinfo(codecvt, locinfo, 0); } @@ -11877,7 +11877,7 @@ void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, loc ctype = MSVCRT_operator_new(sizeof(ctype_wchar)); if(!ctype) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } ctype_wchar_ctor_locinfo(ctype, locinfo, 0); } @@ -11893,7 +11893,7 @@ void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, loc numget = MSVCRT_operator_new(sizeof(num_get)); if(!numget) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } num_get_wchar_ctor_locinfo(numget, locinfo, 0); } @@ -11909,7 +11909,7 @@ void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, loc numput = MSVCRT_operator_new(sizeof(num_put)); if(!numput) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } num_put_wchar_ctor_locinfo(numput, locinfo, 0); } @@ -11925,7 +11925,7 @@ void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, loc numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar)); if(!numpunct) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } numpunct_wchar_ctor_locinfo(numpunct, locinfo, 0, FALSE); } @@ -11941,7 +11941,7 @@ void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, loc c = MSVCRT_operator_new(sizeof(collate)); if(!c) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } collate_wchar_ctor_locinfo(c, locinfo, 0); } @@ -11957,7 +11957,7 @@ void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, loc t = MSVCRT_operator_new(sizeof(time_get_wchar)); if(!t) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } time_get_wchar_ctor_locinfo(t, locinfo, 0); } @@ -11973,7 +11973,7 @@ void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, loc t = MSVCRT_operator_new(sizeof(time_put)); if(!t) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } time_put_wchar_ctor_locinfo(t, locinfo, 0); } @@ -11989,7 +11989,7 @@ void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, loc codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar)); if(!codecvt) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } codecvt_wchar_ctor_locinfo(codecvt, locinfo, 0); } @@ -12015,7 +12015,7 @@ void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, loc ctype = MSVCRT_operator_new(sizeof(ctype_char)); if(!ctype) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } ctype_char_ctor_locinfo(ctype, locinfo, 0); } @@ -12031,7 +12031,7 @@ void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, loc numget = MSVCRT_operator_new(sizeof(num_get)); if(!numget) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } num_get_char_ctor_locinfo(numget, locinfo, 0); } @@ -12047,7 +12047,7 @@ void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, loc numput = MSVCRT_operator_new(sizeof(num_put)); if(!numput) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } num_put_char_ctor_locinfo(numput, locinfo, 0); } @@ -12063,7 +12063,7 @@ void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, loc numpunct = MSVCRT_operator_new(sizeof(numpunct_char)); if(!numpunct) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } numpunct_char_ctor_locinfo(numpunct, locinfo, 0, FALSE); } @@ -12079,7 +12079,7 @@ void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, loc c = MSVCRT_operator_new(sizeof(collate)); if(!c) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } collate_char_ctor_locinfo(c, locinfo, 0); } @@ -12095,7 +12095,7 @@ void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, loc t = MSVCRT_operator_new(sizeof(time_get_char)); if(!t) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } time_get_char_ctor_locinfo(t, locinfo, 0); } @@ -12111,7 +12111,7 @@ void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, loc t = MSVCRT_operator_new(sizeof(time_put)); if(!t) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } time_put_char_ctor_locinfo(t, locinfo, 0); } @@ -12127,7 +12127,7 @@ void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, loc codecvt = MSVCRT_operator_new(sizeof(codecvt_char)); if(!codecvt) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } codecvt_char_ctor_locinfo(codecvt, locinfo, 0); } @@ -12179,7 +12179,7 @@ locale__Locimp* __cdecl locale__Init(void) if(!global_locale) { _Lockit_dtor(&lock); ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return NULL; } @@ -12238,7 +12238,7 @@ locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, co this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp)); if(!this->ptr) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } locale__Locimp_copy_ctor(this->ptr, loc->ptr); @@ -12274,14 +12274,14 @@ locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, cons if(!memcmp(locale_string_char_c_str(&locinfo.newlocname), "*", 2)) { _Locinfo_dtor(&locinfo); MSVCRT_operator_delete(this->ptr); - throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name"); + throw_exception(EXCEPTION_RUNTIME_ERROR, 0, "bad locale name"); } this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp)); if(!this->ptr) { ERR("Out of memory\n"); _Locinfo_dtor(&locinfo); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } locale__Locimp_copy_ctor(this->ptr, loc->ptr); @@ -12302,7 +12302,7 @@ locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp)); if(!this->ptr) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } locale__Locimp_ctor(this->ptr); @@ -12312,7 +12312,7 @@ locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category if(!memcmp(locale_string_char_c_str(&locinfo.newlocname), "*", 2)) { _Locinfo_dtor(&locinfo); MSVCRT_operator_delete(this->ptr); - throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name"); + throw_exception(EXCEPTION_RUNTIME_ERROR, 0, "bad locale name"); } locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL); @@ -12393,7 +12393,7 @@ locale* __thiscall locale__Addfac(locale *this, locale_facet *facet, size_t id, locale__Locimp *new_ptr = MSVCRT_operator_new(sizeof(locale__Locimp)); if(!new_ptr) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return NULL; } locale__Locimp_copy_ctor(new_ptr, this->ptr); @@ -12470,7 +12470,7 @@ locale* __cdecl locale_empty(locale *ret) ret->ptr = MSVCRT_operator_new(sizeof(locale__Locimp)); if(!ret->ptr) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } locale__Locimp_ctor_transparent(ret->ptr, TRUE); return ret; diff --git a/dlls/msvcp90/memory.c b/dlls/msvcp90/memory.c index df3a7c55843..564fb505431 100644 --- a/dlls/msvcp90/memory.c +++ b/dlls/msvcp90/memory.c @@ -171,7 +171,7 @@ DEFINE_THISCALL_WRAPPER(MSVCP_allocator_wchar_allocate, 8) wchar_t* __thiscall MSVCP_allocator_wchar_allocate(void *this, size_t count) { if(UINT_MAX/count < sizeof(wchar_t)) { - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return NULL; } @@ -270,7 +270,7 @@ unsigned short* __thiscall MSVCP_allocator_short_allocate( void *this, size_t count) { if(UINT_MAX/count < sizeof(unsigned short)) { - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); return NULL; } diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c index f70de9e5600..7978b87777a 100644 --- a/dlls/msvcp90/misc.c +++ b/dlls/msvcp90/misc.c @@ -194,6 +194,19 @@ static const struct { {ETXTBSY, str_ETXTBSY}, {EWOULDBLOCK, str_EWOULDBLOCK}, }; + +static const struct { + int err; + const char *msg; +} cpp_error[] = { + { EBUSY, str_EBUSY }, + { EINVAL, str_EINVAL }, + { ESRCH, str_ESRCH }, + { ENOMEM, str_ENOMEM }, + { EPERM, str_EPERM }, + { EDEADLK, str_EDEADLK }, + { EAGAIN, str_EAGAIN } +}; #endif #if _MSVCP_VER >= 140 @@ -265,7 +278,7 @@ mutex* __thiscall mutex_ctor(mutex *this) CRITICAL_SECTION *cs = MSVCRT_operator_new(sizeof(*cs)); if(!cs) { ERR("Out of memory\n"); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } InitializeCriticalSection(cs); @@ -705,7 +718,7 @@ unsigned int __cdecl _Random_device(void) /* TODO: throw correct exception in case of failure */ if(rand_s(&ret)) - throw_exception(EXCEPTION, "random number generator failed\n"); + throw_exception(EXCEPTION, 0, "random number generator failed\n"); return ret; } #endif @@ -1532,7 +1545,7 @@ void __thiscall _Concurrent_queue_base_v4__Internal_throw_exception( const _Concurrent_queue_base_v4 *this) { TRACE("(%p)\n", this); - throw_exception(EXCEPTION_BAD_ALLOC, NULL); + throw_exception(EXCEPTION_BAD_ALLOC, 0, NULL); } /* ??0_Concurrent_queue_base_v4@details@Concurrency@@IAE@I@Z */ @@ -1928,7 +1941,7 @@ void __thiscall _vector_base_v4__Internal_throw_exception(void/*_vector_base_v4* TRACE("(%p %Iu)\n", this, idx); if(idx < ARRAY_SIZE(exceptions)) - throw_exception(exceptions[idx].type, exceptions[idx].msg); + throw_exception(exceptions[idx].type, 0, exceptions[idx].msg); } #ifdef _WIN64 @@ -1972,7 +1985,7 @@ static void concurrent_vector_alloc_segment(_Concurrent_vector_base_v4 *this, __EXCEPT_ALL { this->segment[seg] = NULL; - throw_exception(EXCEPTION_RERAISE, NULL); + throw_exception(EXCEPTION_RERAISE, 0, NULL); } __ENDTRY if(!this->segment[seg]) @@ -2870,6 +2883,16 @@ const char* __cdecl _Syserror_map(int err) return NULL; #endif } + +void __cdecl _Throw_Cpp_error(int code) +{ + char msg[256]; + + TRACE("(%d)\n", code); + + sprintf(msg, "%s: %s", _Syserror_map(cpp_error[code].err), cpp_error[code].msg); + throw_exception(EXCEPTION_SYSTEM_ERROR, cpp_error[code].err, msg); +} #endif #if _MSVCP_VER >= 140 diff --git a/dlls/msvcp90/msvcp_main.c b/dlls/msvcp90/msvcp_main.c index 6bfd8b14367..2a2f215fff9 100644 --- a/dlls/msvcp90/msvcp_main.c +++ b/dlls/msvcp90/msvcp_main.c @@ -96,7 +96,7 @@ static void* __cdecl operator_new(size_t size) } while (freed); TRACE("(%Iu) out of memory\n", size); - throw_exception(EXCEPTION_BAD_ALLOC, "bad allocation"); + throw_exception(EXCEPTION_BAD_ALLOC, 0, "bad allocation"); return NULL; } diff --git a/dlls/msvcp90/string.c b/dlls/msvcp90/string.c index 2be64a5ff35..2dde57a216c 100644 --- a/dlls/msvcp90/string.c +++ b/dlls/msvcp90/string.c @@ -457,7 +457,7 @@ void CDECL MSVCP__String_base_Xlen(void) static const char msg[] = "string too long"; TRACE("\n"); - throw_exception(EXCEPTION_LENGTH_ERROR, msg); + throw_exception(EXCEPTION_LENGTH_ERROR, 0, msg); } /* ?_Xlen@_String_base@std@@QBEXXZ */ @@ -473,7 +473,7 @@ void CDECL MSVCP__String_base_Xran(void) static const char msg[] = "invalid string position"; TRACE("\n"); - throw_exception(EXCEPTION_OUT_OF_RANGE, msg); + throw_exception(EXCEPTION_OUT_OF_RANGE, 0, msg); } /* ?_Xran@_String_base@std@@QBEXXZ */ @@ -489,7 +489,7 @@ void CDECL MSVCP__String_base_Xinvarg(void) static const char msg[] = "invalid string argument"; TRACE("\n"); - throw_exception(EXCEPTION_INVALID_ARGUMENT, msg); + throw_exception(EXCEPTION_INVALID_ARGUMENT, 0, msg); }