Nikolay Sivov : kernel32: Partial CompareStringEx implementation.
Alexandre Julliard
julliard at winehq.org
Fri Jul 20 15:29:58 CDT 2012
Module: wine
Branch: master
Commit: 0e234f3c25383b8576deab5d7c8517edb03c100b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0e234f3c25383b8576deab5d7c8517edb03c100b
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Jul 20 10:30:46 2012 +0400
kernel32: Partial CompareStringEx implementation.
---
dlls/kernel32/kernel32.spec | 1 +
dlls/kernel32/locale.c | 31 ++++++++++++++++++++++---------
include/winnls.h | 1 +
3 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index 7c8f9e2..c5518ce 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -200,6 +200,7 @@
@ stdcall CompareFileTime(ptr ptr)
@ stdcall CompareStringA(long long str long str long)
@ stdcall CompareStringW(long long wstr long wstr long)
+@ stdcall CompareStringEx(wstr long wstr long wstr long ptr ptr long)
@ stdcall ConnectNamedPipe(long ptr)
@ stub ConsoleMenuControl
@ stub ConsoleSubst
diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 748969e..d627bdb 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -2865,18 +2865,31 @@ INT WINAPI FoldStringW(DWORD dwFlags, LPCWSTR src, INT srclen,
*
* See CompareStringA.
*/
-INT WINAPI CompareStringW(LCID lcid, DWORD style,
+INT WINAPI CompareStringW(LCID lcid, DWORD flags,
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;
+ if (version) FIXME("unexpected version parameter\n");
+ if (reserved) FIXME("unexpected reserved value\n");
+ if (lParam) FIXME("unexpected lParam\n");
+
if (!str1 || !str2)
{
SetLastError(ERROR_INVALID_PARAMETER);
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) )
{
SetLastError(ERROR_INVALID_FLAGS);
@@ -2884,13 +2897,13 @@ INT WINAPI CompareStringW(LCID lcid, DWORD style,
}
/* this style is related to diacritics in Arabic, Japanese, and Hebrew */
- if (style & 0x10000000)
- WARN("Ignoring unknown style 0x10000000\n");
+ if (flags & 0x10000000)
+ WARN("Ignoring unknown flags 0x10000000\n");
if (len1 < 0) len1 = strlenW(str1);
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 */
return (ret < 0) ? CSTR_LESS_THAN : CSTR_GREATER_THAN;
@@ -2904,7 +2917,7 @@ INT WINAPI CompareStringW(LCID lcid, DWORD style,
*
* PARAMS
* 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
* len1 [I] Length of str1, or -1 if str1 is NUL terminated
* str2 [I] Second string to compare
@@ -2915,7 +2928,7 @@ INT WINAPI CompareStringW(LCID lcid, DWORD style,
* str1 is less than, equal to or greater than str2 respectively.
* 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)
{
WCHAR *buf1W = NtCurrentTeb()->StaticUnicodeBuffer;
@@ -2932,7 +2945,7 @@ INT WINAPI CompareStringA(LCID lcid, DWORD style,
if (len1 < 0) len1 = strlen(str1);
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)
{
@@ -2981,7 +2994,7 @@ INT WINAPI CompareStringA(LCID lcid, DWORD style,
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 (str2W != buf2W) HeapFree(GetProcessHeap(), 0, str2W);
diff --git a/include/winnls.h b/include/winnls.h
index b52209c..d6bbc13 100644
--- a/include/winnls.h
+++ b/include/winnls.h
@@ -772,6 +772,7 @@ enum SYSGEOCLASS
WINBASEAPI INT WINAPI CompareStringA(LCID,DWORD,LPCSTR,INT,LPCSTR,INT);
WINBASEAPI INT WINAPI CompareStringW(LCID,DWORD,LPCWSTR,INT,LPCWSTR,INT);
#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 BOOL WINAPI EnumCalendarInfoA(CALINFO_ENUMPROCA,LCID,CALID,CALTYPE);
WINBASEAPI BOOL WINAPI EnumCalendarInfoW(CALINFO_ENUMPROCW,LCID,CALID,CALTYPE);
More information about the wine-cvs
mailing list