user32: LB_SETITEMDATA should return 1 on success, not 0
Peter Verthez
peter.verthez at advalvas.be
Sun Aug 12 14:42:11 CDT 2007
---
ChangeLog | 9 +++++++++
dlls/user32/listbox.c | 2 +-
dlls/user32/tests/listbox.c | 22 ++++++++++++++++++++++
include/winuser.h | 1 +
4 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8fe4354..a7c84df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-08-12 Peter Verthez <Peter.Verthez at advalvas.be>
+
+ * dlls/user32/tests/listbox.c:
+ Added test for LB_SETITEMDATA..
+
+ * dlls/user32/listbox.c, include/winuser.h:
+ user32: StraceNt utility shows that LB_SETITEMDATA should return 1
+ on success, not 0 (this is undocumented).
+
2007-08-10 Paul Vriens <paul.vriens.wine at gmail.com>
* dlls/snmpapi/tests/util.c:
diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 166d176..461b5d8 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -2677,7 +2677,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
return LB_ERR;
}
descr->items[wParam].data = lParam;
- return LB_OKAY;
+ return LB_SETITEMDATA_OKAY;
case LB_GETCOUNT16:
case LB_GETCOUNT:
diff --git a/dlls/user32/tests/listbox.c b/dlls/user32/tests/listbox.c
index 125bd9d..156299c 100644
--- a/dlls/user32/tests/listbox.c
+++ b/dlls/user32/tests/listbox.c
@@ -512,6 +512,27 @@ static void test_itemfrompoint(void)
DestroyWindow( hList );
}
+static void test_listbox_item_data(void)
+{
+ HWND hList;
+ int r, id;
+
+ hList = CreateWindow( "ListBox", "list test", 0,
+ 1, 1, 600, 100, NULL, NULL, NULL, NULL );
+ ok( hList != NULL, "failed to create listbox\n");
+
+ id = SendMessage( hList, LB_ADDSTRING, 0, (LPARAM) "hi");
+ ok( id == 0, "item id wrong\n");
+
+ r = SendMessage( hList, LB_SETITEMDATA, 0, MAKELPARAM( 20, 0 ));
+ ok(r == LB_SETITEMDATA_OKAY, "LB_SETITEMDATA returned %d instead of LB_SETITEMDATA_OKAY\n", r);
+
+ r = SendMessage( hList, LB_GETITEMDATA, 0, 0);
+ ok( r == 20, "get item data failed\n");
+
+ DestroyWindow( hList );
+}
+
START_TEST(listbox)
{
const struct listbox_test SS =
@@ -587,4 +608,5 @@ START_TEST(listbox)
test_selection();
test_listbox_height();
test_itemfrompoint();
+ test_listbox_item_data();
}
diff --git a/include/winuser.h b/include/winuser.h
index 4297a8d..97363e0 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -2428,6 +2428,7 @@ typedef struct tagSCROLLBARINFO
/* Listbox message return values */
#define LB_OKAY 0
+#define LB_SETITEMDATA_OKAY 1 /* undoc. OK return for LB_SETITEMDATA */
#define LB_ERR (-1)
#define LB_ERRSPACE (-2)
--
1.5.2.2
More information about the wine-patches
mailing list