2002-07-24 03:56:03 +02:00
|
|
|
/*
|
2005-02-23 16:41:39 +01:00
|
|
|
* Virtual Workplace folder
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
2005-02-23 16:41:39 +01:00
|
|
|
* Copyright 1997 Marcus Meissner
|
|
|
|
* Copyright 1998, 1999, 2002 Juergen Schmied
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2002-07-24 03:56:03 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2004-10-07 05:06:48 +02:00
|
|
|
#define COBJMACROS
|
2003-01-07 21:36:20 +01:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2004-10-07 05:06:48 +02:00
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
#include "winerror.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
2002-07-24 03:56:03 +02:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "winreg.h"
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "wingdi.h"
|
2002-12-05 21:33:07 +01:00
|
|
|
#include "pidl.h"
|
2002-07-24 03:56:03 +02:00
|
|
|
#include "shlguid.h"
|
2004-04-08 06:37:43 +02:00
|
|
|
#include "enumidlist.h"
|
2002-07-24 03:56:03 +02:00
|
|
|
#include "undocshell.h"
|
|
|
|
#include "shell32_main.h"
|
|
|
|
#include "shresdef.h"
|
|
|
|
#include "shlwapi.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "debughlp.h"
|
|
|
|
#include "shfldr.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL (shell);
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* IShellFolder implementation
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct {
|
2005-06-06 21:50:35 +02:00
|
|
|
const IShellFolder2Vtbl *lpVtbl;
|
2005-07-03 14:03:35 +02:00
|
|
|
LONG ref;
|
2005-06-06 21:50:35 +02:00
|
|
|
const IPersistFolder2Vtbl *lpVtblPersistFolder2;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
/* both paths are parsible from the desktop */
|
2005-02-23 16:41:39 +01:00
|
|
|
LPITEMIDLIST pidlRoot; /* absolute pidl */
|
2002-07-24 03:56:03 +02:00
|
|
|
} IGenericSFImpl;
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IShellFolder2Vtbl vt_ShellFolder2;
|
|
|
|
static const IPersistFolder2Vtbl vt_PersistFolder2;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-07-27 13:10:52 +02:00
|
|
|
static inline IGenericSFImpl *impl_from_IPersistFolder2( IPersistFolder2 *iface )
|
|
|
|
{
|
|
|
|
return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpVtblPersistFolder2));
|
|
|
|
}
|
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
/*
|
2005-03-23 14:15:18 +01:00
|
|
|
converts This to an interface pointer
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
#define _IUnknown_(This) (IUnknown*)&(This->lpVtbl)
|
|
|
|
#define _IShellFolder_(This) (IShellFolder*)&(This->lpVtbl)
|
|
|
|
#define _IShellFolder2_(This) (IShellFolder2*)&(This->lpVtbl)
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
#define _IPersist_(This) (IPersist*)&(This->lpVtblPersistFolder2)
|
|
|
|
#define _IPersistFolder_(This) (IPersistFolder*)&(This->lpVtblPersistFolder2)
|
|
|
|
#define _IPersistFolder2_(This) (IPersistFolder2*)&(This->lpVtblPersistFolder2)
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* IShellFolder [MyComputer] implementation
|
|
|
|
*/
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const shvheader MyComputerSFHeader[] = {
|
2002-07-24 03:56:03 +02:00
|
|
|
{IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
|
|
|
|
{IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
|
|
|
|
{IDS_SHV_COLUMN6, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
|
|
|
|
{IDS_SHV_COLUMN7, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MYCOMPUTERSHELLVIEWCOLUMNS 4
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* ISF_MyComputer_Constructor
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI ISF_MyComputer_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
|
|
|
|
{
|
|
|
|
IGenericSFImpl *sf;
|
|
|
|
|
|
|
|
TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
|
|
|
|
|
|
|
|
if (!ppv)
|
2005-02-23 16:41:39 +01:00
|
|
|
return E_POINTER;
|
2002-07-24 03:56:03 +02:00
|
|
|
if (pUnkOuter)
|
2005-02-23 16:41:39 +01:00
|
|
|
return CLASS_E_NOAGGREGATION;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-03-17 21:53:37 +01:00
|
|
|
sf = LocalAlloc (LMEM_ZEROINIT, sizeof (IGenericSFImpl));
|
2002-07-24 03:56:03 +02:00
|
|
|
if (!sf)
|
2005-02-23 16:41:39 +01:00
|
|
|
return E_OUTOFMEMORY;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
sf->ref = 0;
|
2003-04-10 20:17:34 +02:00
|
|
|
sf->lpVtbl = &vt_ShellFolder2;
|
2002-07-24 03:56:03 +02:00
|
|
|
sf->lpVtblPersistFolder2 = &vt_PersistFolder2;
|
2005-02-23 16:41:39 +01:00
|
|
|
sf->pidlRoot = _ILCreateMyComputer (); /* my qualified pidl */
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv)))
|
|
|
|
{
|
|
|
|
IUnknown_Release (_IUnknown_ (sf));
|
|
|
|
return E_NOINTERFACE;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TRACE ("--(%p)\n", sf);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* ISF_MyComputer_fnQueryInterface
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
|
|
|
* NOTES supports not IPersist/IPersistFolder
|
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnQueryInterface (IShellFolder2 *iface,
|
|
|
|
REFIID riid, LPVOID *ppvObj)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
|
|
|
|
|
|
|
|
*ppvObj = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID (riid, &IID_IUnknown) ||
|
2005-02-23 16:41:39 +01:00
|
|
|
IsEqualIID (riid, &IID_IShellFolder) ||
|
|
|
|
IsEqualIID (riid, &IID_IShellFolder2))
|
|
|
|
{
|
|
|
|
*ppvObj = This;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID (riid, &IID_IPersist) ||
|
|
|
|
IsEqualIID (riid, &IID_IPersistFolder) ||
|
|
|
|
IsEqualIID (riid, &IID_IPersistFolder2))
|
|
|
|
{
|
|
|
|
*ppvObj = _IPersistFolder2_ (This);
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
if (*ppvObj)
|
|
|
|
{
|
|
|
|
IUnknown_AddRef ((IUnknown *) (*ppvObj));
|
|
|
|
TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
|
|
|
|
return S_OK;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
TRACE ("-- Interface: E_NOINTERFACE\n");
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ISF_MyComputer_fnAddRef (IShellFolder2 * iface)
|
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedIncrement(&This->ref);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE ("(%p)->(count=%u)\n", This, refCount - 1);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
return refCount;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ISF_MyComputer_fnRelease (IShellFolder2 * iface)
|
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedDecrement(&This->ref);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE ("(%p)->(count=%u)\n", This, refCount + 1);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
if (!refCount)
|
|
|
|
{
|
2002-10-25 23:01:29 +02:00
|
|
|
TRACE ("-- destroying IShellFolder(%p)\n", This);
|
2006-10-07 03:06:26 +02:00
|
|
|
SHFree (This->pidlRoot);
|
2002-10-25 23:01:29 +02:00
|
|
|
LocalFree ((HLOCAL) This);
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
2005-01-14 17:02:20 +01:00
|
|
|
return refCount;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* ISF_MyComputer_fnParseDisplayName
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName (IShellFolder2 *iface,
|
|
|
|
HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName,
|
|
|
|
DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2004-01-30 23:54:12 +01:00
|
|
|
HRESULT hr = E_INVALIDARG;
|
2002-07-24 03:56:03 +02:00
|
|
|
LPCWSTR szNext = NULL;
|
|
|
|
WCHAR szElement[MAX_PATH];
|
2003-12-30 20:24:22 +01:00
|
|
|
LPITEMIDLIST pidlTemp = NULL;
|
|
|
|
CLSID clsid;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", This,
|
|
|
|
hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName),
|
|
|
|
pchEaten, ppidl, pdwAttributes);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
*ppidl = 0;
|
|
|
|
if (pchEaten)
|
2005-02-23 16:41:39 +01:00
|
|
|
*pchEaten = 0; /* strange but like the original */
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2003-12-30 20:24:22 +01:00
|
|
|
/* handle CLSID paths */
|
2005-02-23 16:41:39 +01:00
|
|
|
if (lpszDisplayName[0] == ':' && lpszDisplayName[1] == ':')
|
|
|
|
{
|
|
|
|
szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
|
|
|
|
TRACE ("-- element: %s\n", debugstr_w (szElement));
|
|
|
|
SHCLSIDFromStringW (szElement + 2, &clsid);
|
|
|
|
pidlTemp = _ILCreateGuid (PT_GUID, &clsid);
|
2003-12-30 20:24:22 +01:00
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
/* do we have an absolute path name ? */
|
2005-02-23 16:41:39 +01:00
|
|
|
else if (PathGetDriveNumberW (lpszDisplayName) >= 0 &&
|
|
|
|
lpszDisplayName[2] == (WCHAR) '\\')
|
|
|
|
{
|
|
|
|
szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
|
|
|
|
/* make drive letter uppercase to enable PIDL comparison */
|
|
|
|
szElement[0] = toupper(szElement[0]);
|
|
|
|
pidlTemp = _ILCreateDrive (szElement);
|
2003-12-30 20:24:22 +01:00
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
if (szNext && *szNext)
|
|
|
|
{
|
|
|
|
hr = SHELL32_ParseNextElement (iface, hwndOwner, pbc, &pidlTemp,
|
|
|
|
(LPOLESTR) szNext, pchEaten, pdwAttributes);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pdwAttributes && *pdwAttributes)
|
|
|
|
SHELL32_GetItemAttributes (_IShellFolder_ (This),
|
|
|
|
pidlTemp, pdwAttributes);
|
|
|
|
hr = S_OK;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 20:24:22 +01:00
|
|
|
*ppidl = pidlTemp;
|
|
|
|
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE ("(%p)->(-- ret=0x%08x)\n", This, hr);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2004-04-08 21:50:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
* CreateMyCompEnumList()
|
|
|
|
*/
|
2005-02-26 18:41:26 +01:00
|
|
|
static const WCHAR MyComputer_NameSpaceW[] = { 'S','O','F','T','W','A','R','E',
|
|
|
|
'\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
|
|
|
|
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l',
|
|
|
|
'o','r','e','r','\\','M','y','C','o','m','p','u','t','e','r','\\','N','a','m',
|
|
|
|
'e','s','p','a','c','e','\0' };
|
|
|
|
|
2004-04-08 21:50:17 +02:00
|
|
|
static BOOL CreateMyCompEnumList(IEnumIDList *list, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
BOOL ret = TRUE;
|
|
|
|
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE("(%p)->(flags=0x%08x)\n", list, dwFlags);
|
2004-04-08 21:50:17 +02:00
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
/* enumerate the folders */
|
|
|
|
if (dwFlags & SHCONTF_FOLDERS)
|
2004-04-08 21:50:17 +02:00
|
|
|
{
|
2004-04-15 06:57:46 +02:00
|
|
|
WCHAR wszDriveName[] = {'A', ':', '\\', '\0'};
|
2004-04-08 21:50:17 +02:00
|
|
|
DWORD dwDrivemap = GetLogicalDrives();
|
|
|
|
HKEY hkey;
|
2005-11-23 15:17:22 +01:00
|
|
|
UINT i;
|
2004-04-08 21:50:17 +02:00
|
|
|
|
2004-04-15 06:57:46 +02:00
|
|
|
while (ret && wszDriveName[0]<='Z')
|
2004-04-08 21:50:17 +02:00
|
|
|
{
|
|
|
|
if(dwDrivemap & 0x00000001L)
|
2004-04-15 06:57:46 +02:00
|
|
|
ret = AddToEnumList(list, _ILCreateDrive(wszDriveName));
|
|
|
|
wszDriveName[0]++;
|
2004-04-08 21:50:17 +02:00
|
|
|
dwDrivemap = dwDrivemap >> 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("-- (%p)-> enumerate (mycomputer shell extensions)\n",list);
|
2005-11-23 15:17:22 +01:00
|
|
|
for (i=0; i<2; i++) {
|
|
|
|
if (ret && !RegOpenKeyExW(i == 0 ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
|
|
|
|
MyComputer_NameSpaceW, 0, KEY_READ, &hkey))
|
2004-04-08 21:50:17 +02:00
|
|
|
{
|
2005-11-23 15:17:22 +01:00
|
|
|
WCHAR iid[50];
|
|
|
|
int i=0;
|
2004-04-08 21:50:17 +02:00
|
|
|
|
2005-11-23 15:17:22 +01:00
|
|
|
while (ret)
|
2004-04-08 21:50:17 +02:00
|
|
|
{
|
2005-11-23 15:17:22 +01:00
|
|
|
DWORD size;
|
|
|
|
LONG r;
|
|
|
|
|
|
|
|
size = sizeof(iid) / sizeof(iid[0]);
|
|
|
|
r = RegEnumKeyExW(hkey, i, iid, &size, 0, NULL, NULL, NULL);
|
|
|
|
if (ERROR_SUCCESS == r)
|
|
|
|
{
|
|
|
|
/* FIXME: shell extensions, shouldn't the type be
|
|
|
|
* PT_SHELLEXT? */
|
|
|
|
ret = AddToEnumList(list, _ILCreateGuidFromStrW(iid));
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
else if (ERROR_NO_MORE_ITEMS == r)
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
ret = FALSE;
|
2004-04-08 21:50:17 +02:00
|
|
|
}
|
2005-11-23 15:17:22 +01:00
|
|
|
RegCloseKey(hkey);
|
2004-04-08 21:50:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
/**************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* ISF_MyComputer_fnEnumObjects
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnEnumObjects (IShellFolder2 *iface,
|
|
|
|
HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", This,
|
2005-02-23 16:41:39 +01:00
|
|
|
hwndOwner, dwFlags, ppEnumIDList);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2004-04-08 21:50:17 +02:00
|
|
|
*ppEnumIDList = IEnumIDList_Constructor();
|
|
|
|
if (*ppEnumIDList)
|
|
|
|
CreateMyCompEnumList(*ppEnumIDList, dwFlags);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
|
|
|
|
|
|
|
|
return (*ppEnumIDList) ? S_OK : E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* ISF_MyComputer_fnBindToObject
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnBindToObject (IShellFolder2 *iface,
|
|
|
|
LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", This,
|
|
|
|
pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
return SHELL32_BindToChild (This->pidlRoot, NULL, pidl, riid, ppvOut);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* ISF_MyComputer_fnBindToStorage
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnBindToStorage (IShellFolder2 * iface,
|
|
|
|
LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", This,
|
|
|
|
pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
*ppvOut = NULL;
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* ISF_MyComputer_fnCompareIDs
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnCompareIDs (IShellFolder2 *iface,
|
|
|
|
LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
int nReturn;
|
|
|
|
|
|
|
|
TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
|
|
|
|
nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
|
|
|
|
TRACE ("-- %i\n", nReturn);
|
|
|
|
return nReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* ISF_MyComputer_fnCreateViewObject
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnCreateViewObject (IShellFolder2 *iface,
|
|
|
|
HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
LPSHELLVIEW pShellView;
|
|
|
|
HRESULT hr = E_INVALIDARG;
|
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
TRACE("(%p)->(hwnd=%p,%s,%p)\n", This,
|
|
|
|
hwndOwner, shdebugstr_guid (riid), ppvOut);
|
|
|
|
|
|
|
|
if (!ppvOut)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*ppvOut = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID (riid, &IID_IDropTarget))
|
|
|
|
{
|
|
|
|
WARN ("IDropTarget not implemented\n");
|
|
|
|
hr = E_NOTIMPL;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID (riid, &IID_IContextMenu))
|
|
|
|
{
|
|
|
|
WARN ("IContextMenu not implemented\n");
|
|
|
|
hr = E_NOTIMPL;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID (riid, &IID_IShellView))
|
|
|
|
{
|
|
|
|
pShellView = IShellView_Constructor ((IShellFolder *) iface);
|
|
|
|
if (pShellView)
|
|
|
|
{
|
|
|
|
hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
|
|
|
|
IShellView_Release (pShellView);
|
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_MyComputer_fnGetAttributesOf
|
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf (IShellFolder2 * iface,
|
|
|
|
UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
HRESULT hr = S_OK;
|
|
|
|
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
|
2005-05-10 10:28:11 +02:00
|
|
|
This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-05-10 10:28:11 +02:00
|
|
|
if (!rgfInOut)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
if (cidl && !apidl)
|
2005-02-23 16:41:39 +01:00
|
|
|
return E_INVALIDARG;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2004-04-13 02:19:11 +02:00
|
|
|
if (*rgfInOut == 0)
|
2005-02-23 16:41:39 +01:00
|
|
|
*rgfInOut = ~0;
|
2005-05-26 18:09:12 +02:00
|
|
|
|
|
|
|
if(cidl == 0){
|
|
|
|
IShellFolder *psfParent = NULL;
|
|
|
|
LPCITEMIDLIST rpidl = NULL;
|
|
|
|
|
|
|
|
hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (LPVOID*)&psfParent, (LPCITEMIDLIST*)&rpidl);
|
2005-07-11 12:23:56 +02:00
|
|
|
if(SUCCEEDED(hr)) {
|
2005-05-26 18:09:12 +02:00
|
|
|
SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut);
|
2005-07-11 12:23:56 +02:00
|
|
|
IShellFolder_Release(psfParent);
|
|
|
|
}
|
2005-05-26 18:09:12 +02:00
|
|
|
} else {
|
|
|
|
while (cidl > 0 && *apidl) {
|
|
|
|
pdump (*apidl);
|
|
|
|
SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
|
|
|
|
apidl++;
|
|
|
|
cidl--;
|
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
2005-05-10 10:28:11 +02:00
|
|
|
/* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
|
|
|
|
*rgfInOut &= ~SFGAO_VALIDATE;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE ("-- result=0x%08x\n", *rgfInOut);
|
2002-07-24 03:56:03 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* ISF_MyComputer_fnGetUIObjectOf
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
|
|
|
* PARAMETERS
|
2005-02-23 16:41:39 +01:00
|
|
|
* hwndOwner [in] Parent window for any output
|
|
|
|
* cidl [in] array size
|
|
|
|
* apidl [in] simple pidl array
|
|
|
|
* riid [in] Requested Interface
|
|
|
|
* prgfInOut [ ] reserved
|
|
|
|
* ppvObject [out] Resulting Interface
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnGetUIObjectOf (IShellFolder2 * iface,
|
|
|
|
HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl, REFIID riid,
|
|
|
|
UINT * prgfInOut, LPVOID * ppvOut)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
IUnknown *pObj = NULL;
|
|
|
|
HRESULT hr = E_INVALIDARG;
|
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", This,
|
|
|
|
hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
|
|
|
|
|
|
|
|
if (!ppvOut)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*ppvOut = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1))
|
|
|
|
{
|
|
|
|
pObj = (LPUNKNOWN) ISvItemCm_Constructor ((IShellFolder *) iface,
|
|
|
|
This->pidlRoot, apidl, cidl);
|
|
|
|
hr = S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1))
|
|
|
|
{
|
|
|
|
pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner,
|
|
|
|
This->pidlRoot, apidl, cidl);
|
|
|
|
hr = S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1))
|
|
|
|
{
|
|
|
|
pidl = ILCombine (This->pidlRoot, apidl[0]);
|
|
|
|
pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
|
|
|
|
SHFree (pidl);
|
|
|
|
hr = S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1))
|
|
|
|
{
|
|
|
|
pidl = ILCombine (This->pidlRoot, apidl[0]);
|
|
|
|
pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
|
|
|
|
SHFree (pidl);
|
|
|
|
hr = S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1))
|
|
|
|
{
|
|
|
|
hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget,
|
|
|
|
(LPVOID *) &pObj);
|
|
|
|
}
|
|
|
|
else if ((IsEqualIID(riid,&IID_IShellLinkW) ||
|
|
|
|
IsEqualIID(riid,&IID_IShellLinkA)) && (cidl == 1))
|
|
|
|
{
|
|
|
|
pidl = ILCombine (This->pidlRoot, apidl[0]);
|
|
|
|
hr = IShellLink_ConstructFromFile(NULL, riid, pidl, (LPVOID*) &pObj);
|
|
|
|
SHFree (pidl);
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
2005-02-23 16:41:39 +01:00
|
|
|
else
|
|
|
|
hr = E_NOINTERFACE;
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr) && !pObj)
|
|
|
|
hr = E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
*ppvOut = pObj;
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE ("(%p)->hr=0x%08x\n", This, hr);
|
2002-07-24 03:56:03 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* ISF_MyComputer_fnGetDisplayNameOf
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
|
|
|
|
LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2007-04-10 11:20:48 +02:00
|
|
|
LPWSTR pszPath;
|
2004-01-23 05:25:26 +01:00
|
|
|
HRESULT hr = S_OK;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", This, pidl, dwFlags, strRet);
|
2002-07-24 03:56:03 +02:00
|
|
|
pdump (pidl);
|
|
|
|
|
|
|
|
if (!strRet)
|
2005-02-23 16:41:39 +01:00
|
|
|
return E_INVALIDARG;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2007-04-10 11:20:48 +02:00
|
|
|
pszPath = CoTaskMemAlloc((MAX_PATH +1) * sizeof(WCHAR));
|
|
|
|
if (!pszPath)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
pszPath[0] = 0;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
if (!pidl->mkid.cb)
|
|
|
|
{
|
|
|
|
/* parsing name like ::{...} */
|
2007-04-10 11:20:48 +02:00
|
|
|
pszPath[0] = ':';
|
|
|
|
pszPath[1] = ':';
|
|
|
|
SHELL32_GUIDToStringW(&CLSID_MyComputer, &pszPath[2]);
|
2005-02-23 16:41:39 +01:00
|
|
|
}
|
2005-05-05 12:30:39 +02:00
|
|
|
else if (_ILIsPidlSimple(pidl))
|
2005-02-23 16:41:39 +01:00
|
|
|
{
|
|
|
|
/* take names of special folders only if its only this folder */
|
2005-05-05 12:30:39 +02:00
|
|
|
if (_ILIsSpecialFolder(pidl))
|
2005-02-23 16:41:39 +01:00
|
|
|
{
|
|
|
|
GUID const *clsid;
|
|
|
|
|
|
|
|
clsid = _ILGetGUIDPointer (pidl);
|
|
|
|
if (clsid)
|
|
|
|
{
|
2005-05-23 18:31:42 +02:00
|
|
|
if (GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING)
|
2005-02-23 16:41:39 +01:00
|
|
|
{
|
2005-03-02 11:16:41 +01:00
|
|
|
static const WCHAR clsidW[] =
|
|
|
|
{ 'C','L','S','I','D','\\',0 };
|
|
|
|
static const WCHAR shellfolderW[] =
|
|
|
|
{ '\\','s','h','e','l','l','f','o','l','d','e','r',0 };
|
|
|
|
static const WCHAR wantsForParsingW[] =
|
|
|
|
{ 'W','a','n','t','s','F','o','r','P','a','r','s','i','n',
|
|
|
|
'g',0 };
|
2005-02-23 16:41:39 +01:00
|
|
|
int bWantsForParsing = FALSE;
|
2005-03-02 11:16:41 +01:00
|
|
|
WCHAR szRegPath[100];
|
2005-02-23 16:41:39 +01:00
|
|
|
LONG r;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We can only get a filesystem path from a shellfolder
|
|
|
|
* if the value WantsFORPARSING exists in
|
|
|
|
* CLSID\\{...}\\shellfolder
|
|
|
|
* exception: the MyComputer folder has this keys not
|
|
|
|
* but like any filesystem backed
|
|
|
|
* folder it needs these behaviour
|
|
|
|
*
|
|
|
|
* Get the "WantsFORPARSING" flag from the registry
|
|
|
|
*/
|
|
|
|
|
2005-03-02 11:16:41 +01:00
|
|
|
lstrcpyW (szRegPath, clsidW);
|
|
|
|
SHELL32_GUIDToStringW (clsid, &szRegPath[6]);
|
|
|
|
lstrcatW (szRegPath, shellfolderW);
|
|
|
|
r = SHGetValueW (HKEY_CLASSES_ROOT, szRegPath,
|
|
|
|
wantsForParsingW, NULL, NULL, NULL);
|
2005-02-23 16:41:39 +01:00
|
|
|
if (r == ERROR_SUCCESS)
|
|
|
|
bWantsForParsing = TRUE;
|
|
|
|
|
|
|
|
if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
|
|
|
|
bWantsForParsing)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* We need the filesystem path to the destination folder
|
|
|
|
* Only the folder itself can know it
|
|
|
|
*/
|
|
|
|
hr = SHELL32_GetDisplayNameOfChild (iface, pidl,
|
2007-04-10 11:20:48 +02:00
|
|
|
dwFlags, pszPath, MAX_PATH);
|
2005-02-23 16:41:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-04-10 11:20:48 +02:00
|
|
|
LPWSTR p = pszPath;
|
2005-02-23 16:41:39 +01:00
|
|
|
|
|
|
|
/* parsing name like ::{...} */
|
2006-06-19 21:27:05 +02:00
|
|
|
p[0] = ':';
|
|
|
|
p[1] = ':';
|
|
|
|
p += 2;
|
|
|
|
p += SHELL32_GUIDToStringW(&CLSID_MyComputer, p);
|
|
|
|
|
|
|
|
/* \:: */
|
|
|
|
p[0] = '\\';
|
|
|
|
p[1] = ':';
|
|
|
|
p[2] = ':';
|
2005-02-23 16:41:39 +01:00
|
|
|
p += 3;
|
2006-06-19 21:27:05 +02:00
|
|
|
SHELL32_GUIDToStringW(clsid, p);
|
2005-02-23 16:41:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* user friendly name */
|
2007-04-10 11:20:48 +02:00
|
|
|
HCR_GetClassNameW (clsid, pszPath, MAX_PATH);
|
2005-02-23 16:41:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* append my own path */
|
2007-04-10 11:20:48 +02:00
|
|
|
_ILSimpleGetTextW (pidl, pszPath, MAX_PATH);
|
2005-02-23 16:41:39 +01:00
|
|
|
}
|
|
|
|
}
|
2005-05-05 12:30:39 +02:00
|
|
|
else if (_ILIsDrive(pidl))
|
|
|
|
{
|
2007-04-10 11:20:48 +02:00
|
|
|
_ILSimpleGetTextW (pidl, pszPath, MAX_PATH); /* append my own path */
|
2005-02-23 16:41:39 +01:00
|
|
|
|
2005-05-05 12:30:39 +02:00
|
|
|
/* long view "lw_name (C:)" */
|
|
|
|
if (!(dwFlags & SHGDN_FORPARSING))
|
|
|
|
{
|
|
|
|
DWORD dwVolumeSerialNumber, dwMaximumComponetLength, dwFileSystemFlags;
|
2006-06-19 21:27:05 +02:00
|
|
|
WCHAR wszDrive[18] = {0};
|
|
|
|
static const WCHAR wszOpenBracket[] = {' ','(',0};
|
|
|
|
static const WCHAR wszCloseBracket[] = {')',0};
|
2005-05-05 12:30:39 +02:00
|
|
|
|
2007-04-10 11:20:48 +02:00
|
|
|
GetVolumeInformationW (pszPath, wszDrive,
|
2006-06-19 21:27:05 +02:00
|
|
|
sizeof(wszDrive)/sizeof(wszDrive[0]) - 6,
|
2005-05-05 12:30:39 +02:00
|
|
|
&dwVolumeSerialNumber,
|
|
|
|
&dwMaximumComponetLength, &dwFileSystemFlags, NULL, 0);
|
2006-06-19 21:27:05 +02:00
|
|
|
strcatW (wszDrive, wszOpenBracket);
|
2007-04-10 11:20:48 +02:00
|
|
|
lstrcpynW (wszDrive + strlenW(wszDrive), pszPath, 3);
|
2006-06-19 21:27:05 +02:00
|
|
|
strcatW (wszDrive, wszCloseBracket);
|
2007-04-10 11:20:48 +02:00
|
|
|
strcpyW (pszPath, wszDrive);
|
2005-05-05 12:30:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2005-02-23 16:41:39 +01:00
|
|
|
{
|
2005-05-05 12:30:39 +02:00
|
|
|
/* Neither a shell namespace extension nor a drive letter. */
|
|
|
|
ERR("Wrong pidl type\n");
|
2007-11-19 00:19:19 +01:00
|
|
|
CoTaskMemFree(pszPath);
|
2005-05-05 12:30:39 +02:00
|
|
|
return E_INVALIDARG;
|
2005-02-23 16:41:39 +01:00
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
2005-05-05 12:30:39 +02:00
|
|
|
else
|
2005-02-23 16:41:39 +01:00
|
|
|
{
|
2005-05-05 12:30:39 +02:00
|
|
|
/* Complex pidl. Let the child folder do the work */
|
2007-04-10 11:20:48 +02:00
|
|
|
hr = SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, pszPath, MAX_PATH);
|
2004-01-23 05:25:26 +01:00
|
|
|
}
|
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
if (SUCCEEDED (hr))
|
|
|
|
{
|
2007-04-10 11:20:48 +02:00
|
|
|
/* Win9x always returns ANSI strings, NT always returns Unicode strings */
|
|
|
|
if (GetVersion() & 0x80000000)
|
|
|
|
{
|
|
|
|
strRet->uType = STRRET_CSTR;
|
|
|
|
if (!WideCharToMultiByte(CP_ACP, 0, pszPath, -1, strRet->u.cStr, MAX_PATH,
|
|
|
|
NULL, NULL))
|
|
|
|
strRet->u.cStr[0] = '\0';
|
|
|
|
CoTaskMemFree(pszPath);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strRet->uType = STRRET_WSTR;
|
|
|
|
strRet->u.pOleStr = pszPath;
|
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
2007-04-10 11:20:48 +02:00
|
|
|
else
|
|
|
|
CoTaskMemFree(pszPath);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2007-04-10 11:20:48 +02:00
|
|
|
TRACE ("-- (%p)->(%s)\n", This, strRet->uType == STRRET_CSTR ? strRet->u.cStr : debugstr_w(strRet->u.pOleStr));
|
2004-01-23 05:25:26 +01:00
|
|
|
return hr;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_MyComputer_fnSetNameOf
|
|
|
|
* Changes the name of a file object or subfolder, possibly changing its item
|
|
|
|
* identifier in the process.
|
|
|
|
*
|
|
|
|
* PARAMETERS
|
2005-02-23 16:41:39 +01:00
|
|
|
* hwndOwner [in] Owner window for output
|
|
|
|
* pidl [in] simple pidl of item to change
|
|
|
|
* lpszName [in] the items new display name
|
|
|
|
* dwFlags [in] SHGNO formatting flags
|
|
|
|
* ppidlOut [out] simple pidl returned
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnSetNameOf (
|
|
|
|
IShellFolder2 * iface, HWND hwndOwner, LPCITEMIDLIST pidl,
|
|
|
|
LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2006-10-07 20:18:14 +02:00
|
|
|
FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", This,
|
2005-02-23 16:41:39 +01:00
|
|
|
hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
|
2002-07-24 03:56:03 +02:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnGetDefaultSearchGUID (
|
|
|
|
IShellFolder2 * iface, GUID * pguid)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
FIXME ("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnEnumSearches (
|
|
|
|
IShellFolder2 * iface, IEnumExtraSearch ** ppenum)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
FIXME ("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumn (
|
|
|
|
IShellFolder2 *iface, DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)\n", This);
|
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
if (pSort)
|
|
|
|
*pSort = 0;
|
|
|
|
if (pDisplay)
|
|
|
|
*pDisplay = 0;
|
2002-07-24 03:56:03 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumnState (
|
|
|
|
IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)\n", This);
|
|
|
|
|
2005-02-23 16:41:39 +01:00
|
|
|
if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
|
|
|
|
return E_INVALIDARG;
|
2002-07-24 03:56:03 +02:00
|
|
|
*pcsFlags = MyComputerSFHeader[iColumn].pcsFlags;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2005-02-23 16:41:39 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnGetDetailsEx (IShellFolder2 * iface,
|
|
|
|
LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
FIXME ("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: drive size >4GB is rolling over */
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf (IShellFolder2 * iface,
|
|
|
|
LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
|
|
|
|
|
|
|
|
if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS)
|
2005-02-23 16:41:39 +01:00
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (!pidl)
|
|
|
|
{
|
|
|
|
psd->fmt = MyComputerSFHeader[iColumn].fmt;
|
|
|
|
psd->cxChar = MyComputerSFHeader[iColumn].cxChar;
|
|
|
|
psd->str.uType = STRRET_CSTR;
|
|
|
|
LoadStringA (shell32_hInstance, MyComputerSFHeader[iColumn].colnameid,
|
|
|
|
psd->str.u.cStr, MAX_PATH);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char szPath[MAX_PATH];
|
|
|
|
ULARGE_INTEGER ulBytes;
|
|
|
|
|
|
|
|
psd->str.u.cStr[0] = 0x00;
|
|
|
|
psd->str.uType = STRRET_CSTR;
|
|
|
|
switch (iColumn)
|
|
|
|
{
|
|
|
|
case 0: /* name */
|
|
|
|
hr = IShellFolder_GetDisplayNameOf (iface, pidl,
|
|
|
|
SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
|
|
|
|
break;
|
|
|
|
case 1: /* type */
|
|
|
|
_ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
|
|
|
|
break;
|
|
|
|
case 2: /* total size */
|
|
|
|
if (_ILIsDrive (pidl))
|
|
|
|
{
|
|
|
|
_ILSimpleGetText (pidl, szPath, MAX_PATH);
|
|
|
|
GetDiskFreeSpaceExA (szPath, NULL, &ulBytes, NULL);
|
|
|
|
StrFormatByteSizeA (ulBytes.u.LowPart, psd->str.u.cStr, MAX_PATH);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3: /* free size */
|
|
|
|
if (_ILIsDrive (pidl))
|
|
|
|
{
|
|
|
|
_ILSimpleGetText (pidl, szPath, MAX_PATH);
|
|
|
|
GetDiskFreeSpaceExA (szPath, &ulBytes, NULL, NULL);
|
|
|
|
StrFormatByteSizeA (ulBytes.u.LowPart, psd->str.u.cStr, MAX_PATH);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
hr = S_OK;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
2005-02-23 16:41:39 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI ISF_MyComputer_fnMapColumnToSCID (
|
|
|
|
IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
2002-07-24 03:56:03 +02:00
|
|
|
FIXME ("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IShellFolder2Vtbl vt_ShellFolder2 =
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-02-23 16:41:39 +01:00
|
|
|
ISF_MyComputer_fnQueryInterface,
|
|
|
|
ISF_MyComputer_fnAddRef,
|
|
|
|
ISF_MyComputer_fnRelease,
|
|
|
|
ISF_MyComputer_fnParseDisplayName,
|
|
|
|
ISF_MyComputer_fnEnumObjects,
|
|
|
|
ISF_MyComputer_fnBindToObject,
|
|
|
|
ISF_MyComputer_fnBindToStorage,
|
|
|
|
ISF_MyComputer_fnCompareIDs,
|
|
|
|
ISF_MyComputer_fnCreateViewObject,
|
|
|
|
ISF_MyComputer_fnGetAttributesOf,
|
|
|
|
ISF_MyComputer_fnGetUIObjectOf,
|
|
|
|
ISF_MyComputer_fnGetDisplayNameOf,
|
|
|
|
ISF_MyComputer_fnSetNameOf,
|
|
|
|
/* ShellFolder2 */
|
|
|
|
ISF_MyComputer_fnGetDefaultSearchGUID,
|
|
|
|
ISF_MyComputer_fnEnumSearches,
|
|
|
|
ISF_MyComputer_fnGetDefaultColumn,
|
|
|
|
ISF_MyComputer_fnGetDefaultColumnState,
|
|
|
|
ISF_MyComputer_fnGetDetailsEx,
|
|
|
|
ISF_MyComputer_fnGetDetailsOf,
|
|
|
|
ISF_MyComputer_fnMapColumnToSCID
|
2002-07-24 03:56:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* IMCFldr_PersistFolder2_QueryInterface
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI IMCFldr_PersistFolder2_QueryInterface (
|
|
|
|
IPersistFolder2 * iface, REFIID iid, LPVOID * ppvObj)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)\n", This);
|
|
|
|
|
|
|
|
return IUnknown_QueryInterface (_IUnknown_ (This), iid, ppvObj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* IMCFldr_PersistFolder2_AddRef
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
|
|
|
static ULONG WINAPI IMCFldr_PersistFolder2_AddRef (IPersistFolder2 * iface)
|
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE ("(%p)->(count=%u)\n", This, This->ref);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
return IUnknown_AddRef (_IUnknown_ (This));
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* ISFPersistFolder_Release
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
|
|
|
static ULONG WINAPI IMCFldr_PersistFolder2_Release (IPersistFolder2 * iface)
|
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE ("(%p)->(count=%u)\n", This, This->ref);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
return IUnknown_Release (_IUnknown_ (This));
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* IMCFldr_PersistFolder2_GetClassID
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI IMCFldr_PersistFolder2_GetClassID (
|
|
|
|
IPersistFolder2 * iface, CLSID * lpClassId)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)\n", This);
|
|
|
|
|
|
|
|
if (!lpClassId)
|
2005-02-23 16:41:39 +01:00
|
|
|
return E_POINTER;
|
2002-07-24 03:56:03 +02:00
|
|
|
*lpClassId = CLSID_MyComputer;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* IMCFldr_PersistFolder2_Initialize
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
|
|
|
* NOTES: it makes no sense to change the pidl
|
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI IMCFldr_PersistFolder2_Initialize (
|
|
|
|
IPersistFolder2 * iface, LPCITEMIDLIST pidl)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
TRACE ("(%p)->(%p)\n", This, pidl);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-23 16:41:39 +01:00
|
|
|
* IPersistFolder2_fnGetCurFolder
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
2005-02-23 16:41:39 +01:00
|
|
|
static HRESULT WINAPI IMCFldr_PersistFolder2_GetCurFolder (
|
|
|
|
IPersistFolder2 * iface, LPITEMIDLIST * pidl)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)->(%p)\n", This, pidl);
|
|
|
|
|
|
|
|
if (!pidl)
|
2005-02-23 16:41:39 +01:00
|
|
|
return E_POINTER;
|
2002-07-24 03:56:03 +02:00
|
|
|
*pidl = ILClone (This->pidlRoot);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IPersistFolder2Vtbl vt_PersistFolder2 =
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-02-23 16:41:39 +01:00
|
|
|
IMCFldr_PersistFolder2_QueryInterface,
|
|
|
|
IMCFldr_PersistFolder2_AddRef,
|
|
|
|
IMCFldr_PersistFolder2_Release,
|
|
|
|
IMCFldr_PersistFolder2_GetClassID,
|
|
|
|
IMCFldr_PersistFolder2_Initialize,
|
|
|
|
IMCFldr_PersistFolder2_GetCurFolder
|
2002-07-24 03:56:03 +02:00
|
|
|
};
|