[PATCH v4 2/7] comctl32/listbox: Make SetCount fail if LBS_NODATA is not set

Gabriel Ivăncescu gabrielopcode at gmail.com
Tue Nov 13 04:35:58 CST 2018


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

diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index 3d8804a..4a2df52 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -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)
diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c
index c560ce1..6ac3c73 100644
--- a/dlls/comctl32/tests/listbox.c
+++ b/dlls/comctl32/tests/listbox.c
@@ -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);
     }
-- 
2.19.1




More information about the wine-devel mailing list