ReactOS  0.4.15-dev-3733-g974a0f0
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 548 of file CDrivesFolder.cpp.

549 {
550  pidlRoot = NULL;
551 }
#define NULL
Definition: types.h:112
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:35

◆ ~CDrivesFolder()

CDrivesFolder::~CDrivesFolder ( )

Definition at line 553 of file CDrivesFolder.cpp.

554 {
555  TRACE ("-- destroying IShellFolder(%p)\n", this);
556  SHFree(pidlRoot);
557 }
#define TRACE(s)
Definition: solgame.cpp:4
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
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 656 of file CDrivesFolder.cpp.

657 {
658  TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", this,
659  pidl, pbcReserved, shdebugstr_guid(&riid), ppvOut);
660 
661  if (!pidl)
662  return E_INVALIDARG;
663 
664  if (_ILIsSpecialFolder(pidl))
665  return m_regFolder->BindToObject(pidl, pbcReserved, riid, ppvOut);
666 
667  CHAR* pchDrive = _ILGetDataPointer(pidl)->u.drive.szDriveName;
668 
669  PERSIST_FOLDER_TARGET_INFO pfti = {0};
670  pfti.dwAttributes = -1;
671  pfti.csidl = -1;
672  pfti.szTargetParsingName[0] = *pchDrive;
673  pfti.szTargetParsingName[1] = L':';
674  pfti.szTargetParsingName[2] = L'\\';
675 
677  &pfti,
678  pidl,
679  &CLSID_ShellFSFolder,
680  riid,
681  ppvOut);
682  if (FAILED_UNEXPECTEDLY(hr))
683  return hr;
684 
685  return S_OK;
686 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2176
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
#define L(x)
Definition: ntvdm.h:50
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define S_OK
Definition: intsafe.h:52
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 691 of file CDrivesFolder.cpp.

692 {
693  FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this,
694  pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
695 
696  *ppvOut = NULL;
697  return E_NOTIMPL;
698 }
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
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112

◆ CallBack()

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

Implements IContextMenuCB.

Definition at line 1205 of file CDrivesFolder.cpp.

1206 {
1207  if (uMsg != DFM_MERGECONTEXTMENU && uMsg != DFM_INVOKECOMMAND)
1208  return S_OK;
1209 
1210  /* no data object means no selection */
1211  if (!pdtobj)
1212  {
1213  if (uMsg == DFM_INVOKECOMMAND && wParam == 1) // #1
1214  {
1215  // "System" properties
1216  ShellExecuteW(hwndOwner,
1217  NULL,
1218  L"rundll32.exe",
1219  L"shell32.dll,Control_RunDLL sysdm.cpl",
1220  NULL,
1221  SW_SHOWNORMAL);
1222  }
1223  else if (uMsg == DFM_MERGECONTEXTMENU)
1224  {
1225  QCMINFO *pqcminfo = (QCMINFO *)lParam;
1226  HMENU hpopup = CreatePopupMenu();
1227  _InsertMenuItemW(hpopup, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED); // #0
1229  Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu++, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
1230  DestroyMenu(hpopup);
1231  }
1232 
1233  return S_OK;
1234  }
1235 
1236  if (uMsg != DFM_INVOKECOMMAND || wParam != DFM_CMD_PROPERTIES)
1237  return S_OK;
1238 
1239  return Shell_DefaultContextMenuCallBack(this, pdtobj);
1240 }
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
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:856
#define TRUE
Definition: types.h:120
HRESULT WINAPI Shell_DefaultContextMenuCallBack(IShellFolder *psf, IDataObject *pdtobj)
Definition: shlfolder.cpp:429
HMENU hmenu
Definition: shlobj.h:1315
#define IDS_PROPERTIES
Definition: resource.h:101
WPARAM wParam
Definition: combotst.c:138
#define L(x)
Definition: ntvdm.h:50
#define MFS_ENABLED
Definition: winuser.h:745
#define DFM_INVOKECOMMAND
Definition: precomp.h:45
UINT indexMenu
Definition: shlobj.h:1316
#define MM_ADDSEPARATOR
Definition: shlobj.h:2367
UINT idCmdFirst
Definition: shlobj.h:1317
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:44
#define DFM_CMD_PROPERTIES
Definition: shlobj.h:2451
#define MFT_SEPARATOR
Definition: winuser.h:739
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define S_OK
Definition: intsafe.h:52
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define NULL
Definition: types.h:112
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:2258
#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 704 of file CDrivesFolder.cpp.

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

