[1/3] comctl32/listview: LVM_SETITEM is unsupported on LVS_OWNERDATA

Nikolay Sivov bunglehead at gmail.com
Tue Apr 21 05:52:50 CDT 2009


Changelog:
    - LVM_SETITEM is unsupported on LVS_OWNERDATA

>From 9d60fe953048729e05552200efbfa334b831c022 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Tue, 21 Apr 2009 05:26:10 -0400
Subject: LVM_SETITEM is unsupported on LVS_OWNERDATA

---
 dlls/comctl32/listview.c       |    7 ++++---
 dlls/comctl32/tests/listview.c |   18 ++++++++++++++++++
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 3c294f2..1ba8162 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -10010,10 +10010,11 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
   /* case LVM_SETINSERTMARKCOLOR: */
 
   case LVM_SETITEMA:
-    return LISTVIEW_SetItemT(infoPtr, (LPLVITEMW)lParam, FALSE);
-
   case LVM_SETITEMW:
-    return LISTVIEW_SetItemT(infoPtr, (LPLVITEMW)lParam, TRUE);
+    {
+	if (infoPtr->dwStyle & LVS_OWNERDATA) return FALSE;
+	return LISTVIEW_SetItemT(infoPtr, (LPLVITEMW)lParam, (uMsg == LVM_SETITEMW));
+    }
 
   case LVM_SETITEMCOUNT:
     return LISTVIEW_SetItemCount(infoPtr, (INT)wParam, (DWORD)lParam);
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 6b68c56..b85dbfb 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -1651,6 +1651,24 @@ static void test_ownerdata(void)
     expect(TRUE, res);
     res = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
     expect(1, res);
+    res = SendMessageA(hwnd, LVM_GETITEMCOUNT, 0, 0);
+    expect(1, res);
+    DestroyWindow(hwnd);
+
+    /* LVM_SETITEM is unsupported on LVS_OWNERDATA */
+    hwnd = create_listview_control(LVS_OWNERDATA);
+    ok(hwnd != NULL, "failed to create a listview window\n");
+    res = SendMessageA(hwnd, LVM_SETITEMCOUNT, 1, 0);
+    ok(res != 0, "Expected LVM_SETITEMCOUNT to succeed\n");
+    res = SendMessageA(hwnd, LVM_GETITEMCOUNT, 0, 0);
+    expect(1, res);
+    memset(&item, 0, sizeof(item));
+    item.mask = LVIF_STATE;
+    item.iItem = 0;
+    item.stateMask = LVIS_SELECTED;
+    item.state     = LVIS_SELECTED;
+    res = SendMessageA(hwnd, LVM_SETITEM, 0, (LPARAM)&item);
+    expect(FALSE, res);
     DestroyWindow(hwnd);
 }
 
-- 
1.5.6.5





More information about the wine-patches mailing list