Removed some uses of the non-standard ICOM_THIS macro.
[wine/multimedia.git] / dlls / shell32 / shfldr_desktop.c
blobb4b7f742c8e464f82c1623ad463ebd6e1e8ff9c6
2 /*
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
23 #include "config.h"
24 #include "wine/port.h"
26 #include <stdlib.h>
27 #include <string.h>
28 #include <stdarg.h>
29 #include <stdio.h>
31 #define NONAMELESSUNION
32 #define NONAMELESSSTRUCT
33 #include "winerror.h"
34 #include "windef.h"
35 #include "winbase.h"
36 #include "winreg.h"
37 #include "wingdi.h"
38 #include "winuser.h"
40 #include "ole2.h"
41 #include "shlguid.h"
43 #include "enumidlist.h"
44 #include "pidl.h"
45 #include "undocshell.h"
46 #include "shell32_main.h"
47 #include "shresdef.h"
48 #include "shlwapi.h"
49 #include "shellfolder.h"
50 #include "wine/debug.h"
51 #include "debughlp.h"
52 #include "shfldr.h"
54 WINE_DEFAULT_DEBUG_CHANNEL (shell);
56 /***********************************************************************
57 * Desktopfolder implementation
60 typedef struct {
61 IShellFolder2Vtbl *lpVtbl;
62 DWORD ref;
64 CLSID *pclsid;
66 /* both paths are parsible from the desktop */
67 LPSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
68 LPITEMIDLIST pidlRoot; /* absolute pidl */
70 int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */
72 UINT cfShellIDList; /* clipboardformat for IDropTarget */
73 BOOL fAcceptFmt; /* flag for pending Drop */
74 } IGenericSFImpl;
76 #define _IUnknown_(This) (IShellFolder*)&(This->lpVtbl)
77 #define _IShellFolder_(This) (IShellFolder*)&(This->lpVtbl)
79 static struct IShellFolder2Vtbl vt_MCFldr_ShellFolder2;
81 static shvheader DesktopSFHeader[] = {
82 {IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
83 {IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
84 {IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
85 {IDS_SHV_COLUMN4, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12},
86 {IDS_SHV_COLUMN5, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5}
89 #define DESKTOPSHELLVIEWCOLUMNS 5
91 /**************************************************************************
92 * ISF_Desktop_Constructor
94 HRESULT WINAPI ISF_Desktop_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
96 IGenericSFImpl *sf;
97 char szMyPath[MAX_PATH];
99 TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
101 if (!ppv)
102 return E_POINTER;
103 if (pUnkOuter)
104 return CLASS_E_NOAGGREGATION;
106 if (!SHGetSpecialFolderPathA (0, szMyPath, CSIDL_DESKTOPDIRECTORY, TRUE))
107 return E_UNEXPECTED;
109 sf = (IGenericSFImpl *) LocalAlloc (GMEM_ZEROINIT, sizeof (IGenericSFImpl));
110 if (!sf)
111 return E_OUTOFMEMORY;
113 sf->ref = 0;
114 sf->lpVtbl = &vt_MCFldr_ShellFolder2;
115 sf->pidlRoot = _ILCreateDesktop (); /* my qualified pidl */
116 sf->sPathTarget = SHAlloc (strlen (szMyPath) + 1);
117 lstrcpyA (sf->sPathTarget, szMyPath);
119 if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv))) {
120 IUnknown_Release (_IUnknown_ (sf));
121 return E_NOINTERFACE;
124 TRACE ("--(%p)\n", sf);
125 return S_OK;
128 /**************************************************************************
129 * ISF_Desktop_fnQueryInterface
131 * NOTES supports not IPersist/IPersistFolder
133 static HRESULT WINAPI ISF_Desktop_fnQueryInterface (IShellFolder2 * iface, REFIID riid, LPVOID * ppvObj)
135 IGenericSFImpl *This = (IGenericSFImpl *)iface;
137 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
139 *ppvObj = NULL;
141 if (IsEqualIID (riid, &IID_IUnknown) || IsEqualIID (riid, &IID_IShellFolder)
142 || IsEqualIID (riid, &IID_IShellFolder2)) {
143 *ppvObj = This;
146 if (*ppvObj) {
147 IUnknown_AddRef ((IUnknown *) (*ppvObj));
148 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
149 return S_OK;
151 TRACE ("-- Interface: E_NOINTERFACE\n");
152 return E_NOINTERFACE;
155 static ULONG WINAPI ISF_Desktop_fnAddRef (IShellFolder2 * iface)
157 IGenericSFImpl *This = (IGenericSFImpl *)iface;
159 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
161 return ++(This->ref);
164 static ULONG WINAPI ISF_Desktop_fnRelease (IShellFolder2 * iface)
166 IGenericSFImpl *This = (IGenericSFImpl *)iface;
168 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
170 if (!--(This->ref)) {
171 TRACE ("-- destroying IShellFolder(%p)\n", This);
172 if (This->pidlRoot)
173 SHFree (This->pidlRoot);
174 if (This->sPathTarget)
175 SHFree (This->sPathTarget);
176 LocalFree ((HLOCAL) This);
177 return 0;
179 return This->ref;
182 /**************************************************************************
183 * ISF_Desktop_fnParseDisplayName
185 * NOTES
186 * "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds
187 * to MyComputer
189 static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
190 HWND hwndOwner,
191 LPBC pbc,
192 LPOLESTR lpszDisplayName,
193 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
195 IGenericSFImpl *This = (IGenericSFImpl *)iface;
197 WCHAR szElement[MAX_PATH];
198 LPCWSTR szNext = NULL;
199 LPITEMIDLIST pidlTemp = NULL;
200 HRESULT hr = S_OK;
201 char szPath[MAX_PATH];
202 DWORD len;
203 CLSID clsid;
205 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
206 This, hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
208 if (!lpszDisplayName || !ppidl)
209 return E_INVALIDARG;
211 *ppidl = 0;
213 if (pchEaten)
214 *pchEaten = 0; /* strange but like the original */
216 if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':') {
217 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
218 TRACE ("-- element: %s\n", debugstr_w (szElement));
219 SHCLSIDFromStringW (szElement + 2, &clsid);
220 pidlTemp = _ILCreateGuid (PT_GUID, &clsid);
221 } else if (PathGetDriveNumberW (lpszDisplayName) >= 0) {
222 /* it's a filesystem path with a drive. Let MyComputer parse it */
223 pidlTemp = _ILCreateMyComputer ();
224 szNext = lpszDisplayName;
225 } else if (PathIsUNCW(lpszDisplayName)) {
226 pidlTemp = _ILCreateNetwork();
227 szNext = lpszDisplayName;
228 } else {
229 /* it's a filesystem path on the desktop. Let a FSFolder parse it */
231 if (*lpszDisplayName) {
232 /* build a complete path to create a simple pidl */
233 lstrcpyA(szPath, This->sPathTarget);
234 PathAddBackslashA(szPath);
235 len = lstrlenA(szPath);
236 WideCharToMultiByte(CP_ACP, 0, lpszDisplayName, -1, szPath + len, MAX_PATH - len, NULL, NULL);
237 hr = _ILCreateFromPathA(szPath, &pidlTemp);
238 } else {
239 pidlTemp = _ILCreateMyComputer();
242 szNext = NULL;
245 if (SUCCEEDED(hr) && pidlTemp) {
246 if (szNext && *szNext) {
247 hr = SHELL32_ParseNextElement (iface, hwndOwner, pbc, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
248 } else {
249 if (pdwAttributes && *pdwAttributes) {
250 hr = SHELL32_GetItemAttributes (_IShellFolder_ (This), pidlTemp, pdwAttributes);
255 *ppidl = pidlTemp;
257 TRACE ("(%p)->(-- ret=0x%08lx)\n", This, hr);
259 return hr;
262 /**************************************************************************
263 * CreateDesktopEnumList()
265 static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
267 BOOL ret = TRUE;
268 char szPath[MAX_PATH];
270 TRACE("(%p)->(flags=0x%08lx) \n",list,dwFlags);
272 /*enumerate the root folders */
273 if(dwFlags & SHCONTF_FOLDERS)
275 HKEY hkey;
277 /*create the pidl for This item */
278 ret = AddToEnumList(list, _ILCreateMyComputer());
280 if (ret && !RegOpenKeyExA(HKEY_LOCAL_MACHINE,
281 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\explorer\\desktop\\NameSpace",
282 0, KEY_READ, &hkey))
284 char iid[50];
285 int i=0;
286 BOOL moreKeys = TRUE;
288 while (ret && moreKeys)
290 DWORD size = sizeof (iid);
291 LONG apiRet = RegEnumKeyExA(hkey, i, iid, &size, 0, NULL, NULL,
292 NULL);
294 if (ERROR_SUCCESS == apiRet)
296 ret = AddToEnumList(list, _ILCreateGuidFromStrA(iid));
297 i++;
299 else if (ERROR_NO_MORE_ITEMS == apiRet)
300 moreKeys = FALSE;
301 else
302 ret = FALSE;
304 RegCloseKey(hkey);
308 /*enumerate the elements in %windir%\desktop */
309 SHGetSpecialFolderPathA(0, szPath, CSIDL_DESKTOPDIRECTORY, FALSE);
310 ret = ret && CreateFolderEnumList(list, szPath, dwFlags);
312 return ret;
315 /**************************************************************************
316 * ISF_Desktop_fnEnumObjects
318 static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
319 HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
321 IGenericSFImpl *This = (IGenericSFImpl *)iface;
323 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
325 *ppEnumIDList = IEnumIDList_Constructor();
326 if (*ppEnumIDList)
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", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
344 return SHELL32_BindToChild (This->pidlRoot, This->sPathTarget, pidl, riid, ppvOut);
347 /**************************************************************************
348 * ISF_Desktop_fnBindToStorage
350 static HRESULT WINAPI ISF_Desktop_fnBindToStorage (IShellFolder2 * iface,
351 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
353 IGenericSFImpl *This = (IGenericSFImpl *)iface;
355 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
357 *ppvOut = NULL;
358 return E_NOTIMPL;
361 /**************************************************************************
362 * ISF_Desktop_fnCompareIDs
365 static HRESULT WINAPI ISF_Desktop_fnCompareIDs (IShellFolder2 * iface,
366 LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
368 IGenericSFImpl *This = (IGenericSFImpl *)iface;
370 int nReturn;
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);
375 return 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;
386 LPSHELLVIEW pShellView;
387 HRESULT hr = E_INVALIDARG;
389 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This, hwndOwner, shdebugstr_guid (riid), ppvOut);
391 if (ppvOut) {
392 *ppvOut = NULL;
394 if (IsEqualIID (riid, &IID_IDropTarget)) {
395 WARN ("IDropTarget not implemented\n");
396 hr = E_NOTIMPL;
397 } else if (IsEqualIID (riid, &IID_IContextMenu)) {
398 WARN ("IContextMenu not implemented\n");
399 hr = E_NOTIMPL;
400 } else if (IsEqualIID (riid, &IID_IShellView)) {
401 pShellView = IShellView_Constructor ((IShellFolder *) iface);
402 if (pShellView) {
403 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
404 IShellView_Release (pShellView);
408 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
409 return hr;
412 /**************************************************************************
413 * ISF_Desktop_fnGetAttributesOf
415 static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
416 UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
418 IGenericSFImpl *This = (IGenericSFImpl *)iface;
420 HRESULT hr = S_OK;
422 TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This, cidl, apidl, *rgfInOut);
424 if ((!cidl) || (!apidl) || (!rgfInOut))
425 return E_INVALIDARG;
427 if (*rgfInOut == 0)
428 *rgfInOut = ~0;
430 while (cidl > 0 && *apidl) {
431 pdump (*apidl);
432 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
433 apidl++;
434 cidl--;
437 TRACE ("-- result=0x%08lx\n", *rgfInOut);
439 return hr;
442 /**************************************************************************
443 * ISF_Desktop_fnGetUIObjectOf
445 * PARAMETERS
446 * HWND hwndOwner, //[in ] Parent window for any output
447 * UINT cidl, //[in ] array size
448 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
449 * REFIID riid, //[in ] Requested Interface
450 * UINT* prgfInOut, //[ ] reserved
451 * LPVOID* ppvObject) //[out] Resulting Interface
454 static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
455 HWND hwndOwner,
456 UINT cidl,
457 LPCITEMIDLIST * apidl,
458 REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
460 IGenericSFImpl *This = (IGenericSFImpl *)iface;
462 LPITEMIDLIST pidl;
463 IUnknown *pObj = NULL;
464 HRESULT hr = E_INVALIDARG;
466 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
467 This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
469 if (ppvOut) {
470 *ppvOut = NULL;
472 if (IsEqualIID (riid, &IID_IContextMenu)) {
473 pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface, This->pidlRoot, apidl, cidl);
474 hr = S_OK;
475 } else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1)) {
476 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl);
477 hr = S_OK;
478 } else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1)) {
479 pidl = ILCombine (This->pidlRoot, apidl[0]);
480 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
481 SHFree (pidl);
482 hr = S_OK;
483 } else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1)) {
484 pidl = ILCombine (This->pidlRoot, apidl[0]);
485 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
486 SHFree (pidl);
487 hr = S_OK;
488 } else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1)) {
489 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
490 } else if ((IsEqualIID(riid,&IID_IShellLinkW) || IsEqualIID(riid,&IID_IShellLinkA))
491 && (cidl == 1)) {
492 pidl = ILCombine (This->pidlRoot, apidl[0]);
493 hr = IShellLink_ConstructFromFile(NULL, riid, pidl, (LPVOID*)&pObj);
494 SHFree (pidl);
495 } else {
496 hr = E_NOINTERFACE;
499 if (SUCCEEDED(hr) && !pObj)
500 hr = E_OUTOFMEMORY;
502 *ppvOut = pObj;
504 TRACE ("(%p)->hr=0x%08lx\n", This, hr);
505 return hr;
508 /**************************************************************************
509 * ISF_Desktop_fnGetDisplayNameOf
511 * NOTES
512 * special case: pidl = null gives desktop-name back
514 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
515 LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
517 IGenericSFImpl *This = (IGenericSFImpl *)iface;
519 CHAR szPath[MAX_PATH];
520 GUID const *clsid;
521 HRESULT hr = S_OK;
523 *szPath = '\0';
525 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
526 pdump (pidl);
528 if (!strRet)
529 return E_INVALIDARG;
531 if (_ILIsDesktop (pidl)) {
532 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING)) {
533 lstrcpyA (szPath, This->sPathTarget);
534 } else {
535 HCR_GetClassNameA(&CLSID_ShellDesktop, szPath, MAX_PATH);
537 } else if (_ILIsPidlSimple (pidl)) {
538 if ((clsid = _ILGetGUIDPointer (pidl))) {
539 if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING) {
540 int bWantsForParsing;
543 * we can only get a filesystem path from a shellfolder if the value WantsFORPARSING in
544 * CLSID\\{...}\\shellfolder exists
545 * exception: the MyComputer folder has this keys not but like any filesystem backed
546 * folder it needs these behaviour
548 if (IsEqualIID (clsid, &CLSID_MyComputer)) {
549 bWantsForParsing = 1;
550 } else {
551 /* get the "WantsFORPARSING" flag from the registry */
552 char szRegPath[100];
554 lstrcpyA (szRegPath, "CLSID\\");
555 SHELL32_GUIDToStringA (clsid, &szRegPath[6]);
556 lstrcatA (szRegPath, "\\shellfolder");
557 bWantsForParsing =
558 (ERROR_SUCCESS ==
559 SHGetValueA (HKEY_CLASSES_ROOT, szRegPath, "WantsFORPARSING", NULL, NULL, NULL));
562 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && bWantsForParsing) {
563 /* we need the filesystem path to the destination folder. Only the folder itself can know it */
564 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, szPath, MAX_PATH);
565 } else {
566 /* parsing name like ::{...} */
567 lstrcpyA (szPath, "::");
568 SHELL32_GUIDToStringA (clsid, &szPath[2]);
570 } else {
571 /* user friendly name */
572 HCR_GetClassNameA (clsid, szPath, MAX_PATH);
574 } else {
575 /* file system folder */
576 _ILSimpleGetText (pidl, szPath, MAX_PATH);
578 if (!_ILIsFolder(pidl))
579 SHELL_FS_ProcessDisplayFilename(szPath, dwFlags);
581 } else {
582 /* a complex pidl, let the subfolder do the work */
583 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, szPath, MAX_PATH);
586 if (SUCCEEDED (hr)) {
587 strRet->uType = STRRET_CSTR;
588 lstrcpynA (strRet->u.cStr, szPath, MAX_PATH);
591 TRACE ("-- (%p)->(%s,0x%08lx)\n", This, szPath, hr);
592 return hr;
595 /**************************************************************************
596 * ISF_Desktop_fnSetNameOf
597 * Changes the name of a file object or subfolder, possibly changing its item
598 * identifier in the process.
600 * PARAMETERS
601 * HWND hwndOwner, //[in ] Owner window for output
602 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
603 * LPCOLESTR lpszName, //[in ] the items new display name
604 * DWORD dwFlags, //[in ] SHGNO formatting flags
605 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
607 static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */
608 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
610 IGenericSFImpl *This = (IGenericSFImpl *)iface;
612 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
614 return E_FAIL;
617 static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID (IShellFolder2 * iface, GUID * pguid)
619 IGenericSFImpl *This = (IGenericSFImpl *)iface;
621 FIXME ("(%p)\n", This);
622 return E_NOTIMPL;
624 static HRESULT WINAPI ISF_Desktop_fnEnumSearches (IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
626 IGenericSFImpl *This = (IGenericSFImpl *)iface;
627 FIXME ("(%p)\n", This);
628 return E_NOTIMPL;
630 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn (IShellFolder2 * iface,
631 DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
633 IGenericSFImpl *This = (IGenericSFImpl *)iface;
635 TRACE ("(%p)\n", This);
637 if (pSort)
638 *pSort = 0;
639 if (pDisplay)
640 *pDisplay = 0;
642 return S_OK;
644 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState (IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
646 IGenericSFImpl *This = (IGenericSFImpl *)iface;
648 TRACE ("(%p)\n", This);
650 if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
651 return E_INVALIDARG;
653 *pcsFlags = DesktopSFHeader[iColumn].pcsFlags;
655 return S_OK;
657 static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx (IShellFolder2 * iface,
658 LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
660 IGenericSFImpl *This = (IGenericSFImpl *)iface;
661 FIXME ("(%p)\n", This);
663 return E_NOTIMPL;
665 static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface,
666 LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
668 IGenericSFImpl *This = (IGenericSFImpl *)iface;
670 HRESULT hr = E_FAIL;
672 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
674 if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
675 return E_INVALIDARG;
677 if (!pidl) {
678 psd->fmt = DesktopSFHeader[iColumn].fmt;
679 psd->cxChar = DesktopSFHeader[iColumn].cxChar;
680 psd->str.uType = STRRET_CSTR;
681 LoadStringA (shell32_hInstance, DesktopSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
682 return S_OK;
683 } else {
684 /* the data from the pidl */
685 switch (iColumn) {
686 case 0: /* name */
687 hr = IShellFolder_GetDisplayNameOf (iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
688 break;
689 case 1: /* size */
690 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);
691 break;
692 case 2: /* type */
693 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
694 break;
695 case 3: /* date */
696 _ILGetFileDate (pidl, psd->str.u.cStr, MAX_PATH);
697 break;
698 case 4: /* attributes */
699 _ILGetFileAttributes (pidl, psd->str.u.cStr, MAX_PATH);
700 break;
702 hr = S_OK;
703 psd->str.uType = STRRET_CSTR;
706 return hr;
708 static HRESULT WINAPI ISF_Desktop_fnMapColumnToSCID (IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
710 IGenericSFImpl *This = (IGenericSFImpl *)iface;
711 FIXME ("(%p)\n", This);
712 return E_NOTIMPL;
715 static IShellFolder2Vtbl vt_MCFldr_ShellFolder2 =
717 ISF_Desktop_fnQueryInterface,
718 ISF_Desktop_fnAddRef,
719 ISF_Desktop_fnRelease,
720 ISF_Desktop_fnParseDisplayName,
721 ISF_Desktop_fnEnumObjects,
722 ISF_Desktop_fnBindToObject,
723 ISF_Desktop_fnBindToStorage,
724 ISF_Desktop_fnCompareIDs,
725 ISF_Desktop_fnCreateViewObject,
726 ISF_Desktop_fnGetAttributesOf,
727 ISF_Desktop_fnGetUIObjectOf,
728 ISF_Desktop_fnGetDisplayNameOf,
729 ISF_Desktop_fnSetNameOf,
730 /* ShellFolder2 */
731 ISF_Desktop_fnGetDefaultSearchGUID,
732 ISF_Desktop_fnEnumSearches,
733 ISF_Desktop_fnGetDefaultColumn,
734 ISF_Desktop_fnGetDefaultColumnState,
735 ISF_Desktop_fnGetDetailsEx,
736 ISF_Desktop_fnGetDetailsOf,
737 ISF_Desktop_fnMapColumnToSCID};