Commit 09176c3a authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

kernel32: Treat empty locale name as LOCALE_INVARIANT.

parent 42cbc05e
......@@ -453,6 +453,13 @@ static void parse_locale_name( const WCHAR *str, struct locale_name *name )
name->win_name[0] = 0;
lstrcpynW( name->lang, str, sizeof(name->lang)/sizeof(WCHAR) );
if (!*name->lang)
{
name->lcid = LOCALE_INVARIANT;
name->matches = 4;
return;
}
if (!(p = strpbrkW( name->lang, sepW )))
{
if (!strcmpW( name->lang, posixW ) || !strcmpW( name->lang, cW ))
......
......@@ -2418,9 +2418,9 @@ static void test_LocaleNameToLCID(void)
buffer[0] = 0;
SetLastError(0xdeadbeef);
lcid = pLocaleNameToLCID(LOCALE_NAME_INVARIANT, 0);
todo_wine ok(lcid == 0x7F, "Expected lcid = 0x7F, got %08x, error %d\n", lcid, GetLastError());
ok(lcid == 0x7F, "Expected lcid = 0x7F, got %08x, error %d\n", lcid, GetLastError());
ret = pLCIDToLocaleName(lcid, buffer, LOCALE_NAME_MAX_LENGTH, 0);
ok(ret > 0, "Expected ret > 0, got %d, error %d\n", ret, GetLastError());
todo_wine ok(ret > 0, "Expected ret > 0, got %d, error %d\n", ret, GetLastError());
trace("%08x, %s\n", lcid, wine_dbgstr_w(buffer));
/* bad name */
......@@ -4091,6 +4091,8 @@ static void test_IsValidLocaleName(void)
ok(!ret, "IsValidLocaleName should have failed\n");
ret = pIsValidLocaleName(zzzzW);
ok(!ret, "IsValidLocaleName should have failed\n");
ret = pIsValidLocaleName(LOCALE_NAME_INVARIANT);
ok(ret, "IsValidLocaleName failed\n");
}
static void test_CompareStringOrdinal(void)
......
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