Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/Makefile.in | 2 +- dlls/comctl32/listview.c | 10 +++++++--- dlls/comctl32/tests/listview.c | 13 +++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/dlls/comctl32/Makefile.in b/dlls/comctl32/Makefile.in index e548d3761a6..4ea068ea731 100644 --- a/dlls/comctl32/Makefile.in +++ b/dlls/comctl32/Makefile.in @@ -1,7 +1,7 @@ EXTRADEFS = -D_COMCTL32_ MODULE = comctl32.dll IMPORTLIB = comctl32 -IMPORTS = uuid user32 gdi32 advapi32 usp10 imm32 +IMPORTS = uuid user32 gdi32 advapi32 usp10 imm32 kernelbase DELAYIMPORTS = winmm uxtheme
EXTRADLLFLAGS = -mno-cygwin diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 1092a6ce9b0..6cee291dd69 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -140,6 +140,7 @@ #include "commctrl.h" #include "comctl32.h" #include "uxtheme.h" +#include "shlwapi.h"
#include "wine/debug.h"
@@ -6313,6 +6314,7 @@ static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart, INT nItem = nStart + 1, nLast = infoPtr->nItemCount, nNearestItem = -1; ULONG xdist, ydist, dist, mindist = 0x7fffffff; POINT Position, Destination; + int search_len = 0; LVITEMW lvItem;
/* Search in virtual listviews should be done by application, not by @@ -6378,6 +6380,9 @@ static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart,
nItem = bNearest ? -1 : nStart + 1;
+ if (lpFindInfo->flags & (LVFI_PARTIAL | LVFI_SUBSTRING)) + search_len = lstrlenW(lpFindInfo->psz); + again: for (; nItem < nLast; nItem++) { @@ -6398,12 +6403,11 @@ again: { if (lpFindInfo->flags & (LVFI_PARTIAL | LVFI_SUBSTRING)) { - WCHAR *p = wcsstr(lvItem.pszText, lpFindInfo->psz); - if (!p || p != lvItem.pszText) continue; + if (StrCmpNIW(lvItem.pszText, lpFindInfo->psz, search_len)) continue; } else { - if (lstrcmpW(lvItem.pszText, lpFindInfo->psz) != 0) continue; + if (StrCmpIW(lvItem.pszText, lpFindInfo->psz)) continue; } }
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 20b9873d30d..c19de7f03f9 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -5366,6 +5366,19 @@ static void test_finditem(void) r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); expect(0, r);
+ /* Case sensitivity. */ + strcpy(f, "Foo"); + fi.flags = LVFI_STRING; + fi.psz = f; + r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); + ok(!r, "Unexpected item index %d.\n", r); + + strcpy(f, "F"); + fi.flags = LVFI_SUBSTRING; + fi.psz = f; + r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); + ok(!r, "Unexpected item index %d.\n", r); + DestroyWindow(hwnd); }