2 * Virtual Workplace folder
4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998, 1999, 2002 Juergen Schmied
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "wine/port.h"
31 #define NONAMELESSUNION
32 #define NONAMELESSSTRUCT
42 #include "enumidlist.h"
43 #include "undocshell.h"
44 #include "shell32_main.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 IShellFolder2Vtbl vt_ShellFolder2;
68 static struct IPersistFolder2Vtbl 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 an 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 = LocalAlloc (LMEM_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)))
122 IUnknown_Release (_IUnknown_ (sf));
123 return E_NOINTERFACE;
126 TRACE ("--(%p)\n", sf);
130 /**************************************************************************
131 * ISF_MyComputer_fnQueryInterface
133 * NOTES supports not IPersist/IPersistFolder
135 static HRESULT WINAPI ISF_MyComputer_fnQueryInterface (IShellFolder2 *iface,
136 REFIID riid, LPVOID *ppvObj)
138 IGenericSFImpl *This = (IGenericSFImpl *)iface;
140 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
144 if (IsEqualIID (riid, &IID_IUnknown) ||
145 IsEqualIID (riid, &IID_IShellFolder) ||
146 IsEqualIID (riid, &IID_IShellFolder2))
150 else if (IsEqualIID (riid, &IID_IPersist) ||
151 IsEqualIID (riid, &IID_IPersistFolder) ||
152 IsEqualIID (riid, &IID_IPersistFolder2))
154 *ppvObj = _IPersistFolder2_ (This);
159 IUnknown_AddRef ((IUnknown *) (*ppvObj));
160 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
163 TRACE ("-- Interface: E_NOINTERFACE\n");
164 return E_NOINTERFACE;
167 static ULONG WINAPI ISF_MyComputer_fnAddRef (IShellFolder2 * iface)
169 IGenericSFImpl *This = (IGenericSFImpl *)iface;
170 ULONG refCount = InterlockedIncrement(&This->ref);
172 TRACE ("(%p)->(count=%lu)\n", This, refCount - 1);
177 static ULONG WINAPI ISF_MyComputer_fnRelease (IShellFolder2 * iface)
179 IGenericSFImpl *This = (IGenericSFImpl *)iface;
180 ULONG refCount = InterlockedDecrement(&This->ref);
182 TRACE ("(%p)->(count=%lu)\n", This, refCount + 1);
186 TRACE ("-- destroying IShellFolder(%p)\n", This);
188 SHFree (This->pidlRoot);
189 LocalFree ((HLOCAL) This);
194 /**************************************************************************
195 * ISF_MyComputer_fnParseDisplayName
197 static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName (IShellFolder2 *iface,
198 HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName,
199 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
201 IGenericSFImpl *This = (IGenericSFImpl *)iface;
202 HRESULT hr = E_INVALIDARG;
203 LPCWSTR szNext = NULL;
204 WCHAR szElement[MAX_PATH];
205 LPITEMIDLIST pidlTemp = NULL;
208 TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", This,
209 hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName),
210 pchEaten, ppidl, pdwAttributes);
214 *pchEaten = 0; /* strange but like the original */
216 /* handle CLSID paths */
217 if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':')
219 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
220 TRACE ("-- element: %s\n", debugstr_w (szElement));
221 SHCLSIDFromStringW (szElement + 2, &clsid);
222 pidlTemp = _ILCreateGuid (PT_GUID, &clsid);
224 /* do we have an absolute path name ? */
225 else if (PathGetDriveNumberW (lpszDisplayName) >= 0 &&
226 lpszDisplayName[2] == (WCHAR) '\\')
228 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
229 /* make drive letter uppercase to enable PIDL comparison */
230 szElement[0] = toupper(szElement[0]);
231 pidlTemp = _ILCreateDrive (szElement);
234 if (szNext && *szNext)
236 hr = SHELL32_ParseNextElement (iface, hwndOwner, pbc, &pidlTemp,
237 (LPOLESTR) szNext, pchEaten, pdwAttributes);
241 if (pdwAttributes && *pdwAttributes)
242 SHELL32_GetItemAttributes (_IShellFolder_ (This),
243 pidlTemp, pdwAttributes);
249 TRACE ("(%p)->(-- ret=0x%08lx)\n", This, hr);
254 /**************************************************************************
255 * CreateMyCompEnumList()
257 static const WCHAR MyComputer_NameSpaceW[] = { 'S','O','F','T','W','A','R','E',
258 '\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
259 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l',
260 'o','r','e','r','\\','M','y','C','o','m','p','u','t','e','r','\\','N','a','m',
261 'e','s','p','a','c','e','\0' };
263 static BOOL CreateMyCompEnumList(IEnumIDList *list, DWORD dwFlags)
267 TRACE("(%p)->(flags=0x%08lx) \n",list,dwFlags);
269 /* enumerate the folders */
270 if (dwFlags & SHCONTF_FOLDERS)
272 WCHAR wszDriveName[] = {'A', ':', '\\', '\0'};
273 DWORD dwDrivemap = GetLogicalDrives();
276 while (ret && wszDriveName[0]<='Z')
278 if(dwDrivemap & 0x00000001L)
279 ret = AddToEnumList(list, _ILCreateDrive(wszDriveName));
281 dwDrivemap = dwDrivemap >> 1;
284 TRACE("-- (%p)-> enumerate (mycomputer shell extensions)\n",list);
285 if (ret && !RegOpenKeyExW(HKEY_LOCAL_MACHINE, MyComputer_NameSpaceW,
296 size = sizeof(iid) / sizeof(iid[0]);
297 r = RegEnumKeyExW(hkey, i, iid, &size, 0, NULL, NULL, NULL);
298 if (ERROR_SUCCESS == r)
300 /* FIXME: shell extensions, shouldn't the type be
302 ret = AddToEnumList(list, _ILCreateGuidFromStrW(iid));
305 else if (ERROR_NO_MORE_ITEMS == r)
316 /**************************************************************************
317 * ISF_MyComputer_fnEnumObjects
319 static HRESULT WINAPI ISF_MyComputer_fnEnumObjects (IShellFolder2 *iface,
320 HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
322 IGenericSFImpl *This = (IGenericSFImpl *)iface;
324 TRACE("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This,
325 hwndOwner, dwFlags, ppEnumIDList);
327 *ppEnumIDList = IEnumIDList_Constructor();
329 CreateMyCompEnumList(*ppEnumIDList, dwFlags);
331 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
333 return (*ppEnumIDList) ? S_OK : E_OUTOFMEMORY;
336 /**************************************************************************
337 * ISF_MyComputer_fnBindToObject
339 static HRESULT WINAPI ISF_MyComputer_fnBindToObject (IShellFolder2 *iface,
340 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
342 IGenericSFImpl *This = (IGenericSFImpl *)iface;
344 TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", This,
345 pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
347 return SHELL32_BindToChild (This->pidlRoot, NULL, pidl, riid, ppvOut);
350 /**************************************************************************
351 * ISF_MyComputer_fnBindToStorage
353 static HRESULT WINAPI ISF_MyComputer_fnBindToStorage (IShellFolder2 * iface,
354 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
356 IGenericSFImpl *This = (IGenericSFImpl *)iface;
358 FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", This,
359 pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
365 /**************************************************************************
366 * ISF_MyComputer_fnCompareIDs
369 static HRESULT WINAPI ISF_MyComputer_fnCompareIDs (IShellFolder2 *iface,
370 LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
372 IGenericSFImpl *This = (IGenericSFImpl *)iface;
375 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
376 nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
377 TRACE ("-- %i\n", nReturn);
381 /**************************************************************************
382 * ISF_MyComputer_fnCreateViewObject
384 static HRESULT WINAPI ISF_MyComputer_fnCreateViewObject (IShellFolder2 *iface,
385 HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
387 IGenericSFImpl *This = (IGenericSFImpl *)iface;
388 LPSHELLVIEW pShellView;
389 HRESULT hr = E_INVALIDARG;
391 TRACE("(%p)->(hwnd=%p,%s,%p)\n", This,
392 hwndOwner, shdebugstr_guid (riid), ppvOut);
399 if (IsEqualIID (riid, &IID_IDropTarget))
401 WARN ("IDropTarget not implemented\n");
404 else if (IsEqualIID (riid, &IID_IContextMenu))
406 WARN ("IContextMenu not implemented\n");
409 else if (IsEqualIID (riid, &IID_IShellView))
411 pShellView = IShellView_Constructor ((IShellFolder *) iface);
414 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
415 IShellView_Release (pShellView);
418 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
422 /**************************************************************************
423 * ISF_MyComputer_fnGetAttributesOf
425 static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf (IShellFolder2 * iface,
426 UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
428 IGenericSFImpl *This = (IGenericSFImpl *)iface;
431 TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08lx))\n",
432 This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
442 while (cidl > 0 && *apidl)
445 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
449 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
450 *rgfInOut &= ~SFGAO_VALIDATE;
452 TRACE ("-- result=0x%08lx\n", *rgfInOut);
456 /**************************************************************************
457 * ISF_MyComputer_fnGetUIObjectOf
460 * hwndOwner [in] Parent window for any output
461 * cidl [in] array size
462 * apidl [in] simple pidl array
463 * riid [in] Requested Interface
464 * prgfInOut [ ] reserved
465 * ppvObject [out] Resulting Interface
468 static HRESULT WINAPI ISF_MyComputer_fnGetUIObjectOf (IShellFolder2 * iface,
469 HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl, REFIID riid,
470 UINT * prgfInOut, LPVOID * ppvOut)
472 IGenericSFImpl *This = (IGenericSFImpl *)iface;
475 IUnknown *pObj = NULL;
476 HRESULT hr = E_INVALIDARG;
478 TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", This,
479 hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
486 if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1))
488 pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface,
489 This->pidlRoot, apidl, cidl);
492 else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1))
494 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner,
495 This->pidlRoot, apidl, cidl);
498 else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1))
500 pidl = ILCombine (This->pidlRoot, apidl[0]);
501 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
505 else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1))
507 pidl = ILCombine (This->pidlRoot, apidl[0]);
508 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
512 else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1))
514 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget,
517 else if ((IsEqualIID(riid,&IID_IShellLinkW) ||
518 IsEqualIID(riid,&IID_IShellLinkA)) && (cidl == 1))
520 pidl = ILCombine (This->pidlRoot, apidl[0]);
521 hr = IShellLink_ConstructFromFile(NULL, riid, pidl, (LPVOID*) &pObj);
527 if (SUCCEEDED(hr) && !pObj)
531 TRACE ("(%p)->hr=0x%08lx\n", This, hr);
535 /**************************************************************************
536 * ISF_MyComputer_fnGetDisplayNameOf
538 static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
539 LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
541 IGenericSFImpl *This = (IGenericSFImpl *)iface;
543 char szPath[MAX_PATH];
546 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
556 /* parsing name like ::{...} */
557 lstrcpyA (szPath, "::");
558 SHELL32_GUIDToStringA(&CLSID_MyComputer, &szPath[2]);
560 else if (_ILIsPidlSimple(pidl))
562 /* take names of special folders only if its only this folder */
563 if (_ILIsSpecialFolder(pidl))
567 clsid = _ILGetGUIDPointer (pidl);
570 if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING)
572 static const WCHAR clsidW[] =
573 { 'C','L','S','I','D','\\',0 };
574 static const WCHAR shellfolderW[] =
575 { '\\','s','h','e','l','l','f','o','l','d','e','r',0 };
576 static const WCHAR wantsForParsingW[] =
577 { 'W','a','n','t','s','F','o','r','P','a','r','s','i','n',
579 int bWantsForParsing = FALSE;
580 WCHAR szRegPath[100];
584 * We can only get a filesystem path from a shellfolder
585 * if the value WantsFORPARSING exists in
586 * CLSID\\{...}\\shellfolder
587 * exception: the MyComputer folder has this keys not
588 * but like any filesystem backed
589 * folder it needs these behaviour
591 * Get the "WantsFORPARSING" flag from the registry
594 lstrcpyW (szRegPath, clsidW);
595 SHELL32_GUIDToStringW (clsid, &szRegPath[6]);
596 lstrcatW (szRegPath, shellfolderW);
597 r = SHGetValueW (HKEY_CLASSES_ROOT, szRegPath,
598 wantsForParsingW, NULL, NULL, NULL);
599 if (r == ERROR_SUCCESS)
600 bWantsForParsing = TRUE;
602 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
606 * We need the filesystem path to the destination folder
607 * Only the folder itself can know it
609 hr = SHELL32_GetDisplayNameOfChild (iface, pidl,
610 dwFlags, szPath, MAX_PATH);
616 /* parsing name like ::{...} */
617 p = lstrcpyA(szPath, "::") + 2;
618 p += SHELL32_GUIDToStringA(&CLSID_MyComputer, p);
622 SHELL32_GUIDToStringA(clsid, p);
627 /* user friendly name */
628 HCR_GetClassNameA (clsid, szPath, MAX_PATH);
633 /* append my own path */
634 _ILSimpleGetText (pidl, szPath, MAX_PATH);
637 else if (_ILIsDrive(pidl))
639 _ILSimpleGetText (pidl, szPath, MAX_PATH); /* append my own path */
641 /* long view "lw_name (C:)" */
642 if (!(dwFlags & SHGDN_FORPARSING))
644 DWORD dwVolumeSerialNumber, dwMaximumComponetLength, dwFileSystemFlags;
645 char szDrive[18] = "";
647 GetVolumeInformationA (szPath, szDrive, sizeof (szDrive) - 6,
648 &dwVolumeSerialNumber,
649 &dwMaximumComponetLength, &dwFileSystemFlags, NULL, 0);
650 strcat (szDrive, " (");
651 strncat (szDrive, szPath, 2);
652 strcat (szDrive, ")");
653 strcpy (szPath, szDrive);
658 /* Neither a shell namespace extension nor a drive letter. */
659 ERR("Wrong pidl type\n");
665 /* Complex pidl. Let the child folder do the work */
666 strRet->uType = STRRET_CSTR;
667 hr = SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, szPath, MAX_PATH);
672 strRet->uType = STRRET_CSTR;
673 lstrcpynA (strRet->u.cStr, szPath, MAX_PATH);
676 TRACE ("-- (%p)->(%s)\n", This, szPath);
680 /**************************************************************************
681 * ISF_MyComputer_fnSetNameOf
682 * Changes the name of a file object or subfolder, possibly changing its item
683 * identifier in the process.
686 * hwndOwner [in] Owner window for output
687 * pidl [in] simple pidl of item to change
688 * lpszName [in] the items new display name
689 * dwFlags [in] SHGNO formatting flags
690 * ppidlOut [out] simple pidl returned
692 static HRESULT WINAPI ISF_MyComputer_fnSetNameOf (
693 IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl,
694 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
696 IGenericSFImpl *This = (IGenericSFImpl *)iface;
697 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This,
698 hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
702 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultSearchGUID (
703 IShellFolder2 * iface, GUID * pguid)
705 IGenericSFImpl *This = (IGenericSFImpl *)iface;
706 FIXME ("(%p)\n", This);
709 static HRESULT WINAPI ISF_MyComputer_fnEnumSearches (
710 IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
712 IGenericSFImpl *This = (IGenericSFImpl *)iface;
713 FIXME ("(%p)\n", This);
716 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumn (
717 IShellFolder2 *iface, DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
719 IGenericSFImpl *This = (IGenericSFImpl *)iface;
721 TRACE ("(%p)\n", This);
729 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumnState (
730 IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
732 IGenericSFImpl *This = (IGenericSFImpl *)iface;
734 TRACE ("(%p)\n", This);
736 if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
738 *pcsFlags = MyComputerSFHeader[iColumn].pcsFlags;
742 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsEx (IShellFolder2 * iface,
743 LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
745 IGenericSFImpl *This = (IGenericSFImpl *)iface;
746 FIXME ("(%p)\n", This);
750 /* FIXME: drive size >4GB is rolling over */
751 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf (IShellFolder2 * iface,
752 LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
754 IGenericSFImpl *This = (IGenericSFImpl *)iface;
757 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
759 if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
764 psd->fmt = MyComputerSFHeader[iColumn].fmt;
765 psd->cxChar = MyComputerSFHeader[iColumn].cxChar;
766 psd->str.uType = STRRET_CSTR;
767 LoadStringA (shell32_hInstance, MyComputerSFHeader[iColumn].colnameid,
768 psd->str.u.cStr, MAX_PATH);
773 char szPath[MAX_PATH];
774 ULARGE_INTEGER ulBytes;
776 psd->str.u.cStr[0] = 0x00;
777 psd->str.uType = STRRET_CSTR;
781 hr = IShellFolder_GetDisplayNameOf (iface, pidl,
782 SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
785 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
787 case 2: /* total size */
788 if (_ILIsDrive (pidl))
790 _ILSimpleGetText (pidl, szPath, MAX_PATH);
791 GetDiskFreeSpaceExA (szPath, NULL, &ulBytes, NULL);
792 StrFormatByteSizeA (ulBytes.u.LowPart, psd->str.u.cStr, MAX_PATH);
795 case 3: /* free size */
796 if (_ILIsDrive (pidl))
798 _ILSimpleGetText (pidl, szPath, MAX_PATH);
799 GetDiskFreeSpaceExA (szPath, &ulBytes, NULL, NULL);
800 StrFormatByteSizeA (ulBytes.u.LowPart, psd->str.u.cStr, MAX_PATH);
810 static HRESULT WINAPI ISF_MyComputer_fnMapColumnToSCID (
811 IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
813 IGenericSFImpl *This = (IGenericSFImpl *)iface;
814 FIXME ("(%p)\n", This);
818 static IShellFolder2Vtbl vt_ShellFolder2 =
820 ISF_MyComputer_fnQueryInterface,
821 ISF_MyComputer_fnAddRef,
822 ISF_MyComputer_fnRelease,
823 ISF_MyComputer_fnParseDisplayName,
824 ISF_MyComputer_fnEnumObjects,
825 ISF_MyComputer_fnBindToObject,
826 ISF_MyComputer_fnBindToStorage,
827 ISF_MyComputer_fnCompareIDs,
828 ISF_MyComputer_fnCreateViewObject,
829 ISF_MyComputer_fnGetAttributesOf,
830 ISF_MyComputer_fnGetUIObjectOf,
831 ISF_MyComputer_fnGetDisplayNameOf,
832 ISF_MyComputer_fnSetNameOf,
834 ISF_MyComputer_fnGetDefaultSearchGUID,
835 ISF_MyComputer_fnEnumSearches,
836 ISF_MyComputer_fnGetDefaultColumn,
837 ISF_MyComputer_fnGetDefaultColumnState,
838 ISF_MyComputer_fnGetDetailsEx,
839 ISF_MyComputer_fnGetDetailsOf,
840 ISF_MyComputer_fnMapColumnToSCID
843 /************************************************************************
844 * IMCFldr_PersistFolder2_QueryInterface
846 static HRESULT WINAPI IMCFldr_PersistFolder2_QueryInterface (
847 IPersistFolder2 * iface, REFIID iid, LPVOID * ppvObj)
849 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
851 TRACE ("(%p)\n", This);
853 return IUnknown_QueryInterface (_IUnknown_ (This), iid, ppvObj);
856 /************************************************************************
857 * IMCFldr_PersistFolder2_AddRef
859 static ULONG WINAPI IMCFldr_PersistFolder2_AddRef (IPersistFolder2 * iface)
861 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
863 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
865 return IUnknown_AddRef (_IUnknown_ (This));
868 /************************************************************************
869 * ISFPersistFolder_Release
871 static ULONG WINAPI IMCFldr_PersistFolder2_Release (IPersistFolder2 * iface)
873 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
875 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
877 return IUnknown_Release (_IUnknown_ (This));
880 /************************************************************************
881 * IMCFldr_PersistFolder2_GetClassID
883 static HRESULT WINAPI IMCFldr_PersistFolder2_GetClassID (
884 IPersistFolder2 * iface, CLSID * lpClassId)
886 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
888 TRACE ("(%p)\n", This);
892 *lpClassId = CLSID_MyComputer;
897 /************************************************************************
898 * IMCFldr_PersistFolder2_Initialize
900 * NOTES: it makes no sense to change the pidl
902 static HRESULT WINAPI IMCFldr_PersistFolder2_Initialize (
903 IPersistFolder2 * iface, LPCITEMIDLIST pidl)
905 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
906 TRACE ("(%p)->(%p)\n", This, pidl);
910 /**************************************************************************
911 * IPersistFolder2_fnGetCurFolder
913 static HRESULT WINAPI IMCFldr_PersistFolder2_GetCurFolder (
914 IPersistFolder2 * iface, LPITEMIDLIST * pidl)
916 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
918 TRACE ("(%p)->(%p)\n", This, pidl);
922 *pidl = ILClone (This->pidlRoot);
926 static IPersistFolder2Vtbl vt_PersistFolder2 =
928 IMCFldr_PersistFolder2_QueryInterface,
929 IMCFldr_PersistFolder2_AddRef,
930 IMCFldr_PersistFolder2_Release,
931 IMCFldr_PersistFolder2_GetClassID,
932 IMCFldr_PersistFolder2_Initialize,
933 IMCFldr_PersistFolder2_GetCurFolder