ReactOS  0.4.14-dev-838-g99f979d
CDrivesFolder Class Reference

#include <CDrivesFolder.h>

Inheritance diagram for CDrivesFolder:
Collaboration diagram for CDrivesFolder:

Public Member Functions

 CDrivesFolder ()
 
 ~CDrivesFolder ()
 
HRESULT WINAPI FinalConstruct ()
 
virtual HRESULT WINAPI ParseDisplayName (HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *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)
 
virtual HRESULT WINAPI GetClassID (CLSID *lpClassId)
 
virtual HRESULT WINAPI Initialize (PCIDLIST_ABSOLUTE pidl)
 
virtual HRESULT WINAPI GetCurFolder (PIDLIST_ABSOLUTE *pidl)
 
virtual HRESULT WINAPI CallBack (IShellFolder *psf, HWND hwndOwner, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
- 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 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 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 Attributes

LPITEMIDLIST pidlRoot
 
CComPtr< IShellFolder2m_regFolder
 

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
 
- Public Types inherited from IPersistFolder2
typedef IPersistFolder2LPPERSISTFOLDER2
 
- Public Types inherited from IPersistFolder
typedef IPersistFolderLPPERSISTFOLDER
 
- Public Types inherited from IPersist
typedef IPersistLPPERSIST
 
- 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_STORAGEANCESTOR typedef ULONG SFGAOF
 

Detailed Description

Definition at line 26 of file CDrivesFolder.h.

Constructor & Destructor Documentation

◆ CDrivesFolder()

CDrivesFolder::CDrivesFolder ( )

Definition at line 541 of file CDrivesFolder.cpp.

542 {
543  pidlRoot = NULL;
544 }
smooth NULL
Definition: ftsmooth.c:416
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:35

◆ ~CDrivesFolder()

CDrivesFolder::~CDrivesFolder ( )

Definition at line 546 of file CDrivesFolder.cpp.

547 {
548  TRACE ("-- destroying IShellFolder(%p)\n", this);
549  SHFree(pidlRoot);
550 }
#define TRACE(s)
Definition: solgame.cpp:4
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:35

Member Function Documentation

◆ BindToObject()

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

Definition at line 641 of file CDrivesFolder.cpp.

642 {
643  TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", this,
644  pidl, pbcReserved, shdebugstr_guid(&riid), ppvOut);
645 
646  if (!pidl)
647  return E_INVALIDARG;
648 
649  if (_ILIsSpecialFolder(pidl))
650  return m_regFolder->BindToObject(pidl, pbcReserved, riid, ppvOut);
651 
652  CHAR* pchDrive = _ILGetDataPointer(pidl)->u.drive.szDriveName;
653 
654  PERSIST_FOLDER_TARGET_INFO pfti = {0};
655  pfti.dwAttributes = -1;
656  pfti.csidl = -1;
657  pfti.szTargetParsingName[0] = *pchDrive;
658  pfti.szTargetParsingName[1] = L':';
659  pfti.szTargetParsingName[2] = L'\\';
660 
662  &pfti,
663  pidl,
664  &CLSID_ShellFSFolder,
665  riid,
666  ppvOut);
667  if (FAILED_UNEXPECTEDLY(hr))
668  return hr;
669 
670  return S_OK;
671 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2162
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
char CHAR
Definition: xmlstorage.h:175
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
HRESULT SHELL32_BindToSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidl, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: shlfolder.cpp:159
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:59
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:35

Referenced by GetUIObjectOf().

◆ BindToStorage()

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

Definition at line 676 of file CDrivesFolder.cpp.

677 {
678  FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this,
679  pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
680 
681  *ppvOut = NULL;
682  return E_NOTIMPL;
683 }
REFIID riid
Definition: precomp.h:44
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CallBack()

