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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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;
66 /* both paths are parsible from the desktop */
67 LPWSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
68 LPITEMIDLIST pidlRoot; /* absolute pidl */
70 UINT cfShellIDList; /* clipboardformat for IDropTarget */
71 BOOL fAcceptFmt; /* flag for pending Drop */
74 #define _IUnknown_(This) (IShellFolder*)&(This->lpVtbl)
75 #define _IShellFolder_(This) (IShellFolder*)&(This->lpVtbl)
77 static const shvheader DesktopSFHeader[] = {
78 {IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
79 {IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
80 {IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
81 {IDS_SHV_COLUMN4, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12},
82 {IDS_SHV_COLUMN5, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5}
85 #define DESKTOPSHELLVIEWCOLUMNS 5
87 /**************************************************************************
88 * ISF_Desktop_fnQueryInterface
90 * NOTES supports not IPersist/IPersistFolder
92 static HRESULT WINAPI ISF_Desktop_fnQueryInterface(
93 IShellFolder2 * iface, REFIID riid, LPVOID * ppvObj)
95 IGenericSFImpl *This = (IGenericSFImpl *)iface;
97 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
101 if (IsEqualIID (riid, &IID_IUnknown) ||
102 IsEqualIID (riid, &IID_IShellFolder) ||
103 IsEqualIID (riid, &IID_IShellFolder2))
110 IUnknown_AddRef ((IUnknown *) (*ppvObj));
111 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
114 TRACE ("-- Interface: E_NOINTERFACE\n");
115 return E_NOINTERFACE;
118 static ULONG WINAPI ISF_Desktop_fnAddRef (IShellFolder2 * iface)
120 IGenericSFImpl *This = (IGenericSFImpl *)iface;
121 ULONG refCount = InterlockedIncrement(&This->ref);
123 TRACE ("(%p)->(count=%u)\n", This, refCount - 1);
128 static ULONG WINAPI ISF_Desktop_fnRelease (IShellFolder2 * iface)
130 IGenericSFImpl *This = (IGenericSFImpl *)iface;
131 ULONG refCount = InterlockedDecrement(&This->ref);
133 TRACE ("(%p)->(count=%u)\n", This, refCount + 1);
137 TRACE ("-- destroying IShellFolder(%p)\n", This);
138 SHFree (This->pidlRoot);
139 SHFree (This->sPathTarget);
140 LocalFree ((HLOCAL) This);
146 /**************************************************************************
147 * ISF_Desktop_fnParseDisplayName
150 * "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds
153 static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
154 HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName,
155 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
157 IGenericSFImpl *This = (IGenericSFImpl *)iface;
158 WCHAR szElement[MAX_PATH];
159 LPCWSTR szNext = NULL;
160 LPITEMIDLIST pidlTemp = NULL;
164 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
165 This, hwndOwner, pbc, lpszDisplayName, debugstr_w(lpszDisplayName),
166 pchEaten, ppidl, pdwAttributes);
168 if (!lpszDisplayName || !ppidl)
174 *pchEaten = 0; /* strange but like the original */
176 if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':')
178 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
179 TRACE ("-- element: %s\n", debugstr_w (szElement));
180 SHCLSIDFromStringW (szElement + 2, &clsid);
181 pidlTemp = _ILCreateGuid (PT_GUID, &clsid);
183 else if (PathGetDriveNumberW (lpszDisplayName) >= 0)
185 /* it's a filesystem path with a drive. Let MyComputer/UnixDosFolder parse it */
186 if (UNIXFS_is_rooted_at_desktop())
187 pidlTemp = _ILCreateGuid(PT_GUID, &CLSID_UnixDosFolder);
189 pidlTemp = _ILCreateMyComputer ();
190 szNext = lpszDisplayName;
192 else if (PathIsUNCW(lpszDisplayName))
194 pidlTemp = _ILCreateNetwork();
195 szNext = lpszDisplayName;
197 else if( (pidlTemp = SHELL32_CreatePidlFromBindCtx(pbc, lpszDisplayName)) )
204 /* it's a filesystem path on the desktop. Let a FSFolder parse it */
206 if (*lpszDisplayName)
208 WCHAR szPath[MAX_PATH];
211 /* build a complete path to create a simple pidl */
212 lstrcpynW(szPath, This->sPathTarget, MAX_PATH);
213 pathPtr = PathAddBackslashW(szPath);
216 lstrcpynW(pathPtr, lpszDisplayName, MAX_PATH - (pathPtr - szPath));
217 hr = _ILCreateFromPathW(szPath, &pidlTemp);
221 /* should never reach here, but for completeness */
222 hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
226 pidlTemp = _ILCreateMyComputer();
231 if (SUCCEEDED(hr) && pidlTemp)
233 if (szNext && *szNext)
235 hr = SHELL32_ParseNextElement(iface, hwndOwner, pbc,
236 &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
240 if (pdwAttributes && *pdwAttributes)
241 hr = SHELL32_GetItemAttributes(_IShellFolder_ (This),
242 pidlTemp, pdwAttributes);
248 TRACE ("(%p)->(-- ret=0x%08x)\n", This, hr);
253 /**************************************************************************
254 * CreateDesktopEnumList()
256 static const WCHAR Desktop_NameSpaceW[] = { 'S','O','F','T','W','A','R','E',
257 '\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
258 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l',
259 'o','r','e','r','\\','D','e','s','k','t','o','p','\\','N','a','m','e','s','p',
262 static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
265 WCHAR szPath[MAX_PATH];
267 TRACE("(%p)->(flags=0x%08x)\n", list, dwFlags);
269 /* enumerate the root folders */
270 if (dwFlags & SHCONTF_FOLDERS)
275 /* create the pidl for This item */
276 ret = AddToEnumList(list, _ILCreateMyComputer());
278 for (i=0; i<2; i++) {
279 if (ret && !RegOpenKeyExW(i == 0 ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
280 Desktop_NameSpaceW, 0, KEY_READ, &hkey))
291 r = RegEnumKeyExW(hkey, i, iid, &size, 0, NULL, NULL, NULL);
292 if (ERROR_SUCCESS == r)
294 ret = AddToEnumList(list, _ILCreateGuidFromStrW(iid));
297 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%08x 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;
342 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n",
343 This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
345 return SHELL32_BindToChild( This->pidlRoot, This->sPathTarget, pidl, riid, ppvOut );
348 /**************************************************************************
349 * ISF_Desktop_fnBindToStorage
351 static HRESULT WINAPI ISF_Desktop_fnBindToStorage (IShellFolder2 * iface,
352 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
354 IGenericSFImpl *This = (IGenericSFImpl *)iface;
356 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n",
357 This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
363 /**************************************************************************
364 * ISF_Desktop_fnCompareIDs
366 static HRESULT WINAPI ISF_Desktop_fnCompareIDs (IShellFolder2 * iface,
367 LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
369 IGenericSFImpl *This = (IGenericSFImpl *)iface;
372 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
373 nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
374 TRACE ("-- %i\n", nReturn);
378 /**************************************************************************
379 * ISF_Desktop_fnCreateViewObject
381 static HRESULT WINAPI ISF_Desktop_fnCreateViewObject (IShellFolder2 * iface,
382 HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
384 IGenericSFImpl *This = (IGenericSFImpl *)iface;
385 LPSHELLVIEW pShellView;
386 HRESULT hr = E_INVALIDARG;
388 TRACE ("(%p)->(hwnd=%p,%s,%p)\n",
389 This, hwndOwner, shdebugstr_guid (riid), ppvOut);
396 if (IsEqualIID (riid, &IID_IDropTarget))
398 WARN ("IDropTarget not implemented\n");
401 else if (IsEqualIID (riid, &IID_IContextMenu))
403 WARN ("IContextMenu not implemented\n");
406 else if (IsEqualIID (riid, &IID_IShellView))
408 pShellView = IShellView_Constructor ((IShellFolder *) iface);
411 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
412 IShellView_Release (pShellView);
415 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
419 /**************************************************************************
420 * ISF_Desktop_fnGetAttributesOf
422 static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
423 UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
425 IGenericSFImpl *This = (IGenericSFImpl *)iface;
427 static const DWORD dwDesktopAttributes =
428 SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
429 SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER;
430 static const DWORD dwMyComputerAttributes =
431 SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET |
432 SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
434 TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
435 This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
446 *rgfInOut &= dwDesktopAttributes;
448 while (cidl > 0 && *apidl) {
450 if (_ILIsDesktop(*apidl)) {
451 *rgfInOut &= dwDesktopAttributes;
452 } else if (_ILIsMyComputer(*apidl)) {
453 *rgfInOut &= dwMyComputerAttributes;
455 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
461 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
462 *rgfInOut &= ~SFGAO_VALIDATE;
464 TRACE ("-- result=0x%08x\n", *rgfInOut);
469 /**************************************************************************
470 * ISF_Desktop_fnGetUIObjectOf
473 * HWND hwndOwner, //[in ] Parent window for any output
474 * UINT cidl, //[in ] array size
475 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
476 * REFIID riid, //[in ] Requested Interface
477 * UINT* prgfInOut, //[ ] reserved
478 * LPVOID* ppvObject) //[out] Resulting Interface
481 static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
482 HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl,
483 REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
485 IGenericSFImpl *This = (IGenericSFImpl *)iface;
488 IUnknown *pObj = NULL;
489 HRESULT hr = E_INVALIDARG;
491 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
492 This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
499 if (IsEqualIID (riid, &IID_IContextMenu))
502 pObj = (LPUNKNOWN) ISvItemCm_Constructor( (IShellFolder *) iface, This->pidlRoot, apidl, cidl);
504 pObj = (LPUNKNOWN) ISvBgCm_Constructor( (IShellFolder *) iface, TRUE);
507 else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1))
509 pObj = (LPUNKNOWN) IDataObject_Constructor( hwndOwner,
510 This->pidlRoot, apidl, cidl);
513 else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1))
515 pidl = ILCombine (This->pidlRoot, apidl[0]);
516 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
520 else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1))
522 pidl = ILCombine (This->pidlRoot, apidl[0]);
523 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
527 else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1))
529 hr = IShellFolder_QueryInterface (iface,
530 &IID_IDropTarget, (LPVOID *) & pObj);
532 else if ((IsEqualIID(riid,&IID_IShellLinkW) ||
533 IsEqualIID(riid,&IID_IShellLinkA)) && (cidl == 1))
535 pidl = ILCombine (This->pidlRoot, apidl[0]);
536 hr = IShellLink_ConstructFromFile(NULL, riid, pidl, (LPVOID*)&pObj);
542 if (SUCCEEDED(hr) && !pObj)
546 TRACE ("(%p)->hr=0x%08x\n", This, hr);
550 /**************************************************************************
551 * ISF_Desktop_fnGetDisplayNameOf
554 * special case: pidl = null gives desktop-name back
556 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
557 LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
559 IGenericSFImpl *This = (IGenericSFImpl *)iface;
561 WCHAR wszPath[MAX_PATH];
563 TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", This, pidl, dwFlags, strRet);
569 if (_ILIsDesktop (pidl))
571 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
572 (GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING))
573 strcpyW(wszPath, This->sPathTarget);
575 HCR_GetClassNameW(&CLSID_ShellDesktop, wszPath, MAX_PATH);
577 else if (_ILIsPidlSimple (pidl))
581 if ((clsid = _ILGetGUIDPointer (pidl)))
583 if (GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING)
585 int bWantsForParsing;
588 * We can only get a filesystem path from a shellfolder if the
589 * value WantsFORPARSING in CLSID\\{...}\\shellfolder exists.
591 * Exception: The MyComputer folder doesn't have this key,
592 * but any other filesystem backed folder it needs it.
594 if (IsEqualIID (clsid, &CLSID_MyComputer))
596 bWantsForParsing = TRUE;
600 /* get the "WantsFORPARSING" flag from the registry */
601 static const WCHAR clsidW[] =
602 { 'C','L','S','I','D','\\',0 };
603 static const WCHAR shellfolderW[] =
604 { '\\','s','h','e','l','l','f','o','l','d','e','r',0 };
605 static const WCHAR wantsForParsingW[] =
606 { 'W','a','n','t','s','F','o','r','P','a','r','s','i','n',
608 WCHAR szRegPath[100];
611 lstrcpyW (szRegPath, clsidW);
612 SHELL32_GUIDToStringW (clsid, &szRegPath[6]);
613 lstrcatW (szRegPath, shellfolderW);
614 r = SHGetValueW(HKEY_CLASSES_ROOT, szRegPath,
615 wantsForParsingW, NULL, NULL, NULL);
616 if (r == ERROR_SUCCESS)
617 bWantsForParsing = TRUE;
619 bWantsForParsing = FALSE;
622 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
626 * we need the filesystem path to the destination folder.
627 * Only the folder itself can know it
629 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags,
635 /* parsing name like ::{...} */
638 SHELL32_GUIDToStringW (clsid, &wszPath[2]);
643 /* user friendly name */
644 HCR_GetClassNameW (clsid, wszPath, MAX_PATH);
651 /* file system folder or file rooted at the desktop */
652 if ((GET_SHGDN_FOR(dwFlags) == SHGDN_FORPARSING) &&
653 (GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER))
655 lstrcpynW(wszPath, This->sPathTarget, MAX_PATH - 1);
656 PathAddBackslashW(wszPath);
657 cLen = lstrlenW(wszPath);
660 _ILSimpleGetTextW(pidl, wszPath + cLen, MAX_PATH - cLen);
662 if (!_ILIsFolder(pidl))
663 SHELL_FS_ProcessDisplayFilename(wszPath, dwFlags);
668 /* a complex pidl, let the subfolder do the work */
669 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags,
676 strRet->uType = STRRET_CSTR;
677 if (!WideCharToMultiByte(CP_ACP, 0, wszPath, -1, strRet->u.cStr, MAX_PATH,
679 strRet->u.cStr[0] = '\0';
682 strRet->u.pOleStr = SHAlloc((lstrlenW(This->sPathTarget)+1) *
684 if (!strRet->u.pOleStr)
688 strcpyW(strRet->u.pOleStr, This->sPathTarget);
689 strRet->uType = STRRET_WSTR;
694 TRACE ("-- (%p)->(%s,0x%08x)\n", This,
695 strRet->uType == STRRET_CSTR ? strRet->u.cStr :
696 debugstr_w(strRet->u.pOleStr), hr);
700 /**************************************************************************
701 * ISF_Desktop_fnSetNameOf
702 * Changes the name of a file object or subfolder, possibly changing its item
703 * identifier in the process.
706 * HWND hwndOwner, //[in ] Owner window for output
707 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
708 * LPCOLESTR lpszName, //[in ] the items new display name
709 * DWORD dwFlags, //[in ] SHGNO formatting flags
710 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
712 static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface,
713 HWND hwndOwner, LPCITEMIDLIST pidl, /* simple pidl */
714 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
716 IGenericSFImpl *This = (IGenericSFImpl *)iface;
718 FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", This, hwndOwner, pidl,
719 debugstr_w (lpName), dwFlags, pPidlOut);
724 static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID(IShellFolder2 *iface,
727 IGenericSFImpl *This = (IGenericSFImpl *)iface;
729 FIXME ("(%p)\n", This);
733 static HRESULT WINAPI ISF_Desktop_fnEnumSearches (IShellFolder2 *iface,
734 IEnumExtraSearch ** ppenum)
736 IGenericSFImpl *This = (IGenericSFImpl *)iface;
737 FIXME ("(%p)\n", This);
741 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn (IShellFolder2 * iface,
742 DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
744 IGenericSFImpl *This = (IGenericSFImpl *)iface;
746 TRACE ("(%p)\n", This);
755 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState (
756 IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
758 IGenericSFImpl *This = (IGenericSFImpl *)iface;
760 TRACE ("(%p)\n", This);
762 if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
765 *pcsFlags = DesktopSFHeader[iColumn].pcsFlags;
770 static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx (IShellFolder2 * iface,
771 LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
773 IGenericSFImpl *This = (IGenericSFImpl *)iface;
774 FIXME ("(%p)\n", This);
779 static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface,
780 LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
782 IGenericSFImpl *This = (IGenericSFImpl *)iface;
786 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
788 if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
793 psd->fmt = DesktopSFHeader[iColumn].fmt;
794 psd->cxChar = DesktopSFHeader[iColumn].cxChar;
795 psd->str.uType = STRRET_CSTR;
796 LoadStringA (shell32_hInstance, DesktopSFHeader[iColumn].colnameid,
797 psd->str.u.cStr, MAX_PATH);
801 /* the data from the pidl */
802 psd->str.uType = STRRET_CSTR;
806 hr = IShellFolder_GetDisplayNameOf(iface, pidl,
807 SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
810 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);
813 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
816 _ILGetFileDate (pidl, psd->str.u.cStr, MAX_PATH);
818 case 4: /* attributes */
819 _ILGetFileAttributes (pidl, psd->str.u.cStr, MAX_PATH);
826 static HRESULT WINAPI ISF_Desktop_fnMapColumnToSCID (
827 IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
829 IGenericSFImpl *This = (IGenericSFImpl *)iface;
830 FIXME ("(%p)\n", This);
834 static const IShellFolder2Vtbl vt_MCFldr_ShellFolder2 =
836 ISF_Desktop_fnQueryInterface,
837 ISF_Desktop_fnAddRef,
838 ISF_Desktop_fnRelease,
839 ISF_Desktop_fnParseDisplayName,
840 ISF_Desktop_fnEnumObjects,
841 ISF_Desktop_fnBindToObject,
842 ISF_Desktop_fnBindToStorage,
843 ISF_Desktop_fnCompareIDs,
844 ISF_Desktop_fnCreateViewObject,
845 ISF_Desktop_fnGetAttributesOf,
846 ISF_Desktop_fnGetUIObjectOf,
847 ISF_Desktop_fnGetDisplayNameOf,
848 ISF_Desktop_fnSetNameOf,
850 ISF_Desktop_fnGetDefaultSearchGUID,
851 ISF_Desktop_fnEnumSearches,
852 ISF_Desktop_fnGetDefaultColumn,
853 ISF_Desktop_fnGetDefaultColumnState,
854 ISF_Desktop_fnGetDetailsEx,
855 ISF_Desktop_fnGetDetailsOf,
856 ISF_Desktop_fnMapColumnToSCID
859 /**************************************************************************
860 * ISF_Desktop_Constructor
862 HRESULT WINAPI ISF_Desktop_Constructor (
863 IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
866 WCHAR szMyPath[MAX_PATH];
869 TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
874 return CLASS_E_NOAGGREGATION;
876 if (!SHGetSpecialFolderPathW( 0, szMyPath, CSIDL_DESKTOPDIRECTORY, TRUE ))
879 sf = LocalAlloc( LMEM_ZEROINIT, sizeof (IGenericSFImpl) );
881 return E_OUTOFMEMORY;
884 sf->lpVtbl = &vt_MCFldr_ShellFolder2;
885 sf->pidlRoot = _ILCreateDesktop(); /* my qualified pidl */
886 sf->sPathTarget = SHAlloc( (lstrlenW(szMyPath) + 1)*sizeof(WCHAR) );
887 lstrcpyW( sf->sPathTarget, szMyPath );
889 r = IUnknown_QueryInterface( _IUnknown_(sf), riid, ppv );
892 IUnknown_Release( _IUnknown_(sf) );
896 TRACE ("--(%p)\n", sf);