Module: wine Branch: master Commit: 898e17f2af8e447981ee041b446a2e854522e806 URL: http://source.winehq.org/git/wine.git/?a=commit;h=898e17f2af8e447981ee041b44...
Author: Piotr Caban piotr@codeweavers.com Date: Wed Aug 25 14:46:47 2010 +0200
msvcrt: Added _set_purecall_handler implementation.
---
dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr71/msvcr71.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/exit.c | 13 +++++++++++++ dlls/msvcrt/msvcrt.h | 1 + dlls/msvcrt/msvcrt.spec | 1 + 7 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 1cd1ada..771b2e0 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1078,7 +1078,7 @@ @ stub _set_malloc_crt_max_wait @ stub _set_output_format @ stub _set_printf_count_output -@ stub _set_purecall_handler +@ cdecl _set_purecall_handler(ptr) msvcrt._set_purecall_handler @ cdecl _seterrormode(long) msvcrt._seterrormode @ cdecl -arch=i386,x86_64 -norelay _setjmp(ptr) msvcrt._setjmp @ cdecl -arch=i386 -norelay _setjmp3(ptr long) msvcrt._setjmp3 diff --git a/dlls/msvcr71/msvcr71.spec b/dlls/msvcr71/msvcr71.spec index d3da10e..2483d6b 100644 --- a/dlls/msvcr71/msvcr71.spec +++ b/dlls/msvcr71/msvcr71.spec @@ -510,7 +510,7 @@ @ stdcall -i386 _seh_longjmp_unwind(ptr) msvcrt._seh_longjmp_unwind @ cdecl _set_SSE2_enable(long) msvcrt._set_SSE2_enable @ cdecl _set_error_mode(long) msvcrt._set_error_mode -@ stub _set_purecall_handler +@ cdecl _set_purecall_handler(ptr) msvcrt._set_purecall_handler @ cdecl _set_sbh_threshold(long) msvcrt._set_sbh_threshold @ stub _set_security_error_handler @ cdecl _seterrormode(long) msvcrt._seterrormode diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 93c8047..02ba355 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -931,7 +931,7 @@ @ stub _set_malloc_crt_max_wait @ stub _set_output_format @ stub _set_printf_count_output -@ stub _set_purecall_handler +@ cdecl _set_purecall_handler(ptr) msvcrt._set_purecall_handler @ cdecl _set_sbh_threshold(long) msvcrt._set_sbh_threshold @ cdecl _seterrormode(long) msvcrt._seterrormode @ cdecl -i386 -norelay _setjmp(ptr) msvcrt._setjmp diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 5e32e32..a5c50b1 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -917,7 +917,7 @@ @ stub _set_malloc_crt_max_wait @ stub _set_output_format @ stub _set_printf_count_output -@ stub _set_purecall_handler +@ cdecl _set_purecall_handler(ptr) msvcrt._set_purecall_handler @ cdecl _set_sbh_threshold(long) msvcrt._set_sbh_threshold @ cdecl _seterrormode(long) msvcrt._seterrormode @ cdecl -i386 -norelay _setjmp(ptr) msvcrt._setjmp diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c index 27bb0d3..80749fc 100644 --- a/dlls/msvcrt/exit.c +++ b/dlls/msvcrt/exit.c @@ -32,6 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); static MSVCRT__onexit_t *MSVCRT_atexit_table = NULL; static int MSVCRT_atexit_table_size = 0; static int MSVCRT_atexit_registered = 0; /* Points to free slot */ +static MSVCRT_purecall_handler purecall_handler = NULL;
static const char szMsgBoxTitle[] = "Wine C++ Runtime Library";
@@ -251,6 +252,15 @@ int CDECL MSVCRT_atexit(void (*func)(void)) return MSVCRT__onexit((MSVCRT__onexit_t)func) == (MSVCRT__onexit_t)func ? 0 : -1; }
+/* _set_purecall_handler - not exported in native msvcrt */ +MSVCRT_purecall_handler CDECL _set_purecall_handler(MSVCRT_purecall_handler function) +{ + MSVCRT_purecall_handler ret = purecall_handler; + + TRACE("(%p)\n", function); + purecall_handler = function; + return ret; +}
/********************************************************************* * _purecall (MSVCRT.@) @@ -258,5 +268,8 @@ int CDECL MSVCRT_atexit(void (*func)(void)) void CDECL _purecall(void) { TRACE("(void)\n"); + + if(purecall_handler) + purecall_handler(); _amsg_exit( 25 ); } diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index f68790b..363223d 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -79,6 +79,7 @@ typedef void (*__cdecl MSVCRT__beginthread_start_routine_t)(void *); typedef unsigned int (__stdcall *MSVCRT__beginthreadex_start_routine_t)(void *); typedef int (*__cdecl MSVCRT__onexit_t)(void); typedef void (__cdecl *MSVCRT_invalid_parameter_handler)(const MSVCRT_wchar_t*, const MSVCRT_wchar_t*, const MSVCRT_wchar_t*, unsigned, MSVCRT_uintptr_t); +typedef void (__cdecl *MSVCRT_purecall_handler)(void);
typedef struct {long double x;} MSVCRT__LDOUBLE;
diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 31da01e..254f967 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -1475,3 +1475,4 @@ @ cdecl _configthreadlocale(long) @ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l @ cdecl ___mb_cur_max_l_func(ptr) +@ cdecl _set_purecall_handler(ptr)