Skip to content

Commit c14a14e

Browse files
authored
[BROWSEUI] Find files must compare the entire path when the view asks about the name (reactos#8174)
CORE-20256
1 parent 4562306 commit c14a14e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

dll/win32/browseui/shellfind/CFindFolder.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,11 +890,18 @@ STDMETHODIMP CFindFolder::BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserve
890890

891891
STDMETHODIMP CFindFolder::CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
892892
{
893+
HRESULT hr;
893894
WORD wColumn = LOWORD(lParam);
894895
switch (wColumn)
895896
{
896897
case COL_NAME_INDEX: // Name
897-
break;
898+
C_ASSERT(COL_NAME_INDEX == 0); // SHELL32::SHFSF_COL_NAME
899+
// We can have more than one item with the same filename, in this case, look at the path as well.
900+
// When DefView wants to identify a specific item, it will use the SHCIDS_CANONICALONLY flag.
901+
hr = m_pisfInner->CompareIDs(MAKELONG(0, HIWORD(lParam)), _ILGetFSPidl(pidl1), _ILGetFSPidl(pidl2));
902+
if (hr == S_EQUAL && (lParam & (SHCIDS_CANONICALONLY | SHCIDS_ALLFIELDS)))
903+
hr = CompareIDs(COL_LOCATION_INDEX, pidl1, pidl2);
904+
return hr;
898905
case COL_LOCATION_INDEX: // Path
899906
return MAKE_COMPARE_HRESULT(StrCmpW(_ILGetPath(pidl1), _ILGetPath(pidl2)));
900907
case COL_RELEVANCE_INDEX: // Relevance

0 commit comments

Comments
 (0)