From a406d538bbeaab392e64d43088e8a2572818cff7 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 18 Dec 2012 11:39:00 +0100 Subject: [PATCH] msvcrt: Fixed locale matching code. --- dlls/msvcrt/locale.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index 707b8f1c4ca..4540e9a3101 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -130,9 +130,12 @@ static int compare_info(LCID lcid, DWORD flags, char* buff, const char* cmp, BOO { int len; + if(!cmp[0]) + return 0; + buff[0] = 0; GetLocaleInfoA(lcid, flags|LOCALE_NOUSEROVERRIDE, buff, MAX_ELEM_LEN); - if (!buff[0] || !cmp[0]) + if (!buff[0]) return 0; /* Partial matches are only allowed on language/country names */ @@ -175,7 +178,7 @@ find_best_locale_proc(HMODULE hModule, LPCSTR type, LPCSTR name, WORD LangID, LO TRACE("Found country:%s->%s\n", res->search_country, buff); flags |= FOUND_COUNTRY; } - else if (res->match_flags & FOUND_COUNTRY) + else if (!flags && (res->match_flags & FOUND_COUNTRY)) { return CONTINUE_LOOKING; } @@ -188,7 +191,7 @@ find_best_locale_proc(HMODULE hModule, LPCSTR type, LPCSTR name, WORD LangID, LO flags |= FOUND_CODEPAGE; memcpy(res->found_codepage,res->search_codepage,MAX_ELEM_LEN); } - else if (res->match_flags & FOUND_CODEPAGE) + else if (!flags && (res->match_flags & FOUND_CODEPAGE)) { return CONTINUE_LOOKING; }