From 8276a3375b653cec5df2f823bf5b5ae08550152f Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Thu, 10 May 2012 11:19:37 +0200 Subject: [PATCH] comctl32: LVM_SETITEMTEXT is not supported on LVS_OWNERDATA. --- dlls/comctl32/listview.c | 1 + dlls/comctl32/tests/listview.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index ccabe6bad71..e50784820d2 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -8896,6 +8896,7 @@ static BOOL LISTVIEW_SetItemTextT(LISTVIEW_INFO *infoPtr, INT nItem, const LVITE LVITEMW lvItem; if (!lpLVItem || nItem < 0 || nItem >= infoPtr->nItemCount) return FALSE; + if (infoPtr->dwStyle & LVS_OWNERDATA) return FALSE; lvItem.iItem = nItem; lvItem.iSubItem = lpLVItem->iSubItem; diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index c38bb611d6c..b96e85fcb18 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -2627,6 +2627,8 @@ static void test_sorting(void) static void test_ownerdata(void) { + static char test_str[] = "test"; + HWND hwnd; LONG_PTR style, ret; DWORD res; @@ -2711,7 +2713,7 @@ static void test_ownerdata(void) expect(1, res); DestroyWindow(hwnd); - /* LVM_SETITEM is unsupported on LVS_OWNERDATA */ + /* LVM_SETITEM and LVM_SETITEMTEXT is unsupported on LVS_OWNERDATA */ hwnd = create_listview_control(LVS_OWNERDATA | LVS_REPORT); ok(hwnd != NULL, "failed to create a listview window\n"); res = SendMessageA(hwnd, LVM_SETITEMCOUNT, 1, 0); @@ -2725,6 +2727,10 @@ static void test_ownerdata(void) item.state = LVIS_SELECTED; res = SendMessageA(hwnd, LVM_SETITEM, 0, (LPARAM)&item); expect(FALSE, res); + memset(&item, 0, sizeof(item)); + item.pszText = test_str; + res = SendMessageA(hwnd, LVM_SETITEMTEXT, 0, (LPARAM)&item); + expect(FALSE, res); DestroyWindow(hwnd); /* check notifications after focused/selected changed */