Alexandre Julliard : msvcp: Don't assume that msvcrt is imported.

Alexandre Julliard julliard at winehq.org
Fri Dec 27 13:31:09 CST 2013


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Dec 26 23:43:03 2013 +0100

msvcp: Don't assume that msvcrt is imported.

---

 dlls/msvcp90/locale.c     |    5 ++++-
 dlls/msvcp90/msvcp_main.c |    7 ++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c
index 9b84b63..f9d8e1b 100644
--- a/dlls/msvcp90/locale.c
+++ b/dlls/msvcp90/locale.c
@@ -1410,8 +1410,11 @@ void __thiscall ctype_char__Tidy(ctype_char *this)
 /* ?classic_table@?$ctype at D@std@@KAPEBFXZ */
 const short* __cdecl ctype_char_classic_table(void)
 {
+    ctype_char *ctype;
+
     TRACE("()\n");
-    return &((short*)GetProcAddress(GetModuleHandleA("msvcrt.dll"), "_ctype"))[1];
+    ctype = ctype_char_use_facet( locale_classic() );
+    return ctype->ctype.table;
 }
 
 /* ??0?$ctype at D@std@@QAE at ABV_Locinfo@1 at I@Z */
diff --git a/dlls/msvcp90/msvcp_main.c b/dlls/msvcp90/msvcp_main.c
index 848d5bb..489aacb 100644
--- a/dlls/msvcp90/msvcp_main.c
+++ b/dlls/msvcp90/msvcp_main.c
@@ -60,9 +60,14 @@ void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
 void (__cdecl *MSVCRT_operator_delete)(void*);
 void* (__cdecl *MSVCRT_set_new_handler)(void*);
 
+#define VERSION_STRING(ver) #ver
+#define MSVCRT_NAME(ver) "msvcr" VERSION_STRING(ver) ".dll"
+
 static void init_cxx_funcs(void)
 {
-    HMODULE hmod = GetModuleHandleA("msvcrt.dll");
+    HMODULE hmod = GetModuleHandleA( MSVCRT_NAME(_MSVCP_VER) );
+
+    if (!hmod) FIXME( "%s not loaded\n", MSVCRT_NAME(_MSVCP_VER) );
 
     if (sizeof(void *) > sizeof(int))  /* 64-bit has different names */
     {




More information about the wine-cvs mailing list