ReactOS 0.4.15-dev-7942-gd23573b
CRegFolder Class Reference
Inheritance diagram for CRegFolder:
Collaboration diagram for CRegFolder:

Public Member Functions

 CRegFolder ()
 
 ~CRegFolder ()
 
HRESULT WINAPI Initialize (const GUID *pGuid, LPCITEMIDLIST pidlRoot, LPCWSTR lpszPath, LPCWSTR lpszEnumKeyName)
 
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 ()
 

Private Member Functions

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

Private Attributes

GUID m_guid
 
CAtlStringW m_rootPath
 
CAtlStringW m_enumKeyName
 
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
 

Detailed Description

Definition at line 305 of file CRegFolder.cpp.

Constructor & Destructor Documentation

◆ CRegFolder()

CRegFolder::CRegFolder ( )

Definition at line 354 of file CRegFolder.cpp.

355{
356}

◆ ~CRegFolder()

CRegFolder::~CRegFolder ( )

Definition at line 358 of file CRegFolder.cpp.

359{
360}

Member Function Documentation

◆ _IsInNameSpace()

BOOL CRegFolder::_IsInNameSpace ( _In_ LPCITEMIDLIST  pidl)
private

Definition at line 406 of file CRegFolder.cpp.

407{
409 if (IsEqualGUID(clsid, CLSID_Printers))
410 return TRUE;
411 if (IsEqualGUID(clsid, CLSID_ConnectionFolder))
412 return TRUE;
413 FIXME("Check registry\n");
414 return TRUE;
415}
#define FIXME(fmt,...)
Definition: debug.h:111
#define TRUE
Definition: types.h:120
REFCLSID clsid
Definition: msctf.c:82
IID * _ILGetGUIDPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2369
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

Referenced by ParseDisplayName().

◆ BindToObject()

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

Definition at line 483 of file CRegFolder.cpp.

484{
485 CComPtr<IPersistFolder> pFolder;
486 HRESULT hr;
487
488 if (!ppvOut || !pidl || !pidl->mkid.cb)
489 return E_INVALIDARG;
490
491 *ppvOut = NULL;
492
493 GUID *pGUID = _ILGetGUIDPointer(pidl);
494 if (!pGUID)
495 {
496 ERR("CRegFolder::BindToObject called for non guid item!\n");
497 return E_INVALIDARG;
498 }
499
500 hr = SHELL32_BindToSF(m_pidlRoot, NULL, pidl, pGUID, riid, ppvOut);
502 return hr;
503
504 return S_OK;
505}
#define ERR(fmt,...)
Definition: debug.h:110
CComHeapPtr< ITEMIDLIST > m_pidlRoot
Definition: CRegFolder.cpp:313
#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:168
HRESULT hr
Definition: shlfolder.c:183

◆ BindToStorage()

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

Definition at line 507 of file CRegFolder.cpp.

508{
509 return E_NOTIMPL;
510}
#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 512 of file CRegFolder.cpp.

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

◆ CreateViewObject()

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

Definition at line 548 of file CRegFolder.cpp.

549{
550 return E_NOTIMPL;
551}

◆ EnumObjects()

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

Definition at line 478 of file CRegFolder.cpp.

