ReactOS  0.4.15-dev-4914-g2220e56
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_PKEYSFGAOMASK 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:2187
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:427
HRESULT SHELL32_BindToSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidl, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: shlfolder.cpp:177
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:427
#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 1194 of file CDrivesFolder.cpp.

1195 {
1196  if (uMsg != DFM_MERGECONTEXTMENU && uMsg != DFM_INVOKECOMMAND)
1197  return S_OK;
1198 
1199  /* no data object means no selection */
1200  if (!pdtobj)
1201  {
1202  if (uMsg == DFM_INVOKECOMMAND && wParam == 1) // #1
1203  {
1204  // "System" properties
1205  ShellExecuteW(hwndOwner,
1206  NULL,
1207  L"rundll32.exe",
1208  L"shell32.dll,Control_RunDLL sysdm.cpl",
1209  NULL,
1210  SW_SHOWNORMAL);
1211  }
1212  else if (uMsg == DFM_MERGECONTEXTMENU)
1213  {
1214  QCMINFO *pqcminfo = (QCMINFO *)lParam;
1215  HMENU hpopup = CreatePopupMenu();
1216  _InsertMenuItemW(hpopup, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED); // #0
1218  Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu++, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
1219  DestroyMenu(hpopup);
1220  }
1221 
1222  return S_OK;
1223  }
1224 
1225  if (uMsg != DFM_INVOKECOMMAND || wParam != DFM_CMD_PROPERTIES)
1226  return S_OK;
1227 
1228  return Shell_DefaultContextMenuCallBack(this, pdtobj);
1229 }
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:490
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:2354
#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: /* Type */
733  {
734  /* We want to return immediately because SHELL32_CompareDetails also compares children. */
735  return SHELL32_CompareDetails(this, lParam, pidl1, pidl2);
736  }
737  case 2: /* Size */
738  case 3: /* Size Available */
739  {
740  ULARGE_INTEGER Drive1Available, Drive1Total, Drive2Available, Drive2Total;
741 
742  if (GetVolumeInformationA(pszDrive1, NULL, 0, NULL, NULL, NULL, NULL, 0))
743  GetDiskFreeSpaceExA(pszDrive1, &Drive1Available, &Drive1Total, NULL);
744  else
745  Drive1Available.QuadPart = Drive1Total.QuadPart = 0;
746 
747  if (GetVolumeInformationA(pszDrive2, NULL, 0, NULL, NULL, NULL, NULL, 0))
748  GetDiskFreeSpaceExA(pszDrive2, &Drive2Available, &Drive2Total, NULL);
749  else
750  Drive2Available.QuadPart = Drive2Total.QuadPart = 0;
751 
752  LARGE_INTEGER Diff;
753  if (lParam == 3) /* Size */
754  Diff.QuadPart = Drive1Total.QuadPart - Drive2Total.QuadPart;
755  else /* Size available */
756  Diff.QuadPart = Drive1Available.QuadPart - Drive2Available.QuadPart;
757 
759  break;
760  }
761  case 4: /* comments */
763  break;
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:2187
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:233
#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:256
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1964
#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:285
IContextMenuCB * pcmcb
Definition: shlobj.h:2389
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:427
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3900
#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 1053 of file CDrivesFolder.cpp.

1054 {
1055  FIXME ("(%p)\n", this);
1056  return E_NOTIMPL;
1057 }
#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:776
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 825 of file CDrivesFolder.cpp.

826 {
827  TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
828  this, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
829 
830  if (cidl && !apidl)
831  return E_INVALIDARG;
832 
833  if (*rgfInOut == 0)
834  *rgfInOut = ~0;
835 
836  /* FIXME: always add SFGAO_CANLINK */
837  if(cidl == 0)
838  *rgfInOut &= dwComputerAttributes;
839  else
840  {
841  for (UINT i = 0; i < cidl; ++i)
842  {
843  if (_ILIsDrive(apidl[i]))
844  *rgfInOut &= dwDriveAttributes;
845  else if (_ILIsControlPanel(apidl[i]))
846  *rgfInOut &= dwControlPanelAttributes;
847  else if (_ILIsSpecialFolder(*apidl))
848  m_regFolder->GetAttributesOf(1, &apidl[i], rgfInOut);
849  else
850  ERR("Got unknown pidl type!\n");
851  }
852  }
853 
854  /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
855  *rgfInOut &= ~SFGAO_VALIDATE;
856 
857  TRACE ("-- result=0x%08x\n", *rgfInOut);
858  return S_OK;
859 }
BOOL _ILIsControlPanel(LPCITEMIDLIST pidl)
Definition: pidl.c:1920
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
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1964
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 1156 of file CDrivesFolder.cpp.

1157 {
1158  TRACE ("(%p)\n", this);
1159 
1160  if (!lpClassId)
1161  return E_POINTER;
1162 
1163  *lpClassId = CLSID_MyComputer;
1164  return S_OK;
1165 }
#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 1180 of file CDrivesFolder.cpp.

