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 IEnumIDListImpl
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
, LPITEMIDLIST
* 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
);
237 if (pdwAttributes
&& *pdwAttributes
)
238 SHELL32_GetItemAttributes (this,
239 pidlTemp
, pdwAttributes
);
245 TRACE ("(%p)->(-- ret=0x%08x)\n", this, hr
);
250 /**************************************************************************
251 * CDrivesFolder::EnumObjects
253 HRESULT WINAPI
CDrivesFolder::EnumObjects(HWND hwndOwner
, DWORD dwFlags
, LPENUMIDLIST
*ppEnumIDList
)
255 CComObject
<CDrivesFolderEnum
> *theEnumerator
;
256 CComPtr
<IEnumIDList
> result
;
259 TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner
, dwFlags
, ppEnumIDList
);
261 if (ppEnumIDList
== NULL
)
264 *ppEnumIDList
= NULL
;
265 ATLTRY(theEnumerator
= new CComObject
<CDrivesFolderEnum
>);
267 if (theEnumerator
== NULL
)
268 return E_OUTOFMEMORY
;
270 hResult
= theEnumerator
->QueryInterface(IID_IEnumIDList
, (void **)&result
);
273 delete theEnumerator
;
277 hResult
= theEnumerator
->Initialize(hwndOwner
, dwFlags
);
280 *ppEnumIDList
= result
.Detach();
282 TRACE("-- (%p)->(new ID List: %p)\n", this, *ppEnumIDList
);
287 /**************************************************************************
288 * CDrivesFolder::BindToObject
290 HRESULT WINAPI
CDrivesFolder::BindToObject(LPCITEMIDLIST pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
*ppvOut
)
292 TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", this,
293 pidl
, pbcReserved
, shdebugstr_guid(&riid
), ppvOut
);
295 return SHELL32_BindToChild(pidlRoot
, NULL
, pidl
, riid
, ppvOut
);
298 /**************************************************************************
299 * CDrivesFolder::BindToStorage
301 HRESULT WINAPI
CDrivesFolder::BindToStorage(LPCITEMIDLIST pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
*ppvOut
)
303 FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this,
304 pidl
, pbcReserved
, shdebugstr_guid (&riid
), ppvOut
);
310 /**************************************************************************
311 * CDrivesFolder::CompareIDs
314 HRESULT WINAPI
CDrivesFolder::CompareIDs(LPARAM lParam
, LPCITEMIDLIST pidl1
, LPCITEMIDLIST pidl2
)
318 TRACE("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", this, lParam
, pidl1
, pidl2
);
319 nReturn
= SHELL32_CompareIDs (this, lParam
, pidl1
, pidl2
);
320 TRACE("-- %i\n", nReturn
);
324 /**************************************************************************
325 * CDrivesFolder::CreateViewObject
327 HRESULT WINAPI
CDrivesFolder::CreateViewObject(HWND hwndOwner
, REFIID riid
, LPVOID
* ppvOut
)
329 LPSHELLVIEW pShellView
;
330 HRESULT hr
= E_INVALIDARG
;
332 TRACE("(%p)->(hwnd=%p,%s,%p)\n", this,
333 hwndOwner
, shdebugstr_guid (&riid
), ppvOut
);
340 if (IsEqualIID(riid
, IID_IDropTarget
))
342 WARN("IDropTarget not implemented\n");
345 else if (IsEqualIID(riid
, IID_IContextMenu
))
347 WARN("IContextMenu not implemented\n");
350 else if (IsEqualIID(riid
, IID_IShellView
))
352 hr
= IShellView_Constructor ((IShellFolder
*)this, &pShellView
);
355 hr
= pShellView
->QueryInterface(riid
, ppvOut
);
356 pShellView
->Release();
359 TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut
);
363 /**************************************************************************
364 * CDrivesFolder::GetAttributesOf
366 HRESULT WINAPI
CDrivesFolder::GetAttributesOf(UINT cidl
, LPCITEMIDLIST
* apidl
, DWORD
* rgfInOut
)
368 static const DWORD dwComputerAttributes
=
369 SFGAO_CANRENAME
| SFGAO_CANDELETE
| SFGAO_HASPROPSHEET
| SFGAO_DROPTARGET
|
370 SFGAO_FILESYSANCESTOR
| SFGAO_FOLDER
| SFGAO_HASSUBFOLDER
| SFGAO_CANLINK
;
371 static const DWORD dwControlPanelAttributes
=
372 SFGAO_HASSUBFOLDER
| SFGAO_FOLDER
| SFGAO_CANLINK
;
373 static const DWORD dwDriveAttributes
=
374 SFGAO_HASSUBFOLDER
| SFGAO_FILESYSTEM
| SFGAO_FOLDER
| SFGAO_FILESYSANCESTOR
|
375 SFGAO_DROPTARGET
| SFGAO_HASPROPSHEET
| SFGAO_CANRENAME
| SFGAO_CANLINK
;
377 TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
378 this, cidl
, apidl
, rgfInOut
, rgfInOut
? *rgfInOut
: 0);
386 /* FIXME: always add SFGAO_CANLINK */
388 *rgfInOut
&= dwComputerAttributes
;
391 for (UINT i
= 0; i
< cidl
; ++i
)
393 if (_ILIsDrive(apidl
[i
]))
394 *rgfInOut
&= dwDriveAttributes
;
395 else if (_ILIsControlPanel(apidl
[i
]))
396 *rgfInOut
&= dwControlPanelAttributes
;
400 SHELL32_GetItemAttributes(this, apidl
[i
], rgfInOut
);
405 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
406 *rgfInOut
&= ~SFGAO_VALIDATE
;
408 TRACE ("-- result=0x%08x\n", *rgfInOut
);
412 /**************************************************************************
413 * CDrivesFolder::GetUIObjectOf
416 * hwndOwner [in] Parent window for any output
417 * cidl [in] array size
418 * apidl [in] simple pidl array
419 * riid [in] Requested Interface
420 * prgfInOut [ ] reserved
421 * ppvObject [out] Resulting Interface
424 HRESULT WINAPI
CDrivesFolder::GetUIObjectOf(HWND hwndOwner
,
425 UINT cidl
, LPCITEMIDLIST
*apidl
,
426 REFIID riid
, UINT
*prgfInOut
, LPVOID
*ppvOut
)
429 IUnknown
*pObj
= NULL
;
430 HRESULT hr
= E_INVALIDARG
;
432 TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", this,
433 hwndOwner
, cidl
, apidl
, shdebugstr_guid (&riid
), prgfInOut
, ppvOut
);
440 if (IsEqualIID (riid
, IID_IContextMenu
) && (cidl
>= 1))
442 hr
= CDefFolderMenu_Create2(pidlRoot
, hwndOwner
, cidl
, apidl
, (IShellFolder
*)this, NULL
, 0, NULL
, (IContextMenu
**)&pObj
);
444 else if (IsEqualIID (riid
, IID_IDataObject
) && (cidl
>= 1))
446 hr
= IDataObject_Constructor (hwndOwner
,
447 pidlRoot
, apidl
, cidl
, (IDataObject
**)&pObj
);
449 else if (IsEqualIID (riid
, IID_IExtractIconA
) && (cidl
== 1))
451 pidl
= ILCombine (pidlRoot
, apidl
[0]);
452 pObj
= (LPUNKNOWN
) IExtractIconA_Constructor (pidl
);
456 else if (IsEqualIID (riid
, IID_IExtractIconW
) && (cidl
== 1))
458 pidl
= ILCombine (pidlRoot
, apidl
[0]);
459 pObj
= (LPUNKNOWN
) IExtractIconW_Constructor (pidl
);
463 else if (IsEqualIID (riid
, IID_IDropTarget
) && (cidl
>= 1))
465 IDropTarget
* pDt
= NULL
;
466 hr
= this->QueryInterface(IID_PPV_ARG(IDropTarget
, &pDt
));
469 else if ((IsEqualIID(riid
, IID_IShellLinkW
) ||
470 IsEqualIID(riid
, IID_IShellLinkA
)) && (cidl
== 1))
472 pidl
= ILCombine (pidlRoot
, apidl
[0]);
473 hr
= IShellLink_ConstructFromFile(NULL
, riid
, pidl
, (LPVOID
*) &pObj
);
479 if (SUCCEEDED(hr
) && !pObj
)
483 TRACE ("(%p)->hr=0x%08x\n", this, hr
);
487 /**************************************************************************
488 * CDrivesFolder::GetDisplayNameOf
490 HRESULT WINAPI
CDrivesFolder::GetDisplayNameOf(LPCITEMIDLIST pidl
, DWORD dwFlags
, LPSTRRET strRet
)
495 TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl
, dwFlags
, strRet
);
501 pszPath
= (LPWSTR
)CoTaskMemAlloc((MAX_PATH
+ 1) * sizeof(WCHAR
));
503 return E_OUTOFMEMORY
;
509 /* parsing name like ::{...} */
512 SHELL32_GUIDToStringW(CLSID_MyComputer
, &pszPath
[2]);
514 else if (_ILIsPidlSimple(pidl
))
516 /* take names of special folders only if its only this folder */
517 if (_ILIsSpecialFolder(pidl
))
521 clsid
= _ILGetGUIDPointer (pidl
);
524 if (GET_SHGDN_FOR (dwFlags
) & SHGDN_FORPARSING
)
526 static const WCHAR clsidW
[] = L
"CLSID\\";
527 static const WCHAR shellfolderW
[] = L
"\\shellfolder";
528 static const WCHAR wantsForParsingW
[] = L
"WantsForParsing";
529 BOOL bWantsForParsing
= FALSE
;
530 WCHAR szRegPath
[100];
534 * We can only get a filesystem path from a shellfolder
535 * if the value WantsFORPARSING exists in
536 * CLSID\\{...}\\shellfolder
537 * exception: the MyComputer folder has this keys not
538 * but like any filesystem backed
539 * folder it needs these behaviour
541 * Get the "WantsFORPARSING" flag from the registry
544 wcscpy(szRegPath
, clsidW
);
545 SHELL32_GUIDToStringW(*clsid
, &szRegPath
[6]);
546 wcscat(szRegPath
, shellfolderW
);
547 r
= SHGetValueW(HKEY_CLASSES_ROOT
, szRegPath
,
548 wantsForParsingW
, NULL
, NULL
, NULL
);
549 if (r
== ERROR_SUCCESS
)
550 bWantsForParsing
= TRUE
;
552 if ((GET_SHGDN_RELATION (dwFlags
) == SHGDN_NORMAL
) &&
556 * We need the filesystem path to the destination folder
557 * Only the folder itself can know it
559 hr
= SHELL32_GetDisplayNameOfChild (this, pidl
,
560 dwFlags
, pszPath
, MAX_PATH
);
566 /* parsing name like ::{...} */
570 p
+= SHELL32_GUIDToStringW(CLSID_MyComputer
, p
);
577 SHELL32_GUIDToStringW(*clsid
, p
);
582 /* user friendly name */
584 if (_ILIsMyComputer(pidl
) && sName
)
585 wcscpy(pszPath
, sName
);
587 HCR_GetClassNameW (*clsid
, pszPath
, MAX_PATH
);
589 TRACE("pszPath %s\n", debugstr_w(pszPath
));
594 /* append my own path */
595 _ILSimpleGetTextW(pidl
, pszPath
, MAX_PATH
);
598 else if (_ILIsDrive(pidl
))
601 _ILSimpleGetTextW(pidl
, pszPath
, MAX_PATH
); /* append my own path */
602 /* long view "lw_name (C:)" */
603 if (!(dwFlags
& SHGDN_FORPARSING
))
605 WCHAR wszDrive
[18] = {0};
606 DWORD dwVolumeSerialNumber
, dwMaximumComponentLength
, dwFileSystemFlags
;
607 static const WCHAR wszOpenBracket
[] = {' ', '(', 0};
608 static const WCHAR wszCloseBracket
[] = {')', 0};
610 lstrcpynW(wszDrive
, pszPath
, 4);
612 GetVolumeInformationW(wszDrive
, pszPath
,
614 &dwVolumeSerialNumber
,
615 &dwMaximumComponentLength
, &dwFileSystemFlags
, NULL
, 0);
616 pszPath
[MAX_PATH
-1] = L
'\0';
617 if (!wcslen(pszPath
))
619 UINT DriveType
, ResourceId
;
620 DriveType
= GetDriveTypeW(wszDrive
);
624 ResourceId
= IDS_DRIVE_FIXED
;
627 ResourceId
= IDS_DRIVE_NETWORK
;
630 ResourceId
= IDS_DRIVE_CDROM
;
637 dwFileSystemFlags
= LoadStringW(shell32_hInstance
, ResourceId
, pszPath
, MAX_PATH
);
638 if (dwFileSystemFlags
> MAX_PATH
- 7)
639 pszPath
[MAX_PATH
-7] = L
'\0';
642 wcscat (pszPath
, wszOpenBracket
);
644 wcscat (pszPath
, wszDrive
);
645 wcscat (pszPath
, wszCloseBracket
);
650 /* Neither a shell namespace extension nor a drive letter. */
651 ERR("Wrong pidl type\n");
652 CoTaskMemFree(pszPath
);
658 /* Complex pidl. Let the child folder do the work */
659 hr
= SHELL32_GetDisplayNameOfChild(this, pidl
, dwFlags
, pszPath
, MAX_PATH
);
664 strRet
->uType
= STRRET_WSTR
;
665 strRet
->pOleStr
= pszPath
;
668 CoTaskMemFree(pszPath
);
670 TRACE("-- (%p)->(%s)\n", this, strRet
->uType
== STRRET_CSTR
? strRet
->cStr
: debugstr_w(strRet
->pOleStr
));
674 /**************************************************************************
675 * CDrivesFolder::SetNameOf
676 * Changes the name of a file object or subfolder, possibly changing its item
677 * identifier in the process.
680 * hwndOwner [in] Owner window for output
681 * pidl [in] simple pidl of item to change
682 * lpszName [in] the items new display name
683 * dwFlags [in] SHGNO formatting flags
684 * ppidlOut [out] simple pidl returned
686 HRESULT WINAPI
CDrivesFolder::SetNameOf(HWND hwndOwner
, LPCITEMIDLIST pidl
,
687 LPCOLESTR lpName
, DWORD dwFlags
, LPITEMIDLIST
*pPidlOut
)
694 TRACE("(%p)->(%p,pidl=%p,%s,%u,%p)\n", this,
695 hwndOwner
, pidl
, debugstr_w (lpName
), dwFlags
, pPidlOut
);
697 if (_ILIsDrive(pidl
))
699 if (_ILSimpleGetTextW(pidl
, szName
, _countof(szName
)))
700 SetVolumeLabelW(szName
, lpName
);
702 *pPidlOut
= _ILCreateDrive(szName
);
707 if (pPidlOut
!= NULL
)
708 *pPidlOut
= _ILCreateMyComputer();
710 length
= (wcslen(lpName
) + 1) * sizeof(WCHAR
);
711 sName
= (LPWSTR
)SHAlloc(length
);
714 return E_OUTOFMEMORY
;
716 if (RegOpenKeyExW(HKEY_CURRENT_USER
,
717 L
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
720 &hKey
) != ERROR_SUCCESS
)
722 WARN("Error: failed to open registry key\n");
726 RegSetValueExW(hKey
, NULL
, 0, REG_SZ
, (const LPBYTE
)lpName
, length
);
730 wcscpy(sName
, lpName
);
733 TRACE("result %s\n", debugstr_w(sName
));
737 HRESULT WINAPI
CDrivesFolder::GetDefaultSearchGUID(GUID
* pguid
)
739 FIXME ("(%p)\n", this);
743 HRESULT WINAPI
CDrivesFolder::EnumSearches(IEnumExtraSearch
** ppenum
)
745 FIXME ("(%p)\n", this);
749 HRESULT WINAPI
CDrivesFolder::GetDefaultColumn (DWORD dwRes
, ULONG
*pSort
, ULONG
*pDisplay
)
751 TRACE ("(%p)\n", this);
760 HRESULT WINAPI
CDrivesFolder::GetDefaultColumnState(UINT iColumn
, DWORD
* pcsFlags
)
762 TRACE ("(%p)\n", this);
764 if (!pcsFlags
|| iColumn
>= MYCOMPUTERSHELLVIEWCOLUMNS
)
766 *pcsFlags
= MyComputerSFHeader
[iColumn
].pcsFlags
;
770 HRESULT WINAPI
CDrivesFolder::GetDetailsEx(LPCITEMIDLIST pidl
, const SHCOLUMNID
* pscid
, VARIANT
* pv
)
772 FIXME ("(%p)\n", this);
776 /* FIXME: drive size >4GB is rolling over */
777 HRESULT WINAPI
CDrivesFolder::GetDetailsOf(LPCITEMIDLIST pidl
, UINT iColumn
, SHELLDETAILS
*psd
)
781 TRACE ("(%p)->(%p %i %p)\n", this, pidl
, iColumn
, psd
);
783 if (!psd
|| iColumn
>= MYCOMPUTERSHELLVIEWCOLUMNS
)
788 psd
->fmt
= MyComputerSFHeader
[iColumn
].fmt
;
789 psd
->cxChar
= MyComputerSFHeader
[iColumn
].cxChar
;
790 psd
->str
.uType
= STRRET_CSTR
;
791 LoadStringA(shell32_hInstance
, MyComputerSFHeader
[iColumn
].colnameid
,
792 psd
->str
.cStr
, MAX_PATH
);
797 char szPath
[MAX_PATH
];
798 ULARGE_INTEGER ulBytes
;
800 psd
->str
.cStr
[0] = 0x00;
801 psd
->str
.uType
= STRRET_CSTR
;
805 hr
= GetDisplayNameOf(pidl
,
806 SHGDN_NORMAL
| SHGDN_INFOLDER
, &psd
->str
);
809 _ILGetFileType(pidl
, psd
->str
.cStr
, MAX_PATH
);
811 case 2: /* total size */
812 if (_ILIsDrive(pidl
))
814 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
);
815 GetDiskFreeSpaceExA (szPath
, NULL
, &ulBytes
, NULL
);
816 StrFormatByteSizeA (ulBytes
.LowPart
, psd
->str
.cStr
, MAX_PATH
);
819 case 3: /* free size */
820 if (_ILIsDrive(pidl
))
822 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
);
823 GetDiskFreeSpaceExA (szPath
, &ulBytes
, NULL
, NULL
);
824 StrFormatByteSizeA (ulBytes
.LowPart
, psd
->str
.cStr
, MAX_PATH
);
834 HRESULT WINAPI
CDrivesFolder::MapColumnToSCID(UINT column
, SHCOLUMNID
* pscid
)
836 FIXME("(%p)\n", this);
840 /************************************************************************
841 * CDrivesFolder::GetClassID
843 HRESULT WINAPI
CDrivesFolder::GetClassID(CLSID
*lpClassId
)
845 TRACE ("(%p)\n", this);
850 *lpClassId
= CLSID_MyComputer
;
854 /************************************************************************
855 * CDrivesFolder::Initialize
857 * NOTES: it makes no sense to change the pidl
859 HRESULT WINAPI
CDrivesFolder::Initialize(LPCITEMIDLIST pidl
)
861 TRACE ("(%p)->(%p)\n", this, pidl
);
864 SHFree((LPVOID
)pidlRoot
);
866 pidlRoot
= ILClone(pidl
);
870 /**************************************************************************
871 * CDrivesFolder::GetCurFolder
873 HRESULT WINAPI
CDrivesFolder::GetCurFolder(LPITEMIDLIST
*pidl
)
875 TRACE("(%p)->(%p)\n", this, pidl
);
880 *pidl
= ILClone(pidlRoot
);