SHCoCreateInstance is now documented (spotted by Francois Gouget).
[wine/wine-kai.git] / dlls / shell32 / shfldr_desktop.c
blob868907ccaf9110914b0c0ba95d76d9470873d9df
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 "pidl.h"
44 #include "undocshell.h"
45 #include "shell32_main.h"
46 #include "shresdef.h"
47 #include "shlwapi.h"
48 #include "shellfolder.h"
49 #include "wine/debug.h"
50 #include "debughlp.h"
51 #include "shfldr.h"
53 WINE_DEFAULT_DEBUG_CHANNEL (shell);
55 /***********************************************************************
56 * Desktopfolder implementation
59 typedef struct {
60 ICOM_VFIELD (IShellFolder2);
61 DWORD ref;
63 CLSID *pclsid;
65 /* both paths are parsible from the desktop */
66 LPSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
67 LPITEMIDLIST pidlRoot; /* absolute pidl */
69 int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */
71 UINT cfShellIDList; /* clipboardformat for IDropTarget */
72 BOOL fAcceptFmt; /* flag for pending Drop */
73 } IGenericSFImpl;
75 #define _IUnknown_(This) (IShellFolder*)&(This->lpVtbl)
76 #define _IShellFolder_(This) (IShellFolder*)&(This->lpVtbl)
78 HRESULT WINAPI ISF_MyComputer_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
80 static struct ICOM_VTABLE (IShellFolder2) vt_MCFldr_ShellFolder2;
82 static shvheader DesktopSFHeader[] = {
83 {IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
84 {IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
85 {IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
86 {IDS_SHV_COLUMN4, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12},
87 {IDS_SHV_COLUMN5, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5}
90 #define DESKTOPSHELLVIEWCOLUMNS 5
92 /**************************************************************************
93 * ISF_Desktop_Constructor
95 HRESULT WINAPI ISF_Desktop_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
97 IGenericSFImpl *sf;
98 char szMyPath[MAX_PATH];
100 TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
102 if (!ppv)
103 return E_POINTER;
104 if (pUnkOuter)
105 return CLASS_E_NOAGGREGATION;
107 if (!SHGetSpecialFolderPathA (0, szMyPath, CSIDL_DESKTOPDIRECTORY, TRUE))
108 return E_UNEXPECTED;
110 sf = (IGenericSFImpl *) LocalAlloc (GMEM_ZEROINIT, sizeof (IGenericSFImpl));
111 if (!sf)
112 return E_OUTOFMEMORY;
114 sf->ref = 0;
115 sf->lpVtbl = &vt_MCFldr_ShellFolder2;
116 sf->pidlRoot = _ILCreateDesktop (); /* my qualified pidl */
117 sf->sPathTarget = SHAlloc (strlen (szMyPath) + 1);
118 lstrcpyA (sf->sPathTarget, szMyPath);
120 if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv))) {
121 IUnknown_Release (_IUnknown_ (sf));
122 return E_NOINTERFACE;
125 TRACE ("--(%p)\n", sf);
126 return S_OK;
129 /**************************************************************************
130 * ISF_Desktop_fnQueryInterface
132 * NOTES supports not IPersist/IPersistFolder
134 static HRESULT WINAPI ISF_Desktop_fnQueryInterface (IShellFolder2 * iface, REFIID riid, LPVOID * ppvObj)
136 ICOM_THIS (IGenericSFImpl, iface);
138 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
140 *ppvObj = NULL;
142 if (IsEqualIID (riid, &IID_IUnknown) || IsEqualIID (riid, &IID_IShellFolder)
143 || IsEqualIID (riid, &IID_IShellFolder2)) {
144 *ppvObj = This;
147 if (*ppvObj) {
148 IUnknown_AddRef ((IUnknown *) (*ppvObj));
149 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
150 return S_OK;
152 TRACE ("-- Interface: E_NOINTERFACE\n");
153 return E_NOINTERFACE;
156 static ULONG WINAPI ISF_Desktop_fnAddRef (IShellFolder2 * iface)
158 ICOM_THIS (IGenericSFImpl, iface);
160 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
162 return ++(This->ref);
165 static ULONG WINAPI ISF_Desktop_fnRelease (IShellFolder2 * iface)
167 ICOM_THIS (IGenericSFImpl, iface);
169 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
171 if (!--(This->ref)) {
172 TRACE ("-- destroying IShellFolder(%p)\n", This);
173 if (This->pidlRoot)
174 SHFree (This->pidlRoot);
175 if (This->sPathTarget)
176 SHFree (This->sPathTarget);
177 LocalFree ((HLOCAL) This);
178 return 0;
180 return This->ref;
183 /**************************************************************************
184 * ISF_Desktop_fnParseDisplayName
186 * NOTES
187 * "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds
188 * to MyComputer
190 static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
191 HWND hwndOwner,
192 LPBC pbc,
193 LPOLESTR lpszDisplayName,
194 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
196 ICOM_THIS (IGenericSFImpl, iface);
198 WCHAR szElement[MAX_PATH];
199 LPCWSTR szNext = NULL;
200 LPITEMIDLIST pidlTemp = NULL;
201 HRESULT hr = E_INVALIDARG;
202 char szPath[MAX_PATH];
203 DWORD len;
204 CLSID clsid;
206 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
207 This, hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
209 if (!lpszDisplayName || !ppidl)
210 return E_INVALIDARG;
212 *ppidl = 0;
214 if (pchEaten)
215 *pchEaten = 0; /* strange but like the original */
217 if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':') {
218 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
219 TRACE ("-- element: %s\n", debugstr_w (szElement));
220 SHCLSIDFromStringW (szElement + 2, &clsid);
221 pidlTemp = _ILCreate (PT_MYCOMP, &clsid, sizeof (clsid));
222 } else if (PathGetDriveNumberW (lpszDisplayName) >= 0) {
223 /* it's a filesystem path with a drive. Let MyComputer parse it */
224 pidlTemp = _ILCreateMyComputer ();
225 szNext = lpszDisplayName;
226 } else if (PathIsUNCW(lpszDisplayName)) {
227 pidlTemp = _ILCreateNetwork();
228 szNext = lpszDisplayName;
229 } else {
230 /* it's a filesystem path on the desktop. Let a FSFolder parse it */
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 pidlTemp = _ILCreateFromPathA(szPath);
238 szNext = NULL;
241 if (pidlTemp) {
242 if (szNext && *szNext) {
243 hr = SHELL32_ParseNextElement (iface, hwndOwner, pbc, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
244 } else {
245 hr = S_OK;
246 if (pdwAttributes && *pdwAttributes) {
247 SHELL32_GetItemAttributes (_IShellFolder_ (This), pidlTemp, pdwAttributes);
252 *ppidl = pidlTemp;
254 TRACE ("(%p)->(-- ret=0x%08lx)\n", This, hr);
256 return hr;
259 /**************************************************************************
260 * ISF_Desktop_fnEnumObjects
262 static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
263 HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
265 ICOM_THIS (IGenericSFImpl, iface);
267 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
269 *ppEnumIDList = NULL;
270 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_DESK);
272 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
274 if (!*ppEnumIDList)
275 return E_OUTOFMEMORY;
277 return S_OK;
280 /**************************************************************************
281 * ISF_Desktop_fnBindToObject
283 static HRESULT WINAPI ISF_Desktop_fnBindToObject (IShellFolder2 * iface,
284 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
286 ICOM_THIS (IGenericSFImpl, iface);
288 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
290 return SHELL32_BindToChild (This->pidlRoot, This->sPathTarget, pidl, riid, ppvOut);
293 /**************************************************************************
294 * ISF_Desktop_fnBindToStorage
296 static HRESULT WINAPI ISF_Desktop_fnBindToStorage (IShellFolder2 * iface,
297 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
299 ICOM_THIS (IGenericSFImpl, iface);
301 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
303 *ppvOut = NULL;
304 return E_NOTIMPL;
307 /**************************************************************************
308 * ISF_Desktop_fnCompareIDs
311 static HRESULT WINAPI ISF_Desktop_fnCompareIDs (IShellFolder2 * iface,
312 LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
314 ICOM_THIS (IGenericSFImpl, iface);
316 int nReturn;
318 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
319 nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
320 TRACE ("-- %i\n", nReturn);
321 return nReturn;
324 /**************************************************************************
325 * ISF_Desktop_fnCreateViewObject
327 static HRESULT WINAPI ISF_Desktop_fnCreateViewObject (IShellFolder2 * iface,
328 HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
330 ICOM_THIS (IGenericSFImpl, iface);
332 LPSHELLVIEW pShellView;
333 HRESULT hr = E_INVALIDARG;
335 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This, hwndOwner, shdebugstr_guid (riid), ppvOut);
337 if (ppvOut) {
338 *ppvOut = NULL;
340 if (IsEqualIID (riid, &IID_IDropTarget)) {
341 WARN ("IDropTarget not implemented\n");
342 hr = E_NOTIMPL;
343 } else if (IsEqualIID (riid, &IID_IContextMenu)) {
344 WARN ("IContextMenu not implemented\n");
345 hr = E_NOTIMPL;
346 } else if (IsEqualIID (riid, &IID_IShellView)) {
347 pShellView = IShellView_Constructor ((IShellFolder *) iface);
348 if (pShellView) {
349 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
350 IShellView_Release (pShellView);
354 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
355 return hr;
358 /**************************************************************************
359 * ISF_Desktop_fnGetAttributesOf
361 static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
362 UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
364 ICOM_THIS (IGenericSFImpl, iface);
366 HRESULT hr = S_OK;
368 TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This, cidl, apidl, *rgfInOut);
370 if ((!cidl) || (!apidl) || (!rgfInOut))
371 return E_INVALIDARG;
373 while (cidl > 0 && *apidl) {
374 pdump (*apidl);
375 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
376 apidl++;
377 cidl--;
380 TRACE ("-- result=0x%08lx\n", *rgfInOut);
382 return hr;
385 /**************************************************************************
386 * ISF_Desktop_fnGetUIObjectOf
388 * PARAMETERS
389 * HWND hwndOwner, //[in ] Parent window for any output
390 * UINT cidl, //[in ] array size
391 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
392 * REFIID riid, //[in ] Requested Interface
393 * UINT* prgfInOut, //[ ] reserved
394 * LPVOID* ppvObject) //[out] Resulting Interface
397 static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
398 HWND hwndOwner,
399 UINT cidl,
400 LPCITEMIDLIST * apidl,
401 REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
403 ICOM_THIS (IGenericSFImpl, iface);
405 LPITEMIDLIST pidl;
406 IUnknown *pObj = NULL;
407 HRESULT hr = E_INVALIDARG;
409 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
410 This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
412 if (ppvOut) {
413 *ppvOut = NULL;
415 if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1)) {
416 pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface, This->pidlRoot, apidl, cidl);
417 hr = S_OK;
418 } else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1)) {
419 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl);
420 hr = S_OK;
421 } else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1)) {
422 pidl = ILCombine (This->pidlRoot, apidl[0]);
423 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
424 SHFree (pidl);
425 hr = S_OK;
426 } else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1)) {
427 pidl = ILCombine (This->pidlRoot, apidl[0]);
428 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
429 SHFree (pidl);
430 hr = S_OK;
431 } else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1)) {
432 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
433 } else {
434 hr = E_NOINTERFACE;
437 if (!pObj)
438 hr = E_OUTOFMEMORY;
440 *ppvOut = pObj;
442 TRACE ("(%p)->hr=0x%08lx\n", This, hr);
443 return hr;
446 /**************************************************************************
447 * ISF_Desktop_fnGetDisplayNameOf
449 * NOTES
450 * special case: pidl = null gives desktop-name back
452 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
453 LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
455 ICOM_THIS (IGenericSFImpl, iface);
457 CHAR szPath[MAX_PATH] = "";
458 GUID const *clsid;
459 HRESULT hr = S_OK;
461 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
462 pdump (pidl);
464 if (!strRet)
465 return E_INVALIDARG;
467 if (_ILIsDesktop (pidl)) {
468 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING)) {
469 lstrcpyA (szPath, This->sPathTarget);
470 } else {
471 HCR_GetClassNameA(&CLSID_ShellDesktop, szPath, MAX_PATH);
473 } else if (_ILIsPidlSimple (pidl)) {
474 if ((clsid = _ILGetGUIDPointer (pidl))) {
475 if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING) {
476 int bWantsForParsing;
479 * we can only get a filesystem path from a shellfolder if the value WantsFORPARSING in
480 * CLSID\\{...}\\shellfolder exists
481 * exception: the MyComputer folder has this keys not but like any filesystem backed
482 * folder it needs these behaviour
484 if (IsEqualIID (clsid, &CLSID_MyComputer)) {
485 bWantsForParsing = 1;
486 } else {
487 /* get the "WantsFORPARSING" flag from the registry */
488 char szRegPath[100];
490 lstrcpyA (szRegPath, "CLSID\\");
491 SHELL32_GUIDToStringA (clsid, &szRegPath[6]);
492 lstrcatA (szRegPath, "\\shellfolder");
493 bWantsForParsing =
494 (ERROR_SUCCESS ==
495 SHGetValueA (HKEY_CLASSES_ROOT, szRegPath, "WantsFORPARSING", NULL, NULL, NULL));
498 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && bWantsForParsing) {
499 /* we need the filesystem path to the destination folder. Only the folder itself can know it */
500 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, szPath, MAX_PATH);
501 } else {
502 /* parsing name like ::{...} */
503 lstrcpyA (szPath, "::");
504 SHELL32_GUIDToStringA (clsid, &szPath[2]);
506 } else {
507 /* user friendly name */
508 HCR_GetClassNameA (clsid, szPath, MAX_PATH);
510 } else {
511 /* file system folder */
512 _ILSimpleGetText (pidl, szPath, MAX_PATH);
514 } else {
515 /* a complex pidl, let the subfolder do the work */
516 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, szPath, MAX_PATH);
519 if (SUCCEEDED (hr)) {
520 strRet->uType = STRRET_CSTR;
521 lstrcpynA (strRet->u.cStr, szPath, MAX_PATH);
524 TRACE ("-- (%p)->(%s,0x%08lx)\n", This, szPath, hr);
525 return hr;
528 /**************************************************************************
529 * ISF_Desktop_fnSetNameOf
530 * Changes the name of a file object or subfolder, possibly changing its item
531 * identifier in the process.
533 * PARAMETERS
534 * HWND hwndOwner, //[in ] Owner window for output
535 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
536 * LPCOLESTR lpszName, //[in ] the items new display name
537 * DWORD dwFlags, //[in ] SHGNO formatting flags
538 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
540 static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */
541 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
543 ICOM_THIS (IGenericSFImpl, iface);
545 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
547 return E_FAIL;
550 static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID (IShellFolder2 * iface, GUID * pguid)
552 ICOM_THIS (IGenericSFImpl, iface);
554 FIXME ("(%p)\n", This);
555 return E_NOTIMPL;
557 static HRESULT WINAPI ISF_Desktop_fnEnumSearches (IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
559 ICOM_THIS (IGenericSFImpl, iface);
560 FIXME ("(%p)\n", This);
561 return E_NOTIMPL;
563 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn (IShellFolder2 * iface,
564 DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
566 ICOM_THIS (IGenericSFImpl, iface);
568 TRACE ("(%p)\n", This);
570 if (pSort)
571 *pSort = 0;
572 if (pDisplay)
573 *pDisplay = 0;
575 return S_OK;
577 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState (IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
579 ICOM_THIS (IGenericSFImpl, iface);
581 TRACE ("(%p)\n", This);
583 if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
584 return E_INVALIDARG;
586 *pcsFlags = DesktopSFHeader[iColumn].pcsFlags;
588 return S_OK;
590 static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx (IShellFolder2 * iface,
591 LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
593 ICOM_THIS (IGenericSFImpl, iface);
594 FIXME ("(%p)\n", This);
596 return E_NOTIMPL;
598 static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface,
599 LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
601 ICOM_THIS (IGenericSFImpl, iface);
603 HRESULT hr = E_FAIL;
605 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
607 if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
608 return E_INVALIDARG;
610 if (!pidl) {
611 psd->fmt = DesktopSFHeader[iColumn].fmt;
612 psd->cxChar = DesktopSFHeader[iColumn].cxChar;
613 psd->str.uType = STRRET_CSTR;
614 LoadStringA (shell32_hInstance, DesktopSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
615 return S_OK;
616 } else {
617 /* the data from the pidl */
618 switch (iColumn) {
619 case 0: /* name */
620 hr = IShellFolder_GetDisplayNameOf (iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
621 break;
622 case 1: /* size */
623 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);
624 break;
625 case 2: /* type */
626 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
627 break;
628 case 3: /* date */
629 _ILGetFileDate (pidl, psd->str.u.cStr, MAX_PATH);
630 break;
631 case 4: /* attributes */
632 _ILGetFileAttributes (pidl, psd->str.u.cStr, MAX_PATH);
633 break;
635 hr = S_OK;
636 psd->str.uType = STRRET_CSTR;
639 return hr;
641 static HRESULT WINAPI ISF_Desktop_fnMapColumnToSCID (IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
643 ICOM_THIS (IGenericSFImpl, iface);
644 FIXME ("(%p)\n", This);
645 return E_NOTIMPL;
648 static ICOM_VTABLE (IShellFolder2) vt_MCFldr_ShellFolder2 =
650 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
651 ISF_Desktop_fnQueryInterface,
652 ISF_Desktop_fnAddRef,
653 ISF_Desktop_fnRelease,
654 ISF_Desktop_fnParseDisplayName,
655 ISF_Desktop_fnEnumObjects,
656 ISF_Desktop_fnBindToObject,
657 ISF_Desktop_fnBindToStorage,
658 ISF_Desktop_fnCompareIDs,
659 ISF_Desktop_fnCreateViewObject,
660 ISF_Desktop_fnGetAttributesOf,
661 ISF_Desktop_fnGetUIObjectOf,
662 ISF_Desktop_fnGetDisplayNameOf,
663 ISF_Desktop_fnSetNameOf,
664 /* ShellFolder2 */
665 ISF_Desktop_fnGetDefaultSearchGUID,
666 ISF_Desktop_fnEnumSearches,
667 ISF_Desktop_fnGetDefaultColumn,
668 ISF_Desktop_fnGetDefaultColumnState,
669 ISF_Desktop_fnGetDetailsEx,
670 ISF_Desktop_fnGetDetailsOf,
671 ISF_Desktop_fnMapColumnToSCID};