Commit 9cd67d2a authored by Stefan Leichter's avatar Stefan Leichter Committed by Alexandre Julliard

kernel32: Return a dummy value in GetSystemPreferredUILanguages.

parent 997e2046
......@@ -1053,6 +1053,8 @@ INT WINAPI GetSystemDefaultLocaleName(LPWSTR localename, INT len)
*/
BOOL WINAPI GetSystemPreferredUILanguages(DWORD flags, ULONG* count, WCHAR* buffer, ULONG* size)
{
LCTYPE type;
int lsize;
if (flags & ~(MUI_LANGUAGE_NAME | MUI_LANGUAGE_ID | MUI_MACHINE_LANGUAGE_SETTINGS))
{
SetLastError(ERROR_INVALID_PARAMETER);
......@@ -1069,9 +1071,44 @@ BOOL WINAPI GetSystemPreferredUILanguages(DWORD flags, ULONG* count, WCHAR* buff
return FALSE;
}
FIXME("(0x%x %p %p %p) stub\n", flags, count, buffer, size);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
FIXME("(0x%x %p %p %p) returning a dummy value (current locale)\n", flags, count, buffer, size);
if (flags & MUI_LANGUAGE_ID)
type = LOCALE_ILANGUAGE;
else
type = LOCALE_SNAME;
lsize = GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, type, NULL, 0);
if (!lsize)
{
/* keep last error from callee */
return FALSE;
}
lsize++;
if (!*size)
{
*size = lsize;
*count = 1;
return TRUE;
}
if (lsize > *size)
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
if (!GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, type, buffer, *size))
{
/* keep last error from callee */
return FALSE;
}
buffer[lsize-1] = 0;
*size = lsize;
*count = 1;
TRACE("returned variable content: %d, \"%s\", %d\n", *count, debugstr_w(buffer), *size);
return TRUE;
}
/***********************************************************************
......
......@@ -4623,10 +4623,8 @@ static void test_GetSystemPreferredUILanguages(void)
size = 0;
SetLastError(0xdeadbeef);
ret = pGetSystemPreferredUILanguages(0, &count, NULL, &size);
todo_wine
ok(ret, "Expected GetSystemPreferredUILanguages to succeed\n");
ok(count, "Expected count > 0\n");
todo_wine
ok(size % 6 == 1, "Expected size (%d) %% 6 == 1\n", size);
count = 0xdeadbeef;
......@@ -4657,20 +4655,16 @@ static void test_GetSystemPreferredUILanguages(void)
size = 0;
SetLastError(0xdeadbeef);
ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID | MUI_MACHINE_LANGUAGE_SETTINGS, &count, NULL, &size);
todo_wine
ok(ret, "Expected GetSystemPreferredUILanguages to succeed\n");
ok(count, "Expected count > 0\n");
todo_wine
ok(size % 5 == 1, "Expected size (%d) %% 5 == 1\n", size);
count = 0xdeadbeef;
size = 0;
SetLastError(0xdeadbeef);
ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_NAME | MUI_MACHINE_LANGUAGE_SETTINGS, &count, NULL, &size);
todo_wine
ok(ret, "Expected GetSystemPreferredUILanguages to succeed\n");
ok(count, "Expected count > 0\n");
todo_wine
ok(size % 6 == 1, "Expected size (%d) %% 6 == 1\n", size);
/* second parameter
......@@ -4696,20 +4690,16 @@ static void test_GetSystemPreferredUILanguages(void)
size_id = 0;
SetLastError(0xdeadbeef);
ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID, &count, NULL, &size_id);
todo_wine
ok(ret, "Expected GetSystemPreferredUILanguages to succeed\n");
ok(count, "Expected count > 0\n");
todo_wine
ok(size_id % 5 == 1, "Expected size (%d) %% 5 == 1\n", size_id);
count = 0xdeadbeef;
size_name = 0;
SetLastError(0xdeadbeef);
ret = pGetSystemPreferredUILanguages(MUI_LANGUAGE_NAME, &count, NULL, &size_name);
todo_wine
ok(ret, "Expected GetSystemPreferredUILanguages to succeed\n");
ok(count, "Expected count > 0\n");
todo_wine
ok(size_name % 6 == 1, "Expected size (%d) %% 6 == 1\n", size_name);
size_buffer = max(size_id, size_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment