From f0122420373d8182c9310de926113470cdb2471d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= Date: Wed, 30 Nov 2011 02:51:43 +0100 Subject: [PATCH] msvcrt: Implement _wasctime_s. --- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/msvcrt.spec | 2 +- dlls/msvcrt/time.c | 26 ++++++++++++++++++++++++++ 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index b7106b7ff66..1760a1ac670 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1277,7 +1277,7 @@ @ cdecl _waccess(wstr long) msvcrt._waccess @ cdecl _waccess_s(wstr long) msvcrt._waccess_s @ cdecl _wasctime(ptr) msvcrt._wasctime -@ stub _wasctime_s +@ cdecl _wasctime_s(ptr long ptr) msvcrt._wasctime_s @ cdecl _wassert(wstr wstr long) msvcrt._wassert @ cdecl _wchdir(wstr) msvcrt._wchdir @ cdecl _wchmod(wstr long) msvcrt._wchmod diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 03139470bc9..503864f368d 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -1130,7 +1130,7 @@ @ cdecl _waccess(wstr long) msvcrt._waccess @ cdecl _waccess_s(wstr long) msvcrt._waccess_s @ cdecl _wasctime(ptr) msvcrt._wasctime -@ stub _wasctime_s +@ cdecl _wasctime_s(ptr long ptr) msvcrt._wasctime_s @ cdecl _wassert(wstr wstr long) msvcrt._wassert @ cdecl _wchdir(wstr) msvcrt._wchdir @ cdecl _wchmod(wstr long) msvcrt._wchmod diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 6856d1792d1..7976a0fd727 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -1124,7 +1124,7 @@ @ cdecl _waccess(wstr long) msvcrt._waccess @ cdecl _waccess_s(wstr long) msvcrt._waccess_s @ cdecl _wasctime(ptr) msvcrt._wasctime -@ stub _wasctime_s +@ cdecl _wasctime_s(ptr long ptr) msvcrt._wasctime_s @ cdecl _wassert(wstr wstr long) msvcrt._wassert @ cdecl _wchdir(wstr) msvcrt._wchdir @ cdecl _wchmod(wstr long) msvcrt._wchmod diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 2b6dda21aa4..dfd3a07f015 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -1060,7 +1060,7 @@ @ cdecl _waccess(wstr long) MSVCRT__waccess @ cdecl _waccess_s(wstr long) @ cdecl _wasctime(ptr) MSVCRT__wasctime -# stub _wasctime_s(ptr long ptr) +@ cdecl _wasctime_s(ptr long ptr) MSVCRT__wasctime_s @ cdecl _wassert(wstr wstr long) MSVCRT__wassert @ cdecl _wchdir(wstr) MSVCRT__wchdir @ cdecl _wchmod(wstr long) MSVCRT__wchmod diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index adf6a1d6a30..f9de5c5de0d 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -36,6 +36,7 @@ #include "winbase.h" #include "winnls.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); @@ -949,6 +950,31 @@ MSVCRT_wchar_t * CDECL MSVCRT__wasctime(const struct MSVCRT_tm *mstm) return data->wasctime_buffer; } +/********************************************************************* + * _wasctime_s (MSVCRT.@) + */ +int CDECL MSVCRT__wasctime_s(MSVCRT_wchar_t* time, MSVCRT_size_t size, const struct MSVCRT_tm *mstm) +{ + WCHAR* asc; + unsigned int len; + + if (!MSVCRT_CHECK_PMT(time != NULL) || !MSVCRT_CHECK_PMT(mstm != NULL)) { + *MSVCRT__errno() = MSVCRT_EINVAL; + return MSVCRT_EINVAL; + } + + asc = MSVCRT__wasctime(mstm); + len = (strlenW(asc) + 1) * sizeof(WCHAR); + + if(!MSVCRT_CHECK_PMT(size >= len)) { + *MSVCRT__errno() = MSVCRT_ERANGE; + return MSVCRT_ERANGE; + } + + strcpyW(time, asc); + return 0; +} + /********************************************************************* * _ctime64 (MSVCRT.@) */