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=0x%08lx)\n", This, cidl, apidl, *rgfInOut);
433 if (!cidl || !apidl || !rgfInOut)
439 while (cidl > 0 && *apidl)
442 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
447 TRACE ("-- result=0x%08lx\n", *rgfInOut);
451 /**************************************************************************
452 * ISF_MyComputer_fnGetUIObjectOf
455 * hwndOwner [in] Parent window for any output
456 * cidl [in] array size
457 * apidl [in] simple pidl array
458 * riid [in] Requested Interface
459 * prgfInOut [ ] reserved
460 * ppvObject [out] Resulting Interface
463 static HRESULT WINAPI ISF_MyComputer_fnGetUIObjectOf (IShellFolder2 * iface,
464 HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl, REFIID riid,
465 UINT * prgfInOut, LPVOID * ppvOut)
467 IGenericSFImpl *This = (IGenericSFImpl *)iface;
470 IUnknown *pObj = NULL;
471 HRESULT hr = E_INVALIDARG;
473 TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", This,
474 hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
481 if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1))
483 pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface,
484 This->pidlRoot, apidl, cidl);
487 else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1))
489 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner,
490 This->pidlRoot, apidl, cidl);
493 else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1))
495 pidl = ILCombine (This->pidlRoot, apidl[0]);
496 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
500 else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1))
502 pidl = ILCombine (This->pidlRoot, apidl[0]);
503 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
507 else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1))
509 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget,
512 else if ((IsEqualIID(riid,&IID_IShellLinkW) ||
513 IsEqualIID(riid,&IID_IShellLinkA)) && (cidl == 1))
515 pidl = ILCombine (This->pidlRoot, apidl[0]);
516 hr = IShellLink_ConstructFromFile(NULL, riid, pidl, (LPVOID*) &pObj);
522 if (SUCCEEDED(hr) && !pObj)
526 TRACE ("(%p)->hr=0x%08lx\n", This, hr);
530 /**************************************************************************
531 * ISF_MyComputer_fnGetDisplayNameOf
533 static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
534 LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
536 IGenericSFImpl *This = (IGenericSFImpl *)iface;
538 char szPath[MAX_PATH], szDrive[18];
543 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
552 bSimplePidl = _ILIsPidlSimple (pidl);
556 /* parsing name like ::{...} */
557 lstrcpyA (szPath, "::");
558 SHELL32_GUIDToStringA(&CLSID_MyComputer, &szPath[2]);
560 else if (_ILIsSpecialFolder (pidl))
562 /* take names of special folders only if its only this folder */
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);
638 FIXME ("special folder\n");
642 if (!_ILIsDrive (pidl))
644 ERR ("Wrong pidl type\n");
648 _ILSimpleGetText (pidl, szPath, MAX_PATH); /* append my own path */
650 /* long view "lw_name (C:)" */
651 if (bSimplePidl && !(dwFlags & SHGDN_FORPARSING))
653 DWORD dwVolumeSerialNumber, dwMaximumComponetLength, dwFileSystemFlags;
655 GetVolumeInformationA (szPath, szDrive, sizeof (szDrive) - 6,
656 &dwVolumeSerialNumber,
657 &dwMaximumComponetLength, &dwFileSystemFlags, NULL, 0);
658 strcat (szDrive, " (");
659 strncat (szDrive, szPath, 2);
660 strcat (szDrive, ")");
661 strcpy (szPath, szDrive);
667 /* go deeper if needed */
668 PathAddBackslashA (szPath);
669 len = strlen (szPath);
671 hr = SHELL32_GetDisplayNameOfChild (iface, pidl,
672 dwFlags | SHGDN_INFOLDER, szPath + len, MAX_PATH - len);
677 strRet->uType = STRRET_CSTR;
678 lstrcpynA (strRet->u.cStr, szPath, MAX_PATH);
681 TRACE ("-- (%p)->(%s)\n", This, szPath);
685 /**************************************************************************
686 * ISF_MyComputer_fnSetNameOf
687 * Changes the name of a file object or subfolder, possibly changing its item
688 * identifier in the process.
691 * hwndOwner [in] Owner window for output
692 * pidl [in] simple pidl of item to change
693 * lpszName [in] the items new display name
694 * dwFlags [in] SHGNO formatting flags
695 * ppidlOut [out] simple pidl returned
697 static HRESULT WINAPI ISF_MyComputer_fnSetNameOf (
698 IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl,
699 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
701 IGenericSFImpl *This = (IGenericSFImpl *)iface;
702 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This,
703 hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
707 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultSearchGUID (
708 IShellFolder2 * iface, GUID * pguid)
710 IGenericSFImpl *This = (IGenericSFImpl *)iface;
711 FIXME ("(%p)\n", This);
714 static HRESULT WINAPI ISF_MyComputer_fnEnumSearches (
715 IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
717 IGenericSFImpl *This = (IGenericSFImpl *)iface;
718 FIXME ("(%p)\n", This);
721 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumn (
722 IShellFolder2 *iface, DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
724 IGenericSFImpl *This = (IGenericSFImpl *)iface;
726 TRACE ("(%p)\n", This);
734 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumnState (
735 IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
737 IGenericSFImpl *This = (IGenericSFImpl *)iface;
739 TRACE ("(%p)\n", This);
741 if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
743 *pcsFlags = MyComputerSFHeader[iColumn].pcsFlags;
747 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsEx (IShellFolder2 * iface,
748 LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
750 IGenericSFImpl *This = (IGenericSFImpl *)iface;
751 FIXME ("(%p)\n", This);
755 /* FIXME: drive size >4GB is rolling over */
756 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf (IShellFolder2 * iface,
757 LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
759 IGenericSFImpl *This = (IGenericSFImpl *)iface;
762 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
764 if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
769 psd->fmt = MyComputerSFHeader[iColumn].fmt;
770 psd->cxChar = MyComputerSFHeader[iColumn].cxChar;
771 psd->str.uType = STRRET_CSTR;
772 LoadStringA (shell32_hInstance, MyComputerSFHeader[iColumn].colnameid,
773 psd->str.u.cStr, MAX_PATH);
778 char szPath[MAX_PATH];
779 ULARGE_INTEGER ulBytes;
781 psd->str.u.cStr[0] = 0x00;
782 psd->str.uType = STRRET_CSTR;
786 hr = IShellFolder_GetDisplayNameOf (iface, pidl,
787 SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
790 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
792 case 2: /* total size */
793 if (_ILIsDrive (pidl))
795 _ILSimpleGetText (pidl, szPath, MAX_PATH);
796 GetDiskFreeSpaceExA (szPath, NULL, &ulBytes, NULL);
797 StrFormatByteSizeA (ulBytes.u.LowPart, psd->str.u.cStr, MAX_PATH);
800 case 3: /* free size */
801 if (_ILIsDrive (pidl))
803 _ILSimpleGetText (pidl, szPath, MAX_PATH);
804 GetDiskFreeSpaceExA (szPath, &ulBytes, NULL, NULL);
805 StrFormatByteSizeA (ulBytes.u.LowPart, psd->str.u.cStr, MAX_PATH);
815 static HRESULT WINAPI ISF_MyComputer_fnMapColumnToSCID (
816 IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
818 IGenericSFImpl *This = (IGenericSFImpl *)iface;
819 FIXME ("(%p)\n", This);
823 static IShellFolder2Vtbl vt_ShellFolder2 =
825 ISF_MyComputer_fnQueryInterface,
826 ISF_MyComputer_fnAddRef,
827 ISF_MyComputer_fnRelease,
828 ISF_MyComputer_fnParseDisplayName,
829 ISF_MyComputer_fnEnumObjects,
830 ISF_MyComputer_fnBindToObject,
831 ISF_MyComputer_fnBindToStorage,
832 ISF_MyComputer_fnCompareIDs,
833 ISF_MyComputer_fnCreateViewObject,
834 ISF_MyComputer_fnGetAttributesOf,
835 ISF_MyComputer_fnGetUIObjectOf,
836 ISF_MyComputer_fnGetDisplayNameOf,
837 ISF_MyComputer_fnSetNameOf,
839 ISF_MyComputer_fnGetDefaultSearchGUID,
840 ISF_MyComputer_fnEnumSearches,
841 ISF_MyComputer_fnGetDefaultColumn,
842 ISF_MyComputer_fnGetDefaultColumnState,
843 ISF_MyComputer_fnGetDetailsEx,
844 ISF_MyComputer_fnGetDetailsOf,
845 ISF_MyComputer_fnMapColumnToSCID
848 /************************************************************************
849 * IMCFldr_PersistFolder2_QueryInterface
851 static HRESULT WINAPI IMCFldr_PersistFolder2_QueryInterface (
852 IPersistFolder2 * iface, REFIID iid, LPVOID * ppvObj)
854 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
856 TRACE ("(%p)\n", This);
858 return IUnknown_QueryInterface (_IUnknown_ (This), iid, ppvObj);
861 /************************************************************************
862 * IMCFldr_PersistFolder2_AddRef
864 static ULONG WINAPI IMCFldr_PersistFolder2_AddRef (IPersistFolder2 * iface)
866 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
868 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
870 return IUnknown_AddRef (_IUnknown_ (This));
873 /************************************************************************
874 * ISFPersistFolder_Release
876 static ULONG WINAPI IMCFldr_PersistFolder2_Release (IPersistFolder2 * iface)
878 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
880 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
882 return IUnknown_Release (_IUnknown_ (This));
885 /************************************************************************
886 * IMCFldr_PersistFolder2_GetClassID
888 static HRESULT WINAPI IMCFldr_PersistFolder2_GetClassID (
889 IPersistFolder2 * iface, CLSID * lpClassId)
891 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
893 TRACE ("(%p)\n", This);
897 *lpClassId = CLSID_MyComputer;
902 /************************************************************************
903 * IMCFldr_PersistFolder2_Initialize
905 * NOTES: it makes no sense to change the pidl
907 static HRESULT WINAPI IMCFldr_PersistFolder2_Initialize (
908 IPersistFolder2 * iface, LPCITEMIDLIST pidl)
910 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
911 TRACE ("(%p)->(%p)\n", This, pidl);
915 /**************************************************************************
916 * IPersistFolder2_fnGetCurFolder
918 static HRESULT WINAPI IMCFldr_PersistFolder2_GetCurFolder (
919 IPersistFolder2 * iface, LPITEMIDLIST * pidl)
921 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
923 TRACE ("(%p)->(%p)\n", This, pidl);
927 *pidl = ILClone (This->pidlRoot);
931 static IPersistFolder2Vtbl vt_PersistFolder2 =
933 IMCFldr_PersistFolder2_QueryInterface,
934 IMCFldr_PersistFolder2_AddRef,
935 IMCFldr_PersistFolder2_Release,
936 IMCFldr_PersistFolder2_GetClassID,
937 IMCFldr_PersistFolder2_Initialize,
938 IMCFldr_PersistFolder2_GetCurFolder