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 inneficient. 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) - 2;
83 /*************************************************************************
84 * COMCTL32_ChrCmpHelperW
86 * Internal helper for COMCTL32_ChrCmpW/ChrCmpIW.
88 static BOOL COMCTL32_ChrCmpHelperW(WCHAR ch1, WCHAR ch2, DWORD dwFlags)
90 WCHAR str1[2], str2[2];
96 return CompareStringW(GetThreadLocale(), dwFlags, str1, 2, str2, 2) - 2;
99 /*************************************************************************
100 * COMCTL32_ChrCmpA (internal)
102 * Internal helper function.
104 static BOOL COMCTL32_ChrCmpA(WORD ch1, WORD ch2)
106 return COMCTL32_ChrCmpHelperA(ch1, ch2, 0);
109 /*************************************************************************
110 * COMCTL32_ChrCmpIA (internal)
112 * Compare two characters, ignoring case.
115 * ch1 [I] First character to compare
116 * ch2 [I] Second character to compare
119 * FALSE, if the characters are equal.
120 * Non-zero otherwise.
122 static BOOL COMCTL32_ChrCmpIA(WORD ch1, WORD ch2)
124 TRACE("(%d,%d)\n", ch1, ch2);
126 return COMCTL32_ChrCmpHelperA(ch1, ch2, NORM_IGNORECASE);
129 /*************************************************************************
132 * Internal helper function.
134 static BOOL COMCTL32_ChrCmpW(WCHAR ch1, WCHAR ch2)
136 return COMCTL32_ChrCmpHelperW(ch1, ch2, 0);
139 /*************************************************************************
142 * Internal helper function.
144 static BOOL COMCTL32_ChrCmpIW(WCHAR ch1, WCHAR ch2)
146 return COMCTL32_ChrCmpHelperW(ch1, ch2, NORM_IGNORECASE);
149 /**************************************************************************
150 * Str_GetPtrA [COMCTL32.233]
152 * Copies a string into a destination buffer.
155 * lpSrc [I] Source string
156 * lpDest [O] Destination buffer
157 * nMaxLen [I] Size of buffer in characters
160 * The number of characters copied.
162 INT WINAPI Str_GetPtrA (LPCSTR lpSrc, LPSTR lpDest, INT nMaxLen)
166 TRACE("(%p %p %d)\n", lpSrc, lpDest, nMaxLen);
168 if ((!lpDest || nMaxLen == 0) && lpSrc)
169 return (strlen(lpSrc) + 1);
179 len = strlen(lpSrc) + 1;
183 RtlMoveMemory (lpDest, lpSrc, len - 1);
184 lpDest[len - 1] = '\0';
189 /**************************************************************************
190 * Str_SetPtrA [COMCTL32.234]
192 * Makes a copy of a string, allocating memory if necessary.
195 * lppDest [O] Pointer to destination string
196 * lpSrc [I] Source string
203 * Set lpSrc to NULL to free the memory allocated by a previous call
206 BOOL WINAPI Str_SetPtrA (LPSTR *lppDest, LPCSTR lpSrc)
208 TRACE("(%p %p)\n", lppDest, lpSrc);
211 LPSTR ptr = ReAlloc (*lppDest, strlen (lpSrc) + 1);
227 /**************************************************************************
228 * Str_GetPtrW [COMCTL32.235]
232 INT WINAPI Str_GetPtrW (LPCWSTR lpSrc, LPWSTR lpDest, INT nMaxLen)
236 TRACE("(%p %p %d)\n", lpSrc, lpDest, nMaxLen);
238 if (!lpDest && lpSrc)
239 return strlenW (lpSrc);
249 len = strlenW (lpSrc);
253 RtlMoveMemory (lpDest, lpSrc, len*sizeof(WCHAR));
259 /**************************************************************************
260 * Str_SetPtrW [COMCTL32.236]
264 BOOL WINAPI Str_SetPtrW (LPWSTR *lppDest, LPCWSTR lpSrc)
266 TRACE("(%p %p)\n", lppDest, lpSrc);
269 INT len = strlenW (lpSrc) + 1;
270 LPWSTR ptr = ReAlloc (*lppDest, len * sizeof(WCHAR));
273 strcpyW (ptr, lpSrc);
286 /**************************************************************************
287 * StrChrA [COMCTL32.350]
289 * Find a given character in a string.
292 * lpszStr [I] String to search in.
293 * ch [I] Character to search for.
296 * Success: A pointer to the first occurrence of ch in lpszStr, or NULL if
298 * Failure: NULL, if any arguments are invalid.
300 LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
302 TRACE("(%s,%i)\n", debugstr_a(lpszStr), ch);
308 if (!COMCTL32_ChrCmpA(*lpszStr, ch))
309 return (LPSTR)lpszStr;
310 lpszStr = CharNextA(lpszStr);
316 /**************************************************************************
317 * StrCmpNIA [COMCTL32.353]
319 * Compare two strings, up to a maximum length, ignoring case.
322 * lpszStr [I] First string to compare
323 * lpszComp [I] Second string to compare
324 * iLen [I] Maximum number of chars to compare.
327 * An integer less than, equal to or greater than 0, indicating that
328 * lpszStr is less than, the same, or greater than lpszComp.
330 INT WINAPI StrCmpNIA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
334 TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
336 iRet = CompareStringA(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen);
337 return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0;
340 /*************************************************************************
341 * StrCmpNIW [COMCTL32.361]
345 INT WINAPI StrCmpNIW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
349 TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen);
351 iRet = CompareStringW(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen);
352 return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0;
355 /*************************************************************************
356 * COMCTL32_StrStrHelperA
358 * Internal implementation of StrStrA/StrStrIA
360 static LPSTR COMCTL32_StrStrHelperA(LPCSTR lpszStr, LPCSTR lpszSearch,
361 INT (WINAPI *pStrCmpFn)(LPCSTR,LPCSTR,INT))
365 if (!lpszStr || !lpszSearch || !*lpszSearch)
368 iLen = strlen(lpszSearch);
372 if (!pStrCmpFn(lpszStr, lpszSearch, iLen))
373 return (LPSTR)lpszStr;
374 lpszStr = CharNextA(lpszStr);
379 /*************************************************************************
380 * COMCTL32_StrStrHelperW
382 * Internal implementation of StrStrW/StrStrIW
384 static LPWSTR COMCTL32_StrStrHelperW(LPCWSTR lpszStr, LPCWSTR lpszSearch,
385 INT (WINAPI *pStrCmpFn)(LPCWSTR,LPCWSTR,INT))
389 if (!lpszStr || !lpszSearch || !*lpszSearch)
392 iLen = strlenW(lpszSearch);
396 if (!pStrCmpFn(lpszStr, lpszSearch, iLen))
397 return (LPWSTR)lpszStr;
398 lpszStr = CharNextW(lpszStr);
403 /**************************************************************************
404 * StrStrIA [COMCTL32.355]
406 * Find a substring within a string, ignoring case.
409 * lpszStr [I] String to search in
410 * lpszSearch [I] String to look for
413 * The start of lpszSearch within lpszStr, or NULL if not found.
415 LPSTR WINAPI StrStrIA(LPCSTR lpszStr, LPCSTR lpszSearch)
417 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
419 return COMCTL32_StrStrHelperA(lpszStr, lpszSearch, StrCmpNIA);
422 /**************************************************************************
423 * StrToIntA [COMCTL32.357]
425 * Read a signed integer from a string.
428 * lpszStr [I] String to read integer from
431 * The signed integer value represented by the string, or 0 if no integer is
434 INT WINAPI StrToIntA (LPSTR lpszStr)
436 return atoi(lpszStr);
439 /**************************************************************************
440 * StrStrIW [COMCTL32.363]
444 LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
446 TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
448 return COMCTL32_StrStrHelperW(lpszStr, lpszSearch, StrCmpNIW);
451 /**************************************************************************
452 * StrToIntW [COMCTL32.365]
456 INT WINAPI StrToIntW (LPWSTR lpString)
458 return atoiW(lpString);
461 /*************************************************************************
462 * COMCTL32_StrSpnHelperA (internal)
464 * Internal implementation of StrSpnA/StrCSpnA/StrCSpnIA
466 static int COMCTL32_StrSpnHelperA(LPCSTR lpszStr, LPCSTR lpszMatch,
467 LPSTR (WINAPI *pStrChrFn)(LPCSTR,WORD),
470 LPCSTR lpszRead = lpszStr;
471 if (lpszStr && *lpszStr && lpszMatch)
475 LPCSTR lpszTest = pStrChrFn(lpszMatch, *lpszRead);
477 if (!bInvert && !lpszTest)
479 if (bInvert && lpszTest)
481 lpszRead = CharNextA(lpszRead);
484 return lpszRead - lpszStr;
487 /**************************************************************************
488 * StrCSpnA [COMCTL32.356]
490 * Find the length of the start of a string that does not contain certain
494 * lpszStr [I] String to search
495 * lpszMatch [I] Characters that cannot be in the substring
498 * The length of the part of lpszStr containing only chars not in lpszMatch,
499 * or 0 if any parameter is invalid.
501 int WINAPI StrCSpnA(LPCSTR lpszStr, LPCSTR lpszMatch)
503 TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
505 return COMCTL32_StrSpnHelperA(lpszStr, lpszMatch, StrChrA, TRUE);
508 /**************************************************************************
509 * StrChrW [COMCTL32.358]
513 LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
515 LPWSTR lpszRet = NULL;
517 TRACE("(%s,%i)\n", debugstr_w(lpszStr), ch);
520 lpszRet = strchrW(lpszStr, ch);
524 /**************************************************************************
525 * StrCmpNA [COMCTL32.352]
527 * Compare two strings, up to a maximum length.
530 * lpszStr [I] First string to compare
531 * lpszComp [I] Second string to compare
532 * iLen [I] Maximum number of chars to compare.
535 * An integer less than, equal to or greater than 0, indicating that
536 * lpszStr is less than, the same, or greater than lpszComp.
538 INT WINAPI StrCmpNA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
542 TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
544 iRet = CompareStringA(GetThreadLocale(), 0, lpszStr, iLen, lpszComp, iLen);
545 return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0;
548 /**************************************************************************
549 * StrCmpNW [COMCTL32.360]
553 INT WINAPI StrCmpNW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
557 TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen);
559 iRet = CompareStringW(GetThreadLocale(), 0, lpszStr, iLen, lpszComp, iLen);
560 return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0;
563 /**************************************************************************
564 * StrRChrA [COMCTL32.351]
566 * Find the last occurrence of a character in string.
569 * lpszStr [I] String to search in
570 * lpszEnd [I] Place to end search, or NULL to search until the end of lpszStr
571 * ch [I] Character to search for.
574 * Success: A pointer to the last occurrence of ch in lpszStr before lpszEnd,
575 * or NULL if not found.
576 * Failure: NULL, if any arguments are invalid.
578 LPSTR WINAPI StrRChrA(LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch)
580 LPCSTR lpszRet = NULL;
582 TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr), debugstr_a(lpszEnd), ch);
589 lpszEnd = lpszStr + lstrlenA(lpszStr);
591 while (*lpszStr && lpszStr <= lpszEnd)
593 ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
595 if (!COMCTL32_ChrCmpA(ch, ch2))
597 lpszStr = CharNextA(lpszStr);
600 return (LPSTR)lpszRet;
604 /**************************************************************************
605 * StrRChrW [COMCTL32.359]
609 LPWSTR WINAPI StrRChrW(LPCWSTR lpszStr, LPCWSTR lpszEnd, WORD ch)
611 LPCWSTR lpszRet = NULL;
613 TRACE("(%s,%s,%x)\n", debugstr_w(lpszStr), debugstr_w(lpszEnd), ch);
618 lpszEnd = lpszStr + strlenW(lpszStr);
620 while (*lpszStr && lpszStr <= lpszEnd)
622 if (!COMCTL32_ChrCmpW(ch, *lpszStr))
624 lpszStr = CharNextW(lpszStr);
627 return (LPWSTR)lpszRet;
630 /**************************************************************************
631 * StrStrA [COMCTL32.354]
633 * Find a substring within a string.
636 * lpszStr [I] String to search in
637 * lpszSearch [I] String to look for
640 * The start of lpszSearch within lpszStr, or NULL if not found.
642 LPSTR WINAPI StrStrA(LPCSTR lpszStr, LPCSTR lpszSearch)
644 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
646 return COMCTL32_StrStrHelperA(lpszStr, lpszSearch, StrCmpNA);
649 /**************************************************************************
650 * StrStrW [COMCTL32.362]
654 LPWSTR WINAPI StrStrW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
656 TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
658 return COMCTL32_StrStrHelperW(lpszStr, lpszSearch, StrCmpNW);
661 /*************************************************************************
662 * StrChrIA [COMCTL32.366]
664 * Find a given character in a string, ignoring case.
667 * lpszStr [I] String to search in.
668 * ch [I] Character to search for.
671 * Success: A pointer to the first occurrence of ch in lpszStr, or NULL if
673 * Failure: NULL, if any arguments are invalid.
675 LPSTR WINAPI StrChrIA(LPCSTR lpszStr, WORD ch)
677 TRACE("(%s,%i)\n", debugstr_a(lpszStr), ch);
683 if (!COMCTL32_ChrCmpIA(*lpszStr, ch))
684 return (LPSTR)lpszStr;
685 lpszStr = CharNextA(lpszStr);
691 /*************************************************************************
692 * StrChrIW [COMCTL32.367]
696 LPWSTR WINAPI StrChrIW(LPCWSTR lpszStr, WCHAR ch)
698 TRACE("(%s,%i)\n", debugstr_w(lpszStr), ch);
705 if (toupperW(*lpszStr) == ch)
706 return (LPWSTR)lpszStr;
707 lpszStr = CharNextW(lpszStr);
711 return (LPWSTR)lpszStr;
714 /*************************************************************************
715 * StrRStrIA [COMCTL32.372]
717 * Find the last occurrence of a substring within a string.
720 * lpszStr [I] String to search in
721 * lpszEnd [I] End of lpszStr
722 * lpszSearch [I] String to look for
725 * The last occurrence lpszSearch within lpszStr, or NULL if not found.
727 LPSTR WINAPI StrRStrIA(LPCSTR lpszStr, LPCSTR lpszEnd, LPCSTR lpszSearch)
729 LPSTR lpszRet = NULL;
733 TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
735 if (!lpszStr || !lpszSearch || !*lpszSearch)
739 lpszEnd = lpszStr + lstrlenA(lpszStr);
741 if (IsDBCSLeadByte(*lpszSearch))
742 ch1 = *lpszSearch << 8 | lpszSearch[1];
745 iLen = lstrlenA(lpszSearch);
747 while (lpszStr <= lpszEnd && *lpszStr)
749 ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
750 if (!COMCTL32_ChrCmpIA(ch1, ch2))
752 if (!StrCmpNIA(lpszStr, lpszSearch, iLen))
753 lpszRet = (LPSTR)lpszStr;
755 lpszStr = CharNextA(lpszStr);
760 /*************************************************************************
761 * StrRStrIW [COMCTL32.373]
765 LPWSTR WINAPI StrRStrIW(LPCWSTR lpszStr, LPCWSTR lpszEnd, LPCWSTR lpszSearch)
767 LPWSTR lpszRet = NULL;
770 TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
772 if (!lpszStr || !lpszSearch || !*lpszSearch)
776 lpszEnd = lpszStr + strlenW(lpszStr);
778 iLen = strlenW(lpszSearch);
780 while (lpszStr <= lpszEnd && *lpszStr)
782 if (!COMCTL32_ChrCmpIW(*lpszSearch, *lpszStr))
784 if (!StrCmpNIW(lpszStr, lpszSearch, iLen))
785 lpszRet = (LPWSTR)lpszStr;
787 lpszStr = CharNextW(lpszStr);
792 /*************************************************************************
793 * COMCTL32_StrSpnHelperW
795 * Internal implementation of StrSpnW/StrCSpnW/StrCSpnIW
797 static int COMCTL32_StrSpnHelperW(LPCWSTR lpszStr, LPCWSTR lpszMatch,
798 LPWSTR (WINAPI *pStrChrFn)(LPCWSTR,WCHAR),
801 LPCWSTR lpszRead = lpszStr;
802 if (lpszStr && *lpszStr && lpszMatch)
806 LPCWSTR lpszTest = pStrChrFn(lpszMatch, *lpszRead);
808 if (!bInvert && !lpszTest)
810 if (bInvert && lpszTest)
812 lpszRead = CharNextW(lpszRead);
815 return lpszRead - lpszStr;
818 /*************************************************************************
819 * StrCSpnIA [COMCTL32.374]
821 * Find the length of the start of a string that does not contain certain
822 * characters, ignoring case.
825 * lpszStr [I] String to search
826 * lpszMatch [I] Characters that cannot be in the substring
829 * The length of the part of lpszStr containing only chars not in lpszMatch,
830 * or 0 if any parameter is invalid.
832 int WINAPI StrCSpnIA(LPCSTR lpszStr, LPCSTR lpszMatch)
834 TRACE("(%s,%s)\n",debugstr_a(lpszStr), debugstr_a(lpszMatch));
836 return COMCTL32_StrSpnHelperA(lpszStr, lpszMatch, StrChrIA, TRUE);
839 /*************************************************************************
840 * StrCSpnIW [COMCTL32.375]
844 int WINAPI StrCSpnIW(LPCWSTR lpszStr, LPCWSTR lpszMatch)
846 TRACE("(%s,%s)\n",debugstr_w(lpszStr), debugstr_w(lpszMatch));
848 return COMCTL32_StrSpnHelperW(lpszStr, lpszMatch, StrChrIW, TRUE);
851 /**************************************************************************
852 * StrRChrIA [COMCTL32.368]
854 * Find the last occurrence of a character in string, ignoring case.
857 * lpszStr [I] String to search in
858 * lpszEnd [I] Place to end search, or NULL to search until the end of lpszStr
859 * ch [I] Character to search for.
862 * Success: A pointer to the last occurrence of ch in lpszStr before lpszEnd,
863 * or NULL if not found.
864 * Failure: NULL, if any arguments are invalid.
866 LPSTR WINAPI StrRChrIA(LPCSTR lpszStr, LPCSTR lpszEnd, WORD ch)
868 LPCSTR lpszRet = NULL;
870 TRACE("(%s,%s,%x)\n", debugstr_a(lpszStr), debugstr_a(lpszEnd), ch);
877 lpszEnd = lpszStr + lstrlenA(lpszStr);
879 while (*lpszStr && lpszStr <= lpszEnd)
881 ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
885 lpszStr = CharNextA(lpszStr);
888 return (LPSTR)lpszRet;
891 /**************************************************************************
892 * StrRChrIW [COMCTL32.369]
896 LPWSTR WINAPI StrRChrIW(LPCWSTR lpszStr, LPCWSTR lpszEnd, WORD ch)
898 LPCWSTR lpszRet = NULL;
900 TRACE("(%s,%s,%x)\n", debugstr_w(lpszStr), debugstr_w(lpszEnd), ch);
905 lpszEnd = lpszStr + strlenW(lpszStr);
907 while (*lpszStr && lpszStr <= lpszEnd)
911 lpszStr = CharNextW(lpszStr);
914 return (LPWSTR)lpszRet;
917 /*************************************************************************
918 * StrCSpnW [COMCTL32.364]
922 int WINAPI StrCSpnW(LPCWSTR lpszStr, LPCWSTR lpszMatch)
924 TRACE("(%s,%s)\n",debugstr_w(lpszStr), debugstr_w(lpszMatch));
926 return COMCTL32_StrSpnHelperW(lpszStr, lpszMatch, StrChrW, TRUE);
929 /*************************************************************************
930 * IntlStrEqWorkerA [COMCTL32.376]
932 * Compare two strings.
935 * bCase [I] Whether to compare case sensitively
936 * lpszStr [I] First string to compare
937 * lpszComp [I] Second string to compare
938 * iLen [I] Length to compare
941 * TRUE If the strings are equal.
944 BOOL WINAPI IntlStrEqWorkerA(BOOL bCase, LPCSTR lpszStr, LPCSTR lpszComp,
947 DWORD dwFlags = LOCALE_USE_CP_ACP;
950 TRACE("(%d,%s,%s,%d)\n", bCase,
951 debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
953 /* FIXME: These flags are undocumented and unknown by our CompareString.
954 * We need defines for them.
956 dwFlags |= bCase ? 0x10000000 : 0x10000001;
958 iRet = CompareStringA(GetThreadLocale(),
959 dwFlags, lpszStr, iLen, lpszComp, iLen);
962 iRet = CompareStringA(2048, dwFlags, lpszStr, iLen, lpszComp, iLen);
964 return iRet == 2 ? TRUE : FALSE;
967 /*************************************************************************
968 * IntlStrEqWorkerW [COMCTL32.377]
970 * See IntlStrEqWorkerA.
972 BOOL WINAPI IntlStrEqWorkerW(BOOL bCase, LPCWSTR lpszStr, LPCWSTR lpszComp,
978 TRACE("(%d,%s,%s,%d)\n", bCase,
979 debugstr_w(lpszStr),debugstr_w(lpszComp), iLen);
981 /* FIXME: These flags are undocumented and unknown by our CompareString.
982 * We need defines for them.
984 dwFlags = bCase ? 0x10000000 : 0x10000001;
986 iRet = CompareStringW(GetThreadLocale(),
987 dwFlags, lpszStr, iLen, lpszComp, iLen);
990 iRet = CompareStringW(2048, dwFlags, lpszStr, iLen, lpszComp, iLen);
992 return iRet == 2 ? TRUE : FALSE;