mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 06:41:41 +00:00
kernel32: Don't return a parent locale for neutral locales in GetLocaleInfoEx.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ed46a3268c
commit
c63a08586f
|
@ -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) ||
|
||||
|
|
Loading…
Reference in a new issue