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 class CDrivesFolderEnum
:
43 public CEnumIDListBase
48 HRESULT WINAPI
Initialize(HWND hwndOwner
, DWORD dwFlags
);
49 BOOL
CreateMyCompEnumList(DWORD dwFlags
);
51 BEGIN_COM_MAP(CDrivesFolderEnum
)
52 COM_INTERFACE_ENTRY_IID(IID_IEnumIDList
, IEnumIDList
)
56 /***********************************************************************
57 * IShellFolder [MyComputer] implementation
60 static const shvheader MyComputerSFHeader
[] = {
61 {IDS_SHV_COLUMN1
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 15},
62 {IDS_SHV_COLUMN3
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 10},
63 {IDS_SHV_COLUMN6
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 10},
64 {IDS_SHV_COLUMN7
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 10},
67 #define MYCOMPUTERSHELLVIEWCOLUMNS 4
69 CDrivesFolderEnum::CDrivesFolderEnum()
73 CDrivesFolderEnum::~CDrivesFolderEnum()
77 HRESULT WINAPI
CDrivesFolderEnum::Initialize(HWND hwndOwner
, DWORD dwFlags
)
79 if (CreateMyCompEnumList(dwFlags
) == FALSE
)
85 /**************************************************************************
86 * CDrivesFolderEnum::CreateMyCompEnumList()
89 BOOL
CDrivesFolderEnum::CreateMyCompEnumList(DWORD dwFlags
)
92 static const WCHAR MyComputer_NameSpaceW
[] = L
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\Namespace";
94 TRACE("(%p)->(flags=0x%08x)\n", this, dwFlags
);
96 /* enumerate the folders */
97 if (dwFlags
& SHCONTF_FOLDERS
)
99 WCHAR wszDriveName
[] = {'A', ':', '\\', '\0'};
100 DWORD dwDrivemap
= GetLogicalDrives();
104 while (bRet
&& wszDriveName
[0] <= 'Z')
106 if(dwDrivemap
& 0x00000001L
)
107 bRet
= AddToEnumList(_ILCreateDrive(wszDriveName
));
109 dwDrivemap
= dwDrivemap
>> 1;
112 TRACE("-- (%p)-> enumerate (mycomputer shell extensions)\n", this);
113 for (i
= 0; i
< 2; i
++)
115 if (bRet
&& ERROR_SUCCESS
== RegOpenKeyExW(i
== 0 ? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
,
116 MyComputer_NameSpaceW
, 0, KEY_READ
, &hKey
))
125 dwSize
= sizeof(wszBuf
) / sizeof(wszBuf
[0]);
126 ErrorCode
= RegEnumKeyExW(hKey
, j
, wszBuf
, &dwSize
, 0, NULL
, NULL
, NULL
);
127 if (ERROR_SUCCESS
== ErrorCode
)
129 if (wszBuf
[0] != L
'{')
131 dwSize
= sizeof(wszBuf
);
132 RegGetValueW(hKey
, wszBuf
, NULL
, RRF_RT_REG_SZ
, NULL
, wszBuf
, &dwSize
);
135 /* FIXME: shell extensions - the type should be PT_SHELLEXT (tested) */
136 pidl
= _ILCreateGuidFromStrW(wszBuf
);
138 bRet
= AddToEnumList(pidl
);
140 ERR("Invalid MyComputer namespace extesion: %s\n", wszBuf
);
143 else if (ERROR_NO_MORE_ITEMS
== ErrorCode
)
155 CDrivesFolder::CDrivesFolder()
161 CDrivesFolder::~CDrivesFolder()
163 TRACE ("-- destroying IShellFolder(%p)\n", this);
167 HRESULT WINAPI
CDrivesFolder::FinalConstruct()
170 WCHAR szName
[MAX_PATH
];
171 WCHAR wszMyCompKey
[256];
174 pidlRoot
= _ILCreateMyComputer(); /* my qualified pidl */
175 if (pidlRoot
== NULL
)
176 return E_OUTOFMEMORY
;
178 i
= swprintf(wszMyCompKey
, L
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\");
179 StringFromGUID2(CLSID_MyComputer
, wszMyCompKey
+ i
, sizeof(wszMyCompKey
) / sizeof(wszMyCompKey
[0]) - i
);
180 dwSize
= sizeof(szName
);
181 if (RegGetValueW(HKEY_CURRENT_USER
, wszMyCompKey
,
182 NULL
, RRF_RT_REG_SZ
, NULL
, szName
, &dwSize
) == ERROR_SUCCESS
)
184 sName
= (LPWSTR
)SHAlloc((wcslen(szName
) + 1) * sizeof(WCHAR
));
186 wcscpy(sName
, szName
);
187 TRACE("sName %s\n", debugstr_w(sName
));
192 /**************************************************************************
193 * CDrivesFolder::ParseDisplayName
195 HRESULT WINAPI
CDrivesFolder::ParseDisplayName(HWND hwndOwner
, LPBC pbc
, LPOLESTR lpszDisplayName
,
196 DWORD
* pchEaten
, PIDLIST_RELATIVE
* ppidl
, DWORD
* pdwAttributes
)
198 HRESULT hr
= E_INVALIDARG
;
199 LPCWSTR szNext
= NULL
;
200 WCHAR szElement
[MAX_PATH
];
201 LPITEMIDLIST pidlTemp
= NULL
;
204 TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", this,
205 hwndOwner
, pbc
, lpszDisplayName
, debugstr_w (lpszDisplayName
),
206 pchEaten
, ppidl
, pdwAttributes
);
210 *pchEaten
= 0; /* strange but like the original */
212 /* handle CLSID paths */
213 if (lpszDisplayName
[0] == ':' && lpszDisplayName
[1] == ':')
215 szNext
= GetNextElementW (lpszDisplayName
, szElement
, MAX_PATH
);
216 TRACE ("-- element: %s\n", debugstr_w (szElement
));
217 CLSIDFromString (szElement
+ 2, &clsid
);
218 pidlTemp
= _ILCreateGuid (PT_GUID
, clsid
);
220 /* do we have an absolute path name ? */
221 else if (PathGetDriveNumberW (lpszDisplayName
) >= 0 &&
222 lpszDisplayName
[2] == (WCHAR
) '\\')
224 szNext
= GetNextElementW (lpszDisplayName
, szElement
, MAX_PATH
);
225 /* make drive letter uppercase to enable PIDL comparison */
226 szElement
[0] = toupper(szElement
[0]);
227 pidlTemp
= _ILCreateDrive (szElement
);
230 if (szNext
&& *szNext
)
232 hr
= SHELL32_ParseNextElement (this, hwndOwner
, pbc
, &pidlTemp
,
233 (LPOLESTR
) szNext
, pchEaten
, pdwAttributes
);
238 if (pdwAttributes
&& *pdwAttributes
)
240 if (_ILIsCPanelStruct(pidlTemp
))
241 *pdwAttributes
&= SFGAO_CANLINK
;
242 else if (_ILIsSpecialFolder(pidlTemp
))
243 SHELL32_GetGuidItemAttributes(this, pidlTemp
, pdwAttributes
);
245 ERR("Got an unkown pidl here!\n");
251 TRACE ("(%p)->(-- ret=0x%08x)\n", this, hr
);
256 /**************************************************************************
257 * CDrivesFolder::EnumObjects
259 HRESULT WINAPI
CDrivesFolder::EnumObjects(HWND hwndOwner
, DWORD dwFlags
, LPENUMIDLIST
*ppEnumIDList
)
261 return ShellObjectCreatorInit
<CDrivesFolderEnum
>(hwndOwner
, dwFlags
, IID_IEnumIDList
, ppEnumIDList
);
264 /**************************************************************************
265 * CDrivesFolder::BindToObject
267 HRESULT WINAPI
CDrivesFolder::BindToObject(PCUIDLIST_RELATIVE pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
*ppvOut
)
269 TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", this,
270 pidl
, pbcReserved
, shdebugstr_guid(&riid
), ppvOut
);
272 if (_ILIsSpecialFolder(pidl
))
273 return SHELL32_BindToGuidItem(pidlRoot
, pidl
, pbcReserved
, riid
, ppvOut
);
275 return SHELL32_BindToChild(pidlRoot
, NULL
, pidl
, riid
, ppvOut
);
278 /**************************************************************************
279 * CDrivesFolder::BindToStorage
281 HRESULT WINAPI
CDrivesFolder::BindToStorage(PCUIDLIST_RELATIVE pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
*ppvOut
)
283 FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this,
284 pidl
, pbcReserved
, shdebugstr_guid (&riid
), ppvOut
);
290 /**************************************************************************
291 * CDrivesFolder::CompareIDs
294 HRESULT WINAPI
CDrivesFolder::CompareIDs(LPARAM lParam
, PCUIDLIST_RELATIVE pidl1
, PCUIDLIST_RELATIVE pidl2
)
298 TRACE("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", this, lParam
, pidl1
, pidl2
);
299 nReturn
= SHELL32_CompareIDs (this, lParam
, pidl1
, pidl2
);
300 TRACE("-- %i\n", nReturn
);
304 /**************************************************************************
305 * CDrivesFolder::CreateViewObject
307 HRESULT WINAPI
CDrivesFolder::CreateViewObject(HWND hwndOwner
, REFIID riid
, LPVOID
* ppvOut
)
309 CComPtr
<IShellView
> pShellView
;
310 HRESULT hr
= E_INVALIDARG
;
312 TRACE("(%p)->(hwnd=%p,%s,%p)\n", this,
313 hwndOwner
, shdebugstr_guid (&riid
), ppvOut
);
320 if (IsEqualIID(riid
, IID_IDropTarget
))
322 WARN("IDropTarget not implemented\n");
325 else if (IsEqualIID(riid
, IID_IContextMenu
))
327 WARN("IContextMenu not implemented\n");
330 else if (IsEqualIID(riid
, IID_IShellView
))
332 hr
= CDefView_Constructor(this, riid
, ppvOut
);
334 TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut
);
338 static BOOL
_ILIsControlPanel(LPCITEMIDLIST pidl
)
340 GUID
*guid
= _ILGetGUIDPointer(pidl
);
342 TRACE("(%p)\n", pidl
);
345 return IsEqualIID(*guid
, CLSID_ControlPanel
);
349 /**************************************************************************
350 * CDrivesFolder::GetAttributesOf
352 HRESULT WINAPI
CDrivesFolder::GetAttributesOf(UINT cidl
, PCUITEMID_CHILD_ARRAY apidl
, DWORD
* rgfInOut
)
354 static const DWORD dwComputerAttributes
=
355 SFGAO_CANRENAME
| SFGAO_CANDELETE
| SFGAO_HASPROPSHEET
| SFGAO_DROPTARGET
|
356 SFGAO_FILESYSANCESTOR
| SFGAO_FOLDER
| SFGAO_HASSUBFOLDER
| SFGAO_CANLINK
;
357 static const DWORD dwControlPanelAttributes
=
358 SFGAO_HASSUBFOLDER
| SFGAO_FOLDER
| SFGAO_CANLINK
;
359 static const DWORD dwDriveAttributes
=
360 SFGAO_HASSUBFOLDER
| SFGAO_FILESYSTEM
| SFGAO_FOLDER
| SFGAO_FILESYSANCESTOR
|
361 SFGAO_DROPTARGET
| SFGAO_HASPROPSHEET
| SFGAO_CANRENAME
| SFGAO_CANLINK
;
363 TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
364 this, cidl
, apidl
, rgfInOut
, rgfInOut
? *rgfInOut
: 0);
372 /* FIXME: always add SFGAO_CANLINK */
374 *rgfInOut
&= dwComputerAttributes
;
377 for (UINT i
= 0; i
< cidl
; ++i
)
379 if (_ILIsDrive(apidl
[i
]))
380 *rgfInOut
&= dwDriveAttributes
;
381 else if (_ILIsControlPanel(apidl
[i
]))
382 *rgfInOut
&= dwControlPanelAttributes
;
383 else if (_ILIsSpecialFolder(*apidl
))
384 SHELL32_GetGuidItemAttributes(this, apidl
[i
], rgfInOut
);
386 ERR("Got unknown pidl type!\n");
390 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
391 *rgfInOut
&= ~SFGAO_VALIDATE
;
393 TRACE ("-- result=0x%08x\n", *rgfInOut
);
397 /**************************************************************************
398 * CDrivesFolder::GetUIObjectOf
401 * hwndOwner [in] Parent window for any output
402 * cidl [in] array size
403 * apidl [in] simple pidl array
404 * riid [in] Requested Interface
405 * prgfInOut [ ] reserved
406 * ppvObject [out] Resulting Interface
409 HRESULT WINAPI
CDrivesFolder::GetUIObjectOf(HWND hwndOwner
,
410 UINT cidl
, PCUITEMID_CHILD_ARRAY apidl
,
411 REFIID riid
, UINT
*prgfInOut
, LPVOID
*ppvOut
)
414 IUnknown
*pObj
= NULL
;
415 HRESULT hr
= E_INVALIDARG
;
417 TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", this,
418 hwndOwner
, cidl
, apidl
, shdebugstr_guid (&riid
), prgfInOut
, ppvOut
);
425 if (IsEqualIID (riid
, IID_IContextMenu
) && (cidl
>= 1))
427 hr
= CDefFolderMenu_Create2(pidlRoot
, hwndOwner
, cidl
, apidl
, (IShellFolder
*)this, NULL
, 0, NULL
, (IContextMenu
**)&pObj
);
429 else if (IsEqualIID (riid
, IID_IDataObject
) && (cidl
>= 1))
431 hr
= IDataObject_Constructor (hwndOwner
,
432 pidlRoot
, apidl
, cidl
, (IDataObject
**)&pObj
);
434 else if (IsEqualIID (riid
, IID_IExtractIconA
) && (cidl
== 1))
436 pidl
= ILCombine (pidlRoot
, apidl
[0]);
437 pObj
= IExtractIconA_Constructor (pidl
);
441 else if (IsEqualIID (riid
, IID_IExtractIconW
) && (cidl
== 1))
443 pidl
= ILCombine (pidlRoot
, apidl
[0]);
444 pObj
= IExtractIconW_Constructor (pidl
);
448 else if (IsEqualIID (riid
, IID_IDropTarget
) && (cidl
>= 1))
450 IDropTarget
* pDt
= NULL
;
451 hr
= this->QueryInterface(IID_PPV_ARG(IDropTarget
, &pDt
));
454 else if ((IsEqualIID(riid
, IID_IShellLinkW
) ||
455 IsEqualIID(riid
, IID_IShellLinkA
)) && (cidl
== 1))
457 pidl
= ILCombine (pidlRoot
, apidl
[0]);
458 hr
= IShellLink_ConstructFromFile(NULL
, riid
, pidl
, (LPVOID
*) &pObj
);
464 if (SUCCEEDED(hr
) && !pObj
)
468 TRACE ("(%p)->hr=0x%08x\n", this, hr
);
472 /**************************************************************************
473 * CDrivesFolder::GetDisplayNameOf
475 HRESULT WINAPI
CDrivesFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl
, DWORD dwFlags
, LPSTRRET strRet
)
480 TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl
, dwFlags
, strRet
);
486 pszPath
= (LPWSTR
)CoTaskMemAlloc((MAX_PATH
+ 1) * sizeof(WCHAR
));
488 return E_OUTOFMEMORY
;
494 /* parsing name like ::{...} */
497 SHELL32_GUIDToStringW(CLSID_MyComputer
, &pszPath
[2]);
499 else if (_ILIsPidlSimple(pidl
))
501 if (_ILIsSpecialFolder(pidl
))
502 return SHELL32_GetDisplayNameOfGUIDItem(this, L
"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", pidl
, dwFlags
, strRet
);
503 else if (_ILIsDrive(pidl
))
505 _ILSimpleGetTextW(pidl
, pszPath
, MAX_PATH
); /* append my own path */
506 /* long view "lw_name (C:)" */
507 if (!(dwFlags
& SHGDN_FORPARSING
))
509 WCHAR wszDrive
[18] = {0};
510 DWORD dwVolumeSerialNumber
, dwMaximumComponentLength
, dwFileSystemFlags
;
511 static const WCHAR wszOpenBracket
[] = {' ', '(', 0};
512 static const WCHAR wszCloseBracket
[] = {')', 0};
514 lstrcpynW(wszDrive
, pszPath
, 4);
516 GetVolumeInformationW(wszDrive
, pszPath
,
518 &dwVolumeSerialNumber
,
519 &dwMaximumComponentLength
, &dwFileSystemFlags
, NULL
, 0);
520 pszPath
[MAX_PATH
-1] = L
'\0';
521 if (!wcslen(pszPath
))
523 UINT DriveType
, ResourceId
;
524 DriveType
= GetDriveTypeW(wszDrive
);
528 ResourceId
= IDS_DRIVE_FIXED
;
531 ResourceId
= IDS_DRIVE_NETWORK
;
534 ResourceId
= IDS_DRIVE_CDROM
;
541 dwFileSystemFlags
= LoadStringW(shell32_hInstance
, ResourceId
, pszPath
, MAX_PATH
);
542 if (dwFileSystemFlags
> MAX_PATH
- 7)
543 pszPath
[MAX_PATH
-7] = L
'\0';
546 wcscat (pszPath
, wszOpenBracket
);
548 wcscat (pszPath
, wszDrive
);
549 wcscat (pszPath
, wszCloseBracket
);
554 /* Neither a shell namespace extension nor a drive letter. */
555 ERR("Wrong pidl type\n");
556 CoTaskMemFree(pszPath
);
562 /* Complex pidl. Let the child folder do the work */
563 hr
= SHELL32_GetDisplayNameOfChild(this, pidl
, dwFlags
, pszPath
, MAX_PATH
);
568 strRet
->uType
= STRRET_WSTR
;
569 strRet
->pOleStr
= pszPath
;
572 CoTaskMemFree(pszPath
);
574 TRACE("-- (%p)->(%s)\n", this, strRet
->uType
== STRRET_CSTR
? strRet
->cStr
: debugstr_w(strRet
->pOleStr
));
578 /**************************************************************************
579 * CDrivesFolder::SetNameOf
580 * Changes the name of a file object or subfolder, possibly changing its item
581 * identifier in the process.
584 * hwndOwner [in] Owner window for output
585 * pidl [in] simple pidl of item to change
586 * lpszName [in] the items new display name
587 * dwFlags [in] SHGNO formatting flags
588 * ppidlOut [out] simple pidl returned
590 HRESULT WINAPI
CDrivesFolder::SetNameOf(HWND hwndOwner
, PCUITEMID_CHILD pidl
,
591 LPCOLESTR lpName
, DWORD dwFlags
, PITEMID_CHILD
*pPidlOut
)
598 TRACE("(%p)->(%p,pidl=%p,%s,%u,%p)\n", this,
599 hwndOwner
, pidl
, debugstr_w (lpName
), dwFlags
, pPidlOut
);
601 if (_ILIsDrive(pidl
))
603 if (_ILSimpleGetTextW(pidl
, szName
, _countof(szName
)))
604 SetVolumeLabelW(szName
, lpName
);
606 *pPidlOut
= _ILCreateDrive(szName
);
611 if (pPidlOut
!= NULL
)
612 *pPidlOut
= _ILCreateMyComputer();
614 length
= (wcslen(lpName
) + 1) * sizeof(WCHAR
);
615 sName
= (LPWSTR
)SHAlloc(length
);
618 return E_OUTOFMEMORY
;
620 if (RegOpenKeyExW(HKEY_CURRENT_USER
,
621 L
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
624 &hKey
) != ERROR_SUCCESS
)
626 WARN("Error: failed to open registry key\n");
630 RegSetValueExW(hKey
, NULL
, 0, REG_SZ
, (const LPBYTE
)lpName
, length
);
634 wcscpy(sName
, lpName
);
637 TRACE("result %s\n", debugstr_w(sName
));
641 HRESULT WINAPI
CDrivesFolder::GetDefaultSearchGUID(GUID
* pguid
)
643 FIXME ("(%p)\n", this);
647 HRESULT WINAPI
CDrivesFolder::EnumSearches(IEnumExtraSearch
** ppenum
)
649 FIXME ("(%p)\n", this);
653 HRESULT WINAPI
CDrivesFolder::GetDefaultColumn (DWORD dwRes
, ULONG
*pSort
, ULONG
*pDisplay
)
655 TRACE ("(%p)\n", this);
664 HRESULT WINAPI
CDrivesFolder::GetDefaultColumnState(UINT iColumn
, DWORD
* pcsFlags
)
666 TRACE ("(%p)\n", this);
668 if (!pcsFlags
|| iColumn
>= MYCOMPUTERSHELLVIEWCOLUMNS
)
670 *pcsFlags
= MyComputerSFHeader
[iColumn
].pcsFlags
;
674 HRESULT WINAPI
CDrivesFolder::GetDetailsEx(PCUITEMID_CHILD pidl
, const SHCOLUMNID
* pscid
, VARIANT
* pv
)
676 FIXME ("(%p)\n", this);
680 /* FIXME: drive size >4GB is rolling over */
681 HRESULT WINAPI
CDrivesFolder::GetDetailsOf(PCUITEMID_CHILD pidl
, UINT iColumn
, SHELLDETAILS
*psd
)
685 TRACE ("(%p)->(%p %i %p)\n", this, pidl
, iColumn
, psd
);
687 if (!psd
|| iColumn
>= MYCOMPUTERSHELLVIEWCOLUMNS
)
692 psd
->fmt
= MyComputerSFHeader
[iColumn
].fmt
;
693 psd
->cxChar
= MyComputerSFHeader
[iColumn
].cxChar
;
694 psd
->str
.uType
= STRRET_CSTR
;
695 LoadStringA(shell32_hInstance
, MyComputerSFHeader
[iColumn
].colnameid
,
696 psd
->str
.cStr
, MAX_PATH
);
701 char szPath
[MAX_PATH
];
702 ULARGE_INTEGER ulBytes
;
704 psd
->str
.cStr
[0] = 0x00;
705 psd
->str
.uType
= STRRET_CSTR
;
709 hr
= GetDisplayNameOf(pidl
,
710 SHGDN_NORMAL
| SHGDN_INFOLDER
, &psd
->str
);
713 _ILGetFileType(pidl
, psd
->str
.cStr
, MAX_PATH
);
715 case 2: /* total size */
716 if (_ILIsDrive(pidl
))
718 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
);
719 GetDiskFreeSpaceExA (szPath
, NULL
, &ulBytes
, NULL
);
720 StrFormatByteSize64A (ulBytes
.QuadPart
, psd
->str
.cStr
, MAX_PATH
);
723 case 3: /* free size */
724 if (_ILIsDrive(pidl
))
726 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
);
727 GetDiskFreeSpaceExA (szPath
, &ulBytes
, NULL
, NULL
);
728 StrFormatByteSize64A (ulBytes
.QuadPart
, psd
->str
.cStr
, MAX_PATH
);
738 HRESULT WINAPI
CDrivesFolder::MapColumnToSCID(UINT column
, SHCOLUMNID
* pscid
)
740 FIXME("(%p)\n", this);
744 /************************************************************************
745 * CDrivesFolder::GetClassID
747 HRESULT WINAPI
CDrivesFolder::GetClassID(CLSID
*lpClassId
)
749 TRACE ("(%p)\n", this);
754 *lpClassId
= CLSID_MyComputer
;
758 /************************************************************************
759 * CDrivesFolder::Initialize
761 * NOTES: it makes no sense to change the pidl
763 HRESULT WINAPI
CDrivesFolder::Initialize(LPCITEMIDLIST pidl
)
765 TRACE ("(%p)->(%p)\n", this, pidl
);
768 SHFree((LPVOID
)pidlRoot
);
770 pidlRoot
= ILClone(pidl
);
774 /**************************************************************************
775 * CDrivesFolder::GetCurFolder
777 HRESULT WINAPI
CDrivesFolder::GetCurFolder(LPITEMIDLIST
*pidl
)
779 TRACE("(%p)->(%p)\n", this, pidl
);
784 *pidl
= ILClone(pidlRoot
);