Commit c086a7eb authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

msvcirt: Use proper operator_new and operator_delete types.

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: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com>
parent 816c35e0
...@@ -38,9 +38,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcirt); ...@@ -38,9 +38,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcirt);
#define RESERVE_SIZE 512 #define RESERVE_SIZE 512
#define STATEBUF_SIZE 8 #define STATEBUF_SIZE 8
void* (__cdecl *operator_new)(SIZE_T);
void (__cdecl *operator_delete)(void*);
/* ?sh_none@filebuf@@2HB */ /* ?sh_none@filebuf@@2HB */
const int filebuf_sh_none = 0x800; const int filebuf_sh_none = 0x800;
/* ?sh_read@filebuf@@2HB */ /* ?sh_read@filebuf@@2HB */
...@@ -5132,19 +5129,32 @@ void __cdecl _mtunlock(CRITICAL_SECTION *crit) ...@@ -5132,19 +5129,32 @@ void __cdecl _mtunlock(CRITICAL_SECTION *crit)
LeaveCriticalSection(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) static void init_cxx_funcs(void)
{ {
HMODULE hmod = GetModuleHandleA("msvcrt.dll"); HMODULE hmod = GetModuleHandleA("msvcrt.dll");
if (sizeof(void *) > sizeof(int)) /* 64-bit has different names */ if (sizeof(void *) > sizeof(int)) /* 64-bit has different names */
{ {
operator_new = (void*)GetProcAddress(hmod, "??2@YAPEAX_K@Z"); MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPEAX_K@Z");
operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPEAX@Z"); MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPEAX@Z");
} }
else else
{ {
operator_new = (void*)GetProcAddress(hmod, "??2@YAPAXI@Z"); MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPAXI@Z");
operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPAX@Z"); MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPAX@Z");
} }
} }
......
...@@ -68,7 +68,7 @@ typedef enum { ...@@ -68,7 +68,7 @@ typedef enum {
FLAGS_stdio = 0x4000 FLAGS_stdio = 0x4000
} ios_flags; } ios_flags;
extern void* (__cdecl *MSVCRT_operator_new)(SIZE_T); void* __cdecl operator_new(SIZE_T);
extern void (__cdecl *MSVCRT_operator_delete)(void*); void __cdecl operator_delete(void*);
void init_exception(void*); void init_exception(void*);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment