-- v3: msvcirt: Use proper operator_new and operator_delete types.
From: Gabriel Ivăncescu gabrielopcode@gmail.com
msvcirt's PARENTSRC imports exception.c from msvcp90, but it uses a function pointer for these functions, resulting in a type mismatch.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/msvcirt/msvcirt.c | 24 +++++++++++++++++------- dlls/msvcirt/msvcirt.h | 4 ++-- 2 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c index 8d83fca7c94..0fcdc52c203 100644 --- a/dlls/msvcirt/msvcirt.c +++ b/dlls/msvcirt/msvcirt.c @@ -38,9 +38,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcirt); #define RESERVE_SIZE 512 #define STATEBUF_SIZE 8
-void* (__cdecl *operator_new)(SIZE_T); -void (__cdecl *operator_delete)(void*); - /* ?sh_none@filebuf@@2HB */ const int filebuf_sh_none = 0x800; /* ?sh_read@filebuf@@2HB */ @@ -5132,19 +5129,32 @@ void __cdecl _mtunlock(CRITICAL_SECTION *crit) LeaveCriticalSection(crit); }
+static void* (__cdecl *MSVCRT_operator_new)(SIZE_T); +static void (__cdecl *MSVCRT_operator_delete)(void*); + +void* __cdecl operator_new(SIZE_T size) +{ + return MSVCRT_operator_new(size); +} + +void __cdecl operator_delete(void *mem) +{ + MSVCRT_operator_delete(mem); +} + static void init_cxx_funcs(void) { HMODULE hmod = GetModuleHandleA("msvcrt.dll");
if (sizeof(void *) > sizeof(int)) /* 64-bit has different names */ { - operator_new = (void*)GetProcAddress(hmod, "??2@YAPEAX_K@Z"); - operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPEAX@Z"); + MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPEAX_K@Z"); + MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPEAX@Z"); } else { - operator_new = (void*)GetProcAddress(hmod, "??2@YAPAXI@Z"); - operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPAX@Z"); + MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPAXI@Z"); + MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPAX@Z"); } }
diff --git a/dlls/msvcirt/msvcirt.h b/dlls/msvcirt/msvcirt.h index 5b59b7862a3..ccbc7027146 100644 --- a/dlls/msvcirt/msvcirt.h +++ b/dlls/msvcirt/msvcirt.h @@ -68,7 +68,7 @@ typedef enum { FLAGS_stdio = 0x4000 } ios_flags;
-extern void* (__cdecl *MSVCRT_operator_new)(SIZE_T); -extern void (__cdecl *MSVCRT_operator_delete)(void*); +void* __cdecl operator_new(SIZE_T); +void __cdecl operator_delete(void*);
void init_exception(void*);
This merge request was approved by Piotr Caban.