Commit c63a0858 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Don't return a parent locale for neutral locales in GetLocaleInfoEx.

parent ed46a326
......@@ -1807,16 +1807,22 @@ INT WINAPI GetLocaleInfoEx(LPCWSTR locale, LCTYPE info, LPWSTR buffer, INT len)
if (!lcid) return 0;
/* special handling for neutral locale names */
if (info == LOCALE_SNAME && locale && strlenW(locale) == 2)
if (locale && strlenW(locale) == 2)
{
if (len && len < 3)
switch (info)
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return 0;
case LOCALE_SNAME:
if (len && len < 3)
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return 0;
}
if (len) strcpyW(buffer, locale);
return 3;
case LOCALE_SPARENT:
if (len) buffer[0] = 0;
return 1;
}
if (len) strcpyW(buffer, locale);
return 3;
}
return GetLocaleInfoW(lcid, info, buffer, len);
......
......@@ -4483,6 +4483,14 @@ static void test_GetLocaleInfoEx(void)
ok(ret == lstrlenW(bufferW)+1, "got %d\n", ret);
ok(!lstrcmpW(bufferW, enuW), "got %s\n", wine_dbgstr_w(bufferW));
ret = pGetLocaleInfoEx(enusW, LOCALE_SPARENT, bufferW, sizeof(bufferW)/sizeof(WCHAR));
ok(ret == lstrlenW(bufferW)+1, "got %d\n", ret);
ok(!lstrcmpW(bufferW, enW), "got %s\n", wine_dbgstr_w(bufferW));
ret = pGetLocaleInfoEx(enW, LOCALE_SPARENT, bufferW, sizeof(bufferW)/sizeof(WCHAR));
ok(ret == 1, "got %d\n", ret);
ok(!bufferW[0], "got %s\n", wine_dbgstr_w(bufferW));
ret = pGetLocaleInfoEx(enW, LOCALE_SCOUNTRY, bufferW, sizeof(bufferW)/sizeof(WCHAR));
ok(ret == lstrlenW(bufferW)+1, "got %d\n", ret);
if ((PRIMARYLANGID(LANGIDFROMLCID(GetSystemDefaultLCID())) != LANG_ENGLISH) ||
......
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