user32/listbox: Make LBS_NODATA listboxes error on any attempt to find a value.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d30aadd3e1
commit
dfb57a1655
|
@ -917,6 +917,12 @@ static INT LISTBOX_FindString( LB_DESCR *descr, INT start, LPCWSTR str, BOOL exa
|
||||||
INT i;
|
INT i;
|
||||||
LB_ITEMDATA *item;
|
LB_ITEMDATA *item;
|
||||||
|
|
||||||
|
if (descr->style & LBS_NODATA)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return LB_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
if (start >= descr->nb_items) start = -1;
|
if (start >= descr->nb_items) start = -1;
|
||||||
item = descr->items + start + 1;
|
item = descr->items + start + 1;
|
||||||
if (HAS_STRINGS(descr))
|
if (HAS_STRINGS(descr))
|
||||||
|
@ -2455,7 +2461,7 @@ static LRESULT LISTBOX_HandleChar( LB_DESCR *descr, WCHAR charW )
|
||||||
(LPARAM)descr->self );
|
(LPARAM)descr->self );
|
||||||
if (caret == -2) return 0;
|
if (caret == -2) return 0;
|
||||||
}
|
}
|
||||||
if (caret == -1)
|
if (caret == -1 && !(descr->style & LBS_NODATA))
|
||||||
caret = LISTBOX_FindString( descr, descr->focus_item, str, FALSE);
|
caret = LISTBOX_FindString( descr, descr->focus_item, str, FALSE);
|
||||||
if (caret != -1)
|
if (caret != -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2103,12 +2103,30 @@ static void test_LBS_NODATA(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* More messages that don't work with LBS_NODATA. */
|
/* More messages that don't work with LBS_NODATA. */
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = SendMessageA(listbox, LB_FINDSTRING, 1, 0);
|
||||||
|
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
||||||
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
ret = SendMessageA(listbox, LB_FINDSTRING, 1, 42);
|
ret = SendMessageA(listbox, LB_FINDSTRING, 1, 42);
|
||||||
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
||||||
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = SendMessageA(listbox, LB_FINDSTRINGEXACT, 1, 0);
|
||||||
|
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
||||||
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
ret = SendMessageA(listbox, LB_FINDSTRINGEXACT, 1, 42);
|
ret = SendMessageA(listbox, LB_FINDSTRINGEXACT, 1, 42);
|
||||||
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
||||||
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = SendMessageA(listbox, LB_SELECTSTRING, 1, 0);
|
||||||
|
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
||||||
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
ret = SendMessageA(listbox, LB_SELECTSTRING, 1, 42);
|
ret = SendMessageA(listbox, LB_SELECTSTRING, 1, 42);
|
||||||
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
||||||
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
|
||||||
|
|
||||||
DestroyWindow(listbox);
|
DestroyWindow(listbox);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue