From 0a5c360f39b36c9e5bac6e6bb51e1766fe8b8025 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gabriel=20Iv=C4=83ncescu?= Date: Thu, 15 Nov 2018 11:46:17 +0200 Subject: [PATCH] user32/listbox: Make SetCount fail if LBS_NODATA is not set. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/user32/listbox.c | 2 +- dlls/user32/tests/listbox.c | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index 2fcd73548b9..b5b7dc6bdcb 100644 --- a/dlls/user32/listbox.c +++ b/dlls/user32/listbox.c @@ -1757,7 +1757,7 @@ static LRESULT LISTBOX_SetCount( LB_DESCR *descr, INT count ) { LRESULT ret; - if (HAS_STRINGS(descr)) + if (!(descr->style & LBS_NODATA)) { SetLastError(ERROR_SETCOUNT_ON_BAD_LB); return LB_ERR; diff --git a/dlls/user32/tests/listbox.c b/dlls/user32/tests/listbox.c index 776e3f37185..813968f3d6a 100644 --- a/dlls/user32/tests/listbox.c +++ b/dlls/user32/tests/listbox.c @@ -264,7 +264,6 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA } else { - todo_wine_if((style & LBS_NODATA) && strings[mi->itemID]) ok((void*)mi->itemData == strings[mi->itemID], "mi->itemData = %08lx, expected %p\n", mi->itemData, strings[mi->itemID]); } @@ -1765,9 +1764,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 == 0) ok( GetLastError() == ERROR_SETCOUNT_ON_BAD_LB, "Unexpected error %d.\n", GetLastError() ); DestroyWindow( listbox ); @@ -2137,7 +2134,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); } -- 2.11.4.GIT