ReactOS 0.4.16-dev-980-g00983aa
CFindFolder.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Search Shell Extension
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Search results folder
5 * COPYRIGHT: Copyright 2019 Brock Mammen
6 */
7
8#include "CFindFolder.h"
9#include <exdispid.h>
10
12
13static HRESULT SHELL32_CoCreateInitSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO* ppfti,
14 LPCITEMIDLIST pidlChild, const GUID* clsid, REFIID riid, LPVOID *ppvOut)
15{
16 HRESULT hr;
17 CComPtr<IShellFolder> pShellFolder;
18
20 if (FAILED(hr))
21 return hr;
22
23 LPITEMIDLIST pidlAbsolute = ILCombine (pidlRoot, pidlChild);
26
27 if (ppfti && SUCCEEDED(pShellFolder->QueryInterface(IID_PPV_ARG(IPersistFolder3, &ppf3))))
28 {
29 ppf3->InitializeEx(NULL, pidlAbsolute, ppfti);
30 }
31 else if (SUCCEEDED(pShellFolder->QueryInterface(IID_PPV_ARG(IPersistFolder, &ppf))))
32 {
33 ppf->Initialize(pidlAbsolute);
34 }
35 ILFree (pidlAbsolute);
36
37 return pShellFolder->QueryInterface(riid, ppvOut);
38}
39
41 HMENU hMenu,
42 UINT indexMenu,
43 BOOL fByPosition,
44 UINT wID,
45 UINT fType,
46 LPCWSTR dwTypeData,
47 UINT fState)
48{
49 MENUITEMINFOW mii;
50 WCHAR wszText[100];
51
52 ZeroMemory(&mii, sizeof(mii));
53 mii.cbSize = sizeof(mii);
54 if (fType == MFT_SEPARATOR)
55 mii.fMask = MIIM_ID | MIIM_TYPE;
56 else if (fType == MFT_STRING)
57 {
59 if (IS_INTRESOURCE(dwTypeData))
60 {
61 if (LoadStringW(_AtlBaseModule.GetResourceInstance(), LOWORD((ULONG_PTR)dwTypeData), wszText, _countof(wszText)))
62 mii.dwTypeData = wszText;
63 else
64 {
65 ERR("failed to load string %p\n", dwTypeData);
66 return;
67 }
68 }
69 else
70 mii.dwTypeData = (LPWSTR)dwTypeData;
71 mii.fState = fState;
72 }
73
74 mii.wID = wID;
75 mii.fType = fType;
76 InsertMenuItemW(hMenu, indexMenu, fByPosition, &mii);
77}
78
80{
81 int iResource;
83 int fmt;
84 int cxChar;
85};
86
88{
92};
93
95 m_pidl(NULL),
96 m_hStopEvent(NULL)
97{
98}
99
101{
102 CComHeapPtr<ITEMIDLIST> lpFSPidl(ILCreateFromPathW(lpszPath));
103 if (!lpFSPidl)
104 {
105 ERR("Failed to create pidl from path\n");
106 return NULL;
107 }
108 LPITEMIDLIST lpLastFSPidl = ILFindLastID(lpFSPidl);
109
110 SIZE_T cbPath = (PathFindFileNameW(lpszPath) - lpszPath + 1) * sizeof(WCHAR);
111 SIZE_T cbData = sizeof(WORD) + cbPath + lpLastFSPidl->mkid.cb;
112 if (cbData > 0xffff)
113 return NULL;
114 LPITEMIDLIST pidl = (LPITEMIDLIST) SHAlloc(cbData + sizeof(WORD));
115 if (!pidl)
116 return NULL;
117
118 LPBYTE p = (LPBYTE) pidl;
119 p += sizeof(WORD); // mkid.cb
120
121 PWSTR path = (PWSTR)p;
122 memcpy(p, lpszPath, cbPath);
123 p += cbPath;
124 ((PWSTR)p)[-1] = UNICODE_NULL; // "C:\" not "C:" (required by ILCreateFromPathW and matches Windows)
125 if (!PathIsRootW(path))
126 {
127 p -= sizeof(WCHAR);
128 ((PWSTR)p)[-1] = UNICODE_NULL; // "C:\folder"
129 }
130
131 memcpy(p, lpLastFSPidl, lpLastFSPidl->mkid.cb);
132 p += lpLastFSPidl->mkid.cb;
133
134 pidl->mkid.cb = p - (LPBYTE)pidl;
135 ((LPITEMIDLIST)p)->mkid.cb = 0; // Terminator
136 return pidl;
137}
138
140{
141 if (!pidl || !pidl->mkid.cb)
142 return NULL;
143 return (LPCWSTR) pidl->mkid.abID;
144}
145
147{
148 if (!pidl || !pidl->mkid.cb)
149 return pidl;
150 return (LPCITEMIDLIST) ((LPBYTE) pidl->mkid.abID
151 + ((wcslen((LPCWSTR) pidl->mkid.abID) + 1) * sizeof(WCHAR)));
152}
153
155{
156 PIDLIST_ABSOLUTE pidl = NULL;
157 if (PIDLIST_ABSOLUTE pidlFolder = SHSimpleIDListFromPath(_ILGetPath(pidl))) // FIXME: SHELL32_CreateSimpleIDListFromPath(, DIRECTORY)
158 {
159 pidl = ILCombine(pidlFolder, _ILGetFSPidl(pidl));
160 ILFree(pidlFolder);
161 }
162 return pidl;
163}
164
166{
168 PCWSTR path = _ILGetPath(pidl);
169 if (!path || !path[0])
170 return E_INVALIDARG;
171 PIDLIST_ABSOLUTE pidlFolder = ILCreateFromPathW(path); // FIXME: SHELL32_CreateSimpleIDListFromPath(, DIRECTORY);
172 if (!pidlFolder)
173 return E_FAIL;
174 HRESULT hr = m_pSfDesktop->BindToObject(pidlFolder, NULL, IID_PPV_ARG(IShellFolder, ppSF));
175 ILFree(pidlFolder);
176 if (ppidlLast)
177 *ppidlLast = _ILGetFSPidl(pidl);
178 return hr;
179}
180
182{
184 HRESULT hr = GetFSFolderAndChild(pidl, &pSF1, ppidlLast);
185 if (SUCCEEDED(hr))
186 hr = pSF1->QueryInterface(IID_PPV_ARG(IShellFolder2, ppSF));
187 return hr;
188}
189
190static int CALLBACK ILFreeHelper(void *pItem, void *pCaller)
191{
192 ILFree((LPITEMIDLIST)pItem);
193 return TRUE;
194}
195
197{
199}
200
202{
203 HDPA hDpa = DPA_Create(cidl / 2);
204 if (hDpa)
205 {
206 for (UINT i = 0; i < cidl; ++i)
207 {
208 PIDLIST_ABSOLUTE pidl = _ILCreateAbsolute(apidl[i]);
209 if (pidl)
210 {
211 if (DPA_InsertPtr(hDpa, i, pidl) >= 0)
212 continue;
213 ILFree(pidl);
214 }
215 FreePidlArray(hDpa);
216 return NULL;
217 }
218 }
219 return hDpa;
220}
221
223{
234
236 {
238 }
239};
240
241template<typename TChar, typename TString, int (&StrNCmp)(const TChar *, const TChar *, size_t)>
242static const TChar* StrStrN(const TChar *lpFirst, const TString &lpSrch, UINT cchMax)
243{
244 if (!lpFirst || lpSrch.IsEmpty() || !cchMax)
245 return NULL;
246
247 for (UINT i = cchMax; i > 0 && *lpFirst; i--, lpFirst++)
248 {
249 if (!StrNCmp(lpFirst, lpSrch, lpSrch.GetLength()))
250 return (const TChar*)lpFirst;
251 }
252
253 return NULL;
254}
255
256static inline BOOL
257StrFindNIA(const CHAR *lpFirst, const CStringA &lpSrch, UINT cchMax)
258{
259 return StrStrN<CHAR, CStringA, _strnicmp>(lpFirst, lpSrch, cchMax) != NULL;
260}
261
262static inline BOOL
263StrFindNIW(const WCHAR *lpFirst, const CStringW &lpSrch, UINT cchMax)
264{
265 return StrStrN<WCHAR, CStringW, _wcsnicmp>(lpFirst, lpSrch, cchMax) != NULL;
266}
267
268/*
269 * The following code is borrowed from base/applications/cmdutils/more/more.c .
270 */
271typedef enum
272{
276 ENCODING_UTF8 = 3
278
279static BOOL
283 OUT ENCODING* Encoding OPTIONAL,
285{
286 PBYTE pBytes = (PBYTE)Buffer;
287 ENCODING encFile = ENCODING_ANSI;
288 DWORD dwPos = 0;
289
290 /*
291 * See http://archives.miloush.net/michkap/archive/2007/04/22/2239345.html
292 * for more details about the algorithm and the pitfalls behind it.
293 * Of course it would be actually great to make a nice function that
294 * would work, once and for all, and put it into a library.
295 */
296
297 /* Look for Byte Order Marks */
298 if ((BufferSize >= 2) && (pBytes[0] == 0xFF) && (pBytes[1] == 0xFE))
299 {
300 encFile = ENCODING_UTF16LE;
301 dwPos = 2;
302 }
303 else if ((BufferSize >= 2) && (pBytes[0] == 0xFE) && (pBytes[1] == 0xFF))
304 {
305 encFile = ENCODING_UTF16BE;
306 dwPos = 2;
307 }
308 else if ((BufferSize >= 3) && (pBytes[0] == 0xEF) && (pBytes[1] == 0xBB) && (pBytes[2] == 0xBF))
309 {
310 encFile = ENCODING_UTF8;
311 dwPos = 3;
312 }
313 else
314 {
315 /*
316 * Try using statistical analysis. Do not rely on the return value of
317 * IsTextUnicode as we can get FALSE even if the text is in UTF-16 BE
318 * (i.e. we have some of the IS_TEXT_UNICODE_REVERSE_MASK bits set).
319 * Instead, set all the tests we want to perform, then just check
320 * the passed tests and try to deduce the string properties.
321 */
322
323/*
324 * This mask contains the 3 highest bits from IS_TEXT_UNICODE_NOT_ASCII_MASK
325 * and the 1st highest bit from IS_TEXT_UNICODE_NOT_UNICODE_MASK.
326 */
327#define IS_TEXT_UNKNOWN_FLAGS_MASK ((7 << 13) | (1 << 11))
328
329 /* Flag out the unknown flags here, the passed tests will not have them either */
334 INT Results;
335
337 Results = Tests;
338
339 /*
340 * As the IS_TEXT_UNICODE_NULL_BYTES or IS_TEXT_UNICODE_ILLEGAL_CHARS
341 * flags are expected to be potentially present in the result without
342 * modifying our expectations, filter them out now.
343 */
345
346 /*
347 * NOTE: The flags IS_TEXT_UNICODE_ASCII16 and
348 * IS_TEXT_UNICODE_REVERSE_ASCII16 are not reliable.
349 *
350 * NOTE2: Check for potential "bush hid the facts" effect by also
351 * checking the original results (in 'Tests') for the absence of
352 * the IS_TEXT_UNICODE_NULL_BYTES flag, as we may presumably expect
353 * that in UTF-16 text there will be at some point some NULL bytes.
354 * If not, fall back to ANSI. This shows the limitations of using the
355 * IsTextUnicode API to perform such tests, and the usage of a more
356 * improved encoding detection algorithm would be really welcome.
357 */
358 if (!(Results & IS_TEXT_UNICODE_NOT_UNICODE_MASK) &&
359 !(Results & IS_TEXT_UNICODE_REVERSE_MASK) &&
360 (Results & IS_TEXT_UNICODE_UNICODE_MASK) &&
362 {
363 encFile = ENCODING_UTF16LE;
364 dwPos = (Results & IS_TEXT_UNICODE_SIGNATURE) ? 2 : 0;
365 }
366 else
367 if (!(Results & IS_TEXT_UNICODE_NOT_UNICODE_MASK) &&
368 !(Results & IS_TEXT_UNICODE_UNICODE_MASK) &&
369 (Results & IS_TEXT_UNICODE_REVERSE_MASK) &&
371 {
372 encFile = ENCODING_UTF16BE;
373 dwPos = (Results & IS_TEXT_UNICODE_REVERSE_SIGNATURE) ? 2 : 0;
374 }
375 else
376 {
377 /*
378 * Either 'Results' has neither of those masks set, as it can be
379 * the case for UTF-8 text (or ANSI), or it has both as can be the
380 * case when analysing pure binary data chunk. This is therefore
381 * invalid and we fall back to ANSI encoding.
382 * FIXME: In case of failure, assume ANSI (as long as we do not have
383 * correct tests for UTF8, otherwise we should do them, and at the
384 * very end, assume ANSI).
385 */
386 encFile = ENCODING_ANSI; // ENCODING_UTF8;
387 dwPos = 0;
388 }
389 }
390
391 if (Encoding)
392 *Encoding = encFile;
393 if (SkipBytes)
394 *SkipBytes = dwPos;
395
396 return (encFile != ENCODING_ANSI);
397}
398
399static BOOL SearchFile(LPCWSTR lpFilePath, _SearchData *pSearchData)
400{
403 return FALSE;
404
405 // FIXME: support large file
407 if (size == 0 || size == INVALID_FILE_SIZE)
408 {
410 return FALSE;
411 }
412
415 if (hFileMap == INVALID_HANDLE_VALUE)
416 return FALSE;
417
418 LPBYTE pbContents = (LPBYTE)MapViewOfFile(hFileMap, FILE_MAP_READ, 0, 0, size);
419 CloseHandle(hFileMap);
420 if (!pbContents)
421 return FALSE;
422
424 IsDataUnicode(pbContents, size, &encoding, NULL);
425
426 BOOL bFound;
427 switch (encoding)
428 {
429 case ENCODING_UTF16LE:
430 // UTF-16
431 bFound = StrFindNIW((LPCWSTR)pbContents, pSearchData->szQueryW, size / sizeof(WCHAR));
432 break;
433 case ENCODING_UTF16BE:
434 // UTF-16 BE
435 bFound = StrFindNIW((LPCWSTR)pbContents, pSearchData->szQueryU16BE, size / sizeof(WCHAR));
436 break;
437 case ENCODING_UTF8:
438 // UTF-8
439 bFound = StrFindNIA((LPCSTR)pbContents, pSearchData->szQueryU8, size / sizeof(CHAR));
440 break;
441 case ENCODING_ANSI:
442 default:
443 // ANSI or UTF-8 without BOM
444 bFound = StrFindNIA((LPCSTR)pbContents, pSearchData->szQueryA, size / sizeof(CHAR));
445 if (!bFound && pSearchData->szQueryA != pSearchData->szQueryU8)
446 bFound = StrFindNIA((LPCSTR)pbContents, pSearchData->szQueryU8, size / sizeof(CHAR));
447 break;
448 }
449
450 UnmapViewOfFile(pbContents);
451 return bFound;
452}
453
454static BOOL FileNameMatch(LPCWSTR FindDataFileName, _SearchData *pSearchData)
455{
456 if (pSearchData->szFileName.IsEmpty() || PathMatchSpecW(FindDataFileName, pSearchData->szFileName))
457 {
458 return TRUE;
459 }
460 return FALSE;
461}
462
464{
465 if (pSearchData->szQueryA.IsEmpty() || SearchFile(szPath, pSearchData))
466 {
467 return TRUE;
468 }
469 return FALSE;
470}
471
473{
474 if (!(FileAttributes & FILE_ATTRIBUTE_HIDDEN) || (pSearchData->SearchHidden))
475 {
476 return TRUE;
477 }
478 return FALSE;
479}
480
481static UINT RecursiveFind(LPCWSTR lpPath, _SearchData *pSearchData)
482{
483 if (WaitForSingleObject(pSearchData->hStopEvent, 0) != WAIT_TIMEOUT)
484 return 0;
485
487 WIN32_FIND_DATAW FindData;
488 HANDLE hFindFile;
489 BOOL bMoreFiles = TRUE;
490 UINT uTotalFound = 0;
491
492 PathCombineW(szPath, lpPath, L"*");
493
494 for (hFindFile = FindFirstFileW(szPath, &FindData);
495 bMoreFiles && hFindFile != INVALID_HANDLE_VALUE;
496 bMoreFiles = FindNextFileW(hFindFile, &FindData))
497 {
498#define IS_DOTS(psz) ((psz)[0] == L'.' && ((psz)[1] == 0 || ((psz)[1] == L'.' && (psz)[2] == 0)))
499 if (IS_DOTS(FindData.cFileName))
500 continue;
501
502 PathCombineW(szPath, lpPath, FindData.cFileName);
503
504 if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
505 {
507 if (pSearchData->szQueryW.IsEmpty() &&
508 FileNameMatch(FindData.cFileName, pSearchData) &&
509 AttribHiddenMatch(FindData.dwFileAttributes, pSearchData))
510 {
511 LPWSTR pszPathDup;
512 SHStrDupW(szPath, &pszPathDup);
513 PostMessageW(pSearchData->hwnd, WM_SEARCH_ADD_RESULT, 0, (LPARAM)pszPathDup);
514 uTotalFound++;
515 }
516 status.Format(IDS_SEARCH_FOLDER, FindData.cFileName);
517 LPWSTR pszStatusDup;
518 SHStrDupW(status.GetBuffer(), &pszStatusDup);
519 PostMessageW(pSearchData->hwnd, WM_SEARCH_UPDATE_STATUS, 0, (LPARAM)pszStatusDup);
520
521 uTotalFound += RecursiveFind(szPath, pSearchData);
522 }
523 else if (FileNameMatch(FindData.cFileName, pSearchData)
524 && AttribHiddenMatch(FindData.dwFileAttributes, pSearchData)
525 && ContentsMatch(szPath, pSearchData))
526 {
527 uTotalFound++;
528 LPWSTR pszPathDup;
529 SHStrDupW(szPath, &pszPathDup);
530 PostMessageW(pSearchData->hwnd, WM_SEARCH_ADD_RESULT, 0, (LPARAM)pszPathDup);
531 }
532 }
533
534 if (hFindFile != INVALID_HANDLE_VALUE)
535 FindClose(hFindFile);
536
537 return uTotalFound;
538}
539
541{
542 _SearchData *data = static_cast<_SearchData*>(lpParameter);
543
545
547
548 data->pFindFolder->NotifyConnections(DISPID_SEARCHSTART);
549
550 UINT uTotalFound = 0;
551 for (LOCATIONITEM *pLocation = data->pPaths; pLocation; pLocation = pLocation->pNext)
552 {
553 uTotalFound += RecursiveFind(pLocation->szPath, data);
554 }
555
556 data->pFindFolder->NotifyConnections(DISPID_SEARCHCOMPLETE);
557
559 status.Format(IDS_SEARCH_FILES_FOUND, uTotalFound);
560 LPWSTR pszStatusDup;
561 SHStrDupW(status.GetBuffer(), &pszStatusDup);
562 ::PostMessageW(data->hwnd, WM_SEARCH_UPDATE_STATUS, 0, (LPARAM)pszStatusDup);
563 ::SendMessageW(data->hwnd, WM_SEARCH_STOP, 0, 0);
564
565 CloseHandle(data->hStopEvent);
566 delete data;
567
568 if (SUCCEEDED(hrCoInit))
570
571 return 0;
572}
573
575{
576 DISPPARAMS dispatchParams = {0};
577 CComDynamicUnkArray &subscribers =
579 for (IUnknown** pSubscriber = subscribers.begin(); pSubscriber < subscribers.end(); pSubscriber++)
580 {
581 if (!*pSubscriber)
582 continue;
583
584 CComPtr<IDispatch> pDispatch;
585 HRESULT hResult = (*pSubscriber)->QueryInterface(IID_PPV_ARG(IDispatch, &pDispatch));
586 if (!FAILED_UNEXPECTEDLY(hResult))
587 pDispatch->Invoke(id, GUID_NULL, 0, DISPATCH_METHOD, &dispatchParams, NULL, NULL, NULL);
588 }
589}
590
592{
593 HKEY hkey;
594 DWORD size = sizeof(DWORD);
596 DWORD SearchHiddenValue = 0;
597
598 if (!lParam)
599 return 0;
600
601 // Clear all previous search results
602 UINT uItemIndex;
603 m_shellFolderView->RemoveObject(NULL, &uItemIndex);
604
605 _SearchData* pSearchData = new _SearchData();
606 pSearchData->pFindFolder = this;
607 pSearchData->hwnd = m_hWnd;
608
609 SearchStart *pSearchParams = (SearchStart *) lParam;
610 pSearchData->pPaths = pSearchParams->pPaths;
611 pSearchData->szFileName = pSearchParams->szFileName;
612 pSearchData->szQueryA = pSearchParams->szQuery;
613 pSearchData->szQueryW = pSearchParams->szQuery;
614
615 // UTF-16 BE
616 {
617 CStringW utf16 = pSearchData->szQueryW;
618 LPWSTR psz = utf16.GetBuffer();
619 for (SIZE_T i = 0; psz[i]; ++i)
620 {
621 psz[i] = MAKEWORD(HIBYTE(psz[i]), LOBYTE(psz[i]));
622 }
623 utf16.ReleaseBuffer();
624 pSearchData->szQueryU16BE = utf16;
625 }
626
627 // UTF-8
628 {
630 INT cch = WideCharToMultiByte(CP_UTF8, 0, pSearchData->szQueryW, -1, NULL, 0, NULL, NULL);
631 if (cch > 0)
632 {
633 LPSTR psz = utf8.GetBuffer(cch);
634 WideCharToMultiByte(CP_UTF8, 0, pSearchData->szQueryW, -1, psz, cch, NULL, NULL);
635 utf8.ReleaseBuffer();
636 pSearchData->szQueryU8 = utf8;
637 }
638 else
639 {
640 pSearchData->szQueryU8 = pSearchData->szQueryA;
641 }
642 }
643
644 pSearchData->SearchHidden = pSearchParams->SearchHidden;
645 SHFree(pSearchParams);
646
647 TRACE("pSearchParams->SearchHidden is '%d'.\n", pSearchData->SearchHidden);
648
649 if (pSearchData->SearchHidden)
650 SearchHiddenValue = 1;
651 else
652 SearchHiddenValue = 0;
653
654 /* Placing the code to save the changed settings to the registry here has the effect of not saving any changes */
655 /* to the registry unless the user clicks on the "Search" button. This is the same as what we see in Windows. */
656 result = RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer", 0, KEY_SET_VALUE, &hkey);
657 if (result == ERROR_SUCCESS)
658 {
659 if (RegSetValueExW(hkey, L"SearchHidden", NULL, REG_DWORD, (const BYTE*)&SearchHiddenValue, size) == ERROR_SUCCESS)
660 {
661 TRACE("SearchHidden is '%d'.\n", SearchHiddenValue);
662 }
663 else
664 {
665 ERR("RegSetValueEx for \"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SearchHidden\" Failed.\n");
666 }
667 RegCloseKey(hkey);
668 }
669 else
670 {
671 ERR("RegOpenKey for \"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\" Failed.\n");
672 }
673
674 if (m_hStopEvent)
677
678 if (!SHCreateThread(SearchThreadProc, pSearchData, 0, NULL))
679 {
680 if (pSearchData->hStopEvent)
681 {
682 CloseHandle(pSearchData->hStopEvent);
684 }
685 delete pSearchData;
686 }
687 return 0;
688}
689
691{
692 if (m_hStopEvent)
693 {
696 }
697 return 0;
698}
699
701{
702 if (!lParam)
703 return 0;
704
706
707 CComHeapPtr<ITEMIDLIST> lpSearchPidl(_ILCreate(lpPath));
708 if (lpSearchPidl)
709 {
710 UINT uItemIndex;
711 m_shellFolderView->AddObject(lpSearchPidl, &uItemIndex);
712 }
713
714 return 0;
715}
716
718{
720 if (m_shellBrowser)
721 {
722 m_shellBrowser->SetStatusTextSB(status);
723 }
724
725 return 0;
726}
727
728// *** IShellFolder2 methods ***
730{
732 return E_NOTIMPL;
733}
734
736{
738 return E_NOTIMPL;
739}
740
742{
743 if (pSort)
744 *pSort = COL_NAME_INDEX;
745 if (pDisplay)
746 *pDisplay = COL_NAME_INDEX;
747 return S_OK;
748}
749
751{
752 if (!pcsFlags)
753 return E_INVALIDARG;
754 if (iColumn >= _countof(g_ColumnDefs))
755 return m_pisfInner->GetDefaultColumnState(iColumn - _countof(g_ColumnDefs) + 1, pcsFlags);
756 *pcsFlags = g_ColumnDefs[iColumn].dwDefaultState;
757 return S_OK;
758}
759
761{
762 // FIXME: Handle COL_LOCATION_INDEX and COL_RELEVANCE_INDEX
764 PCUITEMID_CHILD pChild;
765 if (SUCCEEDED(GetFSFolder2AndChild(pidl, &pFolder, &pChild)))
766 return pFolder->GetDetailsEx(pChild, pscid, pv);
767 return E_FAIL;
768}
769
771{
772 if (iColumn >= _countof(g_ColumnDefs))
773 {
774 UINT FSColumn = iColumn - _countof(g_ColumnDefs) + 1;
775 if (pidl)
776 {
778 PCUITEMID_CHILD pChild;
779 if (SUCCEEDED(GetFSFolder2AndChild(pidl, &pFolder, &pChild)))
780 return pFolder->GetDetailsOf(pChild, FSColumn, pDetails);
781 }
782 return m_pisfInner->GetDetailsOf(pidl, FSColumn, pDetails); // Column header info
783 }
784
785 pDetails->cxChar = g_ColumnDefs[iColumn].cxChar;
786 pDetails->fmt = g_ColumnDefs[iColumn].fmt;
787 if (!pidl)
788 return SHSetStrRet(&pDetails->str, _AtlBaseModule.GetResourceInstance(), g_ColumnDefs[iColumn].iResource);
789
790 if (iColumn == COL_LOCATION_INDEX)
791 {
792 return SHSetStrRet(&pDetails->str, _ILGetPath(pidl));
793 }
794
795 if (iColumn == COL_RELEVANCE_INDEX)
796 {
797 // TODO: Fill once the relevance is calculated
798 return SHSetStrRet(&pDetails->str, "");
799 }
800
801 ATLASSERT(iColumn == COL_NAME_INDEX);
802 return GetDisplayNameOf(pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &pDetails->str);
803}
804
806{
808 return E_NOTIMPL;
809}
810
811// *** IShellFolder methods ***
812STDMETHODIMP CFindFolder::ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, ULONG *pchEaten,
813 PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes)
814{
816 return E_NOTIMPL;
817}
818
819STDMETHODIMP CFindFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
820{
821 *ppEnumIDList = NULL;
822 return S_FALSE;
823}
824
826{
827 HRESULT hr;
828 CComPtr<IShellFolder> pInnerFolder;
829 PCUITEMID_CHILD pidlChild;
830 if (FAILED_UNEXPECTEDLY(hr = GetFSFolderAndChild(pidl, &pInnerFolder, &pidlChild)))
831 return hr;
832 return pInnerFolder->BindToObject(pidlChild, pbcReserved, riid, ppvOut);
833}
834
836{
838 return E_NOTIMPL;
839}
840
842{
843 WORD wColumn = LOWORD(lParam);
844 switch (wColumn)
845 {
846 case COL_NAME_INDEX: // Name
847 break;
848 case COL_LOCATION_INDEX: // Path
849 return MAKE_COMPARE_HRESULT(StrCmpW(_ILGetPath(pidl1), _ILGetPath(pidl2)));
850 case COL_RELEVANCE_INDEX: // Relevance
851 return E_NOTIMPL;
852 default: // Default columns
853 wColumn -= _countof(g_ColumnDefs) - 1;
854 break;
855 }
856 // FIXME: DefView does not like the way we sort
857 return m_pisfInner->CompareIDs(HIWORD(lParam) | wColumn, _ILGetFSPidl(pidl1), _ILGetFSPidl(pidl2));
858}
859
861{
862 if (riid == IID_IShellView)
863 {
864 SFV_CREATE sfvparams = {};
865 sfvparams.cbSize = sizeof(SFV_CREATE);
866 sfvparams.pshf = this;
867 sfvparams.psfvcb = this;
868 HRESULT hr = SHCreateShellFolderView(&sfvparams, (IShellView **) ppvOut);
870 {
871 return hr;
872 }
873
874 return ((IShellView * ) * ppvOut)->QueryInterface(IID_PPV_ARG(IShellFolderView, &m_shellFolderView));
875 }
876 return E_NOINTERFACE;
877}
878
880{
881 if (!cidl)
882 {
883 *rgfInOut &= SFGAO_BROWSABLE; // TODO: SFGAO_CANRENAME?
884 return S_OK;
885 }
886
888 for (UINT i = 0; i < cidl; ++i)
889 {
890 CComPtr<IShellFolder> pFolder;
891 PCUITEMID_CHILD pidlChild;
892 if (FAILED_UNEXPECTEDLY(hr = GetFSFolderAndChild(apidl[i], &pFolder, &pidlChild)))
893 break;
894 if (FAILED(hr = pFolder->GetAttributesOf(1, &pidlChild, rgfInOut)))
895 break;
896 }
897 *rgfInOut &= ~SFGAO_CANRENAME; // FIXME: Handle SetNameOf
898 return hr;
899}
900
902 public IContextMenu,
903 public CComObjectRootEx<CComMultiThreadModelNoCS>
904{
908 static const UINT ADDITIONAL_MENU_ITEMS = 2;
909
911 STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
912 {
913 m_firstCmdId = idCmdFirst;
915 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst++, MFT_SEPARATOR, NULL, 0);
916 return m_pInner->QueryContextMenu(hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
917 }
918
920 {
921 if (!IS_INTRESOURCE(lpcmi->lpVerb))
922 {
923 return m_pInner->InvokeCommand(lpcmi);
924 }
925
927 {
928 PCUITEMID_CHILD *apidl;
929 UINT cidl;
930 HRESULT hResult = m_shellFolderView->GetSelectedObjects(&apidl, &cidl);
931 if (FAILED_UNEXPECTEDLY(hResult))
932 return hResult;
933
934 for (UINT i = 0; i < cidl; i++)
935 {
937 if (!folderPidl)
938 return E_OUTOFMEMORY;
940 SHOpenFolderAndSelectItems(folderPidl, 1, &child, 0);
941 }
942 LocalFree(apidl); // Yes, LocalFree
943 return S_OK;
944 }
945
946 // FIXME: We can't block FCIDM_SHVIEW_REFRESH here, add items on SFVM_LISTREFRESHED instead
947 CMINVOKECOMMANDINFOEX actualCmdInfo;
948 memcpy(&actualCmdInfo, lpcmi, lpcmi->cbSize);
949 if (LOWORD(lpcmi->lpVerb) < FCIDM_SHVIEW_ARRANGE) // HACKFIX for DefView using direct FCIDM_SHVIEW ids
950 actualCmdInfo.lpVerb -= ADDITIONAL_MENU_ITEMS;
951 return m_pInner->InvokeCommand((CMINVOKECOMMANDINFO *)&actualCmdInfo);
952 }
953
955 {
956 return m_pInner->GetCommandString(idCommand, uFlags, lpReserved, lpszName, uMaxNameLen);
957 }
958
959public:
960 static HRESULT Create(IShellFolderView *pShellFolderView, IContextMenu *pInnerContextMenu, IContextMenu **pContextMenu)
961 {
964 if (FAILED_UNEXPECTEDLY(hResult))
965 return hResult;
966 pObj->m_shellFolderView = pShellFolderView;
967 pObj->m_pInner = pInnerContextMenu;
968 return pObj->QueryInterface(IID_PPV_ARG(IContextMenu, pContextMenu));
969 }
970
972 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
974};
975
977{
978 // For Delete/Move operations, a subfolder/file needs to come before the parent folder
979 return ::ILGetSize((LPCITEMIDLIST)p1) - ::ILGetSize((LPCITEMIDLIST)p2);
980}
981
983 UINT *prgfInOut, LPVOID *ppvOut)
984{
985 HRESULT hr;
986 if (cidl <= 0)
987 return E_INVALIDARG;
988
989 CComHeapPtr<PCITEMID_CHILD> aFSPidlAlloc;
990 PCITEMID_CHILD pidlSingleBuffer, *aFSPidl = &pidlSingleBuffer; // Optimize for single item callers
991 if (cidl != 1)
992 {
993 if (riid == IID_IDataObject)
994 {
995 if (HDPA hDpa = CreateAbsolutePidlArray(cidl, apidl))
996 {
998 ITEMIDLIST pidlRoot = {};
1000 NULL, (IDataObject**)ppvOut);
1001 FreePidlArray(hDpa);
1002 return hr;
1003 }
1004 }
1005
1006 aFSPidlAlloc.Allocate(cidl);
1007 aFSPidl = aFSPidlAlloc;
1008 }
1009 for (UINT i = 0; i < cidl; i++)
1010 {
1011 aFSPidl[i] = _ILGetFSPidl(apidl[i]);
1012 }
1013
1014 if (riid == IID_IContextMenu)
1015 {
1016 // FIXME: Use CDefFolderMenu_Create2(..., AddFSClassKeysToArray())
1018 if (!folderPidl)
1019 return E_OUTOFMEMORY;
1020 CComPtr<IShellFolder> pDesktopFolder;
1021 if (FAILED_UNEXPECTEDLY(hr = SHGetDesktopFolder(&pDesktopFolder)))
1022 return hr;
1023 CComPtr<IShellFolder> pShellFolder;
1024 hr = pDesktopFolder->BindToObject(folderPidl, NULL, IID_PPV_ARG(IShellFolder, &pShellFolder));
1026 return hr;
1027 CComPtr<IContextMenu> pContextMenu;
1028 hr = pShellFolder->GetUIObjectOf(hwndOwner, cidl, aFSPidl, riid, prgfInOut, (void**)&pContextMenu);
1030 return hr;
1031 return CFindFolderContextMenu::Create(m_shellFolderView, pContextMenu, (IContextMenu **)ppvOut);
1032 }
1033
1034 CComPtr<IShellFolder> pFolder;
1035 if (FAILED_UNEXPECTEDLY(hr = GetFSFolderAndChild(apidl[0], &pFolder)))
1036 return hr;
1037 return pFolder->GetUIObjectOf(hwndOwner, cidl, aFSPidl, riid, prgfInOut, ppvOut);
1038}
1039
1041{
1042 HRESULT hr;
1043 CComPtr<IShellFolder> pFolder;
1044 PCUITEMID_CHILD pidlChild;
1045 if (FAILED_UNEXPECTEDLY(hr = GetFSFolderAndChild(pidl, &pFolder, &pidlChild)))
1046 return hr;
1047 return pFolder->GetDisplayNameOf(pidlChild, dwFlags, pName);
1048}
1049
1051 PITEMID_CHILD *pPidlOut)
1052{
1054 return E_NOTIMPL;
1055}
1056
1059{
1060 switch (uMsg)
1061 {
1062 case SFVM_DEFVIEWMODE:
1063 {
1064 FOLDERVIEWMODE *pViewMode = (FOLDERVIEWMODE *) lParam;
1065 *pViewMode = FVM_DETAILS;
1066 return S_OK;
1067 }
1068 case SFVM_WINDOWCREATED:
1069 {
1070 // Subclass window to receive window messages
1072
1073 // Get shell browser for updating status bar text
1076 return hr;
1077
1078 // Open search bar
1079 CComPtr<IWebBrowser2> pWebBrowser2;
1080 hr = m_shellBrowser->QueryInterface(IID_PPV_ARG(IWebBrowser2, &pWebBrowser2));
1082 return hr;
1083 WCHAR wszGuid[39];
1084 StringFromGUID2(CLSID_FileSearchBand, wszGuid, _countof(wszGuid));
1085 CComVariant searchBar(wszGuid);
1086 return pWebBrowser2->ShowBrowserBar(&searchBar, NULL, NULL);
1087 }
1088 case SFVM_WINDOWCLOSING:
1089 {
1092 return S_OK;
1093 }
1094 case SFVM_GETCOMMANDDIR:
1095 {
1096 HRESULT hr = E_FAIL;
1098 {
1099 PCUITEMID_CHILD *apidl;
1100 UINT cidl = 0;
1101 if (SUCCEEDED(hr = m_shellFolderView->GetSelectedObjects(&apidl, &cidl)))
1102 {
1103 if (cidl)
1105 LocalFree(apidl);
1106 }
1107 }
1108 return hr;
1109 }
1110 // TODO: SFVM_GETCOLUMNSTREAM
1111 }
1112 return E_NOTIMPL;
1113}
1114
1117{
1118 return SHILClone(m_pidl, pidl);
1119}
1120
1121// *** IPersistFolder methods ***
1123{
1124 if (m_pidl)
1125 return E_UNEXPECTED;
1126 HRESULT hr;
1128 return hr;
1129 if (FAILED(hr = SHILClone(pidl, &m_pidl)))
1130 return hr;
1131 return SHELL32_CoCreateInitSF(m_pidl, NULL, NULL, &CLSID_ShellFSFolder,
1133}
1134
1135// *** IPersist methods ***
1137{
1138 if (pClassId == NULL)
1139 return E_INVALIDARG;
1140 *pClassId = CLSID_FindFolder;
1141 return S_OK;
1142}
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:4794
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
static HRESULT SHELL32_CoCreateInitSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidlChild, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: CFindFolder.cpp:13
static BOOL StrFindNIW(const WCHAR *lpFirst, const CStringW &lpSrch, UINT cchMax)
static int CALLBACK ILFreeHelper(void *pItem, void *pCaller)
static const TChar * StrStrN(const TChar *lpFirst, const TString &lpSrch, UINT cchMax)
static BOOL AttribHiddenMatch(DWORD FileAttributes, _SearchData *pSearchData)
static void WINAPI _InsertMenuItemW(HMENU hMenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
Definition: CFindFolder.cpp:40
static BOOL SearchFile(LPCWSTR lpFilePath, _SearchData *pSearchData)
static const FolderViewColumns g_ColumnDefs[]
Definition: CFindFolder.cpp:87
static PIDLIST_ABSOLUTE _ILCreateAbsolute(LPCITEMIDLIST pidlChild)
static BOOL FileNameMatch(LPCWSTR FindDataFileName, _SearchData *pSearchData)
#define IS_TEXT_UNKNOWN_FLAGS_MASK
ENCODING
@ ENCODING_UTF16BE
@ ENCODING_UTF8
@ ENCODING_UTF16LE
@ ENCODING_ANSI
static BOOL ContentsMatch(LPCWSTR szPath, _SearchData *pSearchData)
#define IS_DOTS(psz)
static LPITEMIDLIST _ILCreate(LPCWSTR lpszPath)
static UINT RecursiveFind(LPCWSTR lpPath, _SearchData *pSearchData)
static BOOL IsDataUnicode(IN PVOID Buffer, IN DWORD BufferSize, OUT ENCODING *Encoding OPTIONAL, OUT PDWORD SkipBytes OPTIONAL)
static BOOL StrFindNIA(const CHAR *lpFirst, const CStringA &lpSrch, UINT cchMax)
static LPCWSTR _ILGetPath(LPCITEMIDLIST pidl)
static LPCITEMIDLIST _ILGetFSPidl(LPCITEMIDLIST pidl)
static FolderViewColumns g_ColumnDefs[]
Definition: CFontExt.cpp:34
HRESULT WINAPI SHCreateFileDataObject(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IDataObject *pDataInner, IDataObject **ppDataObj)
void FreeList(LOCATIONITEM *pItems)
Definition: CSearchBar.cpp:95
#define SFVM_GETCOMMANDDIR
#define SFVM_WINDOWCLOSING
struct test_data Tests[]
UINT cchMax
@ lparam
Definition: SystemMenu.c:31
static DWORD const LPVOID const lpReserved
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ERR(fmt,...)
Definition: precomp.h:57
#define STDMETHODIMP
Definition: basetyps.h:43
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define RegCloseKey(hKey)
Definition: registry.h:49
IUnknown ** end()
Definition: atlcom.h:1128
IUnknown ** begin()
Definition: atlcom.h:1123
static HRESULT WINAPI CreateInstance(CComObject< Base > **pp)
Definition: atlcom.h:171
STDMETHOD() QueryInterface(REFIID iid, void **ppvObject)
Definition: atlcom.h:166
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:387
HWND m_hWnd
Definition: atlwin.h:273
Definition: bufpool.h:45
CComPtr< IContextMenu > m_pInner
STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
STDMETHODIMP GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen)
static HRESULT Create(IShellFolderView *pShellFolderView, IContextMenu *pInnerContextMenu, IContextMenu **pContextMenu)
static const UINT ADDITIONAL_MENU_ITEMS
CComPtr< IShellFolderView > m_shellFolderView
STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
STDMETHODIMP GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET pName)
HRESULT GetFSFolder2AndChild(LPCITEMIDLIST pidl, IShellFolder2 **ppSF, PCUITEMID_CHILD *ppidlLast=NULL)
LRESULT StartSearch(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
HANDLE m_hStopEvent
Definition: CFindFolder.h:70
STDMETHODIMP GetClassID(CLSID *pClassId)
CComPtr< IShellFolder2 > m_pisfInner
Definition: CFindFolder.h:67
STDMETHODIMP GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv)
STDMETHODIMP BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
STDMETHODIMP SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
STDMETHODIMP GetCurFolder(PIDLIST_ABSOLUTE *pidl)
static DWORD WINAPI SearchThreadProc(LPVOID lpParameter)
static int CALLBACK SortItemsForDataObject(void *p1, void *p2, LPARAM lparam)
STDMETHODIMP CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
LRESULT AddResult(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
HDPA CreateAbsolutePidlArray(UINT cidl, PCUITEMID_CHILD_ARRAY apidl)
LRESULT UpdateStatus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
STDMETHODIMP GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut)
STDMETHODIMP GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
STDMETHODIMP MapColumnToSCID(UINT iColumn, SHCOLUMNID *pscid)
STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
CComPtr< IShellFolderView > m_shellFolderView
Definition: CFindFolder.h:68
STDMETHODIMP MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam)
STDMETHODIMP EnumSearches(IEnumExtraSearch **ppenum)
void FreePidlArray(HDPA hDpa)
LRESULT StopSearch(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
STDMETHODIMP GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *pDetails)
STDMETHODIMP Initialize(PCIDLIST_ABSOLUTE pidl)
CComPtr< IShellFolder2 > m_pSfDesktop
Definition: CFindFolder.h:67
STDMETHODIMP ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes)
void NotifyConnections(DISPID id)
STDMETHODIMP BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
STDMETHODIMP GetDefaultSearchGUID(GUID *pguid)
LPITEMIDLIST m_pidl
Definition: CFindFolder.h:66
HRESULT GetFSFolderAndChild(LPCITEMIDLIST pidl, IShellFolder **ppSF, PCUITEMID_CHILD *ppidlLast=NULL)
STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
CComPtr< IShellBrowser > m_shellBrowser
Definition: CFindFolder.h:69
STDMETHODIMP GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags)
STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut)
bool Allocate(_In_ size_t nElements=1)
Definition: atlalloc.h:143
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDS_COL_NAME
Definition: resource.h:17
BOOL WINAPI IsTextUnicode(IN CONST VOID *lpv, IN INT iSize, IN OUT LPINT lpiResult OPTIONAL)
Definition: unicode.c:27
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
UINT uFlags
Definition: api.c:59
#define COL_NAME_INDEX
Definition: resource.h:186
#define IDS_COL_RELEVANCE
Definition: resource.h:176
#define IDS_SEARCH_OPEN_FOLDER
Definition: resource.h:180
#define IDS_COL_LOCATION
Definition: resource.h:175
#define COL_RELEVANCE_INDEX
Definition: resource.h:188
#define IDS_SEARCH_FOLDER
Definition: resource.h:178
#define COL_LOCATION_INDEX
Definition: resource.h:187
#define IDS_SEARCH_FILES_FOUND
Definition: resource.h:177
BOOL WINAPI DPA_Sort(HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam)
Definition: dpa.c:813
void WINAPI DPA_DestroyCallback(HDPA hdpa, PFNDPAENUMCALLBACK enumProc, LPVOID lParam)
Definition: dpa.c:1003
HDPA WINAPI DPA_Create(INT nGrow)
Definition: dpa.c:950
INT WINAPI DPA_InsertPtr(HDPA hdpa, INT i, LPVOID p)
Definition: dpa.c:591
#define CloseHandle
Definition: compat.h:739
#define PAGE_READONLY
Definition: compat.h:138
#define UnmapViewOfFile
Definition: compat.h:746
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:744
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_MAP_READ
Definition: compat.h:776
#define CALLBACK
Definition: compat.h:35
#define WideCharToMultiByte
Definition: compat.h:111
#define MapViewOfFile
Definition: compat.h:745
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
BOOL WINAPI SetThreadPriority(IN HANDLE hThread, IN int nPriority)
Definition: thread.c:700
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
HRESULT SHILClone(_In_opt_ LPCITEMIDLIST pidl, _Outptr_ LPITEMIDLIST *ppidl)
Definition: utils.cpp:133
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
HRESULT WINAPI SHCoCreateInstance(LPCWSTR aclsid, const CLSID *clsid, LPUNKNOWN pUnkOuter, REFIID refiid, LPVOID *ppv)
Definition: shellole.c:105
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1501
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
BOOL WINAPI PathMatchSpecW(LPCWSTR lpszPath, LPCWSTR lpszMask)
Definition: path.c:1970
BOOL WINAPI PathIsRootW(LPCWSTR lpszPath)
Definition: path.c:1648
HRESULT WINAPI SHStrDupW(LPCWSTR src, LPWSTR *dest)
Definition: string.c:2018
int WINAPI StrCmpW(LPCWSTR lpszStr, LPCWSTR lpszComp)
Definition: string.c:434
BOOL WINAPI SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, VOID *pData, DWORD dwFlags, LPTHREAD_START_ROUTINE pfnCallback)
Definition: thread.c:356
#define DISPID_SEARCHSTART
Definition: exdispid.h:172
#define DISPID_SEARCHCOMPLETE
Definition: exdispid.h:173
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE _In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Out_ PIO_STATUS_BLOCK _In_opt_ PLARGE_INTEGER _In_ ULONG FileAttributes
Definition: fltkernel.h:1236
LPITEMIDLIST _ILCreate(LPCWSTR lpString, ULONG Index)
Definition: fontpidl.cpp:10
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
REFIID riid
Definition: atlbase.h:39
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
#define GUID_NULL
Definition: ks.h:106
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define END_COM_MAP()
Definition: atlcom.h:592
if(dx< 0)
Definition: linetemp.h:194
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
LPCWSTR szPath
Definition: env.c:37
static LPSTR pName
Definition: security.c:75
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
static LPOLESTR
Definition: stg_prop.c:27
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
static VARIANTARG static DISPID
Definition: ordinal.c:52
static HWND child
Definition: cursoricon.c:298
ENCODING
Definition: more.c:493
REFCLSID clsid
Definition: msctf.c:82
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
_In_ HANDLE hFile
Definition: mswsock.h:90
unsigned int UINT
Definition: ndis.h:50
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define DWORD
Definition: nt_native.h:44
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define UNICODE_NULL
#define L(x)
Definition: ntvdm.h:50
@ COINIT_MULTITHREADED
Definition: objbase.h:279
interface IBindCtx * LPBC
Definition: objfwd.h:18
#define DISPATCH_METHOD
Definition: oleauto.h:1006
const GUID IID_IDataObject
#define PathCombineW
Definition: pathcch.h:317
#define LOWORD(l)
Definition: pedump.c:82
BYTE * PBYTE
Definition: pedump.c:66
DWORD * PDWORD
Definition: pedump.c:68
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:1044
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:198
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:816
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
Definition: pidl.c:1101
#define LVCFMT_LEFT
Definition: commctrl.h:2603
#define DPA_GetPtrPtr(hdpa)
Definition: commctrl.h:4962
#define REFIID
Definition: guiddef.h:118
#define REG_DWORD
Definition: sdbapi.c:596
#define CP_UTF8
Definition: nls.h:20
@ TString
Definition: dwarf.h:133
#define ILGetSize
Definition: shellclasses.h:638
#define WM_SEARCH_ADD_RESULT
Definition: shellfind.h:31
#define WM_SEARCH_UPDATE_STATUS
Definition: shellfind.h:32
#define WM_SEARCH_STOP
Definition: shellfind.h:30
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:623
HRESULT hr
Definition: shlfolder.c:183
EXTERN_C HRESULT WINAPI SHOpenFolderAndSelectItems(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD dwFlags)
Definition: shlfolder.cpp:455
#define SID_SShellBrowser
Definition: shlguid.h:128
#define SFVM_DEFVIEWMODE
Definition: shlobj.h:1326
#define SFVM_WINDOWCREATED
Definition: shlobj.h:1316
PIDLIST_ABSOLUTE WINAPI SHSimpleIDListFromPath(PCWSTR)
struct _SFV_CREATE SFV_CREATE
#define StrNCmp
Definition: shlwapi.h:1559
FOLDERVIEWMODE
Definition: shobjidl.idl:677
@ FVM_DETAILS
Definition: shobjidl.idl:683
#define FCIDM_SHVIEW_ARRANGE
Definition: shresdef.h:850
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
@ SHCOLSTATE_TYPE_STR
Definition: shtypes.idl:121
@ SHCOLSTATE_ONBYDEFAULT
Definition: shtypes.idl:125
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
DWORD dwDefaultState
Definition: CFontExt.cpp:20
STRRET str
Definition: shtypes.idl:108
WCHAR szFileName[MAX_PATH]
Definition: shellfind.h:53
LOCATIONITEM * pPaths
Definition: shellfind.h:52
BOOL SearchHidden
Definition: shellfind.h:55
WCHAR szQuery[MAX_PATH]
Definition: shellfind.h:54
Definition: dpa.c:49
IShellFolderViewCB * psfvcb
Definition: shlobj.h:1368
UINT cbSize
Definition: shlobj.h:1365
IShellFolder * pshf
Definition: shlobj.h:1366
CStringA szQueryA
CStringW szQueryW
CStringW szFileName
CStringW szQueryU16BE
LOCATIONITEM * pPaths
HANDLE hStopEvent
CStringA szQueryU8
CComPtr< CFindFolder > pFindFolder
Definition: ps.c:97
struct tagLOCATIONITEM * pNext
Definition: shellfind.h:36
LPWSTR dwTypeData
Definition: winuser.h:3280
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define MAKEWORD(a, b)
Definition: typedefs.h:248
unsigned char * LPBYTE
Definition: typedefs.h:53
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
#define OUT
Definition: typedefs.h:40
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
#define ZeroMemory
Definition: winbase.h:1743
HANDLE WINAPI GetCurrentThread(void)
Definition: proc.c:1148
_In_ LPCSTR lpName
Definition: winbase.h:2820
#define CreateEvent
Definition: winbase.h:3779
#define INVALID_FILE_SIZE
Definition: winbase.h:574
#define THREAD_PRIORITY_BELOW_NORMAL
Definition: winbase.h:302
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:542
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_UNEXPECTED
Definition: winerror.h:2456
#define IS_TEXT_UNICODE_ILLEGAL_CHARS
Definition: winnt_old.h:923
#define IS_TEXT_UNICODE_UNICODE_MASK
Definition: winnt_old.h:927
#define IS_TEXT_UNICODE_NOT_ASCII_MASK
Definition: winnt_old.h:930
#define IS_TEXT_UNICODE_NULL_BYTES
Definition: winnt_old.h:926
#define IS_TEXT_UNICODE_REVERSE_MASK
Definition: winnt_old.h:928
#define IS_TEXT_UNICODE_REVERSE_SIGNATURE
Definition: winnt_old.h:922
#define IS_TEXT_UNICODE_NOT_UNICODE_MASK
Definition: winnt_old.h:929
#define IS_TEXT_UNICODE_SIGNATURE
Definition: winnt_old.h:921
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegOpenKeyEx
Definition: winreg.h:520
#define MIIM_ID
Definition: winuser.h:733
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
#define MFT_SEPARATOR
Definition: winuser.h:755
#define MIIM_STATE
Definition: winuser.h:732
#define MFS_ENABLED
Definition: winuser.h:761
#define MFT_STRING
Definition: winuser.h:757
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define MIIM_TYPE
Definition: winuser.h:736
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS SkipBytes
Definition: mmfuncs.h:227
#define IID_PPV_ARG(Itype, ppType)
static char * encoding
Definition: xmllint.c:155
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193