Moved system.dll implementation to dlls/kernel.
[wine.git] / dlls / shell32 / shfldr_desktop.c
blob77b5924170d540757482e883b0069f6dd0f8781a
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 <stdio.h>
30 #define NONAMELESSUNION
31 #define NONAMELESSSTRUCT
32 #include "winerror.h"
33 #include "winbase.h"
34 #include "winreg.h"
36 #include "ole2.h"
37 #include "shlguid.h"
39 #include "pidl.h"
40 #include "undocshell.h"
41 #include "shell32_main.h"
42 #include "shresdef.h"
43 #include "shlwapi.h"
44 #include "shellfolder.h"
45 #include "wine/debug.h"
46 #include "debughlp.h"
47 #include "shfldr.h"
49 WINE_DEFAULT_DEBUG_CHANNEL (shell);
51 /***********************************************************************
52 * Desktopfolder implementation
55 typedef struct {
56 ICOM_VFIELD (IShellFolder2);
57 DWORD ref;
59 CLSID *pclsid;
61 /* both paths are parsible from the desktop */
62 LPSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
63 LPITEMIDLIST pidlRoot; /* absolute pidl */
65 int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */
67 UINT cfShellIDList; /* clipboardformat for IDropTarget */
68 BOOL fAcceptFmt; /* flag for pending Drop */
69 } IGenericSFImpl;
71 #define _IUnknown_(This) (IShellFolder*)&(This->lpVtbl)
72 #define _IShellFolder_(This) (IShellFolder*)&(This->lpVtbl)
74 HRESULT WINAPI ISF_MyComputer_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
76 static struct ICOM_VTABLE (IShellFolder2) vt_MCFldr_ShellFolder2;
78 static shvheader DesktopSFHeader[] = {
79 {IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
80 {IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
81 {IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
82 {IDS_SHV_COLUMN4, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12},
83 {IDS_SHV_COLUMN5, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5}
86 #define DESKTOPSHELLVIEWCOLUMNS 5
88 /**************************************************************************
89 * ISF_Desktop_Constructor
91 HRESULT WINAPI ISF_Desktop_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
93 IGenericSFImpl *sf;
94 char szMyPath[MAX_PATH];
96 TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
98 if (!ppv)
99 return E_POINTER;
100 if (pUnkOuter)
101 return CLASS_E_NOAGGREGATION;
103 if (!SHGetSpecialFolderPathA (0, szMyPath, CSIDL_DESKTOPDIRECTORY, TRUE))
104 return E_UNEXPECTED;
106 sf = (IGenericSFImpl *) LocalAlloc (GMEM_ZEROINIT, sizeof (IGenericSFImpl));
107 if (!sf)
108 return E_OUTOFMEMORY;
110 sf->ref = 0;
111 sf->lpVtbl = &vt_MCFldr_ShellFolder2;
112 sf->pidlRoot = _ILCreateDesktop (); /* my qualified pidl */
113 sf->sPathTarget = SHAlloc (strlen (szMyPath) + 1);
114 lstrcpyA (sf->sPathTarget, szMyPath);
116 if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv))) {
117 IUnknown_Release (_IUnknown_ (sf));
118 return E_NOINTERFACE;
121 TRACE ("--(%p)\n", sf);
122 return S_OK;
125 /**************************************************************************
126 * ISF_Desktop_fnQueryInterface
128 * NOTES supports not IPersist/IPersistFolder
130 static HRESULT WINAPI ISF_Desktop_fnQueryInterface (IShellFolder2 * iface, REFIID riid, LPVOID * ppvObj)
132 ICOM_THIS (IGenericSFImpl, iface);
134 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
136 *ppvObj = NULL;
138 if (IsEqualIID (riid, &IID_IUnknown) || IsEqualIID (riid, &IID_IShellFolder)
139 || IsEqualIID (riid, &IID_IShellFolder2)) {
140 *ppvObj = This;
143 if (*ppvObj) {
144 IUnknown_AddRef ((IUnknown *) (*ppvObj));
145 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
146 return S_OK;
148 TRACE ("-- Interface: E_NOINTERFACE\n");
149 return E_NOINTERFACE;
152 static ULONG WINAPI ISF_Desktop_fnAddRef (IShellFolder2 * iface)
154 ICOM_THIS (IGenericSFImpl, iface);
156 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
158 return ++(This->ref);
161 static ULONG WINAPI ISF_Desktop_fnRelease (IShellFolder2 * iface)
163 ICOM_THIS (IGenericSFImpl, iface);
165 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
167 if (!--(This->ref)) {
168 TRACE ("-- destroying IShellFolder(%p)\n", This);
169 if (This->pidlRoot)
170 SHFree (This->pidlRoot);
171 if (This->sPathTarget)
172 SHFree (This->sPathTarget);
173 LocalFree ((HLOCAL) This);
174 return 0;
176 return This->ref;
179 /**************************************************************************
180 * ISF_Desktop_fnParseDisplayName
182 * NOTES
183 * "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds
184 * to MyComputer
186 static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
187 HWND hwndOwner,
188 LPBC pbcReserved,
189 LPOLESTR lpszDisplayName,
190 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
192 ICOM_THIS (IGenericSFImpl, iface);
194 WCHAR szElement[MAX_PATH];
195 LPCWSTR szNext = NULL;
196 LPITEMIDLIST pidlTemp = NULL;
197 HRESULT hr = E_OUTOFMEMORY;
198 CLSID clsid;
200 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
201 This, hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
203 *ppidl = 0;
204 if (pchEaten)
205 *pchEaten = 0; /* strange but like the original */
207 if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':') {
208 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
209 TRACE ("-- element: %s\n", debugstr_w (szElement));
210 SHCLSIDFromStringW (szElement + 2, &clsid);
211 pidlTemp = _ILCreate (PT_MYCOMP, &clsid, sizeof (clsid));
212 } else if (PathGetDriveNumberW (lpszDisplayName) >= 0) {
213 /* it's a filesystem path with a drive. Let MyComputer parse it */
214 pidlTemp = _ILCreateMyComputer ();
215 szNext = lpszDisplayName;
216 } else {
217 /* it's a filesystem path on the desktop. Let a FSFolder parse it */
218 WCHAR szCompletePath[MAX_PATH];
220 /* build a complete path to create a simpel pidl */
221 MultiByteToWideChar (CP_ACP, 0, This->sPathTarget, -1, szCompletePath, MAX_PATH);
222 PathAddBackslashW (szCompletePath);
223 lstrcatW (szCompletePath, lpszDisplayName);
224 pidlTemp = SHSimpleIDListFromPathW (lpszDisplayName);
225 szNext = lpszDisplayName;
228 if (pidlTemp) {
229 if (szNext && *szNext) {
230 hr = SHELL32_ParseNextElement (hwndOwner, iface, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
231 } else {
232 hr = S_OK;
233 if (pdwAttributes && *pdwAttributes) {
234 SHELL32_GetItemAttributes (_IShellFolder_ (This), pidlTemp, pdwAttributes);
239 *ppidl = pidlTemp;
241 TRACE ("(%p)->(-- ret=0x%08lx)\n", This, hr);
243 return hr;
246 /**************************************************************************
247 * ISF_Desktop_fnEnumObjects
249 static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
250 HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
252 ICOM_THIS (IGenericSFImpl, iface);
254 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
256 *ppEnumIDList = NULL;
257 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_DESK);
259 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
261 if (!*ppEnumIDList)
262 return E_OUTOFMEMORY;
264 return S_OK;
267 /**************************************************************************
268 * ISF_Desktop_fnBindToObject
270 static HRESULT WINAPI ISF_Desktop_fnBindToObject (IShellFolder2 * iface,
271 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
273 ICOM_THIS (IGenericSFImpl, iface);
275 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
277 return SHELL32_BindToChild (This->pidlRoot, This->sPathTarget, pidl, riid, ppvOut);
280 /**************************************************************************
281 * ISF_Desktop_fnBindToStorage
283 static HRESULT WINAPI ISF_Desktop_fnBindToStorage (IShellFolder2 * iface,
284 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
286 ICOM_THIS (IGenericSFImpl, iface);
288 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
290 *ppvOut = NULL;
291 return E_NOTIMPL;
294 /**************************************************************************
295 * ISF_Desktop_fnCompareIDs
298 static HRESULT WINAPI ISF_Desktop_fnCompareIDs (IShellFolder2 * iface,
299 LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
301 ICOM_THIS (IGenericSFImpl, iface);
303 int nReturn;
305 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
306 nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
307 TRACE ("-- %i\n", nReturn);
308 return nReturn;
311 /**************************************************************************
312 * ISF_Desktop_fnCreateViewObject
314 static HRESULT WINAPI ISF_Desktop_fnCreateViewObject (IShellFolder2 * iface,
315 HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
317 ICOM_THIS (IGenericSFImpl, iface);
319 LPSHELLVIEW pShellView;
320 HRESULT hr = E_INVALIDARG;
322 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This, hwndOwner, shdebugstr_guid (riid), ppvOut);
324 if (ppvOut) {
325 *ppvOut = NULL;
327 if (IsEqualIID (riid, &IID_IDropTarget)) {
328 WARN ("IDropTarget not implemented\n");
329 hr = E_NOTIMPL;
330 } else if (IsEqualIID (riid, &IID_IContextMenu)) {
331 WARN ("IContextMenu not implemented\n");
332 hr = E_NOTIMPL;
333 } else if (IsEqualIID (riid, &IID_IShellView)) {
334 pShellView = IShellView_Constructor ((IShellFolder *) iface);
335 if (pShellView) {
336 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
337 IShellView_Release (pShellView);
341 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
342 return hr;
345 /**************************************************************************
346 * ISF_Desktop_fnGetAttributesOf
348 static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
349 UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
351 ICOM_THIS (IGenericSFImpl, iface);
353 HRESULT hr = S_OK;
355 TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This, cidl, apidl, *rgfInOut);
357 if ((!cidl) || (!apidl) || (!rgfInOut))
358 return E_INVALIDARG;
360 while (cidl > 0 && *apidl) {
361 pdump (*apidl);
362 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
363 apidl++;
364 cidl--;
367 TRACE ("-- result=0x%08lx\n", *rgfInOut);
369 return hr;
372 /**************************************************************************
373 * ISF_Desktop_fnGetUIObjectOf
375 * PARAMETERS
376 * HWND hwndOwner, //[in ] Parent window for any output
377 * UINT cidl, //[in ] array size
378 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
379 * REFIID riid, //[in ] Requested Interface
380 * UINT* prgfInOut, //[ ] reserved
381 * LPVOID* ppvObject) //[out] Resulting Interface
384 static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
385 HWND hwndOwner,
386 UINT cidl,
387 LPCITEMIDLIST * apidl,
388 REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
390 ICOM_THIS (IGenericSFImpl, iface);
392 LPITEMIDLIST pidl;
393 IUnknown *pObj = NULL;
394 HRESULT hr = E_INVALIDARG;
396 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
397 This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
399 if (ppvOut) {
400 *ppvOut = NULL;
402 if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1)) {
403 pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface, This->pidlRoot, apidl, cidl);
404 hr = S_OK;
405 } else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1)) {
406 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl);
407 hr = S_OK;
408 } else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1)) {
409 pidl = ILCombine (This->pidlRoot, apidl[0]);
410 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
411 SHFree (pidl);
412 hr = S_OK;
413 } else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1)) {
414 pidl = ILCombine (This->pidlRoot, apidl[0]);
415 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
416 SHFree (pidl);
417 hr = S_OK;
418 } else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1)) {
419 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
420 } else {
421 hr = E_NOINTERFACE;
424 if (!pObj)
425 hr = E_OUTOFMEMORY;
427 *ppvOut = pObj;
429 TRACE ("(%p)->hr=0x%08lx\n", This, hr);
430 return hr;
433 /**************************************************************************
434 * ISF_Desktop_fnGetDisplayNameOf
436 * NOTES
437 * special case: pidl = null gives desktop-name back
439 DWORD WINAPI __SHGUIDToStringA (REFGUID guid, LPSTR str)
441 CHAR sFormat[52] = "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}";
443 return wsprintfA (str, sFormat,
444 guid->Data1, guid->Data2, guid->Data3,
445 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
446 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
450 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
451 LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
453 ICOM_THIS (IGenericSFImpl, iface);
455 CHAR szPath[MAX_PATH] = "";
456 GUID const *clsid;
457 HRESULT hr = S_OK;
459 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
460 pdump (pidl);
462 if (!strRet)
463 return E_INVALIDARG;
465 if (_ILIsDesktop (pidl)) {
466 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING)) {
467 lstrcpyA (szPath, This->sPathTarget);
468 } else {
469 HCR_GetClassNameA(&CLSID_ShellDesktop, szPath, MAX_PATH);
471 } else if (_ILIsPidlSimple (pidl)) {
472 if ((clsid = _ILGetGUIDPointer (pidl))) {
473 if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING) {
474 int bWantsForParsing;
477 * we can only get a filesystem path from a shellfolder if the value WantsFORPARSING in
478 * CLSID\\{...}\\shellfolder exists
479 * exception: the MyComputer folder has this keys not but like any filesystem backed
480 * folder it needs these behaviour
482 if (IsEqualIID (clsid, &CLSID_MyComputer)) {
483 bWantsForParsing = 1;
484 } else {
485 /* get the "WantsFORPARSING" flag from the registry */
486 char szRegPath[100];
488 lstrcpyA (szRegPath, "CLSID\\");
489 __SHGUIDToStringA (clsid, &szRegPath[6]);
490 lstrcatA (szRegPath, "\\shellfolder");
491 bWantsForParsing =
492 (ERROR_SUCCESS ==
493 SHGetValueA (HKEY_CLASSES_ROOT, szRegPath, "WantsFORPARSING", NULL, NULL, NULL));
496 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && bWantsForParsing) {
497 /* we need the filesystem path to the destination folder. Only the folder itself can know it */
498 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, szPath, MAX_PATH);
499 } else {
500 /* parsing name like ::{...} */
501 lstrcpyA (szPath, "::");
502 __SHGUIDToStringA (clsid, &szPath[2]);
504 } else {
505 /* user friendly name */
506 HCR_GetClassNameA (clsid, szPath, MAX_PATH);
508 } else {
509 /* file system folder */
510 _ILSimpleGetText (pidl, szPath, MAX_PATH);
512 } else {
513 /* a complex pidl, let the subfolder do the work */
514 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, szPath, MAX_PATH);
517 if (SUCCEEDED (hr)) {
518 strRet->uType = STRRET_CSTR;
519 lstrcpynA (strRet->u.cStr, szPath, MAX_PATH);
522 TRACE ("-- (%p)->(%s,0x%08lx)\n", This, szPath, hr);
523 return hr;
526 /**************************************************************************
527 * ISF_Desktop_fnSetNameOf
528 * Changes the name of a file object or subfolder, possibly changing its item
529 * identifier in the process.
531 * PARAMETERS
532 * HWND hwndOwner, //[in ] Owner window for output
533 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
534 * LPCOLESTR lpszName, //[in ] the items new display name
535 * DWORD dwFlags, //[in ] SHGNO formatting flags
536 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
538 static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */
539 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
541 ICOM_THIS (IGenericSFImpl, iface);
543 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
545 return E_FAIL;
548 static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID (IShellFolder2 * iface, GUID * pguid)
550 ICOM_THIS (IGenericSFImpl, iface);
552 FIXME ("(%p)\n", This);
553 return E_NOTIMPL;
555 static HRESULT WINAPI ISF_Desktop_fnEnumSearches (IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
557 ICOM_THIS (IGenericSFImpl, iface);
558 FIXME ("(%p)\n", This);
559 return E_NOTIMPL;
561 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn (IShellFolder2 * iface,
562 DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
564 ICOM_THIS (IGenericSFImpl, iface);
566 TRACE ("(%p)\n", This);
568 if (pSort)
569 *pSort = 0;
570 if (pDisplay)
571 *pDisplay = 0;
573 return S_OK;
575 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState (IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
577 ICOM_THIS (IGenericSFImpl, iface);
579 TRACE ("(%p)\n", This);
581 if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
582 return E_INVALIDARG;
584 *pcsFlags = DesktopSFHeader[iColumn].pcsFlags;
586 return S_OK;
588 static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx (IShellFolder2 * iface,
589 LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
591 ICOM_THIS (IGenericSFImpl, iface);
592 FIXME ("(%p)\n", This);
594 return E_NOTIMPL;
596 static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface,
597 LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
599 ICOM_THIS (IGenericSFImpl, iface);
601 HRESULT hr = E_FAIL;
603 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
605 if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
606 return E_INVALIDARG;
608 if (!pidl) {
609 psd->fmt = DesktopSFHeader[iColumn].fmt;
610 psd->cxChar = DesktopSFHeader[iColumn].cxChar;
611 psd->str.uType = STRRET_CSTR;
612 LoadStringA (shell32_hInstance, DesktopSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
613 return S_OK;
614 } else {
615 /* the data from the pidl */
616 switch (iColumn) {
617 case 0: /* name */
618 hr = IShellFolder_GetDisplayNameOf (iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
619 break;
620 case 1: /* size */
621 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);
622 break;
623 case 2: /* type */
624 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
625 break;
626 case 3: /* date */
627 _ILGetFileDate (pidl, psd->str.u.cStr, MAX_PATH);
628 break;
629 case 4: /* attributes */
630 _ILGetFileAttributes (pidl, psd->str.u.cStr, MAX_PATH);
631 break;
633 hr = S_OK;
634 psd->str.uType = STRRET_CSTR;
637 return hr;
639 static HRESULT WINAPI ISF_Desktop_fnMapNameToSCID (IShellFolder2 * iface, LPCWSTR pwszName, SHCOLUMNID * pscid)
641 ICOM_THIS (IGenericSFImpl, iface);
642 FIXME ("(%p)\n", This);
643 return E_NOTIMPL;
646 static ICOM_VTABLE (IShellFolder2) vt_MCFldr_ShellFolder2 =
648 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
649 ISF_Desktop_fnQueryInterface,
650 ISF_Desktop_fnAddRef,
651 ISF_Desktop_fnRelease,
652 ISF_Desktop_fnParseDisplayName,
653 ISF_Desktop_fnEnumObjects,
654 ISF_Desktop_fnBindToObject,
655 ISF_Desktop_fnBindToStorage,
656 ISF_Desktop_fnCompareIDs,
657 ISF_Desktop_fnCreateViewObject,
658 ISF_Desktop_fnGetAttributesOf,
659 ISF_Desktop_fnGetUIObjectOf,
660 ISF_Desktop_fnGetDisplayNameOf,
661 ISF_Desktop_fnSetNameOf,
662 /* ShellFolder2 */
663 ISF_Desktop_fnGetDefaultSearchGUID,
664 ISF_Desktop_fnEnumSearches,
665 ISF_Desktop_fnGetDefaultColumn,
666 ISF_Desktop_fnGetDefaultColumnState,
667 ISF_Desktop_fnGetDetailsEx,
668 ISF_Desktop_fnGetDetailsOf,
669 ISF_Desktop_fnMapNameToSCID};