msvcrt: Implemented (_)wcserror.

This commit is contained in:
Eric Pouech 2010-11-02 22:03:47 +01:00 committed by Alexandre Julliard
parent cff575fbb3
commit 71200a9818
9 changed files with 60 additions and 12 deletions

View File

@ -482,7 +482,7 @@
@ extern __unguarded_readlc_active msvcrt.__unguarded_readlc_active @ extern __unguarded_readlc_active msvcrt.__unguarded_readlc_active
@ stub __vswprintf_l @ stub __vswprintf_l
@ extern __wargv msvcrt.__wargv @ extern __wargv msvcrt.__wargv
@ stub __wcserror @ cdecl __wcserror(wstr) msvcrt.__wcserror
@ stub __wcserror_s @ stub __wcserror_s
@ stub __wcsncnt @ stub __wcsncnt
@ cdecl __wgetmainargs(ptr ptr ptr long ptr) msvcrt.__wgetmainargs @ cdecl __wgetmainargs(ptr ptr ptr long ptr) msvcrt.__wgetmainargs
@ -1284,7 +1284,7 @@
@ cdecl _wcreat(wstr long) msvcrt._wcreat @ cdecl _wcreat(wstr long) msvcrt._wcreat
@ stub _wcscoll_l @ stub _wcscoll_l
@ cdecl _wcsdup(wstr) msvcrt._wcsdup @ cdecl _wcsdup(wstr) msvcrt._wcsdup
@ stub _wcserror @ cdecl _wcserror(long) msvcrt._wcserror
@ stub _wcserror_s @ stub _wcserror_s
@ stub _wcsftime_l @ stub _wcsftime_l
@ cdecl _wcsicmp(wstr wstr) msvcrt._wcsicmp @ cdecl _wcsicmp(wstr wstr) msvcrt._wcsicmp

View File

@ -206,7 +206,7 @@
@ cdecl __unDNameEx(ptr str long ptr ptr ptr long) msvcrt.__unDNameEx @ cdecl __unDNameEx(ptr str long ptr ptr ptr long) msvcrt.__unDNameEx
@ extern __unguarded_readlc_active msvcrt.__unguarded_readlc_active @ extern __unguarded_readlc_active msvcrt.__unguarded_readlc_active
@ extern __wargv msvcrt.__wargv @ extern __wargv msvcrt.__wargv
@ stub __wcserror @ cdecl __wcserror(wstr) msvcrt.__wcserror
@ cdecl __wgetmainargs(ptr ptr ptr long ptr) msvcrt.__wgetmainargs @ cdecl __wgetmainargs(ptr ptr ptr long ptr) msvcrt.__wgetmainargs
@ extern __winitenv msvcrt.__winitenv @ extern __winitenv msvcrt.__winitenv
@ cdecl _abnormal_termination() msvcrt._abnormal_termination @ cdecl _abnormal_termination() msvcrt._abnormal_termination
@ -595,7 +595,7 @@
@ extern _wcmdln msvcrt._wcmdln @ extern _wcmdln msvcrt._wcmdln
@ cdecl _wcreat(wstr long) msvcrt._wcreat @ cdecl _wcreat(wstr long) msvcrt._wcreat
@ cdecl _wcsdup(wstr) msvcrt._wcsdup @ cdecl _wcsdup(wstr) msvcrt._wcsdup
@ stub _wcserror @ cdecl _wcserror(long) msvcrt._wcserror
@ cdecl _wcsicmp(wstr wstr) msvcrt._wcsicmp @ cdecl _wcsicmp(wstr wstr) msvcrt._wcsicmp
@ cdecl _wcsicoll(wstr wstr) msvcrt._wcsicoll @ cdecl _wcsicoll(wstr wstr) msvcrt._wcsicoll
@ cdecl _wcslwr(wstr) msvcrt._wcslwr @ cdecl _wcslwr(wstr) msvcrt._wcslwr

View File

