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 ICOM_VFIELD (IShellFolder2);
60 ICOM_VTABLE (IPersistFolder2) * 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 CHAR szTempA[MAX_PATH];
200 LPITEMIDLIST pidlTemp = NULL;
203 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
204 This, hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
208 *pchEaten = 0; /* strange but like the original */
210 /* handle CLSID paths */
211 if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':') {
212 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
213 TRACE ("-- element: %s\n", debugstr_w (szElement));
214 SHCLSIDFromStringW (szElement + 2, &clsid);
215 pidlTemp = _ILCreateGuid (PT_GUID, &clsid);
217 /* do we have an absolute path name ? */
218 else if (PathGetDriveNumberW (lpszDisplayName) >= 0 && lpszDisplayName[2] == (WCHAR) '\\') {
219 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
220 WideCharToMultiByte (CP_ACP, 0, szElement, -1, szTempA, MAX_PATH, NULL, NULL);
221 pidlTemp = _ILCreateDrive (szTempA);
224 if (szNext && *szNext) {
225 hr = SHELL32_ParseNextElement (iface, hwndOwner, pbc, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
227 if (pdwAttributes && *pdwAttributes) {
228 SHELL32_GetItemAttributes (_IShellFolder_ (This), pidlTemp, pdwAttributes);
235 TRACE ("(%p)->(-- ret=0x%08lx)\n", This, hr);
240 /**************************************************************************
241 * CreateMyCompEnumList()
243 static BOOL CreateMyCompEnumList(IEnumIDList *list, DWORD dwFlags)
247 TRACE("(%p)->(flags=0x%08lx) \n",list,dwFlags);
249 /*enumerate the folders*/
250 if(dwFlags & SHCONTF_FOLDERS)
252 CHAR szDriveName[] = "A:\\";
253 DWORD dwDrivemap = GetLogicalDrives();
256 while (ret && szDriveName[0]<='Z')
258 if(dwDrivemap & 0x00000001L)
259 ret = AddToEnumList(list, _ILCreateDrive(szDriveName));
261 dwDrivemap = dwDrivemap >> 1;
264 TRACE("-- (%p)-> enumerate (mycomputer shell extensions)\n",list);
265 if (ret && !RegOpenKeyExA(HKEY_LOCAL_MACHINE,
266 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\explorer\\mycomputer\\NameSpace",
274 DWORD size = sizeof (iid);
275 LONG apiRet = RegEnumKeyExA(hkey, i, iid, &size, 0, NULL, NULL,
278 if (ERROR_SUCCESS == apiRet)
280 /* FIXME: shell extensions, shouldn't the type be
282 ret = AddToEnumList(list, _ILCreateGuidFromStrA(iid));
285 else if (ERROR_NO_MORE_ITEMS == apiRet)
296 /**************************************************************************
297 * ISF_MyComputer_fnEnumObjects
299 static HRESULT WINAPI
300 ISF_MyComputer_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
302 ICOM_THIS (IGenericSFImpl, iface);
304 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
306 *ppEnumIDList = IEnumIDList_Constructor();
308 CreateMyCompEnumList(*ppEnumIDList, dwFlags);
310 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
312 return (*ppEnumIDList) ? S_OK : E_OUTOFMEMORY;
315 /**************************************************************************
316 * ISF_MyComputer_fnBindToObject
318 static HRESULT WINAPI
319 ISF_MyComputer_fnBindToObject (IShellFolder2 * iface, LPCITEMIDLIST pidl,
320 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
322 ICOM_THIS (IGenericSFImpl, iface);
324 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
326 return SHELL32_BindToChild (This->pidlRoot, NULL, pidl, riid, ppvOut);
329 /**************************************************************************
330 * ISF_MyComputer_fnBindToStorage
332 static HRESULT WINAPI
333 ISF_MyComputer_fnBindToStorage (IShellFolder2 * iface,
334 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
336 ICOM_THIS (IGenericSFImpl, iface);
338 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
344 /**************************************************************************
345 * ISF_MyComputer_fnCompareIDs
348 static HRESULT WINAPI
349 ISF_MyComputer_fnCompareIDs (IShellFolder2 * iface, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
351 ICOM_THIS (IGenericSFImpl, iface);
355 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
356 nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
357 TRACE ("-- %i\n", nReturn);
361 /**************************************************************************
362 * ISF_MyComputer_fnCreateViewObject
364 static HRESULT WINAPI
365 ISF_MyComputer_fnCreateViewObject (IShellFolder2 * iface, HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
367 ICOM_THIS (IGenericSFImpl, iface);
369 LPSHELLVIEW pShellView;
370 HRESULT hr = E_INVALIDARG;
372 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This, hwndOwner, shdebugstr_guid (riid), ppvOut);
377 if (IsEqualIID (riid, &IID_IDropTarget)) {
378 WARN ("IDropTarget not implemented\n");
380 } else if (IsEqualIID (riid, &IID_IContextMenu)) {
381 WARN ("IContextMenu not implemented\n");
383 } else if (IsEqualIID (riid, &IID_IShellView)) {
384 pShellView = IShellView_Constructor ((IShellFolder *) iface);
386 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
387 IShellView_Release (pShellView);
391 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
395 /**************************************************************************
396 * ISF_MyComputer_fnGetAttributesOf
398 static HRESULT WINAPI
399 ISF_MyComputer_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
401 ICOM_THIS (IGenericSFImpl, iface);
405 TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This, cidl, apidl, *rgfInOut);
407 if ((!cidl) || (!apidl) || (!rgfInOut))
410 while (cidl > 0 && *apidl) {
412 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
417 TRACE ("-- result=0x%08lx\n", *rgfInOut);
421 /**************************************************************************
422 * ISF_MyComputer_fnGetUIObjectOf
425 * HWND hwndOwner, //[in ] Parent window for any output
426 * UINT cidl, //[in ] array size
427 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
428 * REFIID riid, //[in ] Requested Interface
429 * UINT* prgfInOut, //[ ] reserved
430 * LPVOID* ppvObject) //[out] Resulting Interface
433 static HRESULT WINAPI
434 ISF_MyComputer_fnGetUIObjectOf (IShellFolder2 * iface,
436 UINT cidl, LPCITEMIDLIST * apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
438 ICOM_THIS (IGenericSFImpl, iface);
441 IUnknown *pObj = NULL;
442 HRESULT hr = E_INVALIDARG;
444 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
445 This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
450 if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1)) {
451 pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface, This->pidlRoot, apidl, cidl);
453 } else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1)) {
454 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl);
456 } else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1)) {
457 pidl = ILCombine (This->pidlRoot, apidl[0]);
458 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
461 } else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1)) {
462 pidl = ILCombine (This->pidlRoot, apidl[0]);
463 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
466 } else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1)) {
467 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
468 } else if ((IsEqualIID(riid,&IID_IShellLinkW) || IsEqualIID(riid,&IID_IShellLinkA))
470 pidl = ILCombine (This->pidlRoot, apidl[0]);
471 hr = IShellLink_ConstructFromFile(NULL, riid, pidl, (LPVOID*)&pObj);
477 if (SUCCEEDED(hr) && !pObj)
482 TRACE ("(%p)->hr=0x%08lx\n", This, hr);
486 /**************************************************************************
487 * ISF_MyComputer_fnGetDisplayNameOf
489 static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
491 ICOM_THIS (IGenericSFImpl, iface);
493 char szPath[MAX_PATH],
499 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
508 bSimplePidl = _ILIsPidlSimple (pidl);
510 if (!pidl->mkid.cb) {
511 /* parsing name like ::{...} */
512 lstrcpyA (szPath, "::");
513 SHELL32_GUIDToStringA(&CLSID_MyComputer, &szPath[2]);
514 } else if (_ILIsSpecialFolder (pidl)) {
515 /* take names of special folders only if its only this folder */
519 if ((clsid = _ILGetGUIDPointer (pidl))) {
520 if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING) {
521 int bWantsForParsing;
524 * we can only get a filesystem path from a shellfolder if the value WantsFORPARSING in
525 * CLSID\\{...}\\shellfolder exists
526 * exception: the MyComputer folder has this keys not but like any filesystem backed
527 * folder it needs these behaviour
529 /* get the "WantsFORPARSING" flag from the registry */
532 lstrcpyA (szRegPath, "CLSID\\");
533 SHELL32_GUIDToStringA (clsid, &szRegPath[6]);
534 lstrcatA (szRegPath, "\\shellfolder");
537 SHGetValueA (HKEY_CLASSES_ROOT, szRegPath, "WantsFORPARSING", NULL, NULL, NULL));
539 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && bWantsForParsing) {
540 /* we need the filesystem path to the destination folder. Only the folder itself can know it */
541 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, szPath, MAX_PATH);
545 /* parsing name like ::{...} */
546 p = lstrcpyA(szPath, "::") + 2;
547 p += SHELL32_GUIDToStringA(&CLSID_MyComputer, p);
551 SHELL32_GUIDToStringA(clsid, p);
554 /* user friendly name */
555 HCR_GetClassNameA (clsid, szPath, MAX_PATH);
558 _ILSimpleGetText (pidl, szPath, MAX_PATH); /* append my own path */
560 FIXME ("special folder\n");
563 if (!_ILIsDrive (pidl)) {
564 ERR ("Wrong pidl type\n");
568 _ILSimpleGetText (pidl, szPath, MAX_PATH); /* append my own path */
570 /* long view "lw_name (C:)" */
571 if (bSimplePidl && !(dwFlags & SHGDN_FORPARSING)) {
572 DWORD dwVolumeSerialNumber,
573 dwMaximumComponetLength,
576 GetVolumeInformationA (szPath, szDrive, sizeof (szDrive) - 6, &dwVolumeSerialNumber,
577 &dwMaximumComponetLength, &dwFileSystemFlags, NULL, 0);
578 strcat (szDrive, " (");
579 strncat (szDrive, szPath, 2);
580 strcat (szDrive, ")");
581 strcpy (szPath, szDrive);
585 if (!bSimplePidl) { /* go deeper if needed */
586 PathAddBackslashA (szPath);
587 len = strlen (szPath);
589 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags | SHGDN_INFOLDER, szPath + len, MAX_PATH - len);
592 if (SUCCEEDED (hr)) {
593 strRet->uType = STRRET_CSTR;
594 lstrcpynA (strRet->u.cStr, szPath, MAX_PATH);
597 TRACE ("-- (%p)->(%s)\n", This, szPath);
601 /**************************************************************************
602 * ISF_MyComputer_fnSetNameOf
603 * Changes the name of a file object or subfolder, possibly changing its item
604 * identifier in the process.
607 * HWND hwndOwner, //[in ] Owner window for output
608 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
609 * LPCOLESTR lpszName, //[in ] the items new display name
610 * DWORD dwFlags, //[in ] SHGNO formatting flags
611 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
613 static HRESULT WINAPI ISF_MyComputer_fnSetNameOf (IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */
614 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
616 ICOM_THIS (IGenericSFImpl, iface);
617 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
621 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultSearchGUID (IShellFolder2 * iface, GUID * pguid)
623 ICOM_THIS (IGenericSFImpl, iface);
624 FIXME ("(%p)\n", This);
627 static HRESULT WINAPI ISF_MyComputer_fnEnumSearches (IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
629 ICOM_THIS (IGenericSFImpl, iface);
630 FIXME ("(%p)\n", This);
633 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumn (IShellFolder2 * iface, DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
635 ICOM_THIS (IGenericSFImpl, iface);
637 TRACE ("(%p)\n", This);
639 if (pSort) *pSort = 0;
640 if (pDisplay) *pDisplay = 0;
643 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumnState (IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
645 ICOM_THIS (IGenericSFImpl, iface);
647 TRACE ("(%p)\n", This);
649 if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS) return E_INVALIDARG;
650 *pcsFlags = MyComputerSFHeader[iColumn].pcsFlags;
653 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsEx (IShellFolder2 * iface, LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
655 ICOM_THIS (IGenericSFImpl, iface);
656 FIXME ("(%p)\n", This);
660 /* FIXME: drive size >4GB is rolling over */
661 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
663 ICOM_THIS (IGenericSFImpl, iface);
666 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
668 if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
672 psd->fmt = MyComputerSFHeader[iColumn].fmt;
673 psd->cxChar = MyComputerSFHeader[iColumn].cxChar;
674 psd->str.uType = STRRET_CSTR;
675 LoadStringA (shell32_hInstance, MyComputerSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
678 char szPath[MAX_PATH];
679 ULARGE_INTEGER ulBytes;
681 psd->str.u.cStr[0] = 0x00;
682 psd->str.uType = STRRET_CSTR;
685 hr = IShellFolder_GetDisplayNameOf (iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
688 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
690 case 2: /* total size */
691 if (_ILIsDrive (pidl)) {
692 _ILSimpleGetText (pidl, szPath, MAX_PATH);
693 GetDiskFreeSpaceExA (szPath, NULL, &ulBytes, NULL);
694 StrFormatByteSizeA (ulBytes.u.LowPart, psd->str.u.cStr, MAX_PATH);
697 case 3: /* free size */
698 if (_ILIsDrive (pidl)) {
699 _ILSimpleGetText (pidl, szPath, MAX_PATH);
700 GetDiskFreeSpaceExA (szPath, &ulBytes, NULL, NULL);
701 StrFormatByteSizeA (ulBytes.u.LowPart, psd->str.u.cStr, MAX_PATH);
710 static HRESULT WINAPI ISF_MyComputer_fnMapColumnToSCID (IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
712 ICOM_THIS (IGenericSFImpl, iface);
713 FIXME ("(%p)\n", This);
717 static ICOM_VTABLE (IShellFolder2) vt_ShellFolder2 =
719 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
720 ISF_MyComputer_fnQueryInterface,
721 ISF_MyComputer_fnAddRef,
722 ISF_MyComputer_fnRelease,
723 ISF_MyComputer_fnParseDisplayName,
724 ISF_MyComputer_fnEnumObjects,
725 ISF_MyComputer_fnBindToObject,
726 ISF_MyComputer_fnBindToStorage,
727 ISF_MyComputer_fnCompareIDs,
728 ISF_MyComputer_fnCreateViewObject,
729 ISF_MyComputer_fnGetAttributesOf,
730 ISF_MyComputer_fnGetUIObjectOf,
731 ISF_MyComputer_fnGetDisplayNameOf,
732 ISF_MyComputer_fnSetNameOf,
734 ISF_MyComputer_fnGetDefaultSearchGUID,
735 ISF_MyComputer_fnEnumSearches,
736 ISF_MyComputer_fnGetDefaultColumn,
737 ISF_MyComputer_fnGetDefaultColumnState,
738 ISF_MyComputer_fnGetDetailsEx,
739 ISF_MyComputer_fnGetDetailsOf,
740 ISF_MyComputer_fnMapColumnToSCID
743 /************************************************************************
744 * IMCFldr_PersistFolder2_QueryInterface
746 static HRESULT WINAPI IMCFldr_PersistFolder2_QueryInterface (IPersistFolder2 * iface, REFIID iid, LPVOID * ppvObj)
748 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
750 TRACE ("(%p)\n", This);
752 return IUnknown_QueryInterface (_IUnknown_ (This), iid, ppvObj);
755 /************************************************************************
756 * IMCFldr_PersistFolder2_AddRef
758 static ULONG WINAPI IMCFldr_PersistFolder2_AddRef (IPersistFolder2 * iface)
760 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
762 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
764 return IUnknown_AddRef (_IUnknown_ (This));
767 /************************************************************************
768 * ISFPersistFolder_Release
770 static ULONG WINAPI IMCFldr_PersistFolder2_Release (IPersistFolder2 * iface)
772 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
774 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
776 return IUnknown_Release (_IUnknown_ (This));
779 /************************************************************************
780 * IMCFldr_PersistFolder2_GetClassID
782 static HRESULT WINAPI IMCFldr_PersistFolder2_GetClassID (IPersistFolder2 * iface, CLSID * lpClassId)
784 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
786 TRACE ("(%p)\n", This);
790 *lpClassId = CLSID_MyComputer;
795 /************************************************************************
796 * IMCFldr_PersistFolder2_Initialize
798 * NOTES: it makes no sense to change the pidl
800 static HRESULT WINAPI IMCFldr_PersistFolder2_Initialize (IPersistFolder2 * iface, LPCITEMIDLIST pidl)
802 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
803 TRACE ("(%p)->(%p)\n", This, pidl);
807 /**************************************************************************
808 * IPersistFolder2_fnGetCurFolder
810 static HRESULT WINAPI IMCFldr_PersistFolder2_GetCurFolder (IPersistFolder2 * iface, LPITEMIDLIST * pidl)
812 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
814 TRACE ("(%p)->(%p)\n", This, pidl);
818 *pidl = ILClone (This->pidlRoot);
822 static ICOM_VTABLE (IPersistFolder2) vt_PersistFolder2 =
824 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
825 IMCFldr_PersistFolder2_QueryInterface,
826 IMCFldr_PersistFolder2_AddRef,
827 IMCFldr_PersistFolder2_Release,
828 IMCFldr_PersistFolder2_GetClassID,
829 IMCFldr_PersistFolder2_Initialize,
830 IMCFldr_PersistFolder2_GetCurFolder