479{
480 return ShellObjectCreatorInit<CRegFolderEnum>(m_enumKeyName, dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
481}
CAtlStringW m_enumKeyName
Definition: CRegFolder.cpp:312
_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 553 of file CRegFolder.cpp.

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

◆ 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 >= REGISTRY_COL_COUNT)
812 return E_INVALIDARG;
814 return S_OK;
815}
@ REGISTRY_COL_COUNT
Definition: CRegFolder.cpp:241
@ 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 GUID const *clsid = _ILGetGUIDPointer (pidl);
828
829 if (!clsid)
830 {
831 ERR("Pidl is not reg item!\n");
832 return E_INVALIDARG;
833 }
834
835 switch(iColumn)
836 {
838 return GetDisplayNameOf(pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
840 return SHSetStrRet(&psd->str, IDS_SYSTEMFOLDER);
842 HKEY hKey;
844 return SHSetStrRet(&psd->str, "");
845
846 psd->str.cStr[0] = 0x00;
847 psd->str.uType = STRRET_CSTR;
848 RegLoadMUIStringA(hKey, "InfoTip", psd->str.cStr, MAX_PATH, NULL, 0, NULL);
850 return S_OK;
851 default:
852 /* Return an empty string when we area asked for a column we don't support.
853 Only the regfolder is supposed to do this as it supports less columns compared to other folder
854 and its contents are supposed to be presented alongside items that support more columns. */
855 return SHSetStrRet(&psd->str, "");
856 }
857 return E_FAIL;
858}
@ REGISTRY_COL_TYPE
Definition: CRegFolder.cpp:239
@ REGISTRY_COL_NAME
Definition: CRegFolder.cpp:238
@ REGISTRY_COL_VALUE
Definition: CRegFolder.cpp:240
#define RegCloseKey(hKey)
Definition: registry.h:49
STDMETHOD() GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
Definition: CRegFolder.cpp:616
#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:230
#define IDS_SYSTEMFOLDER
Definition: shresdef.h:350
@ STRRET_CSTR
Definition: shtypes.idl:87
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 616 of file CRegFolder.cpp.

