From b0935ab8111323a01fdc837a274deeda93263f8e Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 16 Apr 2014 13:55:13 -0600 Subject: [PATCH] kernel32: Allow CompareStringEx NORM_LINGUISTIC_CASING flag. --- dlls/kernel32/locale.c | 12 +++++++----- dlls/kernel32/tests/locale.c | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c index c1d89b74604..95978955c26 100644 --- a/dlls/kernel32/locale.c +++ b/dlls/kernel32/locale.c @@ -2985,6 +2985,10 @@ INT WINAPI CompareStringW(LCID lcid, DWORD flags, INT WINAPI CompareStringEx(LPCWSTR locale, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lParam) { + DWORD supported_flags = NORM_IGNORECASE|NORM_IGNORENONSPACE|NORM_IGNORESYMBOLS|SORT_STRINGSORT + |NORM_IGNOREKANATYPE|NORM_IGNOREWIDTH|LOCALE_USE_CP_ACP; + DWORD semistub_flags = NORM_LINGUISTIC_CASING|0x10000000; + /* 0x10000000 is related to diacritics in Arabic, Japanese, and Hebrew */ INT ret; if (version) FIXME("unexpected version parameter\n"); @@ -2997,16 +3001,14 @@ INT WINAPI CompareStringEx(LPCWSTR locale, DWORD flags, LPCWSTR str1, INT len1, return 0; } - if( flags & ~(NORM_IGNORECASE|NORM_IGNORENONSPACE|NORM_IGNORESYMBOLS| - SORT_STRINGSORT|NORM_IGNOREKANATYPE|NORM_IGNOREWIDTH|LOCALE_USE_CP_ACP|0x10000000) ) + if (flags & ~(supported_flags|semistub_flags)) { SetLastError(ERROR_INVALID_FLAGS); return 0; } - /* this style is related to diacritics in Arabic, Japanese, and Hebrew */ - if (flags & 0x10000000) - WARN("Ignoring unknown flags 0x10000000\n"); + if (flags & semistub_flags) + FIXME("semi-stub behavor for flag(s) 0x%x\n", flags & semistub_flags); if (len1 < 0) len1 = strlenW(str1); if (len2 < 0) len2 = strlenW(str2); diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c index fc071a7d7b2..d3c77d0143d 100644 --- a/dlls/kernel32/tests/locale.c +++ b/dlls/kernel32/tests/locale.c @@ -1543,7 +1543,7 @@ static const struct comparestringex_test comparestringex_tests[] = { }, { /* 13 */ "tr-TR", NORM_LINGUISTIC_CASING, - {'i',0}, {0x130,0}, CSTR_LESS_THAN, -1, TRUE + {'i',0}, {0x130,0}, CSTR_LESS_THAN, -1, FALSE }, { /* 14 */ "tr-TR", NORM_LINGUISTIC_CASING, @@ -1593,7 +1593,7 @@ static const struct comparestringex_test comparestringex_tests[] = { }, { /* 25 */ "tr-TR", NORM_LINGUISTIC_CASING | NORM_IGNORECASE, - {'i',0}, {0x130,0}, CSTR_EQUAL, CSTR_LESS_THAN, TRUE + {'i',0}, {0x130,0}, CSTR_EQUAL, CSTR_LESS_THAN, FALSE }, { /* 26 */ "tr-TR", NORM_LINGUISTIC_CASING | NORM_IGNORECASE,