2 * String manipulation functions
4 * Copyright 1998 Eric Kohl
5 * 1998 Juergen Schmied <j.schmied@metronet.de>
6 * 2000 Eric Kohl for CodeWeavers
7 * Copyright 2002 Jon Griffiths
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "wine/port.h"
30 #include <stdlib.h> /* atoi */
39 #include "wine/unicode.h"
41 #include "wine/debug.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(commctrl
);
45 /*************************************************************************
46 * COMCTL32_ChrCmpHelperA
48 * Internal helper for ChrCmpA/COMCTL32_ChrCmpIA.
51 * Both this function and its Unicode counterpart are very inefficient. To
52 * fix this, CompareString must be completely implemented and optimised
53 * first. Then the core character test can be taken out of that function and
54 * placed here, so that it need never be called at all. Until then, do not
55 * attempt to optimise this code unless you are willing to test that it
56 * still performs correctly.
58 static BOOL
COMCTL32_ChrCmpHelperA(WORD ch1
, WORD ch2
, DWORD dwFlags
)
60 char str1
[3], str2
[3];
62 str1
[0] = LOBYTE(ch1
);
63 if (IsDBCSLeadByte(str1
[0]))
65 str1
[1] = HIBYTE(ch1
);
71 str2
[0] = LOBYTE(ch2
);
72 if (IsDBCSLeadByte(str2
[0]))
74 str2
[1] = HIBYTE(ch2
);
80 return CompareStringA(GetThreadLocale(), dwFlags
, str1
, -1, str2
, -1) - CSTR_EQUAL
;
83 /*************************************************************************
84 * COMCTL32_ChrCmpA (internal)
86 * Internal helper function.
88 static BOOL
COMCTL32_ChrCmpA(WORD ch1
, WORD ch2
)
90 return COMCTL32_ChrCmpHelperA(ch1
, ch2
, 0);
93 /*************************************************************************
94 * COMCTL32_ChrCmpIA (internal)
96 * Compare two characters, ignoring case.
99 * ch1 [I] First character to compare
100 * ch2 [I] Second character to compare
103 * FALSE, if the characters are equal.
104 * Non-zero otherwise.
106 static BOOL
COMCTL32_ChrCmpIA(WORD ch1
, WORD ch2
)
108 TRACE("(%d,%d)\n", ch1
, ch2
);
110 return COMCTL32_ChrCmpHelperA(ch1
, ch2
, NORM_IGNORECASE
);
113 /*************************************************************************
116 * Internal helper function.
118 static inline BOOL
COMCTL32_ChrCmpIW(WCHAR ch1
, WCHAR ch2
)
120 return CompareStringW(GetThreadLocale(), NORM_IGNORECASE
, &ch1
, 1, &ch2
, 1) - CSTR_EQUAL
;
123 /**************************************************************************
124 * Str_GetPtrA [COMCTL32.233]
126 * Copies a string into a destination buffer.
129 * lpSrc [I] Source string
130 * lpDest [O] Destination buffer
131 * nMaxLen [I] Size of buffer in characters
134 * The number of characters copied.
136 INT WINAPI
Str_GetPtrA (LPCSTR lpSrc
, LPSTR lpDest
, INT nMaxLen
)
140 TRACE("(%p %p %d)\n", lpSrc
, lpDest
, nMaxLen
);
142 if ((!lpDest
|| nMaxLen
== 0) && lpSrc
)
143 return (strlen(lpSrc
) + 1);
153 len
= strlen(lpSrc
) + 1;
157 RtlMoveMemory (lpDest
, lpSrc
, len
- 1);
158 lpDest
[len
- 1] = '\0';
163 /**************************************************************************
164 * Str_SetPtrA [COMCTL32.234]
166 * Makes a copy of a string, allocating memory if necessary.
169 * lppDest [O] Pointer to destination string
170 * lpSrc [I] Source string
177 * Set lpSrc to NULL to free the memory allocated by a previous call
180 BOOL WINAPI
Str_SetPtrA (LPSTR
*lppDest
, LPCSTR lpSrc
)
182 TRACE("(%p %p)\n", lppDest
, lpSrc
);
185 LPSTR ptr
= ReAlloc (*lppDest
, strlen (lpSrc
) + 1);
199 /**************************************************************************
200 * Str_GetPtrW [COMCTL32.235]
204 INT WINAPI
Str_GetPtrW (LPCWSTR lpSrc
, LPWSTR lpDest
, INT nMaxLen
)
208 TRACE("(%p %p %d)\n", lpSrc
, lpDest
, nMaxLen
);
210 if (!lpDest
&& lpSrc
)
211 return strlenW (lpSrc
);
221 len
= strlenW (lpSrc
);
225 RtlMoveMemory (lpDest
, lpSrc
, len
*sizeof(WCHAR
));
231 /**************************************************************************
232 * Str_SetPtrW [COMCTL32.236]
236 BOOL WINAPI
Str_SetPtrW (LPWSTR
*lppDest
, LPCWSTR lpSrc
)
238 TRACE("(%p %s)\n", lppDest
, debugstr_w(lpSrc
));
241 INT len
= strlenW (lpSrc
) + 1;
242 LPWSTR ptr
= ReAlloc (*lppDest
, len
* sizeof(WCHAR
));
245 strcpyW (ptr
, lpSrc
);
256 /**************************************************************************
257 * StrChrA [COMCTL32.350]
259 * Find a given character in a string.
262 * lpszStr [I] String to search in.
263 * ch [I] Character to search for.
266 * Success: A pointer to the first occurrence of ch in lpszStr, or NULL if
268 * Failure: NULL, if any arguments are invalid.
270 LPSTR WINAPI
StrChrA(LPCSTR lpszStr
, WORD ch
)
272 TRACE("(%s,%i)\n", debugstr_a(lpszStr
), ch
);
278 if (!COMCTL32_ChrCmpA(*lpszStr
, ch
))
279 return (LPSTR
)lpszStr
;
280 lpszStr
= CharNextA(lpszStr
);
286 /**************************************************************************
287 * StrCmpNIA [COMCTL32.353]
289 * Compare two strings, up to a maximum length, ignoring case.
292 * lpszStr [I] First string to compare
293 * lpszComp [I] Second string to compare
294 * iLen [I] Number of chars to compare
297 * An integer less than, equal to or greater than 0, indicating that
298 * lpszStr is less than, the same, or greater than lpszComp.
300 INT WINAPI
StrCmpNIA(LPCSTR lpszStr
, LPCSTR lpszComp
, INT iLen
)
302 TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr
), debugstr_a(lpszComp
), iLen
);
303 return CompareStringA(GetThreadLocale(), NORM_IGNORECASE
, lpszStr
, iLen
, lpszComp
, iLen
) - CSTR_EQUAL
;
306 /*************************************************************************
307 * StrCmpNIW [COMCTL32.361]
311 INT WINAPI
StrCmpNIW(LPCWSTR lpszStr
, LPCWSTR lpszComp
, INT iLen
)
313 TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr
), debugstr_w(lpszComp
), iLen
);
314 return CompareStringW(GetThreadLocale(), NORM_IGNORECASE
, lpszStr
, iLen
, lpszComp
, iLen
) - CSTR_EQUAL
;
317 /*************************************************************************
318 * COMCTL32_StrStrHelperA
320 * Internal implementation of StrStrA/StrStrIA
322 static LPSTR
COMCTL32_StrStrHelperA(LPCSTR lpszStr
, LPCSTR lpszSearch
,
323 INT (WINAPI
*pStrCmpFn
)(LPCSTR
,LPCSTR
,INT
))
328 if (!lpszStr
|| !lpszSearch
|| !*lpszSearch
)
331 iLen
= strlen(lpszSearch
);
332 end
= lpszStr
+ strlen(lpszStr
);
334 while (lpszStr
+ iLen
<= end
)
336 if (!pStrCmpFn(lpszStr
, lpszSearch
, iLen
))
337 return (LPSTR
)lpszStr
;
338 lpszStr
= CharNextA(lpszStr
);
343 /**************************************************************************
344 * StrStrIA [COMCTL32.355]
346 * Find a substring within a string, ignoring case.
349 * lpszStr [I] String to search in
350 * lpszSearch [I] String to look for
353 * The start of lpszSearch within lpszStr, or NULL if not found.
355 LPSTR WINAPI
StrStrIA(LPCSTR lpszStr
, LPCSTR lpszSearch
)
357 TRACE("(%s,%s)\n", debugstr_a(lpszStr
), debugstr_a(lpszSearch
));
359 return COMCTL32_StrStrHelperA(lpszStr
, lpszSearch
, StrCmpNIA
);
362 /**************************************************************************
363 * StrToIntA [COMCTL32.357]
365 * Read a signed integer from a string.
368 * lpszStr [I] String to read integer from
371 * The signed integer value represented by the string, or 0 if no integer is
374 INT WINAPI
StrToIntA (LPCSTR lpszStr
)
376 return atoi(lpszStr
);
379 /**************************************************************************
380 * StrStrIW [COMCTL32.363]
384 LPWSTR WINAPI
StrStrIW(LPCWSTR lpszStr
, LPCWSTR lpszSearch
)
389 TRACE("(%s,%s)\n", debugstr_w(lpszStr
), debugstr_w(lpszSearch
));
391 if (!lpszStr
|| !lpszSearch
|| !*lpszSearch
)
394 iLen
= strlenW(lpszSearch
);
395 end
= lpszStr
+ strlenW(lpszStr
);
397 while (lpszStr
+ iLen
<= end
)
399 if (!StrCmpNIW(lpszStr
, lpszSearch
, iLen
))
400 return (LPWSTR
)lpszStr
;
406 /**************************************************************************
407 * StrToIntW [COMCTL32.365]
411 INT WINAPI
StrToIntW (LPCWSTR lpString
)
413 return atoiW(lpString
);
416 /*************************************************************************
417 * COMCTL32_StrSpnHelperA (internal)
419 * Internal implementation of StrSpnA/StrCSpnA/StrCSpnIA
421 static int COMCTL32_StrSpnHelperA(LPCSTR lpszStr
, LPCSTR lpszMatch
,
422 LPSTR (WINAPI
*pStrChrFn
)(LPCSTR
,WORD
),
425 LPCSTR lpszRead
= lpszStr
;
426 if (lpszStr
&& *lpszStr
&& lpszMatch
)
430 LPCSTR lpszTest
= pStrChrFn(lpszMatch
, *lpszRead
);
432 if (!bInvert
&& !lpszTest
)
434 if (bInvert
&& lpszTest
)
436 lpszRead
= CharNextA(lpszRead
);
439 return lpszRead
- lpszStr
;
442 /**************************************************************************
443 * StrCSpnA [COMCTL32.356]
445 * Find the length of the start of a string that does not contain certain
449 * lpszStr [I] String to search
450 * lpszMatch [I] Characters that cannot be in the substring
453 * The length of the part of lpszStr containing only chars not in lpszMatch,
454 * or 0 if any parameter is invalid.
456 int WINAPI
StrCSpnA(LPCSTR lpszStr
, LPCSTR lpszMatch
)
458 TRACE("(%s,%s)\n",debugstr_a(lpszStr
), debugstr_a(lpszMatch
));
460 return COMCTL32_StrSpnHelperA(lpszStr
, lpszMatch
, StrChrA
, TRUE
);
463 /**************************************************************************
464 * StrChrW [COMCTL32.358]
468 LPWSTR WINAPI
StrChrW(LPCWSTR lpszStr
, WCHAR ch
)
470 LPWSTR lpszRet
= NULL
;
472 TRACE("(%s,%i)\n", debugstr_w(lpszStr
), ch
);
475 lpszRet
= strchrW(lpszStr
, ch
);
479 /**************************************************************************
480 * StrCmpNA [COMCTL32.352]
482 * Compare two strings, up to a maximum length.
485 * lpszStr [I] First string to compare
486 * lpszComp [I] Second string to compare
487 * iLen [I] Number of chars to compare
490 * An integer less than, equal to or greater than 0, indicating that
491 * lpszStr is less than, the same, or greater than lpszComp.
493 INT WINAPI
StrCmpNA(LPCSTR lpszStr
, LPCSTR lpszComp
, INT iLen
)
495 TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr
), debugstr_a(lpszComp
), iLen
);
496 return CompareStringA(GetThreadLocale(), 0, lpszStr
, iLen
, lpszComp
, iLen
) - CSTR_EQUAL
;
499 /**************************************************************************
500 * StrCmpNW [COMCTL32.360]
504 INT WINAPI
StrCmpNW(LPCWSTR lpszStr
, LPCWSTR lpszComp
, INT iLen
)
506 TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr
), debugstr_w(lpszComp
), iLen
);
507 return CompareStringW(GetThreadLocale(), 0, lpszStr
, iLen
, lpszComp
, iLen
) - CSTR_EQUAL
;
510 /**************************************************************************
511 * StrRChrA [COMCTL32.351]
513 * Find the last occurrence of a character in string.
516 * lpszStr [I] String to search in
517 * lpszEnd [I] Place to end search, or NULL to search until the end of lpszStr
518 * ch [I] Character to search for.
521 * Success: A pointer to the last occurrence of ch in lpszStr before lpszEnd,
522 * or NULL if not found.
523 * Failure: NULL, if any arguments are invalid.
525 LPSTR WINAPI
StrRChrA(LPCSTR lpszStr
, LPCSTR lpszEnd
, WORD ch
)
527 LPCSTR lpszRet
= NULL
;
529 TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr
), debugstr_a(lpszEnd
), ch
);
536 lpszEnd
= lpszStr
+ lstrlenA(lpszStr
);
538 while (*lpszStr
&& lpszStr
<= lpszEnd
)
540 ch2
= IsDBCSLeadByte(*lpszStr
)? *lpszStr
<< 8 | lpszStr
[1] : *lpszStr
;
542 if (!COMCTL32_ChrCmpA(ch
, ch2
))
544 lpszStr
= CharNextA(lpszStr
);
547 return (LPSTR
)lpszRet
;
551 /**************************************************************************
552 * StrRChrW [COMCTL32.359]
556 LPWSTR WINAPI
StrRChrW(LPCWSTR str
, LPCWSTR end
, WORD ch
)
560 if (!str
) return NULL
;
561 if (!end
) end
= str
+ strlenW(str
);
564 if (*str
== ch
) ret
= (WCHAR
*)str
;
570 /**************************************************************************
571 * StrStrA [COMCTL32.354]
573 * Find a substring within a string.
576 * lpszStr [I] String to search in
577 * lpszSearch [I] String to look for
580 * The start of lpszSearch within lpszStr, or NULL if not found.
582 LPSTR WINAPI
StrStrA(LPCSTR lpszStr
, LPCSTR lpszSearch
)
584 TRACE("(%s,%s)\n", debugstr_a(lpszStr
), debugstr_a(lpszSearch
));
586 return COMCTL32_StrStrHelperA(lpszStr
, lpszSearch
, StrCmpNA
);
589 /**************************************************************************
590 * StrStrW [COMCTL32.362]
594 LPWSTR WINAPI
StrStrW(LPCWSTR lpszStr
, LPCWSTR lpszSearch
)
596 if (!lpszStr
|| !lpszSearch
) return NULL
;
597 return strstrW( lpszStr
, lpszSearch
);
600 /*************************************************************************
601 * StrChrIA [COMCTL32.366]
603 * Find a given character in a string, ignoring case.
606 * lpszStr [I] String to search in.
607 * ch [I] Character to search for.
610 * Success: A pointer to the first occurrence of ch in lpszStr, or NULL if
612 * Failure: NULL, if any arguments are invalid.
614 LPSTR WINAPI
StrChrIA(LPCSTR lpszStr
, WORD ch
)
616 TRACE("(%s,%i)\n", debugstr_a(lpszStr
), ch
);
622 if (!COMCTL32_ChrCmpIA(*lpszStr
, ch
))
623 return (LPSTR
)lpszStr
;
624 lpszStr
= CharNextA(lpszStr
);
630 /*************************************************************************
631 * StrChrIW [COMCTL32.367]
635 LPWSTR WINAPI
StrChrIW(LPCWSTR lpszStr
, WCHAR ch
)
637 TRACE("(%s,%i)\n", debugstr_w(lpszStr
), ch
);
644 if (toupperW(*lpszStr
) == ch
)
645 return (LPWSTR
)lpszStr
;
650 return (LPWSTR
)lpszStr
;
653 /*************************************************************************
654 * StrRStrIA [COMCTL32.372]
656 * Find the last occurrence of a substring within a string.
659 * lpszStr [I] String to search in
660 * lpszEnd [I] End of lpszStr
661 * lpszSearch [I] String to look for
664 * The last occurrence lpszSearch within lpszStr, or NULL if not found.
666 LPSTR WINAPI
StrRStrIA(LPCSTR lpszStr
, LPCSTR lpszEnd
, LPCSTR lpszSearch
)
668 LPSTR lpszRet
= NULL
;
672 TRACE("(%s,%s)\n", debugstr_a(lpszStr
), debugstr_a(lpszSearch
));
674 if (!lpszStr
|| !lpszSearch
|| !*lpszSearch
)
677 if (IsDBCSLeadByte(*lpszSearch
))
678 ch1
= *lpszSearch
<< 8 | (UCHAR
)lpszSearch
[1];
681 iLen
= lstrlenA(lpszSearch
);
684 lpszEnd
= lpszStr
+ lstrlenA(lpszStr
);
685 else /* reproduce the broken behaviour on Windows */
686 lpszEnd
+= min(iLen
- 1, lstrlenA(lpszEnd
));
688 while (lpszStr
+ iLen
<= lpszEnd
&& *lpszStr
)
690 ch2
= IsDBCSLeadByte(*lpszStr
)? *lpszStr
<< 8 | (UCHAR
)lpszStr
[1] : *lpszStr
;
691 if (!COMCTL32_ChrCmpIA(ch1
, ch2
))
693 if (!StrCmpNIA(lpszStr
, lpszSearch
, iLen
))
694 lpszRet
= (LPSTR
)lpszStr
;
696 lpszStr
= CharNextA(lpszStr
);
701 /*************************************************************************
702 * StrRStrIW [COMCTL32.373]
706 LPWSTR WINAPI
StrRStrIW(LPCWSTR lpszStr
, LPCWSTR lpszEnd
, LPCWSTR lpszSearch
)
708 LPWSTR lpszRet
= NULL
;
711 TRACE("(%s,%s)\n", debugstr_w(lpszStr
), debugstr_w(lpszSearch
));
713 if (!lpszStr
|| !lpszSearch
|| !*lpszSearch
)
716 iLen
= strlenW(lpszSearch
);
719 lpszEnd
= lpszStr
+ strlenW(lpszStr
);
720 else /* reproduce the broken behaviour on Windows */
721 lpszEnd
+= min(iLen
- 1, lstrlenW(lpszEnd
));
724 while (lpszStr
+ iLen
<= lpszEnd
&& *lpszStr
)
726 if (!COMCTL32_ChrCmpIW(*lpszSearch
, *lpszStr
))
728 if (!StrCmpNIW(lpszStr
, lpszSearch
, iLen
))
729 lpszRet
= (LPWSTR
)lpszStr
;
736 /*************************************************************************
737 * StrCSpnIA [COMCTL32.374]
739 * Find the length of the start of a string that does not contain certain
740 * characters, ignoring case.
743 * lpszStr [I] String to search
744 * lpszMatch [I] Characters that cannot be in the substring
747 * The length of the part of lpszStr containing only chars not in lpszMatch,
748 * or 0 if any parameter is invalid.
750 int WINAPI
StrCSpnIA(LPCSTR lpszStr
, LPCSTR lpszMatch
)
752 TRACE("(%s,%s)\n",debugstr_a(lpszStr
), debugstr_a(lpszMatch
));
754 return COMCTL32_StrSpnHelperA(lpszStr
, lpszMatch
, StrChrIA
, TRUE
);
757 /*************************************************************************
758 * StrCSpnIW [COMCTL32.375]
762 int WINAPI
StrCSpnIW(LPCWSTR lpszStr
, LPCWSTR lpszMatch
)
764 LPCWSTR lpszRead
= lpszStr
;
766 TRACE("(%s,%s)\n",debugstr_w(lpszStr
), debugstr_w(lpszMatch
));
768 if (lpszStr
&& *lpszStr
&& lpszMatch
)
772 if (StrChrIW(lpszMatch
, *lpszRead
)) break;
776 return lpszRead
- lpszStr
;
779 /**************************************************************************
780 * StrRChrIA [COMCTL32.368]
782 * Find the last occurrence of a character in string, ignoring case.
785 * lpszStr [I] String to search in
786 * lpszEnd [I] Place to end search, or NULL to search until the end of lpszStr
787 * ch [I] Character to search for.
790 * Success: A pointer to the last occurrence of ch in lpszStr before lpszEnd,
791 * or NULL if not found.
792 * Failure: NULL, if any arguments are invalid.
794 LPSTR WINAPI
StrRChrIA(LPCSTR lpszStr
, LPCSTR lpszEnd
, WORD ch
)
796 LPCSTR lpszRet
= NULL
;
798 TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr
), debugstr_a(lpszEnd
), ch
);
805 lpszEnd
= lpszStr
+ lstrlenA(lpszStr
);
807 while (*lpszStr
&& lpszStr
<= lpszEnd
)
809 ch2
= IsDBCSLeadByte(*lpszStr
)? *lpszStr
<< 8 | lpszStr
[1] : *lpszStr
;
813 lpszStr
= CharNextA(lpszStr
);
816 return (LPSTR
)lpszRet
;
819 /**************************************************************************
820 * StrRChrIW [COMCTL32.369]
824 LPWSTR WINAPI
StrRChrIW(LPCWSTR str
, LPCWSTR end
, WORD ch
)
828 if (!str
) return NULL
;
829 if (!end
) end
= str
+ strlenW(str
);
832 if (!COMCTL32_ChrCmpIW(*str
, ch
)) ret
= (WCHAR
*)str
;
838 /*************************************************************************
839 * StrCSpnW [COMCTL32.364]
843 int WINAPI
StrCSpnW(LPCWSTR lpszStr
, LPCWSTR lpszMatch
)
845 if (!lpszStr
|| !lpszMatch
) return 0;
846 return strcspnW( lpszStr
, lpszMatch
);
849 /*************************************************************************
850 * IntlStrEqWorkerA [COMCTL32.376]
852 * Compare two strings.
855 * bCase [I] Whether to compare case sensitively
856 * lpszStr [I] First string to compare
857 * lpszComp [I] Second string to compare
858 * iLen [I] Length to compare
861 * TRUE If the strings are equal.
864 BOOL WINAPI
IntlStrEqWorkerA(BOOL bCase
, LPCSTR lpszStr
, LPCSTR lpszComp
,
870 TRACE("(%d,%s,%s,%d)\n", bCase
,
871 debugstr_a(lpszStr
), debugstr_a(lpszComp
), iLen
);
873 /* FIXME: This flag is undocumented and unknown by our CompareString.
875 dwFlags
= LOCALE_RETURN_GENITIVE_NAMES
;
876 if (!bCase
) dwFlags
|= NORM_IGNORECASE
;
878 iRet
= CompareStringA(GetThreadLocale(),
879 dwFlags
, lpszStr
, iLen
, lpszComp
, iLen
);
882 iRet
= CompareStringA(2048, dwFlags
, lpszStr
, iLen
, lpszComp
, iLen
);
884 return iRet
== CSTR_EQUAL
;
887 /*************************************************************************
888 * IntlStrEqWorkerW [COMCTL32.377]
890 * See IntlStrEqWorkerA.
892 BOOL WINAPI
IntlStrEqWorkerW(BOOL bCase
, LPCWSTR lpszStr
, LPCWSTR lpszComp
,
898 TRACE("(%d,%s,%s,%d)\n", bCase
,
899 debugstr_w(lpszStr
),debugstr_w(lpszComp
), iLen
);
901 /* FIXME: This flag is undocumented and unknown by our CompareString.
903 dwFlags
= LOCALE_RETURN_GENITIVE_NAMES
;
904 if (!bCase
) dwFlags
|= NORM_IGNORECASE
;
906 iRet
= CompareStringW(GetThreadLocale(),
907 dwFlags
, lpszStr
, iLen
, lpszComp
, iLen
);
910 iRet
= CompareStringW(2048, dwFlags
, lpszStr
, iLen
, lpszComp
, iLen
);
912 return iRet
== CSTR_EQUAL
;