[PATCH] msvcrt: save esp before calling catch block and restore afterwards

Peter Beutner p.beutner at gmx.net
Fri Feb 17 04:57:32 CST 2006


It seems like the esp value (which is saved at [ebp-16]) is sometimes changed
inside the catch handler so we end up with a bogus esp afterwards.
To avoid that save it before calling the catch block.

fixes bug #4482

---

 dlls/msvcrt/cppexcept.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

8ffbe178672e75a6c8152c8fd02a01541e72cb60
diff --git a/dlls/msvcrt/cppexcept.c b/dlls/msvcrt/cppexcept.c
index 66c6aa7..6087996 100644
--- a/dlls/msvcrt/cppexcept.c
+++ b/dlls/msvcrt/cppexcept.c
@@ -285,6 +285,7 @@ inline static void call_catch_block( PEX
     struct catch_func_nested_frame nested_frame;
     int trylevel = frame->trylevel;
     thread_data_t *thread_data = msvcrt_get_thread_data();
+    DWORD save_esp = ((DWORD*)frame)[-1];
 
     for (i = 0; i < descr->tryblock_count; i++)
     {
@@ -339,6 +340,7 @@ inline static void call_catch_block( PEX
             thread_data->exc_record = nested_frame.prev_rec;
             __wine_pop_frame( &nested_frame.frame );
 
+            ((DWORD*)frame)[-1] = save_esp;
             if (info && info->destructor) call_dtor( info->destructor, object );
             TRACE( "done, continuing at %p\n", addr );
 
-- 
1.2.0




More information about the wine-patches mailing list