From 61c49bd78e5c96f14870e5c21a2ff75da7ac17b2 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 10 Nov 2015 17:40:10 +0300 Subject: [PATCH] kernel32: Implement EnumTimeFormatsEx(). Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/kernel32/kernel32.spec | 2 +- dlls/kernel32/lcformat.c | 22 ++++++++++++++++++++++ include/winnls.h | 2 ++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index c324347f0e8..ff67e54255e 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -428,7 +428,7 @@ @ stdcall EnumSystemLocalesEx(ptr long long ptr) @ stdcall EnumSystemLocalesW(ptr long) @ stdcall EnumTimeFormatsA(ptr long long) -# @ stub EnumTimeFormatsEx +@ stdcall EnumTimeFormatsEx(ptr wstr long long) @ stdcall EnumTimeFormatsW(ptr long long) @ stdcall EnumUILanguagesA(ptr long long) @ stdcall EnumUILanguagesW(ptr long long) diff --git a/dlls/kernel32/lcformat.c b/dlls/kernel32/lcformat.c index e421f54669c..0985e359850 100644 --- a/dlls/kernel32/lcformat.c +++ b/dlls/kernel32/lcformat.c @@ -1924,9 +1924,11 @@ struct enumtimeformats_context { enum enum_callback_type type; /* callback kind */ union { TIMEFMT_ENUMPROCW callback; /* user callback pointer */ + TIMEFMT_ENUMPROCEX callbackex; } u; LCID lcid; /* locale of interest */ DWORD flags; + LPARAM lParam; BOOL unicode; /* A vs W callback type, only for regular and Ex callbacks */ }; @@ -1970,6 +1972,9 @@ static BOOL NLS_EnumTimeFormats(struct enumtimeformats_context *ctxt) case CALLBACK_ENUMPROC: ctxt->u.callback(ctxt->unicode ? bufW : (WCHAR*)bufA); break; + case CALLBACK_ENUMPROCEX: + ctxt->u.callbackex(bufW, ctxt->lParam); + break; default: ; } @@ -2020,6 +2025,23 @@ BOOL WINAPI EnumTimeFormatsW(TIMEFMT_ENUMPROCW proc, LCID lcid, DWORD flags) return NLS_EnumTimeFormats(&ctxt); } +/************************************************************************** + * EnumTimeFormatsEx (KERNEL32.@) + */ +BOOL WINAPI EnumTimeFormatsEx(TIMEFMT_ENUMPROCEX proc, const WCHAR *locale, DWORD flags, LPARAM lParam) +{ + struct enumtimeformats_context ctxt; + + ctxt.type = CALLBACK_ENUMPROCEX; + ctxt.u.callbackex = proc; + ctxt.lcid = LocaleNameToLCID(locale, 0); + ctxt.flags = flags; + ctxt.lParam = lParam; + ctxt.unicode = TRUE; + + return NLS_EnumTimeFormats(&ctxt); +} + struct enumcalendar_context { enum enum_callback_type type; /* callback kind */ union { diff --git a/include/winnls.h b/include/winnls.h index 2f899f83029..4b4eb773780 100644 --- a/include/winnls.h +++ b/include/winnls.h @@ -735,6 +735,7 @@ typedef struct _nlsversioninfoex { typedef BOOL (CALLBACK *CALINFO_ENUMPROCEXEX)(LPWSTR,CALID,LPWSTR,LPARAM); typedef BOOL (CALLBACK *DATEFMT_ENUMPROCEXEX)(LPWSTR,CALID,LPARAM); +typedef BOOL (CALLBACK *TIMEFMT_ENUMPROCEX)(LPWSTR,LPARAM); #if defined(STRICT) typedef BOOL (CALLBACK *CALINFO_ENUMPROCA)(LPSTR); typedef BOOL (CALLBACK *CALINFO_ENUMPROCW)(LPWSTR); @@ -862,6 +863,7 @@ WINBASEAPI BOOL WINAPI EnumLanguageGroupLocalesW(LANGGROUPLOCALE_ENUMPROC WINBASEAPI BOOL WINAPI EnumTimeFormatsA(TIMEFMT_ENUMPROCA,LCID,DWORD); WINBASEAPI BOOL WINAPI EnumTimeFormatsW(TIMEFMT_ENUMPROCW,LCID,DWORD); #define EnumTimeFormats WINELIB_NAME_AW(EnumTimeFormats) +WINBASEAPI BOOL WINAPI EnumTimeFormatsEx(TIMEFMT_ENUMPROCEX,LPCWSTR,DWORD,LPARAM); WINBASEAPI BOOL WINAPI EnumUILanguagesA(UILANGUAGE_ENUMPROCA,DWORD,LONG_PTR); WINBASEAPI BOOL WINAPI EnumUILanguagesW(UILANGUAGE_ENUMPROCW,DWORD,LONG_PTR); #define EnumUILanguages WINELIB_NAME_AW(EnumUILanguages) -- 2.11.4.GIT