ReactOS 0.4.15-dev-7887-g64a59a1
CRegFolder.cpp
Go to the documentation of this file.
1/*
2 * ReactOS Shell
3 *
4 * Copyright 2016 Giannis Adamopoulos
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <precomp.h>
22
24
26 HWND hwnd,
27 IDataObject *pdtobj,
28 UINT uMsg,
31{
33 return S_OK;
34
35 PIDLIST_ABSOLUTE pidlFolder;
36 PUITEMID_CHILD *apidl;
37 UINT cidl;
38 HRESULT hr = SH_GetApidlFromDataObject(pdtobj, &pidlFolder, &apidl, &cidl);
40 return hr;
41
42 if (_ILIsMyComputer(apidl[0]))
43 {
44 if (32 >= (UINT_PTR)ShellExecuteW(hwnd,
45 L"open",
46 L"rundll32.exe",
47 L"shell32.dll,Control_RunDLL sysdm.cpl",
48 NULL,
50 {
51 hr = E_FAIL;
52 }
53 }
54 else if (_ILIsDesktop(apidl[0]))
55 {
56 if (32 >= (UINT_PTR)ShellExecuteW(hwnd,
57 L"open",
58 L"rundll32.exe",
59 L"shell32.dll,Control_RunDLL desk.cpl",
60 NULL,
62 {
63 hr = E_FAIL;
64 }
65 }
66 else if (_ILIsNetHood(apidl[0]))
67 {
68 // FIXME path!
69 if (32 >= (UINT_PTR)ShellExecuteW(NULL,
70 L"open",
71 L"explorer.exe",
72 L"::{7007ACC7-3202-11D1-AAD2-00805FC1270E}",
73 NULL,
75 {
76 hr = E_FAIL;
77 }
78 }
79 else if (_ILIsBitBucket(apidl[0]))
80 {
81 /* FIXME: detect the drive path of bitbucket if appropiate */
83 hr = E_FAIL;
84 }
85 else
86 {
87 /* Tell the caller to run the default action */
88 hr = S_FALSE;
89 }
90
91 SHFree(pidlFolder);
92 _ILFreeaPidl(apidl, cidl);
93
94 return hr;
95}
96
98 HWND hwnd,
99 UINT cidl,
101 IShellFolder *psf,
102 IContextMenu **ppcm)
103{
104 HKEY hKeys[10];
105 UINT cKeys = 0;
106
107 GUID *pGuid = _ILGetGUIDPointer(apidl[0]);
108 if (pGuid)
109 {
110 LPOLESTR pwszCLSID;
111 WCHAR key[60];
112
113 wcscpy(key, L"CLSID\\");
114 HRESULT hr = StringFromCLSID(*pGuid, &pwszCLSID);
115 if (hr == S_OK)
116 {
117 wcscpy(&key[6], pwszCLSID);
118 AddClassKeyToArray(key, hKeys, &cKeys);
119 CoTaskMemFree(pwszCLSID);
120 }
121 }
122 AddClassKeyToArray(L"Folder", hKeys, &cKeys);
123
124 return CDefFolderMenu_Create2(pidlFolder, hwnd, cidl, apidl, psf, RegFolderContextMenuCallback, cKeys, hKeys, ppcm);
125}
126
128{
129 WCHAR xriid[40];
130
131 if (!StringFromGUID2(*riid, xriid, _countof(xriid) - 1))
132 return E_FAIL;
133
134 return StringCchPrintfW(KeyName, KeySize, RegPath, xriid);
135}
136
138{
139 CComPtr<IDefaultExtractIconInit> initIcon;
140 HRESULT hr;
141 GUID const * riid;
142 int icon_idx;
143 WCHAR wTemp[MAX_PATH];
144
146 if (FAILED(hr))
147 return hr;
148
149 if (_ILIsDesktop(pidl))
150 {
151 initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_DESKTOP);
152 return initIcon->QueryInterface(iid, ppvOut);
153 }
154
155 riid = _ILGetGUIDPointer(pidl);
156 if (!riid)
157 return E_FAIL;
158
159 /* Choose a correct icon for Recycle Bin (full or empty) */
160 const WCHAR* iconname = NULL;
161 if (_ILIsBitBucket(pidl))
162 {
163 CComPtr<IEnumIDList> EnumIDList;
165
166 CComPtr<IShellFolder2> psfRecycleBin;
167 CComPtr<IShellFolder> psfDesktop;
168 hr = SHGetDesktopFolder(&psfDesktop);
169
170 if (SUCCEEDED(hr))
171 hr = psfDesktop->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder2, &psfRecycleBin));
172 if (SUCCEEDED(hr))
173 hr = psfRecycleBin->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &EnumIDList);
174
175 ULONG itemcount;
176 LPITEMIDLIST pidl = NULL;
177 if (SUCCEEDED(hr) && (hr = EnumIDList->Next(1, &pidl, &itemcount)) == S_OK)
178 {
179 CoTaskMemFree(pidl);
180 iconname = L"Full";
181 } else {
182 iconname = L"Empty";
183 }
184 }
185
186 /* Prepare registry path for loading icons of My Computer and other shell extensions */
188
190 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%s",
191 riid);
193 return hr;
194
195 /* Load icon for the current user */
196 BOOL ret = HCU_GetIconW(KeyName, wTemp, iconname, _countof(wTemp), &icon_idx);
197 if (!ret)
198 {
199 /* Failed, load default system-wide icon */
200 hr = FormatGUIDKey(KeyName, _countof(KeyName), L"CLSID\\%s", riid);
202 return hr;
203
204 ret = HCR_GetIconW(KeyName, wTemp, iconname, _countof(wTemp), &icon_idx);
205 }
206
207 if (ret)
208 {
209 /* Success, set loaded icon */
210 initIcon->SetNormalIcon(wTemp, icon_idx);
211 }
212 else
213 {
214 /* Everything has failed, set blank paper icon */
215 WARN("Failed to load an icon for the item, setting blank icon\n");
216 initIcon->SetNormalIcon(swShell32Name, IDI_SHELL_DOCUMENT - 1);
217 }
218
219 return initIcon->QueryInterface(iid, ppvOut);
220}
221
223 public CEnumIDListBase
224{
225 public:
228 HRESULT Initialize(LPCWSTR lpszEnumKeyName, DWORD dwFlags);
229 HRESULT AddItemsFromKey(HKEY hkey_root, LPCWSTR szRepPath);
230
232 COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
234};
235
237{
242};
243
245{
246}
247
249{
250}
251
253{
255
256 if (!(dwFlags & SHCONTF_FOLDERS))
257 return S_OK;
258
260 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\%s\\Namespace",
261 lpszEnumKeyName);
263 return hr;
264
267
268 return S_OK;
269}
270
272{
274 HKEY hkey;
275
276 if (RegOpenKeyW(hkey_root, szRepPath, &hkey) != ERROR_SUCCESS)
277 return S_FALSE;
278
279 for (int idx = 0; ; idx++)
280 {
281 if (RegEnumKeyW(hkey, idx, name, MAX_PATH) != ERROR_SUCCESS)
282 break;
283
284 /* If the name of the key is not a guid try to get the default value of the key */
285 if (name[0] != L'{')
286 {
287 DWORD dwSize = sizeof(name);
289 }
290
291 if (*name == '{')
292 {
294
295 if (pidl)
296 AddToEnumList(pidl);
297 }
298 }
299
300 RegCloseKey(hkey);
301
302 return S_OK;
303}
304
306 public CComObjectRootEx<CComMultiThreadModelNoCS>,
307 public IShellFolder2
308{
309 private:
311 CAtlStringW m_rootPath;
312 CAtlStringW m_enumKeyName;
313 CComHeapPtr<ITEMIDLIST> m_pidlRoot;
314
316 public:
317 CRegFolder();
318 ~CRegFolder();
319 HRESULT WINAPI Initialize(const GUID *pGuid, LPCITEMIDLIST pidlRoot, LPCWSTR lpszPath, LPCWSTR lpszEnumKeyName);
320
321 // IShellFolder
322 STDMETHOD(ParseDisplayName)(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes) override;
323 STDMETHOD(EnumObjects)(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override;
324 STDMETHOD(BindToObject)(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override;
325 STDMETHOD(BindToStorage)(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override;
327 STDMETHOD(CreateViewObject)(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override;
328 STDMETHOD(GetAttributesOf)(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override;
329 STDMETHOD(GetUIObjectOf)(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut) override;
331 STDMETHOD(SetNameOf)(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override;
332
333 /* ShellFolder2 */
334 STDMETHOD(GetDefaultSearchGUID)(GUID *pguid) override;
335 STDMETHOD(EnumSearches)(IEnumExtraSearch **ppenum) override;
336 STDMETHOD(GetDefaultColumn)(DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override;
337 STDMETHOD(GetDefaultColumnState)(UINT iColumn, DWORD *pcsFlags) override;
338 STDMETHOD(GetDetailsEx)(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override;
339 STDMETHOD(GetDetailsOf)(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override;
341
343
345
347 COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
348 COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
350};
351
353{
354}
355
357{
358}
359
360HRESULT WINAPI CRegFolder::Initialize(const GUID *pGuid, LPCITEMIDLIST pidlRoot, LPCWSTR lpszPath, LPCWSTR lpszEnumKeyName)
361{
362 memcpy(&m_guid, pGuid, sizeof(m_guid));
363
364 m_rootPath = lpszPath;
365 if (!m_rootPath)
366 return E_OUTOFMEMORY;
367
368 m_enumKeyName = lpszEnumKeyName;
369 if (!m_enumKeyName)
370 return E_OUTOFMEMORY;
371
372 m_pidlRoot.Attach(ILClone(pidlRoot));
373 if (!m_pidlRoot)
374 return E_OUTOFMEMORY;
375
376 return S_OK;
377}
378
380{
381 DWORD dwAttributes = *pdwAttributes;
382
383 /* First try to get them from the registry */
384 if (!HCR_GetFolderAttributes(pidl, pdwAttributes))
385 {
386 /* We couldn't get anything */
387 *pdwAttributes = 0;
388 }
389
390 /* Items have more attributes when on desktop */
392 {
393 *pdwAttributes |= (dwAttributes & (SFGAO_CANLINK|SFGAO_CANDELETE|SFGAO_CANRENAME|SFGAO_HASPROPSHEET));
394 }
395
396 /* In any case, links can be created */
397 if (*pdwAttributes == NULL)
398 {
399 *pdwAttributes |= (dwAttributes & SFGAO_CANLINK);
400 }
401 return S_OK;
402}
403
405 ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes)
406{
407 LPITEMIDLIST pidl;
408
409 if (!lpszDisplayName || !ppidl)
410 return E_INVALIDARG;
411
412 *ppidl = 0;
413
414 if (pchEaten)
415 *pchEaten = 0;
416
417 UINT cch = wcslen(lpszDisplayName);
418 if (cch < 39 || lpszDisplayName[0] != L':' || lpszDisplayName[1] != L':')
419 return E_FAIL;
420
421 pidl = _ILCreateGuidFromStrW(lpszDisplayName + 2);
422 if (pidl == NULL)
423 return E_FAIL;
424
425 if (cch < 41)
426 {
427 *ppidl = pidl;
428 if (pdwAttributes && *pdwAttributes)
429 {
430 GetGuidItemAttributes(*ppidl, pdwAttributes);
431 }
432 }
433 else
434 {
435 HRESULT hr = SHELL32_ParseNextElement(this, hwndOwner, pbc, &pidl, lpszDisplayName + 41, pchEaten, pdwAttributes);
436 if (SUCCEEDED(hr))
437 {
438 *ppidl = pidl;
439 }
440 return hr;
441 }
442
443 return S_OK;
444}
445
446HRESULT WINAPI CRegFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
447{
448 return ShellObjectCreatorInit<CRegFolderEnum>(m_enumKeyName, dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
449}
450
452{
453 CComPtr<IPersistFolder> pFolder;
454 HRESULT hr;
455
456 if (!ppvOut || !pidl || !pidl->mkid.cb)
457 return E_INVALIDARG;
458
459 *ppvOut = NULL;
460
461 GUID *pGUID = _ILGetGUIDPointer(pidl);
462 if (!pGUID)
463 {
464 ERR("CRegFolder::BindToObject called for non guid item!\n");
465 return E_INVALIDARG;
466 }
467
468 hr = SHELL32_BindToSF(m_pidlRoot, NULL, pidl, pGUID, riid, ppvOut);
470 return hr;
471
472 return S_OK;
473}
474
476{
477 return E_NOTIMPL;
478}
479
481{
482 if (!pidl1 || !pidl2 || pidl1->mkid.cb == 0 || pidl2->mkid.cb == 0)
483 {
484 ERR("Got an empty pidl!\n");
485 return E_INVALIDARG;
486 }
487
488 GUID const *clsid1 = _ILGetGUIDPointer (pidl1);
489 GUID const *clsid2 = _ILGetGUIDPointer (pidl2);
490
491 if (!clsid1 && !clsid2)
492 {
493 ERR("Got no guid pidl!\n");
494 return E_INVALIDARG;
495 }
496 else if (clsid1 && clsid2)
497 {
498 if (memcmp(clsid1, clsid2, sizeof(GUID)) == 0)
499 return SHELL32_CompareChildren(this, lParam, pidl1, pidl2);
500
501 return SHELL32_CompareDetails(this, lParam, pidl1, pidl2);
502 }
503
504 /* Guid folders come first compared to everything else */
505 /* And Drives come before folders in My Computer */
507 {
508 return MAKE_COMPARE_HRESULT(clsid1 ? 1 : -1);
509 }
510 else
511 {
512 return MAKE_COMPARE_HRESULT(clsid1 ? -1 : 1);
513 }
514}
515
517{
518 return E_NOTIMPL;
519}
520
522{
523 if (!rgfInOut || !cidl || !apidl)
524 return E_INVALIDARG;
525
526 if (*rgfInOut == 0)
527 *rgfInOut = ~0;
528
529 while(cidl > 0 && *apidl)
530 {
531 if (_ILIsSpecialFolder(*apidl))
532 GetGuidItemAttributes(*apidl, rgfInOut);
533 else
534 ERR("Got unknown pidl\n");
535 apidl++;
536 cidl--;
537 }
538
539 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
540 *rgfInOut &= ~SFGAO_VALIDATE;
541
542 return S_OK;
543}
544
546 REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
547{
548 LPVOID pObj = NULL;
550
551 if (!ppvOut)
552 return hr;
553
554 *ppvOut = NULL;
555
556 if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
557 {
558 hr = CGuidItemExtractIcon_CreateInstance(apidl[0], riid, &pObj);
559 }
560 else if (IsEqualIID (riid, IID_IContextMenu) && (cidl >= 1))
561 {
562 if (!_ILGetGUIDPointer (apidl[0]))
563 {
564 ERR("Got non guid item!\n");
565 return E_FAIL;
566 }
567
568 hr = CGuidItemContextMenu_CreateInstance(m_pidlRoot, hwndOwner, cidl, apidl, static_cast<IShellFolder*>(this), (IContextMenu**)&pObj);
569 }
570 else if (IsEqualIID (riid, IID_IDataObject) && (cidl >= 1))
571 {
572 hr = IDataObject_Constructor (hwndOwner, m_pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
573 }
574 else
575 {
577 }
578
579 *ppvOut = pObj;
580 return hr;
581
582}
583
585{
586 if (!strRet || (!_ILIsSpecialFolder(pidl) && pidl != NULL))
587 return E_INVALIDARG;
588
589 if (!pidl || !pidl->mkid.cb)
590 {
592 {
593 LPWSTR pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
594 if (!pszPath)
595 return E_OUTOFMEMORY;
596
597 /* parsing name like ::{...} */
598 pszPath[0] = ':';
599 pszPath[1] = ':';
600 SHELL32_GUIDToStringW(m_guid, &pszPath[2]);
601
602 strRet->uType = STRRET_WSTR;
603 strRet->pOleStr = pszPath;
604
605 return S_OK;
606 }
607 else
608 {
609 BOOL bRet;
610 WCHAR wstrName[MAX_PATH+1];
611 bRet = HCR_GetClassNameW(m_guid, wstrName, MAX_PATH);
612 if (!bRet)
613 return E_FAIL;
614
615 return SHSetStrRet(strRet, wstrName);
616
617 }
618 }
619
620 HRESULT hr;
621 GUID const *clsid = _ILGetGUIDPointer (pidl);
622
623 /* First of all check if we need to query the name from the child item */
626 {
627 int bWantsForParsing = FALSE;
628
629 /*
630 * We can only get a filesystem path from a shellfolder if the
631 * value WantsFORPARSING in CLSID\\{...}\\shellfolder exists.
632 *
633 * Exception: The MyComputer folder doesn't have this key,
634 * but any other filesystem backed folder it needs it.
635 */
636 if (IsEqualIID (*clsid, CLSID_MyComputer))
637 {
638 bWantsForParsing = TRUE;
639 }
640 else
641 {
642 HKEY hkeyClass;
643 if (HCR_RegOpenClassIDKey(*clsid, &hkeyClass))
644 {
645 LONG res = SHGetValueW(hkeyClass, L"Shellfolder", L"WantsForParsing", NULL, NULL, NULL);
646 bWantsForParsing = (res == ERROR_SUCCESS);
647 RegCloseKey(hkeyClass);
648 }
649 }
650
651 if (bWantsForParsing)
652 {
653 /*
654 * we need the filesystem path to the destination folder.
655 * Only the folder itself can know it
656 */
657 return SHELL32_GetDisplayNameOfChild (this, pidl, dwFlags, strRet);
658 }
659 }
660
661 /* Allocate the buffer for the result */
662 SIZE_T cchPath = MAX_PATH + 1;
663 LPWSTR pszPath = (LPWSTR)CoTaskMemAlloc(cchPath * sizeof(WCHAR));
664 if (!pszPath)
665 return E_OUTOFMEMORY;
666
667 hr = S_OK;
668
670 {
671 SIZE_T pathlen = 0;
672 PWCHAR pItemName = pszPath; // GET_SHGDN_RELATION(dwFlags) == SHGDN_INFOLDER
674 {
675 hr = StringCchCopyW(pszPath, cchPath, m_rootPath);
676 if (SUCCEEDED(hr))
677 {
678 pathlen = wcslen(pszPath);
679 pItemName = &pszPath[pathlen];
680 if (pathlen)
681 {
682 if (++pathlen < cchPath)
683 *pItemName++ = L'\\';
684 else
686 }
687 }
688 }
689
690 if (SUCCEEDED(hr) && pathlen + 2 + 38 + 1 < cchPath)
691 {
692 /* parsing name like ::{...} */
693 pItemName[0] = L':';
694 pItemName[1] = L':';
695 SHELL32_GUIDToStringW(*clsid, &pItemName[2]);
696 }
697 else
698 {
700 }
701 }
702 else
703 {
704 /* user friendly name */
705 if (!HCR_GetClassNameW(*clsid, pszPath, cchPath))
706 hr = E_FAIL;
707 }
708
709 if (SUCCEEDED(hr))
710 {
711 strRet->uType = STRRET_WSTR;
712 strRet->pOleStr = pszPath;
713 }
714 else
715 {
716 CoTaskMemFree(pszPath);
717 }
718
719 return hr;
720}
721
722HRESULT WINAPI CRegFolder::SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, /* simple pidl */
723 LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
724{
725 GUID const *clsid = _ILGetGUIDPointer (pidl);
726 LPOLESTR pStr;
727 HRESULT hr;
728 WCHAR szName[100];
729
730 if (!clsid)
731 {
732 ERR("Pidl is not reg item!\n");
733 return E_FAIL;
734 }
735
736 hr = StringFromCLSID(*clsid, &pStr);
738 return hr;
739
740 swprintf(szName, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%s", pStr);
741
742 DWORD cbData = (wcslen(lpName) + 1) * sizeof(WCHAR);
744
745 CoTaskMemFree(pStr);
746
747 if (res == ERROR_SUCCESS)
748 {
749 *pPidlOut = ILClone(pidl);
750 return S_OK;
751 }
752
753 return E_FAIL;
754}
755
756
758{
759 return E_NOTIMPL;
760}
761
763{
764 return E_NOTIMPL;
765}
766
768{
769 if (pSort)
770 *pSort = 0;
771 if (pDisplay)
772 *pDisplay = 0;
773
774 return S_OK;
775}
776
778{
779 if (iColumn >= REGISTRY_COL_COUNT)
780 return E_INVALIDARG;
782 return S_OK;
783}
784
786{
787 return E_NOTIMPL;
788}
789
791{
792 if (!psd)
793 return E_INVALIDARG;
794
795 GUID const *clsid = _ILGetGUIDPointer (pidl);
796
797 if (!clsid)
798 {
799 ERR("Pidl is not reg item!\n");
800 return E_INVALIDARG;
801 }
802
803 switch(iColumn)
804 {
806 return GetDisplayNameOf(pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
808 return SHSetStrRet(&psd->str, IDS_SYSTEMFOLDER);
810 HKEY hKey;
812 return SHSetStrRet(&psd->str, "");
813
814 psd->str.cStr[0] = 0x00;
815 psd->str.uType = STRRET_CSTR;
816 RegLoadMUIStringA(hKey, "InfoTip", psd->str.cStr, MAX_PATH, NULL, 0, NULL);
818 return S_OK;
819 default:
820 /* Return an empty string when we area asked for a column we don't support.
821 Only the regfolder is supposed to do this as it supports less columns compared to other folder
822 and its contents are supposed to be presented alongside items that support more columns. */
823 return SHSetStrRet(&psd->str, "");
824 }
825 return E_FAIL;
826}
827
829{
830 return E_NOTIMPL;
831}
832
833/* In latest windows version this is exported but it takes different arguments! */
834HRESULT CRegFolder_CreateInstance(const GUID *pGuid, LPCITEMIDLIST pidlRoot, LPCWSTR lpszPath, LPCWSTR lpszEnumKeyName, REFIID riid, void **ppv)
835{
836 return ShellObjectCreatorInit<CRegFolder>(pGuid, pidlRoot, lpszPath, lpszEnumKeyName, riid, ppv);
837}
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
HRESULT WINAPI CDefFolderMenu_Create2(PCIDLIST_ABSOLUTE pidlFolder, HWND hwnd, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IShellFolder *psf, LPFNDFMCALLBACK lpfn, UINT nKeys, const HKEY *ahkeyClsKeys, IContextMenu **ppcm)
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
HRESULT WINAPI SHCreateDefaultExtractIcon(REFIID riid, void **ppv)
HRESULT IDataObject_Constructor(HWND hwndOwner, PCIDLIST_ABSOLUTE pMyPidl, PCUIDLIST_RELATIVE_ARRAY apidl, UINT cidl, BOOL bExtendedObject, IDataObject **dataObject)
HRESULT CRegFolder_CreateInstance(const GUID *pGuid, LPCITEMIDLIST pidlRoot, LPCWSTR lpszPath, LPCWSTR lpszEnumKeyName, REFIID riid, void **ppv)
Definition: CRegFolder.cpp:834
registry_columns
Definition: CRegFolder.cpp:237
@ REGISTRY_COL_COUNT
Definition: CRegFolder.cpp:241
@ REGISTRY_COL_TYPE
Definition: CRegFolder.cpp:239
@ REGISTRY_COL_NAME
Definition: CRegFolder.cpp:238
@ REGISTRY_COL_VALUE
Definition: CRegFolder.cpp:240
HRESULT CALLBACK RegFolderContextMenuCallback(IShellFolder *psf, HWND hwnd, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CRegFolder.cpp:25
HRESULT CGuidItemExtractIcon_CreateInstance(LPCITEMIDLIST pidl, REFIID iid, LPVOID *ppvOut)
Definition: CRegFolder.cpp:137
HRESULT FormatGUIDKey(LPWSTR KeyName, SIZE_T KeySize, LPCWSTR RegPath, const GUID *riid)
Definition: CRegFolder.cpp:127
HRESULT CGuidItemContextMenu_CreateInstance(PCIDLIST_ABSOLUTE pidlFolder, HWND hwnd, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IShellFolder *psf, IContextMenu **ppcm)
Definition: CRegFolder.cpp:97
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
#define STDMETHOD(m)
Definition: basetyps.h:62
#define WARN(fmt,...)
Definition: debug.h:112
#define ERR(fmt,...)
Definition: debug.h:110
#define RegCloseKey(hKey)
Definition: registry.h:49
BOOL AddToEnumList(LPITEMIDLIST pidl)
HRESULT Initialize(LPCWSTR lpszEnumKeyName, DWORD dwFlags)
Definition: CRegFolder.cpp:252
HRESULT AddItemsFromKey(HKEY hkey_root, LPCWSTR szRepPath)
Definition: CRegFolder.cpp:271
STDMETHOD() EnumSearches(IEnumExtraSearch **ppenum) override
Definition: CRegFolder.cpp:762
STDMETHOD() MapColumnToSCID(UINT column, SHCOLUMNID *pscid) override
Definition: CRegFolder.cpp:828
STDMETHOD() GetDefaultSearchGUID(GUID *pguid) override
Definition: CRegFolder.cpp:757
STDMETHOD() CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) override
Definition: CRegFolder.cpp:480
STDMETHOD() GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override
Definition: CRegFolder.cpp:785
CAtlStringW m_enumKeyName
Definition: CRegFolder.cpp:312
STDMETHOD() CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override
Definition: CRegFolder.cpp:516
CAtlStringW m_rootPath
Definition: CRegFolder.cpp:311
STDMETHOD() SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override
Definition: CRegFolder.cpp:722
STDMETHOD() GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override
Definition: CRegFolder.cpp:767
CComHeapPtr< ITEMIDLIST > m_pidlRoot
Definition: CRegFolder.cpp:313
STDMETHOD() ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes) override
Definition: CRegFolder.cpp:404
STDMETHOD() GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags) override
Definition: CRegFolder.cpp:777
STDMETHOD() BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
Definition: CRegFolder.cpp:451
STDMETHOD() EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override
Definition: CRegFolder.cpp:446
STDMETHOD() GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
Definition: CRegFolder.cpp:584
STDMETHOD() GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override
Definition: CRegFolder.cpp:790
HRESULT GetGuidItemAttributes(LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
Definition: CRegFolder.cpp:379
STDMETHOD() GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override
Definition: CRegFolder.cpp:521
STDMETHOD() GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut) override
Definition: CRegFolder.cpp:545
HRESULT WINAPI Initialize(const GUID *pGuid, LPCITEMIDLIST pidlRoot, LPCWSTR lpszPath, LPCWSTR lpszEnumKeyName)
Definition: CRegFolder.cpp:360
STDMETHOD() BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
Definition: CRegFolder.cpp:475
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#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
unsigned int idx
Definition: utils.c:41
#define GET_SHGDN_RELATION(dwFlags)
Definition: precomp.h:53
#define DFM_INVOKECOMMAND
Definition: precomp.h:45
#define GET_SHGDN_FOR(dwFlags)
Definition: precomp.h:52
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
LONG WINAPI RegLoadMUIStringA(IN HKEY hKey, IN LPCSTR pszValue OPTIONAL, OUT LPSTR pszOutBuf, IN DWORD cbOutBuf, OUT LPDWORD pcbData OPTIONAL, IN DWORD Flags, IN LPCSTR pszDirectory OPTIONAL)
Definition: reg.c:5268
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2393
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
#define RRF_RT_REG_SZ
Definition: driver.c:575
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1306
#define swprintf
Definition: precomp.h:40
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
WCHAR swShell32Name[MAX_PATH]
Definition: folders.cpp:22
FxAutoRegKey hKey
GLuint res
Definition: glext.h:9613
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
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 BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:679
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:651
#define END_COM_MAP()
Definition: atlcom.h:592
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
static IParseDisplayName ParseDisplayName
Definition: moniker.c:816
static LPOLESTR
Definition: stg_prop.c:27
REFCLSID clsid
Definition: msctf.c:82
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
interface IBindCtx * LPBC
Definition: objfwd.h:18
const GUID IID_IDataObject
long LONG
Definition: pedump.c:60
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
BOOL _ILIsBitBucket(LPCITEMIDLIST pidl)
Definition: pidl.c:1986
BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
Definition: pidl.c:1975
void _ILFreeaPidl(LPITEMIDLIST *apidl, UINT cidl)
Definition: pidl.c:2690
BOOL _ILIsNetHood(LPCITEMIDLIST pidl)
Definition: pidl.c:1953
LPITEMIDLIST _ILCreateGuidFromStrW(LPCWSTR szGUID)
Definition: pidl.c:1769
IID * _ILGetGUIDPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2369
static const WCHAR szName[]
Definition: powrprof.c:45
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
BOOL SH_ShowRecycleBinProperties(WCHAR sDrive)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len)
Definition: classes.c:399
BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD pdwAttributes)
Definition: classes.c:567
BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int *picon_idx)
Definition: classes.c:291
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:579
HRESULT SHELL32_BindToSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidl, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: shlfolder.cpp:159
HRESULT SHELL32_GetDisplayNameOfChild(IShellFolder2 *psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: shlfolder.cpp:197
HRESULT SHELL32_CompareChildren(IShellFolder2 *psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:215
static __inline int SHELL32_GUIDToStringW(REFGUID guid, LPWSTR str)
Definition: shfldr.h:81
LSTATUS AddClassKeyToArray(const WCHAR *szClass, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:268
HRESULT SHELL32_CompareDetails(IShellFolder2 *isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:238
HRESULT SH_GetApidlFromDataObject(IDataObject *pDataObject, PIDLIST_ABSOLUTE *ppidlfolder, PUITEMID_CHILD **apidlItems, UINT *pcidl)
Definition: shlfolder.cpp:352
BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey)
Definition: classes.c:230
HRESULT SHELL32_ParseNextElement(IShellFolder2 *psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST *pidlInOut, LPOLESTR szNext, DWORD *pEaten, DWORD *pdwAttributes)
Definition: shlfolder.cpp:70
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2402
HRESULT hr
Definition: shlfolder.c:183
#define DFM_CMD_PROPERTIES
Definition: shlobj.h:2597
#define IDS_SYSTEMFOLDER
Definition: shresdef.h:350
#define IDI_SHELL_DESKTOP
Definition: shresdef.h:585
#define IDI_SHELL_DOCUMENT
Definition: shresdef.h:551
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
ITEMID_CHILD UNALIGNED * PUITEMID_CHILD
Definition: shtypes.idl:68
@ STRRET_CSTR
Definition: shtypes.idl:87
@ STRRET_WSTR
Definition: shtypes.idl:85
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:68
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
STRRET str
Definition: shtypes.idl:108
char cStr[MAX_PATH]
Definition: shtypes.idl:98
UINT uType
Definition: shtypes.idl:93
LPWSTR pOleStr
Definition: shtypes.idl:96
Definition: copy.c:22
Definition: name.c:39
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t * LPDWORD
Definition: typedefs.h:59
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
DWORD dwAttributes
Definition: vdmdbg.h:34
int ret
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
_In_ LPCSTR lpName
Definition: winbase.h:2789
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define SW_SHOWNORMAL
Definition: winuser.h:770
#define SW_SHOWDEFAULT
Definition: winuser.h:780
static void Initialize()
Definition: xlate.c:212
#define IID_PPV_ARG(Itype, ppType)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185