1181 {
1182  TRACE("(%p)->(%p)\n", this, pidl);
1183 
1184  if (!pidl)
1185  return E_INVALIDARG; /* xp doesn't have this check and crashes on NULL */
1186 
1187  *pidl = ILClone(pidlRoot);
1188  return S_OK;
1189 }
#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 1059 of file CDrivesFolder.cpp.

1060 {
1061  TRACE ("(%p)\n", this);
1062 
1063  if (pSort)
1064  *pSort = 0;
1065  if (pDisplay)
1066  *pDisplay = 0;
1067  return S_OK;
1068 }
#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 1070 of file CDrivesFolder.cpp.

1071 {
1072  TRACE ("(%p)\n", this);
1073 
1074  if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
1075  return E_INVALIDARG;
1076  *pcsFlags = MyComputerSFHeader[iColumn].pcsFlags;
1077  return S_OK;
1078 }
#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 1047 of file CDrivesFolder.cpp.

1048 {
1049  FIXME ("(%p)\n", this);
1050  return E_NOTIMPL;
1051 }
#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 1080 of file CDrivesFolder.cpp.

1081 {
1082  FIXME ("(%p)\n", this);
1083  return E_NOTIMPL;
1084 }
#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 1086 of file CDrivesFolder.cpp.

1087 {
1088  HRESULT hr;
1089 
1090  TRACE ("(%p)->(%p %i %p)\n", this, pidl, iColumn, psd);
1091 
1092  if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
1093  return E_INVALIDARG;
1094 
1095  if (!pidl)
1096  {
1097  psd->fmt = MyComputerSFHeader[iColumn].fmt;
1098  psd->cxChar = MyComputerSFHeader[iColumn].cxChar;
1099  return SHSetStrRet(&psd->str, MyComputerSFHeader[iColumn].colnameid);
1100  }
1101  else if (!_ILIsDrive(pidl))
1102  {
1103  return m_regFolder->GetDetailsOf(pidl, iColumn, psd);
1104  }
1105  else
1106  {
1107  ULARGE_INTEGER ulTotalBytes, ulFreeBytes;
1108  CHAR* pszDrive = _ILGetDataPointer(pidl)->u.drive.szDriveName;
1109  UINT DriveType = GetDriveTypeA(pszDrive);
1110  if (DriveType > DRIVE_RAMDISK)
1112 
1113  switch (iColumn)
1114  {
1115  case 0: /* name */
1117  break;
1118  case 1: /* type */
1119  if (DriveType == DRIVE_REMOVABLE && !IsDriveFloppyA(pszDrive))
1120  hr = SHSetStrRet(&psd->str, IDS_DRIVE_REMOVABLE);
1121  else
1122  hr = SHSetStrRet(&psd->str, iDriveTypeIds[DriveType]);
1123  break;
1124  case 2: /* total size */
1125  case 3: /* free size */
1126  psd->str.cStr[0] = 0x00;
1127  psd->str.uType = STRRET_CSTR;
1128  if (GetVolumeInformationA(pszDrive, NULL, 0, NULL, NULL, NULL, NULL, 0))
1129  {
1130  GetDiskFreeSpaceExA(pszDrive, &ulFreeBytes, &ulTotalBytes, NULL);
1131  if (iColumn == 2)
1132  StrFormatByteSize64A(ulTotalBytes.QuadPart, psd->str.cStr, MAX_PATH);
1133  else
1134  StrFormatByteSize64A(ulFreeBytes.QuadPart, psd->str.cStr, MAX_PATH);
1135  }
1136  hr = S_OK;
1137  break;
1138  case 4: /* FIXME: comments */
1139  hr = SHSetStrRet(&psd->str, "");
1140  break;
1141  }
1142  }
1143 
1144  return hr;
1145 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2187
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:1964
#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 930 of file CDrivesFolder.cpp.

931 {
932  LPWSTR pszPath;
933  HRESULT hr = S_OK;
934 
935  TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl, dwFlags, strRet);
936  pdump (pidl);
937 
938  if (!strRet)
939  return E_INVALIDARG;
940 
941  if (!_ILIsPidlSimple (pidl))
942  {
943  return SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags, strRet);
944  }
945  else if (_ILIsSpecialFolder(pidl))
946  {
947  return m_regFolder->GetDisplayNameOf(pidl, dwFlags, strRet);
948  }
949  else if (!_ILIsDrive(pidl))
950  {
951  ERR("Wrong pidl type\n");
952  return E_INVALIDARG;
953  }
954 
955  pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
956  if (!pszPath)
957  return E_OUTOFMEMORY;
958 
959  pszPath[0] = 0;
960 
961  _ILSimpleGetTextW(pidl, pszPath, MAX_PATH); /* append my own path */
962  /* long view "lw_name (C:)" */
963  if (!(dwFlags & SHGDN_FORPARSING))
964  {
965  WCHAR wszDrive[18] = {0};
966  DWORD dwVolumeSerialNumber, dwMaximumComponentLength, dwFileSystemFlags;
967 
968  lstrcpynW(wszDrive, pszPath, 4);
969  pszPath[0] = L'\0';
970  GetVolumeInformationW(wszDrive, pszPath,
971  MAX_PATH - 7,
972  &dwVolumeSerialNumber,
973  &dwMaximumComponentLength, &dwFileSystemFlags, NULL, 0);
974  pszPath[MAX_PATH-1] = L'\0';
975  if (!wcslen(pszPath))
976  {
977  UINT DriveType, ResourceId;
978  DriveType = GetDriveTypeW(wszDrive);
979  switch(DriveType)
980  {
981  case DRIVE_FIXED:
982  ResourceId = IDS_DRIVE_FIXED;
983  break;
984  case DRIVE_REMOTE:
985  ResourceId = IDS_DRIVE_NETWORK;
986  break;
987  case DRIVE_CDROM:
988  ResourceId = IDS_DRIVE_CDROM;
989  break;
990  default:
991  ResourceId = 0;
992  }
993  if (ResourceId)
994  {
995  dwFileSystemFlags = LoadStringW(shell32_hInstance, ResourceId, pszPath, MAX_PATH);
996  if (dwFileSystemFlags > MAX_PATH - 7)
997  pszPath[MAX_PATH-7] = L'\0';
998  }
999  }
1000  wcscat (pszPath, L" (");
1001  wszDrive[2] = L'\0';
1002  wcscat (pszPath, wszDrive);
1003  wcscat (pszPath, L")");
1004  }
1005 
1006  if (SUCCEEDED(hr))
1007  {
1008  strRet->uType = STRRET_WSTR;
1009  strRet->pOleStr = pszPath;
1010  }
1011  else
1012  CoTaskMemFree(pszPath);
1013 
1014  TRACE("-- (%p)->(%s)\n", this, strRet->uType == STRRET_CSTR ? strRet->cStr : debugstr_w(strRet->pOleStr));
1015  return hr;
1016 }
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:215
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2107
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:1964
_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:311
_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 873 of file CDrivesFolder.cpp.

