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
;
563 TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", This
, pidl
, dwFlags
, strRet
);
569 pszPath
= CoTaskMemAlloc((MAX_PATH
+1) * sizeof(WCHAR
));
571 return E_OUTOFMEMORY
;
573 if (_ILIsDesktop (pidl
))
575 if ((GET_SHGDN_RELATION (dwFlags
) == SHGDN_NORMAL
) &&
576 (GET_SHGDN_FOR (dwFlags
) & SHGDN_FORPARSING
))
577 strcpyW(pszPath
, This
->sPathTarget
);
579 HCR_GetClassNameW(&CLSID_ShellDesktop
, pszPath
, MAX_PATH
);
581 else if (_ILIsPidlSimple (pidl
))
585 if ((clsid
= _ILGetGUIDPointer (pidl
)))
587 if (GET_SHGDN_FOR (dwFlags
) & SHGDN_FORPARSING
)
589 int bWantsForParsing
;
592 * We can only get a filesystem path from a shellfolder if the
593 * value WantsFORPARSING in CLSID\\{...}\\shellfolder exists.
595 * Exception: The MyComputer folder doesn't have this key,
596 * but any other filesystem backed folder it needs it.
598 if (IsEqualIID (clsid
, &CLSID_MyComputer
))
600 bWantsForParsing
= TRUE
;
604 /* get the "WantsFORPARSING" flag from the registry */
605 static const WCHAR clsidW
[] =
606 { 'C','L','S','I','D','\\',0 };
607 static const WCHAR shellfolderW
[] =
608 { '\\','s','h','e','l','l','f','o','l','d','e','r',0 };
609 static const WCHAR wantsForParsingW
[] =
610 { 'W','a','n','t','s','F','o','r','P','a','r','s','i','n',
612 WCHAR szRegPath
[100];
615 lstrcpyW (szRegPath
, clsidW
);
616 SHELL32_GUIDToStringW (clsid
, &szRegPath
[6]);
617 lstrcatW (szRegPath
, shellfolderW
);
618 r
= SHGetValueW(HKEY_CLASSES_ROOT
, szRegPath
,
619 wantsForParsingW
, NULL
, NULL
, NULL
);
620 if (r
== ERROR_SUCCESS
)
621 bWantsForParsing
= TRUE
;
623 bWantsForParsing
= FALSE
;
626 if ((GET_SHGDN_RELATION (dwFlags
) == SHGDN_NORMAL
) &&
630 * we need the filesystem path to the destination folder.
631 * Only the folder itself can know it
633 hr
= SHELL32_GetDisplayNameOfChild (iface
, pidl
, dwFlags
,
639 /* parsing name like ::{...} */
642 SHELL32_GUIDToStringW (clsid
, &pszPath
[2]);
647 /* user friendly name */
648 HCR_GetClassNameW (clsid
, pszPath
, MAX_PATH
);
655 /* file system folder or file rooted at the desktop */
656 if ((GET_SHGDN_FOR(dwFlags
) == SHGDN_FORPARSING
) &&
657 (GET_SHGDN_RELATION(dwFlags
) != SHGDN_INFOLDER
))
659 lstrcpynW(pszPath
, This
->sPathTarget
, MAX_PATH
- 1);
660 PathAddBackslashW(pszPath
);
661 cLen
= lstrlenW(pszPath
);
664 _ILSimpleGetTextW(pidl
, pszPath
+ cLen
, MAX_PATH
- cLen
);
666 if (!_ILIsFolder(pidl
))
667 SHELL_FS_ProcessDisplayFilename(pszPath
, dwFlags
);
672 /* a complex pidl, let the subfolder do the work */
673 hr
= SHELL32_GetDisplayNameOfChild (iface
, pidl
, dwFlags
,
679 /* Win9x always returns ANSI strings, NT always returns Unicode strings */
680 if (GetVersion() & 0x80000000)
682 strRet
->uType
= STRRET_CSTR
;
683 if (!WideCharToMultiByte(CP_ACP
, 0, pszPath
, -1, strRet
->u
.cStr
, MAX_PATH
,
685 strRet
->u
.cStr
[0] = '\0';
686 CoTaskMemFree(pszPath
);
690 strRet
->uType
= STRRET_WSTR
;
691 strRet
->u
.pOleStr
= pszPath
;
695 CoTaskMemFree(pszPath
);
697 TRACE ("-- (%p)->(%s,0x%08x)\n", This
,
698 strRet
->uType
== STRRET_CSTR
? strRet
->u
.cStr
:
699 debugstr_w(strRet
->u
.pOleStr
), hr
);
703 /**************************************************************************
704 * ISF_Desktop_fnSetNameOf
705 * Changes the name of a file object or subfolder, possibly changing its item
706 * identifier in the process.
709 * HWND hwndOwner, //[in ] Owner window for output
710 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
711 * LPCOLESTR lpszName, //[in ] the items new display name
712 * DWORD dwFlags, //[in ] SHGNO formatting flags
713 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
715 static HRESULT WINAPI
ISF_Desktop_fnSetNameOf (IShellFolder2
* iface
,
716 HWND hwndOwner
, LPCITEMIDLIST pidl
, /* simple pidl */
717 LPCOLESTR lpName
, DWORD dwFlags
, LPITEMIDLIST
* pPidlOut
)
719 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
721 FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", This
, hwndOwner
, pidl
,
722 debugstr_w (lpName
), dwFlags
, pPidlOut
);
727 static HRESULT WINAPI
ISF_Desktop_fnGetDefaultSearchGUID(IShellFolder2
*iface
,
730 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
732 FIXME ("(%p)\n", This
);
736 static HRESULT WINAPI
ISF_Desktop_fnEnumSearches (IShellFolder2
*iface
,
737 IEnumExtraSearch
** ppenum
)
739 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
740 FIXME ("(%p)\n", This
);
744 static HRESULT WINAPI
ISF_Desktop_fnGetDefaultColumn (IShellFolder2
* iface
,
745 DWORD dwRes
, ULONG
* pSort
, ULONG
* pDisplay
)
747 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
749 TRACE ("(%p)\n", This
);
758 static HRESULT WINAPI
ISF_Desktop_fnGetDefaultColumnState (
759 IShellFolder2
* iface
, UINT iColumn
, DWORD
* pcsFlags
)
761 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
763 TRACE ("(%p)\n", This
);
765 if (!pcsFlags
|| iColumn
>= DESKTOPSHELLVIEWCOLUMNS
)
768 *pcsFlags
= DesktopSFHeader
[iColumn
].pcsFlags
;
773 static HRESULT WINAPI
ISF_Desktop_fnGetDetailsEx (IShellFolder2
* iface
,
774 LPCITEMIDLIST pidl
, const SHCOLUMNID
* pscid
, VARIANT
* pv
)
776 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
777 FIXME ("(%p)\n", This
);
782 static HRESULT WINAPI
ISF_Desktop_fnGetDetailsOf (IShellFolder2
* iface
,
783 LPCITEMIDLIST pidl
, UINT iColumn
, SHELLDETAILS
* psd
)
785 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
789 TRACE ("(%p)->(%p %i %p)\n", This
, pidl
, iColumn
, psd
);
791 if (!psd
|| iColumn
>= DESKTOPSHELLVIEWCOLUMNS
)
796 psd
->fmt
= DesktopSFHeader
[iColumn
].fmt
;
797 psd
->cxChar
= DesktopSFHeader
[iColumn
].cxChar
;
798 psd
->str
.uType
= STRRET_CSTR
;
799 LoadStringA (shell32_hInstance
, DesktopSFHeader
[iColumn
].colnameid
,
800 psd
->str
.u
.cStr
, MAX_PATH
);
804 /* the data from the pidl */
805 psd
->str
.uType
= STRRET_CSTR
;
809 hr
= IShellFolder_GetDisplayNameOf(iface
, pidl
,
810 SHGDN_NORMAL
| SHGDN_INFOLDER
, &psd
->str
);
813 _ILGetFileSize (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
816 _ILGetFileType (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
819 _ILGetFileDate (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
821 case 4: /* attributes */
822 _ILGetFileAttributes (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
829 static HRESULT WINAPI
ISF_Desktop_fnMapColumnToSCID (
830 IShellFolder2
* iface
, UINT column
, SHCOLUMNID
* pscid
)
832 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
833 FIXME ("(%p)\n", This
);
837 static const IShellFolder2Vtbl vt_MCFldr_ShellFolder2
=
839 ISF_Desktop_fnQueryInterface
,
840 ISF_Desktop_fnAddRef
,
841 ISF_Desktop_fnRelease
,
842 ISF_Desktop_fnParseDisplayName
,
843 ISF_Desktop_fnEnumObjects
,
844 ISF_Desktop_fnBindToObject
,
845 ISF_Desktop_fnBindToStorage
,
846 ISF_Desktop_fnCompareIDs
,
847 ISF_Desktop_fnCreateViewObject
,
848 ISF_Desktop_fnGetAttributesOf
,
849 ISF_Desktop_fnGetUIObjectOf
,
850 ISF_Desktop_fnGetDisplayNameOf
,
851 ISF_Desktop_fnSetNameOf
,
853 ISF_Desktop_fnGetDefaultSearchGUID
,
854 ISF_Desktop_fnEnumSearches
,
855 ISF_Desktop_fnGetDefaultColumn
,
856 ISF_Desktop_fnGetDefaultColumnState
,
857 ISF_Desktop_fnGetDetailsEx
,
858 ISF_Desktop_fnGetDetailsOf
,
859 ISF_Desktop_fnMapColumnToSCID
862 /**************************************************************************
863 * ISF_Desktop_Constructor
865 HRESULT WINAPI
ISF_Desktop_Constructor (
866 IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
)
869 WCHAR szMyPath
[MAX_PATH
];
872 TRACE ("unkOut=%p %s\n", pUnkOuter
, shdebugstr_guid (riid
));
877 return CLASS_E_NOAGGREGATION
;
879 if (!SHGetSpecialFolderPathW( 0, szMyPath
, CSIDL_DESKTOPDIRECTORY
, TRUE
))
882 sf
= LocalAlloc( LMEM_ZEROINIT
, sizeof (IGenericSFImpl
) );
884 return E_OUTOFMEMORY
;
887 sf
->lpVtbl
= &vt_MCFldr_ShellFolder2
;
888 sf
->pidlRoot
= _ILCreateDesktop(); /* my qualified pidl */
889 sf
->sPathTarget
= SHAlloc( (lstrlenW(szMyPath
) + 1)*sizeof(WCHAR
) );
890 lstrcpyW( sf
->sPathTarget
, szMyPath
);
892 r
= IUnknown_QueryInterface( _IUnknown_(sf
), riid
, ppv
);
895 IUnknown_Release( _IUnknown_(sf
) );
899 TRACE ("--(%p)\n", sf
);