2 * Virtual Workplace folder
4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998, 1999, 2002 Juergen Schmied
6 * Copyright 2009 Andrew Hill
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 WINE_DEFAULT_DEBUG_CHANNEL (shell
);
28 CDrivesFolder should create a CRegFolder to represent the virtual items that exist only in
29 the registry. The CRegFolder is aggregated by the CDrivesFolder.
30 The CDrivesFolderEnum class should enumerate only drives on the system. Since the CRegFolder
31 implementation of IShellFolder::EnumObjects enumerates the virtual items, the
32 CDrivesFolderEnum is only responsible for returning the physical items.
34 2. At least on my XP system, the drive pidls returned are of type PT_DRIVE1, not PT_DRIVE
35 3. The parsing name returned for my computer is incorrect. It should be "My Computer"
38 /***********************************************************************
39 * IShellFolder implementation
42 HRESULT
CDrivesExtractIcon_CreateInstance(IShellFolder
* psf
, LPCITEMIDLIST pidl
, REFIID riid
, LPVOID
* ppvOut
)
44 CComPtr
<IDefaultExtractIconInit
> initIcon
;
45 HRESULT hr
= SHCreateDefaultExtractIcon(IID_PPV_ARG(IDefaultExtractIconInit
, &initIcon
));
49 CHAR
* pszDrive
= _ILGetDataPointer(pidl
)->u
.drive
.szDriveName
;
50 WCHAR wTemp
[MAX_PATH
];
55 switch(GetDriveTypeA(pszDrive
))
58 icon_idx
= IDI_SHELL_3_14_FLOPPY
;
61 icon_idx
= IDI_SHELL_CDROM
;
64 icon_idx
= IDI_SHELL_NETDRIVE
;
67 icon_idx
= IDI_SHELL_RAMDISK
;
69 case DRIVE_NO_ROOT_DIR
:
70 icon_idx
= IDI_SHELL_CDROM
;
77 initIcon
->SetNormalIcon(swShell32Name
, -icon_idx
);
81 if (HCR_GetIconW(L
"Drive", wTemp
, NULL
, MAX_PATH
, &icon_idx
))
82 initIcon
->SetNormalIcon(wTemp
, icon_idx
);
84 initIcon
->SetNormalIcon(swShell32Name
, -IDI_SHELL_DRIVE
);
87 return initIcon
->QueryInterface(riid
, ppvOut
);
90 class CDrivesFolderEnum
:
91 public CEnumIDListBase
96 HRESULT WINAPI
Initialize(HWND hwndOwner
, DWORD dwFlags
);
97 BOOL
CreateMyCompEnumList(DWORD dwFlags
);
99 BEGIN_COM_MAP(CDrivesFolderEnum
)
100 COM_INTERFACE_ENTRY_IID(IID_IEnumIDList
, IEnumIDList
)
104 /***********************************************************************
105 * IShellFolder [MyComputer] implementation
108 static const shvheader MyComputerSFHeader
[] = {
109 {IDS_SHV_COLUMN1
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_LEFT
, 15},
110 {IDS_SHV_COLUMN3
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_LEFT
, 10},
111 {IDS_SHV_COLUMN6
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 10},
112 {IDS_SHV_COLUMN7
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 10},
115 #define MYCOMPUTERSHELLVIEWCOLUMNS 4
117 static const DWORD dwComputerAttributes
=
118 SFGAO_CANRENAME
| SFGAO_CANDELETE
| SFGAO_HASPROPSHEET
| SFGAO_DROPTARGET
|
119 SFGAO_FILESYSANCESTOR
| SFGAO_FOLDER
| SFGAO_HASSUBFOLDER
| SFGAO_CANLINK
;
120 static const DWORD dwControlPanelAttributes
=
121 SFGAO_HASSUBFOLDER
| SFGAO_FOLDER
| SFGAO_CANLINK
;
122 static const DWORD dwDriveAttributes
=
123 SFGAO_HASSUBFOLDER
| SFGAO_FILESYSTEM
| SFGAO_FOLDER
| SFGAO_FILESYSANCESTOR
|
124 SFGAO_DROPTARGET
| SFGAO_HASPROPSHEET
| SFGAO_CANRENAME
| SFGAO_CANLINK
;
126 CDrivesFolderEnum::CDrivesFolderEnum()
130 CDrivesFolderEnum::~CDrivesFolderEnum()
134 HRESULT WINAPI
CDrivesFolderEnum::Initialize(HWND hwndOwner
, DWORD dwFlags
)
136 if (CreateMyCompEnumList(dwFlags
) == FALSE
)
142 /**************************************************************************
143 * CDrivesFolderEnum::CreateMyCompEnumList()
146 BOOL
CDrivesFolderEnum::CreateMyCompEnumList(DWORD dwFlags
)
149 static const WCHAR MyComputer_NameSpaceW
[] = L
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\Namespace";
151 TRACE("(%p)->(flags=0x%08x)\n", this, dwFlags
);
153 /* enumerate the folders */
154 if (dwFlags
& SHCONTF_FOLDERS
)
156 WCHAR wszDriveName
[] = {'A', ':', '\\', '\0'};
157 DWORD dwDrivemap
= GetLogicalDrives();
161 while (bRet
&& wszDriveName
[0] <= 'Z')
163 if(dwDrivemap
& 0x00000001L
)
164 bRet
= AddToEnumList(_ILCreateDrive(wszDriveName
));
166 dwDrivemap
= dwDrivemap
>> 1;
169 TRACE("-- (%p)-> enumerate (mycomputer shell extensions)\n", this);
170 for (i
= 0; i
< 2; i
++)
172 if (bRet
&& ERROR_SUCCESS
== RegOpenKeyExW(i
== 0 ? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
,
173 MyComputer_NameSpaceW
, 0, KEY_READ
, &hKey
))
182 dwSize
= sizeof(wszBuf
) / sizeof(wszBuf
[0]);
183 ErrorCode
= RegEnumKeyExW(hKey
, j
, wszBuf
, &dwSize
, 0, NULL
, NULL
, NULL
);
184 if (ERROR_SUCCESS
== ErrorCode
)
186 if (wszBuf
[0] != L
'{')
188 dwSize
= sizeof(wszBuf
);
189 RegGetValueW(hKey
, wszBuf
, NULL
, RRF_RT_REG_SZ
, NULL
, wszBuf
, &dwSize
);
192 /* FIXME: shell extensions - the type should be PT_SHELLEXT (tested) */
193 pidl
= _ILCreateGuidFromStrW(wszBuf
);
195 bRet
= AddToEnumList(pidl
);
197 ERR("Invalid MyComputer namespace extesion: %s\n", wszBuf
);
200 else if (ERROR_NO_MORE_ITEMS
== ErrorCode
)
212 CDrivesFolder::CDrivesFolder()
217 CDrivesFolder::~CDrivesFolder()
219 TRACE ("-- destroying IShellFolder(%p)\n", this);
223 HRESULT WINAPI
CDrivesFolder::FinalConstruct()
225 pidlRoot
= _ILCreateMyComputer(); /* my qualified pidl */
226 if (pidlRoot
== NULL
)
227 return E_OUTOFMEMORY
;
229 HRESULT hr
= CRegFolder_CreateInstance(&CLSID_MyComputer
,
231 L
"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
232 IID_PPV_ARG(IShellFolder2
, &m_regFolder
));
237 /**************************************************************************
238 * CDrivesFolder::ParseDisplayName
240 HRESULT WINAPI
CDrivesFolder::ParseDisplayName(HWND hwndOwner
, LPBC pbc
, LPOLESTR lpszDisplayName
,
241 DWORD
* pchEaten
, PIDLIST_RELATIVE
* ppidl
, DWORD
* pdwAttributes
)
243 HRESULT hr
= E_INVALIDARG
;
244 LPCWSTR szNext
= NULL
;
245 LPITEMIDLIST pidlTemp
= NULL
;
247 TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", this,
248 hwndOwner
, pbc
, lpszDisplayName
, debugstr_w (lpszDisplayName
),
249 pchEaten
, ppidl
, pdwAttributes
);
253 *pchEaten
= 0; /* strange but like the original */
255 /* handle CLSID paths */
256 if (lpszDisplayName
[0] == ':' && lpszDisplayName
[1] == ':')
257 return m_regFolder
->ParseDisplayName(hwndOwner
, pbc
, lpszDisplayName
, pchEaten
, ppidl
, pdwAttributes
);
259 if (PathGetDriveNumberW(lpszDisplayName
) < 0)
262 pidlTemp
= _ILCreateDrive(lpszDisplayName
);
264 return E_OUTOFMEMORY
;
266 if (lpszDisplayName
[2] == L
'\\')
268 szNext
= &lpszDisplayName
[3];
271 if (szNext
&& *szNext
)
273 hr
= SHELL32_ParseNextElement (this, hwndOwner
, pbc
, &pidlTemp
,
274 (LPOLESTR
) szNext
, pchEaten
, pdwAttributes
);
279 if (pdwAttributes
&& *pdwAttributes
)
281 if (_ILIsDrive(pidlTemp
))
282 *pdwAttributes
&= dwDriveAttributes
;
283 else if (_ILIsSpecialFolder(pidlTemp
))
284 m_regFolder
->GetAttributesOf(1, &pidlTemp
, pdwAttributes
);
286 ERR("Got an unkown pidl here!\n");
292 TRACE ("(%p)->(-- ret=0x%08x)\n", this, hr
);
297 /**************************************************************************
298 * CDrivesFolder::EnumObjects
300 HRESULT WINAPI
CDrivesFolder::EnumObjects(HWND hwndOwner
, DWORD dwFlags
, LPENUMIDLIST
*ppEnumIDList
)
302 return ShellObjectCreatorInit
<CDrivesFolderEnum
>(hwndOwner
, dwFlags
, IID_IEnumIDList
, ppEnumIDList
);
305 /**************************************************************************
306 * CDrivesFolder::BindToObject
308 HRESULT WINAPI
CDrivesFolder::BindToObject(PCUIDLIST_RELATIVE pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
*ppvOut
)
310 TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", this,
311 pidl
, pbcReserved
, shdebugstr_guid(&riid
), ppvOut
);
313 if (_ILIsSpecialFolder(pidl
))
314 return m_regFolder
->BindToObject(pidl
, pbcReserved
, riid
, ppvOut
);
316 LPITEMIDLIST pidlChild
= ILCloneFirst (pidl
);
318 return E_OUTOFMEMORY
;
320 CComPtr
<IShellFolder
> psf
;
321 HRESULT hr
= SHELL32_CoCreateInitSF(pidlRoot
,
324 &CLSID_ShellFSFolder
,
326 IID_PPV_ARG(IShellFolder
, &psf
));
333 if (_ILIsPidlSimple (pidl
))
335 return psf
->QueryInterface(riid
, ppvOut
);
339 return psf
->BindToObject(ILGetNext (pidl
), pbcReserved
, riid
, ppvOut
);
343 /**************************************************************************
344 * CDrivesFolder::BindToStorage
346 HRESULT WINAPI
CDrivesFolder::BindToStorage(PCUIDLIST_RELATIVE pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
*ppvOut
)
348 FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this,
349 pidl
, pbcReserved
, shdebugstr_guid (&riid
), ppvOut
);
355 /**************************************************************************
356 * CDrivesFolder::CompareIDs
359 HRESULT WINAPI
CDrivesFolder::CompareIDs(LPARAM lParam
, PCUIDLIST_RELATIVE pidl1
, PCUIDLIST_RELATIVE pidl2
)
363 if (!pidl1
|| !pidl2
)
365 ERR("Got null pidl pointer (%Ix %p %p)!\n", lParam
, pidl1
, pidl2
);
369 if (_ILIsSpecialFolder(pidl1
) || _ILIsSpecialFolder(pidl2
))
370 return m_regFolder
->CompareIDs(lParam
, pidl1
, pidl2
);
372 if (!_ILIsDrive(pidl1
) || !_ILIsDrive(pidl2
) || LOWORD(lParam
) >= MYCOMPUTERSHELLVIEWCOLUMNS
)
375 CHAR
* pszDrive1
= _ILGetDataPointer(pidl1
)->u
.drive
.szDriveName
;
376 CHAR
* pszDrive2
= _ILGetDataPointer(pidl2
)->u
.drive
.szDriveName
;
379 switch(LOWORD(lParam
))
383 result
= stricmp(pszDrive1
, pszDrive2
);
384 hres
= MAKE_COMPARE_HRESULT(result
);
389 /* We want to return immediately because SHELL32_CompareDetails also compares children. */
390 return SHELL32_CompareDetails(this, lParam
, pidl1
, pidl2
);
393 case 3: /* Size Available */
395 ULARGE_INTEGER Drive1Available
, Drive1Total
, Drive2Available
, Drive2Total
;
397 if (GetVolumeInformationA(pszDrive1
, NULL
, 0, NULL
, NULL
, NULL
, NULL
, 0))
398 GetDiskFreeSpaceExA(pszDrive1
, &Drive1Available
, &Drive1Total
, NULL
);
400 Drive1Available
.QuadPart
= Drive1Total
.QuadPart
= 0;
402 if (GetVolumeInformationA(pszDrive2
, NULL
, 0, NULL
, NULL
, NULL
, NULL
, 0))
403 GetDiskFreeSpaceExA(pszDrive2
, &Drive2Available
, &Drive2Total
, NULL
);
405 Drive2Available
.QuadPart
= Drive2Total
.QuadPart
= 0;
408 if (lParam
== 2) /* Size */
409 Diff
.QuadPart
= Drive1Total
.QuadPart
- Drive2Total
.QuadPart
;
410 else /* Size available */
411 Diff
.QuadPart
= Drive1Available
.QuadPart
- Drive2Available
.QuadPart
;
413 hres
= MAKE_COMPARE_HRESULT(Diff
.QuadPart
);
420 if (HRESULT_CODE(hres
) == 0)
421 return SHELL32_CompareChildren(this, lParam
, pidl1
, pidl2
);
426 /**************************************************************************
427 * CDrivesFolder::CreateViewObject
429 HRESULT WINAPI
CDrivesFolder::CreateViewObject(HWND hwndOwner
, REFIID riid
, LPVOID
* ppvOut
)
431 CComPtr
<IShellView
> pShellView
;
432 HRESULT hr
= E_INVALIDARG
;
434 TRACE("(%p)->(hwnd=%p,%s,%p)\n", this,
435 hwndOwner
, shdebugstr_guid (&riid
), ppvOut
);
442 if (IsEqualIID(riid
, IID_IDropTarget
))
444 WARN("IDropTarget not implemented\n");
447 else if (IsEqualIID(riid
, IID_IContextMenu
))
449 WARN("IContextMenu not implemented\n");
452 else if (IsEqualIID(riid
, IID_IShellView
))
454 hr
= CDefView_Constructor(this, riid
, ppvOut
);
456 TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut
);
460 static BOOL
_ILIsControlPanel(LPCITEMIDLIST pidl
)
462 GUID
*guid
= _ILGetGUIDPointer(pidl
);
464 TRACE("(%p)\n", pidl
);
467 return IsEqualIID(*guid
, CLSID_ControlPanel
);
471 /**************************************************************************
472 * CDrivesFolder::GetAttributesOf
474 HRESULT WINAPI
CDrivesFolder::GetAttributesOf(UINT cidl
, PCUITEMID_CHILD_ARRAY apidl
, DWORD
* rgfInOut
)
476 TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
477 this, cidl
, apidl
, rgfInOut
, rgfInOut
? *rgfInOut
: 0);
485 /* FIXME: always add SFGAO_CANLINK */
487 *rgfInOut
&= dwComputerAttributes
;
490 for (UINT i
= 0; i
< cidl
; ++i
)
492 if (_ILIsDrive(apidl
[i
]))
493 *rgfInOut
&= dwDriveAttributes
;
494 else if (_ILIsControlPanel(apidl
[i
]))
495 *rgfInOut
&= dwControlPanelAttributes
;
496 else if (_ILIsSpecialFolder(*apidl
))
497 m_regFolder
->GetAttributesOf(1, &apidl
[i
], rgfInOut
);
499 ERR("Got unknown pidl type!\n");
503 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
504 *rgfInOut
&= ~SFGAO_VALIDATE
;
506 TRACE ("-- result=0x%08x\n", *rgfInOut
);
510 /**************************************************************************
511 * CDrivesFolder::GetUIObjectOf
514 * hwndOwner [in] Parent window for any output
515 * cidl [in] array size
516 * apidl [in] simple pidl array
517 * riid [in] Requested Interface
518 * prgfInOut [ ] reserved
519 * ppvObject [out] Resulting Interface
522 HRESULT WINAPI
CDrivesFolder::GetUIObjectOf(HWND hwndOwner
,
523 UINT cidl
, PCUITEMID_CHILD_ARRAY apidl
,
524 REFIID riid
, UINT
*prgfInOut
, LPVOID
*ppvOut
)
527 HRESULT hr
= E_INVALIDARG
;
529 TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", this,
530 hwndOwner
, cidl
, apidl
, shdebugstr_guid (&riid
), prgfInOut
, ppvOut
);
537 if (IsEqualIID (riid
, IID_IContextMenu
) && (cidl
>= 1))
539 hr
= CDefFolderMenu_Create2(pidlRoot
, hwndOwner
, cidl
, apidl
, (IShellFolder
*)this, NULL
, 0, NULL
, (IContextMenu
**)&pObj
);
541 else if (IsEqualIID (riid
, IID_IDataObject
) && (cidl
>= 1))
543 hr
= IDataObject_Constructor (hwndOwner
,
544 pidlRoot
, apidl
, cidl
, (IDataObject
**)&pObj
);
546 else if ((IsEqualIID (riid
, IID_IExtractIconA
) || IsEqualIID (riid
, IID_IExtractIconW
)) && (cidl
== 1))
548 if (_ILIsDrive(apidl
[0]))
549 hr
= CDrivesExtractIcon_CreateInstance(this, apidl
[0], riid
, &pObj
);
551 hr
= m_regFolder
->GetUIObjectOf(hwndOwner
, cidl
, apidl
, riid
, prgfInOut
, &pObj
);
553 else if (IsEqualIID (riid
, IID_IDropTarget
) && (cidl
>= 1))
555 IDropTarget
* pDt
= NULL
;
556 hr
= this->QueryInterface(IID_PPV_ARG(IDropTarget
, &pDt
));
562 if (SUCCEEDED(hr
) && !pObj
)
566 TRACE ("(%p)->hr=0x%08x\n", this, hr
);
570 /**************************************************************************
571 * CDrivesFolder::GetDisplayNameOf
573 HRESULT WINAPI
CDrivesFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl
, DWORD dwFlags
, LPSTRRET strRet
)
578 TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl
, dwFlags
, strRet
);
584 if (!_ILIsPidlSimple (pidl
))
586 return SHELL32_GetDisplayNameOfChild(this, pidl
, dwFlags
, strRet
);
588 else if (_ILIsSpecialFolder(pidl
))
590 return m_regFolder
->GetDisplayNameOf(pidl
, dwFlags
, strRet
);
592 else if (!_ILIsDrive(pidl
))
594 ERR("Wrong pidl type\n");
598 pszPath
= (LPWSTR
)CoTaskMemAlloc((MAX_PATH
+ 1) * sizeof(WCHAR
));
600 return E_OUTOFMEMORY
;
604 _ILSimpleGetTextW(pidl
, pszPath
, MAX_PATH
); /* append my own path */
605 /* long view "lw_name (C:)" */
606 if (!(dwFlags
& SHGDN_FORPARSING
))
608 WCHAR wszDrive
[18] = {0};
609 DWORD dwVolumeSerialNumber
, dwMaximumComponentLength
, dwFileSystemFlags
;
610 static const WCHAR wszOpenBracket
[] = {' ', '(', 0};
611 static const WCHAR wszCloseBracket
[] = {')', 0};
613 lstrcpynW(wszDrive
, pszPath
, 4);
615 GetVolumeInformationW(wszDrive
, pszPath
,
617 &dwVolumeSerialNumber
,
618 &dwMaximumComponentLength
, &dwFileSystemFlags
, NULL
, 0);
619 pszPath
[MAX_PATH
-1] = L
'\0';
620 if (!wcslen(pszPath
))
622 UINT DriveType
, ResourceId
;
623 DriveType
= GetDriveTypeW(wszDrive
);
627 ResourceId
= IDS_DRIVE_FIXED
;
630 ResourceId
= IDS_DRIVE_NETWORK
;
633 ResourceId
= IDS_DRIVE_CDROM
;
640 dwFileSystemFlags
= LoadStringW(shell32_hInstance
, ResourceId
, pszPath
, MAX_PATH
);
641 if (dwFileSystemFlags
> MAX_PATH
- 7)
642 pszPath
[MAX_PATH
-7] = L
'\0';
645 wcscat (pszPath
, wszOpenBracket
);
647 wcscat (pszPath
, wszDrive
);
648 wcscat (pszPath
, wszCloseBracket
);
653 strRet
->uType
= STRRET_WSTR
;
654 strRet
->pOleStr
= pszPath
;
657 CoTaskMemFree(pszPath
);
659 TRACE("-- (%p)->(%s)\n", this, strRet
->uType
== STRRET_CSTR
? strRet
->cStr
: debugstr_w(strRet
->pOleStr
));
663 /**************************************************************************
664 * CDrivesFolder::SetNameOf
665 * Changes the name of a file object or subfolder, possibly changing its item
666 * identifier in the process.
669 * hwndOwner [in] Owner window for output
670 * pidl [in] simple pidl of item to change
671 * lpszName [in] the items new display name
672 * dwFlags [in] SHGNO formatting flags
673 * ppidlOut [out] simple pidl returned
675 HRESULT WINAPI
CDrivesFolder::SetNameOf(HWND hwndOwner
, PCUITEMID_CHILD pidl
,
676 LPCOLESTR lpName
, DWORD dwFlags
, PITEMID_CHILD
*pPidlOut
)
680 if (_ILIsDrive(pidl
))
682 if (_ILSimpleGetTextW(pidl
, szName
, _countof(szName
)))
683 SetVolumeLabelW(szName
, lpName
);
685 *pPidlOut
= _ILCreateDrive(szName
);
689 return m_regFolder
->SetNameOf(hwndOwner
, pidl
, lpName
, dwFlags
, pPidlOut
);
692 HRESULT WINAPI
CDrivesFolder::GetDefaultSearchGUID(GUID
* pguid
)
694 FIXME ("(%p)\n", this);
698 HRESULT WINAPI
CDrivesFolder::EnumSearches(IEnumExtraSearch
** ppenum
)
700 FIXME ("(%p)\n", this);
704 HRESULT WINAPI
CDrivesFolder::GetDefaultColumn (DWORD dwRes
, ULONG
*pSort
, ULONG
*pDisplay
)
706 TRACE ("(%p)\n", this);
715 HRESULT WINAPI
CDrivesFolder::GetDefaultColumnState(UINT iColumn
, DWORD
* pcsFlags
)
717 TRACE ("(%p)\n", this);
719 if (!pcsFlags
|| iColumn
>= MYCOMPUTERSHELLVIEWCOLUMNS
)
721 *pcsFlags
= MyComputerSFHeader
[iColumn
].pcsFlags
;
725 HRESULT WINAPI
CDrivesFolder::GetDetailsEx(PCUITEMID_CHILD pidl
, const SHCOLUMNID
* pscid
, VARIANT
* pv
)
727 FIXME ("(%p)\n", this);
731 HRESULT WINAPI
CDrivesFolder::GetDetailsOf(PCUITEMID_CHILD pidl
, UINT iColumn
, SHELLDETAILS
*psd
)
735 TRACE ("(%p)->(%p %i %p)\n", this, pidl
, iColumn
, psd
);
737 if (!psd
|| iColumn
>= MYCOMPUTERSHELLVIEWCOLUMNS
)
742 psd
->fmt
= MyComputerSFHeader
[iColumn
].fmt
;
743 psd
->cxChar
= MyComputerSFHeader
[iColumn
].cxChar
;
744 return SHSetStrRet(&psd
->str
, MyComputerSFHeader
[iColumn
].colnameid
);
746 else if (_ILIsSpecialFolder(pidl
))
748 return m_regFolder
->GetDetailsOf(pidl
, iColumn
, psd
);
752 char szPath
[MAX_PATH
];
753 ULARGE_INTEGER ulBytes
;
755 psd
->str
.cStr
[0] = 0x00;
756 psd
->str
.uType
= STRRET_CSTR
;
760 hr
= GetDisplayNameOf(pidl
, SHGDN_NORMAL
| SHGDN_INFOLDER
, &psd
->str
);
763 _ILGetFileType(pidl
, psd
->str
.cStr
, MAX_PATH
);
765 case 2: /* total size */
766 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
);
767 if (GetVolumeInformationA(szPath
, NULL
, 0, NULL
, NULL
, NULL
, NULL
, 0))
769 GetDiskFreeSpaceExA(szPath
, NULL
, &ulBytes
, NULL
);
770 StrFormatByteSize64A(ulBytes
.QuadPart
, psd
->str
.cStr
, MAX_PATH
);
773 case 3: /* free size */
774 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
);
775 if (GetVolumeInformationA(szPath
, NULL
, 0, NULL
, NULL
, NULL
, NULL
, 0))
777 GetDiskFreeSpaceExA(szPath
, &ulBytes
, NULL
, NULL
);
778 StrFormatByteSize64A(ulBytes
.QuadPart
, psd
->str
.cStr
, MAX_PATH
);
788 HRESULT WINAPI
CDrivesFolder::MapColumnToSCID(UINT column
, SHCOLUMNID
* pscid
)
790 FIXME("(%p)\n", this);
794 /************************************************************************
795 * CDrivesFolder::GetClassID
797 HRESULT WINAPI
CDrivesFolder::GetClassID(CLSID
*lpClassId
)
799 TRACE ("(%p)\n", this);
804 *lpClassId
= CLSID_MyComputer
;
808 /************************************************************************
809 * CDrivesFolder::Initialize
811 * NOTES: it makes no sense to change the pidl
813 HRESULT WINAPI
CDrivesFolder::Initialize(LPCITEMIDLIST pidl
)
815 TRACE ("(%p)->(%p)\n", this, pidl
);
818 SHFree((LPVOID
)pidlRoot
);
820 pidlRoot
= ILClone(pidl
);
824 /**************************************************************************
825 * CDrivesFolder::GetCurFolder
827 HRESULT WINAPI
CDrivesFolder::GetCurFolder(LPITEMIDLIST
*pidl
)
829 TRACE("(%p)->(%p)\n", this, pidl
);
834 *pidl
= ILClone(pidlRoot
);