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;
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=%u)\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=%u)\n", This, refCount + 1);
139 TRACE ("-- destroying IShellFolder(%p)\n", This);
140 SHFree (This->pidlRoot);
141 SHFree (This->sPathTarget);
142 LocalFree ((HLOCAL) This);
148 /**************************************************************************
149 * ISF_Desktop_fnParseDisplayName
152 * "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds
155 static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
156 HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName,
157 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
159 IGenericSFImpl *This = (IGenericSFImpl *)iface;
160 WCHAR szElement[MAX_PATH];
161 LPCWSTR szNext = NULL;
162 LPITEMIDLIST pidlTemp = NULL;
166 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
167 This, hwndOwner, pbc, lpszDisplayName, debugstr_w(lpszDisplayName),
168 pchEaten, ppidl, pdwAttributes);
170 if (!lpszDisplayName || !ppidl)
176 *pchEaten = 0; /* strange but like the original */
178 if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':')
180 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
181 TRACE ("-- element: %s\n", debugstr_w (szElement));
182 SHCLSIDFromStringW (szElement + 2, &clsid);
183 pidlTemp = _ILCreateGuid (PT_GUID, &clsid);
185 else if (PathGetDriveNumberW (lpszDisplayName) >= 0)
187 /* it's a filesystem path with a drive. Let MyComputer/UnixDosFolder parse it */
188 if (UNIXFS_is_rooted_at_desktop())
189 pidlTemp = _ILCreateGuid(PT_GUID, &CLSID_UnixDosFolder);
191 pidlTemp = _ILCreateMyComputer ();
192 szNext = lpszDisplayName;
194 else if (PathIsUNCW(lpszDisplayName))
196 pidlTemp = _ILCreateNetwork();
197 szNext = lpszDisplayName;
199 else if( (pidlTemp = SHELL32_CreatePidlFromBindCtx(pbc, lpszDisplayName)) )
206 /* it's a filesystem path on the desktop. Let a FSFolder parse it */
208 if (*lpszDisplayName)
210 WCHAR szPath[MAX_PATH];
213 /* build a complete path to create a simple pidl */
214 lstrcpynW(szPath, This->sPathTarget, MAX_PATH);
215 pathPtr = PathAddBackslashW(szPath);
218 lstrcpynW(pathPtr, lpszDisplayName, MAX_PATH - (pathPtr - szPath));
219 hr = _ILCreateFromPathW(szPath, &pidlTemp);
223 /* should never reach here, but for completeness */
224 hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
228 pidlTemp = _ILCreateMyComputer();
233 if (SUCCEEDED(hr) && pidlTemp)
235 if (szNext && *szNext)
237 hr = SHELL32_ParseNextElement(iface, hwndOwner, pbc,
238 &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
242 if (pdwAttributes && *pdwAttributes)
243 hr = SHELL32_GetItemAttributes(_IShellFolder_ (This),
244 pidlTemp, pdwAttributes);
250 TRACE ("(%p)->(-- ret=0x%08x)\n", This, hr);
255 /**************************************************************************
256 * CreateDesktopEnumList()
258 static const WCHAR Desktop_NameSpaceW[] = { 'S','O','F','T','W','A','R','E',
259 '\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
260 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l',
261 'o','r','e','r','\\','D','e','s','k','t','o','p','\\','N','a','m','e','s','p',
264 static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
267 WCHAR szPath[MAX_PATH];
269 TRACE("(%p)->(flags=0x%08x)\n", list, dwFlags);
271 /* enumerate the root folders */
272 if (dwFlags & SHCONTF_FOLDERS)
277 /* create the pidl for This item */
278 ret = AddToEnumList(list, _ILCreateMyComputer());
280 for (i=0; i<2; i++) {
281 if (ret && !RegOpenKeyExW(i == 0 ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
282 Desktop_NameSpaceW, 0, KEY_READ, &hkey))
293 r = RegEnumKeyExW(hkey, i, iid, &size, 0, NULL, NULL, NULL);
294 if (ERROR_SUCCESS == r)
296 ret = AddToEnumList(list, _ILCreateGuidFromStrW(iid));
299 else if (ERROR_NO_MORE_ITEMS == r)
309 /* enumerate the elements in %windir%\desktop */
310 SHGetSpecialFolderPathW(0, szPath, CSIDL_DESKTOPDIRECTORY, FALSE);
311 ret = ret && CreateFolderEnumList(list, szPath, dwFlags);
316 /**************************************************************************
317 * ISF_Desktop_fnEnumObjects
319 static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
320 HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
322 IGenericSFImpl *This = (IGenericSFImpl *)iface;
324 TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n",
325 This, hwndOwner, dwFlags, ppEnumIDList);
327 *ppEnumIDList = IEnumIDList_Constructor();
329 CreateDesktopEnumList(*ppEnumIDList, dwFlags);
331 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
333 return *ppEnumIDList ? S_OK : E_OUTOFMEMORY;
336 /**************************************************************************
337 * ISF_Desktop_fnBindToObject
339 static HRESULT WINAPI ISF_Desktop_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",
345 This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
347 return SHELL32_BindToChild( This->pidlRoot, This->sPathTarget, pidl, riid, ppvOut );
350 /**************************************************************************
351 * ISF_Desktop_fnBindToStorage
353 static HRESULT WINAPI ISF_Desktop_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",
359 This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
365 /**************************************************************************
366 * ISF_Desktop_fnCompareIDs
368 static HRESULT WINAPI ISF_Desktop_fnCompareIDs (IShellFolder2 * iface,
369 LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
371 IGenericSFImpl *This = (IGenericSFImpl *)iface;
374 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
375 nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
376 TRACE ("-- %i\n", nReturn);
380 /**************************************************************************
381 * ISF_Desktop_fnCreateViewObject
383 static HRESULT WINAPI ISF_Desktop_fnCreateViewObject (IShellFolder2 * iface,
384 HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
386 IGenericSFImpl *This = (IGenericSFImpl *)iface;
387 LPSHELLVIEW pShellView;
388 HRESULT hr = E_INVALIDARG;
390 TRACE ("(%p)->(hwnd=%p,%s,%p)\n",
391 This, hwndOwner, shdebugstr_guid (riid), ppvOut);
398 if (IsEqualIID (riid, &IID_IDropTarget))
400 WARN ("IDropTarget not implemented\n");
403 else if (IsEqualIID (riid, &IID_IContextMenu))
405 WARN ("IContextMenu not implemented\n");
408 else if (IsEqualIID (riid, &IID_IShellView))
410 pShellView = IShellView_Constructor ((IShellFolder *) iface);
413 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
414 IShellView_Release (pShellView);
417 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
421 /**************************************************************************
422 * ISF_Desktop_fnGetAttributesOf
424 static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
425 UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
427 IGenericSFImpl *This = (IGenericSFImpl *)iface;
429 static const DWORD dwDesktopAttributes =
430 SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
431 SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER;
432 static const DWORD dwMyComputerAttributes =
433 SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET |
434 SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
436 TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
437 This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
448 *rgfInOut &= dwDesktopAttributes;
450 while (cidl > 0 && *apidl) {
452 if (_ILIsDesktop(*apidl)) {
453 *rgfInOut &= dwDesktopAttributes;
454 } else if (_ILIsMyComputer(*apidl)) {
455 *rgfInOut &= dwMyComputerAttributes;
457 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
463 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
464 *rgfInOut &= ~SFGAO_VALIDATE;
466 TRACE ("-- result=0x%08x\n", *rgfInOut);
471 /**************************************************************************
472 * ISF_Desktop_fnGetUIObjectOf
475 * HWND hwndOwner, //[in ] Parent window for any output
476 * UINT cidl, //[in ] array size
477 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
478 * REFIID riid, //[in ] Requested Interface
479 * UINT* prgfInOut, //[ ] reserved
480 * LPVOID* ppvObject) //[out] Resulting Interface
483 static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
484 HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl,
485 REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
487 IGenericSFImpl *This = (IGenericSFImpl *)iface;
490 IUnknown *pObj = NULL;
491 HRESULT hr = E_INVALIDARG;
493 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
494 This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
501 if (IsEqualIID (riid, &IID_IContextMenu))
504 pObj = (LPUNKNOWN) ISvItemCm_Constructor( (IShellFolder *) iface, This->pidlRoot, apidl, cidl);
506 pObj = (LPUNKNOWN) ISvBgCm_Constructor( (IShellFolder *) iface, TRUE);
509 else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1))
511 pObj = (LPUNKNOWN) IDataObject_Constructor( hwndOwner,
512 This->pidlRoot, apidl, cidl);
515 else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1))
517 pidl = ILCombine (This->pidlRoot, apidl[0]);
518 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
522 else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1))
524 pidl = ILCombine (This->pidlRoot, apidl[0]);
525 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
529 else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1))
531 hr = IShellFolder_QueryInterface (iface,
532 &IID_IDropTarget, (LPVOID *) & pObj);
534 else if ((IsEqualIID(riid,&IID_IShellLinkW) ||
535 IsEqualIID(riid,&IID_IShellLinkA)) && (cidl == 1))
537 pidl = ILCombine (This->pidlRoot, apidl[0]);
538 hr = IShellLink_ConstructFromFile(NULL, riid, pidl, (LPVOID*)&pObj);
544 if (SUCCEEDED(hr) && !pObj)
548 TRACE ("(%p)->hr=0x%08x\n", This, hr);
552 /**************************************************************************
553 * ISF_Desktop_fnGetDisplayNameOf
556 * special case: pidl = null gives desktop-name back
558 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
559 LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
561 IGenericSFImpl *This = (IGenericSFImpl *)iface;
563 WCHAR wszPath[MAX_PATH];
565 TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", This, pidl, dwFlags, strRet);
571 if (_ILIsDesktop (pidl))
573 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
574 (GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING))
575 strcpyW(wszPath, This->sPathTarget);
577 HCR_GetClassNameW(&CLSID_ShellDesktop, wszPath, MAX_PATH);
579 else if (_ILIsPidlSimple (pidl))
583 if ((clsid = _ILGetGUIDPointer (pidl)))
585 if (GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING)
587 int bWantsForParsing;
590 * We can only get a filesystem path from a shellfolder if the
591 * value WantsFORPARSING in CLSID\\{...}\\shellfolder exists.
593 * Exception: The MyComputer folder doesn't have this key,
594 * but any other filesystem backed folder it needs it.
596 if (IsEqualIID (clsid, &CLSID_MyComputer))
598 bWantsForParsing = TRUE;
602 /* get the "WantsFORPARSING" flag from the registry */
603 static const WCHAR clsidW[] =
604 { 'C','L','S','I','D','\\',0 };
605 static const WCHAR shellfolderW[] =
606 { '\\','s','h','e','l','l','f','o','l','d','e','r',0 };
607 static const WCHAR wantsForParsingW[] =
608 { 'W','a','n','t','s','F','o','r','P','a','r','s','i','n',
610 WCHAR szRegPath[100];
613 lstrcpyW (szRegPath, clsidW);
614 SHELL32_GUIDToStringW (clsid, &szRegPath[6]);
615 lstrcatW (szRegPath, shellfolderW);
616 r = SHGetValueW(HKEY_CLASSES_ROOT, szRegPath,
617 wantsForParsingW, NULL, NULL, NULL);
618 if (r == ERROR_SUCCESS)
619 bWantsForParsing = TRUE;
621 bWantsForParsing = FALSE;
624 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
628 * we need the filesystem path to the destination folder.
629 * Only the folder itself can know it
631 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags,
637 /* parsing name like ::{...} */
640 SHELL32_GUIDToStringW (clsid, &wszPath[2]);
645 /* user friendly name */
646 HCR_GetClassNameW (clsid, wszPath, MAX_PATH);
653 /* file system folder or file rooted at the desktop */
654 if ((GET_SHGDN_FOR(dwFlags) == SHGDN_FORPARSING) &&
655 (GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER))
657 lstrcpynW(wszPath, This->sPathTarget, MAX_PATH - 1);
658 PathAddBackslashW(wszPath);
659 cLen = lstrlenW(wszPath);
662 _ILSimpleGetTextW(pidl, wszPath + cLen, MAX_PATH - cLen);
664 if (!_ILIsFolder(pidl))
665 SHELL_FS_ProcessDisplayFilename(wszPath, dwFlags);
670 /* a complex pidl, let the subfolder do the work */
671 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags,
678 strRet->uType = STRRET_CSTR;
679 if (!WideCharToMultiByte(CP_ACP, 0, wszPath, -1, strRet->u.cStr, MAX_PATH,
681 strRet->u.cStr[0] = '\0';
684 strRet->u.pOleStr = SHAlloc((lstrlenW(This->sPathTarget)+1) *
686 if (!strRet->u.pOleStr)
690 strcpyW(strRet->u.pOleStr, This->sPathTarget);
691 strRet->uType = STRRET_WSTR;
696 TRACE ("-- (%p)->(%s,0x%08x)\n", This,
697 strRet->uType == STRRET_CSTR ? strRet->u.cStr :
698 debugstr_w(strRet->u.pOleStr), hr);
702 /**************************************************************************
703 * ISF_Desktop_fnSetNameOf
704 * Changes the name of a file object or subfolder, possibly changing its item
705 * identifier in the process.
708 * HWND hwndOwner, //[in ] Owner window for output
709 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
710 * LPCOLESTR lpszName, //[in ] the items new display name
711 * DWORD dwFlags, //[in ] SHGNO formatting flags
712 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
714 static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface,
715 HWND hwndOwner, LPCITEMIDLIST pidl, /* simple pidl */
716 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
718 IGenericSFImpl *This = (IGenericSFImpl *)iface;
720 FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", This, hwndOwner, pidl,
721 debugstr_w (lpName), dwFlags, pPidlOut);
726 static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID(IShellFolder2 *iface,
729 IGenericSFImpl *This = (IGenericSFImpl *)iface;
731 FIXME ("(%p)\n", This);
735 static HRESULT WINAPI ISF_Desktop_fnEnumSearches (IShellFolder2 *iface,
736 IEnumExtraSearch ** ppenum)
738 IGenericSFImpl *This = (IGenericSFImpl *)iface;
739 FIXME ("(%p)\n", This);
743 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn (IShellFolder2 * iface,
744 DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
746 IGenericSFImpl *This = (IGenericSFImpl *)iface;
748 TRACE ("(%p)\n", This);
757 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState (
758 IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
760 IGenericSFImpl *This = (IGenericSFImpl *)iface;
762 TRACE ("(%p)\n", This);
764 if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
767 *pcsFlags = DesktopSFHeader[iColumn].pcsFlags;
772 static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx (IShellFolder2 * iface,
773 LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
775 IGenericSFImpl *This = (IGenericSFImpl *)iface;
776 FIXME ("(%p)\n", This);
781 static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface,
782 LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
784 IGenericSFImpl *This = (IGenericSFImpl *)iface;
788 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
790 if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
795 psd->fmt = DesktopSFHeader[iColumn].fmt;
796 psd->cxChar = DesktopSFHeader[iColumn].cxChar;
797 psd->str.uType = STRRET_CSTR;
798 LoadStringA (shell32_hInstance, DesktopSFHeader[iColumn].colnameid,
799 psd->str.u.cStr, MAX_PATH);
803 /* the data from the pidl */
804 psd->str.uType = STRRET_CSTR;
808 hr = IShellFolder_GetDisplayNameOf(iface, pidl,
809 SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
812 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);
815 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
818 _ILGetFileDate (pidl, psd->str.u.cStr, MAX_PATH);
820 case 4: /* attributes */
821 _ILGetFileAttributes (pidl, psd->str.u.cStr, MAX_PATH);
828 static HRESULT WINAPI ISF_Desktop_fnMapColumnToSCID (
829 IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
831 IGenericSFImpl *This = (IGenericSFImpl *)iface;
832 FIXME ("(%p)\n", This);
836 static const IShellFolder2Vtbl vt_MCFldr_ShellFolder2 =
838 ISF_Desktop_fnQueryInterface,
839 ISF_Desktop_fnAddRef,
840 ISF_Desktop_fnRelease,
841 ISF_Desktop_fnParseDisplayName,
842 ISF_Desktop_fnEnumObjects,
843 ISF_Desktop_fnBindToObject,
844 ISF_Desktop_fnBindToStorage,
845 ISF_Desktop_fnCompareIDs,
846 ISF_Desktop_fnCreateViewObject,
847 ISF_Desktop_fnGetAttributesOf,
848 ISF_Desktop_fnGetUIObjectOf,
849 ISF_Desktop_fnGetDisplayNameOf,
850 ISF_Desktop_fnSetNameOf,
852 ISF_Desktop_fnGetDefaultSearchGUID,
853 ISF_Desktop_fnEnumSearches,
854 ISF_Desktop_fnGetDefaultColumn,
855 ISF_Desktop_fnGetDefaultColumnState,
856 ISF_Desktop_fnGetDetailsEx,
857 ISF_Desktop_fnGetDetailsOf,
858 ISF_Desktop_fnMapColumnToSCID
861 /**************************************************************************
862 * ISF_Desktop_Constructor
864 HRESULT WINAPI ISF_Desktop_Constructor (
865 IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
868 WCHAR szMyPath[MAX_PATH];
871 TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
876 return CLASS_E_NOAGGREGATION;
878 if (!SHGetSpecialFolderPathW( 0, szMyPath, CSIDL_DESKTOPDIRECTORY, TRUE ))
881 sf = LocalAlloc( LMEM_ZEROINIT, sizeof (IGenericSFImpl) );
883 return E_OUTOFMEMORY;
886 sf->lpVtbl = &vt_MCFldr_ShellFolder2;
887 sf->pidlRoot = _ILCreateDesktop(); /* my qualified pidl */
888 sf->sPathTarget = SHAlloc( (lstrlenW(szMyPath) + 1)*sizeof(WCHAR) );
889 lstrcpyW( sf->sPathTarget, szMyPath );
891 r = IUnknown_QueryInterface( _IUnknown_(sf), riid, ppv );
894 IUnknown_Release( _IUnknown_(sf) );
898 TRACE ("--(%p)\n", sf);