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

Gabriel Ivăncescu gabrielopcode at gmail.com
Tue Nov 6 05:30:53 CST 2018


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---

Here's the patch series with all of the relevant tests for LBS_NODATA
implementation. To avoid having to use todo_wine for no reason which then gets
replaced, the tests are simply placed after the given patch that requires
them to prove its correct behavior. For example, the second patch tests
SetCount and the third one tests the creation styles so that the first
patch is proven to be Windows' behavior.

The later patches also have their own tests at the end of the series,
which should conclude all relevant tests for LBS_NODATA.

Please note that the final implementation of LBS_NODATA that comes after
this won't affect the tests; it is purely for performance and memory usage
(as that is the whole point of the style to begin with). So these patches
can be committed by themselves and still be completely correct in regards
to Windows behavior. For example if you simply run the tests without the
other patches, they will fail on Wine (rightfully).

 dlls/comctl32/listbox.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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))
-- 
2.19.1




More information about the wine-devel mailing list