From 56eb4d3105733693f8de43eacf8e20ed922cb65a Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Wed, 22 Jun 2016 01:53:00 +0000 Subject: [PATCH] msvcrt: Implement _wperror. Signed-off-by: Hugh McMaster Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr70/msvcr70.spec | 2 +- dlls/msvcr71/msvcr71.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/errno.c | 25 +++++++++++++++++++++++++ dlls/msvcrt/msvcrt.spec | 2 +- dlls/ucrtbase/ucrtbase.spec | 2 +- 10 files changed, 34 insertions(+), 9 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index efbd6880bf5..5fae918c2d9 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1568,7 +1568,7 @@ @ cdecl _wmktemp(wstr) MSVCRT__wmktemp @ cdecl _wmktemp_s(wstr long) MSVCRT__wmktemp_s @ varargs _wopen(wstr long) MSVCRT__wopen -@ stub _wperror(wstr) +@ cdecl _wperror(wstr) MSVCRT__wperror @ extern _wpgmptr MSVCRT__wpgmptr @ cdecl _wpopen(wstr wstr) MSVCRT__wpopen @ stub _wprintf_l diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 7476995be4e..38fdfe9faf2 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1925,7 +1925,7 @@ @ cdecl _wmktemp(wstr) MSVCRT__wmktemp @ cdecl _wmktemp_s(wstr long) MSVCRT__wmktemp_s @ varargs _wopen(wstr long) MSVCRT__wopen -@ stub _wperror(wstr) +@ cdecl _wperror(wstr) MSVCRT__wperror @ extern _wpgmptr MSVCRT__wpgmptr @ cdecl _wpopen(wstr wstr) MSVCRT__wpopen @ stub _wprintf_l diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 7aa2d191827..4ef7358bc71 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1949,7 +1949,7 @@ @ cdecl _wmktemp(wstr) MSVCRT__wmktemp @ cdecl _wmktemp_s(wstr long) MSVCRT__wmktemp_s @ varargs _wopen(wstr long) MSVCRT__wopen -@ stub _wperror(wstr) +@ cdecl _wperror(wstr) MSVCRT__wperror @ extern _wpgmptr MSVCRT__wpgmptr @ cdecl _wpopen(wstr wstr) MSVCRT__wpopen @ stub _wprintf_l diff --git a/dlls/msvcr70/msvcr70.spec b/dlls/msvcr70/msvcr70.spec index f236db5c4a8..6bd50838981 100644 --- a/dlls/msvcr70/msvcr70.spec +++ b/dlls/msvcr70/msvcr70.spec @@ -641,7 +641,7 @@ @ cdecl _wmkdir(wstr) MSVCRT__wmkdir @ cdecl _wmktemp(wstr) MSVCRT__wmktemp @ varargs _wopen(wstr long) MSVCRT__wopen -@ stub _wperror(wstr) +@ cdecl _wperror(wstr) MSVCRT__wperror @ extern _wpgmptr MSVCRT__wpgmptr @ cdecl _wpopen(wstr wstr) MSVCRT__wpopen @ cdecl _wputenv(wstr) diff --git a/dlls/msvcr71/msvcr71.spec b/dlls/msvcr71/msvcr71.spec index 5414dc6b523..7e3f2653f82 100644 --- a/dlls/msvcr71/msvcr71.spec +++ b/dlls/msvcr71/msvcr71.spec @@ -637,7 +637,7 @@ @ cdecl _wmkdir(wstr) MSVCRT__wmkdir @ cdecl _wmktemp(wstr) MSVCRT__wmktemp @ varargs _wopen(wstr long) MSVCRT__wopen -@ stub _wperror(wstr) +@ cdecl _wperror(wstr) MSVCRT__wperror @ extern _wpgmptr MSVCRT__wpgmptr @ cdecl _wpopen(wstr wstr) MSVCRT__wpopen @ cdecl _wputenv(wstr) diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index a6f0a90f0f7..1c1dc1a325c 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -1250,7 +1250,7 @@ @ cdecl _wmktemp(wstr) MSVCRT__wmktemp @ cdecl _wmktemp_s(wstr long) MSVCRT__wmktemp_s @ varargs _wopen(wstr long) MSVCRT__wopen -@ stub _wperror(wstr) +@ cdecl _wperror(wstr) MSVCRT__wperror @ extern _wpgmptr MSVCRT__wpgmptr @ cdecl _wpopen(wstr wstr) MSVCRT__wpopen @ stub _wprintf_l diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 48aed2c3f72..13d1babd7d8 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -1223,7 +1223,7 @@ @ cdecl _wmktemp(wstr) MSVCRT__wmktemp @ cdecl _wmktemp_s(wstr long) MSVCRT__wmktemp_s @ varargs _wopen(wstr long) MSVCRT__wopen -@ stub _wperror(wstr) +@ cdecl _wperror(wstr) MSVCRT__wperror @ extern _wpgmptr MSVCRT__wpgmptr @ cdecl _wpopen(wstr wstr) MSVCRT__wpopen @ stub _wprintf_l diff --git a/dlls/msvcrt/errno.c b/dlls/msvcrt/errno.c index 641ca35ded0..46b1859a8e6 100644 --- a/dlls/msvcrt/errno.c +++ b/dlls/msvcrt/errno.c @@ -343,6 +343,31 @@ void CDECL MSVCRT_perror(const char* str) MSVCRT__write( 2, "\n", 1 ); } +/********************************************************************* + * _wperror (MSVCRT.@) + */ +void CDECL MSVCRT__wperror(const MSVCRT_wchar_t* str) +{ + MSVCRT_size_t size; + char *buffer = NULL; + + if (str && *str) + { + size = MSVCRT_wcstombs(NULL, str, 0); + if (size == -1) return; + size++; + buffer = MSVCRT_malloc(size); + if (!buffer) return; + if (MSVCRT_wcstombs(buffer, str, size) == -1) + { + MSVCRT_free(buffer); + return; + } + } + MSVCRT_perror(buffer); + if (buffer) MSVCRT_free(buffer); +} + /********************************************************************* * _wcserror_s (MSVCRT.@) */ diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 37107d58cf7..274d2e71221 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -1184,7 +1184,7 @@ @ cdecl _wmktemp_s(wstr long) MSVCRT__wmktemp_s @ varargs _wopen(wstr long) MSVCRT__wopen # stub _woutput_s -@ stub _wperror(wstr) +@ cdecl _wperror(wstr) MSVCRT__wperror @ extern _wpgmptr MSVCRT__wpgmptr @ cdecl _wpopen (wstr wstr) MSVCRT__wpopen # stub _wprintf_l(wstr ptr) diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index da03fd100d0..ecfb612c5c9 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -2097,7 +2097,7 @@ @ cdecl _wmktemp(wstr) MSVCRT__wmktemp @ cdecl _wmktemp_s(wstr long) MSVCRT__wmktemp_s @ varargs _wopen(wstr long) MSVCRT__wopen -@ stub _wperror(wstr) +@ cdecl _wperror(wstr) MSVCRT__wperror @ cdecl _wpopen(wstr wstr) MSVCRT__wpopen @ cdecl _wputenv(wstr) @ cdecl _wputenv_s(wstr wstr)