[PATCH v3 4/8] comctl32/listbox: Make SetCount fail if LBS_NODATA is not set

Gabriel Ivăncescu gabrielopcode at gmail.com
Thu Nov 8 05:39:51 CST 2018


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/comctl32/listbox.c       | 5 ++++-
 dlls/comctl32/tests/listbox.c | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index 2137ef8..0a7c341 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -1752,7 +1752,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;
@@ -2518,6 +2518,9 @@ static BOOL LISTBOX_Create( HWND hwnd, LPHEADCOMBO lphc )
     if (descr->style & LBS_OWNERDRAWVARIABLE) descr->style |= LBS_NOINTEGRALHEIGHT;
     descr->item_height = LISTBOX_SetFont( descr, 0 );
 
+    if ((descr->style & (LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_SORT)) != LBS_OWNERDRAWFIXED)
+        descr->style &= ~LBS_NODATA;
+
     if (descr->style & LBS_OWNERDRAWFIXED)
     {
 	if( descr->lphc && (descr->lphc->dwStyle & CBS_DROPDOWN))
diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c
index 5fdfaf8..b4be05c 100644
--- a/dlls/comctl32/tests/listbox.c
+++ b/dlls/comctl32/tests/listbox.c
@@ -1797,7 +1797,7 @@ static void test_set_count( void )
     listbox = create_listbox( LBS_OWNERDRAWFIXED | WS_CHILD | WS_VISIBLE, parent );
 
     ret = SendMessageA( listbox, LB_SETCOUNT, 100, 0 );
-    todo_wine ok( ret == LB_ERR, "expected %d, got %d\n", LB_ERR, ret );
+    ok( ret == LB_ERR, "expected %d, got %d\n", LB_ERR, ret );
 
     DestroyWindow( listbox );
     DestroyWindow( parent );
-- 
2.19.1




More information about the wine-devel mailing list