Piotr Caban : msvcrt: Fix i386 rethrown exceptions handling.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Apr 7 11:42:52 CDT 2016


Module: wine
Branch: master
Commit: ee5e06591f2045316775fedaf735cbdce5b71ce0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ee5e06591f2045316775fedaf735cbdce5b71ce0

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Apr  7 15:36:32 2016 +0200

msvcrt: Fix i386 rethrown exceptions handling.

When __CxxRegisterExceptionObject was used and there was no
catch_function_nested_handler frame to rewind
nested_frame.frame_info.rec was incorrectly set to current exception.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/except_i386.c | 4 +++-
 dlls/msvcrt/msvcrt.h      | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/msvcrt/except_i386.c b/dlls/msvcrt/except_i386.c
index dd807c4..f7f486d 100644
--- a/dlls/msvcrt/except_i386.c
+++ b/dlls/msvcrt/except_i386.c
@@ -447,7 +447,9 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame
                 TRACE("found catch(...) block\n");
             }
 
-            __CxxRegisterExceptionObject(&rec, &nested_frame.frame_info);
+            /* Add frame info here so exception is not freed inside RtlUnwind call */
+            _CreateFrameInfo(&nested_frame.frame_info.frame_info,
+                    (void*)rec->ExceptionInformation[1]);
 
             /* unwind the stack */
             RtlUnwind( catch_frame ? catch_frame : &frame->frame, 0, rec, 0 );
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index b564dc1..5c26866 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -217,6 +217,7 @@ typedef struct
     void *unk;
 } cxx_frame_info;
 
+frame_info* __cdecl _CreateFrameInfo(frame_info *fi, void *obj);
 BOOL __cdecl __CxxRegisterExceptionObject(EXCEPTION_RECORD**, cxx_frame_info*);
 void __cdecl __CxxUnregisterExceptionObject(cxx_frame_info*, BOOL);
 void CDECL __DestructExceptionObject(EXCEPTION_RECORD*);




More information about the wine-cvs mailing list