From 0ef61844b8307c392b4fa0a25b8fcf3ecbff8326 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 15 Mar 2016 13:40:46 +0100 Subject: [PATCH] msvcrt: Add i386 _IsExceptionObjectToBeDestroyed implementation. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- .../api-ms-win-crt-private-l1-1-0.spec | 2 +- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr120_app/msvcr120_app.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/except_arm.c | 9 +++++++ dlls/msvcrt/except_i386.c | 27 +++++++++++++++++++ dlls/msvcrt/except_x86_64.c | 9 +++++++ dlls/ucrtbase/ucrtbase.spec | 2 +- dlls/vcruntime140/vcruntime140.spec | 2 +- 12 files changed, 54 insertions(+), 9 deletions(-) diff --git a/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec b/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec index b77b73e3f43..8674f44fbd8 100644 --- a/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec +++ b/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec @@ -4,7 +4,7 @@ @ stub _FindAndUnlinkFrame @ stub _GetImageBase @ stub _GetThrowImageBase -@ stub _IsExceptionObjectToBeDestroyed +@ cdecl -arch=i386,x86_64,arm _IsExceptionObjectToBeDestroyed(ptr) ucrtbase._IsExceptionObjectToBeDestroyed @ stub _NLG_Dispatch2 @ stub _NLG_Return @ stub _NLG_Return2 diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 39742aaa448..15a446f6912 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -530,7 +530,7 @@ @ cdecl _Getmonths() @ cdecl _Gettnames() @ extern _HUGE MSVCRT__HUGE -@ stub _IsExceptionObjectToBeDestroyed +@ cdecl -arch=i386,x86_64,arm _IsExceptionObjectToBeDestroyed(ptr) @ stub _NLG_Dispatch2 @ stub _NLG_Return @ stub _NLG_Return2 diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index c1ee3a28d8c..ccc659f0c0e 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -853,7 +853,7 @@ @ cdecl _Getmonths() @ cdecl _Gettnames() @ extern _HUGE MSVCRT__HUGE -@ stub _IsExceptionObjectToBeDestroyed +@ cdecl -arch=i386,x86_64,arm _IsExceptionObjectToBeDestroyed(ptr) @ stub _Lock_shared_ptr_spin_lock @ stub -arch=i386 _NLG_Dispatch2 @ stub -arch=arm,win64 __NLG_Dispatch2 diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 00efc6c0fe3..5f17e06a173 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -837,7 +837,7 @@ @ cdecl _Getmonths() @ cdecl _Gettnames() @ extern _HUGE MSVCRT__HUGE -@ stub _IsExceptionObjectToBeDestroyed +@ cdecl -arch=i386,x86_64,arm _IsExceptionObjectToBeDestroyed(ptr) @ stub _LCbuild @ stub -arch=i386 _NLG_Dispatch2 @ stub -arch=arm,win64 __NLG_Dispatch2 diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index 87bf9dc8f22..e978d20c329 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -831,7 +831,7 @@ @ cdecl _Getmonths() msvcr120._Getmonths @ cdecl _Gettnames() msvcr120._Gettnames @ extern _HUGE msvcr120._HUGE -@ stub _IsExceptionObjectToBeDestroyed +@ cdecl -arch=i386,x86_64,arm _IsExceptionObjectToBeDestroyed(ptr) msvcr120._IsExceptionObjectToBeDestroyed @ stub _LCbuild @ stub -arch=i386 _NLG_Dispatch2 @ stub -arch=arm,win64 __NLG_Dispatch2 diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 17af90b9ba6..4df2215abc7 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -162,7 +162,7 @@ @ cdecl _Getmonths() @ cdecl _Gettnames() @ extern _HUGE MSVCRT__HUGE -@ stub _IsExceptionObjectToBeDestroyed +@ cdecl -arch=i386,x86_64,arm _IsExceptionObjectToBeDestroyed(ptr) @ stub -arch=i386 _NLG_Dispatch2 @ stub -arch=arm,win64 __NLG_Dispatch2 @ stub -arch=i386 _NLG_Return diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index fd08455e8ba..4bb2adba675 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -157,7 +157,7 @@ @ cdecl _Getmonths() @ cdecl _Gettnames() @ extern _HUGE MSVCRT__HUGE -@ stub _IsExceptionObjectToBeDestroyed +@ cdecl -arch=i386,x86_64,arm _IsExceptionObjectToBeDestroyed(ptr) @ stub _NLG_Dispatch2 @ stub _NLG_Return @ stub _NLG_Return2 diff --git a/dlls/msvcrt/except_arm.c b/dlls/msvcrt/except_arm.c index 62dadef6284..2779841f630 100644 --- a/dlls/msvcrt/except_arm.c +++ b/dlls/msvcrt/except_arm.c @@ -74,6 +74,15 @@ int CDECL __CxxExceptionFilter( PEXCEPTION_POINTERS ptrs, return EXCEPTION_CONTINUE_SEARCH; } +/********************************************************************* + * _IsExceptionObjectToBeDestroyed (MSVCR80.@) + */ +BOOL __cdecl _IsExceptionObjectToBeDestroyed(const void *obj) +{ + FIXME("%p not implemented\n", obj); + return FALSE; +} + /********************************************************************* * __CxxFrameHandler (MSVCRT.@) */ diff --git a/dlls/msvcrt/except_i386.c b/dlls/msvcrt/except_i386.c index 1625854ee9e..660fb6dbc9c 100644 --- a/dlls/msvcrt/except_i386.c +++ b/dlls/msvcrt/except_i386.c @@ -415,6 +415,33 @@ static DWORD catch_function_nested_handler( EXCEPTION_RECORD *rec, EXCEPTION_REG nested_frame->trylevel ); } +/********************************************************************* + * _IsExceptionObjectToBeDestroyed (MSVCR80.@) + */ +BOOL __cdecl _IsExceptionObjectToBeDestroyed(const void *obj) +{ + EXCEPTION_REGISTRATION_RECORD *reg = NtCurrentTeb()->Tib.ExceptionList; + + TRACE( "%p\n", obj ); + + while (reg != (EXCEPTION_REGISTRATION_RECORD*)-1) + { + if (reg->Handler == catch_function_nested_handler) + { + EXCEPTION_RECORD *rec = ((struct catch_func_nested_frame*)reg)->rec; + + if(!(rec->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND)) + && rec->ExceptionCode == CXX_EXCEPTION && rec->NumberParameters == 3 + && rec->ExceptionInformation[1] == (LONG_PTR)obj) + return FALSE; + } + + reg = reg->Prev; + } + + return TRUE; +} + /* find and call the appropriate catch block for an exception */ /* returns the address to continue execution to after the catch block was called */ static inline void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame *frame, diff --git a/dlls/msvcrt/except_x86_64.c b/dlls/msvcrt/except_x86_64.c index 27d0a15d889..8f0301dc570 100644 --- a/dlls/msvcrt/except_x86_64.c +++ b/dlls/msvcrt/except_x86_64.c @@ -71,6 +71,15 @@ int CDECL __CxxExceptionFilter( PEXCEPTION_POINTERS ptrs, return EXCEPTION_CONTINUE_SEARCH; } +/********************************************************************* + * _IsExceptionObjectToBeDestroyed (MSVCR80.@) + */ +BOOL __cdecl _IsExceptionObjectToBeDestroyed(const void *obj) +{ + FIXME ( "%p not implemented\n", obj ); + return FALSE; +} + /********************************************************************* * __CxxFrameHandler (MSVCRT.@) */ diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index 15f3781c2aa..16540a55890 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -30,7 +30,7 @@ @ cdecl _Getdays() @ cdecl _Getmonths() @ cdecl _Gettnames() -@ stub _IsExceptionObjectToBeDestroyed +@ cdecl -arch=i386,x86_64,arm _IsExceptionObjectToBeDestroyed(ptr) @ stub _LCbuild @ stub _LCmulcc @ stub _LCmulcr diff --git a/dlls/vcruntime140/vcruntime140.spec b/dlls/vcruntime140/vcruntime140.spec index feb94acf3c9..c518b152afd 100644 --- a/dlls/vcruntime140/vcruntime140.spec +++ b/dlls/vcruntime140/vcruntime140.spec @@ -2,7 +2,7 @@ @ stdcall _CxxThrowException(long long) ucrtbase._CxxThrowException @ cdecl -arch=i386 -norelay _EH_prolog() ucrtbase._EH_prolog @ stub _FindAndUnlinkFrame -@ stub _IsExceptionObjectToBeDestroyed +@ cdecl -arch=i386,x86_64,arm _IsExceptionObjectToBeDestroyed(ptr) ucrtbase._IsExceptionObjectToBeDestroyed @ stub _NLG_Dispatch2 @ stub _NLG_Return @ stub _NLG_Return2