617{
618 if (!strRet || (!_ILIsSpecialFolder(pidl) && pidl != NULL))
619 return E_INVALIDARG;
620
621 if (!pidl || !pidl->mkid.cb)
622 {
624 {
625 LPWSTR pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
626 if (!pszPath)
627 return E_OUTOFMEMORY;
628
629 /* parsing name like ::{...} */
630 pszPath[0] = ':';
631 pszPath[1] = ':';
632 SHELL32_GUIDToStringW(m_guid, &pszPath[2]);
633
634 strRet->uType = STRRET_WSTR;
635 strRet->pOleStr = pszPath;
636
637 return S_OK;
638 }
639 else
640 {
641 BOOL bRet;
642 WCHAR wstrName[MAX_PATH+1];
643 bRet = HCR_GetClassNameW(m_guid, wstrName, MAX_PATH);
644 if (!bRet)
645 return E_FAIL;
646
647 return SHSetStrRet(strRet, wstrName);
648
649 }
650 }
651
652 HRESULT hr;
653 GUID const *clsid = _ILGetGUIDPointer (pidl);
654
655 /* First of all check if we need to query the name from the child item */
658 {
659 int bWantsForParsing = FALSE;
660
661 /*
662 * We can only get a filesystem path from a shellfolder if the
663 * value WantsFORPARSING in CLSID\\{...}\\shellfolder exists.
664 *
665 * Exception: The MyComputer folder doesn't have this key,
666 * but any other filesystem backed folder it needs it.
667 */
668 if (IsEqualIID (*clsid, CLSID_MyComputer))
669 {
670 bWantsForParsing = TRUE;
671 }
672 else
673 {
674 HKEY hkeyClass;
675 if (HCR_RegOpenClassIDKey(*clsid, &hkeyClass))
676 {
677 LONG res = SHGetValueW(hkeyClass, L"Shellfolder", L"WantsForParsing", NULL, NULL, NULL);
678 bWantsForParsing = (res == ERROR_SUCCESS);
679 RegCloseKey(hkeyClass);
680 }
681 }
682
683 if (bWantsForParsing)
684 {
685 /*
686 * we need the filesystem path to the destination folder.
687 * Only the folder itself can know it
688 */
689 return SHELL32_GetDisplayNameOfChild (this, pidl, dwFlags, strRet);
690 }
691 }
692
693 /* Allocate the buffer for the result */
694 SIZE_T cchPath = MAX_PATH + 1;
695 LPWSTR pszPath = (LPWSTR)CoTaskMemAlloc(cchPath * sizeof(WCHAR));
696 if (!pszPath)
697 return E_OUTOFMEMORY;
698
699 hr = S_OK;
700
702 {
703 SIZE_T pathlen = 0;
704 PWCHAR pItemName = pszPath; // GET_SHGDN_RELATION(dwFlags) == SHGDN_INFOLDER
706 {
707 hr = StringCchCopyW(pszPath, cchPath, m_rootPath);
708 if (SUCCEEDED(hr))
709 {
710 pathlen = wcslen(pszPath);
711 pItemName = &pszPath[pathlen];
712 if (pathlen)
713 {
714 if (++pathlen < cchPath)
715 *pItemName++ = L'\\';
716 else
718 }
719 }
720 }
721
722 if (SUCCEEDED(hr) && pathlen + 2 + 38 + 1 < cchPath)
723 {
724 /* parsing name like ::{...} */
725 pItemName[0] = L':';
726 pItemName[1] = L':';
727 SHELL32_GUIDToStringW(*clsid, &pItemName[2]);
728 }
729 else
730 {
732 }
733 }
734 else
735 {
736 /* user friendly name */
737 if (!HCR_GetClassNameW(*clsid, pszPath, cchPath))
738 hr = E_FAIL;
739 }
740
741 if (SUCCEEDED(hr))
742 {
743 strRet->uType = STRRET_WSTR;
744 strRet->pOleStr = pszPath;
745 }
746 else
747 {
748 CoTaskMemFree(pszPath);
749 }
750
751 return hr;
752}
CAtlStringW m_rootPath
Definition: CRegFolder.cpp:311
#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:399
HRESULT SHELL32_GetDisplayNameOfChild(IShellFolder2 *psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: shlfolder.cpp:206
static __inline int SHELL32_GUIDToStringW(REFGUID guid, LPWSTR str)
Definition: shfldr.h:85
@ STRRET_WSTR
Definition: shtypes.idl:85
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
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 381 of file CRegFolder.cpp.

382{
383 DWORD dwAttributes = *pdwAttributes;
384
385 /* First try to get them from the registry */
386 if (!HCR_GetFolderAttributes(pidl, pdwAttributes))
387 {
388 /* We couldn't get anything */
389 *pdwAttributes = 0;
390 }
391
392 /* Items have more attributes when on desktop */
394 {
395 *pdwAttributes |= (dwAttributes & (SFGAO_CANLINK|SFGAO_CANDELETE|SFGAO_CANRENAME|SFGAO_HASPROPSHEET));
396 }
397
398 /* In any case, links can be created */
399 if (*pdwAttributes == NULL)
400 {
401 *pdwAttributes |= (dwAttributes & SFGAO_CANLINK);
402 }
403 return S_OK;
404}
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:567
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 577 of file CRegFolder.cpp.

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

◆ Initialize()

HRESULT WINAPI CRegFolder::Initialize ( const GUID pGuid,
LPCITEMIDLIST  pidlRoot,
LPCWSTR  lpszPath,
LPCWSTR  lpszEnumKeyName 
)

Definition at line 362 of file CRegFolder.cpp.

363{
364 memcpy(&m_guid, pGuid, sizeof(m_guid));
365
366 m_rootPath = lpszPath;
367 if (!m_rootPath)
368 return E_OUTOFMEMORY;
369
370 m_enumKeyName = lpszEnumKeyName;
371 if (!m_enumKeyName)
372 return E_OUTOFMEMORY;
373
374 m_pidlRoot.Attach(ILClone(pidlRoot));
375 if (!m_pidlRoot)
376 return E_OUTOFMEMORY;
377
378 return S_OK;
379}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237

◆ MapColumnToSCID()

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

Implements IShellFolder2.

Definition at line 860 of file CRegFolder.cpp.

861{
862 return E_NOTIMPL;
863}

◆ ParseDisplayName()

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

Implements IShellFolder.

Definition at line 417 of file CRegFolder.cpp.

419{
420 if (!ppidl)
421 return E_INVALIDARG;
422
423 *ppidl = NULL;
424
425 if (!lpszDisplayName)
426 return E_INVALIDARG;
427
428 if (lpszDisplayName[0] != L':' || lpszDisplayName[1] != L':')
429 {
430 FIXME("What should we do here?\n");
431 return E_FAIL;
432 }
433
434 LPWSTR pch, pchNextOfComma = NULL;
435 for (pch = &lpszDisplayName[2]; *pch && *pch != L'\\'; ++pch)
436 {
437 if (*pch == L',' && !pchNextOfComma)
438 pchNextOfComma = pch + 1;
439 }
440
441 CLSID clsid;
442 if (!GUIDFromStringW(&lpszDisplayName[2], &clsid))
443 return CO_E_CLASSSTRING;
444
445 if (pchNextOfComma)
446 {
447 FIXME("Delegate folder\n");
448 return E_FAIL;
449 }
450
451 CComHeapPtr<ITEMIDLIST> pidlTemp(_ILCreateGuid(PT_GUID, clsid));
452 if (!pidlTemp)
453 return E_OUTOFMEMORY;
454
455 if (!_IsInNameSpace(pidlTemp) && !(BindCtx_GetMode(pbc, 0) & STGM_CREATE))
456 return E_INVALIDARG;
457
458 *ppidl = pidlTemp.Detach();
459
460 if (!*pch)
461 {
462 if (pdwAttributes && *pdwAttributes)
463 GetGuidItemAttributes(*ppidl, pdwAttributes);
464
465 return S_OK;
466 }
467
468 HRESULT hr = SHELL32_ParseNextElement(this, hwndOwner, pbc, ppidl, pch + 1, pchEaten,
469 pdwAttributes);
470 if (FAILED(hr))
471 {
472 ILFree(*ppidl);
473 *ppidl = NULL;
474 }
475 return hr;
476}
BOOL _IsInNameSpace(_In_ LPCITEMIDLIST pidl)
Definition: CRegFolder.cpp:406
DWORD BindCtx_GetMode(_In_ IBindCtx *pbc, _In_ DWORD dwDefault)
Definition: utils.cpp:114
#define PT_GUID
#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:938
LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, REFIID guid)
Definition: pidl.c:1731
HRESULT SHELL32_ParseNextElement(IShellFolder2 *psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST *pidlInOut, LPOLESTR szNext, DWORD *pEaten, DWORD *pdwAttributes)
Definition: shlfolder.cpp:79
#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 754 of file CRegFolder.cpp.