@ -201,7 +201,7 @@
@ cdecl __unDNameEx(ptr str long ptr ptr ptr long) msvcrt.__unDNameEx @ cdecl __unDNameEx(ptr str long ptr ptr ptr long) msvcrt.__unDNameEx
@ extern __unguarded_readlc_active msvcrt.__unguarded_readlc_active @ extern __unguarded_readlc_active msvcrt.__unguarded_readlc_active
@ extern __wargv msvcrt.__wargv @ extern __wargv msvcrt.__wargv
@ stub __wcserror @ cdecl __wcserror(wstr) msvcrt.__wcserror
@ cdecl __wgetmainargs(ptr ptr ptr long ptr) msvcrt.__wgetmainargs @ cdecl __wgetmainargs(ptr ptr ptr long ptr) msvcrt.__wgetmainargs
@ extern __winitenv msvcrt.__winitenv @ extern __winitenv msvcrt.__winitenv
@ cdecl _abnormal_termination() msvcrt._abnormal_termination @ cdecl _abnormal_termination() msvcrt._abnormal_termination
@ -591,7 +591,7 @@
@ extern _wcmdln msvcrt._wcmdln @ extern _wcmdln msvcrt._wcmdln
@ cdecl _wcreat(wstr long) msvcrt._wcreat @ cdecl _wcreat(wstr long) msvcrt._wcreat
@ cdecl _wcsdup(wstr) msvcrt._wcsdup @ cdecl _wcsdup(wstr) msvcrt._wcsdup
@ stub _wcserror @ cdecl _wcserror(long) msvcrt._wcserror
@ cdecl _wcsicmp(wstr wstr) msvcrt._wcsicmp @ cdecl _wcsicmp(wstr wstr) msvcrt._wcsicmp
@ cdecl _wcsicoll(wstr wstr) msvcrt._wcsicoll @ cdecl _wcsicoll(wstr wstr) msvcrt._wcsicoll
@ cdecl _wcslwr(wstr) msvcrt._wcslwr @ cdecl _wcslwr(wstr) msvcrt._wcslwr

View File

@ -306,7 +306,7 @@
@ extern __unguarded_readlc_active msvcrt.__unguarded_readlc_active @ extern __unguarded_readlc_active msvcrt.__unguarded_readlc_active
@ stub __vswprintf_l @ stub __vswprintf_l
@ extern __wargv msvcrt.__wargv @ extern __wargv msvcrt.__wargv
@ stub __wcserror @ cdecl __wcserror(wstr) msvcrt.__wcserror
@ stub __wcserror_s @ stub __wcserror_s
@ stub __wcsncnt @ stub __wcsncnt
@ cdecl __wgetmainargs(ptr ptr ptr long ptr) msvcrt.__wgetmainargs @ cdecl __wgetmainargs(ptr ptr ptr long ptr) msvcrt.__wgetmainargs
@ -1137,7 +1137,7 @@
@ cdecl _wcreat(wstr long) msvcrt._wcreat @ cdecl _wcreat(wstr long) msvcrt._wcreat
@ stub _wcscoll_l @ stub _wcscoll_l
@ cdecl _wcsdup(wstr) msvcrt._wcsdup @ cdecl _wcsdup(wstr) msvcrt._wcsdup
@ stub _wcserror @ cdecl _wcserror(long) msvcrt._wcserror
@ stub _wcserror_s @ stub _wcserror_s
@ stub _wcsftime_l @ stub _wcsftime_l
@ cdecl _wcsicmp(wstr wstr) msvcrt._wcsicmp @ cdecl _wcsicmp(wstr wstr) msvcrt._wcsicmp

View File

@ -298,7 +298,7 @@
@ extern __unguarded_readlc_active msvcrt.__unguarded_readlc_active @ extern __unguarded_readlc_active msvcrt.__unguarded_readlc_active
@ stub __vswprintf_l @ stub __vswprintf_l
@ extern __wargv msvcrt.__wargv @ extern __wargv msvcrt.__wargv
@ stub __wcserror @ cdecl __wcserror(wstr) msvcrt.__wcserror
@ stub __wcserror_s @ stub __wcserror_s
@ stub __wcsncnt @ stub __wcsncnt
@ cdecl __wgetmainargs(ptr ptr ptr long ptr) msvcrt.__wgetmainargs @ cdecl __wgetmainargs(ptr ptr ptr long ptr) msvcrt.__wgetmainargs
@ -1124,7 +1124,7 @@
@ cdecl _wcreat(wstr long) msvcrt._wcreat @ cdecl _wcreat(wstr long) msvcrt._wcreat
@ stub _wcscoll_l @ stub _wcscoll_l
@ cdecl _wcsdup(wstr) msvcrt._wcsdup @ cdecl _wcsdup(wstr) msvcrt._wcsdup
@ stub _wcserror @ cdecl _wcserror(long) msvcrt._wcserror
@ stub _wcserror_s @ stub _wcserror_s
@ stub _wcsftime_l @ stub _wcsftime_l
@ cdecl _wcsicmp(wstr wstr) msvcrt._wcsicmp @ cdecl _wcsicmp(wstr wstr) msvcrt._wcsicmp

View File

@ -27,6 +27,7 @@
#include "windef.h" #include "windef.h"
#include "winternl.h" #include "winternl.h"
#include "msvcrt.h" #include "msvcrt.h"
#include "winnls.h"
#include "excpt.h" #include "excpt.h"
#include "wine/debug.h" #include "wine/debug.h"
@ -326,6 +327,51 @@ void CDECL MSVCRT_perror(const char* str)
MSVCRT__write( 2, "\n", 1 ); MSVCRT__write( 2, "\n", 1 );
} }
/*********************************************************************
* _wcserror (MSVCRT.@)
*/
MSVCRT_wchar_t* CDECL _wcserror(int err)
{
thread_data_t *data = msvcrt_get_thread_data();
if (!data->wcserror_buffer)
if (!(data->wcserror_buffer = MSVCRT_malloc(256 * sizeof(MSVCRT_wchar_t)))) return NULL;
if (err < 0 || err > MSVCRT__sys_nerr) err = MSVCRT__sys_nerr;
MultiByteToWideChar(CP_ACP, 0, MSVCRT__sys_errlist[err], -1, data->wcserror_buffer, 256);
return data->wcserror_buffer;
}
/**********************************************************************
* __wcserror (MSVCRT.@)
*/
MSVCRT_wchar_t* CDECL __wcserror(const MSVCRT_wchar_t* str)
{
thread_data_t *data = msvcrt_get_thread_data();
int err;
static const WCHAR colonW[] = {':', ' ', '\0'};
static const WCHAR nlW[] = {'\n', '\0'};
size_t len;
if (!data->wcserror_buffer)
if (!(data->wcserror_buffer = MSVCRT_malloc(256 * sizeof(MSVCRT_wchar_t)))) return NULL;
err = data->thread_errno;
if (err < 0 || err > MSVCRT__sys_nerr) err = MSVCRT__sys_nerr;
if (str && *str)
{
lstrcpyW(data->wcserror_buffer, str);
lstrcatW(data->wcserror_buffer, colonW);
}
else data->wcserror_buffer[0] = '\0';
len = lstrlenW(data->wcserror_buffer);
MultiByteToWideChar(CP_ACP, 0, MSVCRT__sys_errlist[err], -1, data->wcserror_buffer + len, 256 - len);
lstrcatW(data->wcserror_buffer, nlW);
return data->wcserror_buffer;
}
/****************************************************************************** /******************************************************************************
* _set_error_mode (MSVCRT.@) * _set_error_mode (MSVCRT.@)
* *

View File

@ -70,6 +70,7 @@ static inline void msvcrt_free_tls_mem(void)
HeapFree(GetProcessHeap(),0,tls->asctime_buffer); HeapFree(GetProcessHeap(),0,tls->asctime_buffer);
HeapFree(GetProcessHeap(),0,tls->wasctime_buffer); HeapFree(GetProcessHeap(),0,tls->wasctime_buffer);
HeapFree(GetProcessHeap(),0,tls->strerror_buffer); HeapFree(GetProcessHeap(),0,tls->strerror_buffer);
HeapFree(GetProcessHeap(),0,tls->wcserror_buffer);
MSVCRT__free_locale(tls->locale); MSVCRT__free_locale(tls->locale);
} }
HeapFree(GetProcessHeap(), 0, tls); HeapFree(GetProcessHeap(), 0, tls);

View File

@ -116,6 +116,7 @@ struct __thread_data {
MSVCRT_wchar_t *wasctime_buffer; /* buffer for wasctime */ MSVCRT_wchar_t *wasctime_buffer; /* buffer for wasctime */
struct MSVCRT_tm time_buffer; /* buffer for localtime/gmtime */ struct MSVCRT_tm time_buffer; /* buffer for localtime/gmtime */
char *strerror_buffer; /* buffer for strerror */ char *strerror_buffer; /* buffer for strerror */
MSVCRT_wchar_t *wcserror_buffer; /* buffer for wcserror */
int fpecode; int fpecode;
MSVCRT_terminate_function terminate_handler; MSVCRT_terminate_function terminate_handler;
MSVCRT_unexpected_function unexpected_handler; MSVCRT_unexpected_function unexpected_handler;

View File

@ -263,7 +263,7 @@
@ cdecl __unDNameEx(ptr str long ptr ptr ptr long) @ cdecl __unDNameEx(ptr str long ptr ptr ptr long)
@ extern __unguarded_readlc_active MSVCRT___unguarded_readlc_active @ extern __unguarded_readlc_active MSVCRT___unguarded_readlc_active
@ extern __wargv MSVCRT___wargv @ extern __wargv MSVCRT___wargv
# stub __wcserror @ cdecl __wcserror(wstr)
# stub __wcserror_s # stub __wcserror_s
# stub __wcsncnt # stub __wcsncnt
@ cdecl __wgetmainargs(ptr ptr ptr long ptr) @ cdecl __wgetmainargs(ptr ptr ptr long ptr)
@ -1057,7 +1057,7 @@
# stub _wcscoll_l # stub _wcscoll_l
@ cdecl _wcsdup(wstr) @ cdecl _wcsdup(wstr)
# stub _wcsdup_dbg # stub _wcsdup_dbg
# stub _wcserror @ cdecl _wcserror(long)
# stub _wcserror_s # stub _wcserror_s
# stub _wcsftime_l # stub _wcsftime_l
@ cdecl _wcsicmp(wstr wstr) ntdll._wcsicmp @ cdecl _wcsicmp(wstr wstr) ntdll._wcsicmp