3 * Virtual Workplace 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
24 #include "wine/port.h"
32 #define NONAMELESSUNION
33 #define NONAMELESSSTRUCT
43 #include "enumidlist.h"
44 #include "undocshell.h"
45 #include "shell32_main.h"
48 #include "shellfolder.h"
49 #include "wine/debug.h"
53 WINE_DEFAULT_DEBUG_CHANNEL (shell
);
55 /***********************************************************************
56 * IShellFolder implementation
60 IShellFolder2Vtbl
*lpVtbl
;
62 IPersistFolder2Vtbl
*lpVtblPersistFolder2
;
64 /* both paths are parsible from the desktop */
65 LPITEMIDLIST pidlRoot
; /* absolute pidl */
66 int dwAttributes
; /* attributes returned by GetAttributesOf FIXME: use it */
69 static struct IShellFolder2Vtbl vt_ShellFolder2
;
70 static struct IPersistFolder2Vtbl vt_PersistFolder2
;
72 #define _IPersistFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpVtblPersistFolder2)))
73 #define _ICOM_THIS_From_IPersistFolder2(class, name) class* This = (class*)(((char*)name)-_IPersistFolder2_Offset);
76 converts This to a 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 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
= (IGenericSFImpl
*) LocalAlloc (GMEM_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
))) {
123 IUnknown_Release (_IUnknown_ (sf
));
124 return E_NOINTERFACE
;
127 TRACE ("--(%p)\n", sf
);
131 /**************************************************************************
132 * ISF_MyComputer_fnQueryInterface
134 * NOTES supports not IPersist/IPersistFolder
136 static HRESULT WINAPI
ISF_MyComputer_fnQueryInterface (IShellFolder2
* iface
, REFIID riid
, LPVOID
* ppvObj
)
138 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
140 TRACE ("(%p)->(%s,%p)\n", This
, shdebugstr_guid (riid
), ppvObj
);
144 if (IsEqualIID (riid
, &IID_IUnknown
) ||
145 IsEqualIID (riid
, &IID_IShellFolder
) || IsEqualIID (riid
, &IID_IShellFolder2
)) {
147 } else if (IsEqualIID (riid
, &IID_IPersist
) ||
148 IsEqualIID (riid
, &IID_IPersistFolder
) || IsEqualIID (riid
, &IID_IPersistFolder2
)) {
149 *ppvObj
= _IPersistFolder2_ (This
);
153 IUnknown_AddRef ((IUnknown
*) (*ppvObj
));
154 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj
, *ppvObj
);
157 TRACE ("-- Interface: E_NOINTERFACE\n");
158 return E_NOINTERFACE
;
161 static ULONG WINAPI
ISF_MyComputer_fnAddRef (IShellFolder2
* iface
)
163 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
165 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
167 return ++(This
->ref
);
170 static ULONG WINAPI
ISF_MyComputer_fnRelease (IShellFolder2
* iface
)
172 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
174 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
176 if (!--(This
->ref
)) {
177 TRACE ("-- destroying IShellFolder(%p)\n", This
);
179 SHFree (This
->pidlRoot
);
180 LocalFree ((HLOCAL
) This
);
186 /**************************************************************************
187 * ISF_MyComputer_fnParseDisplayName
189 static HRESULT WINAPI
190 ISF_MyComputer_fnParseDisplayName (IShellFolder2
* iface
,
193 LPOLESTR lpszDisplayName
,
194 DWORD
* pchEaten
, LPITEMIDLIST
* ppidl
, DWORD
* pdwAttributes
)
196 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
198 HRESULT hr
= E_INVALIDARG
;
199 LPCWSTR szNext
= NULL
;
200 WCHAR szElement
[MAX_PATH
];
201 LPITEMIDLIST pidlTemp
= NULL
;
204 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
205 This
, hwndOwner
, pbc
, lpszDisplayName
, debugstr_w (lpszDisplayName
), pchEaten
, ppidl
, pdwAttributes
);
209 *pchEaten
= 0; /* strange but like the original */
211 /* handle CLSID paths */
212 if (lpszDisplayName
[0] == ':' && lpszDisplayName
[1] == ':') {
213 szNext
= GetNextElementW (lpszDisplayName
, szElement
, MAX_PATH
);
214 TRACE ("-- element: %s\n", debugstr_w (szElement
));
215 SHCLSIDFromStringW (szElement
+ 2, &clsid
);
216 pidlTemp
= _ILCreateGuid (PT_GUID
, &clsid
);
218 /* do we have an absolute path name ? */
219 else if (PathGetDriveNumberW (lpszDisplayName
) >= 0 && lpszDisplayName
[2] == (WCHAR
) '\\') {
220 szNext
= GetNextElementW (lpszDisplayName
, szElement
, MAX_PATH
);
221 szElement
[0] = toupper(szElement
[0]); /* make drive letter uppercase to enable PIDL comparison */
222 pidlTemp
= _ILCreateDrive (szElement
);
225 if (szNext
&& *szNext
) {
226 hr
= SHELL32_ParseNextElement (iface
, hwndOwner
, pbc
, &pidlTemp
, (LPOLESTR
) szNext
, pchEaten
, pdwAttributes
);
228 if (pdwAttributes
&& *pdwAttributes
) {
229 SHELL32_GetItemAttributes (_IShellFolder_ (This
), pidlTemp
, pdwAttributes
);
236 TRACE ("(%p)->(-- ret=0x%08lx)\n", This
, hr
);
241 /**************************************************************************
242 * CreateMyCompEnumList()
244 static BOOL
CreateMyCompEnumList(IEnumIDList
*list
, DWORD dwFlags
)
248 TRACE("(%p)->(flags=0x%08lx) \n",list
,dwFlags
);
250 /*enumerate the folders*/
251 if(dwFlags
& SHCONTF_FOLDERS
)
253 WCHAR wszDriveName
[] = {'A', ':', '\\', '\0'};
254 DWORD dwDrivemap
= GetLogicalDrives();
257 while (ret
&& wszDriveName
[0]<='Z')
259 if(dwDrivemap
& 0x00000001L
)
260 ret
= AddToEnumList(list
, _ILCreateDrive(wszDriveName
));
262 dwDrivemap
= dwDrivemap
>> 1;
265 TRACE("-- (%p)-> enumerate (mycomputer shell extensions)\n",list
);
266 if (ret
&& !RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
267 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\explorer\\mycomputer\\NameSpace",
275 DWORD size
= sizeof (iid
);
276 LONG apiRet
= RegEnumKeyExA(hkey
, i
, iid
, &size
, 0, NULL
, NULL
,
279 if (ERROR_SUCCESS
== apiRet
)
281 /* FIXME: shell extensions, shouldn't the type be
283 ret
= AddToEnumList(list
, _ILCreateGuidFromStrA(iid
));
286 else if (ERROR_NO_MORE_ITEMS
== apiRet
)
297 /**************************************************************************
298 * ISF_MyComputer_fnEnumObjects
300 static HRESULT WINAPI
301 ISF_MyComputer_fnEnumObjects (IShellFolder2
* iface
, HWND hwndOwner
, DWORD dwFlags
, LPENUMIDLIST
* ppEnumIDList
)
303 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
305 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This
, hwndOwner
, dwFlags
, ppEnumIDList
);
307 *ppEnumIDList
= IEnumIDList_Constructor();
309 CreateMyCompEnumList(*ppEnumIDList
, dwFlags
);
311 TRACE ("-- (%p)->(new ID List: %p)\n", This
, *ppEnumIDList
);
313 return (*ppEnumIDList
) ? S_OK
: E_OUTOFMEMORY
;
316 /**************************************************************************
317 * ISF_MyComputer_fnBindToObject
319 static HRESULT WINAPI
320 ISF_MyComputer_fnBindToObject (IShellFolder2
* iface
, LPCITEMIDLIST pidl
,
321 LPBC pbcReserved
, REFIID riid
, LPVOID
* ppvOut
)
323 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
325 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This
, pidl
, pbcReserved
, shdebugstr_guid (riid
), ppvOut
);
327 return SHELL32_BindToChild (This
->pidlRoot
, NULL
, pidl
, riid
, ppvOut
);
330 /**************************************************************************
331 * ISF_MyComputer_fnBindToStorage
333 static HRESULT WINAPI
334 ISF_MyComputer_fnBindToStorage (IShellFolder2
* iface
,
335 LPCITEMIDLIST pidl
, LPBC pbcReserved
, REFIID riid
, LPVOID
* ppvOut
)
337 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
339 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This
, pidl
, pbcReserved
, shdebugstr_guid (riid
), ppvOut
);
345 /**************************************************************************
346 * ISF_MyComputer_fnCompareIDs
349 static HRESULT WINAPI
350 ISF_MyComputer_fnCompareIDs (IShellFolder2
* iface
, LPARAM lParam
, LPCITEMIDLIST pidl1
, LPCITEMIDLIST pidl2
)
352 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
356 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This
, lParam
, pidl1
, pidl2
);
357 nReturn
= SHELL32_CompareIDs (_IShellFolder_ (This
), lParam
, pidl1
, pidl2
);
358 TRACE ("-- %i\n", nReturn
);
362 /**************************************************************************
363 * ISF_MyComputer_fnCreateViewObject
365 static HRESULT WINAPI
366 ISF_MyComputer_fnCreateViewObject (IShellFolder2
* iface
, HWND hwndOwner
, REFIID riid
, LPVOID
* ppvOut
)
368 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
370 LPSHELLVIEW pShellView
;
371 HRESULT hr
= E_INVALIDARG
;
373 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This
, hwndOwner
, shdebugstr_guid (riid
), ppvOut
);
378 if (IsEqualIID (riid
, &IID_IDropTarget
)) {
379 WARN ("IDropTarget not implemented\n");
381 } else if (IsEqualIID (riid
, &IID_IContextMenu
)) {
382 WARN ("IContextMenu not implemented\n");
384 } else if (IsEqualIID (riid
, &IID_IShellView
)) {
385 pShellView
= IShellView_Constructor ((IShellFolder
*) iface
);
387 hr
= IShellView_QueryInterface (pShellView
, riid
, ppvOut
);
388 IShellView_Release (pShellView
);
392 TRACE ("-- (%p)->(interface=%p)\n", This
, ppvOut
);
396 /**************************************************************************
397 * ISF_MyComputer_fnGetAttributesOf
399 static HRESULT WINAPI
400 ISF_MyComputer_fnGetAttributesOf (IShellFolder2
* iface
, UINT cidl
, LPCITEMIDLIST
* apidl
, DWORD
* rgfInOut
)
402 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
406 TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This
, cidl
, apidl
, *rgfInOut
);
408 if ((!cidl
) || (!apidl
) || (!rgfInOut
))
414 while (cidl
> 0 && *apidl
) {
416 SHELL32_GetItemAttributes (_IShellFolder_ (This
), *apidl
, rgfInOut
);
421 TRACE ("-- result=0x%08lx\n", *rgfInOut
);
425 /**************************************************************************
426 * ISF_MyComputer_fnGetUIObjectOf
429 * HWND hwndOwner, //[in ] Parent window for any output
430 * UINT cidl, //[in ] array size
431 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
432 * REFIID riid, //[in ] Requested Interface
433 * UINT* prgfInOut, //[ ] reserved
434 * LPVOID* ppvObject) //[out] Resulting Interface
437 static HRESULT WINAPI
438 ISF_MyComputer_fnGetUIObjectOf (IShellFolder2
* iface
,
440 UINT cidl
, LPCITEMIDLIST
* apidl
, REFIID riid
, UINT
* prgfInOut
, LPVOID
* ppvOut
)
442 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
445 IUnknown
*pObj
= NULL
;
446 HRESULT hr
= E_INVALIDARG
;
448 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
449 This
, hwndOwner
, cidl
, apidl
, shdebugstr_guid (riid
), prgfInOut
, ppvOut
);
454 if (IsEqualIID (riid
, &IID_IContextMenu
) && (cidl
>= 1)) {
455 pObj
= (LPUNKNOWN
) ISvItemCm_Constructor ((IShellFolder
*) iface
, This
->pidlRoot
, apidl
, cidl
);
457 } else if (IsEqualIID (riid
, &IID_IDataObject
) && (cidl
>= 1)) {
458 pObj
= (LPUNKNOWN
) IDataObject_Constructor (hwndOwner
, This
->pidlRoot
, apidl
, cidl
);
460 } else if (IsEqualIID (riid
, &IID_IExtractIconA
) && (cidl
== 1)) {
461 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
462 pObj
= (LPUNKNOWN
) IExtractIconA_Constructor (pidl
);
465 } else if (IsEqualIID (riid
, &IID_IExtractIconW
) && (cidl
== 1)) {
466 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
467 pObj
= (LPUNKNOWN
) IExtractIconW_Constructor (pidl
);
470 } else if (IsEqualIID (riid
, &IID_IDropTarget
) && (cidl
>= 1)) {
471 hr
= IShellFolder_QueryInterface (iface
, &IID_IDropTarget
, (LPVOID
*) & pObj
);
472 } else if ((IsEqualIID(riid
,&IID_IShellLinkW
) || IsEqualIID(riid
,&IID_IShellLinkA
))
474 pidl
= ILCombine (This
->pidlRoot
, apidl
[0]);
475 hr
= IShellLink_ConstructFromFile(NULL
, riid
, pidl
, (LPVOID
*)&pObj
);
481 if (SUCCEEDED(hr
) && !pObj
)
486 TRACE ("(%p)->hr=0x%08lx\n", This
, hr
);
490 /**************************************************************************
491 * ISF_MyComputer_fnGetDisplayNameOf
493 static HRESULT WINAPI
ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2
* iface
, LPCITEMIDLIST pidl
, DWORD dwFlags
, LPSTRRET strRet
)
495 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
497 char szPath
[MAX_PATH
],
503 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This
, pidl
, dwFlags
, strRet
);
512 bSimplePidl
= _ILIsPidlSimple (pidl
);
514 if (!pidl
->mkid
.cb
) {
515 /* parsing name like ::{...} */
516 lstrcpyA (szPath
, "::");
517 SHELL32_GUIDToStringA(&CLSID_MyComputer
, &szPath
[2]);
518 } else if (_ILIsSpecialFolder (pidl
)) {
519 /* take names of special folders only if its only this folder */
523 if ((clsid
= _ILGetGUIDPointer (pidl
))) {
524 if (GET_SHGDN_FOR (dwFlags
) == SHGDN_FORPARSING
) {
525 int bWantsForParsing
;
528 * we can only get a filesystem path from a shellfolder if the value WantsFORPARSING in
529 * CLSID\\{...}\\shellfolder exists
530 * exception: the MyComputer folder has this keys not but like any filesystem backed
531 * folder it needs these behaviour
533 /* get the "WantsFORPARSING" flag from the registry */
536 lstrcpyA (szRegPath
, "CLSID\\");
537 SHELL32_GUIDToStringA (clsid
, &szRegPath
[6]);
538 lstrcatA (szRegPath
, "\\shellfolder");
541 SHGetValueA (HKEY_CLASSES_ROOT
, szRegPath
, "WantsFORPARSING", NULL
, NULL
, NULL
));
543 if ((GET_SHGDN_RELATION (dwFlags
) == SHGDN_NORMAL
) && bWantsForParsing
) {
544 /* we need the filesystem path to the destination folder. Only the folder itself can know it */
545 hr
= SHELL32_GetDisplayNameOfChild (iface
, pidl
, dwFlags
, szPath
, MAX_PATH
);
549 /* parsing name like ::{...} */
550 p
= lstrcpyA(szPath
, "::") + 2;
551 p
+= SHELL32_GUIDToStringA(&CLSID_MyComputer
, p
);
555 SHELL32_GUIDToStringA(clsid
, p
);
558 /* user friendly name */
559 HCR_GetClassNameA (clsid
, szPath
, MAX_PATH
);
562 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
); /* append my own path */
564 FIXME ("special folder\n");
567 if (!_ILIsDrive (pidl
)) {
568 ERR ("Wrong pidl type\n");
572 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
); /* append my own path */
574 /* long view "lw_name (C:)" */
575 if (bSimplePidl
&& !(dwFlags
& SHGDN_FORPARSING
)) {
576 DWORD dwVolumeSerialNumber
,
577 dwMaximumComponetLength
,
580 GetVolumeInformationA (szPath
, szDrive
, sizeof (szDrive
) - 6, &dwVolumeSerialNumber
,
581 &dwMaximumComponetLength
, &dwFileSystemFlags
, NULL
, 0);
582 strcat (szDrive
, " (");
583 strncat (szDrive
, szPath
, 2);
584 strcat (szDrive
, ")");
585 strcpy (szPath
, szDrive
);
589 if (!bSimplePidl
) { /* go deeper if needed */
590 PathAddBackslashA (szPath
);
591 len
= strlen (szPath
);
593 hr
= SHELL32_GetDisplayNameOfChild (iface
, pidl
, dwFlags
| SHGDN_INFOLDER
, szPath
+ len
, MAX_PATH
- len
);
596 if (SUCCEEDED (hr
)) {
597 strRet
->uType
= STRRET_CSTR
;
598 lstrcpynA (strRet
->u
.cStr
, szPath
, MAX_PATH
);
601 TRACE ("-- (%p)->(%s)\n", This
, szPath
);
605 /**************************************************************************
606 * ISF_MyComputer_fnSetNameOf
607 * Changes the name of a file object or subfolder, possibly changing its item
608 * identifier in the process.
611 * HWND hwndOwner, //[in ] Owner window for output
612 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
613 * LPCOLESTR lpszName, //[in ] the items new display name
614 * DWORD dwFlags, //[in ] SHGNO formatting flags
615 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
617 static HRESULT WINAPI
ISF_MyComputer_fnSetNameOf (IShellFolder2
* iface
, HWND hwndOwner
, LPCITEMIDLIST pidl
, /*simple pidl */
618 LPCOLESTR lpName
, DWORD dwFlags
, LPITEMIDLIST
* pPidlOut
)
620 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
621 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This
, hwndOwner
, pidl
, debugstr_w (lpName
), dwFlags
, pPidlOut
);
625 static HRESULT WINAPI
ISF_MyComputer_fnGetDefaultSearchGUID (IShellFolder2
* iface
, GUID
* pguid
)
627 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
628 FIXME ("(%p)\n", This
);
631 static HRESULT WINAPI
ISF_MyComputer_fnEnumSearches (IShellFolder2
* iface
, IEnumExtraSearch
** ppenum
)
633 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
634 FIXME ("(%p)\n", This
);
637 static HRESULT WINAPI
ISF_MyComputer_fnGetDefaultColumn (IShellFolder2
* iface
, DWORD dwRes
, ULONG
* pSort
, ULONG
* pDisplay
)
639 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
641 TRACE ("(%p)\n", This
);
643 if (pSort
) *pSort
= 0;
644 if (pDisplay
) *pDisplay
= 0;
647 static HRESULT WINAPI
ISF_MyComputer_fnGetDefaultColumnState (IShellFolder2
* iface
, UINT iColumn
, DWORD
* pcsFlags
)
649 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
651 TRACE ("(%p)\n", This
);
653 if (!pcsFlags
|| iColumn
>= MYCOMPUTERSHELLVIEWCOLUMNS
) return E_INVALIDARG
;
654 *pcsFlags
= MyComputerSFHeader
[iColumn
].pcsFlags
;
657 static HRESULT WINAPI
ISF_MyComputer_fnGetDetailsEx (IShellFolder2
* iface
, LPCITEMIDLIST pidl
, const SHCOLUMNID
* pscid
, VARIANT
* pv
)
659 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
660 FIXME ("(%p)\n", This
);
664 /* FIXME: drive size >4GB is rolling over */
665 static HRESULT WINAPI
ISF_MyComputer_fnGetDetailsOf (IShellFolder2
* iface
, LPCITEMIDLIST pidl
, UINT iColumn
, SHELLDETAILS
* psd
)
667 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
670 TRACE ("(%p)->(%p %i %p)\n", This
, pidl
, iColumn
, psd
);
672 if (!psd
|| iColumn
>= MYCOMPUTERSHELLVIEWCOLUMNS
)
676 psd
->fmt
= MyComputerSFHeader
[iColumn
].fmt
;
677 psd
->cxChar
= MyComputerSFHeader
[iColumn
].cxChar
;
678 psd
->str
.uType
= STRRET_CSTR
;
679 LoadStringA (shell32_hInstance
, MyComputerSFHeader
[iColumn
].colnameid
, psd
->str
.u
.cStr
, MAX_PATH
);
682 char szPath
[MAX_PATH
];
683 ULARGE_INTEGER ulBytes
;
685 psd
->str
.u
.cStr
[0] = 0x00;
686 psd
->str
.uType
= STRRET_CSTR
;
689 hr
= IShellFolder_GetDisplayNameOf (iface
, pidl
, SHGDN_NORMAL
| SHGDN_INFOLDER
, &psd
->str
);
692 _ILGetFileType (pidl
, psd
->str
.u
.cStr
, MAX_PATH
);
694 case 2: /* total size */
695 if (_ILIsDrive (pidl
)) {
696 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
);
697 GetDiskFreeSpaceExA (szPath
, NULL
, &ulBytes
, NULL
);
698 StrFormatByteSizeA (ulBytes
.u
.LowPart
, psd
->str
.u
.cStr
, MAX_PATH
);
701 case 3: /* free size */
702 if (_ILIsDrive (pidl
)) {
703 _ILSimpleGetText (pidl
, szPath
, MAX_PATH
);
704 GetDiskFreeSpaceExA (szPath
, &ulBytes
, NULL
, NULL
);
705 StrFormatByteSizeA (ulBytes
.u
.LowPart
, psd
->str
.u
.cStr
, MAX_PATH
);
714 static HRESULT WINAPI
ISF_MyComputer_fnMapColumnToSCID (IShellFolder2
* iface
, UINT column
, SHCOLUMNID
* pscid
)
716 IGenericSFImpl
*This
= (IGenericSFImpl
*)iface
;
717 FIXME ("(%p)\n", This
);
721 static IShellFolder2Vtbl vt_ShellFolder2
=
723 ISF_MyComputer_fnQueryInterface
,
724 ISF_MyComputer_fnAddRef
,
725 ISF_MyComputer_fnRelease
,
726 ISF_MyComputer_fnParseDisplayName
,
727 ISF_MyComputer_fnEnumObjects
,
728 ISF_MyComputer_fnBindToObject
,
729 ISF_MyComputer_fnBindToStorage
,
730 ISF_MyComputer_fnCompareIDs
,
731 ISF_MyComputer_fnCreateViewObject
,
732 ISF_MyComputer_fnGetAttributesOf
,
733 ISF_MyComputer_fnGetUIObjectOf
,
734 ISF_MyComputer_fnGetDisplayNameOf
,
735 ISF_MyComputer_fnSetNameOf
,
737 ISF_MyComputer_fnGetDefaultSearchGUID
,
738 ISF_MyComputer_fnEnumSearches
,
739 ISF_MyComputer_fnGetDefaultColumn
,
740 ISF_MyComputer_fnGetDefaultColumnState
,
741 ISF_MyComputer_fnGetDetailsEx
,
742 ISF_MyComputer_fnGetDetailsOf
,
743 ISF_MyComputer_fnMapColumnToSCID
746 /************************************************************************
747 * IMCFldr_PersistFolder2_QueryInterface
749 static HRESULT WINAPI
IMCFldr_PersistFolder2_QueryInterface (IPersistFolder2
* iface
, REFIID iid
, LPVOID
* ppvObj
)
751 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl
, iface
);
753 TRACE ("(%p)\n", This
);
755 return IUnknown_QueryInterface (_IUnknown_ (This
), iid
, ppvObj
);
758 /************************************************************************
759 * IMCFldr_PersistFolder2_AddRef
761 static ULONG WINAPI
IMCFldr_PersistFolder2_AddRef (IPersistFolder2
* iface
)
763 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl
, iface
);
765 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
767 return IUnknown_AddRef (_IUnknown_ (This
));
770 /************************************************************************
771 * ISFPersistFolder_Release
773 static ULONG WINAPI
IMCFldr_PersistFolder2_Release (IPersistFolder2
* iface
)
775 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl
, iface
);
777 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
779 return IUnknown_Release (_IUnknown_ (This
));
782 /************************************************************************
783 * IMCFldr_PersistFolder2_GetClassID
785 static HRESULT WINAPI
IMCFldr_PersistFolder2_GetClassID (IPersistFolder2
* iface
, CLSID
* lpClassId
)
787 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl
, iface
);
789 TRACE ("(%p)\n", This
);
793 *lpClassId
= CLSID_MyComputer
;
798 /************************************************************************
799 * IMCFldr_PersistFolder2_Initialize
801 * NOTES: it makes no sense to change the pidl
803 static HRESULT WINAPI
IMCFldr_PersistFolder2_Initialize (IPersistFolder2
* iface
, LPCITEMIDLIST pidl
)
805 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl
, iface
);
806 TRACE ("(%p)->(%p)\n", This
, pidl
);
810 /**************************************************************************
811 * IPersistFolder2_fnGetCurFolder
813 static HRESULT WINAPI
IMCFldr_PersistFolder2_GetCurFolder (IPersistFolder2
* iface
, LPITEMIDLIST
* pidl
)
815 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl
, iface
);
817 TRACE ("(%p)->(%p)\n", This
, pidl
);
821 *pidl
= ILClone (This
->pidlRoot
);
825 static IPersistFolder2Vtbl vt_PersistFolder2
=
827 IMCFldr_PersistFolder2_QueryInterface
,
828 IMCFldr_PersistFolder2_AddRef
,
829 IMCFldr_PersistFolder2_Release
,
830 IMCFldr_PersistFolder2_GetClassID
,
831 IMCFldr_PersistFolder2_Initialize
,
832 IMCFldr_PersistFolder2_GetCurFolder