ReactOS 0.4.15-dev-8621-g4b051b9
CRegFolder Class Reference
Inheritance diagram for CRegFolder:
Collaboration diagram for CRegFolder:

Public Member Functions

 CRegFolder ()
 
 ~CRegFolder ()
 
HRESULT WINAPI Initialize (PREGFOLDERINITDATA pInit, LPCITEMIDLIST pidlRoot)
 
const REQUIREDREGITEMIsRequiredItem (LPCITEMIDLIST pidl) const
 
STDMETHOD() ParseDisplayName (HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes) override
 
STDMETHOD() EnumObjects (HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override
 
STDMETHOD() BindToObject (PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
 
STDMETHOD() BindToStorage (PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
 
STDMETHOD() CompareIDs (LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) override
 
STDMETHOD() CreateViewObject (HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override
 
STDMETHOD() GetAttributesOf (UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override
 
STDMETHOD() GetUIObjectOf (HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut) override
 
STDMETHOD() GetDisplayNameOf (PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
 
STDMETHOD() SetNameOf (HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override
 
STDMETHOD() GetDefaultSearchGUID (GUID *pguid) override
 
STDMETHOD() EnumSearches (IEnumExtraSearch **ppenum) override
 
STDMETHOD() GetDefaultColumn (DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override
 
STDMETHOD() GetDefaultColumnState (UINT iColumn, DWORD *pcsFlags) override
 
STDMETHOD() GetDetailsEx (PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override
 
STDMETHOD() GetDetailsOf (PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override
 
STDMETHOD() MapColumnToSCID (UINT column, SHCOLUMNID *pscid) override
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
HRESULT GetDefaultSearchGUID ([out] GUID *lpguid)
 
HRESULT EnumSearches ([out] IEnumExtraSearch **ppenum)
 
HRESULT GetDefaultColumn ([in] DWORD dwReserved, [out] ULONG *pSort, [out] ULONG *pDisplay)
 
HRESULT GetDefaultColumnState ([in] UINT iColumn, [out] SHCOLSTATEF *pcsFlags)
 
HRESULT GetDetailsEx ([in] PCUITEMID_CHILD pidl, [in] const SHCOLUMNID *pscid, [out] VARIANT *pv)
 
HRESULT GetDetailsOf ([in] PCUITEMID_CHILD pidl, [in] UINT iColumn, [out] SHELLDETAILS *psd)
 
HRESULT MapColumnToSCID ([in] UINT iColumn, [in] SHCOLUMNID *pscid)
 
- Public Member Functions inherited from IShellFolder
HRESULT ParseDisplayName ([in] HWND hwndOwner, [in] LPBC pbcReserved, [in, string] LPOLESTR lpszDisplayName, [out] ULONG *pchEaten, [out] PIDLIST_RELATIVE *ppidl, [in, out, unique] ULONG *pdwAttributes)
 
HRESULT EnumObjects ([in] HWND hwndOwner, [in] SHCONTF grfFlags, [out] IEnumIDList **ppenumIDList)
 
HRESULT BindToObject ([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
 
HRESULT BindToStorage ([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvObj)
 
HRESULT CompareIDs ([in] LPARAM lParam, [in] PCUIDLIST_RELATIVE pidl1, [in] PCUIDLIST_RELATIVE pidl2)
 
HRESULT CreateViewObject ([in] HWND hwndOwner, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
 
HRESULT GetAttributesOf ([in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in, out] SFGAOF *rgfInOut)
 
HRESULT GetUIObjectOf ([in] HWND hwndOwner, [in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in] REFIID riid, [in, out, unique] UINT *prgfInOut, [out, iid_is(riid)] void **ppvOut)
 
HRESULT GetDisplayNameOf ([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
 
HRESULT SetNameOf ([in] HWND hwnd, [in] PCUITEMID_CHILD pidl, [in, string] LPCOLESTR lpszName, [in] SHGDNF uFlags, [out] PITEMID_CHILD *ppidlOut)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
- Public Member Functions inherited from CRegFolderInfo
void InitializeFolderInfo (const REGFOLDERINFO *pInfo)
 
const CLSIDIsRegItem (LPCITEMIDLIST pidl) const
 
LPITEMIDLIST CreateItem (size_t i) const
 
LPCWSTR GetParsingPath () const
 
UINT GetCLSIDOffset () const
 
PIDLTYPE GetPidlType () const
 
UINT GetRequiredItemsCount () const
 
const REQUIREDREGITEMGetAt (size_t i) const
 

Private Member Functions

HRESULT GetGuidItemAttributes (LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
 
BOOL _IsInNameSpace (_In_ LPCITEMIDLIST pidl)
 

Private Attributes

IShellFolderm_pOuterFolder
 
CComHeapPtr< ITEMIDLISTm_pidlRoot
 

Additional Inherited Members

- Public Types inherited from IShellFolder2
typedef struct IShellFolder2::SHCOLUMNIDLPSHCOLUMNID
 
typedef const SHCOLUMNIDLPCSHCOLUMNID
 
- Public Types inherited from IShellFolder
enum  tagSHGDN {
  SHGDN_NORMAL = 0 , SHGDN_INFOLDER = 1 , SHGDN_FOREDITING = 0x1000 , SHGDN_INCLUDE_NONFILESYS = 0x2000 ,
  SHGDN_FORADDRESSBAR = 0x4000 , SHGDN_FORPARSING = 0x8000
}
 
enum  tagSHCONTF {
  SHCONTF_FOLDERS = 32 , SHCONTF_NONFOLDERS = 64 , SHCONTF_INCLUDEHIDDEN = 128 , SHCONTF_INIT_ON_FIRST_NEXT = 256 ,
  SHCONTF_NETPRINTERSRCH = 512 , SHCONTF_SHAREABLE = 1024 , SHCONTF_STORAGE = 2048 , SHCONTF_NAVIGATION_ENUM = 0x01000 ,
  SHCONTF_FASTITEMS = 0x02000 , SHCONTF_FLATLIST = 0x04000 , SHCONTF_ENABLE_ASYNC = 0x08000 , SHCONTF_INCLUDESUPERHIDDEN = 0x10000
}
 
typedef IShellFolderLPSHELLFOLDER
 
typedef enum IShellFolder::tagSHGDN SHGNO
 
typedef DWORD SHGDNF
 
typedef DWORD SHCONTF
 
typedef ULONG SFGAOF
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 
- Public Attributes inherited from CRegFolderInfo
const REGFOLDERINFOm_pInfo
 

Detailed Description

Definition at line 308 of file CRegFolder.cpp.

Constructor & Destructor Documentation

◆ CRegFolder()

CRegFolder::CRegFolder ( )

Definition at line 368 of file CRegFolder.cpp.

369{
370}

◆ ~CRegFolder()

CRegFolder::~CRegFolder ( )

Definition at line 372 of file CRegFolder.cpp.

373{
374}

Member Function Documentation

◆ _IsInNameSpace()

BOOL CRegFolder::_IsInNameSpace ( _In_ LPCITEMIDLIST  pidl)
private

Definition at line 410 of file CRegFolder.cpp.

411{
413 if (IsEqualGUID(clsid, CLSID_Printers))
414 return TRUE;
416 return TRUE;
417 FIXME("Check registry\n");
418 return TRUE;
419}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define TRUE
Definition: types.h:120
REFCLSID clsid
Definition: msctf.c:82
IID * _ILGetGUIDPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2298
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define CLSID_ConnectionFolder

Referenced by ParseDisplayName().

◆ BindToObject()

HRESULT WINAPI CRegFolder::BindToObject ( PCUIDLIST_RELATIVE  pidl,
LPBC  pbcReserved,
REFIID  riid,
LPVOID ppvOut 
)
override

Definition at line 488 of file CRegFolder.cpp.

489{
490 CComPtr<IPersistFolder> pFolder;
491 HRESULT hr;
492
493 if (!ppvOut || !pidl || !pidl->mkid.cb)
494 return E_INVALIDARG;
495
496 *ppvOut = NULL;
497
498 GUID *pGUID = _ILGetGUIDPointer(pidl);
499 if (!pGUID)
500 {
501 ERR("CRegFolder::BindToObject called for non guid item!\n");
502 return E_INVALIDARG;
503 }
504
505 hr = SHELL32_BindToSF(m_pidlRoot, NULL, pidl, pGUID, riid, ppvOut);
507 return hr;
508
509 return S_OK;
510}
#define ERR(fmt,...)
Definition: precomp.h:57
CComHeapPtr< ITEMIDLIST > m_pidlRoot
Definition: CRegFolder.cpp:315
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
HRESULT SHELL32_BindToSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidl, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: shlfolder.cpp:196
HRESULT hr
Definition: shlfolder.c:183

◆ BindToStorage()

HRESULT WINAPI CRegFolder::BindToStorage ( PCUIDLIST_RELATIVE  pidl,
LPBC  pbcReserved,
REFIID  riid,
LPVOID ppvOut 
)
override

Definition at line 512 of file CRegFolder.cpp.

513{
514 return E_NOTIMPL;
515}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CompareIDs()

HRESULT WINAPI CRegFolder::CompareIDs ( LPARAM  lParam,
PCUIDLIST_RELATIVE  pidl1,
PCUIDLIST_RELATIVE  pidl2 
)
override

Implements IShellFolder.

Definition at line 517 of file CRegFolder.cpp.

518{
519 if (!pidl1 || !pidl2 || pidl1->mkid.cb == 0 || pidl2->mkid.cb == 0)
520 {
521 ERR("Got an empty pidl!\n");
522 return E_INVALIDARG;
523 }
524
525 GUID const *clsid1 = _ILGetGUIDPointer (pidl1);
526 GUID const *clsid2 = _ILGetGUIDPointer (pidl2);
527
528 if (!clsid1 && !clsid2)
529 {
530 ERR("Got no guid pidl!\n");
531 return E_INVALIDARG;
532 }
533 else if (clsid1 && clsid2)
534 {
535 if (memcmp(clsid1, clsid2, sizeof(GUID)) == 0)
536 return SHELL32_CompareChildren(this, lParam, pidl1, pidl2);
537
538 return SHELL32_CompareDetails(this, lParam, pidl1, pidl2);
539 }
540
541 /* Guid folders come first compared to everything else */
542 /* And Drives come before folders in My Computer */
543 if (GetPidlType() == PT_COMPUTER_REGITEM)
544 return MAKE_COMPARE_HRESULT(clsid1 ? 1 : -1);
545 else
546 return MAKE_COMPARE_HRESULT(clsid1 ? -1 : 1);
547}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
LPARAM lParam
Definition: combotst.c:139
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:621
HRESULT SHELL32_CompareChildren(IShellFolder2 *psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:252
HRESULT SHELL32_CompareDetails(IShellFolder2 *isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:275
PIDLTYPE GetPidlType() const
Definition: CRegFolder.cpp:123

◆ CreateViewObject()

HRESULT WINAPI CRegFolder::CreateViewObject ( HWND  hwndOwner,
REFIID  riid,
LPVOID ppvOut 
)
override

Definition at line 549 of file CRegFolder.cpp.

550{
551 return E_NOTIMPL;
552}

◆ EnumObjects()

HRESULT WINAPI CRegFolder::EnumObjects ( HWND  hwndOwner,
DWORD  dwFlags,
LPENUMIDLIST *  ppEnumIDList 
)
override

Definition at line 482 of file CRegFolder.cpp.

483{
484 return ShellObjectCreatorInit<CRegFolderEnum>(m_pInfo, m_pOuterFolder, dwFlags,
485 IID_PPV_ARG(IEnumIDList, ppEnumIDList));
486}
IShellFolder * m_pOuterFolder
Definition: CRegFolder.cpp:314
const REGFOLDERINFO * m_pInfo
Definition: CRegFolder.cpp:91
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define IID_PPV_ARG(Itype, ppType)

◆ EnumSearches()

HRESULT WINAPI CRegFolder::EnumSearches ( IEnumExtraSearch **  ppenum)
override

Implements IShellFolder2.

Definition at line 794 of file CRegFolder.cpp.

795{
796 return E_NOTIMPL;
797}

◆ GetAttributesOf()

HRESULT WINAPI CRegFolder::GetAttributesOf ( UINT  cidl,
PCUITEMID_CHILD_ARRAY  apidl,
DWORD rgfInOut 
)
override

Definition at line 554 of file CRegFolder.cpp.

555{
556 if (!rgfInOut || !cidl || !apidl)
557 return E_INVALIDARG;
558
559 if (*rgfInOut == 0)
560 *rgfInOut = ~0;
561
562 while(cidl > 0 && *apidl)
563 {
564 if (_ILIsSpecialFolder(*apidl))
565 GetGuidItemAttributes(*apidl, rgfInOut);
566 else
567 ERR("Got unknown pidl\n");
568 apidl++;
569 cidl--;
570 }
571
572 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
573 *rgfInOut &= ~SFGAO_VALIDATE;
574
575 return S_OK;
576}
HRESULT GetGuidItemAttributes(LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
Definition: CRegFolder.cpp:388
BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:1998

◆ GetDefaultColumn()

HRESULT WINAPI CRegFolder::GetDefaultColumn ( DWORD  dwRes,
ULONG pSort,
ULONG pDisplay 
)
override

Implements IShellFolder2.

Definition at line 799 of file CRegFolder.cpp.

800{
801 if (pSort)
802 *pSort = 0;
803 if (pDisplay)
804 *pDisplay = 0;
805
806 return S_OK;
807}

◆ GetDefaultColumnState()

HRESULT WINAPI CRegFolder::GetDefaultColumnState ( UINT  iColumn,
DWORD pcsFlags 
)
override

Implements IShellFolder2.

Definition at line 809 of file CRegFolder.cpp.

810{
811 if (iColumn >= REGFOLDERCOLUMNCOUNT)
812 return E_INVALIDARG;
814 return S_OK;
815}
@ REGFOLDERCOLUMNCOUNT
Definition: CRegFolder.cpp:305
@ SHCOLSTATE_TYPE_STR
Definition: shtypes.idl:121
@ SHCOLSTATE_ONBYDEFAULT
Definition: shtypes.idl:125

◆ GetDefaultSearchGUID()

HRESULT WINAPI CRegFolder::GetDefaultSearchGUID ( GUID pguid)
override

Implements IShellFolder2.

Definition at line 789 of file CRegFolder.cpp.

790{
791 return E_NOTIMPL;
792}

◆ GetDetailsEx()

HRESULT WINAPI CRegFolder::GetDetailsEx ( PCUITEMID_CHILD  pidl,
const SHCOLUMNID pscid,
VARIANT pv 
)
override

Implements IShellFolder2.

Definition at line 817 of file CRegFolder.cpp.

818{
819 return E_NOTIMPL;
820}

◆ GetDetailsOf()

HRESULT WINAPI CRegFolder::GetDetailsOf ( PCUITEMID_CHILD  pidl,
UINT  iColumn,
SHELLDETAILS psd 
)
override

Implements IShellFolder2.

Definition at line 822 of file CRegFolder.cpp.

823{
824 if (!psd)
825 return E_INVALIDARG;
826
827 if (!pidl)
828 {
829 TRACE("CRegFolder has no column info\n");
830 return E_INVALIDARG;
831 }
832
833 GUID const *clsid = _ILGetGUIDPointer (pidl);
834
835 if (!clsid)
836 {
837 ERR("Pidl is not reg item!\n");
838 return E_INVALIDARG;
839 }
840
841 switch(iColumn)
842 {
843 case COL_NAME:
844 return GetDisplayNameOf(pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
845 case COL_TYPE:
846 return SHSetStrRet(&psd->str, IDS_SYSTEMFOLDER);
847 case COL_INFOTIP:
848 HKEY hKey;
850 return SHSetStrRet(&psd->str, "");
851
852 psd->str.cStr[0] = 0x00;
853 psd->str.uType = STRRET_CSTR;
854 RegLoadMUIStringA(hKey, "InfoTip", psd->str.cStr, MAX_PATH, NULL, 0, NULL);
856 return S_OK;
857 default:
858 /* Return an empty string when we area asked for a column we don't support.
859 Only the regfolder is supposed to do this as it supports less columns compared to other folder
860 and its contents are supposed to be presented alongside items that support more columns. */
861 return SHSetStrRet(&psd->str, "");
862 }
863 return E_FAIL;
864}
@ COL_INFOTIP
Definition: CRegFolder.cpp:304
@ COL_NAME
Definition: CRegFolder.cpp:302
@ COL_TYPE
Definition: CRegFolder.cpp:303
#define RegCloseKey(hKey)
Definition: registry.h:49
STDMETHOD() GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
Definition: CRegFolder.cpp:617
#define E_FAIL
Definition: ddrawi.h:102
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
#define MAX_PATH
Definition: compat.h:34
FxAutoRegKey hKey
BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey)
Definition: classes.c:236
#define IDS_SYSTEMFOLDER
Definition: shresdef.h:355
@ STRRET_CSTR
Definition: shtypes.idl:87
#define TRACE(s)
Definition: solgame.cpp:4
STRRET str
Definition: shtypes.idl:108
char cStr[MAX_PATH]
Definition: shtypes.idl:98
UINT uType
Definition: shtypes.idl:93

◆ GetDisplayNameOf()

HRESULT WINAPI CRegFolder::GetDisplayNameOf ( PCUITEMID_CHILD  pidl,
DWORD  dwFlags,
LPSTRRET  strRet 
)
override

Definition at line 617 of file CRegFolder.cpp.

618{
619 if (!strRet || (!_ILIsSpecialFolder(pidl) && pidl != NULL))
620 return E_INVALIDARG;
621
622 if (!pidl || !pidl->mkid.cb)
623 {
625 {
627 {
628 TRACE("GDNO returning INFOLDER instead of %#x\n", GET_SHGDN_RELATION(dwFlags));
629 }
630 LPWSTR pszPath = (LPWSTR)CoTaskMemAlloc((2 + 38 + 1) * sizeof(WCHAR));
631 if (!pszPath)
632 return E_OUTOFMEMORY;
633 /* parsing name like ::{...} */
634 pszPath[0] = ':';
635 pszPath[1] = ':';
636 SHELL32_GUIDToStringW(m_pInfo->clsid, &pszPath[2]);
637 strRet->uType = STRRET_WSTR;
638 strRet->pOleStr = pszPath;
639 return S_OK;
640 }
641 else
642 {
643 BOOL bRet;
644 WCHAR wstrName[MAX_PATH+1];
645 bRet = HCR_GetClassNameW(m_pInfo->clsid, wstrName, MAX_PATH);
646 if (!bRet)
647 return E_FAIL;
648
649 return SHSetStrRet(strRet, wstrName);
650 }
651 }
652
653 HRESULT hr;
654 GUID const *clsid = _ILGetGUIDPointer (pidl);
655
656 /* First of all check if we need to query the name from the child item */
659 {
660 int bWantsForParsing = FALSE;
661
662 /*
663 * We can only get a filesystem path from a shellfolder if the
664 * value WantsFORPARSING in CLSID\\{...}\\shellfolder exists.
665 *
666 * Exception: The MyComputer folder doesn't have this key,
667 * but any other filesystem backed folder it needs it.
668 */
669 if (IsEqualIID (*clsid, CLSID_MyComputer))
670 {
671 bWantsForParsing = TRUE;
672 }
673 else
674 {
675 HKEY hkeyClass;
676 if (HCR_RegOpenClassIDKey(*clsid, &hkeyClass))
677 {
678 LONG res = SHGetValueW(hkeyClass, L"Shellfolder", L"WantsForParsing", NULL, NULL, NULL);
679 bWantsForParsing = (res == ERROR_SUCCESS);
680 RegCloseKey(hkeyClass);
681 }
682 }
683
684 if (bWantsForParsing)
685 {
686 /*
687 * we need the filesystem path to the destination folder.
688 * Only the folder itself can know it
689 */
690 return SHELL32_GetDisplayNameOfChild (this, pidl, dwFlags, strRet);
691 }
692 }
693
694 /* Allocate the buffer for the result */
695 SIZE_T cchPath = MAX_PATH + 1;
696 LPWSTR pszPath = (LPWSTR)CoTaskMemAlloc(cchPath * sizeof(WCHAR));
697 if (!pszPath)
698 return E_OUTOFMEMORY;
699
700 hr = S_OK;
701
703 {
704 SIZE_T pathlen = 0;
705 PWCHAR pItemName = pszPath; // GET_SHGDN_RELATION(dwFlags) == SHGDN_INFOLDER
707 {
708 hr = StringCchCopyW(pszPath, cchPath, GetParsingPath());
709 if (SUCCEEDED(hr))
710 {
711 pathlen = wcslen(pszPath);
712 pItemName = &pszPath[pathlen];
713 if (pathlen)
714 {
715 if (++pathlen < cchPath)
716 *pItemName++ = L'\\';
717 else
719 }
720 }
721 }
722
723 if (SUCCEEDED(hr) && pathlen + 2 + 38 + 1 < cchPath)
724 {
725 /* parsing name like ::{...} */
726 pItemName[0] = L':';
727 pItemName[1] = L':';
728 SHELL32_GUIDToStringW(*clsid, &pItemName[2]);
729 }
730 else
731 {
733 }
734 }
735 else
736 {
737 /* user friendly name */
738 if (!HCR_GetClassNameW(*clsid, pszPath, cchPath))
739 hr = E_FAIL;
740 }
741
742 if (SUCCEEDED(hr))
743 {
744 strRet->uType = STRRET_WSTR;
745 strRet->pOleStr = pszPath;
746 }
747 else
748 {
749 CoTaskMemFree(pszPath);
750 }
751
752 return hr;
753}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FALSE
Definition: types.h:117
#define GET_SHGDN_RELATION(dwFlags)
Definition: precomp.h:53
#define GET_SHGDN_FOR(dwFlags)
Definition: precomp.h:52
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
unsigned int BOOL
Definition: ntddk_ex.h:94
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)
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len)
Definition: classes.c:405
HRESULT SHELL32_GetDisplayNameOfChild(IShellFolder2 *psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: shlfolder.cpp:234
#define IS_SHGDN_FOR_PARSING(flags)
Definition: shfldr.h:77
static __inline int SHELL32_GUIDToStringW(REFGUID guid, LPWSTR str)
Definition: shfldr.h:143
@ STRRET_WSTR
Definition: shtypes.idl:85
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
LPCWSTR GetParsingPath() const
Definition: CRegFolder.cpp:121
REFCLSID clsid
Definition: shfldr.h:62
LPWSTR pOleStr
Definition: shtypes.idl:96
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint16_t * PWCHAR
Definition: typedefs.h:56
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by GetDetailsOf().

◆ GetGuidItemAttributes()

HRESULT CRegFolder::GetGuidItemAttributes ( LPCITEMIDLIST  pidl,
LPDWORD  pdwAttributes 
)
private

Definition at line 388 of file CRegFolder.cpp.

389{
390 DWORD dwAttributes = *pdwAttributes;
391
392 /* First try to get them from the registry */
393 if (!HCR_GetFolderAttributes(pidl, pdwAttributes))
394 {
395 /* We couldn't get anything */
396 *pdwAttributes = 0;
397 }
398
399 /* Items have more attributes when on desktop */
401 {
402 *pdwAttributes |= (dwAttributes & (SFGAO_CANLINK|SFGAO_CANDELETE|SFGAO_CANRENAME|SFGAO_HASPROPSHEET));
403 }
404
405 /* In any case, links can be created */
406 *pdwAttributes |= (dwAttributes & SFGAO_CANLINK);
407 return S_OK;
408}
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD pdwAttributes)
Definition: classes.c:573
DWORD dwAttributes
Definition: vdmdbg.h:34

Referenced by GetAttributesOf(), and ParseDisplayName().

◆ GetUIObjectOf()

HRESULT WINAPI CRegFolder::GetUIObjectOf ( HWND  hwndOwner,
UINT  cidl,
PCUITEMID_CHILD_ARRAY  apidl,
REFIID  riid,
UINT prgfInOut,
LPVOID ppvOut 
)
override

Definition at line 578 of file CRegFolder.cpp.

580{
581 LPVOID pObj = NULL;
583
584 if (!ppvOut)
585 return hr;
586
587 *ppvOut = NULL;
588
589 if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
590 {
591 hr = CGuidItemExtractIcon_CreateInstance(apidl[0], riid, &pObj);
592 }
593 else if (IsEqualIID (riid, IID_IContextMenu) && (cidl >= 1))
594 {
595 if (!_ILGetGUIDPointer (apidl[0]))
596 {
597 ERR("Got non guid item!\n");
598 return E_FAIL;
599 }
600
601 hr = CRegItemContextMenu_CreateInstance(m_pidlRoot, hwndOwner, cidl, apidl, static_cast<IShellFolder*>(this), (IContextMenu**)&pObj);
602 }
603 else if (IsEqualIID (riid, IID_IDataObject) && (cidl >= 1))
604 {
605 hr = IDataObject_Constructor (hwndOwner, m_pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
606 }
607 else
608 {
610 }
611
612 *ppvOut = pObj;
613 return hr;
614
615}
HRESULT IDataObject_Constructor(HWND hwndOwner, PCIDLIST_ABSOLUTE pMyPidl, PCUIDLIST_RELATIVE_ARRAY apidl, UINT cidl, BOOL bExtendedObject, IDataObject **dataObject)
static HRESULT CRegItemContextMenu_CreateInstance(PCIDLIST_ABSOLUTE pidlFolder, HWND hwnd, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IShellFolder *psf, IContextMenu **ppcm)
Definition: CRegFolder.cpp:913
HRESULT CGuidItemExtractIcon_CreateInstance(LPCITEMIDLIST pidl, REFIID iid, LPVOID *ppvOut)
Definition: CRegFolder.cpp:128
const GUID IID_IDataObject
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ Initialize()

HRESULT WINAPI CRegFolder::Initialize ( PREGFOLDERINITDATA  pInit,
LPCITEMIDLIST  pidlRoot 
)

Definition at line 376 of file CRegFolder.cpp.

377{
379 m_pOuterFolder = pInit->psfOuter;
380
381 m_pidlRoot.Attach(ILClone(pidlRoot));
382 if (!m_pidlRoot)
383 return E_OUTOFMEMORY;
384
385 return S_OK;
386}
PWDFDEVICE_INIT pInit
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
void InitializeFolderInfo(const REGFOLDERINFO *pInfo)
Definition: CRegFolder.cpp:93

◆ IsRequiredItem()

const REQUIREDREGITEM * CRegFolder::IsRequiredItem ( LPCITEMIDLIST  pidl) const
inline

Definition at line 325 of file CRegFolder.cpp.

326 {
327 const CLSID* const pCLSID = IsRegItem(pidl);
328 for (size_t i = 0; pCLSID && i < GetRequiredItemsCount(); ++i)
329 {
330 const REQUIREDREGITEM &item = GetAt(i);
331 if (item.clsid == *pCLSID)
332 return &item;
333 }
334 return NULL;
335 }
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
static ATOM item
Definition: dde.c:856
const CLSID * IsRegItem(LPCITEMIDLIST pidl) const
Definition: CRegFolder.cpp:98
const REQUIREDREGITEM & GetAt(size_t i) const
Definition: CRegFolder.cpp:125
UINT GetRequiredItemsCount() const
Definition: CRegFolder.cpp:124

Referenced by RegFolderContextMenuCallback().

◆ MapColumnToSCID()

HRESULT WINAPI CRegFolder::MapColumnToSCID ( UINT  column,
SHCOLUMNID pscid 
)
override

Implements IShellFolder2.

Definition at line 866 of file CRegFolder.cpp.

867{
868 return E_NOTIMPL;
869}

◆ ParseDisplayName()

HRESULT WINAPI CRegFolder::ParseDisplayName ( HWND  hwndOwner,
LPBC  pbc,
LPOLESTR  lpszDisplayName,
ULONG pchEaten,
PIDLIST_RELATIVE ppidl,
ULONG pdwAttributes 
)
override

Implements IShellFolder.

Definition at line 421 of file CRegFolder.cpp.

423{
424 if (!ppidl)
425 return E_INVALIDARG;
426
427 *ppidl = NULL;
428
429 if (!lpszDisplayName)
430 return E_INVALIDARG;
431
432 if (lpszDisplayName[0] != L':' || lpszDisplayName[1] != L':')
433 {
434 FIXME("What should we do here?\n");
435 return E_FAIL;
436 }
437
438 LPWSTR pch, pchNextOfComma = NULL;
439 for (pch = &lpszDisplayName[2]; *pch && *pch != L'\\'; ++pch)
440 {
441 if (*pch == L',' && !pchNextOfComma)
442 pchNextOfComma = pch + 1;
443 }
444
445 CLSID clsid;
446 if (!GUIDFromStringW(&lpszDisplayName[2], &clsid))
447 return CO_E_CLASSSTRING;
448
449 if (pchNextOfComma)
450 {
451 FIXME("Delegate folder\n");
452 return E_FAIL;
453 }
454
455 CComHeapPtr<ITEMIDLIST> pidlTemp(CreateRegItem(GetPidlType(), clsid));
456 if (!pidlTemp)
457 return E_OUTOFMEMORY;
458
459 if (!_IsInNameSpace(pidlTemp) && !(BindCtx_GetMode(pbc, 0) & STGM_CREATE))
460 return E_INVALIDARG;
461
462 *ppidl = pidlTemp.Detach();
463
464 if (!*pch)
465 {
466 if (pdwAttributes && *pdwAttributes)
467 GetGuidItemAttributes(*ppidl, pdwAttributes);
468
469 return S_OK;
470 }
471
472 HRESULT hr = SHELL32_ParseNextElement(this, hwndOwner, pbc, ppidl, pch + 1, pchEaten,
473 pdwAttributes);
474 if (FAILED(hr))
475 {
476 ILFree(*ppidl);
477 *ppidl = NULL;
478 }
479 return hr;
480}
static LPITEMIDLIST CreateRegItem(PIDLTYPE type, REFCLSID clsid, BYTE order=0)
Definition: CRegFolder.cpp:38
BOOL _IsInNameSpace(_In_ LPCITEMIDLIST pidl)
Definition: CRegFolder.cpp:410
DWORD BindCtx_GetMode(_In_ IBindCtx *pbc, _In_ DWORD dwDefault)
Definition: utils.cpp:128
#define FAILED(hr)
Definition: intsafe.h:51
#define pch(ap)
Definition: match.c:418
#define STGM_CREATE
Definition: objbase.h:926
BOOL WINAPI GUIDFromStringW(_In_ PCWSTR psz, _Out_ LPGUID pguid)
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:946
HRESULT SHELL32_ParseNextElement(IShellFolder2 *psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST *pidlInOut, LPOLESTR szNext, DWORD *pEaten, DWORD *pdwAttributes)
Definition: shlfolder.cpp:107
#define CO_E_CLASSSTRING
Definition: winerror.h:2806

◆ SetNameOf()

HRESULT WINAPI CRegFolder::SetNameOf ( HWND  hwndOwner,
PCUITEMID_CHILD  pidl,
LPCOLESTR  lpName,
DWORD  dwFlags,
PITEMID_CHILD pPidlOut 
)
override

Implements IShellFolder.

Definition at line 755 of file CRegFolder.cpp.

757{
758 GUID const *clsid = _ILGetGUIDPointer (pidl);
759 LPOLESTR pStr;
760 HRESULT hr;
761 WCHAR szName[100];
762
763 if (!clsid)
764 {
765 ERR("Pidl is not reg item!\n");
766 return E_FAIL;
767 }
768
769 hr = StringFromCLSID(*clsid, &pStr);
771 return hr;
772
773 swprintf(szName, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%s", pStr);
774
775 DWORD cbData = (wcslen(lpName) + 1) * sizeof(WCHAR);
777
778 CoTaskMemFree(pStr);
779
780 if (res == ERROR_SUCCESS)
781 {
782 return pPidlOut ? SHILClone(pidl, pPidlOut) : S_OK;
783 }
784
785 return E_FAIL;
786}
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
#define RRF_RT_REG_SZ
Definition: driver.c:575
HRESULT SHILClone(_In_opt_ LPCITEMIDLIST pidl, _Outptr_ LPITEMIDLIST *ppidl)
Definition: utils.cpp:13
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 LPOLESTR
Definition: stg_prop.c:27
static const WCHAR szName[]
Definition: powrprof.c:45
_In_ LPCSTR lpName
Definition: winbase.h:2789
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Member Data Documentation

◆ m_pidlRoot

CComHeapPtr<ITEMIDLIST> CRegFolder::m_pidlRoot
private

Definition at line 315 of file CRegFolder.cpp.

Referenced by BindToObject(), GetGuidItemAttributes(), GetUIObjectOf(), and Initialize().

◆ m_pOuterFolder

IShellFolder* CRegFolder::m_pOuterFolder
private

Definition at line 314 of file CRegFolder.cpp.

Referenced by EnumObjects(), and Initialize().


The documentation for this class was generated from the following file: