2 * Virtual Workplace folder
4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998, 1999, 2002 Juergen Schmied
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "wine/port.h"
31 #define NONAMELESSUNION
32 #define NONAMELESSSTRUCT
42 #include "enumidlist.h"
43 #include "undocshell.h"
44 #include "shell32_main.h"
47 #include "wine/debug.h"
51 WINE_DEFAULT_DEBUG_CHANNEL (shell
);
53 /***********************************************************************
54 * IShellFolder implementation
58 const IShellFolder2Vtbl
*lpVtbl
;
60 const IPersistFolder2Vtbl
*lpVtblPersistFolder2
;
62 /* both paths are parsible from the desktop */
63 LPITEMIDLIST pidlRoot
; /* absolute pidl */
66 static const IShellFolder2Vtbl vt_ShellFolder2
;
67 static const IPersistFolder2Vtbl vt_PersistFolder2
;
69 static inline IGenericSFImpl
*impl_from_IPersistFolder2( IPersistFolder2
*iface
)
71 return (IGenericSFImpl
*)((char*)iface
- FIELD_OFFSET(IGenericSFImpl
, lpVtblPersistFolder2
));
76 converts This to an interface pointer
78 #define _IUnknown_(This) (IUnknown*)&(This->lpVtbl)
79 #define _IShellFolder_(This) (IShellFolder*)&(This->lpVtbl)
80 #define _IShellFolder2_(This) (IShellFolder2*)&(This->lpVtbl)
82 #define _IPersist_(This) (IPersist*)&(This->lpVtblPersistFolder2)
83 #define _IPersistFolder_(This) (IPersistFolder*)&(This->lpVtblPersistFolder2)
84 #define _IPersistFolder2_(This) (IPersistFolder2*)&(This->lpVtblPersistFolder2)
86 /***********************************************************************
87 * IShellFolder [MyComputer] implementation
90 static const shvheader MyComputerSFHeader
[] = {
91 {IDS_SHV_COLUMN1
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 15},
92 {IDS_SHV_COLUMN3
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 10},
93 {IDS_SHV_COLUMN6
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 10},
94 {IDS_SHV_COLUMN7
, SHCOLSTATE_TYPE_STR
| SHCOLSTATE_ONBYDEFAULT
, LVCFMT_RIGHT
, 10},
97 #define MYCOMPUTERSHELLVIEWCOLUMNS 4
99 /**************************************************************************
100 * ISF_MyComputer_Constructor
102 HRESULT WINAPI
ISF_MyComputer_Constructor (IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
)
106 TRACE ("unkOut=%p %s\n", pUnkOuter
, shdebugstr_guid (riid
));
111 return CLASS_E_NOAGGREGATION
;
113 sf
= LocalAlloc (LMEM_ZEROINIT
, sizeof (IGenericSFImpl
));
115 return E_OUTOFMEMORY
;
118 sf
->lpVtbl
= &vt_ShellFolder2
;
119 sf
->lpVtblPersistFolder2
= &vt_PersistFolder2
;
120 sf
->pidlRoot
= _ILCreateMyComputer (); /* my qualified pidl */
122 if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (sf
), riid
, ppv
)))
124 IUnknown_Release (_IUnknown_ (sf
));
125 return E_NOINTERFACE
;
128 TRACE ("--(%p)\n", sf
);
132 /**************************************************************************
133 * ISF_MyComputer_fnQueryInterface
135 * NOTES supports not IPersist/IPersistFolder
137 static HRESULT WINAPI
ISF_MyComputer_fnQueryInterface (IShellFolder2
*iface
,
138 REFIID riid
, LPVOID
*ppvObj
)
140 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
142 TRACE ("(%p)->(%s,%p)\n", This
, shdebugstr_guid (riid
), ppvObj
);
146 if (IsEqualIID (riid
, &IID_IUnknown
) ||
147 IsEqualIID (riid
, &IID_IShellFolder
) ||
148 IsEqualIID (riid
, &IID_IShellFolder2
))
152 else if (IsEqualIID (riid
, &IID_IPersist
) ||
153 IsEqualIID (riid
, &IID_IPersistFolder
) ||
154 IsEqualIID (riid
, &IID_IPersistFolder2
))
156 *ppvObj
= _IPersistFolder2_ (This
);
161 IUnknown_AddRef ((IUnknown
*) (*ppvObj
));
162 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj
, *ppvObj
);
165 TRACE ("-- Interface: E_NOINTERFACE\n");
166 return E_NOINTERFACE
;
169 static ULONG WINAPI
ISF_MyComputer_fnAddRef (IShellFolder2
* iface
)
171 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
172 ULONG refCount
= InterlockedIncrement(&This
->ref
);
174 TRACE ("(%p)->(count=%lu)\n", This
, refCount
- 1);
179 static ULONG WINAPI
ISF_MyComputer_fnRelease (IShellFolder2
* iface
)
181 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
182 ULONG refCount
= InterlockedDecrement(&This
->ref
);
184 TRACE ("(%p)->(count=%lu)\n", This
, refCount
+ 1);
188 TRACE ("-- destroying IShellFolder(%p)\n", This
);
190 SHFree (This
->pidlRoot
);
191 LocalFree ((HLOCAL
) This
);
196 /**************************************************************************
197 * ISF_MyComputer_fnParseDisplayName
199 static HRESULT WINAPI
ISF_MyComputer_fnParseDisplayName (IShellFolder2
*iface
,
200 HWND hwndOwner
, LPBC pbc
, LPOLESTR lpszDisplayName
,
201 DWORD
* pchEaten
, LPITEMIDLIST
* ppidl
, DWORD
* pdwAttributes
)
203 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
204 HRESULT hr
= E_INVALIDARG
;
205 LPCWSTR szNext
= NULL
;
206 WCHAR szElement
[MAX_PATH
];
207 LPITEMIDLIST pidlTemp
= NULL
;
210 TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", This
,
211 hwndOwner
, pbc
, lpszDisplayName
, debugstr_w (lpszDisplayName
),
212 pchEaten
, ppidl
, pdwAttributes
);
216 *pchEaten
= 0; /* strange but like the original */
218 /* handle CLSID paths */
219 if (lpszDisplayName
[0] == ':' && lpszDisplayName
[1] == ':')
221 szNext
= GetNextElementW (lpszDisplayName
, szElement
, MAX_PATH
);
222 TRACE ("-- element: %s\n", debugstr_w (szElement
));
223 SHCLSIDFromStringW (szElement
+ 2, &clsid
);
224 pidlTemp
= _ILCreateGuid (PT_GUID
, &clsid
);
226 /* do we have an absolute path name ? */
227 else if (PathGetDriveNumberW (lpszDisplayName
) >= 0 &&
228 lpszDisplayName
[2] == (WCHAR
) '\\')
230 szNext
= GetNextElementW (lpszDisplayName
, szElement
, MAX_PATH
);
231 /* make drive letter uppercase to enable PIDL comparison */
232 szElement
[0] = toupper(szElement
[0]);
233 pidlTemp
= _ILCreateDrive (szElement
);
236 if (szNext
&& *szNext
)
238 hr
= SHELL32_ParseNextElement (iface
, hwndOwner
, pbc
, &pidlTemp
,
239 (LPOLESTR
) szNext
, pchEaten
, pdwAttributes
);
243 if (pdwAttributes
&& *pdwAttributes
)
244 SHELL32_GetItemAttributes (_IShellFolder_ (This
),
245 pidlTemp
, pdwAttributes
);
251 TRACE ("(%p)->(-- ret=0x%08lx)\n", This
, hr
);
256 /**************************************************************************
257 * CreateMyCompEnumList()
259 static const WCHAR MyComputer_NameSpaceW
[] = { 'S','O','F','T','W','A','R','E',
260 '\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
261 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l',
262 'o','r','e','r','\\','M','y','C','o','m','p','u','t','e','r','\\','N','a','m',
263 'e','s','p','a','c','e','\0' };
265 static BOOL
CreateMyCompEnumList(IEnumIDList
*list
, DWORD dwFlags
)
269 TRACE("(%p)->(flags=0x%08lx)\n", list
, dwFlags
);
271 /* enumerate the folders */
272 if (dwFlags
& SHCONTF_FOLDERS
)
274 WCHAR wszDriveName
[] = {'A', ':', '\\', '\0'};
275 DWORD dwDrivemap
= GetLogicalDrives();
279 while (ret
&& wszDriveName
[0]<='Z')
281 if(dwDrivemap
& 0x00000001L
)
282 ret
= AddToEnumList(list
, _ILCreateDrive(wszDriveName
));
284 dwDrivemap
= dwDrivemap
>> 1;
287 TRACE("-- (%p)-> enumerate (mycomputer shell extensions)\n",list
);
288 for (i
=0; i
<2; i
++) {
289 if (ret
&& !RegOpenKeyExW(i
== 0 ? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
,
290 MyComputer_NameSpaceW
, 0, KEY_READ
, &hkey
))
300 size
= sizeof(iid
) / sizeof(iid
[0]);
301 r
= RegEnumKeyExW(hkey
, i
, iid
, &size
, 0, NULL
, NULL
, NULL
);
302 if (ERROR_SUCCESS
== r
)
304 /* FIXME: shell extensions, shouldn't the type be
306 ret
= AddToEnumList(list
, _ILCreateGuidFromStrW(iid
));
309 else if (ERROR_NO_MORE_ITEMS
== r
)
321 /**************************************************************************
322 * ISF_MyComputer_fnEnumObjects
324 static HRESULT WINAPI
ISF_MyComputer_fnEnumObjects (IShellFolder2
*iface
,
325 HWND hwndOwner
, DWORD dwFlags
, LPENUMIDLIST
*ppEnumIDList
)
327 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
329 TRACE("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This
,
330 hwndOwner
, dwFlags
, ppEnumIDList
);
332 *ppEnumIDList
= IEnumIDList_Constructor();
334 CreateMyCompEnumList(*ppEnumIDList
, dwFlags
);
336 TRACE ("-- (%p)->(new ID List: %p)\n", This
, *ppEnumIDList
);
338 return (*ppEnumIDList
) ? S_OK
: E_OUTOFMEMORY
;
341 /**************************************************************************
342 * ISF_MyComputer_fnBindToObject
344 static HRESULT WINAPI
ISF_MyComputer_fnBindToObject (IShellFolder2
*iface
,
345 LPCITEMIDLIST pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
*ppvOut
)
347 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
349 TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", This
,
350 pidl
, pbcReserved
, shdebugstr_guid (riid
), ppvOut
);
352 return SHELL32_BindToChild (This
->pidlRoot
, NULL
, pidl
, riid
, ppvOut
);
355 /**************************************************************************
356 * ISF_MyComputer_fnBindToStorage
358 static HRESULT WINAPI
ISF_MyComputer_fnBindToStorage (IShellFolder2
* iface
,
359 LPCITEMIDLIST pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
*ppvOut
)
361 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
363 FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", This
,
364 pidl
, pbcReserved
, shdebugstr_guid (riid
), ppvOut
);
370 /**************************************************************************
371 * ISF_MyComputer_fnCompareIDs
374 static HRESULT WINAPI
ISF_MyComputer_fnCompareIDs (IShellFolder2
*iface
,
375 LPARAM lParam
, LPCITEMIDLIST pidl1
, LPCITEMIDLIST pidl2
)
377 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
380 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This
, lParam
, pidl1
, pidl2
);
381 nReturn
= SHELL32_CompareIDs (_IShellFolder_ (This
), lParam
, pidl1
, pidl2
);
382 TRACE ("-- %i\n", nReturn
);
386 /**************************************************************************
387 * ISF_MyComputer_fnCreateViewObject
389 static HRESULT WINAPI
ISF_MyComputer_fnCreateViewObject (IShellFolder2
*iface
,
390 HWND hwndOwner
, REFIID riid
, LPVOID
* ppvOut
)
392 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
393 LPSHELLVIEW pShellView
;
394 HRESULT hr
= E_INVALIDARG
;
396 TRACE("(%p)->(hwnd=%p,%s,%p)\n", This
,
397 hwndOwner
, shdebugstr_guid (riid
), ppvOut
);
404 if (IsEqualIID (riid
, &IID_IDropTarget
))
406 WARN ("IDropTarget not implemented\n");
409 else if (IsEqualIID (riid
, &IID_IContextMenu
))
411 WARN ("IContextMenu not implemented\n");
414 else if (IsEqualIID (riid
, &IID_IShellView
))
416 pShellView
= IShellView_Constructor ((IShellFolder
*) iface
);
419 hr
= IShellView_QueryInterface (pShellView
, riid
, ppvOut
);
420 IShellView_Release (pShellView
);
423 TRACE ("-- (%p)->(interface=%p)\n", This
, ppvOut
);
427 /**************************************************************************
428 * ISF_MyComputer_fnGetAttributesOf
430 static HRESULT WINAPI
ISF_MyComputer_fnGetAttributesOf (IShellFolder2
* iface
,
431 UINT cidl
, LPCITEMIDLIST
* apidl
, DWORD
* rgfInOut
)
433 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
436 TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08lx))\n",
437 This
, cidl
, apidl
, rgfInOut
, rgfInOut
? *rgfInOut
: 0);
448 IShellFolder
*psfParent
= NULL
;
449 LPCITEMIDLIST rpidl
= NULL
;
451 hr
= SHBindToParent(This
->pidlRoot
, &IID_IShellFolder
, (LPVOID
*)&psfParent
, (LPCITEMIDLIST
*)&rpidl
);
453 SHELL32_GetItemAttributes (psfParent
, rpidl
, rgfInOut
);
454 IShellFolder_Release(psfParent
);
457 while (cidl
> 0 && *apidl
) {
459 SHELL32_GetItemAttributes (_IShellFolder_ (This
), *apidl
, rgfInOut
);
464 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
465 *rgfInOut
&= ~SFGAO_VALIDATE
;
467 TRACE ("-- result=0x%08lx\n", *rgfInOut
);
471 /**************************************************************************
472 * ISF_MyComputer_fnGetUIObjectOf
475 * hwndOwner [in] Parent window for any output
476 * cidl [in] array size
477 * apidl [in] simple pidl array
478 * riid [in] Requested Interface
479 * prgfInOut [ ] reserved
480 * ppvObject [out] Resulting Interface
483 static HRESULT WINAPI
ISF_MyComputer_fnGetUIObjectOf (IShellFolder2
* iface
,
484 HWND hwndOwner
, UINT cidl
, LPCITEMIDLIST
* apidl
, REFIID riid
,
485 UINT
* prgfInOut
, LPVOID
* ppvOut
)
487 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
490 IUnknown
*pObj
= NULL
;
491 HRESULT hr
= E_INVALIDARG
;
493 TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", This
,
494 hwndOwner
, cidl
, apidl
, shdebugstr_guid (riid
), prgfInOut
, ppvOut
);
501 if (IsEqualIID (riid
, &IID_IContextMenu
) && (cidl
>= 1))
503 pObj
= (LPUNKNOWN
) ISvItemCm_Constructor ((IShellFolder
*) iface
,
504 This
->pidlRoot
, apidl
, cidl
);
507 else if (IsEqualIID (riid
, &IID_IDataObject
) && (cidl
>= 1))
509 pObj
= (LPUNKNOWN
) IDataObject_Constructor (hwndOwner
,
510 This
->pidlRoot
, apidl
, cidl
);
513 else if (IsEqualIID (riid
, &IID_IExtractIconA
) && (cidl
== 1))
515 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
516 pObj
= (LPUNKNOWN
) IExtractIconA_Constructor (pidl
);
520 else if (IsEqualIID (riid
, &IID_IExtractIconW
) && (cidl
== 1))
522 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
523 pObj
= (LPUNKNOWN
) IExtractIconW_Constructor (pidl
);
527 else if (IsEqualIID (riid
, &IID_IDropTarget
) && (cidl
>= 1))
529 hr
= IShellFolder_QueryInterface (iface
, &IID_IDropTarget
,
532 else if ((IsEqualIID(riid
,&IID_IShellLinkW
) ||
533 IsEqualIID(riid
,&IID_IShellLinkA
)) && (cidl
== 1))
535 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
536 hr
= IShellLink_ConstructFromFile(NULL
, riid
, pidl
, (LPVOID
*) &pObj
);
542 if (SUCCEEDED(hr
) && !pObj
)
546 TRACE ("(%p)->hr=0x%08lx\n", This
, hr
);
550 /**************************************************************************
551 * ISF_MyComputer_fnGetDisplayNameOf
553 static HRESULT WINAPI
ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2
*iface
,
554 LPCITEMIDLIST pidl
, DWORD dwFlags
, LPSTRRET strRet
)
556 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
558 char szPath
[MAX_PATH
];
561 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This
, pidl
, dwFlags
, strRet
);
571 /* parsing name like ::{...} */
572 lstrcpyA (szPath
, "::");
573 SHELL32_GUIDToStringA(&CLSID_MyComputer
, &szPath
[2]);
575 else if (_ILIsPidlSimple(pidl
))
577 /* take names of special folders only if its only this folder */
578 if (_ILIsSpecialFolder(pidl
))
582 clsid
= _ILGetGUIDPointer (pidl
);
585 if (GET_SHGDN_FOR (dwFlags
) & SHGDN_FORPARSING
)
587 static const WCHAR clsidW
[] =
588 { 'C','L','S','I','D','\\',0 };
589 static const WCHAR shellfolderW
[] =
590 { '\\','s','h','e','l','l','f','o','l','d','e','r',0 };
591 static const WCHAR wantsForParsingW
[] =
592 { 'W','a','n','t','s','F','o','r','P','a','r','s','i','n',
594 int bWantsForParsing
= FALSE
;
595 WCHAR szRegPath
[100];
599 * We can only get a filesystem path from a shellfolder
600 * if the value WantsFORPARSING exists in
601 * CLSID\\{...}\\shellfolder
602 * exception: the MyComputer folder has this keys not
603 * but like any filesystem backed
604 * folder it needs these behaviour
606 * Get the "WantsFORPARSING" flag from the registry
609 lstrcpyW (szRegPath
, clsidW
);
610 SHELL32_GUIDToStringW (clsid
, &szRegPath
[6]);
611 lstrcatW (szRegPath
, shellfolderW
);
612 r
= SHGetValueW (HKEY_CLASSES_ROOT
, szRegPath
,
613 wantsForParsingW
, NULL
, NULL
, NULL
);
614 if (r
== ERROR_SUCCESS
)
615 bWantsForParsing
= TRUE
;
617 if ((GET_SHGDN_RELATION (dwFlags
) == SHGDN_NORMAL
) &&
620 WCHAR wszPath
[MAX_PATH
];
622 * We need the filesystem path to the destination folder
623 * Only the folder itself can know it
625 hr
= SHELL32_GetDisplayNameOfChild (iface
, pidl
,
626 dwFlags
, wszPath
, MAX_PATH
);
629 if (!WideCharToMultiByte(CP_ACP
, 0, wszPath
, -1, szPath
, MAX_PATH
,
638 /* parsing name like ::{...} */
639 p
= lstrcpyA(szPath
, "::") + 2;
640 p
+= SHELL32_GUIDToStringA(&CLSID_MyComputer
, p
);
644 SHELL32_GUIDToStringA(clsid
, p
);
649 /* user friendly name */
650 HCR_GetClassNameA (clsid
, szPath
, MAX_PATH
);
655 /* append my own path */
656 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
);
659 else if (_ILIsDrive(pidl
))
661 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
); /* append my own path */
663 /* long view "lw_name (C:)" */
664 if (!(dwFlags
& SHGDN_FORPARSING
))
666 DWORD dwVolumeSerialNumber
, dwMaximumComponetLength
, dwFileSystemFlags
;
667 char szDrive
[18] = "";
669 GetVolumeInformationA (szPath
, szDrive
, sizeof (szDrive
) - 6,
670 &dwVolumeSerialNumber
,
671 &dwMaximumComponetLength
, &dwFileSystemFlags
, NULL
, 0);
672 strcat (szDrive
, " (");
673 strncat (szDrive
, szPath
, 2);
674 strcat (szDrive
, ")");
675 strcpy (szPath
, szDrive
);
680 /* Neither a shell namespace extension nor a drive letter. */
681 ERR("Wrong pidl type\n");
687 WCHAR wszPath
[MAX_PATH
];
688 /* Complex pidl. Let the child folder do the work */
689 strRet
->uType
= STRRET_CSTR
;
690 hr
= SHELL32_GetDisplayNameOfChild(iface
, pidl
, dwFlags
, wszPath
, MAX_PATH
);
693 if (!WideCharToMultiByte(CP_ACP
, 0, wszPath
, -1, szPath
, MAX_PATH
,
701 strRet
->uType
= STRRET_CSTR
;
702 lstrcpynA (strRet
->u
.cStr
, szPath
, MAX_PATH
);
705 TRACE ("-- (%p)->(%s)\n", This
, szPath
);
709 /**************************************************************************
710 * ISF_MyComputer_fnSetNameOf
711 * Changes the name of a file object or subfolder, possibly changing its item
712 * identifier in the process.
715 * hwndOwner [in] Owner window for output
716 * pidl [in] simple pidl of item to change
717 * lpszName [in] the items new display name
718 * dwFlags [in] SHGNO formatting flags
719 * ppidlOut [out] simple pidl returned
721 static HRESULT WINAPI
ISF_MyComputer_fnSetNameOf (
722 IShellFolder2
* iface
, HWND hwndOwner
, LPCITEMIDLIST pidl
,
723 LPCOLESTR lpName
, DWORD dwFlags
, LPITEMIDLIST
* pPidlOut
)
725 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
726 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This
,
727 hwndOwner
, pidl
, debugstr_w (lpName
), dwFlags
, pPidlOut
);
731 static HRESULT WINAPI
ISF_MyComputer_fnGetDefaultSearchGUID (
732 IShellFolder2
* iface
, GUID
* pguid
)
734 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
735 FIXME ("(%p)\n", This
);
738 static HRESULT WINAPI
ISF_MyComputer_fnEnumSearches (
739 IShellFolder2
* iface
, IEnumExtraSearch
** ppenum
)
741 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
742 FIXME ("(%p)\n", This
);
745 static HRESULT WINAPI
ISF_MyComputer_fnGetDefaultColumn (
746 IShellFolder2
*iface
, DWORD dwRes
, ULONG
*pSort
, ULONG
*pDisplay
)
748 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
750 TRACE ("(%p)\n", This
);
758 static HRESULT WINAPI
ISF_MyComputer_fnGetDefaultColumnState (
759 IShellFolder2
* iface
, UINT iColumn
, DWORD
* pcsFlags
)
761 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
763 TRACE ("(%p)\n", This
);
765 if (!pcsFlags
|| iColumn
>= MYCOMPUTERSHELLVIEWCOLUMNS
)
767 *pcsFlags
= MyComputerSFHeader
[iColumn
].pcsFlags
;
771 static HRESULT WINAPI
ISF_MyComputer_fnGetDetailsEx (IShellFolder2
* iface
,
772 LPCITEMIDLIST pidl
, const SHCOLUMNID
* pscid
, VARIANT
* pv
)
774 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
775 FIXME ("(%p)\n", This
);
779 /* FIXME: drive size >4GB is rolling over */
780 static HRESULT WINAPI
ISF_MyComputer_fnGetDetailsOf (IShellFolder2
* iface
,
781 LPCITEMIDLIST pidl
, UINT iColumn
, SHELLDETAILS
* psd
)
783 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
786 TRACE ("(%p)->(%p %i %p)\n", This
, pidl
, iColumn
, psd
);
788 if (!psd
|| iColumn
>= MYCOMPUTERSHELLVIEWCOLUMNS
)
793 psd
->fmt
= MyComputerSFHeader
[iColumn
].fmt
;
794 psd
->cxChar
= MyComputerSFHeader
[iColumn
].cxChar
;
795 psd
->str
.uType
= STRRET_CSTR
;
796 LoadStringA (shell32_hInstance
, MyComputerSFHeader
[iColumn
].colnameid
,
797 psd
->str
.u
.cStr
, MAX_PATH
);
802 char szPath
[MAX_PATH
];
803 ULARGE_INTEGER ulBytes
;
805 psd
->str
.u
.cStr
[0] = 0x00;
806 psd
->str
.uType
= STRRET_CSTR
;
810 hr
= IShellFolder_GetDisplayNameOf (iface
, pidl
,
811 SHGDN_NORMAL
| SHGDN_INFOLDER
, &psd
->str
);
814 _ILGetFileType (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
816 case 2: /* total size */
817 if (_ILIsDrive (pidl
))
819 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
);
820 GetDiskFreeSpaceExA (szPath
, NULL
, &ulBytes
, NULL
);
821 StrFormatByteSizeA (ulBytes
.u
.LowPart
, psd
->str
.u
.cStr
, MAX_PATH
);
824 case 3: /* free size */
825 if (_ILIsDrive (pidl
))
827 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
);
828 GetDiskFreeSpaceExA (szPath
, &ulBytes
, NULL
, NULL
);
829 StrFormatByteSizeA (ulBytes
.u
.LowPart
, psd
->str
.u
.cStr
, MAX_PATH
);
839 static HRESULT WINAPI
ISF_MyComputer_fnMapColumnToSCID (
840 IShellFolder2
* iface
, UINT column
, SHCOLUMNID
* pscid
)
842 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
843 FIXME ("(%p)\n", This
);
847 static const IShellFolder2Vtbl vt_ShellFolder2
=
849 ISF_MyComputer_fnQueryInterface
,
850 ISF_MyComputer_fnAddRef
,
851 ISF_MyComputer_fnRelease
,
852 ISF_MyComputer_fnParseDisplayName
,
853 ISF_MyComputer_fnEnumObjects
,
854 ISF_MyComputer_fnBindToObject
,
855 ISF_MyComputer_fnBindToStorage
,
856 ISF_MyComputer_fnCompareIDs
,
857 ISF_MyComputer_fnCreateViewObject
,
858 ISF_MyComputer_fnGetAttributesOf
,
859 ISF_MyComputer_fnGetUIObjectOf
,
860 ISF_MyComputer_fnGetDisplayNameOf
,
861 ISF_MyComputer_fnSetNameOf
,
863 ISF_MyComputer_fnGetDefaultSearchGUID
,
864 ISF_MyComputer_fnEnumSearches
,
865 ISF_MyComputer_fnGetDefaultColumn
,
866 ISF_MyComputer_fnGetDefaultColumnState
,
867 ISF_MyComputer_fnGetDetailsEx
,
868 ISF_MyComputer_fnGetDetailsOf
,
869 ISF_MyComputer_fnMapColumnToSCID
872 /************************************************************************
873 * IMCFldr_PersistFolder2_QueryInterface
875 static HRESULT WINAPI
IMCFldr_PersistFolder2_QueryInterface (
876 IPersistFolder2
* iface
, REFIID iid
, LPVOID
* ppvObj
)
878 IGenericSFImpl
*This
= impl_from_IPersistFolder2(iface
);
880 TRACE ("(%p)\n", This
);
882 return IUnknown_QueryInterface (_IUnknown_ (This
), iid
, ppvObj
);
885 /************************************************************************
886 * IMCFldr_PersistFolder2_AddRef
888 static ULONG WINAPI
IMCFldr_PersistFolder2_AddRef (IPersistFolder2
* iface
)
890 IGenericSFImpl
*This
= impl_from_IPersistFolder2(iface
);
892 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
894 return IUnknown_AddRef (_IUnknown_ (This
));
897 /************************************************************************
898 * ISFPersistFolder_Release
900 static ULONG WINAPI
IMCFldr_PersistFolder2_Release (IPersistFolder2
* iface
)
902 IGenericSFImpl
*This
= impl_from_IPersistFolder2(iface
);
904 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
906 return IUnknown_Release (_IUnknown_ (This
));
909 /************************************************************************
910 * IMCFldr_PersistFolder2_GetClassID
912 static HRESULT WINAPI
IMCFldr_PersistFolder2_GetClassID (
913 IPersistFolder2
* iface
, CLSID
* lpClassId
)
915 IGenericSFImpl
*This
= impl_from_IPersistFolder2(iface
);
917 TRACE ("(%p)\n", This
);
921 *lpClassId
= CLSID_MyComputer
;
926 /************************************************************************
927 * IMCFldr_PersistFolder2_Initialize
929 * NOTES: it makes no sense to change the pidl
931 static HRESULT WINAPI
IMCFldr_PersistFolder2_Initialize (
932 IPersistFolder2
* iface
, LPCITEMIDLIST pidl
)
934 IGenericSFImpl
*This
= impl_from_IPersistFolder2(iface
);
935 TRACE ("(%p)->(%p)\n", This
, pidl
);
939 /**************************************************************************
940 * IPersistFolder2_fnGetCurFolder
942 static HRESULT WINAPI
IMCFldr_PersistFolder2_GetCurFolder (
943 IPersistFolder2
* iface
, LPITEMIDLIST
* pidl
)
945 IGenericSFImpl
*This
= impl_from_IPersistFolder2(iface
);
947 TRACE ("(%p)->(%p)\n", This
, pidl
);
951 *pidl
= ILClone (This
->pidlRoot
);
955 static const IPersistFolder2Vtbl vt_PersistFolder2
=
957 IMCFldr_PersistFolder2_QueryInterface
,
958 IMCFldr_PersistFolder2_AddRef
,
959 IMCFldr_PersistFolder2_Release
,
960 IMCFldr_PersistFolder2_GetClassID
,
961 IMCFldr_PersistFolder2_Initialize
,
962 IMCFldr_PersistFolder2_GetCurFolder