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/UnixDosFolder parse it */
190 if (UNIXFS_is_rooted_at_desktop())
191 pidlTemp
= _ILCreateGuid(PT_GUID
, &CLSID_UnixDosFolder
);
193 pidlTemp
= _ILCreateMyComputer ();
194 szNext
= lpszDisplayName
;
196 else if (PathIsUNCW(lpszDisplayName
))
198 pidlTemp
= _ILCreateNetwork();
199 szNext
= lpszDisplayName
;
201 else if( (pidlTemp
= SHELL32_CreatePidlFromBindCtx(pbc
, lpszDisplayName
)) )
208 /* it's a filesystem path on the desktop. Let a FSFolder parse it */
210 if (*lpszDisplayName
)
212 WCHAR szPath
[MAX_PATH
];
215 /* build a complete path to create a simple pidl */
216 lstrcpynW(szPath
, This
->sPathTarget
, MAX_PATH
);
217 pathPtr
= PathAddBackslashW(szPath
);
220 lstrcpynW(pathPtr
, lpszDisplayName
, MAX_PATH
- (pathPtr
- szPath
));
221 hr
= _ILCreateFromPathW(szPath
, &pidlTemp
);
225 /* should never reach here, but for completeness */
226 hr
= HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER
);
230 pidlTemp
= _ILCreateMyComputer();
235 if (SUCCEEDED(hr
) && pidlTemp
)
237 if (szNext
&& *szNext
)
239 hr
= SHELL32_ParseNextElement(iface
, hwndOwner
, pbc
,
240 &pidlTemp
, (LPOLESTR
) szNext
, pchEaten
, pdwAttributes
);
244 if (pdwAttributes
&& *pdwAttributes
)
245 hr
= SHELL32_GetItemAttributes(_IShellFolder_ (This
),
246 pidlTemp
, pdwAttributes
);
252 TRACE ("(%p)->(-- ret=0x%08lx)\n", This
, hr
);
257 /**************************************************************************
258 * CreateDesktopEnumList()
260 static const WCHAR Desktop_NameSpaceW
[] = { 'S','O','F','T','W','A','R','E',
261 '\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
262 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l',
263 'o','r','e','r','\\','D','e','s','k','t','o','p','\\','N','a','m','e','s','p',
266 static BOOL
CreateDesktopEnumList(IEnumIDList
*list
, DWORD dwFlags
)
269 WCHAR szPath
[MAX_PATH
];
271 TRACE("(%p)->(flags=0x%08lx) \n",list
,dwFlags
);
273 /* enumerate the root folders */
274 if (dwFlags
& SHCONTF_FOLDERS
)
279 /* create the pidl for This item */
280 ret
= AddToEnumList(list
, _ILCreateMyComputer());
282 r
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
, Desktop_NameSpaceW
,
284 if (ret
&& ERROR_SUCCESS
== r
)
288 BOOL moreKeys
= TRUE
;
290 while (ret
&& moreKeys
)
295 r
= RegEnumKeyExW(hkey
, i
, iid
, &size
, 0, NULL
, NULL
, NULL
);
296 if (ERROR_SUCCESS
== r
)
298 ret
= AddToEnumList(list
, _ILCreateGuidFromStrW(iid
));
301 else if (ERROR_NO_MORE_ITEMS
== r
)
310 /* enumerate the elements in %windir%\desktop */
311 SHGetSpecialFolderPathW(0, szPath
, CSIDL_DESKTOPDIRECTORY
, FALSE
);
312 ret
= ret
&& CreateFolderEnumList(list
, szPath
, dwFlags
);
317 /**************************************************************************
318 * ISF_Desktop_fnEnumObjects
320 static HRESULT WINAPI
ISF_Desktop_fnEnumObjects (IShellFolder2
* iface
,
321 HWND hwndOwner
, DWORD dwFlags
, LPENUMIDLIST
* ppEnumIDList
)
323 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
325 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n",
326 This
, hwndOwner
, dwFlags
, ppEnumIDList
);
328 *ppEnumIDList
= IEnumIDList_Constructor();
330 CreateDesktopEnumList(*ppEnumIDList
, dwFlags
);
332 TRACE ("-- (%p)->(new ID List: %p)\n", This
, *ppEnumIDList
);
334 return *ppEnumIDList
? S_OK
: E_OUTOFMEMORY
;
337 /**************************************************************************
338 * ISF_Desktop_fnBindToObject
340 static HRESULT WINAPI
ISF_Desktop_fnBindToObject (IShellFolder2
* iface
,
341 LPCITEMIDLIST pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
* ppvOut
)
343 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
344 char szPath
[MAX_PATH
];
346 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n",
347 This
, pidl
, pbcReserved
, shdebugstr_guid (riid
), ppvOut
);
349 WideCharToMultiByte( CP_ACP
, 0, This
->sPathTarget
, -1,
350 szPath
, MAX_PATH
, NULL
, NULL
);
351 return SHELL32_BindToChild( This
->pidlRoot
, szPath
, pidl
, riid
, ppvOut
);
354 /**************************************************************************
355 * ISF_Desktop_fnBindToStorage
357 static HRESULT WINAPI
ISF_Desktop_fnBindToStorage (IShellFolder2
* iface
,
358 LPCITEMIDLIST pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
* ppvOut
)
360 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
362 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n",
363 This
, pidl
, pbcReserved
, shdebugstr_guid (riid
), ppvOut
);
369 /**************************************************************************
370 * ISF_Desktop_fnCompareIDs
372 static HRESULT WINAPI
ISF_Desktop_fnCompareIDs (IShellFolder2
* iface
,
373 LPARAM lParam
, LPCITEMIDLIST pidl1
, LPCITEMIDLIST pidl2
)
375 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
378 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This
, lParam
, pidl1
, pidl2
);
379 nReturn
= SHELL32_CompareIDs (_IShellFolder_ (This
), lParam
, pidl1
, pidl2
);
380 TRACE ("-- %i\n", nReturn
);
384 /**************************************************************************
385 * ISF_Desktop_fnCreateViewObject
387 static HRESULT WINAPI
ISF_Desktop_fnCreateViewObject (IShellFolder2
* iface
,
388 HWND hwndOwner
, REFIID riid
, LPVOID
* ppvOut
)
390 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
391 LPSHELLVIEW pShellView
;
392 HRESULT hr
= E_INVALIDARG
;
394 TRACE ("(%p)->(hwnd=%p,%s,%p)\n",
395 This
, hwndOwner
, shdebugstr_guid (riid
), ppvOut
);
402 if (IsEqualIID (riid
, &IID_IDropTarget
))
404 WARN ("IDropTarget not implemented\n");
407 else if (IsEqualIID (riid
, &IID_IContextMenu
))
409 WARN ("IContextMenu not implemented\n");
412 else if (IsEqualIID (riid
, &IID_IShellView
))
414 pShellView
= IShellView_Constructor ((IShellFolder
*) iface
);
417 hr
= IShellView_QueryInterface (pShellView
, riid
, ppvOut
);
418 IShellView_Release (pShellView
);
421 TRACE ("-- (%p)->(interface=%p)\n", This
, ppvOut
);
425 /**************************************************************************
426 * ISF_Desktop_fnGetAttributesOf
428 static HRESULT WINAPI
ISF_Desktop_fnGetAttributesOf (IShellFolder2
* iface
,
429 UINT cidl
, LPCITEMIDLIST
* apidl
, DWORD
* rgfInOut
)
431 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
433 const static DWORD dwDesktopAttributes
=
434 SFGAO_STORAGE
| SFGAO_HASPROPSHEET
| SFGAO_STORAGE_ANCESTOR
|
435 SFGAO_FILESYSANCESTOR
| SFGAO_FOLDER
| SFGAO_FILESYSTEM
| SFGAO_HASSUBFOLDER
;
437 TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08lx))\n",
438 This
, cidl
, apidl
, rgfInOut
, rgfInOut
? *rgfInOut
: 0);
449 *rgfInOut
&= dwDesktopAttributes
;
451 while (cidl
> 0 && *apidl
) {
453 if (_ILIsDesktop(*apidl
)) {
454 *rgfInOut
&= dwDesktopAttributes
;
456 SHELL32_GetItemAttributes (_IShellFolder_ (This
), *apidl
, rgfInOut
);
462 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
463 *rgfInOut
&= ~SFGAO_VALIDATE
;
465 TRACE ("-- result=0x%08lx\n", *rgfInOut
);
470 /**************************************************************************
471 * ISF_Desktop_fnGetUIObjectOf
474 * HWND hwndOwner, //[in ] Parent window for any output
475 * UINT cidl, //[in ] array size
476 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
477 * REFIID riid, //[in ] Requested Interface
478 * UINT* prgfInOut, //[ ] reserved
479 * LPVOID* ppvObject) //[out] Resulting Interface
482 static HRESULT WINAPI
ISF_Desktop_fnGetUIObjectOf (IShellFolder2
* iface
,
483 HWND hwndOwner
, UINT cidl
, LPCITEMIDLIST
* apidl
,
484 REFIID riid
, UINT
* prgfInOut
, LPVOID
* ppvOut
)
486 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
489 IUnknown
*pObj
= NULL
;
490 HRESULT hr
= E_INVALIDARG
;
492 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
493 This
, hwndOwner
, cidl
, apidl
, shdebugstr_guid (riid
), prgfInOut
, ppvOut
);
500 if (IsEqualIID (riid
, &IID_IContextMenu
))
503 pObj
= (LPUNKNOWN
) ISvItemCm_Constructor( (IShellFolder
*) iface
, This
->pidlRoot
, apidl
, cidl
);
505 pObj
= (LPUNKNOWN
) ISvBgCm_Constructor( (IShellFolder
*) iface
, TRUE
);
508 else if (IsEqualIID (riid
, &IID_IDataObject
) && (cidl
>= 1))
510 pObj
= (LPUNKNOWN
) IDataObject_Constructor( hwndOwner
,
511 This
->pidlRoot
, apidl
, cidl
);
514 else if (IsEqualIID (riid
, &IID_IExtractIconA
) && (cidl
== 1))
516 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
517 pObj
= (LPUNKNOWN
) IExtractIconA_Constructor (pidl
);
521 else if (IsEqualIID (riid
, &IID_IExtractIconW
) && (cidl
== 1))
523 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
524 pObj
= (LPUNKNOWN
) IExtractIconW_Constructor (pidl
);
528 else if (IsEqualIID (riid
, &IID_IDropTarget
) && (cidl
>= 1))
530 hr
= IShellFolder_QueryInterface (iface
,
531 &IID_IDropTarget
, (LPVOID
*) & pObj
);
533 else if ((IsEqualIID(riid
,&IID_IShellLinkW
) ||
534 IsEqualIID(riid
,&IID_IShellLinkA
)) && (cidl
== 1))
536 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
537 hr
= IShellLink_ConstructFromFile(NULL
, riid
, pidl
, (LPVOID
*)&pObj
);
543 if (SUCCEEDED(hr
) && !pObj
)
547 TRACE ("(%p)->hr=0x%08lx\n", This
, hr
);
551 /**************************************************************************
552 * ISF_Desktop_fnGetDisplayNameOf
555 * special case: pidl = null gives desktop-name back
557 static HRESULT WINAPI
ISF_Desktop_fnGetDisplayNameOf (IShellFolder2
* iface
,
558 LPCITEMIDLIST pidl
, DWORD dwFlags
, LPSTRRET strRet
)
560 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
563 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This
, pidl
, dwFlags
, strRet
);
569 strRet
->uType
= STRRET_CSTR
;
570 if (_ILIsDesktop (pidl
))
572 if ((GET_SHGDN_RELATION (dwFlags
) == SHGDN_NORMAL
) &&
573 (GET_SHGDN_FOR (dwFlags
) & SHGDN_FORPARSING
))
577 WideCharToMultiByte( CP_ACP
, 0, This
->sPathTarget
, -1,
578 strRet
->u
.cStr
, MAX_PATH
, NULL
, &defCharUsed
);
581 strRet
->u
.pOleStr
= SHAlloc((lstrlenW(This
->sPathTarget
)+1) *
583 if (!strRet
->u
.pOleStr
)
587 strcpyW(strRet
->u
.pOleStr
, This
->sPathTarget
);
588 strRet
->uType
= STRRET_WSTR
;
594 HCR_GetClassNameA(&CLSID_ShellDesktop
, strRet
->u
.cStr
, MAX_PATH
);
597 else if (_ILIsPidlSimple (pidl
))
601 if ((clsid
= _ILGetGUIDPointer (pidl
)))
603 if (GET_SHGDN_FOR (dwFlags
) & SHGDN_FORPARSING
)
605 int bWantsForParsing
;
608 * We can only get a filesystem path from a shellfolder if the
609 * value WantsFORPARSING in CLSID\\{...}\\shellfolder exists.
611 * Exception: The MyComputer folder doesn't have this key,
612 * but any other filesystem backed folder it needs it.
614 if (IsEqualIID (clsid
, &CLSID_MyComputer
))
616 bWantsForParsing
= TRUE
;
620 /* get the "WantsFORPARSING" flag from the registry */
621 static const WCHAR clsidW
[] =
622 { 'C','L','S','I','D','\\',0 };
623 static const WCHAR shellfolderW
[] =
624 { '\\','s','h','e','l','l','f','o','l','d','e','r',0 };
625 static const WCHAR wantsForParsingW
[] =
626 { 'W','a','n','t','s','F','o','r','P','a','r','s','i','n',
628 WCHAR szRegPath
[100];
631 lstrcpyW (szRegPath
, clsidW
);
632 SHELL32_GUIDToStringW (clsid
, &szRegPath
[6]);
633 lstrcatW (szRegPath
, shellfolderW
);
634 r
= SHGetValueW(HKEY_CLASSES_ROOT
, szRegPath
,
635 wantsForParsingW
, NULL
, NULL
, NULL
);
636 if (r
== ERROR_SUCCESS
)
637 bWantsForParsing
= TRUE
;
639 bWantsForParsing
= FALSE
;
642 if ((GET_SHGDN_RELATION (dwFlags
) == SHGDN_NORMAL
) &&
646 * we need the filesystem path to the destination folder.
647 * Only the folder itself can know it
649 hr
= SHELL32_GetDisplayNameOfChild (iface
, pidl
, dwFlags
,
655 /* parsing name like ::{...} */
656 lstrcpyA (strRet
->u
.cStr
, "::");
657 SHELL32_GUIDToStringA (clsid
, &strRet
->u
.cStr
[2]);
662 /* user friendly name */
663 HCR_GetClassNameA (clsid
, strRet
->u
.cStr
, MAX_PATH
);
668 /* file system folder */
669 _ILSimpleGetText (pidl
, strRet
->u
.cStr
, MAX_PATH
);
671 if (!_ILIsFolder(pidl
))
672 SHELL_FS_ProcessDisplayFilename(strRet
->u
.cStr
, dwFlags
);
677 /* a complex pidl, let the subfolder do the work */
678 hr
= SHELL32_GetDisplayNameOfChild (iface
, pidl
, dwFlags
,
679 strRet
->u
.cStr
, MAX_PATH
);
682 TRACE ("-- (%p)->(%s,0x%08lx)\n", This
,
683 strRet
->uType
== STRRET_CSTR
? strRet
->u
.cStr
:
684 debugstr_w(strRet
->u
.pOleStr
), hr
);
688 /**************************************************************************
689 * ISF_Desktop_fnSetNameOf
690 * Changes the name of a file object or subfolder, possibly changing its item
691 * identifier in the process.
694 * HWND hwndOwner, //[in ] Owner window for output
695 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
696 * LPCOLESTR lpszName, //[in ] the items new display name
697 * DWORD dwFlags, //[in ] SHGNO formatting flags
698 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
700 static HRESULT WINAPI
ISF_Desktop_fnSetNameOf (IShellFolder2
* iface
,
701 HWND hwndOwner
, LPCITEMIDLIST pidl
, /* simple pidl */
702 LPCOLESTR lpName
, DWORD dwFlags
, LPITEMIDLIST
* pPidlOut
)
704 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
706 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This
, hwndOwner
, pidl
,
707 debugstr_w (lpName
), dwFlags
, pPidlOut
);
712 static HRESULT WINAPI
ISF_Desktop_fnGetDefaultSearchGUID(IShellFolder2
*iface
,
715 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
717 FIXME ("(%p)\n", This
);
721 static HRESULT WINAPI
ISF_Desktop_fnEnumSearches (IShellFolder2
*iface
,
722 IEnumExtraSearch
** ppenum
)
724 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
725 FIXME ("(%p)\n", This
);
729 static HRESULT WINAPI
ISF_Desktop_fnGetDefaultColumn (IShellFolder2
* iface
,
730 DWORD dwRes
, ULONG
* pSort
, ULONG
* pDisplay
)
732 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
734 TRACE ("(%p)\n", This
);
743 static HRESULT WINAPI
ISF_Desktop_fnGetDefaultColumnState (
744 IShellFolder2
* iface
, UINT iColumn
, DWORD
* pcsFlags
)
746 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
748 TRACE ("(%p)\n", This
);
750 if (!pcsFlags
|| iColumn
>= DESKTOPSHELLVIEWCOLUMNS
)
753 *pcsFlags
= DesktopSFHeader
[iColumn
].pcsFlags
;
758 static HRESULT WINAPI
ISF_Desktop_fnGetDetailsEx (IShellFolder2
* iface
,
759 LPCITEMIDLIST pidl
, const SHCOLUMNID
* pscid
, VARIANT
* pv
)
761 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
762 FIXME ("(%p)\n", This
);
767 static HRESULT WINAPI
ISF_Desktop_fnGetDetailsOf (IShellFolder2
* iface
,
768 LPCITEMIDLIST pidl
, UINT iColumn
, SHELLDETAILS
* psd
)
770 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
774 TRACE ("(%p)->(%p %i %p)\n", This
, pidl
, iColumn
, psd
);
776 if (!psd
|| iColumn
>= DESKTOPSHELLVIEWCOLUMNS
)
781 psd
->fmt
= DesktopSFHeader
[iColumn
].fmt
;
782 psd
->cxChar
= DesktopSFHeader
[iColumn
].cxChar
;
783 psd
->str
.uType
= STRRET_CSTR
;
784 LoadStringA (shell32_hInstance
, DesktopSFHeader
[iColumn
].colnameid
,
785 psd
->str
.u
.cStr
, MAX_PATH
);
789 /* the data from the pidl */
790 psd
->str
.uType
= STRRET_CSTR
;
794 hr
= IShellFolder_GetDisplayNameOf(iface
, pidl
,
795 SHGDN_NORMAL
| SHGDN_INFOLDER
, &psd
->str
);
798 _ILGetFileSize (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
801 _ILGetFileType (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
804 _ILGetFileDate (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
806 case 4: /* attributes */
807 _ILGetFileAttributes (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
814 static HRESULT WINAPI
ISF_Desktop_fnMapColumnToSCID (
815 IShellFolder2
* iface
, UINT column
, SHCOLUMNID
* pscid
)
817 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
818 FIXME ("(%p)\n", This
);
822 static const IShellFolder2Vtbl vt_MCFldr_ShellFolder2
=
824 ISF_Desktop_fnQueryInterface
,
825 ISF_Desktop_fnAddRef
,
826 ISF_Desktop_fnRelease
,
827 ISF_Desktop_fnParseDisplayName
,
828 ISF_Desktop_fnEnumObjects
,
829 ISF_Desktop_fnBindToObject
,
830 ISF_Desktop_fnBindToStorage
,
831 ISF_Desktop_fnCompareIDs
,
832 ISF_Desktop_fnCreateViewObject
,
833 ISF_Desktop_fnGetAttributesOf
,
834 ISF_Desktop_fnGetUIObjectOf
,
835 ISF_Desktop_fnGetDisplayNameOf
,
836 ISF_Desktop_fnSetNameOf
,
838 ISF_Desktop_fnGetDefaultSearchGUID
,
839 ISF_Desktop_fnEnumSearches
,
840 ISF_Desktop_fnGetDefaultColumn
,
841 ISF_Desktop_fnGetDefaultColumnState
,
842 ISF_Desktop_fnGetDetailsEx
,
843 ISF_Desktop_fnGetDetailsOf
,
844 ISF_Desktop_fnMapColumnToSCID
847 /**************************************************************************
848 * ISF_Desktop_Constructor
850 HRESULT WINAPI
ISF_Desktop_Constructor (
851 IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
)
854 WCHAR szMyPath
[MAX_PATH
];
857 TRACE ("unkOut=%p %s\n", pUnkOuter
, shdebugstr_guid (riid
));
862 return CLASS_E_NOAGGREGATION
;
864 if (!SHGetSpecialFolderPathW( 0, szMyPath
, CSIDL_DESKTOPDIRECTORY
, TRUE
))
867 sf
= LocalAlloc( LMEM_ZEROINIT
, sizeof (IGenericSFImpl
) );
869 return E_OUTOFMEMORY
;
872 sf
->lpVtbl
= &vt_MCFldr_ShellFolder2
;
873 sf
->pidlRoot
= _ILCreateDesktop(); /* my qualified pidl */
874 sf
->sPathTarget
= SHAlloc( (lstrlenW(szMyPath
) + 1)*sizeof(WCHAR
) );
875 lstrcpyW( sf
->sPathTarget
, szMyPath
);
877 r
= IUnknown_QueryInterface( _IUnknown_(sf
), riid
, ppv
);
880 IUnknown_Release( _IUnknown_(sf
) );
884 TRACE ("--(%p)\n", sf
);