ReactOS  0.4.15-dev-439-g292f67a
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 550 of file CDrivesFolder.cpp.

551 {
552  pidlRoot = NULL;
553 }
smooth NULL
Definition: ftsmooth.c:416
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:35

◆ ~CDrivesFolder()

CDrivesFolder::~CDrivesFolder ( )

Definition at line 555 of file CDrivesFolder.cpp.

556 {
557  TRACE ("-- destroying IShellFolder(%p)\n", this);
558  SHFree(pidlRoot);
559 }
#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 658 of file CDrivesFolder.cpp.

659 {
660  TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", this,
661  pidl, pbcReserved, shdebugstr_guid(&riid), ppvOut);
662 
663  if (!pidl)
664  return E_INVALIDARG;
665 
666  if (_ILIsSpecialFolder(pidl))
667  return m_regFolder->BindToObject(pidl, pbcReserved, riid, ppvOut);
668 
669  CHAR* pchDrive = _ILGetDataPointer(pidl)->u.drive.szDriveName;
670 
671  PERSIST_FOLDER_TARGET_INFO pfti = {0};
672  pfti.dwAttributes = -1;
673  pfti.csidl = -1;
674  pfti.szTargetParsingName[0] = *pchDrive;
675  pfti.szTargetParsingName[1] = L':';
676  pfti.szTargetParsingName[2] = L'\\';
677 
679  &pfti,
680  pidl,
681  &CLSID_ShellFSFolder,
682  riid,
683  ppvOut);
684  if (FAILED_UNEXPECTEDLY(hr))
685  return hr;
686 
687  return S_OK;
688 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2170
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:78
#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 693 of file CDrivesFolder.cpp.

694 {
695  FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this,
696  pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
697 
698  *ppvOut = NULL;
699  return E_NOTIMPL;
700 }
REFIID riid
Definition: precomp.h:44
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
#define FIXME(fmt,...)
Definition: debug.h:111
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 1209 of file CDrivesFolder.cpp.

1210 {
1211  if (uMsg != DFM_MERGECONTEXTMENU && uMsg != DFM_INVOKECOMMAND)
1212  return S_OK;
1213 
1214  /* no data object means no selection */
1215  if (!pdtobj)
1216  {
1217  if (uMsg == DFM_INVOKECOMMAND && wParam == 1) // #1
1218  {
1219  // "System" properties
1220  ShellExecuteW(hwndOwner,
1221  NULL,
1222  L"rundll32.exe",
1223  L"shell32.dll,Control_RunDLL sysdm.cpl",
1224  NULL,
1225  SW_SHOWNORMAL);
1226  }
1227  else if (uMsg == DFM_MERGECONTEXTMENU)
1228  {
1229  QCMINFO *pqcminfo = (QCMINFO *)lParam;
1230  HMENU hpopup = CreatePopupMenu();
1231  _InsertMenuItemW(hpopup, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED); // #0
1233  Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu++, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
1234  DestroyMenu(hpopup);
1235  }
1236 
1237  return S_OK;
1238  }
1239 
1240  if (uMsg != DFM_INVOKECOMMAND || wParam != DFM_CMD_PROPERTIES)
1241  return S_OK;
1242 
1243  return Shell_DefaultContextMenuCallBack(this, pdtobj);
1244 }
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
UINT idCmdLast
Definition: shlobj.h:1318
#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:1315
#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:1316
#define MM_ADDSEPARATOR
Definition: shlobj.h:2345
UINT idCmdFirst
Definition: shlobj.h:1317
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:44
#define DFM_CMD_PROPERTIES
Definition: shlobj.h:2429
#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:2274
#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 706 of file CDrivesFolder.cpp.

