comctl32/listbox: Make SetCount fail if LBS_NODATA is not set.

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:
Gabriel Ivăncescu 2018-11-13 12:35:58 +02:00 committed by Alexandre Julliard
parent 8e13120c80
commit 2aedcf3f8c
2 changed files with 1 additions and 8 deletions

View File

@ -1752,11 +1752,7 @@ static LRESULT LISTBOX_SetCount( LB_DESCR *descr, INT count )
{
LRESULT ret;
if (HAS_STRINGS(descr))
{
SetLastError(ERROR_SETCOUNT_ON_BAD_LB);
return LB_ERR;
}
if (!(descr->style & LBS_NODATA)) return LB_ERR;
/* FIXME: this is far from optimal... */
if (count > descr->nb_items)

View File

@ -1806,9 +1806,7 @@ static void test_set_count( void )
SetLastError( 0xdeadbeef );
ret = SendMessageA( listbox, LB_SETCOUNT, 100, 0 );
todo_wine_if(i == 0)
ok( ret == LB_ERR, "expected %d, got %d\n", LB_ERR, ret );
todo_wine_if(i == 1)
ok( GetLastError() == 0xdeadbeef, "Unexpected error %d.\n", GetLastError() );
DestroyWindow( listbox );
@ -2341,7 +2339,6 @@ todo_wine
style = GetWindowLongA(listbox, GWL_STYLE);
ok((style & invalid_styles[i]) == invalid_styles[i], "%u: unexpected window styles %#x.\n", i, style);
ret = SendMessageA(listbox, LB_SETCOUNT, 100, 0);
todo_wine_if(i == 1 || i == 4)
ok(ret == LB_ERR, "%u: unexpected return value %d.\n", i, ret);
DestroyWindow(listbox);
}