ReactOS 0.4.15-dev-8241-g63935f8
CDrivesFolder Class Reference

#include <CDrivesFolder.h>

Inheritance diagram for CDrivesFolder:
Collaboration diagram for CDrivesFolder:

Public Member Functions

 CDrivesFolder ()
 
 ~CDrivesFolder ()
 
HRESULT WINAPI FinalConstruct ()
 
STDMETHOD() ParseDisplayName (HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes) override
 
STDMETHOD() EnumObjects (HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override
 
STDMETHOD() BindToObject (PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
 
STDMETHOD() BindToStorage (PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
 
STDMETHOD() CompareIDs (LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) override
 
STDMETHOD() CreateViewObject (HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override
 
STDMETHOD() GetAttributesOf (UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override
 
STDMETHOD() GetUIObjectOf (HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut) override
 
STDMETHOD() GetDisplayNameOf (PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
 
STDMETHOD() SetNameOf (HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override
 
STDMETHOD() GetDefaultSearchGUID (GUID *pguid) override
 
STDMETHOD() EnumSearches (IEnumExtraSearch **ppenum) override
 
STDMETHOD() GetDefaultColumn (DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override
 
STDMETHOD() GetDefaultColumnState (UINT iColumn, DWORD *pcsFlags) override
 
STDMETHOD() GetDetailsEx (PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override
 
STDMETHOD() GetDetailsOf (PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override
 
STDMETHOD() MapColumnToSCID (UINT column, SHCOLUMNID *pscid) override
 
STDMETHOD() GetClassID (CLSID *lpClassId) override
 
STDMETHOD() Initialize (PCIDLIST_ABSOLUTE pidl) override
 
STDMETHOD() GetCurFolder (PIDLIST_ABSOLUTE *pidl) override
 
STDMETHOD() CallBack (IShellFolder *psf, HWND hwndOwner, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam) override
 
- 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 ()
 
HRESULT GetDefaultSearchGUID ([out] GUID *lpguid)
 
HRESULT EnumSearches ([out] IEnumExtraSearch **ppenum)
 
HRESULT GetDefaultColumn ([in] DWORD dwReserved, [out] ULONG *pSort, [out] ULONG *pDisplay)
 
HRESULT GetDefaultColumnState ([in] UINT iColumn, [out] SHCOLSTATEF *pcsFlags)
 
HRESULT GetDetailsEx ([in] PCUITEMID_CHILD pidl, [in] const SHCOLUMNID *pscid, [out] VARIANT *pv)
 
HRESULT GetDetailsOf ([in] PCUITEMID_CHILD pidl, [in] UINT iColumn, [out] SHELLDETAILS *psd)
 
HRESULT MapColumnToSCID ([in] UINT iColumn, [in] SHCOLUMNID *pscid)
 
- 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 CompareIDs ([in] LPARAM lParam, [in] PCUIDLIST_RELATIVE pidl1, [in] PCUIDLIST_RELATIVE pidl2)
 
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)
 
HRESULT SetNameOf ([in] HWND hwnd, [in] PCUITEMID_CHILD pidl, [in, string] LPCOLESTR lpszName, [in] SHGDNF uFlags, [out] PITEMID_CHILD *ppidlOut)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
HRESULT GetCurFolder ([out] PIDLIST_ABSOLUTE *ppidl)
 
HRESULT Initialize ([in] PCIDLIST_ABSOLUTE pidl)
 
HRESULT GetClassID ([out] CLSID *pClassID)
 
HRESULT CallBack ([in] IShellFolder *psf, [in] HWND hwndOwner, [in] IDataObject *pdtobj, [in] UINT uMsg, [in] WPARAM wParam, [in] LPARAM lParam)
 

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

Detailed Description

Definition at line 26 of file CDrivesFolder.h.

Constructor & Destructor Documentation

◆ CDrivesFolder()

CDrivesFolder::CDrivesFolder ( )

Definition at line 629 of file CDrivesFolder.cpp.

630{
631 pidlRoot = NULL;
632}
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:35
#define NULL
Definition: types.h:112

◆ ~CDrivesFolder()

CDrivesFolder::~CDrivesFolder ( )

Definition at line 634 of file CDrivesFolder.cpp.

635{
636 TRACE("-- destroying IShellFolder(%p)\n", this);
638}
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
#define TRACE(s)
Definition: solgame.cpp:4

Member Function Documentation

◆ BindToObject()

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

Definition at line 745 of file CDrivesFolder.cpp.

746{
747 TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", this,
748 pidl, pbcReserved, shdebugstr_guid(&riid), ppvOut);
749
750 if (!pidl)
751 return E_INVALIDARG;
752
753 if (_ILIsSpecialFolder(pidl))
754 return m_regFolder->BindToObject(pidl, pbcReserved, riid, ppvOut);
755
756 CHAR* pchDrive = _ILGetDataPointer(pidl)->u.drive.szDriveName;
757
758 PERSIST_FOLDER_TARGET_INFO pfti = {0};
759 pfti.dwAttributes = -1;
760 pfti.csidl = -1;
761 pfti.szTargetParsingName[0] = *pchDrive;
762 pfti.szTargetParsingName[1] = L':';
763 pfti.szTargetParsingName[2] = L'\\';
764
766 &pfti,
767 pidl,
768 &CLSID_ShellFSFolder,
769 riid,
770 ppvOut);
772 return hr;
773
774 return S_OK;
775}
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:36
#define E_INVALIDARG
Definition: ddrawi.h:101
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:428
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define L(x)
Definition: ntvdm.h:50
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2154
HRESULT SHELL32_BindToSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidl, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: shlfolder.cpp:168
HRESULT hr
Definition: shlfolder.c:183
char CHAR
Definition: xmlstorage.h:175

Referenced by GetUIObjectOf(), and ParseDisplayName().

◆ BindToStorage()

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

Definition at line 780 of file CDrivesFolder.cpp.

781{
782 FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this,
783 pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
784
785 *ppvOut = NULL;
786 return E_NOTIMPL;
787}
#define FIXME(fmt,...)
Definition: debug.h:114
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CallBack()

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

Implements IContextMenuCB.

Definition at line 1308 of file CDrivesFolder.cpp.

1309{
1310 enum { IDC_PROPERTIES };
1311 /* no data object means no selection */
1312 if (!pdtobj)
1313 {
1314 if (uMsg == DFM_INVOKECOMMAND && wParam == IDC_PROPERTIES)
1315 {
1316 // "System" properties
1317 return SHELL_ExecuteControlPanelCPL(hwndOwner, L"sysdm.cpl") ? S_OK : E_FAIL;
1318 }
1319 else if (uMsg == DFM_MERGECONTEXTMENU)
1320 {
1321 QCMINFO *pqcminfo = (QCMINFO *)lParam;
1322 HMENU hpopup = CreatePopupMenu();
1324 pqcminfo->idCmdFirst = Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
1325 DestroyMenu(hpopup);
1326 return S_OK;
1327 }
1328 }
1329 return SHELL32_DefaultContextMenuCallBack(psf, pdtobj, uMsg);
1330}
#define IDS_PROPERTIES
Definition: resource.h:102
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_FAIL
Definition: ddrawi.h:102
#define TRUE
Definition: types.h:120
#define IDC_PROPERTIES
Definition: resource.h:32
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:44
#define DFM_INVOKECOMMAND
Definition: precomp.h:45
#define SHELL_ExecuteControlPanelCPL(hwnd, cpl)
Definition: precomp.h:154
HRESULT SHELL32_DefaultContextMenuCallBack(IShellFolder *psf, IDataObject *pdo, UINT msg)
Definition: shlfolder.cpp:522
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:856
#define MM_ADDSEPARATOR
Definition: shlobj.h:2521
HMENU hmenu
Definition: shlobj.h:1389
UINT idCmdLast
Definition: shlobj.h:1392
UINT idCmdFirst
Definition: shlobj.h:1391
UINT indexMenu
Definition: shlobj.h:1390
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define MFS_ENABLED
Definition: winuser.h:750
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define MFT_STRING
Definition: winuser.h:746
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ CompareIDs()

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

Implements IShellFolder.

Definition at line 793 of file CDrivesFolder.cpp.

794{
796
797 if (!pidl1 || !pidl2)
798 {
799 ERR("Got null pidl pointer (%Ix %p %p)!\n", lParam, pidl1, pidl2);
800 return E_INVALIDARG;
801 }
802
803 if (_ILIsSpecialFolder(pidl1) || _ILIsSpecialFolder(pidl2))
804 return m_regFolder->CompareIDs(lParam, pidl1, pidl2);
805
806 UINT iColumn = LOWORD(lParam);
807 if (!_ILIsDrive(pidl1) || !_ILIsDrive(pidl2) || iColumn >= _countof(MyComputerSFHeader))
808 return E_INVALIDARG;
809
810 CHAR* pszDrive1 = _ILGetDataPointer(pidl1)->u.drive.szDriveName;
811 CHAR* pszDrive2 = _ILGetDataPointer(pidl2)->u.drive.szDriveName;
812
813 int result;
814 switch (MyComputerSFHeader[iColumn].colnameid)
815 {
817 {
818 result = stricmp(pszDrive1, pszDrive2);
820 break;
821 }
823 {
824 /* We want to return immediately because SHELL32_CompareDetails also compares children. */
825 return SHELL32_CompareDetails(this, lParam, pidl1, pidl2);
826 }
829 {
830 ULARGE_INTEGER Drive1Available, Drive1Total, Drive2Available, Drive2Total;
831
832 if (GetVolumeInformationA(pszDrive1, NULL, 0, NULL, NULL, NULL, NULL, 0))
833 GetDiskFreeSpaceExA(pszDrive1, &Drive1Available, &Drive1Total, NULL);
834 else
835 Drive1Available.QuadPart = Drive1Total.QuadPart = 0;
836
837 if (GetVolumeInformationA(pszDrive2, NULL, 0, NULL, NULL, NULL, NULL, 0))
838 GetDiskFreeSpaceExA(pszDrive2, &Drive2Available, &Drive2Total, NULL);
839 else
840 Drive2Available.QuadPart = Drive2Total.QuadPart = 0;
841
842 LARGE_INTEGER Diff;
843 if (lParam == 3) /* Size */
844 Diff.QuadPart = Drive1Total.QuadPart - Drive2Total.QuadPart;
845 else /* Size available */
846 Diff.QuadPart = Drive1Available.QuadPart - Drive2Available.QuadPart;
847
849 break;
850 }
853 break;
855 }
856
857 if (HRESULT_CODE(hres) == 0)
858 return SHELL32_CompareChildren(this, lParam, pidl1, pidl2);
859
860 return hres;
861}
static const shvheader MyComputerSFHeader[]
#define ERR(fmt,...)
Definition: debug.h:113
#define IDS_SHV_COLUMN_TYPE
Definition: resource.h:75
#define IDS_SHV_COLUMN_NAME
Definition: resource.h:74
#define stricmp(_String1, _String2)
Definition: compat.h:24
BOOL WINAPI GetDiskFreeSpaceExA(IN LPCSTR lpDirectoryName OPTIONAL, OUT PULARGE_INTEGER lpFreeBytesAvailableToCaller, OUT PULARGE_INTEGER lpTotalNumberOfBytes, OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
Definition: disk.c:313
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
GLuint64EXT * result
Definition: glext.h:11304
HRESULT hres
Definition: protocol.c:465
unsigned int UINT
Definition: ndis.h:50
#define DEFAULT_UNREACHABLE
#define LOWORD(l)
Definition: pedump.c:82
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:2003
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:607
HRESULT SHELL32_CompareChildren(IShellFolder2 *psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:224
HRESULT SHELL32_CompareDetails(IShellFolder2 *isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:247
#define IDS_SHV_COLUMN_DISK_AVAILABLE
Definition: shresdef.h:57
#define IDS_SHV_COLUMN_DISK_CAPACITY
Definition: shresdef.h:56
#define IDS_SHV_COLUMN_COMMENTS
Definition: shresdef.h:69
#define _countof(array)
Definition: sndvol32.h:70
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
LONGLONG QuadPart
Definition: typedefs.h:114
#define HRESULT_CODE(hr)
Definition: winerror.h:76

◆ CreateViewObject()

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

Definition at line 866 of file CDrivesFolder.cpp.

867{
868 CComPtr<IShellView> pShellView;
870
871 TRACE("(%p)->(hwnd=%p,%s,%p)\n", this,
872 hwndOwner, shdebugstr_guid (&riid), ppvOut);
873
874 if (!ppvOut)
875 return hr;
876
877 *ppvOut = NULL;
878
879 if (IsEqualIID(riid, IID_IDropTarget))
880 {
881 WARN("IDropTarget not implemented\n");
882 hr = E_NOTIMPL;
883 }
884 else if (IsEqualIID(riid, IID_IContextMenu))
885 {
886 HKEY hKeys[16];
887 UINT cKeys = 0;
888 AddClassKeyToArray(L"Directory\\Background", hKeys, &cKeys);
889
890 DEFCONTEXTMENU dcm;
891 dcm.hwnd = hwndOwner;
892 dcm.pcmcb = this;
893 dcm.pidlFolder = pidlRoot;
894 dcm.psf = this;
895 dcm.cidl = 0;
896 dcm.apidl = NULL;
897 dcm.cKeys = cKeys;
898 dcm.aKeys = hKeys;
900 hr = SHCreateDefaultContextMenu(&dcm, riid, ppvOut);
901 }
902 else if (IsEqualIID(riid, IID_IShellView))
903 {
904 SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
905 hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
906 }
907 TRACE("-- (%p)->(interface=%p)\n", this, ppvOut);
908 return hr;
909}
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:4372
HRESULT WINAPI SHCreateDefaultContextMenu(const DEFCONTEXTMENU *pdcm, REFIID riid, void **ppv)
#define WARN(fmt,...)
Definition: debug.h:115
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
LSTATUS AddClassKeyToArray(const WCHAR *szClass, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:277
struct _SFV_CREATE SFV_CREATE
IContextMenuCB * pcmcb
Definition: shlobj.h:2543
IShellFolder * psf
Definition: shlobj.h:2545
IUnknown * punkAssociationInfo
Definition: shlobj.h:2548
PCUITEMID_CHILD_ARRAY apidl
Definition: shlobj.h:2547
const HKEY * aKeys
Definition: shlobj.h:2550
PCIDLIST_ABSOLUTE pidlFolder
Definition: shlobj.h:2544

◆ EnumObjects()

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

Definition at line 734 of file CDrivesFolder.cpp.

735{
736 CComPtr<IEnumIDList> pRegEnumerator;
737 m_regFolder->EnumObjects(hwndOwner, dwFlags, &pRegEnumerator);
738
739 return ShellObjectCreatorInit<CDrivesFolderEnum>(hwndOwner, dwFlags, pRegEnumerator, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
740}
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define IID_PPV_ARG(Itype, ppType)

◆ EnumSearches()

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

Implements IShellFolder2.

Definition at line 1155 of file CDrivesFolder.cpp.

1156{
1157 FIXME("(%p)\n", this);
1158 return E_NOTIMPL;
1159}

◆ FinalConstruct()

HRESULT WINAPI CDrivesFolder::FinalConstruct ( )

Definition at line 640 of file CDrivesFolder.cpp.

641{
642 pidlRoot = _ILCreateMyComputer(); /* my qualified pidl */
643 if (pidlRoot == NULL)
644 return E_OUTOFMEMORY;
645
646 HRESULT hr = CRegFolder_CreateInstance(&CLSID_MyComputer,
647 pidlRoot,
648 L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
649 L"MyComputer",
651
652 return hr;
653}
HRESULT CRegFolder_CreateInstance(const GUID *pGuid, LPCITEMIDLIST pidlRoot, LPCWSTR lpszPath, LPCWSTR lpszEnumKeyName, REFIID riid, void **ppv)
Definition: CRegFolder.cpp:865
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
LPITEMIDLIST _ILCreateMyComputer(void)
Definition: pidl.c:1646

◆ GetAttributesOf()

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

Definition at line 914 of file CDrivesFolder.cpp.

915{
916 TRACE("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
917 this, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
918
919 if (cidl && !apidl)
920 return E_INVALIDARG;
921
922 if (*rgfInOut == 0)
923 *rgfInOut = ~0;
924
925 /* FIXME: always add SFGAO_CANLINK */
926 if(cidl == 0)
927 *rgfInOut &= dwComputerAttributes;
928 else
929 {
930 for (UINT i = 0; i < cidl; ++i)
931 {
932 if (_ILIsDrive(apidl[i]))
933 {
934 *rgfInOut &= dwDriveAttributes;
935
936 if (_ILGetDriveType(apidl[i]) == DRIVE_CDROM)
937 *rgfInOut &= ~SFGAO_CANRENAME; // CD-ROM drive cannot rename
938 }
939 else if (_ILIsControlPanel(apidl[i]))
940 *rgfInOut &= dwControlPanelAttributes;
941 else if (_ILIsSpecialFolder(*apidl))
942 m_regFolder->GetAttributesOf(1, &apidl[i], rgfInOut);
943 else
944 ERR("Got unknown pidl type!\n");
945 }
946 }
947
948 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
949 *rgfInOut &= ~SFGAO_VALIDATE;
950
951 TRACE("-- result=0x%08x\n", *rgfInOut);
952 return S_OK;
953}
BOOL _ILGetDriveType(LPCITEMIDLIST pidl)
static const DWORD dwComputerAttributes
static const DWORD dwDriveAttributes
static const DWORD dwControlPanelAttributes
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
#define DRIVE_CDROM
Definition: machpc98.h:119
BOOL _ILIsControlPanel(LPCITEMIDLIST pidl)
Definition: pidl.c:1959

Referenced by ParseDisplayName().

◆ GetClassID()

HRESULT WINAPI CDrivesFolder::GetClassID ( CLSID lpClassId)
override

Implements IPersist.

Definition at line 1270 of file CDrivesFolder.cpp.

1271{
1272 TRACE("(%p)\n", this);
1273
1274 if (!lpClassId)
1275 return E_POINTER;
1276
1277 *lpClassId = CLSID_MyComputer;
1278 return S_OK;
1279}
#define E_POINTER
Definition: winerror.h:2365

◆ GetCurFolder()

HRESULT WINAPI CDrivesFolder::GetCurFolder ( PIDLIST_ABSOLUTE pidl)
override

Implements IPersistFolder2.

Definition at line 1294 of file CDrivesFolder.cpp.

1295{
1296 TRACE("(%p)->(%p)\n", this, pidl);
1297
1298 if (!pidl)
1299 return E_INVALIDARG; /* xp doesn't have this check and crashes on NULL */
1300
1301 *pidl = ILClone(pidlRoot);
1302 return S_OK;
1303}
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237

◆ GetDefaultColumn()

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

Implements IShellFolder2.

Definition at line 1161 of file CDrivesFolder.cpp.

1162{
1163 TRACE("(%p)\n", this);
1164
1165 if (pSort)
1166 *pSort = 0;
1167 if (pDisplay)
1168 *pDisplay = 0;
1169 return S_OK;
1170}

◆ GetDefaultColumnState()

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

Implements IShellFolder2.

Definition at line 1172 of file CDrivesFolder.cpp.

1173{
1174 TRACE("(%p)\n", this);
1175
1176 if (!pcsFlags || iColumn >= _countof(MyComputerSFHeader))
1177 return E_INVALIDARG;
1178 *pcsFlags = MyComputerSFHeader[iColumn].colstate;
1179 return S_OK;
1180}
WORD colstate
Definition: shfldr.h:31

◆ GetDefaultSearchGUID()

HRESULT WINAPI CDrivesFolder::GetDefaultSearchGUID ( GUID pguid)
override

Implements IShellFolder2.

Definition at line 1149 of file CDrivesFolder.cpp.

1150{
1151 FIXME("(%p)\n", this);
1152 return E_NOTIMPL;
1153}

◆ GetDetailsEx()

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

Implements IShellFolder2.

Definition at line 1182 of file CDrivesFolder.cpp.

1183{
1184 FIXME("(%p)\n", this);
1185 return E_NOTIMPL;
1186}

◆ GetDetailsOf()

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

Implements IShellFolder2.

Definition at line 1188 of file CDrivesFolder.cpp.

1189{
1190 HRESULT hr;
1191
1192 TRACE("(%p)->(%p %i %p)\n", this, pidl, iColumn, psd);
1193
1194 if (!psd || iColumn >= _countof(MyComputerSFHeader))
1195 return E_INVALIDARG;
1196
1197 if (!pidl)
1198 {
1199 psd->fmt = MyComputerSFHeader[iColumn].fmt;
1200 psd->cxChar = MyComputerSFHeader[iColumn].cxChar;
1201 return SHSetStrRet(&psd->str, MyComputerSFHeader[iColumn].colnameid);
1202 }
1203 else if (!_ILIsDrive(pidl))
1204 {
1205 switch (MyComputerSFHeader[iColumn].colnameid)
1206 {
1209 return m_regFolder->GetDetailsOf(pidl, iColumn, psd);
1212 return SHSetStrRet(&psd->str, ""); /* blank col */
1214 return m_regFolder->GetDetailsOf(pidl, 2, psd); /* 2 = comments */
1216 }
1217 }
1218 else
1219 {
1220 ULARGE_INTEGER ulTotalBytes, ulFreeBytes;
1221 CHAR* pszDrive = _ILGetDataPointer(pidl)->u.drive.szDriveName;
1222 UINT DriveType = GetDriveTypeA(pszDrive);
1225
1226 switch (MyComputerSFHeader[iColumn].colnameid)
1227 {
1230 break;
1232 if (DriveType == DRIVE_REMOVABLE && !IsDriveFloppyA(pszDrive))
1233 hr = SHSetStrRet(&psd->str, IDS_DRIVE_REMOVABLE);
1234 else
1235 hr = SHSetStrRet(&psd->str, iDriveTypeIds[DriveType]);
1236 break;
1239 psd->str.cStr[0] = 0x00;
1240 psd->str.uType = STRRET_CSTR;
1241 if (GetVolumeInformationA(pszDrive, NULL, 0, NULL, NULL, NULL, NULL, 0))
1242 {
1243 GetDiskFreeSpaceExA(pszDrive, &ulFreeBytes, &ulTotalBytes, NULL);
1244 if (iColumn == 2)
1245 StrFormatByteSize64A(ulTotalBytes.QuadPart, psd->str.cStr, MAX_PATH);
1246 else
1247 StrFormatByteSize64A(ulFreeBytes.QuadPart, psd->str.cStr, MAX_PATH);
1248 }
1249 hr = S_OK;
1250 break;
1252 hr = SHSetStrRet(&psd->str, ""); /* FIXME: comments */
1253 break;
1255 }
1256 }
1257
1258 return hr;
1259}
static int iDriveTypeIds[7]
UINT DriveType
STDMETHOD() GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
#define MAX_PATH
Definition: compat.h:34
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
Definition: disk.c:468
LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
Definition: string.c:2496
BOOL IsDriveFloppyA(LPCSTR pszDriveRoot)
Definition: drvdefext.cpp:386
#define IDS_DRIVE_REMOVABLE
Definition: shresdef.h:117
@ STRRET_CSTR
Definition: shtypes.idl:87
STRRET str
Definition: shtypes.idl:108
char cStr[MAX_PATH]
Definition: shtypes.idl:98
UINT uType
Definition: shtypes.idl:93
#define DRIVE_RAMDISK
Definition: winbase.h:255
#define DRIVE_FIXED
Definition: winbase.h:252
#define DRIVE_REMOVABLE
Definition: winbase.h:251

◆ GetDisplayNameOf()

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

Definition at line 1024 of file CDrivesFolder.cpp.

1025{
1026 LPWSTR pszPath;
1027 HRESULT hr = S_OK;
1028
1029 TRACE("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl, dwFlags, strRet);
1030 pdump (pidl);
1031
1032 if (!strRet)
1033 return E_INVALIDARG;
1034
1035 if (!_ILIsPidlSimple (pidl))
1036 {
1037 return SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags, strRet);
1038 }
1039 else if (_ILIsSpecialFolder(pidl))
1040 {
1041 return m_regFolder->GetDisplayNameOf(pidl, dwFlags, strRet);
1042 }
1043 else if (!_ILIsDrive(pidl))
1044 {
1045 ERR("Wrong pidl type\n");
1046 return E_INVALIDARG;
1047 }
1048
1049 pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
1050 if (!pszPath)
1051 return E_OUTOFMEMORY;
1052
1053 pszPath[0] = 0;
1054
1055 _ILSimpleGetTextW(pidl, pszPath, MAX_PATH); /* append my own path */
1056 /* long view "lw_name (C:)" */
1057 if (!(dwFlags & SHGDN_FORPARSING))
1058 {
1059 WCHAR wszDrive[18] = {0};
1060
1061 lstrcpynW(wszDrive, pszPath, 4);
1062 pszPath[0] = L'\0';
1063
1064 if (!SUCCEEDED(getLabelForDrive(wszDrive, pszPath)))
1065 {
1066 DWORD dwVolumeSerialNumber, dwMaximumComponentLength, dwFileSystemFlags;
1067
1068 GetVolumeInformationW(wszDrive, pszPath,
1069 MAX_PATH - 7,
1070 &dwVolumeSerialNumber,
1071 &dwMaximumComponentLength, &dwFileSystemFlags, NULL, 0);
1072 pszPath[MAX_PATH-1] = L'\0';
1073
1074 if (!wcslen(pszPath))
1075 {
1077 DriveType = GetDriveTypeW(wszDrive);
1078
1079 switch (DriveType)
1080 {
1081 case DRIVE_FIXED:
1083 break;
1084 case DRIVE_REMOTE:
1086 break;
1087 case DRIVE_CDROM:
1089 break;
1090 default:
1091 ResourceId = 0;
1092 }
1093
1094 if (ResourceId)
1095 {
1096 dwFileSystemFlags = LoadStringW(shell32_hInstance, ResourceId, pszPath, MAX_PATH);
1097 if (dwFileSystemFlags > MAX_PATH - 7)
1098 pszPath[MAX_PATH-7] = L'\0';
1099 }
1100 }
1101 }
1102 wcscat(pszPath, L" (");
1103 wszDrive[2] = L'\0';
1104 wcscat(pszPath, wszDrive);
1105 wcscat(pszPath, L")");
1106 }
1107
1108 if (SUCCEEDED(hr))
1109 {
1110 strRet->uType = STRRET_WSTR;
1111 strRet->pOleStr = pszPath;
1112 }
1113 else
1114 CoTaskMemFree(pszPath);
1115
1116 TRACE("-- (%p)->(%s)\n", this, strRet->uType == STRRET_CSTR ? strRet->cStr : debugstr_w(strRet->pOleStr));
1117 return hr;
1118}
static HRESULT getLabelForDrive(LPWSTR wszPath, LPWSTR wszLabel)
INT ResourceId
Definition: LoadImageGCC.c:72
#define shell32_hInstance
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:311
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
#define lstrcpynW
Definition: compat.h:738
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
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
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define debugstr_w
Definition: kernel32.h:32
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2074
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
HRESULT SHELL32_GetDisplayNameOfChild(IShellFolder2 *psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: shlfolder.cpp:206
#define IDS_DRIVE_CDROM
Definition: shresdef.h:114
#define IDS_DRIVE_FIXED
Definition: shresdef.h:113
#define IDS_DRIVE_NETWORK
Definition: shresdef.h:115
@ STRRET_WSTR
Definition: shtypes.idl:85
LPWSTR pOleStr
Definition: shtypes.idl:96
#define DRIVE_REMOTE
Definition: winbase.h:253
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by GetDetailsOf().

◆ GetUIObjectOf()

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

Definition at line 967 of file CDrivesFolder.cpp.

970{
971 LPVOID pObj = NULL;
973
974 TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", this,
975 hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
976
977 if (!ppvOut)
978 return hr;
979
980 *ppvOut = NULL;
981
982 if (IsEqualIID (riid, IID_IContextMenu) && (cidl >= 1))
983 {
984 if (_ILIsDrive(apidl[0]))
985 hr = CDrivesContextMenu_CreateInstance(pidlRoot, hwndOwner, cidl, apidl, static_cast<IShellFolder*>(this), (IContextMenu**)&pObj);
986 else
987 hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
988 }
989 else if (IsEqualIID (riid, IID_IDataObject) && (cidl >= 1))
990 {
991 hr = IDataObject_Constructor(hwndOwner,
992 pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
993 }
994 else if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
995 {
996 if (_ILIsDrive(apidl[0]))
997 hr = CDrivesExtractIcon_CreateInstance(this, apidl[0], riid, &pObj);
998 else
999 hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
1000 }
1001 else if (IsEqualIID (riid, IID_IDropTarget) && (cidl == 1))
1002 {
1003 CComPtr<IShellFolder> psfChild;
1004 hr = this->BindToObject(apidl[0], NULL, IID_PPV_ARG(IShellFolder, &psfChild));
1006 return hr;
1007
1008 return psfChild->CreateViewObject(NULL, riid, ppvOut);
1009 }
1010 else
1011 hr = E_NOINTERFACE;
1012
1013 if (SUCCEEDED(hr) && !pObj)
1014 hr = E_OUTOFMEMORY;
1015
1016 *ppvOut = pObj;
1017 TRACE("(%p)->hr=0x%08x\n", this, hr);
1018 return hr;
1019}
HRESULT CDrivesContextMenu_CreateInstance(PCIDLIST_ABSOLUTE pidlFolder, HWND hwnd, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IShellFolder *psf, IContextMenu **ppcm)
HRESULT CDrivesExtractIcon_CreateInstance(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
HRESULT IDataObject_Constructor(HWND hwndOwner, PCIDLIST_ABSOLUTE pMyPidl, PCUIDLIST_RELATIVE_ARRAY apidl, UINT cidl, BOOL bExtendedObject, IDataObject **dataObject)
STDMETHOD() BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
const GUID IID_IDataObject
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ Initialize()

HRESULT WINAPI CDrivesFolder::Initialize ( PCIDLIST_ABSOLUTE  pidl)
override

Implements IPersistFolder.

Definition at line 1286 of file CDrivesFolder.cpp.

1287{
1288 return S_OK;
1289}

◆ MapColumnToSCID()

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

Implements IShellFolder2.

Definition at line 1261 of file CDrivesFolder.cpp.

1262{
1263 FIXME("(%p)\n", this);
1264 return E_NOTIMPL;
1265}

◆ ParseDisplayName()

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

Definition at line 658 of file CDrivesFolder.cpp.

660{
662
663 TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", this,
664 hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName),
665 pchEaten, ppidl, pdwAttributes);
666
667 if (!ppidl)
668 return hr;
669
670 *ppidl = NULL;
671
672 if (!lpszDisplayName)
673 return hr;
674
675 /* handle CLSID paths */
676 if (lpszDisplayName[0] == L':' && lpszDisplayName[1] == L':')
677 {
678 return m_regFolder->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, pchEaten, ppidl,
679 pdwAttributes);
680 }
681
682 if (lpszDisplayName[0] &&
683 ((L'A' <= lpszDisplayName[0] && lpszDisplayName[0] <= L'Z') ||
684 (L'a' <= lpszDisplayName[0] && lpszDisplayName[0] <= L'z')) &&
685 lpszDisplayName[1] == L':' && lpszDisplayName[2] == L'\\')
686 {
687 // "C:\..."
688 WCHAR szRoot[8];
689 PathBuildRootW(szRoot, ((*lpszDisplayName - 1) & 0x1F));
690
691 if (SHIsFileSysBindCtx(pbc, NULL) != S_OK && !(BindCtx_GetMode(pbc, 0) & STGM_CREATE))
692 {
693 if (::GetDriveType(szRoot) == DRIVE_NO_ROOT_DIR)
695 }
696
697 CComHeapPtr<ITEMIDLIST> pidlTemp(_ILCreateDrive(szRoot));
698 if (!pidlTemp)
699 return E_OUTOFMEMORY;
700
701 if (lpszDisplayName[3])
702 {
703 CComPtr<IShellFolder> pChildFolder;
704 hr = BindToObject(pidlTemp, pbc, IID_PPV_ARG(IShellFolder, &pChildFolder));
706 return hr;
707
708 ULONG chEaten;
709 CComHeapPtr<ITEMIDLIST> pidlChild;
710 hr = pChildFolder->ParseDisplayName(hwndOwner, pbc, &lpszDisplayName[3], &chEaten,
711 &pidlChild, pdwAttributes);
713 return hr;
714
715 hr = SHILCombine(pidlTemp, pidlChild, ppidl);
716 }
717 else
718 {
719 *ppidl = pidlTemp.Detach();
720 if (pdwAttributes && *pdwAttributes)
721 GetAttributesOf(1, (PCUITEMID_CHILD_ARRAY)ppidl, pdwAttributes);
722 hr = S_OK;
723 }
724 }
725
726 TRACE("(%p)->(-- ret=0x%08x)\n", this, hr);
727
728 return hr;
729}
STDMETHOD() GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override
DWORD BindCtx_GetMode(_In_ IBindCtx *pbc, _In_ DWORD dwDefault)
Definition: utils.cpp:128
HRESULT SHIsFileSysBindCtx(_In_ IBindCtx *pBindCtx, _Out_opt_ WIN32_FIND_DATAW *pFindData)
Definition: utils.cpp:153
LPWSTR WINAPI PathBuildRootW(LPWSTR lpszPath, int drive)
Definition: path.c:348
#define STGM_CREATE
Definition: objbase.h:926
LPITEMIDLIST _ILCreateDrive(LPCWSTR lpszNew)
Definition: pidl.c:1849
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
uint32_t ULONG
Definition: typedefs.h:59
#define DRIVE_NO_ROOT_DIR
Definition: winbase.h:257
#define GetDriveType
Definition: winbase.h:3812
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

◆ SetNameOf()

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

Implements IShellFolder.

Definition at line 1132 of file CDrivesFolder.cpp.

1134{
1135 WCHAR szName[30];
1136
1137 if (_ILIsDrive(pidl))
1138 {
1141 if (pPidlOut)
1142 *pPidlOut = _ILCreateDrive(szName);
1143 return S_OK;
1144 }
1145
1146 return m_regFolder->SetNameOf(hwndOwner, pidl, lpName, dwFlags, pPidlOut);
1147}
BOOL WINAPI SetVolumeLabelW(IN LPCWSTR lpRootPathName, IN LPCWSTR lpVolumeName OPTIONAL)
Definition: volume.c:503
static const WCHAR szName[]
Definition: powrprof.c:45
_In_ LPCSTR lpName
Definition: winbase.h:2789

Member Data Documentation

◆ m_regFolder

◆ pidlRoot

LPITEMIDLIST CDrivesFolder::pidlRoot
private

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