Set the dll search path to the location specified in configure
[wine/multimedia.git] / dlls / shell32 / shfldr_desktop.c
blobefafc9bfeb5999eeb5957106a2ace73cabb3c132
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 pbcReserved,
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_OUTOFMEMORY;
202 CLSID clsid;
204 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
205 This, hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
207 *ppidl = 0;
208 if (pchEaten)
209 *pchEaten = 0; /* strange but like the original */
211 if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':') {
212 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
213 TRACE ("-- element: %s\n", debugstr_w (szElement));
214 SHCLSIDFromStringW (szElement + 2, &clsid);
215 pidlTemp = _ILCreate (PT_MYCOMP, &clsid, sizeof (clsid));
216 } else if (PathGetDriveNumberW (lpszDisplayName) >= 0) {
217 /* it's a filesystem path with a drive. Let MyComputer parse it */
218 pidlTemp = _ILCreateMyComputer ();
219 szNext = lpszDisplayName;
220 } else {
221 /* it's a filesystem path on the desktop. Let a FSFolder parse it */
222 WCHAR szCompletePath[MAX_PATH];
224 /* build a complete path to create a simpel pidl */
225 MultiByteToWideChar (CP_ACP, 0, This->sPathTarget, -1, szCompletePath, MAX_PATH);
226 PathAddBackslashW (szCompletePath);
227 lstrcatW (szCompletePath, lpszDisplayName);
228 pidlTemp = SHSimpleIDListFromPathW (lpszDisplayName);
229 szNext = lpszDisplayName;
232 if (pidlTemp) {
233 if (szNext && *szNext) {
234 hr = SHELL32_ParseNextElement (hwndOwner, iface, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
235 } else {
236 hr = S_OK;
237 if (pdwAttributes && *pdwAttributes) {
238 SHELL32_GetItemAttributes (_IShellFolder_ (This), pidlTemp, pdwAttributes);
243 *ppidl = pidlTemp;
245 TRACE ("(%p)->(-- ret=0x%08lx)\n", This, hr);
247 return hr;
250 /**************************************************************************
251 * ISF_Desktop_fnEnumObjects
253 static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
254 HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
256 ICOM_THIS (IGenericSFImpl, iface);
258 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
260 *ppEnumIDList = NULL;
261 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_DESK);
263 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
265 if (!*ppEnumIDList)
266 return E_OUTOFMEMORY;
268 return S_OK;
271 /**************************************************************************
272 * ISF_Desktop_fnBindToObject
274 static HRESULT WINAPI ISF_Desktop_fnBindToObject (IShellFolder2 * iface,
275 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
277 ICOM_THIS (IGenericSFImpl, iface);
279 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
281 return SHELL32_BindToChild (This->pidlRoot, This->sPathTarget, pidl, riid, ppvOut);
284 /**************************************************************************
285 * ISF_Desktop_fnBindToStorage
287 static HRESULT WINAPI ISF_Desktop_fnBindToStorage (IShellFolder2 * iface,
288 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
290 ICOM_THIS (IGenericSFImpl, iface);
292 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
294 *ppvOut = NULL;
295 return E_NOTIMPL;
298 /**************************************************************************
299 * ISF_Desktop_fnCompareIDs
302 static HRESULT WINAPI ISF_Desktop_fnCompareIDs (IShellFolder2 * iface,
303 LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
305 ICOM_THIS (IGenericSFImpl, iface);
307 int nReturn;
309 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
310 nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
311 TRACE ("-- %i\n", nReturn);
312 return nReturn;
315 /**************************************************************************
316 * ISF_Desktop_fnCreateViewObject
318 static HRESULT WINAPI ISF_Desktop_fnCreateViewObject (IShellFolder2 * iface,
319 HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
321 ICOM_THIS (IGenericSFImpl, iface);
323 LPSHELLVIEW pShellView;
324 HRESULT hr = E_INVALIDARG;
326 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This, hwndOwner, shdebugstr_guid (riid), ppvOut);
328 if (ppvOut) {
329 *ppvOut = NULL;
331 if (IsEqualIID (riid, &IID_IDropTarget)) {
332 WARN ("IDropTarget not implemented\n");
333 hr = E_NOTIMPL;
334 } else if (IsEqualIID (riid, &IID_IContextMenu)) {
335 WARN ("IContextMenu not implemented\n");
336 hr = E_NOTIMPL;
337 } else if (IsEqualIID (riid, &IID_IShellView)) {
338 pShellView = IShellView_Constructor ((IShellFolder *) iface);
339 if (pShellView) {
340 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
341 IShellView_Release (pShellView);
345 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
346 return hr;
349 /**************************************************************************
350 * ISF_Desktop_fnGetAttributesOf
352 static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
353 UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
355 ICOM_THIS (IGenericSFImpl, iface);
357 HRESULT hr = S_OK;
359 TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This, cidl, apidl, *rgfInOut);
361 if ((!cidl) || (!apidl) || (!rgfInOut))
362 return E_INVALIDARG;
364 while (cidl > 0 && *apidl) {
365 pdump (*apidl);
366 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
367 apidl++;
368 cidl--;
371 TRACE ("-- result=0x%08lx\n", *rgfInOut);
373 return hr;
376 /**************************************************************************
377 * ISF_Desktop_fnGetUIObjectOf
379 * PARAMETERS
380 * HWND hwndOwner, //[in ] Parent window for any output
381 * UINT cidl, //[in ] array size
382 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
383 * REFIID riid, //[in ] Requested Interface
384 * UINT* prgfInOut, //[ ] reserved
385 * LPVOID* ppvObject) //[out] Resulting Interface
388 static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
389 HWND hwndOwner,
390 UINT cidl,
391 LPCITEMIDLIST * apidl,
392 REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
394 ICOM_THIS (IGenericSFImpl, iface);
396 LPITEMIDLIST pidl;
397 IUnknown *pObj = NULL;
398 HRESULT hr = E_INVALIDARG;
400 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
401 This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
403 if (ppvOut) {
404 *ppvOut = NULL;
406 if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1)) {
407 pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface, This->pidlRoot, apidl, cidl);
408 hr = S_OK;
409 } else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1)) {
410 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl);
411 hr = S_OK;
412 } else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1)) {
413 pidl = ILCombine (This->pidlRoot, apidl[0]);
414 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
415 SHFree (pidl);
416 hr = S_OK;
417 } else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1)) {
418 pidl = ILCombine (This->pidlRoot, apidl[0]);
419 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
420 SHFree (pidl);
421 hr = S_OK;
422 } else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1)) {
423 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
424 } else {
425 hr = E_NOINTERFACE;
428 if (!pObj)
429 hr = E_OUTOFMEMORY;
431 *ppvOut = pObj;
433 TRACE ("(%p)->hr=0x%08lx\n", This, hr);
434 return hr;
437 /**************************************************************************
438 * ISF_Desktop_fnGetDisplayNameOf
440 * NOTES
441 * special case: pidl = null gives desktop-name back
443 DWORD WINAPI __SHGUIDToStringA (REFGUID guid, LPSTR str)
445 CHAR sFormat[52] = "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}";
447 return wsprintfA (str, sFormat,
448 guid->Data1, guid->Data2, guid->Data3,
449 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
450 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
454 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
455 LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
457 ICOM_THIS (IGenericSFImpl, iface);
459 CHAR szPath[MAX_PATH] = "";
460 GUID const *clsid;
461 HRESULT hr = S_OK;
463 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
464 pdump (pidl);
466 if (!strRet)
467 return E_INVALIDARG;
469 if (_ILIsDesktop (pidl)) {
470 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING)) {
471 lstrcpyA (szPath, This->sPathTarget);
472 } else {
473 HCR_GetClassNameA(&CLSID_ShellDesktop, szPath, MAX_PATH);
475 } else if (_ILIsPidlSimple (pidl)) {
476 if ((clsid = _ILGetGUIDPointer (pidl))) {
477 if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING) {
478 int bWantsForParsing;
481 * we can only get a filesystem path from a shellfolder if the value WantsFORPARSING in
482 * CLSID\\{...}\\shellfolder exists
483 * exception: the MyComputer folder has this keys not but like any filesystem backed
484 * folder it needs these behaviour
486 if (IsEqualIID (clsid, &CLSID_MyComputer)) {
487 bWantsForParsing = 1;
488 } else {
489 /* get the "WantsFORPARSING" flag from the registry */
490 char szRegPath[100];
492 lstrcpyA (szRegPath, "CLSID\\");
493 __SHGUIDToStringA (clsid, &szRegPath[6]);
494 lstrcatA (szRegPath, "\\shellfolder");
495 bWantsForParsing =
496 (ERROR_SUCCESS ==
497 SHGetValueA (HKEY_CLASSES_ROOT, szRegPath, "WantsFORPARSING", NULL, NULL, NULL));
500 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && bWantsForParsing) {
501 /* we need the filesystem path to the destination folder. Only the folder itself can know it */
502 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, szPath, MAX_PATH);
503 } else {
504 /* parsing name like ::{...} */
505 lstrcpyA (szPath, "::");
506 __SHGUIDToStringA (clsid, &szPath[2]);
508 } else {
509 /* user friendly name */
510 HCR_GetClassNameA (clsid, szPath, MAX_PATH);
512 } else {
513 /* file system folder */
514 _ILSimpleGetText (pidl, szPath, MAX_PATH);
516 } else {
517 /* a complex pidl, let the subfolder do the work */
518 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, szPath, MAX_PATH);
521 if (SUCCEEDED (hr)) {
522 strRet->uType = STRRET_CSTR;
523 lstrcpynA (strRet->u.cStr, szPath, MAX_PATH);
526 TRACE ("-- (%p)->(%s,0x%08lx)\n", This, szPath, hr);
527 return hr;
530 /**************************************************************************
531 * ISF_Desktop_fnSetNameOf
532 * Changes the name of a file object or subfolder, possibly changing its item
533 * identifier in the process.
535 * PARAMETERS
536 * HWND hwndOwner, //[in ] Owner window for output
537 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
538 * LPCOLESTR lpszName, //[in ] the items new display name
539 * DWORD dwFlags, //[in ] SHGNO formatting flags
540 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
542 static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */
543 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
545 ICOM_THIS (IGenericSFImpl, iface);
547 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
549 return E_FAIL;
552 static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID (IShellFolder2 * iface, GUID * pguid)
554 ICOM_THIS (IGenericSFImpl, iface);
556 FIXME ("(%p)\n", This);
557 return E_NOTIMPL;
559 static HRESULT WINAPI ISF_Desktop_fnEnumSearches (IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
561 ICOM_THIS (IGenericSFImpl, iface);
562 FIXME ("(%p)\n", This);
563 return E_NOTIMPL;
565 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn (IShellFolder2 * iface,
566 DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
568 ICOM_THIS (IGenericSFImpl, iface);
570 TRACE ("(%p)\n", This);
572 if (pSort)
573 *pSort = 0;
574 if (pDisplay)
575 *pDisplay = 0;
577 return S_OK;
579 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState (IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
581 ICOM_THIS (IGenericSFImpl, iface);
583 TRACE ("(%p)\n", This);
585 if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
586 return E_INVALIDARG;
588 *pcsFlags = DesktopSFHeader[iColumn].pcsFlags;
590 return S_OK;
592 static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx (IShellFolder2 * iface,
593 LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
595 ICOM_THIS (IGenericSFImpl, iface);
596 FIXME ("(%p)\n", This);
598 return E_NOTIMPL;
600 static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface,
601 LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
603 ICOM_THIS (IGenericSFImpl, iface);
605 HRESULT hr = E_FAIL;
607 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
609 if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
610 return E_INVALIDARG;
612 if (!pidl) {
613 psd->fmt = DesktopSFHeader[iColumn].fmt;
614 psd->cxChar = DesktopSFHeader[iColumn].cxChar;
615 psd->str.uType = STRRET_CSTR;
616 LoadStringA (shell32_hInstance, DesktopSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
617 return S_OK;
618 } else {
619 /* the data from the pidl */
620 switch (iColumn) {
621 case 0: /* name */
622 hr = IShellFolder_GetDisplayNameOf (iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
623 break;
624 case 1: /* size */
625 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);
626 break;
627 case 2: /* type */
628 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
629 break;
630 case 3: /* date */
631 _ILGetFileDate (pidl, psd->str.u.cStr, MAX_PATH);
632 break;
633 case 4: /* attributes */
634 _ILGetFileAttributes (pidl, psd->str.u.cStr, MAX_PATH);
635 break;
637 hr = S_OK;
638 psd->str.uType = STRRET_CSTR;
641 return hr;
643 static HRESULT WINAPI ISF_Desktop_fnMapColumnToSCID (IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
645 ICOM_THIS (IGenericSFImpl, iface);
646 FIXME ("(%p)\n", This);
647 return E_NOTIMPL;
650 static ICOM_VTABLE (IShellFolder2) vt_MCFldr_ShellFolder2 =
652 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
653 ISF_Desktop_fnQueryInterface,
654 ISF_Desktop_fnAddRef,
655 ISF_Desktop_fnRelease,
656 ISF_Desktop_fnParseDisplayName,
657 ISF_Desktop_fnEnumObjects,
658 ISF_Desktop_fnBindToObject,
659 ISF_Desktop_fnBindToStorage,
660 ISF_Desktop_fnCompareIDs,
661 ISF_Desktop_fnCreateViewObject,
662 ISF_Desktop_fnGetAttributesOf,
663 ISF_Desktop_fnGetUIObjectOf,
664 ISF_Desktop_fnGetDisplayNameOf,
665 ISF_Desktop_fnSetNameOf,
666 /* ShellFolder2 */
667 ISF_Desktop_fnGetDefaultSearchGUID,
668 ISF_Desktop_fnEnumSearches,
669 ISF_Desktop_fnGetDefaultColumn,
670 ISF_Desktop_fnGetDefaultColumnState,
671 ISF_Desktop_fnGetDetailsEx,
672 ISF_Desktop_fnGetDetailsOf,
673 ISF_Desktop_fnMapColumnToSCID};