707 {
708  HRESULT hres;
709 
710  if (!pidl1 || !pidl2)
711  {
712  ERR("Got null pidl pointer (%Ix %p %p)!\n", lParam, pidl1, pidl2);
713  return E_INVALIDARG;
714  }
715 
716  if (_ILIsSpecialFolder(pidl1) || _ILIsSpecialFolder(pidl2))
717  return m_regFolder->CompareIDs(lParam, pidl1, pidl2);
718 
719  if (!_ILIsDrive(pidl1) || !_ILIsDrive(pidl2) || LOWORD(lParam) >= MYCOMPUTERSHELLVIEWCOLUMNS)
720  return E_INVALIDARG;
721 
722  CHAR* pszDrive1 = _ILGetDataPointer(pidl1)->u.drive.szDriveName;
723  CHAR* pszDrive2 = _ILGetDataPointer(pidl2)->u.drive.szDriveName;
724 
725  int result;
726  switch(LOWORD(lParam))
727  {
728  case 0: /* name */
729  {
730  result = stricmp(pszDrive1, pszDrive2);
732  break;
733  }
734  case 1: /* comments */
736  break;
737  case 2: /* Type */
738  {
739  /* We want to return immediately because SHELL32_CompareDetails also compares children. */
740  return SHELL32_CompareDetails(this, lParam, pidl1, pidl2);
741  }
742  case 3: /* Size */
743  case 4: /* Size Available */
744  {
745  ULARGE_INTEGER Drive1Available, Drive1Total, Drive2Available, Drive2Total;
746 
747  if (GetVolumeInformationA(pszDrive1, NULL, 0, NULL, NULL, NULL, NULL, 0))
748  GetDiskFreeSpaceExA(pszDrive1, &Drive1Available, &Drive1Total, NULL);
749  else
750  Drive1Available.QuadPart = Drive1Total.QuadPart = 0;
751 
752  if (GetVolumeInformationA(pszDrive2, NULL, 0, NULL, NULL, NULL, NULL, 0))
753  GetDiskFreeSpaceExA(pszDrive2, &Drive2Available, &Drive2Total, NULL);
754  else
755  Drive2Available.QuadPart = Drive2Total.QuadPart = 0;
756 
757  LARGE_INTEGER Diff;
758  if (lParam == 3) /* Size */
759  Diff.QuadPart = Drive1Total.QuadPart - Drive2Total.QuadPart;
760  else /* Size available */
761  Diff.QuadPart = Drive1Available.QuadPart - Drive2Available.QuadPart;
762 
764  break;
765  }
766  default:
767  return E_INVALIDARG;
768  }
769 
770  if (HRESULT_CODE(hres) == 0)
771  return SHELL32_CompareChildren(this, lParam, pidl1, pidl2);
772 
773  return hres;
774 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2170
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:78
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1947
#define ERR(fmt,...)
Definition: debug.h:110
#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:113

◆ CreateViewObject()

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

Definition at line 779 of file CDrivesFolder.cpp.

780 {
781  CComPtr<IShellView> pShellView;
783 
784  TRACE("(%p)->(hwnd=%p,%s,%p)\n", this,
785  hwndOwner, shdebugstr_guid (&riid), ppvOut);
786 
787  if (!ppvOut)
788  return hr;
789 
790  *ppvOut = NULL;
791 
792  if (IsEqualIID(riid, IID_IDropTarget))
793  {
794  WARN("IDropTarget not implemented\n");
795  hr = E_NOTIMPL;
796  }
797  else if (IsEqualIID(riid, IID_IContextMenu))
798  {
799  HKEY hKeys[16];
800  UINT cKeys = 0;
801  AddClassKeyToArray(L"Directory\\Background", hKeys, &cKeys);
802 
803  DEFCONTEXTMENU dcm;
804  dcm.hwnd = hwndOwner;
805  dcm.pcmcb = this;
806  dcm.pidlFolder = pidlRoot;
807  dcm.psf = this;
808  dcm.cidl = 0;
809  dcm.apidl = NULL;
810  dcm.cKeys = cKeys;
811  dcm.aKeys = hKeys;
813  hr = SHCreateDefaultContextMenu(&dcm, riid, ppvOut);
814  }
815  else if (IsEqualIID(riid, IID_IShellView))
816  {
817  SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
818  hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
819  }
820  TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut);
821  return hr;
822 }
HRESULT hr
Definition: shlfolder.c:183
const HKEY * aKeys
Definition: shlobj.h:2374
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI SHCreateDefaultContextMenu(const DEFCONTEXTMENU *pdcm, REFIID riid, void **ppv)
#define WARN(fmt,...)
Definition: debug.h:112
void AddClassKeyToArray(const WCHAR *szClass, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:267
IContextMenuCB * pcmcb
Definition: shlobj.h:2367
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3594
IShellFolder * psf
Definition: shlobj.h:2369
#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:78
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:2372
PCUITEMID_CHILD_ARRAY apidl
Definition: shlobj.h:2371
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:35
PCIDLIST_ABSOLUTE pidlFolder
Definition: shlobj.h:2368
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ EnumObjects()

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

Definition at line 647 of file CDrivesFolder.cpp.

648 {
649  CComPtr<IEnumIDList> pRegEnumerator;
650  m_regFolder->EnumObjects(hwndOwner, dwFlags, &pRegEnumerator);
651 
652  return ShellObjectCreatorInit<CDrivesFolderEnum>(hwndOwner, dwFlags, pRegEnumerator, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
653 }
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 1068 of file CDrivesFolder.cpp.

1069 {
1070  FIXME ("(%p)\n", this);
1071  return E_NOTIMPL;
1072 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ FinalConstruct()

HRESULT WINAPI CDrivesFolder::FinalConstruct ( )

Definition at line 561 of file CDrivesFolder.cpp.

562 {
563  pidlRoot = _ILCreateMyComputer(); /* my qualified pidl */
564  if (pidlRoot == NULL)
565  return E_OUTOFMEMORY;
566 
567  HRESULT hr = CRegFolder_CreateInstance(&CLSID_MyComputer,
568  pidlRoot,
569  L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
570  L"MyComputer",
572 
573  return hr;
574 }
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:1607
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:78
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 838 of file CDrivesFolder.cpp.

839 {
840  TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
841  this, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
842 
843  if (cidl && !apidl)
844  return E_INVALIDARG;
845 
846  if (*rgfInOut == 0)
847  *rgfInOut = ~0;
848 
849  /* FIXME: always add SFGAO_CANLINK */
850  if(cidl == 0)
851  *rgfInOut &= dwComputerAttributes;
852  else
853  {
854  for (UINT i = 0; i < cidl; ++i)
855  {
856  if (_ILIsDrive(apidl[i]))
857  *rgfInOut &= dwDriveAttributes;
858  else if (_ILIsControlPanel(apidl[i]))
859  *rgfInOut &= dwControlPanelAttributes;
860  else if (_ILIsSpecialFolder(*apidl))
861  m_regFolder->GetAttributesOf(1, &apidl[i], rgfInOut);
862  else
863  ERR("Got unknown pidl type!\n");
864  }
865  }
866 
867  /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
868  *rgfInOut &= ~SFGAO_VALIDATE;
869 
870  TRACE ("-- result=0x%08x\n", *rgfInOut);
871  return S_OK;
872 }
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:1947
static const DWORD dwDriveAttributes
#define ERR(fmt,...)
Definition: debug.h:110
#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 1171 of file CDrivesFolder.cpp.

1172 {
1173  TRACE ("(%p)\n", this);
1174 
1175  if (!lpClassId)
1176  return E_POINTER;
1177 
1178  *lpClassId = CLSID_MyComputer;
1179  return S_OK;
1180 }
#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 1195 of file CDrivesFolder.cpp.

1196 {
1197  TRACE("(%p)->(%p)\n", this, pidl);
1198 
1199  if (!pidl)
1200  return E_INVALIDARG; /* xp doesn't have this check and crashes on NULL */
1201 
1202  *pidl = ILClone(pidlRoot);
1203  return S_OK;
1204 }
#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 1074 of file CDrivesFolder.cpp.

1075 {
1076  TRACE ("(%p)\n", this);
1077 
1078  if (pSort)
1079  *pSort = 0;
1080  if (pDisplay)
1081  *pDisplay = 0;
1082  return S_OK;
1083 }
#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 1085 of file CDrivesFolder.cpp.

1086 {
1087  TRACE ("(%p)\n", this);
1088 
1089  if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
1090  return E_INVALIDARG;
1091  *pcsFlags = MyComputerSFHeader[iColumn].pcsFlags;
1092  return S_OK;
1093 }
#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 1062 of file CDrivesFolder.cpp.

1063 {
1064  FIXME ("(%p)\n", this);
1065  return E_NOTIMPL;
1066 }
#define FIXME(fmt,...)
Definition: debug.h:111
#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 1095 of file CDrivesFolder.cpp.

1096 {
1097  FIXME ("(%p)\n", this);
1098  return E_NOTIMPL;
1099 }
#define FIXME(fmt,...)
Definition: debug.h:111
#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 1101 of file CDrivesFolder.cpp.

1102 {
1103  HRESULT hr;
1104 
1105  TRACE ("(%p)->(%p %i %p)\n", this, pidl, iColumn, psd);
1106 
1107  if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
1108  return E_INVALIDARG;
1109 
1110  if (!pidl)
1111  {
1112  psd->fmt = MyComputerSFHeader[iColumn].fmt;
1113  psd->cxChar = MyComputerSFHeader[iColumn].cxChar;
1114  return SHSetStrRet(&psd->str, MyComputerSFHeader[iColumn].colnameid);
1115  }
1116  else if (!_ILIsDrive(pidl))
1117  {
1118  return m_regFolder->GetDetailsOf(pidl, iColumn, psd);
1119  }
1120  else
1121  {
1122  ULARGE_INTEGER ulTotalBytes, ulFreeBytes;
1123  CHAR* pszDrive = _ILGetDataPointer(pidl)->u.drive.szDriveName;
1124  UINT DriveType = GetDriveTypeA(pszDrive);
1125  if (DriveType > DRIVE_RAMDISK)
1127 
1128  switch (iColumn)
1129  {
1130  case 0: /* name */
1132  break;
1133  case 1: /* FIXME: comments */
1134  hr = SHSetStrRet(&psd->str, "");
1135  break;
1136  case 2: /* type */
1137  if (DriveType == DRIVE_REMOVABLE && !IsDriveFloppyA(pszDrive))
1138  hr = SHSetStrRet(&psd->str, IDS_DRIVE_REMOVABLE);
1139  else
1140  hr = SHSetStrRet(&psd->str, iDriveTypeIds[DriveType]);
1141  break;
1142  case 3: /* total size */
1143  case 4: /* free size */
1144  psd->str.cStr[0] = 0x00;
1145  psd->str.uType = STRRET_CSTR;
1146  if (GetVolumeInformationA(pszDrive, NULL, 0, NULL, NULL, NULL, NULL, 0))
1147  {
1148  GetDiskFreeSpaceExA(pszDrive, &ulFreeBytes, &ulTotalBytes, NULL);
1149  if (iColumn == 3)
1150  StrFormatByteSize64A(ulTotalBytes.QuadPart, psd->str.cStr, MAX_PATH);
1151  else
1152  StrFormatByteSize64A(ulFreeBytes.QuadPart, psd->str.cStr, MAX_PATH);
1153  }
1154  hr = S_OK;
1155  break;
1156  }
1157  }
1158 
1159  return hr;
1160 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2170
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 IsDriveFloppyA(LPCSTR pszDriveRoot)
Definition: drvdefext.cpp:373
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
#define DRIVE_REMOVABLE
Definition: winbase.h:248
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:78
static int iDriveTypeIds[7]
#define MAX_PATH
Definition: compat.h:26
#define IDS_DRIVE_REMOVABLE
Definition: shresdef.h:109
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1947
#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 943 of file CDrivesFolder.cpp.

944 {
945  LPWSTR pszPath;
946  HRESULT hr = S_OK;
947 
948  TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl, dwFlags, strRet);
949  pdump (pidl);
950 
951  if (!strRet)
952  return E_INVALIDARG;
953 
954  if (!_ILIsPidlSimple (pidl))
955  {
956  return SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags, strRet);
957  }
958  else if (_ILIsSpecialFolder(pidl))
959  {
960  return m_regFolder->GetDisplayNameOf(pidl, dwFlags, strRet);
961  }
962  else if (!_ILIsDrive(pidl))
963  {
964  ERR("Wrong pidl type\n");
965  return E_INVALIDARG;
966  }
967 
968  pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
969  if (!pszPath)
970  return E_OUTOFMEMORY;
971 
972  pszPath[0] = 0;
973 
974  _ILSimpleGetTextW(pidl, pszPath, MAX_PATH); /* append my own path */
975  /* long view "lw_name (C:)" */
976  if (!(dwFlags & SHGDN_FORPARSING))
977  {
978  WCHAR wszDrive[18] = {0};
979  DWORD dwVolumeSerialNumber, dwMaximumComponentLength, dwFileSystemFlags;
980  static const WCHAR wszOpenBracket[] = {' ', '(', 0};
981  static const WCHAR wszCloseBracket[] = {')', 0};
982 
983  lstrcpynW(wszDrive, pszPath, 4);
984  pszPath[0] = L'\0';
985  GetVolumeInformationW(wszDrive, pszPath,
986  MAX_PATH - 7,
987  &dwVolumeSerialNumber,
988  &dwMaximumComponentLength, &dwFileSystemFlags, NULL, 0);
989  pszPath[MAX_PATH-1] = L'\0';
990  if (!wcslen(pszPath))
991  {
992  UINT DriveType, ResourceId;
993  DriveType = GetDriveTypeW(wszDrive);
994  switch(DriveType)
995  {
996  case DRIVE_FIXED:
997  ResourceId = IDS_DRIVE_FIXED;
998  break;
999  case DRIVE_REMOTE:
1000  ResourceId = IDS_DRIVE_NETWORK;
1001  break;
1002  case DRIVE_CDROM:
1003  ResourceId = IDS_DRIVE_CDROM;
1004  break;
1005  default:
1006  ResourceId = 0;
1007  }
1008  if (ResourceId)
1009  {
1010  dwFileSystemFlags = LoadStringW(shell32_hInstance, ResourceId, pszPath, MAX_PATH);
1011  if (dwFileSystemFlags > MAX_PATH - 7)
1012  pszPath[MAX_PATH-7] = L'\0';
1013  }
1014  }
1015  wcscat (pszPath, wszOpenBracket);
1016  wszDrive[2] = L'\0';
1017  wcscat (pszPath, wszDrive);
1018  wcscat (pszPath, wszCloseBracket);
1019  }
1020 
1021  if (SUCCEEDED(hr))
1022  {
1023  strRet->uType = STRRET_WSTR;
1024  strRet->pOleStr = pszPath;
1025  }
1026  else
1027  CoTaskMemFree(pszPath);
1028 
1029  TRACE("-- (%p)->(%s)\n", this, strRet->uType == STRRET_CSTR ? strRet->cStr : debugstr_w(strRet->pOleStr));
1030  return hr;
1031 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
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:406
char cStr[MAX_PATH]
Definition: shtypes.idl:98
#define DRIVE_REMOTE
Definition: winbase.h:250
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define DRIVE_CDROM
Definition: machpc98.h:115
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:2090
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:78
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1947
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:110
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
_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:426
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 886 of file CDrivesFolder.cpp.

889 {
890  LPVOID pObj = NULL;
892 
893  TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", this,
894  hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
895 
896  if (!ppvOut)
897  return hr;
898 
899  *ppvOut = NULL;
900 
901  if (IsEqualIID (riid, IID_IContextMenu) && (cidl >= 1))
902  {
903  if (_ILIsDrive(apidl[0]))
904  hr = CDrivesContextMenu_CreateInstance(pidlRoot, hwndOwner, cidl, apidl, static_cast<IShellFolder*>(this), (IContextMenu**)&pObj);
905  else
906  hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
907  }
908  else if (IsEqualIID (riid, IID_IDataObject) && (cidl >= 1))
909  {
910  hr = IDataObject_Constructor (hwndOwner,
911  pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
912  }
913  else if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
914  {
915  if (_ILIsDrive(apidl[0]))
916  hr = CDrivesExtractIcon_CreateInstance(this, apidl[0], riid, &pObj);
917  else
918  hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
919  }
920  else if (IsEqualIID (riid, IID_IDropTarget) && (cidl == 1))
921  {
922  CComPtr<IShellFolder> psfChild;
923  hr = this->BindToObject(apidl[0], NULL, IID_PPV_ARG(IShellFolder, &psfChild));
924  if (FAILED_UNEXPECTEDLY(hr))
925  return hr;
926 
927  return psfChild->CreateViewObject(NULL, riid, ppvOut);
928  }
929  else
930  hr = E_NOINTERFACE;
931 
932  if (SUCCEEDED(hr) && !pObj)
933  hr = E_OUTOFMEMORY;
934 
935  *ppvOut = pObj;
936  TRACE ("(%p)->hr=0x%08x\n", this, hr);
937  return hr;
938 }
#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:78
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1947
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 1187 of file CDrivesFolder.cpp.

1188 {
1189  return S_OK;
1190 }
#define S_OK
Definition: intsafe.h:59

◆ MapColumnToSCID()

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

Implements IShellFolder2.

Definition at line 1162 of file CDrivesFolder.cpp.

1163 {
1164  FIXME("(%p)\n", this);
1165  return E_NOTIMPL;
1166 }
#define FIXME(fmt,...)
Definition: debug.h:111
#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 579 of file CDrivesFolder.cpp.

581 {
583  LPCWSTR szNext = NULL;
584  LPITEMIDLIST pidlTemp = NULL;
585  WCHAR volumePathName[MAX_PATH];
586 
587  TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", this,
588  hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName),
589  pchEaten, ppidl, pdwAttributes);
590 
591  *ppidl = 0;
592  if (pchEaten)
593  *pchEaten = 0; /* strange but like the original */
594 
595  /* handle CLSID paths */
596  if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':')
597  return m_regFolder->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, pchEaten, ppidl, pdwAttributes);
598 
599  if (PathGetDriveNumberW(lpszDisplayName) < 0)
600  return E_INVALIDARG;
601 
602  /* check if this drive actually exists */
603  if (!GetVolumePathNameW(lpszDisplayName, volumePathName, _countof(volumePathName)) ||
604  GetDriveTypeW(volumePathName) < DRIVE_REMOVABLE)
605  {
607  }
608 
609  pidlTemp = _ILCreateDrive(lpszDisplayName);
610  if (!pidlTemp)
611  return E_OUTOFMEMORY;
612 
613  if (lpszDisplayName[2] == L'\\')
614  {
615  szNext = &lpszDisplayName[3];
616  }
617 
618  if (szNext && *szNext)
619  {
620  hr = SHELL32_ParseNextElement (this, hwndOwner, pbc, &pidlTemp,
621  (LPOLESTR) szNext, pchEaten, pdwAttributes);
622  }
623  else
624  {
625  hr = S_OK;
626  if (pdwAttributes && *pdwAttributes)
627  {
628  if (_ILIsDrive(pidlTemp))
629  *pdwAttributes &= dwDriveAttributes;
630  else if (_ILIsSpecialFolder(pidlTemp))
631  m_regFolder->GetAttributesOf(1, &pidlTemp, pdwAttributes);
632  else
633  ERR("Got an unkown pidl here!\n");
634  }
635  }
636 
637  *ppidl = pidlTemp;
638 
639  TRACE ("(%p)->(-- ret=0x%08x)\n", this, hr);
640 
641  return hr;
642 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LPITEMIDLIST _ILCreateDrive(LPCWSTR lpszNew)
Definition: pidl.c:1802
BOOL WINAPI GetVolumePathNameW(IN LPCWSTR lpszFileName, IN LPWSTR lpszVolumePathName, IN DWORD cchBufferLength)
Definition: volume.c:815
static LPOLESTR
Definition: stg_prop.c:27
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
#define DRIVE_REMOVABLE
Definition: winbase.h:248
#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
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:26
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1947
static const WCHAR L[]
Definition: oid.c:1250
#define ERROR_INVALID_DRIVE
Definition: winerror.h:118
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
static const DWORD dwDriveAttributes
#define ERR(fmt,...)
Definition: debug.h:110
#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 1045 of file CDrivesFolder.cpp.

1047 {
1048  WCHAR szName[30];
1049 
1050  if (_ILIsDrive(pidl))
1051  {
1052  if (_ILSimpleGetTextW(pidl, szName, _countof(szName)))
1054  if (pPidlOut)
1055  *pPidlOut = _ILCreateDrive(szName);
1056  return S_OK;
1057  }
1058 
1059  return m_regFolder->SetNameOf(hwndOwner, pidl, lpName, dwFlags, pPidlOut);
1060 }
LPITEMIDLIST _ILCreateDrive(LPCWSTR lpszNew)
Definition: pidl.c:1802
_In_ LPCSTR lpName
Definition: winbase.h:2752
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2090
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI SetVolumeLabelW(IN LPCWSTR lpRootPathName, IN LPCWSTR lpVolumeName OPTIONAL)
Definition: volume.c:503
#define _countof(array)
Definition: sndvol32.h:68
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1947
_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: