Commit 0e234f3c authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

kernel32: Partial CompareStringEx implementation.

parent 31fc6814
...@@ -200,6 +200,7 @@ ...@@ -200,6 +200,7 @@
@ stdcall CompareFileTime(ptr ptr) @ stdcall CompareFileTime(ptr ptr)
@ stdcall CompareStringA(long long str long str long) @ stdcall CompareStringA(long long str long str long)
@ stdcall CompareStringW(long long wstr long wstr long) @ stdcall CompareStringW(long long wstr long wstr long)
@ stdcall CompareStringEx(wstr long wstr long wstr long ptr ptr long)
@ stdcall ConnectNamedPipe(long ptr) @ stdcall ConnectNamedPipe(long ptr)
@ stub ConsoleMenuControl @ stub ConsoleMenuControl
@ stub ConsoleSubst @ stub ConsoleSubst
......
...@@ -2865,18 +2865,31 @@ INT WINAPI FoldStringW(DWORD dwFlags, LPCWSTR src, INT srclen, ...@@ -2865,18 +2865,31 @@ INT WINAPI FoldStringW(DWORD dwFlags, LPCWSTR src, INT srclen,
* *
* See CompareStringA. * See CompareStringA.
*/ */
INT WINAPI CompareStringW(LCID lcid, DWORD style, INT WINAPI CompareStringW(LCID lcid, DWORD flags,
LPCWSTR str1, INT len1, LPCWSTR str2, INT len2) LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
{ {
return CompareStringEx(NULL, flags, str1, len1, str2, len2, NULL, NULL, 0);
}
/******************************************************************************
* CompareStringEx (KERNEL32.@)
*/
INT WINAPI CompareStringEx(LPCWSTR locale, DWORD flags, LPCWSTR str1, INT len1,
LPCWSTR str2, INT len2, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lParam)
{
INT ret; INT ret;
if (version) FIXME("unexpected version parameter\n");
if (reserved) FIXME("unexpected reserved value\n");
if (lParam) FIXME("unexpected lParam\n");
if (!str1 || !str2) if (!str1 || !str2)
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return 0; return 0;
} }
if( style & ~(NORM_IGNORECASE|NORM_IGNORENONSPACE|NORM_IGNORESYMBOLS| if( flags & ~(NORM_IGNORECASE|NORM_IGNORENONSPACE|NORM_IGNORESYMBOLS|
SORT_STRINGSORT|NORM_IGNOREKANATYPE|NORM_IGNOREWIDTH|LOCALE_USE_CP_ACP|0x10000000) ) SORT_STRINGSORT|NORM_IGNOREKANATYPE|NORM_IGNOREWIDTH|LOCALE_USE_CP_ACP|0x10000000) )
{ {
SetLastError(ERROR_INVALID_FLAGS); SetLastError(ERROR_INVALID_FLAGS);
...@@ -2884,13 +2897,13 @@ INT WINAPI CompareStringW(LCID lcid, DWORD style, ...@@ -2884,13 +2897,13 @@ INT WINAPI CompareStringW(LCID lcid, DWORD style,
} }
/* this style is related to diacritics in Arabic, Japanese, and Hebrew */ /* this style is related to diacritics in Arabic, Japanese, and Hebrew */
if (style & 0x10000000) if (flags & 0x10000000)
WARN("Ignoring unknown style 0x10000000\n"); WARN("Ignoring unknown flags 0x10000000\n");
if (len1 < 0) len1 = strlenW(str1); if (len1 < 0) len1 = strlenW(str1);
if (len2 < 0) len2 = strlenW(str2); if (len2 < 0) len2 = strlenW(str2);
ret = wine_compare_string(style, str1, len1, str2, len2); ret = wine_compare_string(flags, str1, len1, str2, len2);
if (ret) /* need to translate result */ if (ret) /* need to translate result */
return (ret < 0) ? CSTR_LESS_THAN : CSTR_GREATER_THAN; return (ret < 0) ? CSTR_LESS_THAN : CSTR_GREATER_THAN;
...@@ -2904,7 +2917,7 @@ INT WINAPI CompareStringW(LCID lcid, DWORD style, ...@@ -2904,7 +2917,7 @@ INT WINAPI CompareStringW(LCID lcid, DWORD style,
* *
* PARAMS * PARAMS
* lcid [I] LCID for the comparison * lcid [I] LCID for the comparison
* style [I] Flags for the comparison (NORM_ constants from "winnls.h"). * flags [I] Flags for the comparison (NORM_ constants from "winnls.h").
* str1 [I] First string to compare * str1 [I] First string to compare
* len1 [I] Length of str1, or -1 if str1 is NUL terminated * len1 [I] Length of str1, or -1 if str1 is NUL terminated
* str2 [I] Second string to compare * str2 [I] Second string to compare
...@@ -2915,7 +2928,7 @@ INT WINAPI CompareStringW(LCID lcid, DWORD style, ...@@ -2915,7 +2928,7 @@ INT WINAPI CompareStringW(LCID lcid, DWORD style,
* str1 is less than, equal to or greater than str2 respectively. * str1 is less than, equal to or greater than str2 respectively.
* Failure: FALSE. Use GetLastError() to determine the cause. * Failure: FALSE. Use GetLastError() to determine the cause.
*/ */
INT WINAPI CompareStringA(LCID lcid, DWORD style, INT WINAPI CompareStringA(LCID lcid, DWORD flags,
LPCSTR str1, INT len1, LPCSTR str2, INT len2) LPCSTR str1, INT len1, LPCSTR str2, INT len2)
{ {
WCHAR *buf1W = NtCurrentTeb()->StaticUnicodeBuffer; WCHAR *buf1W = NtCurrentTeb()->StaticUnicodeBuffer;
...@@ -2932,7 +2945,7 @@ INT WINAPI CompareStringA(LCID lcid, DWORD style, ...@@ -2932,7 +2945,7 @@ INT WINAPI CompareStringA(LCID lcid, DWORD style,
if (len1 < 0) len1 = strlen(str1); if (len1 < 0) len1 = strlen(str1);
if (len2 < 0) len2 = strlen(str2); if (len2 < 0) len2 = strlen(str2);
if (!(style & LOCALE_USE_CP_ACP)) locale_cp = get_lcid_codepage( lcid ); if (!(flags & LOCALE_USE_CP_ACP)) locale_cp = get_lcid_codepage( lcid );
if (len1) if (len1)
{ {
...@@ -2981,7 +2994,7 @@ INT WINAPI CompareStringA(LCID lcid, DWORD style, ...@@ -2981,7 +2994,7 @@ INT WINAPI CompareStringA(LCID lcid, DWORD style,
str2W = buf2W; str2W = buf2W;
} }
ret = CompareStringW(lcid, style, str1W, len1W, str2W, len2W); ret = CompareStringEx(NULL, flags, str1W, len1W, str2W, len2W, NULL, NULL, 0);
if (str1W != buf1W) HeapFree(GetProcessHeap(), 0, str1W); if (str1W != buf1W) HeapFree(GetProcessHeap(), 0, str1W);
if (str2W != buf2W) HeapFree(GetProcessHeap(), 0, str2W); if (str2W != buf2W) HeapFree(GetProcessHeap(), 0, str2W);
......
...@@ -772,6 +772,7 @@ enum SYSGEOCLASS ...@@ -772,6 +772,7 @@ enum SYSGEOCLASS
WINBASEAPI INT WINAPI CompareStringA(LCID,DWORD,LPCSTR,INT,LPCSTR,INT); WINBASEAPI INT WINAPI CompareStringA(LCID,DWORD,LPCSTR,INT,LPCSTR,INT);
WINBASEAPI INT WINAPI CompareStringW(LCID,DWORD,LPCWSTR,INT,LPCWSTR,INT); WINBASEAPI INT WINAPI CompareStringW(LCID,DWORD,LPCWSTR,INT,LPCWSTR,INT);
#define CompareString WINELIB_NAME_AW(CompareString) #define CompareString WINELIB_NAME_AW(CompareString)
WINBASEAPI INT WINAPI CompareStringEx(LPCWSTR,DWORD,LPCWSTR,INT,LPCWSTR,INT,LPNLSVERSIONINFO,LPVOID,LPARAM);
WINBASEAPI LCID WINAPI ConvertDefaultLocale(LCID); WINBASEAPI LCID WINAPI ConvertDefaultLocale(LCID);
WINBASEAPI BOOL WINAPI EnumCalendarInfoA(CALINFO_ENUMPROCA,LCID,CALID,CALTYPE); WINBASEAPI BOOL WINAPI EnumCalendarInfoA(CALINFO_ENUMPROCA,LCID,CALID,CALTYPE);
WINBASEAPI BOOL WINAPI EnumCalendarInfoW(CALINFO_ENUMPROCW,LCID,CALID,CALTYPE); WINBASEAPI BOOL WINAPI EnumCalendarInfoW(CALINFO_ENUMPROCW,LCID,CALID,CALTYPE);
......
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