◆ CreateViewObject()

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

Definition at line 777 of file CDrivesFolder.cpp.

778 {
779  CComPtr<IShellView> pShellView;
781 
782  TRACE("(%p)->(hwnd=%p,%s,%p)\n", this,
783  hwndOwner, shdebugstr_guid (&riid), ppvOut);
784 
785  if (!ppvOut)
786  return hr;
787 
788  *ppvOut = NULL;
789 
790  if (IsEqualIID(riid, IID_IDropTarget))
791  {
792  WARN("IDropTarget not implemented\n");
793  hr = E_NOTIMPL;
794  }
795  else if (IsEqualIID(riid, IID_IContextMenu))
796  {
797  HKEY hKeys[16];
798  UINT cKeys = 0;
799  AddClassKeyToArray(L"Directory\\Background", hKeys, &cKeys);
800 
801  DEFCONTEXTMENU dcm;
802  dcm.hwnd = hwndOwner;
803  dcm.pcmcb = this;
804  dcm.pidlFolder = pidlRoot;
805  dcm.psf = this;
806  dcm.cidl = 0;
807  dcm.apidl = NULL;
808  dcm.cKeys = cKeys;
809  dcm.aKeys = hKeys;
811  hr = SHCreateDefaultContextMenu(&dcm, riid, ppvOut);
812  }
813  else if (IsEqualIID(riid, IID_IShellView))
814  {
815  SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
816  hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
817  }
818  TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut);
819  return hr;
820 }
HRESULT hr
Definition: shlfolder.c:183
const HKEY * aKeys
Definition: shlobj.h:2396
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:2389
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3792
#define L(x)
Definition: ntvdm.h:50
IShellFolder * psf
Definition: shlobj.h:2391
#define E_INVALIDARG
Definition: ddrawi.h:101
struct _SFV_CREATE SFV_CREATE
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
IUnknown * punkAssociationInfo
Definition: shlobj.h:2394
PCUITEMID_CHILD_ARRAY apidl
Definition: shlobj.h:2393
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:35
PCIDLIST_ABSOLUTE pidlFolder
Definition: shlobj.h:2390
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ EnumObjects()

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

Definition at line 645 of file CDrivesFolder.cpp.

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

