Alistair Leslie-Hughes : msvcrtd: Forward operator_new_dbg to msvcrt.

Alexandre Julliard julliard at winehq.org
Tue Apr 10 17:24:29 CDT 2018


Module: wine
Branch: master
Commit: 6c42e742b3decb38733f0b42b7c072ac377a242b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6c42e742b3decb38733f0b42b7c072ac377a242b

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Tue Apr 10 02:19:13 2018 +0000

msvcrtd: Forward operator_new_dbg to msvcrt.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrtd/debug.c       | 39 ---------------------------------------
 dlls/msvcrtd/msvcrtd.spec  |  4 ++--
 dlls/msvcrtd/tests/debug.c | 13 ++++++++++++-
 3 files changed, 14 insertions(+), 42 deletions(-)

diff --git a/dlls/msvcrtd/debug.c b/dlls/msvcrtd/debug.c
index b849652..df7a892 100644
--- a/dlls/msvcrtd/debug.c
+++ b/dlls/msvcrtd/debug.c
@@ -25,8 +25,6 @@
 #define  _DEBUG
 #include "crtdbg.h"
 
-WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
-
 int _crtAssertBusy = -1;
 int _crtBreakAlloc = -1;
 int _crtDbgFlag = 0;
@@ -40,43 +38,6 @@ typedef unsigned long MSVCRT_size_t;
 extern int _callnewh(MSVCRT_size_t);
 
 /*********************************************************************
- *		??2 at YAPAXIHPBDH@Z (MSVCRTD.@)
- */
-void * CDECL MSVCRTD_operator_new_dbg(MSVCRT_size_t nSize, int nBlockUse,
-                                      const char *szFileName, int nLine)
-{
-    void *retval = NULL;
-
-    TRACE("(%lu, %d, '%s', %d)\n", nSize, nBlockUse, szFileName, nLine);
-
-    switch(_BLOCK_TYPE(nBlockUse))
-    {
-    case _NORMAL_BLOCK:
-        break;
-    case _CLIENT_BLOCK:
-        FIXME("Unimplemented case for nBlockUse = _CLIENT_BLOCK\n");
-        return NULL;
-    case _FREE_BLOCK:
-        FIXME("Native code throws an exception here\n");
-        return NULL;
-    case _CRT_BLOCK:
-    case _IGNORE_BLOCK:
-        ERR("Not allowed nBlockUse value: %d\n", _BLOCK_TYPE(nBlockUse));
-        return NULL;
-    default:
-        ERR("Unknown nBlockUse value: %d\n", _BLOCK_TYPE(nBlockUse));
-        return NULL;
-    }
-
-    retval = HeapAlloc(GetProcessHeap(), 0, nSize);
-
-    if (!retval)
-        _callnewh(nSize);
-
-    return retval;
-}
-
-/*********************************************************************
  *		_CrtSetDumpClient (MSVCRTD.@)
  */
 void * CDECL _CrtSetDumpClient(void *dumpClient)
diff --git a/dlls/msvcrtd/msvcrtd.spec b/dlls/msvcrtd/msvcrtd.spec
index 15066c3..33c6e99 100644
--- a/dlls/msvcrtd/msvcrtd.spec
+++ b/dlls/msvcrtd/msvcrtd.spec
@@ -31,8 +31,8 @@
 @ cdecl -arch=win64 ??1type_info@@UEAA at XZ(ptr) msvcrt.??1type_info@@UEAA at XZ
 @ cdecl -arch=win32 ??2 at YAPAXI@Z(long) msvcrt.??2 at YAPAXI@Z
 @ cdecl -arch=win64 ??2 at YAPEAX_K@Z(long) msvcrt.??2 at YAPEAX_K@Z
-@ cdecl -arch=win32 ??2 at YAPAXIHPBDH@Z(long long str long) MSVCRTD_operator_new_dbg
-@ cdecl -arch=win64 ??2 at YAPEAX_KHPEBDH@Z(long long str long) MSVCRTD_operator_new_dbg
+@ cdecl -arch=win32 ??2 at YAPAXIHPBDH@Z(long long str long) msvcrt.??2 at YAPAXIHPBDH@Z
+@ cdecl -arch=win64 ??2 at YAPEAX_KHPEBDH@Z(long long str long) msvcrt.??2 at YAPEAX_KHPEBDH@Z
 @ cdecl -arch=win32 ??3 at YAXPAX@Z(ptr) msvcrt.??3 at YAXPAX@Z
 @ cdecl -arch=win64 ??3 at YAXPEAX@Z(ptr) msvcrt.??3 at YAXPEAX@Z
 @ thiscall -arch=i386 ??4__non_rtti_object@@QAEAAV0 at ABV0@@Z(ptr ptr) msvcrt.??4__non_rtti_object@@QAEAAV0 at ABV0@@Z
diff --git a/dlls/msvcrtd/tests/debug.c b/dlls/msvcrtd/tests/debug.c
index 9055db1..4af4c81 100644
--- a/dlls/msvcrtd/tests/debug.c
+++ b/dlls/msvcrtd/tests/debug.c
@@ -31,6 +31,7 @@
 /**********************************************************************/
 
 static void * (__cdecl *pMSVCRTD_operator_new_dbg)(size_t, int, const char *, int) = NULL;
+static void * (__cdecl *pMSVCRTD_operator_delete)(void *) = NULL;
 
 /* Some exports are only available in later versions */
 #define SETNOFAIL(x,y) x = (void*)GetProcAddress(hModule,y)
@@ -46,9 +47,15 @@ static BOOL init_functions(void)
   }
 
   if (sizeof(void *) > sizeof(int))  /* 64-bit has a different mangled name */
+  {
       SET(pMSVCRTD_operator_new_dbg, "??2 at YAPEAX_KHPEBDH@Z");
+      SET(pMSVCRTD_operator_delete, "??3 at YAXPEAX@Z");
+  }
   else
+  {
       SET(pMSVCRTD_operator_new_dbg, "??2 at YAPAXIHPBDH@Z");
+      SET(pMSVCRTD_operator_delete, "??3 at YAXPAX@Z");
+  }
 
   if (pMSVCRTD_operator_new_dbg == NULL)
     return FALSE;
@@ -64,7 +71,11 @@ static void test_new(void)
 
   mem = pMSVCRTD_operator_new_dbg(42, _NORMAL_BLOCK, __FILE__, __LINE__);
   ok(mem != NULL, "memory not allocated\n");
-  HeapFree(GetProcessHeap(), 0, mem);
+  pMSVCRTD_operator_delete(mem);
+
+  mem = pMSVCRTD_operator_new_dbg(42, _CRT_BLOCK, __FILE__, __LINE__);
+  ok(mem != NULL, "memory not allocated\n");
+  pMSVCRTD_operator_delete(mem);
 }
 
 /**********************************************************************/




More information about the wine-cvs mailing list