HRESULT WINAPI CDrivesFolder::CallBack ( IShellFolder psf,
HWND  hwndOwner,
IDataObject pdtobj,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
virtual

Implements IContextMenuCB.

Definition at line 1189 of file CDrivesFolder.cpp.

1190 {
1191  if (uMsg != DFM_MERGECONTEXTMENU && uMsg != DFM_INVOKECOMMAND)
1192  return S_OK;
1193 
1194  /* no data object means no selection */
1195  if (!pdtobj)
1196  {
1197  if (uMsg == DFM_INVOKECOMMAND && wParam == 1) // #1
1198  {
1199  // "System" properties
1200  ShellExecuteW(hwndOwner,
1201  NULL,
1202  L"rundll32.exe",
1203  L"shell32.dll,Control_RunDLL sysdm.cpl",
1204  NULL,
1205  SW_SHOWNORMAL);
1206  }
1207  else if (uMsg == DFM_MERGECONTEXTMENU)
1208  {
1209  QCMINFO *pqcminfo = (QCMINFO *)lParam;
1210  HMENU hpopup = CreatePopupMenu();
1211  _InsertMenuItemW(hpopup, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED); // #0
1213  Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu++, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
1214  DestroyMenu(hpopup);
1215  }
1216 
1217  return S_OK;
1218  }
1219 
1220  if (uMsg != DFM_INVOKECOMMAND || wParam != DFM_CMD_PROPERTIES)
1221  return S_OK;
1222 
1223  return Shell_DefaultContextMenuCallBack(this, pdtobj);
1224 }
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
UINT idCmdLast
Definition: shlobj.h:1317
#define MFT_STRING
Definition: winuser.h:741
#define TRUE
Definition: types.h:120
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:857
HRESULT WINAPI Shell_DefaultContextMenuCallBack(IShellFolder *psf, IDataObject *pdtobj)
Definition: shlfolder.cpp:450
HMENU hmenu
Definition: shlobj.h:1314
#define IDS_PROPERTIES
Definition: resource.h:101
WPARAM wParam
Definition: combotst.c:138
#define MFS_ENABLED
Definition: winuser.h:745
#define DFM_INVOKECOMMAND
Definition: precomp.h:45
smooth NULL
Definition: ftsmooth.c:416
UINT indexMenu
Definition: shlobj.h:1315
#define MM_ADDSEPARATOR
Definition: shlobj.h:2327
UINT idCmdFirst
Definition: shlobj.h:1316
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:44
#define DFM_CMD_PROPERTIES
Definition: shlobj.h:2411
#define MFT_SEPARATOR
Definition: winuser.h:739
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define S_OK
Definition: intsafe.h:59
#define SW_SHOWNORMAL
Definition: winuser.h:764
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:846
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2250
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139

◆ CompareIDs()

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

Implements IShellFolder.

Definition at line 689 of file CDrivesFolder.cpp.

690 {
691  HRESULT hres;
692 
693  if (!pidl1 || !pidl2)
694  {
695  ERR("Got null pidl pointer (%Ix %p %p)!\n", lParam, pidl1, pidl2);
696  return E_INVALIDARG;
697  }
698 
699  if (_ILIsSpecialFolder(pidl1) || _ILIsSpecialFolder(pidl2))
700  return m_regFolder->CompareIDs(lParam, pidl1, pidl2);
701 
702  if (!_ILIsDrive(pidl1) || !_ILIsDrive(pidl2) || LOWORD(lParam) >= MYCOMPUTERSHELLVIEWCOLUMNS)
703  return E_INVALIDARG;
704 
705  CHAR* pszDrive1 = _ILGetDataPointer(pidl1)->u.drive.szDriveName;
706  CHAR* pszDrive2 = _ILGetDataPointer(pidl2)->u.drive.szDriveName;
707 
708  int result;
709  switch(LOWORD(lParam))
710  {
711  case 0: /* name */
712  {
713  result = stricmp(pszDrive1, pszDrive2);
715  break;
716  }
717  case 1: /* comments */
719  break;
720  case 2: /* Type */
721  {
722  /* We want to return immediately because SHELL32_CompareDetails also compares children. */
723  return SHELL32_CompareDetails(this, lParam, pidl1, pidl2);
724  }
725  case 3: /* Size */
726  case 4: /* Size Available */
727  {
728  ULARGE_INTEGER Drive1Available, Drive1Total, Drive2Available, Drive2Total;
729 
730  if (GetVolumeInformationA(pszDrive1, NULL, 0, NULL, NULL, NULL, NULL, 0))
731  GetDiskFreeSpaceExA(pszDrive1, &Drive1Available, &Drive1Total, NULL);
732  else
733  Drive1Available.QuadPart = Drive1Total.QuadPart = 0;
734 
735  if (GetVolumeInformationA(pszDrive2, NULL, 0, NULL, NULL, NULL, NULL, 0))
736  GetDiskFreeSpaceExA(pszDrive2, &Drive2Available, &Drive2Total, NULL);
737  else
738  Drive2Available.QuadPart = Drive2Total.QuadPart = 0;
739 
740  LARGE_INTEGER Diff;
741  if (lParam == 3) /* Size */
742  Diff.QuadPart = Drive1Total.QuadPart - Drive2Total.QuadPart;
743  else /* Size available */
744  Diff.QuadPart = Drive1Available.QuadPart - Drive2Available.QuadPart;
745 
747  break;
748  }
749  default:
750  return E_INVALIDARG;
751  }
752 
753  if (HRESULT_CODE(hres) == 0)
754  return SHELL32_CompareChildren(this, lParam, pidl1, pidl2);
755 
756  return hres;
757 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2162
char CHAR
Definition: xmlstorage.h:175
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:535
BOOL WINAPI GetVolumeInformationA(IN LPCSTR lpRootPathName, IN LPSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
Definition: volume.c:32
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
HRESULT SHELL32_CompareChildren(IShellFolder2 *psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:215
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP int __cdecl stricmp(_In_z_ const char *_Str1, _In_z_ const char *_Str2)
HRESULT SHELL32_CompareDetails(IShellFolder2 *isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:238
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1939
#define ERR(fmt,...)
Definition: debug.h:109
#define MYCOMPUTERSHELLVIEWCOLUMNS
#define HRESULT_CODE(hr)
Definition: winerror.h:76
BOOL WINAPI GetDiskFreeSpaceExA(IN LPCSTR lpDirectoryName OPTIONAL, OUT PULARGE_INTEGER lpFreeBytesAvailableToCaller, OUT PULARGE_INTEGER lpTotalNumberOfBytes, OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
Definition: disk.c:313
GLuint64EXT * result
Definition: glext.h:11304
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
LONGLONG QuadPart
Definition: typedefs.h:112

◆ CreateViewObject()

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

Definition at line 762 of file CDrivesFolder.cpp.

763 {
764  CComPtr<IShellView> pShellView;
766 
767  TRACE("(%p)->(hwnd=%p,%s,%p)\n", this,
768  hwndOwner, shdebugstr_guid (&riid), ppvOut);
769 
770  if (!ppvOut)
771  return hr;
772 
773  *ppvOut = NULL;
774 
775  if (IsEqualIID(riid, IID_IDropTarget))
776  {
777  WARN("IDropTarget not implemented\n");
778  hr = E_NOTIMPL;
779  }
780  else if (IsEqualIID(riid, IID_IContextMenu))
781  {
782  HKEY hKeys[16];
783  UINT cKeys = 0;
784  AddClassKeyToArray(L"Directory\\Background", hKeys, &cKeys);
785 
786  DEFCONTEXTMENU dcm;
787  dcm.hwnd = hwndOwner;
788  dcm.pcmcb = this;
789  dcm.pidlFolder = pidlRoot;
790  dcm.psf = this;
791  dcm.cidl = 0;
792  dcm.apidl = NULL;
793  dcm.cKeys = cKeys;
794  dcm.aKeys = hKeys;
796  hr = SHCreateDefaultContextMenu(&dcm, riid, ppvOut);
797  }
798  else if (IsEqualIID(riid, IID_IShellView))
799  {
800  SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
801  hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
802  }
803  TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut);
804  return hr;
805 }
HRESULT hr
Definition: shlfolder.c:183
const HKEY * aKeys
Definition: shlobj.h:2356
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI SHCreateDefaultContextMenu(const DEFCONTEXTMENU *pdcm, REFIID riid, void **ppv)
#define WARN(fmt,...)
Definition: debug.h:111
void AddClassKeyToArray(const WCHAR *szClass, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:267
IContextMenuCB * pcmcb
Definition: shlobj.h:2349
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3472
IShellFolder * psf
Definition: shlobj.h:2351
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
struct _SFV_CREATE SFV_CREATE
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR L[]
Definition: oid.c:1250
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int UINT
Definition: ndis.h:50
IUnknown * punkAssociationInfo
Definition: shlobj.h:2354
PCUITEMID_CHILD_ARRAY apidl
Definition: shlobj.h:2353
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:35
PCIDLIST_ABSOLUTE pidlFolder
Definition: shlobj.h:2350
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ EnumObjects()

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

Definition at line 630 of file CDrivesFolder.cpp.

631 {
632  CComPtr<IEnumIDList> pRegEnumerator;
633  m_regFolder->EnumObjects(hwndOwner, dwFlags, &pRegEnumerator);
634 
635  return ShellObjectCreatorInit<CDrivesFolderEnum>(hwndOwner, dwFlags, pRegEnumerator, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
636 }
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
#define IID_PPV_ARG(Itype, ppType)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ EnumSearches()

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

Implements IShellFolder2.

Definition at line 1051 of file CDrivesFolder.cpp.

1052 {
1053  FIXME ("(%p)\n", this);
1054  return E_NOTIMPL;
1055 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ FinalConstruct()

HRESULT WINAPI CDrivesFolder::FinalConstruct ( )

Definition at line 552 of file CDrivesFolder.cpp.

553 {
554  pidlRoot = _ILCreateMyComputer(); /* my qualified pidl */
555  if (pidlRoot == NULL)
556  return E_OUTOFMEMORY;
557 
558  HRESULT hr = CRegFolder_CreateInstance(&CLSID_MyComputer,
559  pidlRoot,
560  L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
561  L"MyComputer",
563 
564  return hr;
565 }
HRESULT hr
Definition: shlfolder.c:183
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
#define IID_PPV_ARG(Itype, ppType)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
LPITEMIDLIST _ILCreateMyComputer(void)
Definition: pidl.c:1599
HRESULT CRegFolder_CreateInstance(const GUID *pGuid, LPCITEMIDLIST pidlRoot, LPCWSTR lpszPath, LPCWSTR lpszEnumKeyName, REFIID riid, void **ppv)
Definition: CRegFolder.cpp:778
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR L[]
Definition: oid.c:1250
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:35

◆ GetAttributesOf()

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

Definition at line 821 of file CDrivesFolder.cpp.

822 {
823  TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
824  this, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
825 
826  if (cidl && !apidl)
827  return E_INVALIDARG;
828 
829  if (*rgfInOut == 0)
830  *rgfInOut = ~0;
831 
832  /* FIXME: always add SFGAO_CANLINK */
833  if(cidl == 0)
834  *rgfInOut &= dwComputerAttributes;
835  else
836  {
837  for (UINT i = 0; i < cidl; ++i)
838  {
839  if (_ILIsDrive(apidl[i]))
840  *rgfInOut &= dwDriveAttributes;
841  else if (_ILIsControlPanel(apidl[i]))
842  *rgfInOut &= dwControlPanelAttributes;
843  else if (_ILIsSpecialFolder(*apidl))
844  m_regFolder->GetAttributesOf(1, &apidl[i], rgfInOut);
845  else
846  ERR("Got unknown pidl type!\n");
847  }
848  }
849 
850  /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
851  *rgfInOut &= ~SFGAO_VALIDATE;
852 
853  TRACE ("-- result=0x%08x\n", *rgfInOut);
854  return S_OK;
855 }
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
static const DWORD dwComputerAttributes
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 BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
static const DWORD dwControlPanelAttributes
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL _ILIsControlPanel(LPCITEMIDLIST pidl)
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1939
static const DWORD dwDriveAttributes
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
unsigned int UINT
Definition: ndis.h:50

◆ GetClassID()

HRESULT WINAPI CDrivesFolder::GetClassID ( CLSID lpClassId)
virtual

Implements IPersist.

Definition at line 1151 of file CDrivesFolder.cpp.

1152 {
1153  TRACE ("(%p)\n", this);
1154 
1155  if (!lpClassId)
1156  return E_POINTER;
1157 
1158  *lpClassId = CLSID_MyComputer;
1159  return S_OK;
1160 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ GetCurFolder()

HRESULT WINAPI CDrivesFolder::GetCurFolder ( PIDLIST_ABSOLUTE pidl)
virtual

Implements IPersistFolder2.

Definition at line 1175 of file CDrivesFolder.cpp.

1176 {
1177  TRACE("(%p)->(%p)\n", this, pidl);
1178 
1179  if (!pidl)
1180  return E_INVALIDARG; /* xp doesn't have this check and crashes on NULL */
1181 
1182  *pidl = ILClone(pidlRoot);
1183  return S_OK;
1184 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:35

◆ GetDefaultColumn()

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

Implements IShellFolder2.

Definition at line 1057 of file CDrivesFolder.cpp.

1058 {
1059  TRACE ("(%p)\n", this);
1060 
1061  if (pSort)
1062  *pSort = 0;
1063  if (pDisplay)
1064  *pDisplay = 0;
1065  return S_OK;
1066 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ GetDefaultColumnState()

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

Implements IShellFolder2.

Definition at line 1068 of file CDrivesFolder.cpp.

1069 {
1070  TRACE ("(%p)\n", this);
1071 
1072  if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
1073  return E_INVALIDARG;
1074  *pcsFlags = MyComputerSFHeader[iColumn].pcsFlags;
1075  return S_OK;
1076 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
#define MYCOMPUTERSHELLVIEWCOLUMNS
static const shvheader MyComputerSFHeader[]

◆ GetDefaultSearchGUID()

HRESULT WINAPI CDrivesFolder::GetDefaultSearchGUID ( GUID pguid)
virtual

Implements IShellFolder2.

Definition at line 1045 of file CDrivesFolder.cpp.

1046 {
1047  FIXME ("(%p)\n", this);
1048  return E_NOTIMPL;
1049 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetDetailsEx()

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

Implements IShellFolder2.

Definition at line 1078 of file CDrivesFolder.cpp.

1079 {
1080  FIXME ("(%p)\n", this);
1081  return E_NOTIMPL;
1082 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetDetailsOf()

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

Implements IShellFolder2.

Definition at line 1084 of file CDrivesFolder.cpp.

1085 {
1086  HRESULT hr;
1087 
1088  TRACE ("(%p)->(%p %i %p)\n", this, pidl, iColumn, psd);
1089 
1090  if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
1091  return E_INVALIDARG;
1092 
1093  if (!pidl)
1094  {
1095  psd->fmt = MyComputerSFHeader[iColumn].fmt;
1096  psd->cxChar = MyComputerSFHeader[iColumn].cxChar;
1097  return SHSetStrRet(&psd->str, MyComputerSFHeader[iColumn].colnameid);
1098  }
1099  else if (!_ILIsDrive(pidl))
1100  {
1101  return m_regFolder->GetDetailsOf(pidl, iColumn, psd);
1102  }
1103  else
1104  {
1105  ULARGE_INTEGER ulTotalBytes, ulFreeBytes;
1106  CHAR* pszDrive = _ILGetDataPointer(pidl)->u.drive.szDriveName;
1107  UINT DriveType = GetDriveTypeA(pszDrive);
1108  if (DriveType > DRIVE_RAMDISK)
1110 
1111  switch (iColumn)
1112  {
1113  case 0: /* name */
1115  break;
1116  case 1: /* FIXME: comments */
1117  hr = SHSetStrRet(&psd->str, "");
1118  break;
1119  case 2: /* type */
1120  hr = SHSetStrRet(&psd->str, iDriveTypeIds[DriveType]);
1121  break;
1122  case 3: /* total size */
1123  case 4: /* free size */
1124  psd->str.cStr[0] = 0x00;
1125  psd->str.uType = STRRET_CSTR;
1126  if (GetVolumeInformationA(pszDrive, NULL, 0, NULL, NULL, NULL, NULL, 0))
1127  {
1128  GetDiskFreeSpaceExA(pszDrive, &ulFreeBytes, &ulTotalBytes, NULL);
1129  if (iColumn == 3)
1130  StrFormatByteSize64A(ulTotalBytes.QuadPart, psd->str.cStr, MAX_PATH);
1131  else
1132  StrFormatByteSize64A(ulFreeBytes.QuadPart, psd->str.cStr, MAX_PATH);
1133  }
1134  hr = S_OK;
1135  break;
1136  }
1137  }
1138 
1139  return hr;
1140 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2162
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
Definition: disk.c:468
HRESULT hr
Definition: shlfolder.c:183
LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
Definition: string.c:2454
char CHAR
Definition: xmlstorage.h:175
virtual HRESULT WINAPI GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
#define DRIVE_RAMDISK
Definition: winbase.h:252
UINT DriveType
BOOL WINAPI GetVolumeInformationA(IN LPCSTR lpRootPathName, IN LPSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
Definition: volume.c:32
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
STRRET str
Definition: shtypes.idl:108
char cStr[MAX_PATH]
Definition: shtypes.idl:98
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static int iDriveTypeIds[7]
#define MAX_PATH
Definition: compat.h:26
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1939
#define DRIVE_FIXED
Definition: winbase.h:249
#define S_OK
Definition: intsafe.h:59
#define MYCOMPUTERSHELLVIEWCOLUMNS
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI GetDiskFreeSpaceExA(IN LPCSTR lpDirectoryName OPTIONAL, OUT PULARGE_INTEGER lpFreeBytesAvailableToCaller, OUT PULARGE_INTEGER lpTotalNumberOfBytes, OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
Definition: disk.c:313
UINT uType
Definition: shtypes.idl:93
static const shvheader MyComputerSFHeader[]

◆ GetDisplayNameOf()

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

Definition at line 926 of file CDrivesFolder.cpp.

927 {
928  LPWSTR pszPath;
929  HRESULT hr = S_OK;
930 
931  TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl, dwFlags, strRet);
932  pdump (pidl);
933 
934  if (!strRet)
935  return E_INVALIDARG;
936 
937  if (!_ILIsPidlSimple (pidl))
938  {
939  return SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags, strRet);
940  }
941  else if (_ILIsSpecialFolder(pidl))
942  {
943  return m_regFolder->GetDisplayNameOf(pidl, dwFlags, strRet);
944  }
945  else if (!_ILIsDrive(pidl))
946  {
947  ERR("Wrong pidl type\n");
948  return E_INVALIDARG;
949  }
950 
951  pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
952  if (!pszPath)
953  return E_OUTOFMEMORY;
954 
955  pszPath[0] = 0;
956 
957  _ILSimpleGetTextW(pidl, pszPath, MAX_PATH); /* append my own path */
958  /* long view "lw_name (C:)" */
959  if (!(dwFlags & SHGDN_FORPARSING))
960  {
961  WCHAR wszDrive[18] = {0};
962  DWORD dwVolumeSerialNumber, dwMaximumComponentLength, dwFileSystemFlags;
963  static const WCHAR wszOpenBracket[] = {' ', '(', 0};
964  static const WCHAR wszCloseBracket[] = {')', 0};
965 
966  lstrcpynW(wszDrive, pszPath, 4);
967  pszPath[0] = L'\0';
968  GetVolumeInformationW(wszDrive, pszPath,
969  MAX_PATH - 7,
970  &dwVolumeSerialNumber,
971  &dwMaximumComponentLength, &dwFileSystemFlags, NULL, 0);
972  pszPath[MAX_PATH-1] = L'\0';
973  if (!wcslen(pszPath))
974  {
975  UINT DriveType, ResourceId;
976  DriveType = GetDriveTypeW(wszDrive);
977  switch(DriveType)
978  {
979  case DRIVE_FIXED:
980  ResourceId = IDS_DRIVE_FIXED;
981  break;
982  case DRIVE_REMOTE:
983  ResourceId = IDS_DRIVE_NETWORK;
984  break;
985  case DRIVE_CDROM:
986  ResourceId = IDS_DRIVE_CDROM;
987  break;
988  default:
989  ResourceId = 0;
990  }
991  if (ResourceId)
992  {
993  dwFileSystemFlags = LoadStringW(shell32_hInstance, ResourceId, pszPath, MAX_PATH);
994  if (dwFileSystemFlags > MAX_PATH - 7)
995  pszPath[MAX_PATH-7] = L'\0';
996  }
997  }
998  wcscat (pszPath, wszOpenBracket);
999  wszDrive[2] = L'\0';
1000  wcscat (pszPath, wszDrive);
1001  wcscat (pszPath, wszCloseBracket);
1002  }
1003 
1004  if (SUCCEEDED(hr))
1005  {
1006  strRet->uType = STRRET_WSTR;
1007  strRet->pOleStr = pszPath;
1008  }
1009  else
1010  CoTaskMemFree(pszPath);
1011 
1012  TRACE("-- (%p)->(%s)\n", this, strRet->uType == STRRET_CSTR ? strRet->cStr : debugstr_w(strRet->pOleStr));
1013  return hr;
1014 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT hr
Definition: shlfolder.c:183
LPWSTR pOleStr
Definition: shtypes.idl:96
UINT DriveType
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
#define IDS_DRIVE_CDROM
Definition: shresdef.h:106
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define lstrcpynW
Definition: compat.h:405
char cStr[MAX_PATH]
Definition: shtypes.idl:98
#define DRIVE_REMOTE
Definition: winbase.h:250
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
HRESULT SHELL32_GetDisplayNameOfChild(IShellFolder2 *psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: shlfolder.cpp:197
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2082
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
#define TRACE(s)
Definition: solgame.cpp:4
#define IDS_DRIVE_FIXED
Definition: shresdef.h:105
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1939
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
#define DRIVE_FIXED
Definition: winbase.h:249
#define IDS_DRIVE_NETWORK
Definition: shresdef.h:107
#define ERR(fmt,...)
Definition: debug.h:109
BOOL WINAPI GetVolumeInformationW(IN LPCWSTR lpRootPathName, IN LPWSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPWSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
Definition: volume.c:226
#define S_OK
Definition: intsafe.h:59
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:248
#define DRIVE_CDROM
Definition: winbase.h:251
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
unsigned int UINT
Definition: ndis.h:50
WCHAR * LPWSTR
Definition: xmlstorage.h:184
UINT uType
Definition: shtypes.idl:93
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by GetDetailsOf().

◆ GetUIObjectOf()

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

Definition at line 869 of file CDrivesFolder.cpp.

872 {
873  LPVOID pObj = NULL;
875 
876  TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", this,
877  hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
878 
879  if (!ppvOut)
880  return hr;
881 
882  *ppvOut = NULL;
883 
884  if (IsEqualIID (riid, IID_IContextMenu) && (cidl >= 1))
885  {
886  if (_ILIsDrive(apidl[0]))
887  hr = CDrivesContextMenu_CreateInstance(pidlRoot, hwndOwner, cidl, apidl, static_cast<IShellFolder*>(this), (IContextMenu**)&pObj);
888  else
889  hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
890  }
891  else if (IsEqualIID (riid, IID_IDataObject) && (cidl >= 1))
892  {
893  hr = IDataObject_Constructor (hwndOwner,
894  pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
895  }
896  else if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
897  {
898  if (_ILIsDrive(apidl[0]))
899  hr = CDrivesExtractIcon_CreateInstance(this, apidl[0], riid, &pObj);
900  else
901  hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
902  }
903  else if (IsEqualIID (riid, IID_IDropTarget) && (cidl == 1))
904  {
905  CComPtr<IShellFolder> psfChild;
906  hr = this->BindToObject(apidl[0], NULL, IID_PPV_ARG(IShellFolder, &psfChild));
907  if (FAILED_UNEXPECTEDLY(hr))
908  return hr;
909 
910  return psfChild->CreateViewObject(NULL, riid, ppvOut);
911  }
912  else
913  hr = E_NOINTERFACE;
914 
915  if (SUCCEEDED(hr) && !pObj)
916  hr = E_OUTOFMEMORY;
917 
918  *ppvOut = pObj;
919  TRACE ("(%p)->hr=0x%08x\n", this, hr);
920  return hr;
921 }
#define TRUE
Definition: types.h:120
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT CDrivesExtractIcon_CreateInstance(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
const GUID IID_IDataObject
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
virtual HRESULT WINAPI BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
#define IID_PPV_ARG(Itype, ppType)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
HRESULT IDataObject_Constructor(HWND hwndOwner, PCIDLIST_ABSOLUTE pMyPidl, PCUIDLIST_RELATIVE_ARRAY apidl, UINT cidl, BOOL bExtendedObject, IDataObject **dataObject)
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1939
HRESULT CDrivesContextMenu_CreateInstance(PCIDLIST_ABSOLUTE pidlFolder, HWND hwnd, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IShellFolder *psf, IContextMenu **ppcm)
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:35
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ Initialize()

HRESULT WINAPI CDrivesFolder::Initialize ( PCIDLIST_ABSOLUTE  pidl)
virtual

Implements IPersistFolder.

Definition at line 1167 of file CDrivesFolder.cpp.

1168 {
1169  return S_OK;
1170 }
#define S_OK
Definition: intsafe.h:59

◆ MapColumnToSCID()

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

Implements IShellFolder2.

Definition at line 1142 of file CDrivesFolder.cpp.

1143 {
1144  FIXME("(%p)\n", this);
1145  return E_NOTIMPL;
1146 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ParseDisplayName()

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

Definition at line 570 of file CDrivesFolder.cpp.

572 {
574  LPCWSTR szNext = NULL;
575  LPITEMIDLIST pidlTemp = NULL;
576 
577  TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", this,
578  hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName),
579  pchEaten, ppidl, pdwAttributes);
580 
581  *ppidl = 0;
582  if (pchEaten)
583  *pchEaten = 0; /* strange but like the original */
584 
585  /* handle CLSID paths */
586  if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':')
587  return m_regFolder->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, pchEaten, ppidl, pdwAttributes);
588 
589  if (PathGetDriveNumberW(lpszDisplayName) < 0)
590  return E_INVALIDARG;
591 
592  pidlTemp = _ILCreateDrive(lpszDisplayName);
593  if (!pidlTemp)
594  return E_OUTOFMEMORY;
595 
596  if (lpszDisplayName[2] == L'\\')
597  {
598  szNext = &lpszDisplayName[3];
599  }
600 
601  if (szNext && *szNext)
602  {
603  hr = SHELL32_ParseNextElement (this, hwndOwner, pbc, &pidlTemp,
604  (LPOLESTR) szNext, pchEaten, pdwAttributes);
605  }
606  else
607  {
608  hr = S_OK;
609  if (pdwAttributes && *pdwAttributes)
610  {
611  if (_ILIsDrive(pidlTemp))
612  *pdwAttributes &= dwDriveAttributes;
613  else if (_ILIsSpecialFolder(pidlTemp))
614  m_regFolder->GetAttributesOf(1, &pidlTemp, pdwAttributes);
615  else
616  ERR("Got an unkown pidl here!\n");
617  }
618  }
619 
620  *ppidl = pidlTemp;
621 
622  TRACE ("(%p)->(-- ret=0x%08x)\n", this, hr);
623 
624  return hr;
625 }
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LPITEMIDLIST _ILCreateDrive(LPCWSTR lpszNew)
Definition: pidl.c:1794
static LPOLESTR
Definition: stg_prop.c:27
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
HRESULT SHELL32_ParseNextElement(IShellFolder2 *psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST *pidlInOut, LPOLESTR szNext, DWORD *pEaten, DWORD *pdwAttributes)
Definition: shlfolder.cpp:70
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1939
static const WCHAR L[]
Definition: oid.c:1250
static const DWORD dwDriveAttributes
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:548
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

◆ SetNameOf()

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

Implements IShellFolder.

Definition at line 1028 of file CDrivesFolder.cpp.

1030 {
1031  WCHAR szName[30];
1032 
1033  if (_ILIsDrive(pidl))
1034  {
1035  if (_ILSimpleGetTextW(pidl, szName, _countof(szName)))
1037  if (pPidlOut)
1038  *pPidlOut = _ILCreateDrive(szName);
1039  return S_OK;
1040  }
1041 
1042  return m_regFolder->SetNameOf(hwndOwner, pidl, lpName, dwFlags, pPidlOut);
1043 }
LPITEMIDLIST _ILCreateDrive(LPCWSTR lpszNew)
Definition: pidl.c:1794
#define _countof(array)
Definition: fontsub.cpp:30
_In_ LPCSTR lpName
Definition: winbase.h:2746
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2082
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI SetVolumeLabelW(IN LPCWSTR lpRootPathName, IN LPCWSTR lpVolumeName OPTIONAL)
Definition: volume.c:503
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1939
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:59
static const WCHAR szName[]
Definition: msipriv.h:1194

Member Data Documentation

◆ m_regFolder

◆ pidlRoot

LPITEMIDLIST CDrivesFolder::pidlRoot
private

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