[PATCH] msvcrtd: Allow new to allocated a _CRT_BLOCK block

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Tue Apr 3 19:26:19 CDT 2018


Fixes: https://bugs.winehq.org/show_bug.cgi?id=44001

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/msvcrtd/debug.c       | 2 +-
 dlls/msvcrtd/tests/debug.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/msvcrtd/debug.c b/dlls/msvcrtd/debug.c
index b8496526ae..6bfa730ece 100644
--- a/dlls/msvcrtd/debug.c
+++ b/dlls/msvcrtd/debug.c
@@ -52,6 +52,7 @@ void * CDECL MSVCRTD_operator_new_dbg(MSVCRT_size_t nSize, int nBlockUse,
     switch(_BLOCK_TYPE(nBlockUse))
     {
     case _NORMAL_BLOCK:
+    case _CRT_BLOCK:
         break;
     case _CLIENT_BLOCK:
         FIXME("Unimplemented case for nBlockUse = _CLIENT_BLOCK\n");
@@ -59,7 +60,6 @@ void * CDECL MSVCRTD_operator_new_dbg(MSVCRT_size_t nSize, int nBlockUse,
     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;
diff --git a/dlls/msvcrtd/tests/debug.c b/dlls/msvcrtd/tests/debug.c
index 9055db1382..d234f02f6d 100644
--- a/dlls/msvcrtd/tests/debug.c
+++ b/dlls/msvcrtd/tests/debug.c
@@ -65,6 +65,10 @@ 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);
+
+  mem = pMSVCRTD_operator_new_dbg(42, _CRT_BLOCK, __FILE__, __LINE__);
+  ok(mem != NULL, "memory not allocated\n");
+  HeapFree(GetProcessHeap(), 0, mem);
 }
 
 /**********************************************************************/
-- 
2.16.3




More information about the wine-devel mailing list