Add cyrillic glyphs to Wine System.
[wine/dcerpc.git] / dlls / comctl32 / string.c
bloba67f6622fbba2681c4f1ae5ac32d38efd6c11671
1 /*
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include <stdarg.h>
26 #include <string.h>
27 #include <stdlib.h> /* atoi */
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winuser.h"
32 #include "winnls.h"
34 #include "wine/unicode.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
40 /*************************************************************************
41 * COMCTL32_ChrCmpHelperA
43 * Internal helper for ChrCmpA/COMCTL32_ChrCmpIA.
45 * NOTES
46 * Both this function and its Unicode counterpart are very inneficient. To
47 * fix this, CompareString must be completely implemented and optimised
48 * first. Then the core character test can be taken out of that function and
49 * placed here, so that it need never be called at all. Until then, do not
50 * attempt to optimise this code unless you are willing to test that it
51 * still performs correctly.
53 static BOOL COMCTL32_ChrCmpHelperA(WORD ch1, WORD ch2, DWORD dwFlags)
55 char str1[3], str2[3];
57 str1[0] = LOBYTE(ch1);
58 if (IsDBCSLeadByte(str1[0]))
60 str1[1] = HIBYTE(ch1);
61 str1[2] = '\0';
63 else
64 str1[1] = '\0';
66 str2[0] = LOBYTE(ch2);
67 if (IsDBCSLeadByte(str2[0]))
69 str2[1] = HIBYTE(ch2);
70 str2[2] = '\0';
72 else
73 str2[1] = '\0';
75 return CompareStringA(GetThreadLocale(), dwFlags, str1, -1, str2, -1) - 2;
78 /*************************************************************************
79 * COMCTL32_ChrCmpHelperW
81 * Internal helper for COMCTL32_ChrCmpW/ChrCmpIW.
83 static BOOL COMCTL32_ChrCmpHelperW(WCHAR ch1, WCHAR ch2, DWORD dwFlags)
85 WCHAR str1[2], str2[2];
87 str1[0] = ch1;
88 str1[1] = '\0';
89 str2[0] = ch2;
90 str2[1] = '\0';
91 return CompareStringW(GetThreadLocale(), dwFlags, str1, 2, str2, 2) - 2;
94 /*************************************************************************
95 * COMCTL32_ChrCmpA (internal)
97 * Internal helper function.
99 static BOOL COMCTL32_ChrCmpA(WORD ch1, WORD ch2)
101 return COMCTL32_ChrCmpHelperA(ch1, ch2, 0);
104 /*************************************************************************
105 * COMCTL32_ChrCmpIA (internal)
107 * Compare two characters, ignoring case.
109 * PARAMS
110 * ch1 [I] First character to compare
111 * ch2 [I] Second character to compare
113 * RETURNS
114 * FALSE, if the characters are equal.
115 * Non-zero otherwise.
117 static BOOL COMCTL32_ChrCmpIA(WORD ch1, WORD ch2)
119 TRACE("(%d,%d)\n", ch1, ch2);
121 return COMCTL32_ChrCmpHelperA(ch1, ch2, NORM_IGNORECASE);
124 /*************************************************************************
125 * COMCTL32_ChrCmpW
127 * Internal helper function.
129 static BOOL COMCTL32_ChrCmpW(WCHAR ch1, WCHAR ch2)
131 return COMCTL32_ChrCmpHelperW(ch1, ch2, 0);
134 /**************************************************************************
135 * StrChrA [COMCTL32.350]
137 * Find a given character in a string.
139 * PARAMS
140 * lpszStr [I] String to search in.
141 * ch [I] Character to search for.
143 * RETURNS
144 * Success: A pointer to the first occurrence of ch in lpszStr, or NULL if
145 * not found.
146 * Failure: NULL, if any arguments are invalid.
148 LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
150 TRACE("(%s,%i)\n", debugstr_a(lpszStr), ch);
152 if (lpszStr)
154 while (*lpszStr)
156 if (!COMCTL32_ChrCmpA(*lpszStr, ch))
157 return (LPSTR)lpszStr;
158 lpszStr = CharNextA(lpszStr);
161 return NULL;
164 /*************************************************************************
165 * COMCTL32_StrStrHelperA
167 * Internal implementation of StrStrA/StrStrIA
169 static LPSTR COMCTL32_StrStrHelperA(LPCSTR lpszStr, LPCSTR lpszSearch,
170 int (*pStrCmpFn)(LPCSTR,LPCSTR,size_t))
172 size_t iLen;
174 if (!lpszStr || !lpszSearch || !*lpszSearch)
175 return NULL;
177 iLen = strlen(lpszSearch);
179 while (*lpszStr)
181 if (!pStrCmpFn(lpszStr, lpszSearch, iLen))
182 return (LPSTR)lpszStr;
183 lpszStr = CharNextA(lpszStr);
185 return NULL;
188 /*************************************************************************
189 * COMCTL32_StrStrHelperW
191 * Internal implementation of StrStrW/StrStrIW
193 static LPWSTR COMCTL32_StrStrHelperW(LPCWSTR lpszStr, LPCWSTR lpszSearch,
194 int (*pStrCmpFn)(LPCWSTR,LPCWSTR,int))
196 int iLen;
198 if (!lpszStr || !lpszSearch || !*lpszSearch)
199 return NULL;
201 iLen = strlenW(lpszSearch);
203 while (*lpszStr)
205 if (!pStrCmpFn(lpszStr, lpszSearch, iLen))
206 return (LPWSTR)lpszStr;
207 lpszStr = CharNextW(lpszStr);
209 return NULL;
212 /**************************************************************************
213 * StrStrIA [COMCTL32.355]
215 * Find a substring within a string, ignoring case.
217 * PARAMS
218 * lpszStr [I] String to search in
219 * lpszSearch [I] String to look for
221 * RETURNS
222 * The start of lpszSearch within lpszStr, or NULL if not found.
224 LPSTR WINAPI StrStrIA(LPCSTR lpszStr, LPCSTR lpszSearch)
226 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
228 return COMCTL32_StrStrHelperA(lpszStr, lpszSearch, strncasecmp);
231 /**************************************************************************
232 * StrToIntA [COMCTL32.357]
234 * Read a signed integer from a string.
236 * PARAMS
237 * lpszStr [I] String to read integer from
239 * RETURNS
240 * The signed integer value represented by the string, or 0 if no integer is
241 * present.
243 INT WINAPI StrToIntA (LPSTR lpszStr)
245 return atoi(lpszStr);
248 /**************************************************************************
249 * StrStrIW [COMCTL32.363]
251 * See StrStrIA.
253 LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
255 TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
257 return COMCTL32_StrStrHelperW(lpszStr, lpszSearch, strncmpiW);
260 /**************************************************************************
261 * StrToIntW [COMCTL32.365]
263 * See StrToIntA.
265 INT WINAPI StrToIntW (LPWSTR lpString)
267 return atoiW(lpString);
270 /*************************************************************************
271 * COMCTL32_StrSpnHelperA (internal)
273 * Internal implementation of StrSpnA/StrCSpnA/StrCSpnIA
275 static int COMCTL32_StrSpnHelperA(LPCSTR lpszStr, LPCSTR lpszMatch,
276 LPSTR (WINAPI *pStrChrFn)(LPCSTR,WORD),
277 BOOL bInvert)
279 LPCSTR lpszRead = lpszStr;
280 if (lpszStr && *lpszStr && lpszMatch)
282 while (*lpszRead)
284 LPCSTR lpszTest = pStrChrFn(lpszMatch, *lpszRead);
286 if (!bInvert && !lpszTest)
287 break;
288 if (bInvert && lpszTest)
289 break;
290 lpszRead = CharNextA(lpszRead);
293 return lpszRead - lpszStr;
296 /**************************************************************************
297 * StrCSpnA [COMCTL32.356]
299 * Find the length of the start of a string that does not contain certain
300 * characters.
302 * PARAMS
303 * lpszStr [I] String to search
304 * lpszMatch [I] Characters that cannot be in the substring
306 * RETURNS
307 * The length of the part of lpszStr containing only chars not in lpszMatch,
308 * or 0 if any parameter is invalid.
310 int WINAPI StrCSpnA(LPCSTR lpszStr, LPCSTR lpszMatch)
312 TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
314 return COMCTL32_StrSpnHelperA(lpszStr, lpszMatch, StrChrA, TRUE);
317 /**************************************************************************
318 * StrChrW [COMCTL32.358]
320 * See StrChrA.
322 LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
324 LPWSTR lpszRet = NULL;
326 TRACE("(%s,%i)\n", debugstr_w(lpszStr), ch);
328 if (lpszStr)
329 lpszRet = strchrW(lpszStr, ch);
330 return lpszRet;
333 /**************************************************************************
334 * StrCmpNA [COMCTL32.352]
336 * Compare two strings, up to a maximum length.
338 * PARAMS
339 * lpszStr [I] First string to compare
340 * lpszComp [I] Second string to compare
341 * iLen [I] Maximum number of chars to compare.
343 * RETURNS
344 * An integer less than, equal to or greater than 0, indicating that
345 * lpszStr is less than, the same, or greater than lpszComp.
347 INT WINAPI StrCmpNA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
349 INT iRet;
351 TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
353 iRet = CompareStringA(GetThreadLocale(), 0, lpszStr, iLen, lpszComp, iLen);
354 return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0;
357 /**************************************************************************
358 * StrCmpNIA [COMCTL32.353]
360 * Compare two strings, up to a maximum length, ignoring case.
362 * PARAMS
363 * lpszStr [I] First string to compare
364 * lpszComp [I] Second string to compare
365 * iLen [I] Maximum number of chars to compare.
367 * RETURNS
368 * An integer less than, equal to or greater than 0, indicating that
369 * lpszStr is less than, the same, or greater than lpszComp.
371 int WINAPI StrCmpNIA(LPCSTR lpszStr, LPCSTR lpszComp, int iLen)
373 INT iRet;
375 TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
377 iRet = CompareStringA(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen);
378 return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0;
381 /*************************************************************************
382 * StrCmpNIW [COMCTL32.361]
384 * See StrCmpNIA.
386 INT WINAPI StrCmpNIW(LPCWSTR lpszStr, LPCWSTR lpszComp, int iLen)
388 INT iRet;
390 TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen);
392 iRet = CompareStringW(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen);
393 return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0;
396 /**************************************************************************
397 * StrCmpNW [COMCTL32.360]
399 * See StrCmpNA.
401 INT WINAPI StrCmpNW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
403 INT iRet;
405 TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen);
407 iRet = CompareStringW(GetThreadLocale(), 0, lpszStr, iLen, lpszComp, iLen);
408 return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0;
411 /**************************************************************************
412 * StrRChrA [COMCTL32.351]
414 * Find the last occurence of a character in string.
416 * PARAMS
417 * lpszStr [I] String to search in
418 * lpszEnd [I] Place to end search, or NULL to search until the end of lpszStr
419 * ch [I] Character to search for.
421 * RETURNS
422 * Success: A pointer to the last occurrence of ch in lpszStr before lpszEnd,
423 * or NULL if not found.
424 * Failure: NULL, if any arguments are invalid.
426 LPSTR WINAPI StrRChrA(LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch)
428 LPCSTR lpszRet = NULL;
430 TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr), debugstr_a(lpszEnd), ch);
432 if (lpszStr)
434 WORD ch2;
436 if (!lpszEnd)
437 lpszEnd = lpszStr + lstrlenA(lpszStr);
439 while (*lpszStr && lpszStr <= lpszEnd)
441 ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
443 if (!COMCTL32_ChrCmpA(ch, ch2))
444 lpszRet = lpszStr;
445 lpszStr = CharNextA(lpszStr);
448 return (LPSTR)lpszRet;
452 /**************************************************************************
453 * StrRChrW [COMCTL32.359]
455 * See StrRChrA.
457 LPWSTR WINAPI StrRChrW(LPCWSTR lpszStr, LPCWSTR lpszEnd, WORD ch)
459 LPCWSTR lpszRet = NULL;
461 TRACE("(%s,%s,%x)\n", debugstr_w(lpszStr), debugstr_w(lpszEnd), ch);
463 if (lpszStr)
465 if (!lpszEnd)
466 lpszEnd = lpszStr + strlenW(lpszStr);
468 while (*lpszStr && lpszStr <= lpszEnd)
470 if (!COMCTL32_ChrCmpW(ch, *lpszStr))
471 lpszRet = lpszStr;
472 lpszStr = CharNextW(lpszStr);
475 return (LPWSTR)lpszRet;
478 /**************************************************************************
479 * StrStrA [COMCTL32.354]
481 * Find a substring within a string.
483 * PARAMS
484 * lpszStr [I] String to search in
485 * lpszSearch [I] String to look for
487 * RETURNS
488 * The start of lpszSearch within lpszStr, or NULL if not found.
490 LPSTR WINAPI StrStrA(LPCSTR lpszStr, LPCSTR lpszSearch)
492 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
494 return COMCTL32_StrStrHelperA(lpszStr, lpszSearch, strncmp);
497 /**************************************************************************
498 * StrStrW [COMCTL32.362]
500 * See StrStrA.
502 LPWSTR WINAPI StrStrW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
504 TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
506 return COMCTL32_StrStrHelperW(lpszStr, lpszSearch, strncmpW);
509 /*************************************************************************
510 * StrChrIA [COMCTL32.366]
512 * Find a given character in a string, ignoring case.
514 * PARAMS
515 * lpszStr [I] String to search in.
516 * ch [I] Character to search for.
518 * RETURNS
519 * Success: A pointer to the first occurrence of ch in lpszStr, or NULL if
520 * not found.
521 * Failure: NULL, if any arguments are invalid.
523 LPSTR WINAPI StrChrIA(LPCSTR lpszStr, WORD ch)
525 TRACE("(%s,%i)\n", debugstr_a(lpszStr), ch);
527 if (lpszStr)
529 while (*lpszStr)
531 if (!COMCTL32_ChrCmpIA(*lpszStr, ch))
532 return (LPSTR)lpszStr;
533 lpszStr = CharNextA(lpszStr);
536 return NULL;
539 /*************************************************************************
540 * StrChrIW [COMCTL32.367]
542 * See StrChrA.
544 LPWSTR WINAPI StrChrIW(LPCWSTR lpszStr, WCHAR ch)
546 TRACE("(%s,%i)\n", debugstr_w(lpszStr), ch);
548 if (lpszStr)
550 ch = toupperW(ch);
551 while (*lpszStr)
553 if (toupperW(*lpszStr) == ch)
554 return (LPWSTR)lpszStr;
555 lpszStr = CharNextW(lpszStr);
557 lpszStr = NULL;
559 return (LPWSTR)lpszStr;
562 /*************************************************************************
563 * StrRStrIA [COMCTL32.372]
565 * Find the last occurence of a substring within a string.
567 * PARAMS
568 * lpszStr [I] String to search in
569 * lpszEnd [I] End of lpszStr
570 * lpszSearch [I] String to look for
572 * RETURNS
573 * The last occurence lpszSearch within lpszStr, or NULL if not found.
575 LPSTR WINAPI StrRStrIA(LPCSTR lpszStr, LPCSTR lpszEnd, LPCSTR lpszSearch)
577 LPSTR lpszRet = NULL;
578 WORD ch1, ch2;
579 INT iLen;
581 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
583 if (!lpszStr || !lpszSearch || !*lpszSearch)
584 return NULL;
586 if (!lpszEnd)
587 lpszEnd = lpszStr + lstrlenA(lpszStr);
589 if (IsDBCSLeadByte(*lpszSearch))
590 ch1 = *lpszSearch << 8 | lpszSearch[1];
591 else
592 ch1 = *lpszSearch;
593 iLen = lstrlenA(lpszSearch);
595 while (lpszStr <= lpszEnd && *lpszStr)
597 ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
598 if (!COMCTL32_ChrCmpIA(ch1, ch2))
600 if (!StrCmpNIA(lpszStr, lpszSearch, iLen))
601 lpszRet = (LPSTR)lpszStr;
603 lpszStr = CharNextA(lpszStr);
605 return lpszRet;
608 /*************************************************************************
609 * StrRStrIW [COMCTL32.373]
611 * See StrRStrIA.
613 LPWSTR WINAPI StrRStrIW(LPCWSTR lpszStr, LPCWSTR lpszEnd, LPCWSTR lpszSearch)
615 LPWSTR lpszRet = NULL;
616 INT iLen;
618 TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
620 if (!lpszStr || !lpszSearch || !*lpszSearch)
621 return NULL;
623 if (!lpszEnd)
624 lpszEnd = lpszStr + strlenW(lpszStr);
626 iLen = strlenW(lpszSearch);
628 while (lpszStr <= lpszEnd && *lpszStr)
630 if (!COMCTL32_ChrCmpIA(*lpszSearch, *lpszStr))
632 if (!StrCmpNIW(lpszStr, lpszSearch, iLen))
633 lpszRet = (LPWSTR)lpszStr;
635 lpszStr = CharNextW(lpszStr);
637 return lpszRet;
640 /*************************************************************************
641 * COMCTL32_StrSpnHelperW
643 * Internal implementation of StrSpnW/StrCSpnW/StrCSpnIW
645 static int COMCTL32_StrSpnHelperW(LPCWSTR lpszStr, LPCWSTR lpszMatch,
646 LPWSTR (WINAPI *pStrChrFn)(LPCWSTR,WCHAR),
647 BOOL bInvert)
649 LPCWSTR lpszRead = lpszStr;
650 if (lpszStr && *lpszStr && lpszMatch)
652 while (*lpszRead)
654 LPCWSTR lpszTest = pStrChrFn(lpszMatch, *lpszRead);
656 if (!bInvert && !lpszTest)
657 break;
658 if (bInvert && lpszTest)
659 break;
660 lpszRead = CharNextW(lpszRead);
663 return lpszRead - lpszStr;
666 /*************************************************************************
667 * StrCSpnIA [COMCTL32.374]
669 * Find the length of the start of a string that does not contain certain
670 * characters, ignoring case.
672 * PARAMS
673 * lpszStr [I] String to search
674 * lpszMatch [I] Characters that cannot be in the substring
676 * RETURNS
677 * The length of the part of lpszStr containing only chars not in lpszMatch,
678 * or 0 if any parameter is invalid.
680 int WINAPI StrCSpnIA(LPCSTR lpszStr, LPCSTR lpszMatch)
682 TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
684 return COMCTL32_StrSpnHelperA(lpszStr, lpszMatch, StrChrIA, TRUE);
687 /*************************************************************************
688 * StrCSpnIW [COMCTL32.375]
690 * See StrCSpnIA.
692 int WINAPI StrCSpnIW(LPCWSTR lpszStr, LPCWSTR lpszMatch)
694 TRACE("(%s,%s)\n",debugstr_w(lpszStr), debugstr_w(lpszMatch));
696 return COMCTL32_StrSpnHelperW(lpszStr, lpszMatch, StrChrIW, TRUE);
699 /**************************************************************************
700 * StrRChrIA [COMCTL32.368]
702 * Find the last occurence of a character in string, ignoring case.
704 * PARAMS
705 * lpszStr [I] String to search in
706 * lpszEnd [I] Place to end search, or NULL to search until the end of lpszStr
707 * ch [I] Character to search for.
709 * RETURNS
710 * Success: A pointer to the last occurrence of ch in lpszStr before lpszEnd,
711 * or NULL if not found.
712 * Failure: NULL, if any arguments are invalid.
714 LPSTR WINAPI StrRChrIA(LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch)
716 LPCSTR lpszRet = NULL;
718 TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr), debugstr_a(lpszEnd), ch);
720 if (lpszStr)
722 WORD ch2;
724 if (!lpszEnd)
725 lpszEnd = lpszStr + lstrlenA(lpszStr);
727 while (*lpszStr && lpszStr <= lpszEnd)
729 ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
731 if (ch == ch2)
732 lpszRet = lpszStr;
733 lpszStr = CharNextA(lpszStr);
736 return (LPSTR)lpszRet;
739 /**************************************************************************
740 * StrRChrIW [COMCTL32.369]
742 * See StrRChrIA.
744 LPWSTR WINAPI StrRChrIW(LPCWSTR lpszStr, LPCWSTR lpszEnd, WORD ch)
746 LPCWSTR lpszRet = NULL;
748 TRACE("(%s,%s,%x)\n", debugstr_w(lpszStr), debugstr_w(lpszEnd), ch);
750 if (lpszStr)
752 if (!lpszEnd)
753 lpszEnd = lpszStr + strlenW(lpszStr);
755 while (*lpszStr && lpszStr <= lpszEnd)
757 if (ch == *lpszStr)
758 lpszRet = lpszStr;
759 lpszStr = CharNextW(lpszStr);
762 return (LPWSTR)lpszRet;
765 /*************************************************************************
766 * StrCSpnW [COMCTL32.364]
768 * See StrCSpnA.
770 int WINAPI StrCSpnW(LPCWSTR lpszStr, LPCWSTR lpszMatch)
772 TRACE("(%s,%s)\n",debugstr_w(lpszStr), debugstr_w(lpszMatch));
774 return COMCTL32_StrSpnHelperW(lpszStr, lpszMatch, StrChrW, TRUE);
777 /*************************************************************************
778 * IntlStrEqWorkerA [COMCTL32.376]
780 * Compare two strings.
782 * PARAMS
783 * bCase [I] Whether to compare case sensitively
784 * lpszStr [I] First string to compare
785 * lpszComp [I] Second string to compare
786 * iLen [I] Length to compare
788 * RETURNS
789 * TRUE If the strings are equal.
790 * FALSE Otherwise.
792 BOOL WINAPI IntlStrEqWorkerA(BOOL bCase, LPCSTR lpszStr, LPCSTR lpszComp,
793 int iLen)
795 DWORD dwFlags = LOCALE_USE_CP_ACP;
796 int iRet;
798 TRACE("(%d,%s,%s,%d)\n", bCase,
799 debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
801 /* FIXME: These flags are undocumented and unknown by our CompareString.
802 * We need defines for them.
804 dwFlags |= bCase ? 0x10000000 : 0x10000001;
806 iRet = CompareStringA(GetThreadLocale(),
807 dwFlags, lpszStr, iLen, lpszComp, iLen);
809 if (!iRet)
810 iRet = CompareStringA(2048, dwFlags, lpszStr, iLen, lpszComp, iLen);
812 return iRet == 2 ? TRUE : FALSE;
815 /*************************************************************************
816 * IntlStrEqWorkerW [COMCTL32.377]
818 * See IntlStrEqWorkerA.
820 BOOL WINAPI IntlStrEqWorkerW(BOOL bCase, LPCWSTR lpszStr, LPCWSTR lpszComp,
821 int iLen)
823 DWORD dwFlags;
824 int iRet;
826 TRACE("(%d,%s,%s,%d)\n", bCase,
827 debugstr_w(lpszStr),debugstr_w(lpszComp), iLen);
829 /* FIXME: These flags are undocumented and unknown by our CompareString.
830 * We need defines for them.
832 dwFlags = bCase ? 0x10000000 : 0x10000001;
834 iRet = CompareStringW(GetThreadLocale(),
835 dwFlags, lpszStr, iLen, lpszComp, iLen);
837 if (!iRet)
838 iRet = CompareStringW(2048, dwFlags, lpszStr, iLen, lpszComp, iLen);
840 return iRet == 2 ? TRUE : FALSE;