From 389fbcf961732528d8cc4351e299256ae5782b96 Mon Sep 17 00:00:00 2001 From: Vijay Kiran Kamuju Date: Sat, 1 Apr 2023 11:23:41 +0000 Subject: [PATCH] msvcp110: Add std::_Rethrow_future_exception implementation. --- dlls/msvcp110/msvcp110.spec | 2 +- dlls/msvcp120/msvcp120.spec | 2 +- dlls/msvcp120_app/msvcp120_app.spec | 2 +- dlls/msvcp140/msvcp140.spec | 2 +- dlls/msvcp90/exception.c | 53 ++++++++++++++++++----------- dlls/msvcp_win/msvcp_win.spec | 2 +- 6 files changed, 38 insertions(+), 25 deletions(-) diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec index 2de95bf94ef..074ca946b19 100644 --- a/dlls/msvcp110/msvcp110.spec +++ b/dlls/msvcp110/msvcp110.spec @@ -1732,7 +1732,7 @@ @ cdecl -arch=win64 ?_Rep@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@G_K@Z(ptr ptr ptr long long) num_put_wchar__Rep @ cdecl -arch=win32 ?_Rep@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@_WI@Z(ptr ptr long ptr long long) num_put_wchar__Rep @ cdecl -arch=win64 ?_Rep@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@_W_K@Z(ptr ptr ptr long long) num_put_wchar__Rep -@ stub ?_Rethrow_future_exception@std@@YAXVexception_ptr@1@@Z +@ cdecl -norelay ?_Rethrow_future_exception@std@@YAXVexception_ptr@1@@Z() _Rethrow_future_exception @ stub -arch=win32 ?_Rng_abort@std@@YAXPBD@Z @ stub -arch=win64 ?_Rng_abort@std@@YAXPEBD@Z @ cdecl -arch=win32 ?_Segment_index_of@_Concurrent_vector_base_v4@details@Concurrency@@KAII@Z(long) _vector_base_v4__Segment_index_of diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec index e0adc83113f..0d2a5fe0fca 100644 --- a/dlls/msvcp120/msvcp120.spec +++ b/dlls/msvcp120/msvcp120.spec @@ -1693,7 +1693,7 @@ @ cdecl -arch=win64 ?_Rep@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@G_K@Z(ptr ptr ptr long long) num_put_wchar__Rep @ cdecl -arch=win32 ?_Rep@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@_WI@Z(ptr ptr long ptr long long) num_put_wchar__Rep @ cdecl -arch=win64 ?_Rep@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@_W_K@Z(ptr ptr ptr long long) num_put_wchar__Rep -@ stub ?_Rethrow_future_exception@std@@YAXVexception_ptr@1@@Z +@ cdecl -norelay ?_Rethrow_future_exception@std@@YAXVexception_ptr@1@@Z() _Rethrow_future_exception @ stub -arch=win32 ?_Rng_abort@std@@YAXPBD@Z @ stub -arch=win64 ?_Rng_abort@std@@YAXPEBD@Z @ cdecl -arch=win32 ?_Segment_index_of@_Concurrent_vector_base_v4@details@Concurrency@@KAII@Z(long) _vector_base_v4__Segment_index_of diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec index dd8e3ebf173..d11ba788898 100644 --- a/dlls/msvcp120_app/msvcp120_app.spec +++ b/dlls/msvcp120_app/msvcp120_app.spec @@ -1693,7 +1693,7 @@ @ cdecl -arch=win64 ?_Rep@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@G_K@Z(ptr ptr ptr long long) msvcp120.?_Rep@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@G_K@Z @ cdecl -arch=win32 ?_Rep@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@_WI@Z(ptr ptr long ptr long long) msvcp120.?_Rep@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@_WI@Z @ cdecl -arch=win64 ?_Rep@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@_W_K@Z(ptr ptr ptr long long) msvcp120.?_Rep@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@_W_K@Z -@ stub ?_Rethrow_future_exception@std@@YAXVexception_ptr@1@@Z +@ cdecl -norelay ?_Rethrow_future_exception@std@@YAXVexception_ptr@1@@Z() msvcp120.?_Rethrow_future_exception@std@@YAXVexception_ptr@1@@Z @ stub -arch=win32 ?_Rng_abort@std@@YAXPBD@Z @ stub -arch=win64 ?_Rng_abort@std@@YAXPEBD@Z @ cdecl -arch=win32 ?_Segment_index_of@_Concurrent_vector_base_v4@details@Concurrency@@KAII@Z(long) msvcp120.?_Segment_index_of@_Concurrent_vector_base_v4@details@Concurrency@@KAII@Z diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec index dd619c637e1..8e57b828182 100644 --- a/dlls/msvcp140/msvcp140.spec +++ b/dlls/msvcp140/msvcp140.spec @@ -1595,7 +1595,7 @@ @ cdecl -arch=arm ?_Reset@_ContextCallback@details@Concurrency@@AAAXXZ(ptr) _ContextCallback__Reset @ thiscall -arch=i386 ?_Reset@_ContextCallback@details@Concurrency@@AAEXXZ(ptr) _ContextCallback__Reset @ cdecl -arch=win64 ?_Reset@_ContextCallback@details@Concurrency@@AEAAXXZ(ptr) _ContextCallback__Reset -@ stub ?_Rethrow_future_exception@std@@YAXVexception_ptr@1@@Z +@ cdecl -norelay ?_Rethrow_future_exception@std@@YAXVexception_ptr@1@@Z() _Rethrow_future_exception @ stub -arch=win32 ?_Rng_abort@std@@YAXPBD@Z @ stub -arch=win64 ?_Rng_abort@std@@YAXPEBD@Z @ cdecl -arch=win32 ?_Schedule_chore@details@Concurrency@@YAHPAU_Threadpool_chore@12@@Z(ptr) _Schedule_chore diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c index 8ceaa91e884..66a5061a4f0 100644 --- a/dlls/msvcp90/exception.c +++ b/dlls/msvcp90/exception.c @@ -947,6 +947,38 @@ bool __cdecl MSVCP__uncaught_exception(void) return __uncaught_exception(); } +#if _MSVCP_VER >= 110 +typedef struct +{ + EXCEPTION_RECORD *rec; + LONG *ref; /* not binary compatible with native */ +} exception_ptr; + +static void exception_ptr_rethrow(const exception_ptr *ep) +{ + TRACE("(%p)\n", ep); + + if (!ep->rec) + { + static const char *exception_msg = "bad exception"; + exception e; + + MSVCP_exception_ctor(&e, &exception_msg); + _CxxThrowException(&e, &exception_cxx_type); + return; + } + + RaiseException(ep->rec->ExceptionCode, ep->rec->ExceptionFlags & (~EH_UNWINDING), + ep->rec->NumberParameters, ep->rec->ExceptionInformation); +} + +/* ?_Rethrow_future_exception@std@@YAXVexception_ptr@1@@Z */ +void __cdecl _Rethrow_future_exception(const exception_ptr ep) +{ + exception_ptr_rethrow(&ep); +} +#endif + #if _MSVCP_VER >= 140 void** CDECL __current_exception(void); @@ -1002,12 +1034,6 @@ int __cdecl __uncaught_exceptions(void) return *__processing_throw(); } -typedef struct -{ - EXCEPTION_RECORD *rec; - LONG *ref; /* not binary compatible with native */ -} exception_ptr; - /********************************************************************* * ?__ExceptionPtrCreate@@YAXPAX@Z * ?__ExceptionPtrCreate@@YAXPEAX@Z @@ -1102,20 +1128,7 @@ void __cdecl __ExceptionPtrAssign(exception_ptr *ep, const exception_ptr *assign */ void __cdecl __ExceptionPtrRethrow(const exception_ptr *ep) { - TRACE("(%p)\n", ep); - - if (!ep->rec) - { - static const char *exception_msg = "bad exception"; - exception e; - - MSVCP_exception_ctor(&e, &exception_msg); - _CxxThrowException(&e, &exception_cxx_type); - return; - } - - RaiseException(ep->rec->ExceptionCode, ep->rec->ExceptionFlags & (~EH_UNWINDING), - ep->rec->NumberParameters, ep->rec->ExceptionInformation); + exception_ptr_rethrow(ep); } /********************************************************************* diff --git a/dlls/msvcp_win/msvcp_win.spec b/dlls/msvcp_win/msvcp_win.spec index d2fae9f1e14..0e05582e251 100644 --- a/dlls/msvcp_win/msvcp_win.spec +++ b/dlls/msvcp_win/msvcp_win.spec @@ -1595,7 +1595,7 @@ @ cdecl -arch=arm ?_Reset@_ContextCallback@details@Concurrency@@AAAXXZ(ptr) msvcp140.?_Reset@_ContextCallback@details@Concurrency@@AAAXXZ @ thiscall -arch=i386 ?_Reset@_ContextCallback@details@Concurrency@@AAEXXZ(ptr) msvcp140.?_Reset@_ContextCallback@details@Concurrency@@AAEXXZ @ cdecl -arch=win64 ?_Reset@_ContextCallback@details@Concurrency@@AEAAXXZ(ptr) msvcp140.?_Reset@_ContextCallback@details@Concurrency@@AEAAXXZ -@ stub ?_Rethrow_future_exception@std@@YAXVexception_ptr@1@@Z +@ cdecl -norelay ?_Rethrow_future_exception@std@@YAXVexception_ptr@1@@Z() msvcp140.?_Rethrow_future_exception@std@@YAXVexception_ptr@1@@Z @ stub -arch=win32 ?_Rng_abort@std@@YAXPBD@Z @ stub -arch=win64 ?_Rng_abort@std@@YAXPEBD@Z @ cdecl -arch=win32 ?_Schedule_chore@details@Concurrency@@YAHPAU_Threadpool_chore@12@@Z(ptr) msvcp140.?_Schedule_chore@details@Concurrency@@YAHPAU_Threadpool_chore@12@@Z