Release 20030408.
[wine/gsoc-2012-control.git] / dlls / shell32 / shfldr_mycomp.c
blob4a98429ad6a5a7f8cdf9b2a31f096ce36a30b613
2 /*
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
23 #include "config.h"
24 #include "wine/port.h"
26 #include <stdlib.h>
27 #include <string.h>
28 #include <stdio.h>
30 #define NONAMELESSUNION
31 #define NONAMELESSSTRUCT
32 #include "winerror.h"
33 #include "winbase.h"
34 #include "winreg.h"
36 #include "pidl.h"
37 #include "shlguid.h"
39 #include "undocshell.h"
40 #include "shell32_main.h"
41 #include "shresdef.h"
42 #include "shlwapi.h"
43 #include "shellfolder.h"
44 #include "wine/debug.h"
45 #include "debughlp.h"
46 #include "shfldr.h"
48 WINE_DEFAULT_DEBUG_CHANNEL (shell);
50 /***********************************************************************
51 * IShellFolder implementation
54 typedef struct {
55 ICOM_VFIELD (IShellFolder2);
56 DWORD ref;
57 ICOM_VTABLE (IPersistFolder2) * lpVtblPersistFolder2;
59 /* both paths are parsible from the desktop */
60 LPITEMIDLIST pidlRoot; /* absolute pidl */
61 int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */
62 } IGenericSFImpl;
64 static struct ICOM_VTABLE (IShellFolder2) vt_ShellFolder2;
65 static struct ICOM_VTABLE (IPersistFolder2) vt_PersistFolder2;
67 HRESULT WINAPI ISF_MyComputer_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
69 #define _IPersistFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpVtblPersistFolder2)))
70 #define _ICOM_THIS_From_IPersistFolder2(class, name) class* This = (class*)(((char*)name)-_IPersistFolder2_Offset);
73 converts This to a interface pointer
75 #define _IUnknown_(This) (IUnknown*)&(This->lpVtbl)
76 #define _IShellFolder_(This) (IShellFolder*)&(This->lpVtbl)
77 #define _IShellFolder2_(This) (IShellFolder2*)&(This->lpVtbl)
79 #define _IPersist_(This) (IPersist*)&(This->lpVtblPersistFolder2)
80 #define _IPersistFolder_(This) (IPersistFolder*)&(This->lpVtblPersistFolder2)
81 #define _IPersistFolder2_(This) (IPersistFolder2*)&(This->lpVtblPersistFolder2)
83 /***********************************************************************
84 * IShellFolder [MyComputer] implementation
87 static shvheader MyComputerSFHeader[] = {
88 {IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
89 {IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
90 {IDS_SHV_COLUMN6, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
91 {IDS_SHV_COLUMN7, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
94 #define MYCOMPUTERSHELLVIEWCOLUMNS 4
96 /**************************************************************************
97 * ISF_MyComputer_Constructor
99 HRESULT WINAPI ISF_MyComputer_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
101 IGenericSFImpl *sf;
103 TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
105 if (!ppv)
106 return E_POINTER;
107 if (pUnkOuter)
108 return CLASS_E_NOAGGREGATION;
110 sf = (IGenericSFImpl *) LocalAlloc (GMEM_ZEROINIT, sizeof (IGenericSFImpl));
111 if (!sf)
112 return E_OUTOFMEMORY;
114 sf->ref = 0;
115 ICOM_VTBL (sf) = &vt_ShellFolder2;
116 sf->lpVtblPersistFolder2 = &vt_PersistFolder2;
117 sf->pidlRoot = _ILCreateMyComputer (); /* my qualified pidl */
119 if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv))) {
120 IUnknown_Release (_IUnknown_ (sf));
121 return E_NOINTERFACE;
124 TRACE ("--(%p)\n", sf);
125 return S_OK;
128 /**************************************************************************
129 * ISF_MyComputer_fnQueryInterface
131 * NOTES supports not IPersist/IPersistFolder
133 static HRESULT WINAPI ISF_MyComputer_fnQueryInterface (IShellFolder2 * iface, REFIID riid, LPVOID * ppvObj)
135 ICOM_THIS (IGenericSFImpl, iface);
137 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
139 *ppvObj = NULL;
141 if (IsEqualIID (riid, &IID_IUnknown) ||
142 IsEqualIID (riid, &IID_IShellFolder) || IsEqualIID (riid, &IID_IShellFolder2)) {
143 *ppvObj = This;
144 } else if (IsEqualIID (riid, &IID_IPersist) ||
145 IsEqualIID (riid, &IID_IPersistFolder) || IsEqualIID (riid, &IID_IPersistFolder2)) {
146 *ppvObj = _IPersistFolder2_ (This);
149 if (*ppvObj) {
150 IUnknown_AddRef ((IUnknown *) (*ppvObj));
151 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
152 return S_OK;
154 TRACE ("-- Interface: E_NOINTERFACE\n");
155 return E_NOINTERFACE;
158 static ULONG WINAPI ISF_MyComputer_fnAddRef (IShellFolder2 * iface)
160 ICOM_THIS (IGenericSFImpl, iface);
162 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
164 return ++(This->ref);
167 static ULONG WINAPI ISF_MyComputer_fnRelease (IShellFolder2 * iface)
169 ICOM_THIS (IGenericSFImpl, iface);
171 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
173 if (!--(This->ref)) {
174 TRACE ("-- destroying IShellFolder(%p)\n", This);
175 if (This->pidlRoot)
176 SHFree (This->pidlRoot);
177 LocalFree ((HLOCAL) This);
178 return 0;
180 return This->ref;
183 /**************************************************************************
184 * ISF_MyComputer_fnParseDisplayName
186 static HRESULT WINAPI
187 ISF_MyComputer_fnParseDisplayName (IShellFolder2 * iface,
188 HWND hwndOwner,
189 LPBC pbcReserved,
190 LPOLESTR lpszDisplayName,
191 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
193 ICOM_THIS (IGenericSFImpl, iface);
195 HRESULT hr = E_OUTOFMEMORY;
196 LPCWSTR szNext = NULL;
197 WCHAR szElement[MAX_PATH];
198 CHAR szTempA[MAX_PATH];
199 LPITEMIDLIST pidlTemp;
201 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
202 This, hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName), pchEaten, ppidl, pdwAttributes);
204 *ppidl = 0;
205 if (pchEaten)
206 *pchEaten = 0; /* strange but like the original */
208 /* do we have an absolute path name ? */
209 if (PathGetDriveNumberW (lpszDisplayName) >= 0 && lpszDisplayName[2] == (WCHAR) '\\') {
210 szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
211 WideCharToMultiByte (CP_ACP, 0, szElement, -1, szTempA, MAX_PATH, NULL, NULL);
212 pidlTemp = _ILCreateDrive (szTempA);
214 if (szNext && *szNext) {
215 hr = SHELL32_ParseNextElement (hwndOwner, iface, &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
216 } else {
217 if (pdwAttributes && *pdwAttributes) {
218 SHELL32_GetItemAttributes (_IShellFolder_ (This), pidlTemp, pdwAttributes);
220 hr = S_OK;
222 *ppidl = pidlTemp;
225 TRACE ("(%p)->(-- ret=0x%08lx)\n", This, hr);
227 return hr;
230 /**************************************************************************
231 * ISF_MyComputer_fnEnumObjects
233 static HRESULT WINAPI
234 ISF_MyComputer_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
236 ICOM_THIS (IGenericSFImpl, iface);
238 TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
240 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_MYCOMP);
242 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
244 return (*ppEnumIDList) ? S_OK : E_OUTOFMEMORY;
247 /**************************************************************************
248 * ISF_MyComputer_fnBindToObject
250 static HRESULT WINAPI
251 ISF_MyComputer_fnBindToObject (IShellFolder2 * iface, LPCITEMIDLIST pidl,
252 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
254 ICOM_THIS (IGenericSFImpl, iface);
256 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
258 return SHELL32_BindToChild (This->pidlRoot, NULL, pidl, riid, ppvOut);
261 /**************************************************************************
262 * ISF_MyComputer_fnBindToStorage
264 static HRESULT WINAPI
265 ISF_MyComputer_fnBindToStorage (IShellFolder2 * iface,
266 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
268 ICOM_THIS (IGenericSFImpl, iface);
270 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
272 *ppvOut = NULL;
273 return E_NOTIMPL;
276 /**************************************************************************
277 * ISF_MyComputer_fnCompareIDs
280 static HRESULT WINAPI
281 ISF_MyComputer_fnCompareIDs (IShellFolder2 * iface, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
283 ICOM_THIS (IGenericSFImpl, iface);
285 int nReturn;
287 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
288 nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
289 TRACE ("-- %i\n", nReturn);
290 return nReturn;
293 /**************************************************************************
294 * ISF_MyComputer_fnCreateViewObject
296 static HRESULT WINAPI
297 ISF_MyComputer_fnCreateViewObject (IShellFolder2 * iface, HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
299 ICOM_THIS (IGenericSFImpl, iface);
301 LPSHELLVIEW pShellView;
302 HRESULT hr = E_INVALIDARG;
304 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This, hwndOwner, shdebugstr_guid (riid), ppvOut);
306 if (ppvOut) {
307 *ppvOut = NULL;
309 if (IsEqualIID (riid, &IID_IDropTarget)) {
310 WARN ("IDropTarget not implemented\n");
311 hr = E_NOTIMPL;
312 } else if (IsEqualIID (riid, &IID_IContextMenu)) {
313 WARN ("IContextMenu not implemented\n");
314 hr = E_NOTIMPL;
315 } else if (IsEqualIID (riid, &IID_IShellView)) {
316 pShellView = IShellView_Constructor ((IShellFolder *) iface);
317 if (pShellView) {
318 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
319 IShellView_Release (pShellView);
323 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
324 return hr;
327 /**************************************************************************
328 * ISF_MyComputer_fnGetAttributesOf
330 static HRESULT WINAPI
331 ISF_MyComputer_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
333 ICOM_THIS (IGenericSFImpl, iface);
335 HRESULT hr = S_OK;
337 TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This, cidl, apidl, *rgfInOut);
339 if ((!cidl) || (!apidl) || (!rgfInOut))
340 return E_INVALIDARG;
342 while (cidl > 0 && *apidl) {
343 pdump (*apidl);
344 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
345 apidl++;
346 cidl--;
349 TRACE ("-- result=0x%08lx\n", *rgfInOut);
350 return hr;
353 /**************************************************************************
354 * ISF_MyComputer_fnGetUIObjectOf
356 * PARAMETERS
357 * HWND hwndOwner, //[in ] Parent window for any output
358 * UINT cidl, //[in ] array size
359 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
360 * REFIID riid, //[in ] Requested Interface
361 * UINT* prgfInOut, //[ ] reserved
362 * LPVOID* ppvObject) //[out] Resulting Interface
365 static HRESULT WINAPI
366 ISF_MyComputer_fnGetUIObjectOf (IShellFolder2 * iface,
367 HWND hwndOwner,
368 UINT cidl, LPCITEMIDLIST * apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
370 ICOM_THIS (IGenericSFImpl, iface);
372 LPITEMIDLIST pidl;
373 IUnknown *pObj = NULL;
374 HRESULT hr = E_INVALIDARG;
376 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
377 This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
379 if (ppvOut) {
380 *ppvOut = NULL;
382 if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1)) {
383 pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface, This->pidlRoot, apidl, cidl);
384 hr = S_OK;
385 } else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1)) {
386 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl);
387 hr = S_OK;
388 } else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1)) {
389 pidl = ILCombine (This->pidlRoot, apidl[0]);
390 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
391 SHFree (pidl);
392 hr = S_OK;
393 } else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1)) {
394 pidl = ILCombine (This->pidlRoot, apidl[0]);
395 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
396 SHFree (pidl);
397 hr = S_OK;
398 } else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1)) {
399 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
400 } else {
401 hr = E_NOINTERFACE;
404 if (!pObj)
405 hr = E_OUTOFMEMORY;
407 *ppvOut = pObj;
409 TRACE ("(%p)->hr=0x%08lx\n", This, hr);
410 return hr;
413 /**************************************************************************
414 * ISF_MyComputer_fnGetDisplayNameOf
416 * NOTES
417 * The desktopfolder creates only complete paths (SHGDN_FORPARSING).
418 * SHGDN_INFOLDER makes no sense.
420 static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
422 ICOM_THIS (IGenericSFImpl, iface);
424 char szPath[MAX_PATH],
425 szDrive[18];
426 int len = 0;
427 BOOL bSimplePidl;
429 TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
430 pdump (pidl);
432 if (!strRet)
433 return E_INVALIDARG;
435 szPath[0] = 0x00;
436 szDrive[0] = 0x00;
438 bSimplePidl = _ILIsPidlSimple (pidl);
440 if (_ILIsSpecialFolder (pidl)) {
441 /* take names of special folders only if its only this folder */
442 if (bSimplePidl) {
443 _ILSimpleGetText (pidl, szPath, MAX_PATH); /* append my own path */
444 } else {
445 FIXME ("special folder\n");
447 } else {
448 if (!_ILIsDrive (pidl)) {
449 ERR ("Wrong pidl type\n");
450 return E_INVALIDARG;
453 _ILSimpleGetText (pidl, szPath, MAX_PATH); /* append my own path */
455 /* long view "lw_name (C:)" */
456 if (bSimplePidl && !(dwFlags & SHGDN_FORPARSING)) {
457 DWORD dwVolumeSerialNumber,
458 dwMaximumComponetLength,
459 dwFileSystemFlags;
461 GetVolumeInformationA (szPath, szDrive, sizeof (szDrive) - 6, &dwVolumeSerialNumber,
462 &dwMaximumComponetLength, &dwFileSystemFlags, NULL, 0);
463 strcat (szDrive, " (");
464 strncat (szDrive, szPath, 2);
465 strcat (szDrive, ")");
466 strcpy (szPath, szDrive);
470 if (!bSimplePidl) { /* go deeper if needed */
471 PathAddBackslashA (szPath);
472 len = strlen (szPath);
474 if (!SUCCEEDED
475 (SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags | SHGDN_INFOLDER, szPath + len, MAX_PATH - len)))
476 return E_OUTOFMEMORY;
478 strRet->uType = STRRET_CSTR;
479 lstrcpynA (strRet->u.cStr, szPath, MAX_PATH);
481 TRACE ("-- (%p)->(%s)\n", This, szPath);
482 return S_OK;
485 /**************************************************************************
486 * ISF_MyComputer_fnSetNameOf
487 * Changes the name of a file object or subfolder, possibly changing its item
488 * identifier in the process.
490 * PARAMETERS
491 * HWND hwndOwner, //[in ] Owner window for output
492 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
493 * LPCOLESTR lpszName, //[in ] the items new display name
494 * DWORD dwFlags, //[in ] SHGNO formatting flags
495 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
497 static HRESULT WINAPI ISF_MyComputer_fnSetNameOf (IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */
498 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
500 ICOM_THIS (IGenericSFImpl, iface);
501 FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
502 return E_FAIL;
505 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultSearchGUID (IShellFolder2 * iface, GUID * pguid)
507 ICOM_THIS (IGenericSFImpl, iface);
508 FIXME ("(%p)\n", This);
509 return E_NOTIMPL;
511 static HRESULT WINAPI ISF_MyComputer_fnEnumSearches (IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
513 ICOM_THIS (IGenericSFImpl, iface);
514 FIXME ("(%p)\n", This);
515 return E_NOTIMPL;
517 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumn (IShellFolder2 * iface, DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
519 ICOM_THIS (IGenericSFImpl, iface);
521 TRACE ("(%p)\n", This);
523 if (pSort) *pSort = 0;
524 if (pDisplay) *pDisplay = 0;
525 return S_OK;
527 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumnState (IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
529 ICOM_THIS (IGenericSFImpl, iface);
531 TRACE ("(%p)\n", This);
533 if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS) return E_INVALIDARG;
534 *pcsFlags = MyComputerSFHeader[iColumn].pcsFlags;
535 return S_OK;
537 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsEx (IShellFolder2 * iface, LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
539 ICOM_THIS (IGenericSFImpl, iface);
540 FIXME ("(%p)\n", This);
541 return E_NOTIMPL;
544 /* FIXME: drive size >4GB is rolling over */
545 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
547 ICOM_THIS (IGenericSFImpl, iface);
548 HRESULT hr;
550 TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
552 if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
553 return E_INVALIDARG;
555 if (!pidl) {
556 psd->fmt = MyComputerSFHeader[iColumn].fmt;
557 psd->cxChar = MyComputerSFHeader[iColumn].cxChar;
558 psd->str.uType = STRRET_CSTR;
559 LoadStringA (shell32_hInstance, MyComputerSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
560 return S_OK;
561 } else {
562 char szPath[MAX_PATH];
563 ULARGE_INTEGER ulBytes;
565 psd->str.u.cStr[0] = 0x00;
566 psd->str.uType = STRRET_CSTR;
567 switch (iColumn) {
568 case 0: /* name */
569 hr = IShellFolder_GetDisplayNameOf (iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
570 break;
571 case 1: /* type */
572 _ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
573 break;
574 case 2: /* total size */
575 if (_ILIsDrive (pidl)) {
576 _ILSimpleGetText (pidl, szPath, MAX_PATH);
577 GetDiskFreeSpaceExA (szPath, NULL, &ulBytes, NULL);
578 StrFormatByteSizeA (ulBytes.s.LowPart, psd->str.u.cStr, MAX_PATH);
580 break;
581 case 3: /* free size */
582 if (_ILIsDrive (pidl)) {
583 _ILSimpleGetText (pidl, szPath, MAX_PATH);
584 GetDiskFreeSpaceExA (szPath, &ulBytes, NULL, NULL);
585 StrFormatByteSizeA (ulBytes.s.LowPart, psd->str.u.cStr, MAX_PATH);
587 break;
589 hr = S_OK;
592 return hr;
594 static HRESULT WINAPI ISF_MyComputer_fnMapNameToSCID (IShellFolder2 * iface, LPCWSTR pwszName, SHCOLUMNID * pscid)
596 ICOM_THIS (IGenericSFImpl, iface);
597 FIXME ("(%p)\n", This);
598 return E_NOTIMPL;
601 static ICOM_VTABLE (IShellFolder2) vt_ShellFolder2 =
603 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
604 ISF_MyComputer_fnQueryInterface,
605 ISF_MyComputer_fnAddRef,
606 ISF_MyComputer_fnRelease,
607 ISF_MyComputer_fnParseDisplayName,
608 ISF_MyComputer_fnEnumObjects,
609 ISF_MyComputer_fnBindToObject,
610 ISF_MyComputer_fnBindToStorage,
611 ISF_MyComputer_fnCompareIDs,
612 ISF_MyComputer_fnCreateViewObject,
613 ISF_MyComputer_fnGetAttributesOf,
614 ISF_MyComputer_fnGetUIObjectOf,
615 ISF_MyComputer_fnGetDisplayNameOf,
616 ISF_MyComputer_fnSetNameOf,
617 /* ShellFolder2 */
618 ISF_MyComputer_fnGetDefaultSearchGUID,
619 ISF_MyComputer_fnEnumSearches,
620 ISF_MyComputer_fnGetDefaultColumn,
621 ISF_MyComputer_fnGetDefaultColumnState,
622 ISF_MyComputer_fnGetDetailsEx,
623 ISF_MyComputer_fnGetDetailsOf,
624 ISF_MyComputer_fnMapNameToSCID
627 /************************************************************************
628 * IMCFldr_PersistFolder2_QueryInterface
630 static HRESULT WINAPI IMCFldr_PersistFolder2_QueryInterface (IPersistFolder2 * iface, REFIID iid, LPVOID * ppvObj)
632 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
634 TRACE ("(%p)\n", This);
636 return IUnknown_QueryInterface (_IUnknown_ (This), iid, ppvObj);
639 /************************************************************************
640 * IMCFldr_PersistFolder2_AddRef
642 static ULONG WINAPI IMCFldr_PersistFolder2_AddRef (IPersistFolder2 * iface)
644 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
646 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
648 return IUnknown_AddRef (_IUnknown_ (This));
651 /************************************************************************
652 * ISFPersistFolder_Release
654 static ULONG WINAPI IMCFldr_PersistFolder2_Release (IPersistFolder2 * iface)
656 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
658 TRACE ("(%p)->(count=%lu)\n", This, This->ref);
660 return IUnknown_Release (_IUnknown_ (This));
663 /************************************************************************
664 * IMCFldr_PersistFolder2_GetClassID
666 static HRESULT WINAPI IMCFldr_PersistFolder2_GetClassID (IPersistFolder2 * iface, CLSID * lpClassId)
668 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
670 TRACE ("(%p)\n", This);
672 if (!lpClassId)
673 return E_POINTER;
674 *lpClassId = CLSID_MyComputer;
676 return S_OK;
679 /************************************************************************
680 * IMCFldr_PersistFolder2_Initialize
682 * NOTES: it makes no sense to change the pidl
684 static HRESULT WINAPI IMCFldr_PersistFolder2_Initialize (IPersistFolder2 * iface, LPCITEMIDLIST pidl)
686 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
687 TRACE ("(%p)->(%p)\n", This, pidl);
688 return E_NOTIMPL;
691 /**************************************************************************
692 * IPersistFolder2_fnGetCurFolder
694 static HRESULT WINAPI IMCFldr_PersistFolder2_GetCurFolder (IPersistFolder2 * iface, LPITEMIDLIST * pidl)
696 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
698 TRACE ("(%p)->(%p)\n", This, pidl);
700 if (!pidl)
701 return E_POINTER;
702 *pidl = ILClone (This->pidlRoot);
703 return S_OK;
706 static ICOM_VTABLE (IPersistFolder2) vt_PersistFolder2 =
708 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
709 IMCFldr_PersistFolder2_QueryInterface,
710 IMCFldr_PersistFolder2_AddRef,
711 IMCFldr_PersistFolder2_Release,
712 IMCFldr_PersistFolder2_GetClassID,
713 IMCFldr_PersistFolder2_Initialize,
714 IMCFldr_PersistFolder2_GetCurFolder