Skip to content

Commit 81931d1

Browse files
authored
[SHELL32] Use the folder column, not the list column during DefView sorting (reactos#8162)
IShellFolder::CompareIDs does not understand ListView columns, we must provide it with a column index it understands during sorting. CORE-20251
1 parent c25856d commit 81931d1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

dll/win32/shell32/CDefView.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ struct LISTVIEW_SORT_INFO
6565
bool bColumnIsFolderColumn;
6666
UINT8 Reserved; // Unused
6767
INT ListColumn;
68+
INT FolderColumn; // Only valid during a sorting operation
6869

6970
enum { UNSPECIFIEDCOLUMN = -1 };
7071
void Reset()
@@ -1262,7 +1263,7 @@ INT CALLBACK CDefView::ListViewCompareItems(LPARAM lParam1, LPARAM lParam2, LPAR
12621263
PCUIDLIST_RELATIVE pidl2 = reinterpret_cast<PCUIDLIST_RELATIVE>(lParam2);
12631264
CDefView *pThis = reinterpret_cast<CDefView*>(lpData);
12641265

1265-
HRESULT hres = pThis->m_pSFParent->CompareIDs(pThis->m_sortInfo.ListColumn, pidl1, pidl2);
1266+
HRESULT hres = pThis->m_pSFParent->CompareIDs(pThis->m_sortInfo.FolderColumn, pidl1, pidl2);
12661267
if (FAILED_UNEXPECTEDLY(hres))
12671268
return 0;
12681269

@@ -1317,7 +1318,7 @@ BOOL CDefView::_Sort(int Col)
13171318
hColumn.fmt |= (m_sortInfo.Direction > 0 ? HDF_SORTUP : HDF_SORTDOWN);
13181319
Header_SetItem(hHeader, m_sortInfo.ListColumn, &hColumn);
13191320

1320-
/* Sort the list, using the current values of ListColumn and bIsAscending */
1321+
m_sortInfo.FolderColumn = MapListColumnToFolderColumn(m_sortInfo.ListColumn);
13211322
ASSERT(m_sortInfo.Direction == 1 || m_sortInfo.Direction == -1);
13221323
return m_ListView.SortItems(ListViewCompareItems, this);
13231324
}

0 commit comments

Comments
 (0)