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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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=%u)\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=%u)\n", This
, refCount
+ 1);
188 TRACE ("-- destroying IShellFolder(%p)\n", This
);
189 SHFree (This
->pidlRoot
);
190 LocalFree ((HLOCAL
) This
);
195 /**************************************************************************
196 * ISF_MyComputer_fnParseDisplayName
198 static HRESULT WINAPI
ISF_MyComputer_fnParseDisplayName (IShellFolder2
*iface
,
199 HWND hwndOwner
, LPBC pbc
, LPOLESTR lpszDisplayName
,
200 DWORD
* pchEaten
, LPITEMIDLIST
* ppidl
, DWORD
* pdwAttributes
)
202 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
203 HRESULT hr
= E_INVALIDARG
;
204 LPCWSTR szNext
= NULL
;
205 WCHAR szElement
[MAX_PATH
];
206 LPITEMIDLIST pidlTemp
= NULL
;
209 TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", This
,
210 hwndOwner
, pbc
, lpszDisplayName
, debugstr_w (lpszDisplayName
),
211 pchEaten
, ppidl
, pdwAttributes
);
215 *pchEaten
= 0; /* strange but like the original */
217 /* handle CLSID paths */
218 if (lpszDisplayName
[0] == ':' && lpszDisplayName
[1] == ':')
220 szNext
= GetNextElementW (lpszDisplayName
, szElement
, MAX_PATH
);
221 TRACE ("-- element: %s\n", debugstr_w (szElement
));
222 SHCLSIDFromStringW (szElement
+ 2, &clsid
);
223 pidlTemp
= _ILCreateGuid (PT_GUID
, &clsid
);
225 /* do we have an absolute path name ? */
226 else if (PathGetDriveNumberW (lpszDisplayName
) >= 0 &&
227 lpszDisplayName
[2] == (WCHAR
) '\\')
229 szNext
= GetNextElementW (lpszDisplayName
, szElement
, MAX_PATH
);
230 /* make drive letter uppercase to enable PIDL comparison */
231 szElement
[0] = toupper(szElement
[0]);
232 pidlTemp
= _ILCreateDrive (szElement
);
235 if (szNext
&& *szNext
)
237 hr
= SHELL32_ParseNextElement (iface
, hwndOwner
, pbc
, &pidlTemp
,
238 (LPOLESTR
) szNext
, pchEaten
, pdwAttributes
);
242 if (pdwAttributes
&& *pdwAttributes
)
243 SHELL32_GetItemAttributes (_IShellFolder_ (This
),
244 pidlTemp
, pdwAttributes
);
250 TRACE ("(%p)->(-- ret=0x%08x)\n", This
, hr
);
255 /**************************************************************************
256 * CreateMyCompEnumList()
258 static const WCHAR MyComputer_NameSpaceW
[] = { 'S','O','F','T','W','A','R','E',
259 '\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
260 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l',
261 'o','r','e','r','\\','M','y','C','o','m','p','u','t','e','r','\\','N','a','m',
262 'e','s','p','a','c','e','\0' };
264 static BOOL
CreateMyCompEnumList(IEnumIDList
*list
, DWORD dwFlags
)
268 TRACE("(%p)->(flags=0x%08x)\n", list
, dwFlags
);
270 /* enumerate the folders */
271 if (dwFlags
& SHCONTF_FOLDERS
)
273 WCHAR wszDriveName
[] = {'A', ':', '\\', '\0'};
274 DWORD dwDrivemap
= GetLogicalDrives();
278 while (ret
&& wszDriveName
[0]<='Z')
280 if(dwDrivemap
& 0x00000001L
)
281 ret
= AddToEnumList(list
, _ILCreateDrive(wszDriveName
));
283 dwDrivemap
= dwDrivemap
>> 1;
286 TRACE("-- (%p)-> enumerate (mycomputer shell extensions)\n",list
);
287 for (i
=0; i
<2; i
++) {
288 if (ret
&& !RegOpenKeyExW(i
== 0 ? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER
,
289 MyComputer_NameSpaceW
, 0, KEY_READ
, &hkey
))
299 size
= sizeof(iid
) / sizeof(iid
[0]);
300 r
= RegEnumKeyExW(hkey
, i
, iid
, &size
, 0, NULL
, NULL
, NULL
);
301 if (ERROR_SUCCESS
== r
)
303 /* FIXME: shell extensions, shouldn't the type be
305 ret
= AddToEnumList(list
, _ILCreateGuidFromStrW(iid
));
308 else if (ERROR_NO_MORE_ITEMS
== r
)
320 /**************************************************************************
321 * ISF_MyComputer_fnEnumObjects
323 static HRESULT WINAPI
ISF_MyComputer_fnEnumObjects (IShellFolder2
*iface
,
324 HWND hwndOwner
, DWORD dwFlags
, LPENUMIDLIST
*ppEnumIDList
)
326 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
328 TRACE("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", This
,
329 hwndOwner
, dwFlags
, ppEnumIDList
);
331 *ppEnumIDList
= IEnumIDList_Constructor();
333 CreateMyCompEnumList(*ppEnumIDList
, dwFlags
);
335 TRACE ("-- (%p)->(new ID List: %p)\n", This
, *ppEnumIDList
);
337 return (*ppEnumIDList
) ? S_OK
: E_OUTOFMEMORY
;
340 /**************************************************************************
341 * ISF_MyComputer_fnBindToObject
343 static HRESULT WINAPI
ISF_MyComputer_fnBindToObject (IShellFolder2
*iface
,
344 LPCITEMIDLIST pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
*ppvOut
)
346 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
348 TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", This
,
349 pidl
, pbcReserved
, shdebugstr_guid (riid
), ppvOut
);
351 return SHELL32_BindToChild (This
->pidlRoot
, NULL
, pidl
, riid
, ppvOut
);
354 /**************************************************************************
355 * ISF_MyComputer_fnBindToStorage
357 static HRESULT WINAPI
ISF_MyComputer_fnBindToStorage (IShellFolder2
* iface
,
358 LPCITEMIDLIST pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
*ppvOut
)
360 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
362 FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", This
,
363 pidl
, pbcReserved
, shdebugstr_guid (riid
), ppvOut
);
369 /**************************************************************************
370 * ISF_MyComputer_fnCompareIDs
373 static HRESULT WINAPI
ISF_MyComputer_fnCompareIDs (IShellFolder2
*iface
,
374 LPARAM lParam
, LPCITEMIDLIST pidl1
, LPCITEMIDLIST pidl2
)
376 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
379 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This
, lParam
, pidl1
, pidl2
);
380 nReturn
= SHELL32_CompareIDs (_IShellFolder_ (This
), lParam
, pidl1
, pidl2
);
381 TRACE ("-- %i\n", nReturn
);
385 /**************************************************************************
386 * ISF_MyComputer_fnCreateViewObject
388 static HRESULT WINAPI
ISF_MyComputer_fnCreateViewObject (IShellFolder2
*iface
,
389 HWND hwndOwner
, REFIID riid
, LPVOID
* ppvOut
)
391 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
392 LPSHELLVIEW pShellView
;
393 HRESULT hr
= E_INVALIDARG
;
395 TRACE("(%p)->(hwnd=%p,%s,%p)\n", This
,
396 hwndOwner
, shdebugstr_guid (riid
), ppvOut
);
403 if (IsEqualIID (riid
, &IID_IDropTarget
))
405 WARN ("IDropTarget not implemented\n");
408 else if (IsEqualIID (riid
, &IID_IContextMenu
))
410 WARN ("IContextMenu not implemented\n");
413 else if (IsEqualIID (riid
, &IID_IShellView
))
415 pShellView
= IShellView_Constructor ((IShellFolder
*) iface
);
418 hr
= IShellView_QueryInterface (pShellView
, riid
, ppvOut
);
419 IShellView_Release (pShellView
);
422 TRACE ("-- (%p)->(interface=%p)\n", This
, ppvOut
);
426 /**************************************************************************
427 * ISF_MyComputer_fnGetAttributesOf
429 static HRESULT WINAPI
ISF_MyComputer_fnGetAttributesOf (IShellFolder2
* iface
,
430 UINT cidl
, LPCITEMIDLIST
* apidl
, DWORD
* rgfInOut
)
432 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
435 TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
436 This
, cidl
, apidl
, rgfInOut
, rgfInOut
? *rgfInOut
: 0);
447 IShellFolder
*psfParent
= NULL
;
448 LPCITEMIDLIST rpidl
= NULL
;
450 hr
= SHBindToParent(This
->pidlRoot
, &IID_IShellFolder
, (LPVOID
*)&psfParent
, (LPCITEMIDLIST
*)&rpidl
);
452 SHELL32_GetItemAttributes (psfParent
, rpidl
, rgfInOut
);
453 IShellFolder_Release(psfParent
);
456 while (cidl
> 0 && *apidl
) {
458 SHELL32_GetItemAttributes (_IShellFolder_ (This
), *apidl
, rgfInOut
);
463 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
464 *rgfInOut
&= ~SFGAO_VALIDATE
;
466 TRACE ("-- result=0x%08x\n", *rgfInOut
);
470 /**************************************************************************
471 * ISF_MyComputer_fnGetUIObjectOf
474 * hwndOwner [in] Parent window for any output
475 * cidl [in] array size
476 * apidl [in] simple pidl array
477 * riid [in] Requested Interface
478 * prgfInOut [ ] reserved
479 * ppvObject [out] Resulting Interface
482 static HRESULT WINAPI
ISF_MyComputer_fnGetUIObjectOf (IShellFolder2
* iface
,
483 HWND hwndOwner
, UINT cidl
, LPCITEMIDLIST
* apidl
, REFIID riid
,
484 UINT
* prgfInOut
, LPVOID
* ppvOut
)
486 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
489 IUnknown
*pObj
= NULL
;
490 HRESULT hr
= E_INVALIDARG
;
492 TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", This
,
493 hwndOwner
, cidl
, apidl
, shdebugstr_guid (riid
), prgfInOut
, ppvOut
);
500 if (IsEqualIID (riid
, &IID_IContextMenu
) && (cidl
>= 1))
502 pObj
= (LPUNKNOWN
) ISvItemCm_Constructor ((IShellFolder
*) iface
,
503 This
->pidlRoot
, apidl
, cidl
);
506 else if (IsEqualIID (riid
, &IID_IDataObject
) && (cidl
>= 1))
508 pObj
= (LPUNKNOWN
) IDataObject_Constructor (hwndOwner
,
509 This
->pidlRoot
, apidl
, cidl
);
512 else if (IsEqualIID (riid
, &IID_IExtractIconA
) && (cidl
== 1))
514 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
515 pObj
= (LPUNKNOWN
) IExtractIconA_Constructor (pidl
);
519 else if (IsEqualIID (riid
, &IID_IExtractIconW
) && (cidl
== 1))
521 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
522 pObj
= (LPUNKNOWN
) IExtractIconW_Constructor (pidl
);
526 else if (IsEqualIID (riid
, &IID_IDropTarget
) && (cidl
>= 1))
528 hr
= IShellFolder_QueryInterface (iface
, &IID_IDropTarget
,
531 else if ((IsEqualIID(riid
,&IID_IShellLinkW
) ||
532 IsEqualIID(riid
,&IID_IShellLinkA
)) && (cidl
== 1))
534 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
535 hr
= IShellLink_ConstructFromFile(NULL
, riid
, pidl
, (LPVOID
*) &pObj
);
541 if (SUCCEEDED(hr
) && !pObj
)
545 TRACE ("(%p)->hr=0x%08x\n", This
, hr
);
549 /**************************************************************************
550 * ISF_MyComputer_fnGetDisplayNameOf
552 static HRESULT WINAPI
ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2
*iface
,
553 LPCITEMIDLIST pidl
, DWORD dwFlags
, LPSTRRET strRet
)
555 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
557 WCHAR wszPath
[MAX_PATH
];
560 TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", This
, pidl
, dwFlags
, strRet
);
570 /* parsing name like ::{...} */
573 SHELL32_GUIDToStringW(&CLSID_MyComputer
, &wszPath
[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
) &&
621 * We need the filesystem path to the destination folder
622 * Only the folder itself can know it
624 hr
= SHELL32_GetDisplayNameOfChild (iface
, pidl
,
625 dwFlags
, wszPath
, MAX_PATH
);
631 /* parsing name like ::{...} */
635 p
+= SHELL32_GUIDToStringW(&CLSID_MyComputer
, p
);
642 SHELL32_GUIDToStringW(clsid
, p
);
647 /* user friendly name */
648 HCR_GetClassNameW (clsid
, wszPath
, MAX_PATH
);
653 /* append my own path */
654 _ILSimpleGetTextW (pidl
, wszPath
, MAX_PATH
);
657 else if (_ILIsDrive(pidl
))
659 _ILSimpleGetTextW (pidl
, wszPath
, MAX_PATH
); /* append my own path */
661 /* long view "lw_name (C:)" */
662 if (!(dwFlags
& SHGDN_FORPARSING
))
664 DWORD dwVolumeSerialNumber
, dwMaximumComponetLength
, dwFileSystemFlags
;
665 WCHAR wszDrive
[18] = {0};
666 static const WCHAR wszOpenBracket
[] = {' ','(',0};
667 static const WCHAR wszCloseBracket
[] = {')',0};
669 GetVolumeInformationW (wszPath
, wszDrive
,
670 sizeof(wszDrive
)/sizeof(wszDrive
[0]) - 6,
671 &dwVolumeSerialNumber
,
672 &dwMaximumComponetLength
, &dwFileSystemFlags
, NULL
, 0);
673 strcatW (wszDrive
, wszOpenBracket
);
674 lstrcpynW (wszDrive
+ strlenW(wszDrive
), wszPath
, 3);
675 strcatW (wszDrive
, wszCloseBracket
);
676 strcpyW (wszPath
, wszDrive
);
681 /* Neither a shell namespace extension nor a drive letter. */
682 ERR("Wrong pidl type\n");
688 /* Complex pidl. Let the child folder do the work */
689 hr
= SHELL32_GetDisplayNameOfChild(iface
, pidl
, dwFlags
, wszPath
, MAX_PATH
);
694 strRet
->uType
= STRRET_CSTR
;
695 if (!WideCharToMultiByte(CP_ACP
, 0, wszPath
, -1, strRet
->u
.cStr
, MAX_PATH
,
697 strRet
->u
.cStr
[0] = '\0';
700 TRACE ("-- (%p)->(%s)\n", This
, debugstr_w(wszPath
));
704 /**************************************************************************
705 * ISF_MyComputer_fnSetNameOf
706 * Changes the name of a file object or subfolder, possibly changing its item
707 * identifier in the process.
710 * hwndOwner [in] Owner window for output
711 * pidl [in] simple pidl of item to change
712 * lpszName [in] the items new display name
713 * dwFlags [in] SHGNO formatting flags
714 * ppidlOut [out] simple pidl returned
716 static HRESULT WINAPI
ISF_MyComputer_fnSetNameOf (
717 IShellFolder2
* iface
, HWND hwndOwner
, LPCITEMIDLIST pidl
,
718 LPCOLESTR lpName
, DWORD dwFlags
, LPITEMIDLIST
* pPidlOut
)
720 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
721 FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", This
,
722 hwndOwner
, pidl
, debugstr_w (lpName
), dwFlags
, pPidlOut
);
726 static HRESULT WINAPI
ISF_MyComputer_fnGetDefaultSearchGUID (
727 IShellFolder2
* iface
, GUID
* pguid
)
729 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
730 FIXME ("(%p)\n", This
);
733 static HRESULT WINAPI
ISF_MyComputer_fnEnumSearches (
734 IShellFolder2
* iface
, IEnumExtraSearch
** ppenum
)
736 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
737 FIXME ("(%p)\n", This
);
740 static HRESULT WINAPI
ISF_MyComputer_fnGetDefaultColumn (
741 IShellFolder2
*iface
, DWORD dwRes
, ULONG
*pSort
, ULONG
*pDisplay
)
743 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
745 TRACE ("(%p)\n", This
);
753 static HRESULT WINAPI
ISF_MyComputer_fnGetDefaultColumnState (
754 IShellFolder2
* iface
, UINT iColumn
, DWORD
* pcsFlags
)
756 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
758 TRACE ("(%p)\n", This
);
760 if (!pcsFlags
|| iColumn
>= MYCOMPUTERSHELLVIEWCOLUMNS
)
762 *pcsFlags
= MyComputerSFHeader
[iColumn
].pcsFlags
;
766 static HRESULT WINAPI
ISF_MyComputer_fnGetDetailsEx (IShellFolder2
* iface
,
767 LPCITEMIDLIST pidl
, const SHCOLUMNID
* pscid
, VARIANT
* pv
)
769 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
770 FIXME ("(%p)\n", This
);
774 /* FIXME: drive size >4GB is rolling over */
775 static HRESULT WINAPI
ISF_MyComputer_fnGetDetailsOf (IShellFolder2
* iface
,
776 LPCITEMIDLIST pidl
, UINT iColumn
, SHELLDETAILS
* psd
)
778 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
781 TRACE ("(%p)->(%p %i %p)\n", This
, pidl
, iColumn
, psd
);
783 if (!psd
|| iColumn
>= MYCOMPUTERSHELLVIEWCOLUMNS
)
788 psd
->fmt
= MyComputerSFHeader
[iColumn
].fmt
;
789 psd
->cxChar
= MyComputerSFHeader
[iColumn
].cxChar
;
790 psd
->str
.uType
= STRRET_CSTR
;
791 LoadStringA (shell32_hInstance
, MyComputerSFHeader
[iColumn
].colnameid
,
792 psd
->str
.u
.cStr
, MAX_PATH
);
797 char szPath
[MAX_PATH
];
798 ULARGE_INTEGER ulBytes
;
800 psd
->str
.u
.cStr
[0] = 0x00;
801 psd
->str
.uType
= STRRET_CSTR
;
805 hr
= IShellFolder_GetDisplayNameOf (iface
, pidl
,
806 SHGDN_NORMAL
| SHGDN_INFOLDER
, &psd
->str
);
809 _ILGetFileType (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
811 case 2: /* total size */
812 if (_ILIsDrive (pidl
))
814 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
);
815 GetDiskFreeSpaceExA (szPath
, NULL
, &ulBytes
, NULL
);
816 StrFormatByteSizeA (ulBytes
.u
.LowPart
, psd
->str
.u
.cStr
, MAX_PATH
);
819 case 3: /* free size */
820 if (_ILIsDrive (pidl
))
822 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
);
823 GetDiskFreeSpaceExA (szPath
, &ulBytes
, NULL
, NULL
);
824 StrFormatByteSizeA (ulBytes
.u
.LowPart
, psd
->str
.u
.cStr
, MAX_PATH
);
834 static HRESULT WINAPI
ISF_MyComputer_fnMapColumnToSCID (
835 IShellFolder2
* iface
, UINT column
, SHCOLUMNID
* pscid
)
837 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
838 FIXME ("(%p)\n", This
);
842 static const IShellFolder2Vtbl vt_ShellFolder2
=
844 ISF_MyComputer_fnQueryInterface
,
845 ISF_MyComputer_fnAddRef
,
846 ISF_MyComputer_fnRelease
,
847 ISF_MyComputer_fnParseDisplayName
,
848 ISF_MyComputer_fnEnumObjects
,
849 ISF_MyComputer_fnBindToObject
,
850 ISF_MyComputer_fnBindToStorage
,
851 ISF_MyComputer_fnCompareIDs
,
852 ISF_MyComputer_fnCreateViewObject
,
853 ISF_MyComputer_fnGetAttributesOf
,
854 ISF_MyComputer_fnGetUIObjectOf
,
855 ISF_MyComputer_fnGetDisplayNameOf
,
856 ISF_MyComputer_fnSetNameOf
,
858 ISF_MyComputer_fnGetDefaultSearchGUID
,
859 ISF_MyComputer_fnEnumSearches
,
860 ISF_MyComputer_fnGetDefaultColumn
,
861 ISF_MyComputer_fnGetDefaultColumnState
,
862 ISF_MyComputer_fnGetDetailsEx
,
863 ISF_MyComputer_fnGetDetailsOf
,
864 ISF_MyComputer_fnMapColumnToSCID
867 /************************************************************************
868 * IMCFldr_PersistFolder2_QueryInterface
870 static HRESULT WINAPI
IMCFldr_PersistFolder2_QueryInterface (
871 IPersistFolder2
* iface
, REFIID iid
, LPVOID
* ppvObj
)
873 IGenericSFImpl
*This
= impl_from_IPersistFolder2(iface
);
875 TRACE ("(%p)\n", This
);
877 return IUnknown_QueryInterface (_IUnknown_ (This
), iid
, ppvObj
);
880 /************************************************************************
881 * IMCFldr_PersistFolder2_AddRef
883 static ULONG WINAPI
IMCFldr_PersistFolder2_AddRef (IPersistFolder2
* iface
)
885 IGenericSFImpl
*This
= impl_from_IPersistFolder2(iface
);
887 TRACE ("(%p)->(count=%u)\n", This
, This
->ref
);
889 return IUnknown_AddRef (_IUnknown_ (This
));
892 /************************************************************************
893 * ISFPersistFolder_Release
895 static ULONG WINAPI
IMCFldr_PersistFolder2_Release (IPersistFolder2
* iface
)
897 IGenericSFImpl
*This
= impl_from_IPersistFolder2(iface
);
899 TRACE ("(%p)->(count=%u)\n", This
, This
->ref
);
901 return IUnknown_Release (_IUnknown_ (This
));
904 /************************************************************************
905 * IMCFldr_PersistFolder2_GetClassID
907 static HRESULT WINAPI
IMCFldr_PersistFolder2_GetClassID (
908 IPersistFolder2
* iface
, CLSID
* lpClassId
)
910 IGenericSFImpl
*This
= impl_from_IPersistFolder2(iface
);
912 TRACE ("(%p)\n", This
);
916 *lpClassId
= CLSID_MyComputer
;
921 /************************************************************************
922 * IMCFldr_PersistFolder2_Initialize
924 * NOTES: it makes no sense to change the pidl
926 static HRESULT WINAPI
IMCFldr_PersistFolder2_Initialize (
927 IPersistFolder2
* iface
, LPCITEMIDLIST pidl
)
929 IGenericSFImpl
*This
= impl_from_IPersistFolder2(iface
);
930 TRACE ("(%p)->(%p)\n", This
, pidl
);
934 /**************************************************************************
935 * IPersistFolder2_fnGetCurFolder
937 static HRESULT WINAPI
IMCFldr_PersistFolder2_GetCurFolder (
938 IPersistFolder2
* iface
, LPITEMIDLIST
* pidl
)
940 IGenericSFImpl
*This
= impl_from_IPersistFolder2(iface
);
942 TRACE ("(%p)->(%p)\n", This
, pidl
);
946 *pidl
= ILClone (This
->pidlRoot
);
950 static const IPersistFolder2Vtbl vt_PersistFolder2
=
952 IMCFldr_PersistFolder2_QueryInterface
,
953 IMCFldr_PersistFolder2_AddRef
,
954 IMCFldr_PersistFolder2_Release
,
955 IMCFldr_PersistFolder2_GetClassID
,
956 IMCFldr_PersistFolder2_Initialize
,
957 IMCFldr_PersistFolder2_GetCurFolder