3 * Virtual Desktop 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"
32 #define NONAMELESSUNION
33 #define NONAMELESSSTRUCT
45 #include "enumidlist.h"
47 #include "undocshell.h"
48 #include "shell32_main.h"
51 #include "shellfolder.h"
52 #include "wine/debug.h"
56 WINE_DEFAULT_DEBUG_CHANNEL (shell);
58 /***********************************************************************
59 * Desktopfolder implementation
63 const IShellFolder2Vtbl *lpVtbl;
68 /* both paths are parsible from the desktop */
69 LPWSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
70 LPITEMIDLIST pidlRoot; /* absolute pidl */
72 UINT cfShellIDList; /* clipboardformat for IDropTarget */
73 BOOL fAcceptFmt; /* flag for pending Drop */
76 #define _IUnknown_(This) (IShellFolder*)&(This->lpVtbl)
77 #define _IShellFolder_(This) (IShellFolder*)&(This->lpVtbl)
79 static shvheader DesktopSFHeader[] = {
80 {IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
81 {IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
82 {IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
83 {IDS_SHV_COLUMN4, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12},
84 {IDS_SHV_COLUMN5, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5}
87 #define DESKTOPSHELLVIEWCOLUMNS 5
89 /**************************************************************************
90 * ISF_Desktop_fnQueryInterface
92 * NOTES supports not IPersist/IPersistFolder
94 static HRESULT WINAPI ISF_Desktop_fnQueryInterface(
95 IShellFolder2 * iface, REFIID riid, LPVOID * ppvObj)
97 IGenericSFImpl *This = (IGenericSFImpl *)iface;
99 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
103 if (IsEqualIID (riid, &IID_IUnknown) ||
104 IsEqualIID (riid, &IID_IShellFolder) ||
105 IsEqualIID (riid, &IID_IShellFolder2))
112 IUnknown_AddRef ((IUnknown *) (*ppvObj));
113 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
116 TRACE ("-- Interface: E_NOINTERFACE\n");
117 return E_NOINTERFACE;
120 static ULONG WINAPI ISF_Desktop_fnAddRef (IShellFolder2 * iface)
122 IGenericSFImpl *This = (IGenericSFImpl *)iface;
123 ULONG refCount = InterlockedIncrement(&This->ref);
125 TRACE ("(%p)->(count=%lu)\n", This, refCount - 1);
130 static ULONG WINAPI ISF_Desktop_fnRelease (IShellFolder2 * iface)
132 IGenericSFImpl *This = (IGenericSFImpl *)iface;
133 ULONG refCount = InterlockedDecrement(&This->ref);
135 TRACE ("(%p)->(count=%lu)\n", This, refCount + 1);
139 TRACE ("-- destroying IShellFolder(%p)\n", This);
141 SHFree (This->pidlRoot);
142 if (This->sPathTarget)
143 SHFree (This->sPathTarget);
144 LocalFree ((HLOCAL) This);
150 /**************************************************************************
151 * ISF_Desktop_fnParseDisplayName
154 * "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds
157 static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
158 HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName,
159 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
161 IGenericSFImpl *This = (IGenericSFImpl *)iface;
162 WCHAR szElement[MAX_PATH];
163 LPCWSTR szNext = NULL;
164 LPITEMIDLIST pidlTemp = NULL;
168 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
169 This, hwndOwner, pbc, lpszDisplayName, debugstr_w(lpszDisplayName),
170 pchEaten, ppidl, pdwAttributes);
172 if (!lpszDisplayName || !ppidl)
178 *pchEaten = 0; /* strange but like the original */
180 if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':')
182 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
183 TRACE ("-- element: %s\n", debugstr_w (szElement));
184 SHCLSIDFromStringW (szElement + 2, &clsid);
185 pidlTemp = _ILCreateGuid (PT_GUID, &clsid);
187 else if (PathGetDriveNumberW (lpszDisplayName) >= 0)
189 /* it's a filesystem path with a drive. Let MyComputer parse it */
190 pidlTemp = _ILCreateMyComputer ();
191 szNext = lpszDisplayName;
193 else if (PathIsUNCW(lpszDisplayName))
195 pidlTemp = _ILCreateNetwork();
196 szNext = lpszDisplayName;
198 else if( (pidlTemp = SHELL32_CreatePidlFromBindCtx(pbc, lpszDisplayName)) )
205 /* it's a filesystem path on the desktop. Let a FSFolder parse it */
207 if (*lpszDisplayName)
209 WCHAR szPath[MAX_PATH];
212 /* build a complete path to create a simple pidl */
213 lstrcpynW(szPath, This->sPathTarget, MAX_PATH);
214 pathPtr = PathAddBackslashW(szPath);
217 lstrcpynW(pathPtr, lpszDisplayName, MAX_PATH - (pathPtr - szPath));
218 hr = _ILCreateFromPathW(szPath, &pidlTemp);
222 /* should never reach here, but for completeness */
223 hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
227 pidlTemp = _ILCreateMyComputer();
232 if (SUCCEEDED(hr) && pidlTemp)
234 if (szNext && *szNext)
236 hr = SHELL32_ParseNextElement(iface, hwndOwner, pbc,
237 &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
241 if (pdwAttributes && *pdwAttributes)
242 hr = SHELL32_GetItemAttributes(_IShellFolder_ (This),
243 pidlTemp, pdwAttributes);
249 TRACE ("(%p)->(-- ret=0x%08lx)\n", This, hr);
254 /**************************************************************************
255 * CreateDesktopEnumList()
257 static const WCHAR Desktop_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','\\','D','e','s','k','t','o','p','\\','N','a','m','e','s','p',
263 static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
266 WCHAR szPath[MAX_PATH];
268 TRACE("(%p)->(flags=0x%08lx) \n",list,dwFlags);
270 /* enumerate the root folders */
271 if (dwFlags & SHCONTF_FOLDERS)
276 /* create the pidl for This item */
277 ret = AddToEnumList(list, _ILCreateMyComputer());
279 r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, Desktop_NameSpaceW,
281 if (ret && ERROR_SUCCESS == r)
285 BOOL moreKeys = TRUE;
287 while (ret && moreKeys)
292 r = RegEnumKeyExW(hkey, i, iid, &size, 0, NULL, NULL, NULL);
293 if (ERROR_SUCCESS == r)
295 ret = AddToEnumList(list, _ILCreateGuidFromStrW(iid));
298 else if (ERROR_NO_MORE_ITEMS == r)
307 /* enumerate the elements in %windir%\desktop */
308 SHGetSpecialFolderPathW(0, szPath, CSIDL_DESKTOPDIRECTORY, FALSE);
309 ret = ret && CreateFolderEnumList(list, szPath, dwFlags);
314 /**************************************************************************
315 * ISF_Desktop_fnEnumObjects
317 static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
318 HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
320 IGenericSFImpl *This = (IGenericSFImpl *)iface;
322 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n",
323 This, hwndOwner, dwFlags, ppEnumIDList);
325 *ppEnumIDList = IEnumIDList_Constructor();
327 CreateDesktopEnumList(*ppEnumIDList, dwFlags);
329 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
331 return *ppEnumIDList ? S_OK : E_OUTOFMEMORY;
334 /**************************************************************************
335 * ISF_Desktop_fnBindToObject
337 static HRESULT WINAPI ISF_Desktop_fnBindToObject (IShellFolder2 * iface,
338 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
340 IGenericSFImpl *This = (IGenericSFImpl *)iface;
341 char szPath[MAX_PATH];
343 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n",
344 This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
346 WideCharToMultiByte( CP_ACP, 0, This->sPathTarget, -1,
347 szPath, MAX_PATH, NULL, NULL );
348 return SHELL32_BindToChild( This->pidlRoot, szPath, pidl, riid, ppvOut );
351 /**************************************************************************
352 * ISF_Desktop_fnBindToStorage
354 static HRESULT WINAPI ISF_Desktop_fnBindToStorage (IShellFolder2 * iface,
355 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
357 IGenericSFImpl *This = (IGenericSFImpl *)iface;
359 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n",
360 This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
366 /**************************************************************************
367 * ISF_Desktop_fnCompareIDs
369 static HRESULT WINAPI ISF_Desktop_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_Desktop_fnCreateViewObject
384 static HRESULT WINAPI ISF_Desktop_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",
392 This, 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_Desktop_fnGetAttributesOf
425 static HRESULT WINAPI ISF_Desktop_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);
443 IShellFolder *psfParent = NULL;
444 LPCITEMIDLIST rpidl = NULL;
446 hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (LPVOID*)&psfParent, (LPCITEMIDLIST*)&rpidl);
448 SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut);
450 while (cidl > 0 && *apidl) {
452 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
457 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
458 *rgfInOut &= ~SFGAO_VALIDATE;
460 TRACE ("-- result=0x%08lx\n", *rgfInOut);
465 /**************************************************************************
466 * ISF_Desktop_fnGetUIObjectOf
469 * HWND hwndOwner, //[in ] Parent window for any output
470 * UINT cidl, //[in ] array size
471 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
472 * REFIID riid, //[in ] Requested Interface
473 * UINT* prgfInOut, //[ ] reserved
474 * LPVOID* ppvObject) //[out] Resulting Interface
477 static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
478 HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl,
479 REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
481 IGenericSFImpl *This = (IGenericSFImpl *)iface;
484 IUnknown *pObj = NULL;
485 HRESULT hr = E_INVALIDARG;
487 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
488 This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
495 if (IsEqualIID (riid, &IID_IContextMenu))
498 pObj = (LPUNKNOWN) ISvItemCm_Constructor( (IShellFolder *) iface, This->pidlRoot, apidl, cidl);
500 pObj = (LPUNKNOWN) ISvBgCm_Constructor( (IShellFolder *) iface, TRUE);
503 else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1))
505 pObj = (LPUNKNOWN) IDataObject_Constructor( hwndOwner,
506 This->pidlRoot, apidl, cidl);
509 else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1))
511 pidl = ILCombine (This->pidlRoot, apidl[0]);
512 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
516 else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1))
518 pidl = ILCombine (This->pidlRoot, apidl[0]);
519 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
523 else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1))
525 hr = IShellFolder_QueryInterface (iface,
526 &IID_IDropTarget, (LPVOID *) & pObj);
528 else if ((IsEqualIID(riid,&IID_IShellLinkW) ||
529 IsEqualIID(riid,&IID_IShellLinkA)) && (cidl == 1))
531 pidl = ILCombine (This->pidlRoot, apidl[0]);
532 hr = IShellLink_ConstructFromFile(NULL, riid, pidl, (LPVOID*)&pObj);
538 if (SUCCEEDED(hr) && !pObj)
542 TRACE ("(%p)->hr=0x%08lx\n", This, hr);
546 /**************************************************************************
547 * ISF_Desktop_fnGetDisplayNameOf
550 * special case: pidl = null gives desktop-name back
552 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
553 LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
555 IGenericSFImpl *This = (IGenericSFImpl *)iface;
558 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
564 strRet->uType = STRRET_CSTR;
565 if (_ILIsDesktop (pidl))
567 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
568 (GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING))
572 WideCharToMultiByte( CP_ACP, 0, This->sPathTarget, -1,
573 strRet->u.cStr, MAX_PATH, NULL, &defCharUsed );
576 strRet->u.pOleStr = SHAlloc((lstrlenW(This->sPathTarget)+1) *
578 if (!strRet->u.pOleStr)
582 strcpyW(strRet->u.pOleStr, This->sPathTarget);
583 strRet->uType = STRRET_WSTR;
589 HCR_GetClassNameA(&CLSID_ShellDesktop, strRet->u.cStr, MAX_PATH);
592 else if (_ILIsPidlSimple (pidl))
596 if ((clsid = _ILGetGUIDPointer (pidl)))
598 if (GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING)
600 int bWantsForParsing;
603 * We can only get a filesystem path from a shellfolder if the
604 * value WantsFORPARSING in CLSID\\{...}\\shellfolder exists.
606 * Exception: The MyComputer folder doesn't have this key,
607 * but any other filesystem backed folder it needs it.
609 if (IsEqualIID (clsid, &CLSID_MyComputer))
611 bWantsForParsing = TRUE;
615 /* get the "WantsFORPARSING" flag from the registry */
616 static const WCHAR clsidW[] =
617 { 'C','L','S','I','D','\\',0 };
618 static const WCHAR shellfolderW[] =
619 { '\\','s','h','e','l','l','f','o','l','d','e','r',0 };
620 static const WCHAR wantsForParsingW[] =
621 { 'W','a','n','t','s','F','o','r','P','a','r','s','i','n',
623 WCHAR szRegPath[100];
626 lstrcpyW (szRegPath, clsidW);
627 SHELL32_GUIDToStringW (clsid, &szRegPath[6]);
628 lstrcatW (szRegPath, shellfolderW);
629 r = SHGetValueW(HKEY_CLASSES_ROOT, szRegPath,
630 wantsForParsingW, NULL, NULL, NULL);
631 if (r == ERROR_SUCCESS)
632 bWantsForParsing = TRUE;
634 bWantsForParsing = FALSE;
637 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
641 * we need the filesystem path to the destination folder.
642 * Only the folder itself can know it
644 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags,
650 /* parsing name like ::{...} */
651 lstrcpyA (strRet->u.cStr, "::");
652 SHELL32_GUIDToStringA (clsid, &strRet->u.cStr[2]);
657 /* user friendly name */
658 HCR_GetClassNameA (clsid, strRet->u.cStr, MAX_PATH);
663 /* file system folder */
664 _ILSimpleGetText (pidl, strRet->u.cStr, MAX_PATH);
666 if (!_ILIsFolder(pidl))
667 SHELL_FS_ProcessDisplayFilename(strRet->u.cStr, dwFlags);
672 /* a complex pidl, let the subfolder do the work */
673 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags,
674 strRet->u.cStr, MAX_PATH);
677 TRACE ("-- (%p)->(%s,0x%08lx)\n", This,
678 strRet->uType == STRRET_CSTR ? strRet->u.cStr :
679 debugstr_w(strRet->u.pOleStr), hr);
683 /**************************************************************************
684 * ISF_Desktop_fnSetNameOf
685 * Changes the name of a file object or subfolder, possibly changing its item
686 * identifier in the process.
689 * HWND hwndOwner, //[in ] Owner window for output
690 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
691 * LPCOLESTR lpszName, //[in ] the items new display name
692 * DWORD dwFlags, //[in ] SHGNO formatting flags
693 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
695 static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface,
696 HWND hwndOwner, LPCITEMIDLIST pidl, /* simple pidl */
697 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
699 IGenericSFImpl *This = (IGenericSFImpl *)iface;
701 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl,
702 debugstr_w (lpName), dwFlags, pPidlOut);
707 static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID(IShellFolder2 *iface,
710 IGenericSFImpl *This = (IGenericSFImpl *)iface;
712 FIXME ("(%p)\n", This);
716 static HRESULT WINAPI ISF_Desktop_fnEnumSearches (IShellFolder2 *iface,
717 IEnumExtraSearch ** ppenum)
719 IGenericSFImpl *This = (IGenericSFImpl *)iface;
720 FIXME ("(%p)\n", This);
724 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn (IShellFolder2 * iface,
725 DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
727 IGenericSFImpl *This = (IGenericSFImpl *)iface;
729 TRACE ("(%p)\n", This);
738 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState (
739 IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
741 IGenericSFImpl *This = (IGenericSFImpl *)iface;
743 TRACE ("(%p)\n", This);
745 if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
748 *pcsFlags = DesktopSFHeader[iColumn].pcsFlags;
753 static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx (IShellFolder2 * iface,
754 LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
756 IGenericSFImpl *This = (IGenericSFImpl *)iface;
757 FIXME ("(%p)\n", This);
762 static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface,
763 LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
765 IGenericSFImpl *This = (IGenericSFImpl *)iface;
769 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
771 if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
776 psd->fmt = DesktopSFHeader[iColumn].fmt;
777 psd->cxChar = DesktopSFHeader[iColumn].cxChar;
778 psd->str.uType = STRRET_CSTR;
779 LoadStringA (shell32_hInstance, DesktopSFHeader[iColumn].colnameid,
780 psd->str.u.cStr, MAX_PATH);
784 /* the data from the pidl */
785 psd->str.uType = STRRET_CSTR;
789 hr = IShellFolder_GetDisplayNameOf(iface, pidl,
790 SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
793 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);
796 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
799 _ILGetFileDate (pidl, psd->str.u.cStr, MAX_PATH);
801 case 4: /* attributes */
802 _ILGetFileAttributes (pidl, psd->str.u.cStr, MAX_PATH);
809 static HRESULT WINAPI ISF_Desktop_fnMapColumnToSCID (
810 IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
812 IGenericSFImpl *This = (IGenericSFImpl *)iface;
813 FIXME ("(%p)\n", This);
817 static const IShellFolder2Vtbl vt_MCFldr_ShellFolder2 =
819 ISF_Desktop_fnQueryInterface,
820 ISF_Desktop_fnAddRef,
821 ISF_Desktop_fnRelease,
822 ISF_Desktop_fnParseDisplayName,
823 ISF_Desktop_fnEnumObjects,
824 ISF_Desktop_fnBindToObject,
825 ISF_Desktop_fnBindToStorage,
826 ISF_Desktop_fnCompareIDs,
827 ISF_Desktop_fnCreateViewObject,
828 ISF_Desktop_fnGetAttributesOf,
829 ISF_Desktop_fnGetUIObjectOf,
830 ISF_Desktop_fnGetDisplayNameOf,
831 ISF_Desktop_fnSetNameOf,
833 ISF_Desktop_fnGetDefaultSearchGUID,
834 ISF_Desktop_fnEnumSearches,
835 ISF_Desktop_fnGetDefaultColumn,
836 ISF_Desktop_fnGetDefaultColumnState,
837 ISF_Desktop_fnGetDetailsEx,
838 ISF_Desktop_fnGetDetailsOf,
839 ISF_Desktop_fnMapColumnToSCID
842 /**************************************************************************
843 * ISF_Desktop_Constructor
845 HRESULT WINAPI ISF_Desktop_Constructor (
846 IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
849 WCHAR szMyPath[MAX_PATH];
852 TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
857 return CLASS_E_NOAGGREGATION;
859 if (!SHGetSpecialFolderPathW( 0, szMyPath, CSIDL_DESKTOPDIRECTORY, TRUE ))
862 sf = LocalAlloc( LMEM_ZEROINIT, sizeof (IGenericSFImpl) );
864 return E_OUTOFMEMORY;
867 sf->lpVtbl = &vt_MCFldr_ShellFolder2;
868 sf->pidlRoot = _ILCreateDesktop(); /* my qualified pidl */
869 sf->sPathTarget = SHAlloc( (lstrlenW(szMyPath) + 1)*sizeof(WCHAR) );
870 lstrcpyW( sf->sPathTarget, szMyPath );
872 r = IUnknown_QueryInterface( _IUnknown_(sf), riid, ppv );
875 IUnknown_Release( _IUnknown_(sf) );
879 TRACE ("--(%p)\n", sf);