ReactOS  0.4.15-dev-4857-g47842d7
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)
 
virtual HRESULT WINAPI ParseDisplayName (HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes)
 
virtual HRESULT WINAPI EnumObjects (HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
 
virtual HRESULT WINAPI BindToObject (PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
 
virtual HRESULT WINAPI BindToStorage (PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
 
virtual HRESULT WINAPI CompareIDs (LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
 
virtual HRESULT WINAPI CreateViewObject (HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
 
virtual HRESULT WINAPI GetAttributesOf (UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut)
 
virtual HRESULT WINAPI GetUIObjectOf (HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut)
 
virtual HRESULT WINAPI GetDisplayNameOf (PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
 
virtual HRESULT WINAPI SetNameOf (HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
 
virtual HRESULT WINAPI GetDefaultSearchGUID (GUID *pguid)
 
virtual HRESULT WINAPI EnumSearches (IEnumExtraSearch **ppenum)
 
virtual HRESULT WINAPI GetDefaultColumn (DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
 
virtual HRESULT WINAPI GetDefaultColumnState (UINT iColumn, DWORD *pcsFlags)
 
virtual HRESULT WINAPI GetDetailsEx (PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv)
 
virtual HRESULT WINAPI GetDetailsOf (PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd)
 
virtual HRESULT WINAPI MapColumnToSCID (UINT column, SHCOLUMNID *pscid)
 
- 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 ()
 
- Public Member Functions inherited from IShellFolder
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 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)
 
- 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)
 

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
 
- 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 IShellFolder
SFGAO_PKEYSFGAOMASK typedef ULONG SFGAOF
 

Detailed Description

Definition at line 271 of file CRegFolder.cpp.

Constructor & Destructor Documentation

◆ CRegFolder()

CRegFolder::CRegFolder ( )

Definition at line 318 of file CRegFolder.cpp.

319 {
320 }

◆ ~CRegFolder()

CRegFolder::~CRegFolder ( )

Definition at line 322 of file CRegFolder.cpp.

323 {
324 }

Member Function Documentation

◆ BindToObject()

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

Definition at line 417 of file CRegFolder.cpp.

418 {
419  CComPtr<IPersistFolder> pFolder;
420  HRESULT hr;
421 
422  if (!ppvOut || !pidl || !pidl->mkid.cb)
423  return E_INVALIDARG;
424 
425  *ppvOut = NULL;
426 
427  GUID *pGUID = _ILGetGUIDPointer(pidl);
428  if (!pGUID)
429  {
430  ERR("CRegFolder::BindToObject called for non guid item!\n");
431  return E_INVALIDARG;
432  }
433 
434  hr = SHELL32_BindToSF(m_pidlRoot, NULL, pidl, pGUID, riid, ppvOut);
435  if (FAILED_UNEXPECTEDLY(hr))
436  return hr;
437 
438  return S_OK;
439 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
HRESULT SHELL32_BindToSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidl, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: shlfolder.cpp:177
#define E_INVALIDARG
Definition: ddrawi.h:101
LONG HRESULT
Definition: typedefs.h:79
IID * _ILGetGUIDPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2325
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
CComHeapPtr< ITEMIDLIST > m_pidlRoot
Definition: CRegFolder.cpp:279
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112

◆ BindToStorage()

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

Definition at line 441 of file CRegFolder.cpp.

442 {
443  return E_NOTIMPL;
444 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CompareIDs()

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

Implements IShellFolder.

Definition at line 446 of file CRegFolder.cpp.

447 {
448  if (!pidl1 || !pidl2 || pidl1->mkid.cb == 0 || pidl2->mkid.cb == 0)
449  {
450  ERR("Got an empty pidl!\n");
451  return E_INVALIDARG;
452  }
453 
454  GUID const *clsid1 = _ILGetGUIDPointer (pidl1);
455  GUID const *clsid2 = _ILGetGUIDPointer (pidl2);
456 
457  if (!clsid1 && !clsid2)
458  {
459  ERR("Got no guid pidl!\n");
460  return E_INVALIDARG;
461  }
462  else if (clsid1 && clsid2)
463  {
464  if (memcmp(clsid1, clsid2, sizeof(GUID)) == 0)
465  return SHELL32_CompareChildren(this, lParam, pidl1, pidl2);
466 
467  return SHELL32_CompareDetails(this, lParam, pidl1, pidl2);
468  }
469 
470  /* Guid folders come first compared to everything else */
471  /* And Drives come before folders in My Computer */
473  {
474  return MAKE_COMPARE_HRESULT(clsid1 ? 1 : -1);
475  }
476  else
477  {
478  return MAKE_COMPARE_HRESULT(clsid1 ? -1 : 1);
479  }
480 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
Definition: pidl.c:1931
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:546
HRESULT SHELL32_CompareChildren(IShellFolder2 *psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:233
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT SHELL32_CompareDetails(IShellFolder2 *isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:256
IID * _ILGetGUIDPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2325
CComHeapPtr< ITEMIDLIST > m_pidlRoot
Definition: CRegFolder.cpp:279
#define ERR(fmt,...)
Definition: debug.h:110
LPARAM lParam
Definition: combotst.c:139

◆ CreateViewObject()

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

Definition at line 482 of file CRegFolder.cpp.

483 {
484  return E_NOTIMPL;
485 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ EnumObjects()

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

Definition at line 412 of file CRegFolder.cpp.

413 {
414  return ShellObjectCreatorInit<CRegFolderEnum>(m_enumKeyName, dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
415 }
#define IID_PPV_ARG(Itype, ppType)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
CAtlStringW m_enumKeyName
Definition: CRegFolder.cpp:278

◆ EnumSearches()

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

Implements IShellFolder2.

Definition at line 704 of file CRegFolder.cpp.

705 {
706  return E_NOTIMPL;
707 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetAttributesOf()

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

Definition at line 487 of file CRegFolder.cpp.

488 {
489  if (!rgfInOut || !cidl || !apidl)
490  return E_INVALIDARG;
491 
492  if (*rgfInOut == 0)
493  *rgfInOut = ~0;
494 
495  while(cidl > 0 && *apidl)
496  {
497  if (_ILIsSpecialFolder(*apidl))
498  GetGuidItemAttributes(*apidl, rgfInOut);
499  else
500  ERR("Got an unkown pidl here!\n");
501  apidl++;
502  cidl--;
503  }
504 
505  /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
506  *rgfInOut &= ~SFGAO_VALIDATE;
507 
508  return S_OK;
509 }
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
HRESULT GetGuidItemAttributes(LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
Definition: CRegFolder.cpp:345
#define E_INVALIDARG
Definition: ddrawi.h:101
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52

◆ GetDefaultColumn()

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

Implements IShellFolder2.

Definition at line 709 of file CRegFolder.cpp.

710 {
711  if (pSort)
712  *pSort = 0;
713  if (pDisplay)
714  *pDisplay = 0;
715 
716  return S_OK;
717 }
#define S_OK
Definition: intsafe.h:52

◆ GetDefaultColumnState()

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

Implements IShellFolder2.

Definition at line 719 of file CRegFolder.cpp.

720 {
721  if (iColumn >= 2)
722  return E_INVALIDARG;
724  return S_OK;
725 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define S_OK
Definition: intsafe.h:52

◆ GetDefaultSearchGUID()

HRESULT WINAPI CRegFolder::GetDefaultSearchGUID ( GUID pguid)
virtual

Implements IShellFolder2.

Definition at line 699 of file CRegFolder.cpp.

700 {
701  return E_NOTIMPL;
702 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetDetailsEx()

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

Implements IShellFolder2.

Definition at line 727 of file CRegFolder.cpp.

728 {
729  return E_NOTIMPL;
730 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetDetailsOf()

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

Implements IShellFolder2.

Definition at line 732 of file CRegFolder.cpp.

733 {
734  if (!psd)
735  return E_INVALIDARG;
736 
737  GUID const *clsid = _ILGetGUIDPointer (pidl);
738 
739  if (!clsid)
740  {
741  ERR("Pidl is not reg item!\n");
742  return E_INVALIDARG;
743  }
744 
745  switch(iColumn)
746  {
747  case 0: /* name */
748  return GetDisplayNameOf(pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
749  case 1: /* type */
750  return SHSetStrRet(&psd->str, IDS_SYSTEMFOLDER);
751  case 4: /* comments */
752  HKEY hKey;
754  return SHSetStrRet(&psd->str, "");
755 
756  psd->str.cStr[0] = 0x00;
757  psd->str.uType = STRRET_CSTR;
758  RegLoadMUIStringA(hKey, "InfoTip", psd->str.cStr, MAX_PATH, NULL, 0, NULL);
759  RegCloseKey(hKey);
760  return S_OK;
761  default:
762  /* Return an empty string when we area asked for a column we don't support.
763  Only the regfolder is supposed to do this as it supports less columns compared to other folder
764  and its contents are supposed to be presented alongside items that support more columns. */
765  return SHSetStrRet(&psd->str, "");
766  }
767  return E_FAIL;
768 }
#define E_FAIL
Definition: ddrawi.h:102
STRRET str
Definition: shtypes.idl:108
char cStr[MAX_PATH]
Definition: shtypes.idl:98
#define E_INVALIDARG
Definition: ddrawi.h:101
IID * _ILGetGUIDPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2325
#define MAX_PATH
Definition: compat.h:34
virtual HRESULT WINAPI GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: CRegFolder.cpp:550
REFCLSID clsid
Definition: msctf.c:82
#define ERR(fmt,...)
Definition: debug.h:110
BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey)
Definition: classes.c:227
#define S_OK
Definition: intsafe.h:52
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
UINT uType
Definition: shtypes.idl:93
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)
#define RegCloseKey(hKey)
Definition: registry.h:47
#define IDS_SYSTEMFOLDER
Definition: shresdef.h:323

◆ GetDisplayNameOf()

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

Definition at line 550 of file CRegFolder.cpp.

551 {
552  if (!strRet || (!_ILIsSpecialFolder(pidl) && pidl != NULL))
553  return E_INVALIDARG;
554 
555  if (!pidl || !pidl->mkid.cb)
556  {
558  {
559  LPWSTR pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
560  if (!pszPath)
561  return E_OUTOFMEMORY;
562 
563  /* parsing name like ::{...} */
564  pszPath[0] = ':';
565  pszPath[1] = ':';
566  SHELL32_GUIDToStringW(m_guid, &pszPath[2]);
567 
568  strRet->uType = STRRET_WSTR;
569  strRet->pOleStr = pszPath;
570 
571  return S_OK;
572  }
573  else
574  {
575  BOOL bRet;
576  WCHAR wstrName[MAX_PATH+1];
577  bRet = HCR_GetClassNameW(m_guid, wstrName, MAX_PATH);
578  if (!bRet)
579  return E_FAIL;
580 
581  return SHSetStrRet(strRet, wstrName);
582 
583  }
584  }
585 
586  HRESULT hr;
587  GUID const *clsid = _ILGetGUIDPointer (pidl);
588 
589  /* First of all check if we need to query the name from the child item */
592  {
593  int bWantsForParsing = FALSE;
594 
595  /*
596  * We can only get a filesystem path from a shellfolder if the
597  * value WantsFORPARSING in CLSID\\{...}\\shellfolder exists.
598  *
599  * Exception: The MyComputer folder doesn't have this key,
600  * but any other filesystem backed folder it needs it.
601  */
602  if (IsEqualIID (*clsid, CLSID_MyComputer))
603  {
604  bWantsForParsing = TRUE;
605  }
606  else
607  {
608  HKEY hkeyClass;
609  if (HCR_RegOpenClassIDKey(*clsid, &hkeyClass))
610  {
611  LONG res = SHGetValueW(hkeyClass, L"Shellfolder", L"WantsForParsing", NULL, NULL, NULL);
612  bWantsForParsing = (res == ERROR_SUCCESS);
613  RegCloseKey(hkeyClass);
614  }
615  }
616 
617  if (bWantsForParsing)
618  {
619  /*
620  * we need the filesystem path to the destination folder.
621  * Only the folder itself can know it
622  */
623  return SHELL32_GetDisplayNameOfChild (this, pidl, dwFlags, strRet);
624  }
625  }
626 
627  /* Allocate the buffer for the result */
628  LPWSTR pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
629  if (!pszPath)
630  return E_OUTOFMEMORY;
631 
632  hr = S_OK;
633 
635  {
636  wcscpy(pszPath, m_rootPath);
637  PWCHAR pItemName = &pszPath[wcslen(pszPath)];
638 
639  /* parsing name like ::{...} */
640  pItemName[0] = ':';
641  pItemName[1] = ':';
642  SHELL32_GUIDToStringW (*clsid, &pItemName[2]);
643  }
644  else
645  {
646  /* user friendly name */
647  if (!HCR_GetClassNameW (*clsid, pszPath, MAX_PATH))
648  hr = E_FAIL;
649  }
650 
651  if (SUCCEEDED(hr))
652  {
653  strRet->uType = STRRET_WSTR;
654  strRet->pOleStr = pszPath;
655  }
656  else
657  {
658  CoTaskMemFree(pszPath);
659  }
660 
661  return hr;
662 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define GET_SHGDN_RELATION(dwFlags)
Definition: precomp.h:53
#define TRUE
Definition: types.h:120
LPWSTR pOleStr
Definition: shtypes.idl:96
uint16_t * PWCHAR
Definition: typedefs.h:56
#define E_FAIL
Definition: ddrawi.h:102
#define L(x)
Definition: ntvdm.h:50
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FALSE
Definition: types.h:117
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define GET_SHGDN_FOR(dwFlags)
Definition: precomp.h:52
if SUCCEEDED(hr)
CAtlStringW m_rootPath
Definition: CRegFolder.cpp:277
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT SHELL32_GetDisplayNameOfChild(IShellFolder2 *psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: shlfolder.cpp:215
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
IID * _ILGetGUIDPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2325
#define MAX_PATH
Definition: compat.h:34
static __inline int SHELL32_GUIDToStringW(REFGUID guid, LPWSTR str)
Definition: shfldr.h:81
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
REFCLSID clsid
Definition: msctf.c:82
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey)
Definition: classes.c:227
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
GLuint res
Definition: glext.h:9613
WCHAR * LPWSTR
Definition: xmlstorage.h:184
UINT uType
Definition: shtypes.idl:93
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define RegCloseKey(hKey)
Definition: registry.h:47
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len)
Definition: classes.c:342

Referenced by GetDetailsOf().

◆ GetGuidItemAttributes()

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

Definition at line 345 of file CRegFolder.cpp.

346 {
347  DWORD dwAttributes = *pdwAttributes;
348 
349  /* First try to get them from the registry */
350  if (!HCR_GetFolderAttributes(pidl, pdwAttributes))
351  {
352  /* We couldn't get anything */
353  *pdwAttributes = 0;
354  }
355 
356  /* Items have more attributes when on desktop */
358  {
359  *pdwAttributes |= (dwAttributes & (SFGAO_CANLINK|SFGAO_CANDELETE|SFGAO_CANRENAME|SFGAO_HASPROPSHEET));
360  }
361 
362  /* In any case, links can be created */
363  if (*pdwAttributes == NULL)
364  {
365  *pdwAttributes |= (dwAttributes & SFGAO_CANLINK);
366  }
367  return S_OK;
368 }
DWORD dwAttributes
Definition: vdmdbg.h:34
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
unsigned long DWORD
Definition: ntddk_ex.h:95
CComHeapPtr< ITEMIDLIST > m_pidlRoot
Definition: CRegFolder.cpp:279
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD pdwAttributes)
Definition: classes.c:510

Referenced by GetAttributesOf(), and ParseDisplayName().

◆ GetUIObjectOf()

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

Definition at line 511 of file CRegFolder.cpp.

513 {
514  LPVOID pObj = NULL;
516 
517  if (!ppvOut)
518  return hr;
519 
520  *ppvOut = NULL;
521 
522  if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
523  {
524  hr = CGuidItemExtractIcon_CreateInstance(apidl[0], riid, &pObj);
525  }
526  else if (IsEqualIID (riid, IID_IContextMenu) && (cidl >= 1))
527  {
528  if (!_ILGetGUIDPointer (apidl[0]))
529  {
530  ERR("Got non guid item!\n");
531  return E_FAIL;
532  }
533 
534  hr = CGuidItemContextMenu_CreateInstance(m_pidlRoot, hwndOwner, cidl, apidl, static_cast<IShellFolder*>(this), (IContextMenu**)&pObj);
535  }
536  else if (IsEqualIID (riid, IID_IDataObject) && (cidl >= 1))
537  {
538  hr = IDataObject_Constructor (hwndOwner, m_pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
539  }
540  else
541  {
542  hr = E_NOINTERFACE;
543  }
544 
545  *ppvOut = pObj;
546  return hr;
547 
548 }
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
REFIID riid
Definition: precomp.h:44
const GUID IID_IDataObject
#define E_FAIL
Definition: ddrawi.h:102
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT IDataObject_Constructor(HWND hwndOwner, PCIDLIST_ABSOLUTE pMyPidl, PCUIDLIST_RELATIVE_ARRAY apidl, UINT cidl, BOOL bExtendedObject, IDataObject **dataObject)
LONG HRESULT
Definition: typedefs.h:79
IID * _ILGetGUIDPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2325
HRESULT CGuidItemContextMenu_CreateInstance(PCIDLIST_ABSOLUTE pidlFolder, HWND hwnd, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IShellFolder *psf, IContextMenu **ppcm)
Definition: CRegFolder.cpp:92
CComHeapPtr< ITEMIDLIST > m_pidlRoot
Definition: CRegFolder.cpp:279
HRESULT CGuidItemExtractIcon_CreateInstance(LPCITEMIDLIST pidl, REFIID iid, LPVOID *ppvOut)
Definition: CRegFolder.cpp:121
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ Initialize()

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

Definition at line 326 of file CRegFolder.cpp.

327 {
328  memcpy(&m_guid, pGuid, sizeof(m_guid));
329 
330  m_rootPath = lpszPath;
331  if (!m_rootPath)
332  return E_OUTOFMEMORY;
333 
334  m_enumKeyName = lpszEnumKeyName;
335  if (!m_enumKeyName)
336  return E_OUTOFMEMORY;
337 
338  m_pidlRoot.Attach(ILClone(pidlRoot));
339  if (!m_pidlRoot)
340  return E_OUTOFMEMORY;
341 
342  return S_OK;
343 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
CAtlStringW m_rootPath
Definition: CRegFolder.cpp:277
CComHeapPtr< ITEMIDLIST > m_pidlRoot
Definition: CRegFolder.cpp:279
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
CAtlStringW m_enumKeyName
Definition: CRegFolder.cpp:278

◆ MapColumnToSCID()

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

Implements IShellFolder2.

Definition at line 770 of file CRegFolder.cpp.

771 {
772  return E_NOTIMPL;
773 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ParseDisplayName()

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

Implements IShellFolder.

Definition at line 370 of file CRegFolder.cpp.

372 {
373  LPITEMIDLIST pidl;
374 
375  if (!lpszDisplayName || !ppidl)
376  return E_INVALIDARG;
377 
378  *ppidl = 0;
379 
380  if (pchEaten)
381  *pchEaten = 0;
382 
383  UINT cch = wcslen(lpszDisplayName);
384  if (cch < 39 || lpszDisplayName[0] != L':' || lpszDisplayName[1] != L':')
385  return E_FAIL;
386 
387  pidl = _ILCreateGuidFromStrW(lpszDisplayName + 2);
388  if (pidl == NULL)
389  return E_FAIL;
390 
391  if (cch < 41)
392  {
393  *ppidl = pidl;
394  if (pdwAttributes && *pdwAttributes)
395  {
396  GetGuidItemAttributes(*ppidl, pdwAttributes);
397  }
398  }
399  else
400  {
401  HRESULT hr = SHELL32_ParseNextElement(this, hwndOwner, pbc, &pidl, lpszDisplayName + 41, pchEaten, pdwAttributes);
402  if (SUCCEEDED(hr))
403  {
404  *ppidl = pidl;
405  }
406  return hr;
407  }
408 
409  return S_OK;
410 }
HRESULT hr
Definition: shlfolder.c:183
#define E_FAIL
Definition: ddrawi.h:102
#define L(x)
Definition: ntvdm.h:50
HRESULT GetGuidItemAttributes(LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
Definition: CRegFolder.cpp:345
if SUCCEEDED(hr)
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT SHELL32_ParseNextElement(IShellFolder2 *psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST *pidlInOut, LPOLESTR szNext, DWORD *pEaten, DWORD *pdwAttributes)
Definition: shlfolder.cpp:88
LPITEMIDLIST _ILCreateGuidFromStrW(LPCWSTR szGUID)
Definition: pidl.c:1725
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:52
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
IN PCTCH IN DWORD cch
Definition: pager.h:36
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

◆ SetNameOf()

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

Implements IShellFolder.

Definition at line 664 of file CRegFolder.cpp.

666 {
667  GUID const *clsid = _ILGetGUIDPointer (pidl);
668  LPOLESTR pStr;
669  HRESULT hr;
670  WCHAR szName[100];
671 
672  if (!clsid)
673  {
674  ERR("Pidl is not reg item!\n");
675  return E_FAIL;
676  }
677 
678  hr = StringFromCLSID(*clsid, &pStr);
679  if (FAILED_UNEXPECTEDLY(hr))
680  return hr;
681 
682  swprintf(szName, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%s", pStr);
683 
684  DWORD cbData = (wcslen(lpName) + 1) * sizeof(WCHAR);
686 
687  CoTaskMemFree(pStr);
688 
689  if (res == ERROR_SUCCESS)
690  {
691  *pPidlOut = ILClone(pidl);
692  return S_OK;
693  }
694 
695  return E_FAIL;
696 }
static const WCHAR szName[]
Definition: powrprof.c:45
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1306
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define HKEY_CURRENT_USER
Definition: winreg.h:11
_In_ LPCSTR lpName
Definition: winbase.h:2773
#define RRF_RT_REG_SZ
Definition: driver.c:575
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
IID * _ILGetGUIDPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2325
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
unsigned long DWORD
Definition: ntddk_ex.h:95
REFCLSID clsid
Definition: msctf.c:82
int _cdecl swprintf(const WCHAR *,...)
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
GLuint res
Definition: glext.h:9613
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412

Member Data Documentation

◆ m_enumKeyName

CAtlStringW CRegFolder::m_enumKeyName
private

Definition at line 278 of file CRegFolder.cpp.

Referenced by EnumObjects(), and Initialize().

◆ m_guid

GUID CRegFolder::m_guid
private

Definition at line 276 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 277 of file CRegFolder.cpp.

Referenced by GetDisplayNameOf(), and Initialize().


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