1065 {
1066  FIXME ("(%p)\n", this);
1067  return E_NOTIMPL;
1068 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ FinalConstruct()

HRESULT WINAPI CDrivesFolder::FinalConstruct ( )

Definition at line 559 of file CDrivesFolder.cpp.

560 {
561  pidlRoot = _ILCreateMyComputer(); /* my qualified pidl */
562  if (pidlRoot == NULL)
563  return E_OUTOFMEMORY;
564 
565  HRESULT hr = CRegFolder_CreateInstance(&CLSID_MyComputer,
566  pidlRoot,
567  L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
568  L"MyComputer",
570 
571  return hr;
572 }
HRESULT hr
Definition: shlfolder.c:183
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
#define IID_PPV_ARG(Itype, ppType)
#define L(x)
Definition: ntvdm.h:50
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
LPITEMIDLIST _ILCreateMyComputer(void)
Definition: pidl.c:1613
HRESULT CRegFolder_CreateInstance(const GUID *pGuid, LPCITEMIDLIST pidlRoot, LPCWSTR lpszPath, LPCWSTR lpszEnumKeyName, REFIID riid, void **ppv)
Definition: CRegFolder.cpp:779
LONG HRESULT
Definition: typedefs.h:79
#define NULL
Definition: types.h:112
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:35

◆ GetAttributesOf()

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

Definition at line 836 of file CDrivesFolder.cpp.

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

◆ GetClassID()

HRESULT WINAPI CDrivesFolder::GetClassID ( CLSID lpClassId)
virtual

Implements IPersist.

Definition at line 1167 of file CDrivesFolder.cpp.

1168 {
1169  TRACE ("(%p)\n", this);
1170 
1171  if (!lpClassId)
1172  return E_POINTER;
1173 
1174  *lpClassId = CLSID_MyComputer;
1175  return S_OK;
1176 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52
#define E_POINTER
Definition: winerror.h:2365

◆ GetCurFolder()

HRESULT WINAPI CDrivesFolder::GetCurFolder ( PIDLIST_ABSOLUTE pidl)
virtual

Implements IPersistFolder2.

Definition at line 1191 of file CDrivesFolder.cpp.

1192 {
1193  TRACE("(%p)->(%p)\n", this, pidl);
1194 
1195  if (!pidl)
1196  return E_INVALIDARG; /* xp doesn't have this check and crashes on NULL */
1197 
1198  *pidl = ILClone(pidlRoot);
1199  return S_OK;
1200 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52
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 1070 of file CDrivesFolder.cpp.

1071 {
1072  TRACE ("(%p)\n", this);
1073 
1074  if (pSort)
1075  *pSort = 0;
1076  if (pDisplay)
1077  *pDisplay = 0;
1078  return S_OK;
1079 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52

◆ GetDefaultColumnState()

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

Implements IShellFolder2.

Definition at line 1081 of file CDrivesFolder.cpp.

1082 {
1083  TRACE ("(%p)\n", this);
1084 
1085  if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
1086  return E_INVALIDARG;
1087  *pcsFlags = MyComputerSFHeader[iColumn].pcsFlags;
1088  return S_OK;
1089 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52
#define MYCOMPUTERSHELLVIEWCOLUMNS
static const shvheader MyComputerSFHeader[]

◆ GetDefaultSearchGUID()

HRESULT WINAPI CDrivesFolder::GetDefaultSearchGUID ( GUID pguid)
virtual

Implements IShellFolder2.

Definition at line 1058 of file CDrivesFolder.cpp.

1059 {
1060  FIXME ("(%p)\n", this);
1061  return E_NOTIMPL;
1062 }
#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 1091 of file CDrivesFolder.cpp.

1092 {
1093  FIXME ("(%p)\n", this);
1094  return E_NOTIMPL;
1095 }
#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 1097 of file CDrivesFolder.cpp.

1098 {
1099  HRESULT hr;
1100 
1101  TRACE ("(%p)->(%p %i %p)\n", this, pidl, iColumn, psd);
1102 
1103  if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
1104  return E_INVALIDARG;
1105 
1106  if (!pidl)
1107  {
1108  psd->fmt = MyComputerSFHeader[iColumn].fmt;
1109  psd->cxChar = MyComputerSFHeader[iColumn].cxChar;
1110  return SHSetStrRet(&psd->str, MyComputerSFHeader[iColumn].colnameid);
1111  }
1112  else if (!_ILIsDrive(pidl))
1113  {
1114  return m_regFolder->GetDetailsOf(pidl, iColumn, psd);
1115  }
1116  else
1117  {
1118  ULARGE_INTEGER ulTotalBytes, ulFreeBytes;
1119  CHAR* pszDrive = _ILGetDataPointer(pidl)->u.drive.szDriveName;
1120  UINT DriveType = GetDriveTypeA(pszDrive);
1121  if (DriveType > DRIVE_RAMDISK)
1123 
1124  switch (iColumn)
1125  {
1126  case 0: /* name */
1128  break;
1129  case 1: /* FIXME: comments */
1130  hr = SHSetStrRet(&psd->str, "");
1131  break;
1132  case 2: /* type */
1133  if (DriveType == DRIVE_REMOVABLE && !IsDriveFloppyA(pszDrive))
1134  hr = SHSetStrRet(&psd->str, IDS_DRIVE_REMOVABLE);
1135  else
1136  hr = SHSetStrRet(&psd->str, iDriveTypeIds[DriveType]);
1137  break;
1138  case 3: /* total size */
1139  case 4: /* free size */
1140  psd->str.cStr[0] = 0x00;
1141  psd->str.uType = STRRET_CSTR;
1142  if (GetVolumeInformationA(pszDrive, NULL, 0, NULL, NULL, NULL, NULL, 0))
1143  {
1144  GetDiskFreeSpaceExA(pszDrive, &ulFreeBytes, &ulTotalBytes, NULL);
1145  if (iColumn == 3)
1146  StrFormatByteSize64A(ulTotalBytes.QuadPart, psd->str.cStr, MAX_PATH);
1147  else
1148  StrFormatByteSize64A(ulFreeBytes.QuadPart, psd->str.cStr, MAX_PATH);
1149  }
1150  hr = S_OK;
1151  break;
1152  }
1153  }
1154 
1155  return hr;
1156 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2176
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:2488
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:372
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
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
static int iDriveTypeIds[7]
#define MAX_PATH
Definition: compat.h:34
#define IDS_DRIVE_REMOVABLE
Definition: shresdef.h:117
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1953
#define DRIVE_FIXED
Definition: winbase.h:249
#define S_OK
Definition: intsafe.h:52
#define MYCOMPUTERSHELLVIEWCOLUMNS
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
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 941 of file CDrivesFolder.cpp.

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

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 884 of file CDrivesFolder.cpp.

887 {
888  LPVOID pObj = NULL;
890 
891  TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", this,
892  hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
893 
894  if (!ppvOut)
895  return hr;
896 
897  *ppvOut = NULL;
898 
899  if (IsEqualIID (riid, IID_IContextMenu) && (cidl >= 1))
900  {
901  if (_ILIsDrive(apidl[0]))
902  hr = CDrivesContextMenu_CreateInstance(pidlRoot, hwndOwner, cidl, apidl, static_cast<IShellFolder*>(this), (IContextMenu**)&pObj);
903  else
904  hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
905  }
906  else if (IsEqualIID (riid, IID_IDataObject) && (cidl >= 1))
907  {
908  hr = IDataObject_Constructor (hwndOwner,
909  pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
910  }
911  else if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
912  {
913  if (_ILIsDrive(apidl[0]))
914  hr = CDrivesExtractIcon_CreateInstance(this, apidl[0], riid, &pObj);
915  else
916  hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
917  }
918  else if (IsEqualIID (riid, IID_IDropTarget) && (cidl == 1))
919  {
920  CComPtr<IShellFolder> psfChild;
921  hr = this->BindToObject(apidl[0], NULL, IID_PPV_ARG(IShellFolder, &psfChild));
922  if (FAILED_UNEXPECTEDLY(hr))
923  return hr;
924 
925  return psfChild->CreateViewObject(NULL, riid, ppvOut);
926  }
927  else
928  hr = E_NOINTERFACE;
929 
930  if (SUCCEEDED(hr) && !pObj)
931  hr = E_OUTOFMEMORY;
932 
933  *ppvOut = pObj;
934  TRACE ("(%p)->hr=0x%08x\n", this, hr);
935  return hr;
936 }
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT CDrivesExtractIcon_CreateInstance(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
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
if SUCCEEDED(hr)
#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)
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1953
HRESULT CDrivesContextMenu_CreateInstance(PCIDLIST_ABSOLUTE pidlFolder, HWND hwnd, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IShellFolder *psf, IContextMenu **ppcm)
#define NULL
Definition: types.h:112
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:35
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ Initialize()

HRESULT WINAPI CDrivesFolder::Initialize ( PCIDLIST_ABSOLUTE  pidl)
virtual

Implements IPersistFolder.

Definition at line 1183 of file CDrivesFolder.cpp.

1184 {
1185  return S_OK;
1186 }
#define S_OK
Definition: intsafe.h:52

◆ MapColumnToSCID()

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

Implements IShellFolder2.

Definition at line 1158 of file CDrivesFolder.cpp.

1159 {
1160  FIXME("(%p)\n", this);
1161  return E_NOTIMPL;
1162 }
#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 577 of file CDrivesFolder.cpp.

579 {
581  LPCWSTR szNext = NULL;
582  LPITEMIDLIST pidlTemp = NULL;
583  INT nDriveNumber;
584 
585  TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", this,
586  hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName),
587  pchEaten, ppidl, pdwAttributes);
588 
589  *ppidl = 0;
590  if (pchEaten)
591  *pchEaten = 0; /* strange but like the original */
592 
593  /* handle CLSID paths */
594  if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':')
595  return m_regFolder->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, pchEaten, ppidl, pdwAttributes);
596 
597  nDriveNumber = PathGetDriveNumberW(lpszDisplayName);
598  if (nDriveNumber < 0)
599  return E_INVALIDARG;
600 
601  /* check if this drive actually exists */
602  if ((::GetLogicalDrives() & (1 << nDriveNumber)) == 0)
603  {
605  }
606 
607  pidlTemp = _ILCreateDrive(lpszDisplayName);
608  if (!pidlTemp)
609  return E_OUTOFMEMORY;
610 
611  if (lpszDisplayName[2] == L'\\')
612  {
613  szNext = &lpszDisplayName[3];
614  }
615 
616  if (szNext && *szNext)
617  {
618  hr = SHELL32_ParseNextElement (this, hwndOwner, pbc, &pidlTemp,
619  (LPOLESTR) szNext, pchEaten, pdwAttributes);
620  }
621  else
622  {
623  hr = S_OK;
624  if (pdwAttributes && *pdwAttributes)
625  {
626  if (_ILIsDrive(pidlTemp))
627  *pdwAttributes &= dwDriveAttributes;
628  else if (_ILIsSpecialFolder(pidlTemp))
629  m_regFolder->GetAttributesOf(1, &pidlTemp, pdwAttributes);
630  else
631  ERR("Got an unkown pidl here!\n");
632  }
633  }
634 
635  *ppidl = pidlTemp;
636 
637  TRACE ("(%p)->(-- ret=0x%08x)\n", this, hr);
638 
639  return hr;
640 }
#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:1808
static LPOLESTR
Definition: stg_prop.c:27
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
int32_t INT
Definition: typedefs.h:58
#define L(x)
Definition: ntvdm.h:50
#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
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:79
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1953
#define ERROR_INVALID_DRIVE
Definition: winerror.h:118
static const DWORD dwDriveAttributes
DWORD WINAPI GetLogicalDrives(VOID)
Definition: disk.c:110
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:553
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 1041 of file CDrivesFolder.cpp.

1043 {
1044  WCHAR szName[30];
1045 
1046  if (_ILIsDrive(pidl))
1047  {
1048  if (_ILSimpleGetTextW(pidl, szName, _countof(szName)))
1050  if (pPidlOut)
1051  *pPidlOut = _ILCreateDrive(szName);
1052  return S_OK;
1053  }
1054 
1055  return m_regFolder->SetNameOf(hwndOwner, pidl, lpName, dwFlags, pPidlOut);
1056 }
LPITEMIDLIST _ILCreateDrive(LPCWSTR lpszNew)
Definition: pidl.c:1808
_In_ LPCSTR lpName
Definition: winbase.h:2770
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2096
__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:1953
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:52
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: