Fixed header dependencies to be fully compatible with the Windows
[wine/multimedia.git] / dlls / shell32 / shfldr_desktop.c
blob5fbd311b43ccd7f6cd50d53ac4a63b61d5171a9c
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"
39 #include "ole2.h"
40 #include "shlguid.h"
42 #include "pidl.h"
43 #include "undocshell.h"
44 #include "shell32_main.h"
45 #include "shresdef.h"
46 #include "shlwapi.h"
47 #include "shellfolder.h"
48 #include "wine/debug.h"
49 #include "debughlp.h"
50 #include "shfldr.h"
52 WINE_DEFAULT_DEBUG_CHANNEL (shell);
54 /***********************************************************************
55 * Desktopfolder implementation
58 typedef struct {
59 ICOM_VFIELD (IShellFolder2);
60 DWORD ref;
62 CLSID *pclsid;
64 /* both paths are parsible from the desktop */
65 LPSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
66 LPITEMIDLIST pidlRoot; /* absolute pidl */
68 int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */
70 UINT cfShellIDList; /* clipboardformat for IDropTarget */
71 BOOL fAcceptFmt; /* flag for pending Drop */
72 } IGenericSFImpl;
74 #define _IUnknown_(This) (IShellFolder*)&(This->lpVtbl)
75 #define _IShellFolder_(This) (IShellFolder*)&(This->lpVtbl)
77 HRESULT WINAPI ISF_MyComputer_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
79 static struct ICOM_VTABLE (IShellFolder2) 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 ICOM_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 ICOM_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 ICOM_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 pbcReserved,
192 LPOLESTR lpszDisplayName,
193 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
195 ICOM_THIS (IGenericSFImpl, iface);
197 WCHAR szElement[MAX_PATH];
198 LPCWSTR szNext = NULL;
199 LPITEMIDLIST pidlTemp = NULL;
200 HRESULT hr = E_OUTOFMEMORY;
201 CLSID clsid;
203 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
204 This, hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
206 *ppidl = 0;
207 if (pchEaten)
208 *pchEaten = 0; /* strange but like the original */
210 if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':') {
211 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
212 TRACE ("-- element: %s\n", debugstr_w (szElement));
213 SHCLSIDFromStringW (szElement + 2, &clsid);
214 pidlTemp = _ILCreate (PT_MYCOMP, &clsid, sizeof (clsid));
215 } else if (PathGetDriveNumberW (lpszDisplayName) >= 0) {
216 /* it's a filesystem path with a drive. Let MyComputer parse it */
217 pidlTemp = _ILCreateMyComputer ();
218 szNext = lpszDisplayName;
219 } else {
220 /* it's a filesystem path on the desktop. Let a FSFolder parse it */
221 WCHAR szCompletePath[MAX_PATH];
223 /* build a complete path to create a simpel pidl */
224 MultiByteToWideChar (CP_ACP, 0, This->sPathTarget, -1, szCompletePath, MAX_PATH);
225 PathAddBackslashW (szCompletePath);
226 lstrcatW (szCompletePath, lpszDisplayName);
227 pidlTemp = SHSimpleIDListFromPathW (lpszDisplayName);
228 szNext = lpszDisplayName;
231 if (pidlTemp) {
232 if (szNext && *szNext) {
233 hr = SHELL32_ParseNextElement (hwndOwner, iface, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
234 } else {
235 hr = S_OK;
236 if (pdwAttributes && *pdwAttributes) {
237 SHELL32_GetItemAttributes (_IShellFolder_ (This), pidlTemp, pdwAttributes);
242 *ppidl = pidlTemp;
244 TRACE ("(%p)->(-- ret=0x%08lx)\n", This, hr);
246 return hr;
249 /**************************************************************************
250 * ISF_Desktop_fnEnumObjects
252 static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
253 HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
255 ICOM_THIS (IGenericSFImpl, iface);
257 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
259 *ppEnumIDList = NULL;
260 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_DESK);
262 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
264 if (!*ppEnumIDList)
265 return E_OUTOFMEMORY;
267 return S_OK;
270 /**************************************************************************
271 * ISF_Desktop_fnBindToObject
273 static HRESULT WINAPI ISF_Desktop_fnBindToObject (IShellFolder2 * iface,
274 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
276 ICOM_THIS (IGenericSFImpl, iface);
278 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
280 return SHELL32_BindToChild (This->pidlRoot, This->sPathTarget, pidl, riid, ppvOut);
283 /**************************************************************************
284 * ISF_Desktop_fnBindToStorage
286 static HRESULT WINAPI ISF_Desktop_fnBindToStorage (IShellFolder2 * iface,
287 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
289 ICOM_THIS (IGenericSFImpl, iface);
291 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
293 *ppvOut = NULL;
294 return E_NOTIMPL;
297 /**************************************************************************
298 * ISF_Desktop_fnCompareIDs
301 static HRESULT WINAPI ISF_Desktop_fnCompareIDs (IShellFolder2 * iface,
302 LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
304 ICOM_THIS (IGenericSFImpl, iface);
306 int nReturn;
308 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
309 nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
310 TRACE ("-- %i\n", nReturn);
311 return nReturn;
314 /**************************************************************************
315 * ISF_Desktop_fnCreateViewObject
317 static HRESULT WINAPI ISF_Desktop_fnCreateViewObject (IShellFolder2 * iface,
318 HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
320 ICOM_THIS (IGenericSFImpl, iface);
322 LPSHELLVIEW pShellView;
323 HRESULT hr = E_INVALIDARG;
325 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This, hwndOwner, shdebugstr_guid (riid), ppvOut);
327 if (ppvOut) {
328 *ppvOut = NULL;
330 if (IsEqualIID (riid, &IID_IDropTarget)) {
331 WARN ("IDropTarget not implemented\n");
332 hr = E_NOTIMPL;
333 } else if (IsEqualIID (riid, &IID_IContextMenu)) {
334 WARN ("IContextMenu not implemented\n");
335 hr = E_NOTIMPL;
336 } else if (IsEqualIID (riid, &IID_IShellView)) {
337 pShellView = IShellView_Constructor ((IShellFolder *) iface);
338 if (pShellView) {
339 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
340 IShellView_Release (pShellView);
344 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
345 return hr;
348 /**************************************************************************
349 * ISF_Desktop_fnGetAttributesOf
351 static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
352 UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
354 ICOM_THIS (IGenericSFImpl, iface);
356 HRESULT hr = S_OK;
358 TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This, cidl, apidl, *rgfInOut);
360 if ((!cidl) || (!apidl) || (!rgfInOut))
361 return E_INVALIDARG;
363 while (cidl > 0 && *apidl) {
364 pdump (*apidl);
365 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
366 apidl++;
367 cidl--;
370 TRACE ("-- result=0x%08lx\n", *rgfInOut);
372 return hr;
375 /**************************************************************************
376 * ISF_Desktop_fnGetUIObjectOf
378 * PARAMETERS
379 * HWND hwndOwner, //[in ] Parent window for any output
380 * UINT cidl, //[in ] array size
381 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
382 * REFIID riid, //[in ] Requested Interface
383 * UINT* prgfInOut, //[ ] reserved
384 * LPVOID* ppvObject) //[out] Resulting Interface
387 static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
388 HWND hwndOwner,
389 UINT cidl,
390 LPCITEMIDLIST * apidl,
391 REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
393 ICOM_THIS (IGenericSFImpl, iface);
395 LPITEMIDLIST pidl;
396 IUnknown *pObj = NULL;
397 HRESULT hr = E_INVALIDARG;
399 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
400 This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
402 if (ppvOut) {
403 *ppvOut = NULL;
405 if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1)) {
406 pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface, This->pidlRoot, apidl, cidl);
407 hr = S_OK;
408 } else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1)) {
409 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl);
410 hr = S_OK;
411 } else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1)) {
412 pidl = ILCombine (This->pidlRoot, apidl[0]);
413 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
414 SHFree (pidl);
415 hr = S_OK;
416 } else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1)) {
417 pidl = ILCombine (This->pidlRoot, apidl[0]);
418 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
419 SHFree (pidl);
420 hr = S_OK;
421 } else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1)) {
422 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
423 } else {
424 hr = E_NOINTERFACE;
427 if (!pObj)
428 hr = E_OUTOFMEMORY;
430 *ppvOut = pObj;
432 TRACE ("(%p)->hr=0x%08lx\n", This, hr);
433 return hr;
436 /**************************************************************************
437 * ISF_Desktop_fnGetDisplayNameOf
439 * NOTES
440 * special case: pidl = null gives desktop-name back
442 DWORD WINAPI __SHGUIDToStringA (REFGUID guid, LPSTR str)
444 CHAR sFormat[52] = "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}";
446 return wsprintfA (str, sFormat,
447 guid->Data1, guid->Data2, guid->Data3,
448 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
449 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
453 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
454 LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
456 ICOM_THIS (IGenericSFImpl, iface);
458 CHAR szPath[MAX_PATH] = "";
459 GUID const *clsid;
460 HRESULT hr = S_OK;
462 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
463 pdump (pidl);
465 if (!strRet)
466 return E_INVALIDARG;
468 if (_ILIsDesktop (pidl)) {
469 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING)) {
470 lstrcpyA (szPath, This->sPathTarget);
471 } else {
472 HCR_GetClassNameA(&CLSID_ShellDesktop, szPath, MAX_PATH);
474 } else if (_ILIsPidlSimple (pidl)) {
475 if ((clsid = _ILGetGUIDPointer (pidl))) {
476 if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING) {
477 int bWantsForParsing;
480 * we can only get a filesystem path from a shellfolder if the value WantsFORPARSING in
481 * CLSID\\{...}\\shellfolder exists
482 * exception: the MyComputer folder has this keys not but like any filesystem backed
483 * folder it needs these behaviour
485 if (IsEqualIID (clsid, &CLSID_MyComputer)) {
486 bWantsForParsing = 1;
487 } else {
488 /* get the "WantsFORPARSING" flag from the registry */
489 char szRegPath[100];
491 lstrcpyA (szRegPath, "CLSID\\");
492 __SHGUIDToStringA (clsid, &szRegPath[6]);
493 lstrcatA (szRegPath, "\\shellfolder");
494 bWantsForParsing =
495 (ERROR_SUCCESS ==
496 SHGetValueA (HKEY_CLASSES_ROOT, szRegPath, "WantsFORPARSING", NULL, NULL, NULL));
499 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && bWantsForParsing) {
500 /* we need the filesystem path to the destination folder. Only the folder itself can know it */
501 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, szPath, MAX_PATH);
502 } else {
503 /* parsing name like ::{...} */
504 lstrcpyA (szPath, "::");
505 __SHGUIDToStringA (clsid, &szPath[2]);
507 } else {
508 /* user friendly name */
509 HCR_GetClassNameA (clsid, szPath, MAX_PATH);
511 } else {
512 /* file system folder */
513 _ILSimpleGetText (pidl, szPath, MAX_PATH);
515 } else {
516 /* a complex pidl, let the subfolder do the work */
517 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, szPath, MAX_PATH);
520 if (SUCCEEDED (hr)) {
521 strRet->uType = STRRET_CSTR;
522 lstrcpynA (strRet->u.cStr, szPath, MAX_PATH);
525 TRACE ("-- (%p)->(%s,0x%08lx)\n", This, szPath, hr);
526 return hr;
529 /**************************************************************************
530 * ISF_Desktop_fnSetNameOf
531 * Changes the name of a file object or subfolder, possibly changing its item
532 * identifier in the process.
534 * PARAMETERS
535 * HWND hwndOwner, //[in ] Owner window for output
536 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
537 * LPCOLESTR lpszName, //[in ] the items new display name
538 * DWORD dwFlags, //[in ] SHGNO formatting flags
539 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
541 static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */
542 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
544 ICOM_THIS (IGenericSFImpl, iface);
546 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
548 return E_FAIL;
551 static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID (IShellFolder2 * iface, GUID * pguid)
553 ICOM_THIS (IGenericSFImpl, iface);
555 FIXME ("(%p)\n", This);
556 return E_NOTIMPL;
558 static HRESULT WINAPI ISF_Desktop_fnEnumSearches (IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
560 ICOM_THIS (IGenericSFImpl, iface);
561 FIXME ("(%p)\n", This);
562 return E_NOTIMPL;
564 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn (IShellFolder2 * iface,
565 DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
567 ICOM_THIS (IGenericSFImpl, iface);
569 TRACE ("(%p)\n", This);
571 if (pSort)
572 *pSort = 0;
573 if (pDisplay)
574 *pDisplay = 0;
576 return S_OK;
578 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState (IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
580 ICOM_THIS (IGenericSFImpl, iface);
582 TRACE ("(%p)\n", This);
584 if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
585 return E_INVALIDARG;
587 *pcsFlags = DesktopSFHeader[iColumn].pcsFlags;
589 return S_OK;
591 static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx (IShellFolder2 * iface,
592 LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
594 ICOM_THIS (IGenericSFImpl, iface);
595 FIXME ("(%p)\n", This);
597 return E_NOTIMPL;
599 static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface,
600 LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
602 ICOM_THIS (IGenericSFImpl, iface);
604 HRESULT hr = E_FAIL;
606 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
608 if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
609 return E_INVALIDARG;
611 if (!pidl) {
612 psd->fmt = DesktopSFHeader[iColumn].fmt;
613 psd->cxChar = DesktopSFHeader[iColumn].cxChar;
614 psd->str.uType = STRRET_CSTR;
615 LoadStringA (shell32_hInstance, DesktopSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
616 return S_OK;
617 } else {
618 /* the data from the pidl */
619 switch (iColumn) {
620 case 0: /* name */
621 hr = IShellFolder_GetDisplayNameOf (iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
622 break;
623 case 1: /* size */
624 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);
625 break;
626 case 2: /* type */
627 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
628 break;
629 case 3: /* date */
630 _ILGetFileDate (pidl, psd->str.u.cStr, MAX_PATH);
631 break;
632 case 4: /* attributes */
633 _ILGetFileAttributes (pidl, psd->str.u.cStr, MAX_PATH);
634 break;
636 hr = S_OK;
637 psd->str.uType = STRRET_CSTR;
640 return hr;
642 static HRESULT WINAPI ISF_Desktop_fnMapColumnToSCID (IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
644 ICOM_THIS (IGenericSFImpl, iface);
645 FIXME ("(%p)\n", This);
646 return E_NOTIMPL;
649 static ICOM_VTABLE (IShellFolder2) vt_MCFldr_ShellFolder2 =
651 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
652 ISF_Desktop_fnQueryInterface,
653 ISF_Desktop_fnAddRef,
654 ISF_Desktop_fnRelease,
655 ISF_Desktop_fnParseDisplayName,
656 ISF_Desktop_fnEnumObjects,
657 ISF_Desktop_fnBindToObject,
658 ISF_Desktop_fnBindToStorage,
659 ISF_Desktop_fnCompareIDs,
660 ISF_Desktop_fnCreateViewObject,
661 ISF_Desktop_fnGetAttributesOf,
662 ISF_Desktop_fnGetUIObjectOf,
663 ISF_Desktop_fnGetDisplayNameOf,
664 ISF_Desktop_fnSetNameOf,
665 /* ShellFolder2 */
666 ISF_Desktop_fnGetDefaultSearchGUID,
667 ISF_Desktop_fnEnumSearches,
668 ISF_Desktop_fnGetDefaultColumn,
669 ISF_Desktop_fnGetDefaultColumnState,
670 ISF_Desktop_fnGetDetailsEx,
671 ISF_Desktop_fnGetDetailsOf,
672 ISF_Desktop_fnMapColumnToSCID};