Added Unicode versions of the HCR_ internal functions.
[wine/wine-kai.git] / dlls / shell32 / shfldr_desktop.c
blobbddc891470bf6955040e641168210794c895348e
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 #include "winerror.h"
31 #include "winbase.h"
32 #include "winreg.h"
34 #include "ole2.h"
35 #include "shlguid.h"
37 #include "pidl.h"
38 #include "undocshell.h"
39 #include "shell32_main.h"
40 #include "shresdef.h"
41 #include "shlwapi.h"
42 #include "shellfolder.h"
43 #include "wine/debug.h"
44 #include "debughlp.h"
45 #include "shfldr.h"
47 WINE_DEFAULT_DEBUG_CHANNEL (shell);
49 /***********************************************************************
50 * Desktopfolder implementation
53 typedef struct {
54 ICOM_VFIELD (IShellFolder2);
55 DWORD ref;
57 CLSID *pclsid;
59 /* both paths are parsible from the desktop */
60 LPSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
61 LPITEMIDLIST pidlRoot; /* absolute pidl */
63 int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */
65 UINT cfShellIDList; /* clipboardformat for IDropTarget */
66 BOOL fAcceptFmt; /* flag for pending Drop */
67 } IGenericSFImpl;
69 #define _IUnknown_(This) (IShellFolder*)&(This->lpVtbl)
70 #define _IShellFolder_(This) (IShellFolder*)&(This->lpVtbl)
72 HRESULT WINAPI ISF_MyComputer_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
74 static struct ICOM_VTABLE (IShellFolder2) vt_MCFldr_ShellFolder2;
76 static shvheader DesktopSFHeader[] = {
77 {IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
78 {IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
79 {IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
80 {IDS_SHV_COLUMN4, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12},
81 {IDS_SHV_COLUMN5, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5}
84 #define DESKTOPSHELLVIEWCOLUMNS 5
86 /**************************************************************************
87 * ISF_Desktop_Constructor
89 HRESULT WINAPI ISF_Desktop_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
91 IGenericSFImpl *sf;
92 char szMyPath[MAX_PATH];
94 TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
96 if (!ppv)
97 return E_POINTER;
98 if (pUnkOuter)
99 return CLASS_E_NOAGGREGATION;
101 if (!SHGetSpecialFolderPathA (0, szMyPath, CSIDL_DESKTOPDIRECTORY, TRUE))
102 return E_UNEXPECTED;
104 sf = (IGenericSFImpl *) LocalAlloc (GMEM_ZEROINIT, sizeof (IGenericSFImpl));
105 if (!sf)
106 return E_OUTOFMEMORY;
108 sf->ref = 0;
109 ICOM_VTBL (sf) = &vt_MCFldr_ShellFolder2;
110 sf->pidlRoot = _ILCreateDesktop (); /* my qualified pidl */
111 sf->sPathTarget = SHAlloc (strlen (szMyPath) + 1);
112 lstrcpyA (sf->sPathTarget, szMyPath);
114 if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv))) {
115 IUnknown_Release (_IUnknown_ (sf));
116 return E_NOINTERFACE;
119 TRACE ("--(%p)\n", sf);
120 return S_OK;
123 /**************************************************************************
124 * ISF_Desktop_fnQueryInterface
126 * NOTES supports not IPersist/IPersistFolder
128 static HRESULT WINAPI ISF_Desktop_fnQueryInterface (IShellFolder2 * iface, REFIID riid, LPVOID * ppvObj)
130 ICOM_THIS (IGenericSFImpl, iface);
132 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
134 *ppvObj = NULL;
136 if (IsEqualIID (riid, &IID_IUnknown) || IsEqualIID (riid, &IID_IShellFolder)
137 || IsEqualIID (riid, &IID_IShellFolder2)) {
138 *ppvObj = This;
141 if (*ppvObj) {
142 IUnknown_AddRef ((IUnknown *) (*ppvObj));
143 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
144 return S_OK;
146 TRACE ("-- Interface: E_NOINTERFACE\n");
147 return E_NOINTERFACE;
150 static ULONG WINAPI ISF_Desktop_fnAddRef (IShellFolder2 * iface)
152 ICOM_THIS (IGenericSFImpl, iface);
154 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
156 return ++(This->ref);
159 static ULONG WINAPI ISF_Desktop_fnRelease (IShellFolder2 * iface)
161 ICOM_THIS (IGenericSFImpl, iface);
163 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
165 if (!--(This->ref)) {
166 TRACE ("-- destroying IShellFolder(%p)\n", This);
167 if (This->pidlRoot)
168 SHFree (This->pidlRoot);
169 if (This->sPathTarget)
170 SHFree (This->sPathTarget);
171 LocalFree ((HLOCAL) This);
172 return 0;
174 return This->ref;
177 /**************************************************************************
178 * ISF_Desktop_fnParseDisplayName
180 * NOTES
181 * "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds
182 * to MyComputer
184 static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
185 HWND hwndOwner,
186 LPBC pbcReserved,
187 LPOLESTR lpszDisplayName,
188 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
190 ICOM_THIS (IGenericSFImpl, iface);
192 WCHAR szElement[MAX_PATH];
193 LPCWSTR szNext = NULL;
194 LPITEMIDLIST pidlTemp = NULL;
195 HRESULT hr = E_OUTOFMEMORY;
196 CLSID clsid;
198 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
199 This, hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
201 *ppidl = 0;
202 if (pchEaten)
203 *pchEaten = 0; /* strange but like the original */
205 if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':') {
206 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
207 TRACE ("-- element: %s\n", debugstr_w (szElement));
208 CLSIDFromString (szElement + 2, &clsid);
209 pidlTemp = _ILCreate (PT_MYCOMP, &clsid, sizeof (clsid));
210 } else if (PathGetDriveNumberW (lpszDisplayName) >= 0) {
211 /* it's a filesystem path with a drive. Let MyComputer parse it */
212 pidlTemp = _ILCreateMyComputer ();
213 szNext = lpszDisplayName;
214 } else {
215 /* it's a filesystem path on the desktop. Let a FSFolder parse it */
216 WCHAR szCompletePath[MAX_PATH];
218 /* build a complete path to create a simpel pidl */
219 MultiByteToWideChar (CP_ACP, 0, This->sPathTarget, -1, szCompletePath, MAX_PATH);
220 PathAddBackslashW (szCompletePath);
221 lstrcatW (szCompletePath, lpszDisplayName);
222 pidlTemp = SHSimpleIDListFromPathW (lpszDisplayName);
223 szNext = lpszDisplayName;
226 if (pidlTemp) {
227 if (szNext && *szNext) {
228 hr = SHELL32_ParseNextElement (hwndOwner, iface, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
229 } else {
230 hr = S_OK;
231 if (pdwAttributes && *pdwAttributes) {
232 SHELL32_GetItemAttributes (_IShellFolder_ (This), pidlTemp, pdwAttributes);
237 *ppidl = pidlTemp;
239 TRACE ("(%p)->(-- ret=0x%08lx)\n", This, hr);
241 return hr;
244 /**************************************************************************
245 * ISF_Desktop_fnEnumObjects
247 static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
248 HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
250 ICOM_THIS (IGenericSFImpl, iface);
252 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
254 *ppEnumIDList = NULL;
255 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_DESK);
257 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
259 if (!*ppEnumIDList)
260 return E_OUTOFMEMORY;
262 return S_OK;
265 /**************************************************************************
266 * ISF_Desktop_fnBindToObject
268 static HRESULT WINAPI ISF_Desktop_fnBindToObject (IShellFolder2 * iface,
269 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
271 ICOM_THIS (IGenericSFImpl, iface);
273 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
275 return SHELL32_BindToChild (This->pidlRoot, This->sPathTarget, pidl, riid, ppvOut);
278 /**************************************************************************
279 * ISF_Desktop_fnBindToStorage
281 static HRESULT WINAPI ISF_Desktop_fnBindToStorage (IShellFolder2 * iface,
282 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
284 ICOM_THIS (IGenericSFImpl, iface);
286 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
288 *ppvOut = NULL;
289 return E_NOTIMPL;
292 /**************************************************************************
293 * ISF_Desktop_fnCompareIDs
296 static HRESULT WINAPI ISF_Desktop_fnCompareIDs (IShellFolder2 * iface,
297 LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
299 ICOM_THIS (IGenericSFImpl, iface);
301 int nReturn;
303 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
304 nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
305 TRACE ("-- %i\n", nReturn);
306 return nReturn;
309 /**************************************************************************
310 * ISF_Desktop_fnCreateViewObject
312 static HRESULT WINAPI ISF_Desktop_fnCreateViewObject (IShellFolder2 * iface,
313 HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
315 ICOM_THIS (IGenericSFImpl, iface);
317 LPSHELLVIEW pShellView;
318 HRESULT hr = E_INVALIDARG;
320 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This, hwndOwner, shdebugstr_guid (riid), ppvOut);
322 if (ppvOut) {
323 *ppvOut = NULL;
325 if (IsEqualIID (riid, &IID_IDropTarget)) {
326 WARN ("IDropTarget not implemented\n");
327 hr = E_NOTIMPL;
328 } else if (IsEqualIID (riid, &IID_IContextMenu)) {
329 WARN ("IContextMenu not implemented\n");
330 hr = E_NOTIMPL;
331 } else if (IsEqualIID (riid, &IID_IShellView)) {
332 pShellView = IShellView_Constructor ((IShellFolder *) iface);
333 if (pShellView) {
334 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
335 IShellView_Release (pShellView);
339 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
340 return hr;
343 /**************************************************************************
344 * ISF_Desktop_fnGetAttributesOf
346 static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
347 UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
349 ICOM_THIS (IGenericSFImpl, iface);
351 HRESULT hr = S_OK;
353 TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This, cidl, apidl, *rgfInOut);
355 if ((!cidl) || (!apidl) || (!rgfInOut))
356 return E_INVALIDARG;
358 while (cidl > 0 && *apidl) {
359 pdump (*apidl);
360 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
361 apidl++;
362 cidl--;
365 TRACE ("-- result=0x%08lx\n", *rgfInOut);
367 return hr;
370 /**************************************************************************
371 * ISF_Desktop_fnGetUIObjectOf
373 * PARAMETERS
374 * HWND hwndOwner, //[in ] Parent window for any output
375 * UINT cidl, //[in ] array size
376 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
377 * REFIID riid, //[in ] Requested Interface
378 * UINT* prgfInOut, //[ ] reserved
379 * LPVOID* ppvObject) //[out] Resulting Interface
382 static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
383 HWND hwndOwner,
384 UINT cidl,
385 LPCITEMIDLIST * apidl,
386 REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
388 ICOM_THIS (IGenericSFImpl, iface);
390 LPITEMIDLIST pidl;
391 IUnknown *pObj = NULL;
392 HRESULT hr = E_INVALIDARG;
394 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
395 This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
397 if (ppvOut) {
398 *ppvOut = NULL;
400 if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1)) {
401 pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface, This->pidlRoot, apidl, cidl);
402 hr = S_OK;
403 } else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1)) {
404 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl);
405 hr = S_OK;
406 } else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1)) {
407 pidl = ILCombine (This->pidlRoot, apidl[0]);
408 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
409 SHFree (pidl);
410 hr = S_OK;
411 } else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1)) {
412 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
413 } else {
414 hr = E_NOINTERFACE;
417 if (!pObj)
418 hr = E_OUTOFMEMORY;
420 *ppvOut = pObj;
422 TRACE ("(%p)->hr=0x%08lx\n", This, hr);
423 return hr;
426 /**************************************************************************
427 * ISF_Desktop_fnGetDisplayNameOf
429 * NOTES
430 * special case: pidl = null gives desktop-name back
432 DWORD WINAPI __SHGUIDToStringA (REFGUID guid, LPSTR str)
434 CHAR sFormat[52] = "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}";
436 return wsprintfA (str, sFormat,
437 guid->Data1, guid->Data2, guid->Data3,
438 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
439 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
443 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
444 LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
446 ICOM_THIS (IGenericSFImpl, iface);
448 CHAR szPath[MAX_PATH] = "";
449 GUID const *clsid;
450 HRESULT hr = S_OK;
452 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
453 pdump (pidl);
455 if (!strRet)
456 return E_INVALIDARG;
458 if (_ILIsDesktop (pidl)) {
459 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING)) {
460 lstrcpyA (szPath, This->sPathTarget);
461 } else {
462 HCR_GetClassNameA(&CLSID_ShellDesktop, szPath, MAX_PATH);
464 } else if (_ILIsPidlSimple (pidl)) {
465 if ((clsid = _ILGetGUIDPointer (pidl))) {
466 if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING) {
467 int bWantsForParsing;
470 * we can only get a filesystem path from a shellfolder if the value WantsFORPARSING in
471 * CLSID\\{...}\\shellfolder exists
472 * exception: the MyComputer folder has this keys not but like any filesystem backed
473 * folder it needs these behaviour
475 if (IsEqualIID (clsid, &CLSID_MyComputer)) {
476 bWantsForParsing = 1;
477 } else {
478 /* get the "WantsFORPARSING" flag from the registry */
479 char szRegPath[100];
481 lstrcpyA (szRegPath, "CLSID\\");
482 __SHGUIDToStringA (clsid, &szRegPath[6]);
483 lstrcatA (szRegPath, "\\shellfolder");
484 bWantsForParsing =
485 (ERROR_SUCCESS ==
486 SHGetValueA (HKEY_CLASSES_ROOT, szRegPath, "WantsFORPARSING", NULL, NULL, NULL));
489 if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && bWantsForParsing) {
490 /* we need the filesystem path to the destination folder. Only the folder itself can know it */
491 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, szPath, MAX_PATH);
492 } else {
493 /* parsing name like ::{...} */
494 lstrcpyA (szPath, "::");
495 __SHGUIDToStringA (clsid, &szPath[2]);
497 } else {
498 /* user friendly name */
499 HCR_GetClassNameA (clsid, szPath, MAX_PATH);
501 } else {
502 /* file system folder */
503 _ILSimpleGetText (pidl, szPath, MAX_PATH);
505 } else {
506 /* a complex pidl, let the subfolder do the work */
507 hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags, szPath, MAX_PATH);
510 if (SUCCEEDED (hr)) {
511 strRet->uType = STRRET_CSTR;
512 lstrcpynA (strRet->u.cStr, szPath, MAX_PATH);
515 TRACE ("-- (%p)->(%s,0x%08lx)\n", This, szPath, hr);
516 return hr;
519 /**************************************************************************
520 * ISF_Desktop_fnSetNameOf
521 * Changes the name of a file object or subfolder, possibly changing its item
522 * identifier in the process.
524 * PARAMETERS
525 * HWND hwndOwner, //[in ] Owner window for output
526 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
527 * LPCOLESTR lpszName, //[in ] the items new display name
528 * DWORD dwFlags, //[in ] SHGNO formatting flags
529 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
531 static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */
532 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
534 ICOM_THIS (IGenericSFImpl, iface);
536 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
538 return E_FAIL;
541 static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID (IShellFolder2 * iface, GUID * pguid)
543 ICOM_THIS (IGenericSFImpl, iface);
545 FIXME ("(%p)\n", This);
546 return E_NOTIMPL;
548 static HRESULT WINAPI ISF_Desktop_fnEnumSearches (IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
550 ICOM_THIS (IGenericSFImpl, iface);
551 FIXME ("(%p)\n", This);
552 return E_NOTIMPL;
554 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn (IShellFolder2 * iface,
555 DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
557 ICOM_THIS (IGenericSFImpl, iface);
559 TRACE ("(%p)\n", This);
561 if (pSort)
562 *pSort = 0;
563 if (pDisplay)
564 *pDisplay = 0;
566 return S_OK;
568 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState (IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
570 ICOM_THIS (IGenericSFImpl, iface);
572 TRACE ("(%p)\n", This);
574 if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
575 return E_INVALIDARG;
577 *pcsFlags = DesktopSFHeader[iColumn].pcsFlags;
579 return S_OK;
581 static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx (IShellFolder2 * iface,
582 LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
584 ICOM_THIS (IGenericSFImpl, iface);
585 FIXME ("(%p)\n", This);
587 return E_NOTIMPL;
589 static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface,
590 LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
592 ICOM_THIS (IGenericSFImpl, iface);
594 HRESULT hr = E_FAIL;
596 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
598 if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
599 return E_INVALIDARG;
601 if (!pidl) {
602 psd->fmt = DesktopSFHeader[iColumn].fmt;
603 psd->cxChar = DesktopSFHeader[iColumn].cxChar;
604 psd->str.uType = STRRET_CSTR;
605 LoadStringA (shell32_hInstance, DesktopSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
606 return S_OK;
607 } else {
608 /* the data from the pidl */
609 switch (iColumn) {
610 case 0: /* name */
611 hr = IShellFolder_GetDisplayNameOf (iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
612 break;
613 case 1: /* size */
614 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);
615 break;
616 case 2: /* type */
617 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
618 break;
619 case 3: /* date */
620 _ILGetFileDate (pidl, psd->str.u.cStr, MAX_PATH);
621 break;
622 case 4: /* attributes */
623 _ILGetFileAttributes (pidl, psd->str.u.cStr, MAX_PATH);
624 break;
626 hr = S_OK;
627 psd->str.uType = STRRET_CSTR;
630 return hr;
632 static HRESULT WINAPI ISF_Desktop_fnMapNameToSCID (IShellFolder2 * iface, LPCWSTR pwszName, SHCOLUMNID * pscid)
634 ICOM_THIS (IGenericSFImpl, iface);
635 FIXME ("(%p)\n", This);
636 return E_NOTIMPL;
639 static ICOM_VTABLE (IShellFolder2) vt_MCFldr_ShellFolder2 =
641 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
642 ISF_Desktop_fnQueryInterface,
643 ISF_Desktop_fnAddRef,
644 ISF_Desktop_fnRelease,
645 ISF_Desktop_fnParseDisplayName,
646 ISF_Desktop_fnEnumObjects,
647 ISF_Desktop_fnBindToObject,
648 ISF_Desktop_fnBindToStorage,
649 ISF_Desktop_fnCompareIDs,
650 ISF_Desktop_fnCreateViewObject,
651 ISF_Desktop_fnGetAttributesOf,
652 ISF_Desktop_fnGetUIObjectOf,
653 ISF_Desktop_fnGetDisplayNameOf,
654 ISF_Desktop_fnSetNameOf,
655 /* ShellFolder2 */
656 ISF_Desktop_fnGetDefaultSearchGUID,
657 ISF_Desktop_fnEnumSearches,
658 ISF_Desktop_fnGetDefaultColumn,
659 ISF_Desktop_fnGetDefaultColumnState,
660 ISF_Desktop_fnGetDetailsEx,
661 ISF_Desktop_fnGetDetailsOf,
662 ISF_Desktop_fnMapNameToSCID};