diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 0b3439bd4d9..44aaba0c9db 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -6502,14 +6502,9 @@ static BOOL LISTVIEW_GetColumnT(const LISTVIEW_INFO *infoPtr, INT nColumn, LPLVC return TRUE; } - -static BOOL LISTVIEW_GetColumnOrderArray(const LISTVIEW_INFO *infoPtr, INT iCount, LPINT lpiArray) +static inline BOOL LISTVIEW_GetColumnOrderArray(const LISTVIEW_INFO *infoPtr, INT iCount, LPINT lpiArray) { - TRACE("iCount=%d, lpiArray=%p\n", iCount, lpiArray); - - if (!lpiArray) - return FALSE; - + if (!infoPtr->hwndHeader) return FALSE; return SendMessageW(infoPtr->hwndHeader, HDM_GETORDERARRAY, iCount, (LPARAM)lpiArray); } diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 8ce1cfe0286..0947251d8c3 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -176,6 +176,8 @@ static const struct message listview_ownerdata_switchto_seq[] = { static const struct message listview_getorderarray_seq[] = { { LVM_GETCOLUMNORDERARRAY, sent|id|wparam, 2, 0, LISTVIEW_ID }, { HDM_GETORDERARRAY, sent|id|wparam, 2, 0, HEADER_ID }, + { LVM_GETCOLUMNORDERARRAY, sent|id|wparam, 0, 0, LISTVIEW_ID }, + { HDM_GETORDERARRAY, sent|id|wparam, 0, 0, HEADER_ID }, { 0 } }; @@ -1413,13 +1415,28 @@ static void test_items(void) static void test_columns(void) { - HWND hwnd; + HWND hwnd, header; LVCOLUMNA column; LVITEMA item; INT order[2]; CHAR buff[5]; DWORD rc; + hwnd = CreateWindowExA(0, "SysListView32", "foo", LVS_LIST, + 10, 10, 100, 200, hwndparent, NULL, NULL, NULL); + ok(hwnd != NULL, "failed to create listview window\n"); + + header = (HWND)SendMessageA(hwnd, LVM_GETHEADER, 0, 0); + ok(header == NULL, "got %p\n", header); + + rc = SendMessageA(hwnd, LVM_GETCOLUMNORDERARRAY, 2, (LPARAM)&order); + ok(rc == 0, "got %d\n", rc); + + header = (HWND)SendMessageA(hwnd, LVM_GETHEADER, 0, 0); + ok(header == NULL, "got %p\n", header); + + DestroyWindow(hwnd); + hwnd = CreateWindowExA(0, "SysListView32", "foo", LVS_REPORT, 10, 10, 100, 200, hwndparent, NULL, NULL, NULL); ok(hwnd != NULL, "failed to create listview window\n"); @@ -1457,6 +1474,9 @@ static void test_columns(void) ok(order[0] == 0, "Expected order 0, got %d\n", order[0]); ok(order[1] == 1, "Expected order 1, got %d\n", order[1]); + rc = SendMessageA(hwnd, LVM_GETCOLUMNORDERARRAY, 0, 0); + expect(0, rc); + ok_sequence(sequences, LISTVIEW_SEQ_INDEX, listview_getorderarray_seq, "get order array", FALSE); /* after column added subitem is considered as present */