Dmitry Timoshkov : user32: Fix order of items passed in WM_COMPAREITEM data.

Alexandre Julliard julliard at winehq.org
Thu Jun 28 15:55:10 CDT 2018


Module: wine
Branch: master
Commit: 18420c24c98f1bc1dcce5412b1c7972a28c46748
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=18420c24c98f1bc1dcce5412b1c7972a28c46748

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Thu Jun 28 18:48:43 2018 +0800

user32: Fix order of items passed in WM_COMPAREITEM data.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/listbox.c   | 12 ++++++------
 dlls/user32/tests/msg.c |  4 ----
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 8df6763..4900339 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -835,7 +835,7 @@ static INT LISTBOX_FindStringPos( LB_DESCR *descr, LPCWSTR str, BOOL exact )
     {
         index = (min + max) / 2;
         if (HAS_STRINGS(descr))
-            res = LISTBOX_lstrcmpiW( descr->locale, str, descr->items[index].str);
+            res = LISTBOX_lstrcmpiW( descr->locale, descr->items[index].str, str );
         else
         {
             COMPAREITEMSTRUCT cis;
@@ -846,15 +846,15 @@ static INT LISTBOX_FindStringPos( LB_DESCR *descr, LPCWSTR str, BOOL exact )
             cis.hwndItem   = descr->self;
             /* note that some application (MetaStock) expects the second item
              * to be in the listbox */
-            cis.itemID1    = -1;
-            cis.itemData1  = (ULONG_PTR)str;
-            cis.itemID2    = index;
-            cis.itemData2  = descr->items[index].data;
+            cis.itemID1    = index;
+            cis.itemData1  = descr->items[index].data;
+            cis.itemID2    = -1;
+            cis.itemData2  = (ULONG_PTR)str;
             cis.dwLocaleId = descr->locale;
             res = SendMessageW( descr->owner, WM_COMPAREITEM, id, (LPARAM)&cis );
         }
         if (!res) return index;
-        if (res < 0) max = index;
+        if (res > 0) max = index;
         else min = index + 1;
     }
     return exact ? -1 : max;
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 5a5d5ed..da01766 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -2276,9 +2276,7 @@ static void add_message_(int line, const struct recvd_message *msg)
 
                 ok(msg->wParam == cis->CtlID, "expected %#x, got %#lx\n", cis->CtlID, msg->wParam);
                 ok(cis->hwndItem == ctrl, "expected %p, got %p\n", ctrl, cis->hwndItem);
-todo_wine
                 ok((int)cis->itemID1 >= 0, "expected >= 0, got %d\n", cis->itemID1);
-todo_wine
                 ok((int)cis->itemID2 == -1, "expected -1, got %d\n", cis->itemID2);
 
                 sprintf( seq->output, "%s: %p WM_COMPAREITEM: CtlType %#x, CtlID %#x, itemID1 %#x, itemData1 %#lx, itemID2 %#x, itemData2 %#lx",
@@ -14385,10 +14383,8 @@ static void test_listbox_messages(void)
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 0");
     ok(ret == 0, "expected 0, got %ld\n", ret);
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 1");
-todo_wine
     ok(ret == 1, "expected 1, got %ld\n", ret);
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 2");
-todo_wine
     ok(ret == 2, "expected 2, got %ld\n", ret);
 
     ok_sequence(wm_lb_addstring_sort_ownerdraw, "LB_ADDSTRING", TRUE);




More information about the wine-cvs mailing list