From bc1eaf7a0fbc7ee0aa58fe603b42c225dea11249 Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Mon, 8 Jun 2015 16:24:00 -0700 Subject: [PATCH] msvcrt: Add _W_Getdays. --- dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr120_app/msvcr120_app.spec | 2 +- dlls/msvcrt/locale.c | 36 ++++++++++++++++++++++++++++- dlls/msvcrt/msvcrt.h | 15 +++++++++++- 5 files changed, 52 insertions(+), 5 deletions(-) diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index e99df427f42..2438b5ea06d 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -864,7 +864,7 @@ @ stub -arch=win64 _SetThrowImageBase @ cdecl _Strftime(str long str ptr ptr) @ stub _Unlock_shared_ptr_spin_lock -@ stub _W_Getdays +@ cdecl _W_Getdays() @ stub _W_Getmonths @ stub _W_Gettnames @ stub _Wcsftime diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 2beb51b7084..dbbf05ffbdf 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -846,7 +846,7 @@ @ stub -arch=win64 _SetImageBase @ stub -arch=win64 _SetThrowImageBase @ cdecl _Strftime(str long str ptr ptr) -@ stub _W_Getdays +@ cdecl _W_Getdays() @ stub _W_Getmonths @ stub _W_Gettnames @ stub _Wcsftime diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index e262aa97cf3..6f6a9809d92 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -842,7 +842,7 @@ @ stub -arch=win64 _SetImageBase @ stub -arch=win64 _SetThrowImageBase @ cdecl _Strftime(str long str ptr ptr) msvcr120._Strftime -@ stub _W_Getdays +@ cdecl _W_Getdays() msvcr120._W_Getdays @ stub _W_Getmonths @ stub _W_Gettnames @ stub _Wcsftime diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index 2b1efc6ac1c..8a5c1103ef5 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -35,6 +35,7 @@ #include "mtdll.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); @@ -439,6 +440,39 @@ char* CDECL _Getdays(void) return out; } +/********************************************************************* + * _W_Getdays (MSVCRT.@) + */ +MSVCRT_wchar_t* CDECL _W_Getdays(void) +{ + MSVCRT___lc_time_data *cur = get_locinfo()->lc_time_curr; + MSVCRT_wchar_t *out; + int i, len, size; + + TRACE("\n"); + + size = cur->wstr.names.short_mon[0]-cur->wstr.names.short_wday[0]; + out = MSVCRT_malloc((size+1)*sizeof(*out)); + if(!out) + return NULL; + + size = 0; + for(i=0; i<7; i++) { + out[size++] = ':'; + len = strlenW(cur->wstr.names.short_wday[i]); + memcpy(&out[size], cur->wstr.names.short_wday[i], len*sizeof(*out)); + size += len; + + out[size++] = ':'; + len = strlenW(cur->wstr.names.wday[i]); + memcpy(&out[size], cur->wstr.names.wday[i], len*sizeof(*out)); + size += len; + } + out[size] = '\0'; + + return out; +} + /********************************************************************* * _Getmonths (MSVCRT.@) */ @@ -1381,7 +1415,7 @@ MSVCRT__locale_t CDECL MSVCRT__create_locale(int category, const char *locale) } } for(i=0; ilocinfo->lc_time_curr->wstr[i] = (MSVCRT_wchar_t*)&loc->locinfo->lc_time_curr->data[ret]; + loc->locinfo->lc_time_curr->wstr.wstr[i] = (MSVCRT_wchar_t*)&loc->locinfo->lc_time_curr->data[ret]; if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) { memcpy(&loc->locinfo->lc_time_curr->data[ret], cloc_short_dateW, sizeof(cloc_short_dateW)); ret += sizeof(cloc_short_dateW); diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 806c4bf4498..e11400b0692 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -134,7 +134,20 @@ typedef struct { } str; LCID lcid; int unk[2]; - MSVCRT_wchar_t *wstr[43]; + union { + MSVCRT_wchar_t *wstr[43]; + struct { + MSVCRT_wchar_t *short_wday[7]; + MSVCRT_wchar_t *wday[7]; + MSVCRT_wchar_t *short_mon[12]; + MSVCRT_wchar_t *mon[12]; + MSVCRT_wchar_t *am; + MSVCRT_wchar_t *pm; + MSVCRT_wchar_t *short_date; + MSVCRT_wchar_t *date; + MSVCRT_wchar_t *time; + } names; + } wstr; char data[1]; } MSVCRT___lc_time_data;