756{
757 GUID const *clsid = _ILGetGUIDPointer (pidl);
758 LPOLESTR pStr;
759 HRESULT hr;
760 WCHAR szName[100];
761
762 if (!clsid)
763 {
764 ERR("Pidl is not reg item!\n");
765 return E_FAIL;
766 }
767
768 hr = StringFromCLSID(*clsid, &pStr);
770 return hr;
771
772 swprintf(szName, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%s", pStr);
773
774 DWORD cbData = (wcslen(lpName) + 1) * sizeof(WCHAR);
776
777 CoTaskMemFree(pStr);
778
779 if (res == ERROR_SUCCESS)
780 {
781 *pPidlOut = ILClone(pidl);
782 return 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
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_enumKeyName

CAtlStringW CRegFolder::m_enumKeyName
private

Definition at line 312 of file CRegFolder.cpp.

Referenced by EnumObjects(), and Initialize().

◆ m_guid

GUID CRegFolder::m_guid
private

Definition at line 310 of file CRegFolder.cpp.

Referenced by GetDisplayNameOf(), and Initialize().

◆ m_pidlRoot

CComHeapPtr<ITEMIDLIST> CRegFolder::m_pidlRoot
private

◆ m_rootPath

CAtlStringW CRegFolder::m_rootPath
private

Definition at line 311 of file CRegFolder.cpp.

Referenced by GetDisplayNameOf(), and Initialize().


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