876 {
877  LPVOID pObj = NULL;
879 
880  TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", this,
881  hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
882 
883  if (!ppvOut)
884  return hr;
885 
886  *ppvOut = NULL;
887 
888  if (IsEqualIID (riid, IID_IContextMenu) && (cidl >= 1))
889  {
890  if (_ILIsDrive(apidl[0]))
891  hr = CDrivesContextMenu_CreateInstance(pidlRoot, hwndOwner, cidl, apidl, static_cast<IShellFolder*>(this), (IContextMenu**)&pObj);
892  else
893  hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
894  }
895  else if (IsEqualIID (riid, IID_IDataObject) && (cidl >= 1))
896  {
897  hr = IDataObject_Constructor (hwndOwner,
898  pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
899  }
900  else if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
901  {
902  if (_ILIsDrive(apidl[0]))
903  hr = CDrivesExtractIcon_CreateInstance(this, apidl[0], riid, &pObj);
904  else
905  hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
906  }
907  else if (IsEqualIID (riid, IID_IDropTarget) && (cidl == 1))
908  {
909  CComPtr<IShellFolder> psfChild;
910  hr = this->BindToObject(apidl[0], NULL, IID_PPV_ARG(IShellFolder, &psfChild));
911  if (FAILED_UNEXPECTEDLY(hr))
912  return hr;
913 
914  return psfChild->CreateViewObject(NULL, riid, ppvOut);
915  }
916  else
917  hr = E_NOINTERFACE;
918 
919  if (SUCCEEDED(hr) && !pObj)
920  hr = E_OUTOFMEMORY;
921 
922  *ppvOut = pObj;
923  TRACE ("(%p)->hr=0x%08x\n", this, hr);
924  return hr;
925 }
#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:427
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:1964
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 1172 of file CDrivesFolder.cpp.

1173 {
1174  return S_OK;
1175 }
#define S_OK
Definition: intsafe.h:52

◆ MapColumnToSCID()

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

Implements IShellFolder2.

Definition at line 1147 of file CDrivesFolder.cpp.

1148 {
1149  FIXME("(%p)\n", this);
1150  return E_NOTIMPL;
1151 }
#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:88
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1964
#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 1030 of file CDrivesFolder.cpp.

1032 {
1033  WCHAR szName[30];
1034 
1035  if (_ILIsDrive(pidl))
1036  {
1037  if (_ILSimpleGetTextW(pidl, szName, _countof(szName)))
1039  if (pPidlOut)
1040  *pPidlOut = _ILCreateDrive(szName);
1041  return S_OK;
1042  }
1043 
1044  return m_regFolder->SetNameOf(hwndOwner, pidl, lpName, dwFlags, pPidlOut);
1045 }
static const WCHAR szName[]
Definition: powrprof.c:45
LPITEMIDLIST _ILCreateDrive(LPCWSTR lpszNew)
Definition: pidl.c:1808
_In_ LPCSTR lpName
Definition: winbase.h:2773
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2107
__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:1964
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:52

Member Data Documentation

◆ m_regFolder

◆ pidlRoot

LPITEMIDLIST CDrivesFolder::pidlRoot
private

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