Piotr Caban : msvcr90: Don't forward exception constructors to msvcrt.

Alexandre Julliard julliard at winehq.org
Fri Sep 27 11:33:13 CDT 2013


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Fri Sep 27 12:00:44 2013 +0200

msvcr90: Don't forward exception constructors to msvcrt.

---

 dlls/msvcr90/msvcr90.c    |   81 +++++++++++++++++++++++++++++++++++++++++++++
 dlls/msvcr90/msvcr90.spec |   16 ++++----
 2 files changed, 89 insertions(+), 8 deletions(-)

diff --git a/dlls/msvcr90/msvcr90.c b/dlls/msvcr90/msvcr90.c
index 4787867..7640738 100644
--- a/dlls/msvcr90/msvcr90.c
+++ b/dlls/msvcr90/msvcr90.c
@@ -18,17 +18,58 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include <config.h>
+
 #include <stdarg.h>
 
 #include "stdio.h"
 #include "windef.h"
 #include "winbase.h"
 
+#ifdef __i386__
+
+#define THISCALL(func) __thiscall_ ## func
+#define __thiscall __stdcall
+#define DEFINE_THISCALL_WRAPPER(func,args) \
+    extern void THISCALL(func)(void); \
+    __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
+            "popl %eax\n\t" \
+            "pushl %ecx\n\t" \
+            "pushl %eax\n\t" \
+            "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
+
+extern void *call_thiscall_func;
+__ASM_GLOBAL_FUNC(call_thiscall_func,
+        "popl %eax\n\t"
+        "popl %edx\n\t"
+        "popl %ecx\n\t"
+        "pushl %eax\n\t"
+        "jmp *%edx\n\t")
+
+#define call_func1(func,this) ((void* (WINAPI*)(void*,void*))&call_thiscall_func)(func,this)
+#define call_func2(func,this,a) ((void* (WINAPI*)(void*,void*,const void*))&call_thiscall_func)(func,this,(const void*)(a))
+#define call_func3(func,this,a,b) ((void* (WINAPI*)(void*,void*,const void*,const void*))&call_thiscall_func)(func,this,(const void*)(a),(const void*)(b))
+
+#else /* __i386__ */
+
+#define __thiscall __cdecl
+#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
+
+#define call_func1(func,this) func(this)
+#define call_func2(func,this,a) func(this,a)
+#define call_func3(func,this,a,b) func(this,a,b)
+
+#endif /* __i386__ */
+
 typedef void (__cdecl *MSVCRT__se_translator_function)(unsigned int code, struct _EXCEPTION_POINTERS *info);
 
 static void* (__cdecl *MSVCRT_operator_new)(size_t);
 static void (__cdecl *MSVCRT_operator_delete)(void*);
 static MSVCRT__se_translator_function (__cdecl *MSVCRT__set_se_translator)(MSVCRT__se_translator_function);
+static void* (__thiscall *MSVCRT_exception_ctor)(void*, const char**);
+static void* (__thiscall *MSVCRT_exception_ctor_noalloc)(void*, char**, int);
+static void* (__thiscall *MSVCRT_exception_copy_ctor)(void*, const void*);
+static void (__thiscall *MSVCRT_exception_dtor)(void*);
 
 static void init_cxx_funcs(void)
 {
@@ -40,6 +81,10 @@ static void init_cxx_funcs(void)
         MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3 at YAXPEAX@Z");
         MSVCRT__set_se_translator = (void*)GetProcAddress(hmod,
                 "?_set_se_translator@@YAP6AXIPEAU_EXCEPTION_POINTERS@@@ZP6AXI0 at Z@Z");
+        MSVCRT_exception_ctor = (void*)GetProcAddress(hmod, "??0exception@@QEAA at AEBQEBD@Z");
+        MSVCRT_exception_ctor_noalloc = (void*)GetProcAddress(hmod, "??0exception@@QEAA at AEBQEBDH@Z");
+        MSVCRT_exception_copy_ctor = (void*)GetProcAddress(hmod, "??0exception@@QEAA at AEBV0@@Z");
+        MSVCRT_exception_dtor = (void*)GetProcAddress(hmod, "??1exception@@UEAA at XZ");
     }
     else
     {
@@ -47,6 +92,10 @@ static void init_cxx_funcs(void)
         MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3 at YAXPAX@Z");
         MSVCRT__set_se_translator = (void*)GetProcAddress(hmod,
                 "?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0 at Z@Z");
+        MSVCRT_exception_ctor = (void*)GetProcAddress(hmod, "??0exception@@QAE at ABQBD@Z");
+        MSVCRT_exception_ctor_noalloc = (void*)GetProcAddress(hmod, "??0exception@@QAE at ABQBDH@Z");
+        MSVCRT_exception_copy_ctor = (void*)GetProcAddress(hmod, "??0exception@@QAE at ABV0@@Z");
+        MSVCRT_exception_dtor = (void*)GetProcAddress(hmod, "??1exception@@UAE at XZ");
     }
 }
 
@@ -116,3 +165,35 @@ MSVCRT__se_translator_function CDECL MSVCR90__set_se_translator(MSVCRT__se_trans
 {
     return MSVCRT__set_se_translator(func);
 }
+
+/* ??0exception at std@@QAE at ABQBD@Z */
+/* ??0exception at std@@QEAA at AEBQEBD@Z */
+DEFINE_THISCALL_WRAPPER(exception_ctor, 8)
+void* __thiscall exception_ctor(void *this, const char **name)
+{
+    return call_func2(MSVCRT_exception_ctor, this, name);
+}
+
+/* ??0exception at std@@QAE at ABQBDH@Z */
+/* ??0exception at std@@QEAA at AEBQEBDH@Z */
+DEFINE_THISCALL_WRAPPER(exception_ctor_noalloc, 12)
+void* __thiscall exception_ctor_noalloc(void *this, char **name, int noalloc)
+{
+    return call_func3(MSVCRT_exception_ctor_noalloc, this, name, noalloc);
+}
+
+/* ??0exception at std@@QAE at ABV01@@Z */
+/* ??0exception at std@@QEAA at AEBV01@@Z */
+DEFINE_THISCALL_WRAPPER(exception_copy_ctor, 8)
+void* __thiscall exception_copy_ctor(void *this, const void *rhs)
+{
+    return call_func2(MSVCRT_exception_copy_ctor, this, rhs);
+}
+
+/* ??1exception at std@@UAE at XZ */
+/* ??1exception at std@@UEAA at XZ */
+DEFINE_THISCALL_WRAPPER(exception_dtor, 4)
+void __thiscall exception_dtor(void *this)
+{
+    call_func1(MSVCRT_exception_dtor, this);
+}
diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec
index 3632599..36cf2e4 100644
--- a/dlls/msvcr90/msvcr90.spec
+++ b/dlls/msvcr90/msvcr90.spec
@@ -12,12 +12,12 @@
 @ cdecl -arch=win64 ??0bad_typeid at std@@QEAA at AEBV01@@Z(ptr ptr) msvcrt.??0bad_typeid@@QEAA at AEBV0@@Z
 @ thiscall -arch=i386 ??0bad_typeid at std@@QAE at PBD@Z(ptr str) msvcrt.??0bad_typeid@@QAE at PBD@Z
 @ cdecl -arch=win64 ??0bad_typeid at std@@QEAA at PEBD@Z(ptr str) msvcrt.??0bad_typeid@@QEAA at PEBD@Z
-@ thiscall -arch=i386 ??0exception at std@@QAE at ABQBD@Z(ptr ptr) msvcrt.??0exception@@QAE at ABQBD@Z
-@ cdecl -arch=win64 ??0exception at std@@QEAA at AEBQEBD@Z(ptr ptr) msvcrt.??0exception@@QEAA at AEBQEBD@Z
-@ thiscall -arch=i386 ??0exception at std@@QAE at ABQBDH@Z(ptr ptr long) msvcrt.??0exception@@QAE at ABQBDH@Z
-@ cdecl -arch=win64 ??0exception at std@@QEAA at AEBQEBDH@Z(ptr ptr long) msvcrt.??0exception@@QEAA at AEBQEBDH@Z
-@ thiscall -arch=i386 ??0exception at std@@QAE at ABV01@@Z(ptr ptr) msvcrt.??0exception@@QAE at ABV0@@Z
-@ cdecl -arch=win64 ??0exception at std@@QEAA at AEBV01@@Z(ptr ptr) msvcrt.??0exception@@QEAA at AEBV0@@Z
+@ thiscall -arch=i386 ??0exception at std@@QAE at ABQBD@Z(ptr ptr) exception_ctor
+@ cdecl -arch=win64 ??0exception at std@@QEAA at AEBQEBD@Z(ptr ptr) exception_ctor
+@ thiscall -arch=i386 ??0exception at std@@QAE at ABQBDH@Z(ptr ptr long) exception_ctor_noalloc
+@ cdecl -arch=win64 ??0exception at std@@QEAA at AEBQEBDH@Z(ptr ptr long) exception_ctor_noalloc
+@ thiscall -arch=i386 ??0exception at std@@QAE at ABV01@@Z(ptr ptr) exception_copy_ctor
+@ cdecl -arch=win64 ??0exception at std@@QEAA at AEBV01@@Z(ptr ptr) exception_copy_ctor
 @ thiscall -arch=i386 ??0exception at std@@QAE at XZ(ptr) msvcrt.??0exception@@QAE at XZ
 @ cdecl -arch=win64 ??0exception at std@@QEAA at XZ(ptr) msvcrt.??0exception@@QEAA at XZ
 @ thiscall -arch=i386 ??1__non_rtti_object at std@@UAE at XZ(ptr) msvcrt.??1__non_rtti_object@@UAE at XZ
@@ -26,8 +26,8 @@
 @ cdecl -arch=win64 ??1bad_cast at std@@UEAA at XZ(ptr) msvcrt.??1bad_cast@@UEAA at XZ
 @ thiscall -arch=i386 ??1bad_typeid at std@@UAE at XZ(ptr) msvcrt.??1bad_typeid@@UAE at XZ
 @ cdecl -arch=win64 ??1bad_typeid at std@@UEAA at XZ(ptr) msvcrt.??1bad_typeid@@UEAA at XZ
-@ thiscall -arch=i386 ??1exception at std@@UAE at XZ(ptr) msvcrt.??1exception@@UAE at XZ
-@ cdecl -arch=win64 ??1exception at std@@UEAA at XZ(ptr) msvcrt.??1exception@@UEAA at XZ
+@ thiscall -arch=i386 ??1exception at std@@UAE at XZ(ptr) exception_dtor
+@ cdecl -arch=win64 ??1exception at std@@UEAA at XZ(ptr) exception_dtor
 @ cdecl -arch=arm ??1type_info@@UAA at XZ(ptr) msvcrt.??1type_info@@UAA at XZ
 @ thiscall -arch=i386 ??1type_info@@UAE at XZ(ptr) msvcrt.??1type_info@@UAE at XZ
 @ cdecl -arch=win64 ??1type_info@@UEAA at XZ(ptr) msvcrt.??1type_info@@UEAA at XZ




More information about the wine-cvs mailing list