[v2 PATCH 1/4] kernel32: GetLocaleInfoA() doesn't support LOCALE_SSHORTTIME
Nikolay Sivov
nsivov at codeweavers.com
Tue Nov 10 08:40:07 CST 2015
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/kernel32/locale.c | 3 ++-
dlls/kernel32/tests/locale.c | 62 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index c0a66ef..6dc0d05 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -1295,7 +1295,8 @@ INT WINAPI GetLocaleInfoA( LCID lcid, LCTYPE lctype, LPSTR buffer, INT len )
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
- if (lctype & LOCALE_RETURN_GENITIVE_NAMES )
+ if (((lctype & ~LOCALE_LOCALEINFOFLAGSMASK) == LOCALE_SSHORTTIME) ||
+ (lctype & LOCALE_RETURN_GENITIVE_NAMES))
{
SetLastError( ERROR_INVALID_FLAGS );
return 0;
diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
index 1e4fd2a..b34767b 100644
--- a/dlls/kernel32/tests/locale.c
+++ b/dlls/kernel32/tests/locale.c
@@ -3358,6 +3358,7 @@ static void test_EnumUILanguageA(void)
}
static char date_fmt_buf[1024];
+static WCHAR date_fmt_bufW[1024];
static BOOL CALLBACK enum_datetime_procA(LPSTR fmt)
{
@@ -3366,6 +3367,12 @@ static BOOL CALLBACK enum_datetime_procA(LPSTR fmt)
return TRUE;
}
+static BOOL CALLBACK enum_datetime_procW(WCHAR *fmt)
+{
+ lstrcatW(date_fmt_bufW, fmt);
+ return FALSE;
+}
+
static void test_EnumDateFormatsA(void)
{
char *p, buf[256];
@@ -3473,6 +3480,60 @@ static void test_EnumTimeFormatsA(void)
ok(!lstrcmpA(date_fmt_buf, buf), "expected \"%s\" got \"%s\"\n", date_fmt_buf, buf);
}
+static void test_EnumTimeFormatsW(void)
+{
+ LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
+ WCHAR bufW[256];
+ BOOL ret;
+
+ date_fmt_bufW[0] = 0;
+ ret = EnumTimeFormatsW(enum_datetime_procW, lcid, 0);
+ ok(ret, "EnumTimeFormatsW(0) error %d\n", GetLastError());
+ ret = GetLocaleInfoW(lcid, LOCALE_STIMEFORMAT, bufW, sizeof(bufW)/sizeof(bufW[0]));
+ ok(ret, "GetLocaleInfoW(LOCALE_STIMEFORMAT) error %d\n", GetLastError());
+ ok(!lstrcmpW(date_fmt_bufW, bufW), "expected \"%s\" got \"%s\"\n", wine_dbgstr_w(date_fmt_bufW),
+ wine_dbgstr_w(bufW));
+
+ date_fmt_bufW[0] = 0;
+ ret = EnumTimeFormatsW(enum_datetime_procW, lcid, LOCALE_USE_CP_ACP);
+ ok(ret, "EnumTimeFormatsW(LOCALE_USE_CP_ACP) error %d\n", GetLastError());
+ ret = GetLocaleInfoW(lcid, LOCALE_STIMEFORMAT, bufW, sizeof(bufW)/sizeof(bufW[0]));
+ ok(ret, "GetLocaleInfoW(LOCALE_STIMEFORMAT) error %d\n", GetLastError());
+ ok(!lstrcmpW(date_fmt_bufW, bufW), "expected \"%s\" got \"%s\"\n", wine_dbgstr_w(date_fmt_bufW),
+ wine_dbgstr_w(bufW));
+
+ /* TIME_NOSECONDS is Win7+ feature */
+ date_fmt_bufW[0] = 0;
+ ret = EnumTimeFormatsW(enum_datetime_procW, lcid, TIME_NOSECONDS);
+ if (!ret && GetLastError() == ERROR_INVALID_FLAGS)
+ skip("EnumTimeFormatsW doesn't support TIME_NOSECONDS\n");
+ else {
+ char buf[256];
+
+ todo_wine
+ ok(ret, "EnumTimeFormatsW(TIME_NOSECONDS) error %d\n", GetLastError());
+ ret = GetLocaleInfoW(lcid, LOCALE_SSHORTTIME, bufW, sizeof(bufW)/sizeof(bufW[0]));
+ ok(ret, "GetLocaleInfoW(LOCALE_SSHORTTIME) error %d\n", GetLastError());
+ todo_wine
+ ok(!lstrcmpW(date_fmt_bufW, bufW), "expected \"%s\" got \"%s\"\n", wine_dbgstr_w(date_fmt_bufW),
+ wine_dbgstr_w(bufW));
+
+ /* EnumTimeFormatsA doesn't support this flag */
+ ret = EnumTimeFormatsA(enum_datetime_procA, lcid, TIME_NOSECONDS);
+ todo_wine {
+ ok(!ret && GetLastError() == ERROR_INVALID_FLAGS, "EnumTimeFormatsA(TIME_NOSECONDS) ret %d, error %d\n", ret,
+ GetLastError());
+
+ ret = EnumTimeFormatsA(NULL, lcid, TIME_NOSECONDS);
+ ok(!ret && GetLastError() == ERROR_INVALID_FLAGS, "EnumTimeFormatsA(TIME_NOSECONDS) ret %d, error %d\n", ret,
+ GetLastError());
+ }
+ /* And it's not supported by GetLocaleInfoA either */
+ ret = GetLocaleInfoA(lcid, LOCALE_SSHORTTIME, buf, sizeof(buf)/sizeof(buf[0]));
+ ok(!ret && GetLastError() == ERROR_INVALID_FLAGS, "GetLocaleInfoA(LOCALE_SSHORTTIME) ret %d, error %d\n", ret,
+ GetLastError());
+ }
+}
static void test_GetCPInfo(void)
{
BOOL ret;
@@ -4506,6 +4567,7 @@ START_TEST(locale)
InitFunctionPointers();
test_EnumTimeFormatsA();
+ test_EnumTimeFormatsW();
test_EnumDateFormatsA();
test_GetLocaleInfoA();
test_GetLocaleInfoW();
--
2.6.2
More information about the wine-patches
mailing list