3 * Virtual Workplace folder
5 * Copyright 1997 Marcus Meissner
6 * Copyright 1998, 1999, 2002 Juergen Schmied
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "wine/port.h"
31 #define NONAMELESSUNION
32 #define NONAMELESSSTRUCT
41 #include "enumidlist.h"
42 #include "undocshell.h"
43 #include "shell32_main.h"
46 #include "shellfolder.h"
47 #include "wine/debug.h"
51 WINE_DEFAULT_DEBUG_CHANNEL (shell);
53 /***********************************************************************
54 * IShellFolder implementation
58 IShellFolder2Vtbl *lpVtbl;
60 IPersistFolder2Vtbl *lpVtblPersistFolder2;
62 /* both paths are parsible from the desktop */
63 LPITEMIDLIST pidlRoot; /* absolute pidl */
64 int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */
67 static struct ICOM_VTABLE (IShellFolder2) vt_ShellFolder2;
68 static struct ICOM_VTABLE (IPersistFolder2) vt_PersistFolder2;
70 #define _IPersistFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpVtblPersistFolder2)))
71 #define _ICOM_THIS_From_IPersistFolder2(class, name) class* This = (class*)(((char*)name)-_IPersistFolder2_Offset);
74 converts This to a interface pointer
76 #define _IUnknown_(This) (IUnknown*)&(This->lpVtbl)
77 #define _IShellFolder_(This) (IShellFolder*)&(This->lpVtbl)
78 #define _IShellFolder2_(This) (IShellFolder2*)&(This->lpVtbl)
80 #define _IPersist_(This) (IPersist*)&(This->lpVtblPersistFolder2)
81 #define _IPersistFolder_(This) (IPersistFolder*)&(This->lpVtblPersistFolder2)
82 #define _IPersistFolder2_(This) (IPersistFolder2*)&(This->lpVtblPersistFolder2)
84 /***********************************************************************
85 * IShellFolder [MyComputer] implementation
88 static shvheader MyComputerSFHeader[] = {
89 {IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
90 {IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
91 {IDS_SHV_COLUMN6, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
92 {IDS_SHV_COLUMN7, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
95 #define MYCOMPUTERSHELLVIEWCOLUMNS 4
97 /**************************************************************************
98 * ISF_MyComputer_Constructor
100 HRESULT WINAPI ISF_MyComputer_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
104 TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
109 return CLASS_E_NOAGGREGATION;
111 sf = (IGenericSFImpl *) LocalAlloc (GMEM_ZEROINIT, sizeof (IGenericSFImpl));
113 return E_OUTOFMEMORY;
116 sf->lpVtbl = &vt_ShellFolder2;
117 sf->lpVtblPersistFolder2 = &vt_PersistFolder2;
118 sf->pidlRoot = _ILCreateMyComputer (); /* my qualified pidl */
120 if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv))) {
121 IUnknown_Release (_IUnknown_ (sf));
122 return E_NOINTERFACE;
125 TRACE ("--(%p)\n", sf);
129 /**************************************************************************
130 * ISF_MyComputer_fnQueryInterface
132 * NOTES supports not IPersist/IPersistFolder
134 static HRESULT WINAPI ISF_MyComputer_fnQueryInterface (IShellFolder2 * iface, REFIID riid, LPVOID * ppvObj)
136 ICOM_THIS (IGenericSFImpl, iface);
138 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
142 if (IsEqualIID (riid, &IID_IUnknown) ||
143 IsEqualIID (riid, &IID_IShellFolder) || IsEqualIID (riid, &IID_IShellFolder2)) {
145 } else if (IsEqualIID (riid, &IID_IPersist) ||
146 IsEqualIID (riid, &IID_IPersistFolder) || IsEqualIID (riid, &IID_IPersistFolder2)) {
147 *ppvObj = _IPersistFolder2_ (This);
151 IUnknown_AddRef ((IUnknown *) (*ppvObj));
152 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
155 TRACE ("-- Interface: E_NOINTERFACE\n");
156 return E_NOINTERFACE;
159 static ULONG WINAPI ISF_MyComputer_fnAddRef (IShellFolder2 * iface)
161 ICOM_THIS (IGenericSFImpl, iface);
163 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
165 return ++(This->ref);
168 static ULONG WINAPI ISF_MyComputer_fnRelease (IShellFolder2 * iface)
170 ICOM_THIS (IGenericSFImpl, iface);
172 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
174 if (!--(This->ref)) {
175 TRACE ("-- destroying IShellFolder(%p)\n", This);
177 SHFree (This->pidlRoot);
178 LocalFree ((HLOCAL) This);
184 /**************************************************************************
185 * ISF_MyComputer_fnParseDisplayName
187 static HRESULT WINAPI
188 ISF_MyComputer_fnParseDisplayName (IShellFolder2 * iface,
191 LPOLESTR lpszDisplayName,
192 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
194 ICOM_THIS (IGenericSFImpl, iface);
196 HRESULT hr = E_INVALIDARG;
197 LPCWSTR szNext = NULL;
198 WCHAR szElement[MAX_PATH];
199 LPITEMIDLIST pidlTemp = NULL;
202 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
203 This, hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
207 *pchEaten = 0; /* strange but like the original */
209 /* handle CLSID paths */
210 if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':') {
211 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
212 TRACE ("-- element: %s\n", debugstr_w (szElement));
213 SHCLSIDFromStringW (szElement + 2, &clsid);
214 pidlTemp = _ILCreateGuid (PT_GUID, &clsid);
216 /* do we have an absolute path name ? */
217 else if (PathGetDriveNumberW (lpszDisplayName) >= 0 && lpszDisplayName[2] == (WCHAR) '\\') {
218 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
219 pidlTemp = _ILCreateDrive (szElement);
222 if (szNext && *szNext) {
223 hr = SHELL32_ParseNextElement (iface, hwndOwner, pbc, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
225 if (pdwAttributes && *pdwAttributes) {
226 SHELL32_GetItemAttributes (_IShellFolder_ (This), pidlTemp, pdwAttributes);
233 TRACE ("(%p)->(-- ret=0x%08lx)\n", This, hr);
238 /**************************************************************************
239 * CreateMyCompEnumList()
241 static BOOL CreateMyCompEnumList(IEnumIDList *list, DWORD dwFlags)
245 TRACE("(%p)->(flags=0x%08lx) \n",list,dwFlags);
247 /*enumerate the folders*/
248 if(dwFlags & SHCONTF_FOLDERS)
250 WCHAR wszDriveName[] = {'A', ':', '\\', '\0'};
251 DWORD dwDrivemap = GetLogicalDrives();
254 while (ret && wszDriveName[0]<='Z')
256 if(dwDrivemap & 0x00000001L)
257 ret = AddToEnumList(list, _ILCreateDrive(wszDriveName));
259 dwDrivemap = dwDrivemap >> 1;
262 TRACE("-- (%p)-> enumerate (mycomputer shell extensions)\n",list);
263 if (ret && !RegOpenKeyExA(HKEY_LOCAL_MACHINE,
264 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\explorer\\mycomputer\\NameSpace",
272 DWORD size = sizeof (iid);
273 LONG apiRet = RegEnumKeyExA(hkey, i, iid, &size, 0, NULL, NULL,
276 if (ERROR_SUCCESS == apiRet)
278 /* FIXME: shell extensions, shouldn't the type be
280 ret = AddToEnumList(list, _ILCreateGuidFromStrA(iid));
283 else if (ERROR_NO_MORE_ITEMS == apiRet)
294 /**************************************************************************
295 * ISF_MyComputer_fnEnumObjects
297 static HRESULT WINAPI
298 ISF_MyComputer_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
300 ICOM_THIS (IGenericSFImpl, iface);
302 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
304 *ppEnumIDList = IEnumIDList_Constructor();
306 CreateMyCompEnumList(*ppEnumIDList, dwFlags);
308 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
310 return (*ppEnumIDList) ? S_OK : E_OUTOFMEMORY;
313 /**************************************************************************
314 * ISF_MyComputer_fnBindToObject
316 static HRESULT WINAPI
317 ISF_MyComputer_fnBindToObject (IShellFolder2 * iface, LPCITEMIDLIST pidl,
318 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
320 ICOM_THIS (IGenericSFImpl, iface);
322 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
324 return SHELL32_BindToChild (This->pidlRoot, NULL, pidl, riid, ppvOut);
327 /**************************************************************************
328 * ISF_MyComputer_fnBindToStorage
330 static HRESULT WINAPI
331 ISF_MyComputer_fnBindToStorage (IShellFolder2 * iface,
332 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
334 ICOM_THIS (IGenericSFImpl, iface);
336 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
342 /**************************************************************************
343 * ISF_MyComputer_fnCompareIDs
346 static HRESULT WINAPI
347 ISF_MyComputer_fnCompareIDs (IShellFolder2 * iface, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
349 ICOM_THIS (IGenericSFImpl, iface);
353 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
354 nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
355 TRACE ("-- %i\n", nReturn);
359 /**************************************************************************
360 * ISF_MyComputer_fnCreateViewObject
362 static HRESULT WINAPI
363 ISF_MyComputer_fnCreateViewObject (IShellFolder2 * iface, HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
365 ICOM_THIS (IGenericSFImpl, iface);
367 LPSHELLVIEW pShellView;
368 HRESULT hr = E_INVALIDARG;
370 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This, hwndOwner, shdebugstr_guid (riid), ppvOut);
375 if (IsEqualIID (riid, &IID_IDropTarget)) {
376 WARN ("IDropTarget not implemented\n");
378 } else if (IsEqualIID (riid, &IID_IContextMenu)) {
379 WARN ("IContextMenu not implemented\n");
381 } else if (IsEqualIID (riid, &IID_IShellView)) {
382 pShellView = IShellView_Constructor ((IShellFolder *) iface);
384 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
385 IShellView_Release (pShellView);
389 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
393 /**************************************************************************
394 * ISF_MyComputer_fnGetAttributesOf
396 static HRESULT WINAPI
397 ISF_MyComputer_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
399 ICOM_THIS (IGenericSFImpl, iface);
403 TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This, cidl, apidl, *rgfInOut);
405 if ((!cidl) || (!apidl) || (!rgfInOut))
411 while (cidl > 0 && *apidl) {
413 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
418 TRACE ("-- result=0x%08lx\n", *rgfInOut);
422 /**************************************************************************
423 * ISF_MyComputer_fnGetUIObjectOf
426 * HWND hwndOwner, //[in ] Parent window for any output
427 * UINT cidl, //[in ] array size
428 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
429 * REFIID riid, //[in ] Requested Interface
430 * UINT* prgfInOut, //[ ] reserved
431 * LPVOID* ppvObject) //[out] Resulting Interface
434 static HRESULT WINAPI
435 ISF_MyComputer_fnGetUIObjectOf (IShellFolder2 * iface,
437 UINT cidl, LPCITEMIDLIST * apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
439 ICOM_THIS (IGenericSFImpl, iface);
442 IUnknown *pObj = NULL;
443 HRESULT hr = E_INVALIDARG;
445 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
446 This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
451 if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1)) {
452 pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface, This->pidlRoot, apidl, cidl);
454 } else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1)) {
455 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl);
457 } else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1)) {
458 pidl = ILCombine (This->pidlRoot, apidl[0]);
459 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
462 } else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1)) {
463 pidl = ILCombine (This->pidlRoot, apidl[0]);
464 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
467 } else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1)) {
468 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
469 } else if ((IsEqualIID(riid,&IID_IShellLinkW) || IsEqualIID(riid,&IID_IShellLinkA))
471 pidl = ILCombine (This->pidlRoot, apidl[0]);
472 hr = IShellLink_ConstructFromFile(NULL, riid, pidl, (LPVOID*)&pObj);
478 if (SUCCEEDED(hr) && !pObj)
483 TRACE ("(%p)->hr=0x%08lx\n", This, hr);
487 /**************************************************************************
488 * ISF_MyComputer_fnGetDisplayNameOf
490 static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
492 ICOM_THIS (IGenericSFImpl, iface);
494 char szPath[MAX_PATH],
500 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
509 bSimplePidl = _ILIsPidlSimple (pidl);
511 if (!pidl->mkid.cb) {
512 /* parsing name like ::{...} */
513 lstrcpyA (szPath, "::");
514 SHELL32_GUIDToStringA(&CLSID_MyComputer, &szPath[2]);
515 } else if (_ILIsSpecialFolder (pidl)) {
516 /* take names of special folders only if its only this folder */
520 if ((clsid = _ILGetGUIDPointer (pidl))) {
521 if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING) {
522 int bWantsForParsing;
525 * we can only get a filesystem path from a shellfolder if the value WantsFORPARSING in
526 * CLSID\\{...}\\shellfolder exists
527 * exception: the MyComputer folder has this keys not but like any filesystem backed
528 * folder it needs these behaviour
530 /* get the "WantsFORPARSING" flag from the registry */
533 lstrcpyA (szRegPath, "CLSID\\");
534 SHELL32_GUIDToStringA (clsid, &szRegPath[6]);
535 lstrcatA (szRegPath, "\\shellfolder");
538 SHGetValueA (HKEY_CLASSES_ROOT, szRegPath, "WantsFORPARSING", NULL, NULL, NULL));
540 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && bWantsForParsing) {
541 /* we need the filesystem path to the destination folder. Only the folder itself can know it */
542 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, szPath, MAX_PATH);
546 /* parsing name like ::{...} */
547 p = lstrcpyA(szPath, "::") + 2;
548 p += SHELL32_GUIDToStringA(&CLSID_MyComputer, p);
552 SHELL32_GUIDToStringA(clsid, p);
555 /* user friendly name */
556 HCR_GetClassNameA (clsid, szPath, MAX_PATH);
559 _ILSimpleGetText (pidl, szPath, MAX_PATH); /* append my own path */
561 FIXME ("special folder\n");
564 if (!_ILIsDrive (pidl)) {
565 ERR ("Wrong pidl type\n");
569 _ILSimpleGetText (pidl, szPath, MAX_PATH); /* append my own path */
571 /* long view "lw_name (C:)" */
572 if (bSimplePidl && !(dwFlags & SHGDN_FORPARSING)) {
573 DWORD dwVolumeSerialNumber,
574 dwMaximumComponetLength,
577 GetVolumeInformationA (szPath, szDrive, sizeof (szDrive) - 6, &dwVolumeSerialNumber,
578 &dwMaximumComponetLength, &dwFileSystemFlags, NULL, 0);
579 strcat (szDrive, " (");
580 strncat (szDrive, szPath, 2);
581 strcat (szDrive, ")");
582 strcpy (szPath, szDrive);
586 if (!bSimplePidl) { /* go deeper if needed */
587 PathAddBackslashA (szPath);
588 len = strlen (szPath);
590 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags | SHGDN_INFOLDER, szPath + len, MAX_PATH - len);
593 if (SUCCEEDED (hr)) {
594 strRet->uType = STRRET_CSTR;
595 lstrcpynA (strRet->u.cStr, szPath, MAX_PATH);
598 TRACE ("-- (%p)->(%s)\n", This, szPath);
602 /**************************************************************************
603 * ISF_MyComputer_fnSetNameOf
604 * Changes the name of a file object or subfolder, possibly changing its item
605 * identifier in the process.
608 * HWND hwndOwner, //[in ] Owner window for output
609 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
610 * LPCOLESTR lpszName, //[in ] the items new display name
611 * DWORD dwFlags, //[in ] SHGNO formatting flags
612 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
614 static HRESULT WINAPI ISF_MyComputer_fnSetNameOf (IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */
615 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
617 ICOM_THIS (IGenericSFImpl, iface);
618 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
622 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultSearchGUID (IShellFolder2 * iface, GUID * pguid)
624 ICOM_THIS (IGenericSFImpl, iface);
625 FIXME ("(%p)\n", This);
628 static HRESULT WINAPI ISF_MyComputer_fnEnumSearches (IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
630 ICOM_THIS (IGenericSFImpl, iface);
631 FIXME ("(%p)\n", This);
634 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumn (IShellFolder2 * iface, DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
636 ICOM_THIS (IGenericSFImpl, iface);
638 TRACE ("(%p)\n", This);
640 if (pSort) *pSort = 0;
641 if (pDisplay) *pDisplay = 0;
644 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumnState (IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
646 ICOM_THIS (IGenericSFImpl, iface);
648 TRACE ("(%p)\n", This);
650 if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS) return E_INVALIDARG;
651 *pcsFlags = MyComputerSFHeader[iColumn].pcsFlags;
654 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsEx (IShellFolder2 * iface, LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
656 ICOM_THIS (IGenericSFImpl, iface);
657 FIXME ("(%p)\n", This);
661 /* FIXME: drive size >4GB is rolling over */
662 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
664 ICOM_THIS (IGenericSFImpl, iface);
667 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
669 if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
673 psd->fmt = MyComputerSFHeader[iColumn].fmt;
674 psd->cxChar = MyComputerSFHeader[iColumn].cxChar;
675 psd->str.uType = STRRET_CSTR;
676 LoadStringA (shell32_hInstance, MyComputerSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
679 char szPath[MAX_PATH];
680 ULARGE_INTEGER ulBytes;
682 psd->str.u.cStr[0] = 0x00;
683 psd->str.uType = STRRET_CSTR;
686 hr = IShellFolder_GetDisplayNameOf (iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
689 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
691 case 2: /* total size */
692 if (_ILIsDrive (pidl)) {
693 _ILSimpleGetText (pidl, szPath, MAX_PATH);
694 GetDiskFreeSpaceExA (szPath, NULL, &ulBytes, NULL);
695 StrFormatByteSizeA (ulBytes.u.LowPart, psd->str.u.cStr, MAX_PATH);
698 case 3: /* free size */
699 if (_ILIsDrive (pidl)) {
700 _ILSimpleGetText (pidl, szPath, MAX_PATH);
701 GetDiskFreeSpaceExA (szPath, &ulBytes, NULL, NULL);
702 StrFormatByteSizeA (ulBytes.u.LowPart, psd->str.u.cStr, MAX_PATH);
711 static HRESULT WINAPI ISF_MyComputer_fnMapColumnToSCID (IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
713 ICOM_THIS (IGenericSFImpl, iface);
714 FIXME ("(%p)\n", This);
718 static ICOM_VTABLE (IShellFolder2) vt_ShellFolder2 =
720 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
721 ISF_MyComputer_fnQueryInterface,
722 ISF_MyComputer_fnAddRef,
723 ISF_MyComputer_fnRelease,
724 ISF_MyComputer_fnParseDisplayName,
725 ISF_MyComputer_fnEnumObjects,
726 ISF_MyComputer_fnBindToObject,
727 ISF_MyComputer_fnBindToStorage,
728 ISF_MyComputer_fnCompareIDs,
729 ISF_MyComputer_fnCreateViewObject,
730 ISF_MyComputer_fnGetAttributesOf,
731 ISF_MyComputer_fnGetUIObjectOf,
732 ISF_MyComputer_fnGetDisplayNameOf,
733 ISF_MyComputer_fnSetNameOf,
735 ISF_MyComputer_fnGetDefaultSearchGUID,
736 ISF_MyComputer_fnEnumSearches,
737 ISF_MyComputer_fnGetDefaultColumn,
738 ISF_MyComputer_fnGetDefaultColumnState,
739 ISF_MyComputer_fnGetDetailsEx,
740 ISF_MyComputer_fnGetDetailsOf,
741 ISF_MyComputer_fnMapColumnToSCID
744 /************************************************************************
745 * IMCFldr_PersistFolder2_QueryInterface
747 static HRESULT WINAPI IMCFldr_PersistFolder2_QueryInterface (IPersistFolder2 * iface, REFIID iid, LPVOID * ppvObj)
749 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
751 TRACE ("(%p)\n", This);
753 return IUnknown_QueryInterface (_IUnknown_ (This), iid, ppvObj);
756 /************************************************************************
757 * IMCFldr_PersistFolder2_AddRef
759 static ULONG WINAPI IMCFldr_PersistFolder2_AddRef (IPersistFolder2 * iface)
761 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
763 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
765 return IUnknown_AddRef (_IUnknown_ (This));
768 /************************************************************************
769 * ISFPersistFolder_Release
771 static ULONG WINAPI IMCFldr_PersistFolder2_Release (IPersistFolder2 * iface)
773 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
775 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
777 return IUnknown_Release (_IUnknown_ (This));
780 /************************************************************************
781 * IMCFldr_PersistFolder2_GetClassID
783 static HRESULT WINAPI IMCFldr_PersistFolder2_GetClassID (IPersistFolder2 * iface, CLSID * lpClassId)
785 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
787 TRACE ("(%p)\n", This);
791 *lpClassId = CLSID_MyComputer;
796 /************************************************************************
797 * IMCFldr_PersistFolder2_Initialize
799 * NOTES: it makes no sense to change the pidl
801 static HRESULT WINAPI IMCFldr_PersistFolder2_Initialize (IPersistFolder2 * iface, LPCITEMIDLIST pidl)
803 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
804 TRACE ("(%p)->(%p)\n", This, pidl);
808 /**************************************************************************
809 * IPersistFolder2_fnGetCurFolder
811 static HRESULT WINAPI IMCFldr_PersistFolder2_GetCurFolder (IPersistFolder2 * iface, LPITEMIDLIST * pidl)
813 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
815 TRACE ("(%p)->(%p)\n", This, pidl);
819 *pidl = ILClone (This->pidlRoot);
823 static ICOM_VTABLE (IPersistFolder2) vt_PersistFolder2 =
825 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
826 IMCFldr_PersistFolder2_QueryInterface,
827 IMCFldr_PersistFolder2_AddRef,
828 IMCFldr_PersistFolder2_Release,
829 IMCFldr_PersistFolder2_GetClassID,
830 IMCFldr_PersistFolder2_Initialize,
831 IMCFldr_PersistFolder2_GetCurFolder