Module: wine Branch: stable Commit: 93fb9cd15ea3b66aba7a8e0c438da2302c603b59 URL: http://source.winehq.org/git/wine.git/?a=commit;h=93fb9cd15ea3b66aba7a8e0c43...
Author: Piotr Caban piotr@codeweavers.com Date: Wed Jan 20 11:42:14 2016 +0100
msvcr110: Add _W_Gettnames implementation.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit 59ed8c593c8c5d7d7de2ecde6a283d9d4276661f) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
.../api-ms-win-crt-time-l1-1-0.spec | 2 +- dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr120/tests/msvcr120.c | 53 ++++++++++++++++++++++ dlls/msvcr120_app/msvcr120_app.spec | 2 +- dlls/msvcrt/locale.c | 8 ++++ dlls/ucrtbase/ucrtbase.spec | 2 +- 7 files changed, 66 insertions(+), 5 deletions(-)
diff --git a/dlls/api-ms-win-crt-time-l1-1-0/api-ms-win-crt-time-l1-1-0.spec b/dlls/api-ms-win-crt-time-l1-1-0/api-ms-win-crt-time-l1-1-0.spec index b619703..6ae7a08 100644 --- a/dlls/api-ms-win-crt-time-l1-1-0/api-ms-win-crt-time-l1-1-0.spec +++ b/dlls/api-ms-win-crt-time-l1-1-0/api-ms-win-crt-time-l1-1-0.spec @@ -4,7 +4,7 @@ @ cdecl _Strftime(str long str ptr ptr) ucrtbase._Strftime @ cdecl _W_Getdays() ucrtbase._W_Getdays @ cdecl _W_Getmonths() ucrtbase._W_Getmonths -@ stub _W_Gettnames +@ cdecl _W_Gettnames() ucrtbase._W_Gettnames @ stub _Wcsftime @ cdecl __daylight() ucrtbase.__daylight @ cdecl __dstbias() ucrtbase.__dstbias diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 8a4ee4a..cd56cf8 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -866,7 +866,7 @@ @ stub _Unlock_shared_ptr_spin_lock @ cdecl _W_Getdays() @ cdecl _W_Getmonths() -@ stub _W_Gettnames +@ cdecl _W_Gettnames() @ stub _Wcsftime @ cdecl _XcptFilter(long ptr) @ cdecl __AdjustPointer(ptr ptr) diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 47f79ca..5f69b0d 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -850,7 +850,7 @@ @ cdecl _Strftime(str long str ptr ptr) @ cdecl _W_Getdays() @ cdecl _W_Getmonths() -@ stub _W_Gettnames +@ cdecl _W_Gettnames() @ stub _Wcsftime @ cdecl _XcptFilter(long ptr) @ cdecl __AdjustPointer(ptr ptr) diff --git a/dlls/msvcr120/tests/msvcr120.c b/dlls/msvcr120/tests/msvcr120.c index 330c6b1..d6936f5 100644 --- a/dlls/msvcr120/tests/msvcr120.c +++ b/dlls/msvcr120/tests/msvcr120.c @@ -24,6 +24,7 @@
#include <windef.h> #include <winbase.h> +#include <winnls.h> #include "wine/test.h"
#include <locale.h> @@ -65,6 +66,8 @@ static int (CDECL *p__dsign)(double); static int (CDECL *p__fdsign)(float); static wchar_t** (CDECL *p____lc_locale_name_func)(void); static unsigned int (CDECL *p__GetConcurrency)(void); +static void* (CDECL *p__W_Gettnames)(void); +static void (CDECL *p_free)(void*);
static BOOL init(void) { @@ -84,6 +87,8 @@ static BOOL init(void) p__fdsign = (void*)GetProcAddress(module, "_fdsign"); p____lc_locale_name_func = (void*)GetProcAddress(module, "___lc_locale_name_func"); p__GetConcurrency = (void*)GetProcAddress(module,"?_GetConcurrency@details@Concurrency@@YAIXZ"); + p__W_Gettnames = (void*)GetProcAddress(module, "_W_Gettnames"); + p_free = (void*)GetProcAddress(module, "free"); return TRUE; }
@@ -233,6 +238,53 @@ static void test__GetConcurrency(void) ok(c == si.dwNumberOfProcessors, "expected %u, got %u\n", si.dwNumberOfProcessors, c); }
+static void test__W_Gettnames(void) +{ + static const char *str[] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", + "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday", + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", + "January", "February", "March", "April", "May", "June", "July", + "August", "September", "October", "November", "December", + "AM", "PM", "M/d/yyyy" + }; + + struct { + char *str[43]; + int unk[2]; + wchar_t *wstr[43]; + wchar_t *locname; + char data[1]; + } *ret; + int i, size; + WCHAR buf[64]; + + if(!p_setlocale(LC_ALL, "english")) + return; + + ret = p__W_Gettnames(); + size = ret->str[0]-(char*)ret; + if(sizeof(void*) == 8) + ok(size==0x2c0, "structure size: %x\n", size); + else + ok(size==0x164, "structure size: %x\n", size); + + for(i=0; i<sizeof(str)/sizeof(*str); i++) { + ok(!strcmp(ret->str[i], str[i]), "ret->str[%d] = %s, expected %s\n", + i, ret->str[i], str[i]); + + MultiByteToWideChar(CP_ACP, 0, str[i], strlen(str[i])+1, + buf, sizeof(buf)/sizeof(*buf)); + ok(!lstrcmpW(ret->wstr[i], buf), "ret->wstr[%d] = %s, expected %s\n", + i, wine_dbgstr_w(ret->wstr[i]), wine_dbgstr_w(buf)); + } + p_free(ret); + + p_setlocale(LC_ALL, "C"); +} + START_TEST(msvcr120) { if (!init()) return; @@ -240,4 +292,5 @@ START_TEST(msvcr120) test__dsign(); test____lc_locale_name_func(); test__GetConcurrency(); + test__W_Gettnames(); } diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index 6447c0d..9aa0978 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -844,7 +844,7 @@ @ cdecl _Strftime(str long str ptr ptr) msvcr120._Strftime @ cdecl _W_Getdays() msvcr120._W_Getdays @ cdecl _W_Getmonths() msvcr120._W_Getmonths -@ stub _W_Gettnames +@ cdecl _W_Gettnames() msvcr120._W_Gettnames @ stub _Wcsftime @ cdecl _XcptFilter(long ptr) msvcr120._XcptFilter @ cdecl __AdjustPointer(ptr ptr) msvcr120.__AdjustPointer diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index e1a0fbe..a1551c2 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -580,6 +580,14 @@ void* CDECL _Gettnames(void) }
/********************************************************************* + * _W_Gettnames (MSVCR110.@) + */ +void* CDECL _W_Gettnames(void) +{ + return _Gettnames(); +} + +/********************************************************************* * __crtLCMapStringA (MSVCRT.@) */ int CDECL __crtLCMapStringA( diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index 44b01af..5bad345 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -43,7 +43,7 @@ @ cdecl _Strftime(str long str ptr ptr) @ cdecl _W_Getdays() @ cdecl _W_Getmonths() -@ stub _W_Gettnames +@ cdecl _W_Gettnames() @ stub _Wcsftime @ cdecl __AdjustPointer(ptr ptr) @ stub __BuildCatchObject