Skip to content

Commit 9a55c93

Browse files
authored
[BROWSEUI][SHELL32] Fix desktop and computer find files locations (reactos#7721)
- Searching the Desktop now searches the two desktop folders. - Searching My Computer now searches all local disks. - Adds a "Browse..." entry to the combobox list.
1 parent 556cc8a commit 9a55c93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+398
-33
lines changed

dll/win32/browseui/shellfind/CFindFolder.cpp

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,19 @@ struct _SearchData
148148
{
149149
HWND hwnd;
150150
HANDLE hStopEvent;
151-
CStringW szPath;
151+
LOCATIONITEM *pPaths;
152152
CStringW szFileName;
153153
CStringA szQueryA;
154154
CStringW szQueryW;
155155
CStringW szQueryU16BE;
156156
CStringA szQueryU8;
157157
BOOL SearchHidden;
158158
CComPtr<CFindFolder> pFindFolder;
159+
160+
~_SearchData()
161+
{
162+
FreeList(pPaths);
163+
}
159164
};
160165

161166
template<typename TChar, typename TString, int (&StrNCmp)(const TChar *, const TChar *, size_t)>
@@ -461,11 +466,17 @@ DWORD WINAPI CFindFolder::SearchThreadProc(LPVOID lpParameter)
461466
{
462467
_SearchData *data = static_cast<_SearchData*>(lpParameter);
463468

469+
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
470+
464471
HRESULT hrCoInit = CoInitializeEx(NULL, COINIT_MULTITHREADED);
465472

466473
data->pFindFolder->NotifyConnections(DISPID_SEARCHSTART);
467474

468-
UINT uTotalFound = RecursiveFind(data->szPath, data);
475+
UINT uTotalFound = 0;
476+
for (LOCATIONITEM *pLocation = data->pPaths; pLocation; pLocation = pLocation->pNext)
477+
{
478+
uTotalFound += RecursiveFind(pLocation->szPath, data);
479+
}
469480

470481
data->pFindFolder->NotifyConnections(DISPID_SEARCHCOMPLETE);
471482

@@ -521,7 +532,7 @@ LRESULT CFindFolder::StartSearch(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &
521532
pSearchData->hwnd = m_hWnd;
522533

523534
SearchStart *pSearchParams = (SearchStart *) lParam;
524-
pSearchData->szPath = pSearchParams->szPath;
535+
pSearchData->pPaths = pSearchParams->pPaths;
525536
pSearchData->szFileName = pSearchParams->szFileName;
526537
pSearchData->szQueryA = pSearchParams->szQuery;
527538
pSearchData->szQueryW = pSearchParams->szQuery;
@@ -589,12 +600,15 @@ LRESULT CFindFolder::StartSearch(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &
589600
SetEvent(m_hStopEvent);
590601
pSearchData->hStopEvent = m_hStopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
591602

592-
if (!SHCreateThread(SearchThreadProc, pSearchData, NULL, NULL))
603+
if (!SHCreateThread(SearchThreadProc, pSearchData, 0, NULL))
593604
{
594-
SHFree(pSearchData);
595-
return 0;
605+
if (pSearchData->hStopEvent)
606+
{
607+
CloseHandle(pSearchData->hStopEvent);
608+
m_hStopEvent = NULL;
609+
}
610+
delete pSearchData;
596611
}
597-
598612
return 0;
599613
}
600614

0 commit comments

Comments
 (0)