From abb746002b8b0f60fe7e5b865aedd97a770a0086 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Thu, 1 Apr 2010 12:40:22 +0200 Subject: [PATCH] msvcrt: Fix _get/_set_invalid_parameter_handler implementation. --- dlls/msvcr80/msvcr80.spec | 6 +++--- dlls/msvcr90/msvcr90.c | 25 ------------------------- dlls/msvcr90/msvcr90.spec | 6 +++--- dlls/msvcrt/errno.c | 19 +++++++++++++++++++ dlls/msvcrt/msvcrt.spec | 6 +++++- 5 files changed, 30 insertions(+), 32 deletions(-) diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 541cf683730..b48656e9fa5 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -470,7 +470,7 @@ @ stub _get_errno @ stub _get_fmode @ stub _get_heap_handle -@ cdecl _get_invalid_parameter_handler() msvcr90._get_invalid_parameter_handler +@ cdecl _get_invalid_parameter_handler() msvcrt._get_invalid_parameter_handler @ cdecl _get_osfhandle(long) msvcrt._get_osfhandle @ stub _get_osplatform @ stub _get_osver @@ -533,7 +533,7 @@ @ stub _inp @ stub _inpd @ stub _inpw -@ extern _invalid_parameter msvcrt._invalid_parameter +@ stub _invalid_parameter @ stub _invalid_parameter_noinfo @ stub _invoke_watson @ extern _iob msvcrt._iob @@ -873,7 +873,7 @@ @ stub _set_errno @ cdecl _set_error_mode(long) msvcrt._set_error_mode @ stub _set_fmode -@ cdecl _set_invalid_parameter_handler(ptr) msvcr90._set_invalid_parameter_handler +@ cdecl _set_invalid_parameter_handler(ptr) msvcrt._set_invalid_parameter_handler @ stub _set_malloc_crt_max_wait @ stub _set_output_format @ stub _set_printf_count_output diff --git a/dlls/msvcr90/msvcr90.c b/dlls/msvcr90/msvcr90.c index a1994d87d09..c3515ee6c43 100644 --- a/dlls/msvcr90/msvcr90.c +++ b/dlls/msvcr90/msvcr90.c @@ -27,7 +27,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcr90); typedef int (CDECL *_INITTERM_E_FN)(void); -typedef void (__cdecl *_invalid_parameter_handler)(const wchar_t*, const wchar_t*, const wchar_t*, unsigned, unsigned*); /********************************************************************* * DllMain (MSVCR90.@) @@ -77,30 +76,6 @@ void * CDECL _encoded_null(void) return MSVCR90_encode_pointer(NULL); } -/********************************************************************* - * _get_invalid_parameter_handler (MSVCR90.@) - */ -_invalid_parameter_handler CDECL _get_invalid_parameter_handler(void) -{ - TRACE("\n"); - return *((_invalid_parameter_handler*)GetProcAddress(GetModuleHandleA("msvcrt.dll"), "_invalid_parameter")); -} - -/********************************************************************* - * _set_invalid_parameter_handler (MSVCR90.@) - */ -_invalid_parameter_handler CDECL _set_invalid_parameter_handler(_invalid_parameter_handler handler) -{ - _invalid_parameter_handler *ptr = (_invalid_parameter_handler*)GetProcAddress( - GetModuleHandleA("msvcrt.dll"), "_invalid_parameter"); - _invalid_parameter_handler old = *ptr; - - TRACE("(%p)\n", handler); - - *ptr = handler; - return old; -} - /********************************************************************* * _initterm_e (MSVCR90.@) * diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 296466ac919..fd6c8df2cc5 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -462,7 +462,7 @@ @ stub _get_errno @ stub _get_fmode @ stub _get_heap_handle -@ cdecl _get_invalid_parameter_handler() +@ cdecl _get_invalid_parameter_handler() msvcrt._get_invalid_parameter_handler @ cdecl _get_osfhandle(long) msvcrt._get_osfhandle @ stub _get_output_format @ stub _get_pgmptr @@ -521,7 +521,7 @@ @ stub _inp @ stub _inpd @ stub _inpw -@ extern _invalid_parameter msvcrt._invalid_parameter +@ stub _invalid_parameter @ stub _invalid_parameter_noinfo @ stub _invoke_watson @ extern _iob msvcrt._iob @@ -859,7 +859,7 @@ @ stub _set_errno @ cdecl _set_error_mode(long) msvcrt._set_error_mode @ stub _set_fmode -@ cdecl _set_invalid_parameter_handler(ptr) +@ cdecl _set_invalid_parameter_handler(ptr) msvcrt._set_invalid_parameter_handler @ stub _set_malloc_crt_max_wait @ stub _set_output_format @ stub _set_printf_count_output diff --git a/dlls/msvcrt/errno.c b/dlls/msvcrt/errno.c index c4c861885e9..80dcab6ce02 100644 --- a/dlls/msvcrt/errno.c +++ b/dlls/msvcrt/errno.c @@ -286,3 +286,22 @@ void CDECL _seterrormode(int mode) { SetErrorMode( mode ); } + +/* _get_invalid_parameter_handler - not exported in native msvcrt, added in msvcr80 */ +MSVCRT_invalid_parameter_handler CDECL _get_invalid_parameter_handler(void) +{ + TRACE("\n"); + return MSVCRT_invalid_parameter; +} + +/* _set_invalid_parameter_handler - not exproted in native msvcrt, added in msvcr80 */ +MSVCRT_invalid_parameter_handler CDECL _set_invalid_parameter_handler( + MSVCRT_invalid_parameter_handler handler) +{ + MSVCRT_invalid_parameter_handler old = MSVCRT_invalid_parameter; + + TRACE("(%p)\n", handler); + + MSVCRT_invalid_parameter = handler; + return old; +} diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 2b6be16aeb4..762563ef7a7 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -479,7 +479,7 @@ @ stub _inp #(long) -i386 @ stub _inpd #(long) -i386 @ stub _inpw #(long) -i386 -@ extern _invalid_parameter MSVCRT_invalid_parameter +@ stub _invalid_parameter @ extern _iob MSVCRT__iob # stub _isalnum_l # stub _isalpha_l @@ -1409,3 +1409,7 @@ # stub wprintf_s @ varargs wscanf(wstr) MSVCRT_wscanf # stub wscanf_s + +# Functions not exported in native dll: +@ cdecl _get_invalid_parameter_handler() +@ cdecl _set_invalid_parameter_handler(ptr)