msvcp90: Added set_new_handler implementation.

This commit is contained in:
Piotr Caban 2011-09-13 10:30:29 +02:00 committed by Alexandre Julliard
parent 45dc6c0e22
commit 870d35c688
4 changed files with 35 additions and 2 deletions

View file

@ -25,6 +25,8 @@
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcp90);
/* ??0_Mutex@std@@QAE@XZ */
/* ??0_Mutex@std@@QEAA@XZ */
@ -191,3 +193,29 @@ unsigned short __cdecl wctype(const char *property)
return 0;
}
typedef void (__cdecl *MSVCP_new_handler_func)(void);
static MSVCP_new_handler_func MSVCP_new_handler;
static int __cdecl new_handler_wrapper(MSVCP_size_t unused)
{
MSVCP_new_handler();
return 1;
}
/* ?set_new_handler@std@@YAP6AXXZP6AXXZ@Z */
MSVCP_new_handler_func __cdecl set_new_handler(MSVCP_new_handler_func new_handler)
{
MSVCP_new_handler_func old_handler = MSVCP_new_handler;
TRACE("%p\n", new_handler);
MSVCP_new_handler = new_handler;
MSVCRT_set_new_handler(new_handler ? new_handler_wrapper : NULL);
return old_handler;
}
/* ?set_new_handler@std@@YAP6AXXZH@Z */
MSVCP_new_handler_func __cdecl set_new_handler_reset(int unused)
{
return set_new_handler(NULL);
}

View file

@ -29,6 +29,7 @@ void __cdecl _invalid_parameter(const wchar_t*, const wchar_t*,
extern void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
extern void (__cdecl *MSVCRT_operator_delete)(void*);
extern void* (__cdecl *MSVCRT_set_new_handler)(void*);
/* Copied from dlls/msvcrt/cpp.c */
#ifdef __i386__ /* thiscall functions are i386-specific */

View file

@ -5310,8 +5310,8 @@
@ stub -arch=win64 ?seekpos@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAA?AV?$fpos@H@2@V32@H@Z
@ stub -arch=win32 ?seekpos@strstreambuf@std@@MAE?AV?$fpos@H@2@V32@H@Z
@ stub -arch=win64 ?seekpos@strstreambuf@std@@MEAA?AV?$fpos@H@2@V32@H@Z
@ stub ?set_new_handler@std@@YAP6AXXZH@Z
@ stub ?set_new_handler@std@@YAP6AXXZP6AXXZ@Z
@ cdecl ?set_new_handler@std@@YAP6AXXZH@Z(long) set_new_handler_reset
@ cdecl ?set_new_handler@std@@YAP6AXXZP6AXXZ@Z(ptr) set_new_handler
@ stub ?setbase@std@@YA?AU?$_Smanip@H@1@H@Z
@ stub -arch=win32 ?setbuf@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PADH@Z
@ stub -arch=win64 ?setbuf@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PEAD_J@Z

View file

@ -30,6 +30,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcp90);
void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
void (__cdecl *MSVCRT_operator_delete)(void*);
void* (__cdecl *MSVCRT_set_new_handler)(void*);
static void init_cxx_funcs(void)
{
HMODULE hmod = GetModuleHandleA("msvcrt.dll");
@ -38,11 +40,13 @@ static void init_cxx_funcs(void)
{
MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPEAX_K@Z");
MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPEAX@Z");
MSVCRT_set_new_handler = (void*)GetProcAddress(hmod, "?_set_new_handler@@YAP6AH_K@ZP6AH0@Z@Z");
}
else
{
MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPAXI@Z");
MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPAX@Z");
MSVCRT_set_new_handler = (void*)GetProcAddress(hmod, "?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z");
}
}