2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
/*
|
2005-02-21 19:36:47 +01:00
|
|
|
* Virtual Desktop Folder
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
2005-02-21 19:36:47 +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
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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"
|
2003-09-09 21:39:31 +02:00
|
|
|
#include "winuser.h"
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2002-12-05 21:33:07 +01:00
|
|
|
#include "ole2.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 "pidl.h"
|
|
|
|
#include "undocshell.h"
|
|
|
|
#include "shell32_main.h"
|
|
|
|
#include "shresdef.h"
|
|
|
|
#include "shlwapi.h"
|
|
|
|
#include "shellfolder.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "debughlp.h"
|
|
|
|
#include "shfldr.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL (shell);
|
|
|
|
|
|
|
|
/***********************************************************************
|
2005-02-21 19:36:47 +01:00
|
|
|
* Desktopfolder implementation
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct {
|
2004-08-12 21:52:49 +02:00
|
|
|
IShellFolder2Vtbl *lpVtbl;
|
2002-07-24 03:56:03 +02:00
|
|
|
DWORD ref;
|
|
|
|
|
|
|
|
CLSID *pclsid;
|
|
|
|
|
|
|
|
/* both paths are parsible from the desktop */
|
2005-03-17 14:57:38 +01:00
|
|
|
LPWSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
|
|
|
|
LPITEMIDLIST pidlRoot; /* absolute pidl */
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
UINT cfShellIDList; /* clipboardformat for IDropTarget */
|
|
|
|
BOOL fAcceptFmt; /* flag for pending Drop */
|
2002-07-24 03:56:03 +02:00
|
|
|
} IGenericSFImpl;
|
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
#define _IUnknown_(This) (IShellFolder*)&(This->lpVtbl)
|
|
|
|
#define _IShellFolder_(This) (IShellFolder*)&(This->lpVtbl)
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
static shvheader DesktopSFHeader[] = {
|
|
|
|
{IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
|
|
|
|
{IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
|
|
|
|
{IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
|
|
|
|
{IDS_SHV_COLUMN4, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12},
|
|
|
|
{IDS_SHV_COLUMN5, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DESKTOPSHELLVIEWCOLUMNS 5
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-21 19:36:47 +01:00
|
|
|
* ISF_Desktop_fnQueryInterface
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
|
|
|
* NOTES supports not IPersist/IPersistFolder
|
|
|
|
*/
|
2005-02-21 19:36:47 +01:00
|
|
|
static HRESULT WINAPI ISF_Desktop_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;
|
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
if (IsEqualIID (riid, &IID_IUnknown) ||
|
|
|
|
IsEqualIID (riid, &IID_IShellFolder) ||
|
|
|
|
IsEqualIID (riid, &IID_IShellFolder2))
|
|
|
|
{
|
|
|
|
*ppvObj = This;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
2005-02-21 19:36:47 +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_Desktop_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
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
TRACE ("(%p)->(count=%lu)\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_Desktop_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
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
TRACE ("(%p)->(count=%lu)\n", This, refCount + 1);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
if (!refCount)
|
|
|
|
{
|
|
|
|
TRACE ("-- destroying IShellFolder(%p)\n", This);
|
|
|
|
if (This->pidlRoot)
|
|
|
|
SHFree (This->pidlRoot);
|
|
|
|
if (This->sPathTarget)
|
|
|
|
SHFree (This->sPathTarget);
|
|
|
|
LocalFree ((HLOCAL) This);
|
2002-10-25 23:01:29 +02:00
|
|
|
return 0;
|
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-21 19:36:47 +01:00
|
|
|
* ISF_Desktop_fnParseDisplayName
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds
|
|
|
|
* to MyComputer
|
|
|
|
*/
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
|
2005-02-21 19:36:47 +01:00
|
|
|
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;
|
2002-07-24 03:56:03 +02:00
|
|
|
WCHAR szElement[MAX_PATH];
|
|
|
|
LPCWSTR szNext = NULL;
|
|
|
|
LPITEMIDLIST pidlTemp = NULL;
|
2004-04-15 01:57:46 +02:00
|
|
|
HRESULT hr = S_OK;
|
2002-07-24 03:56:03 +02:00
|
|
|
CLSID clsid;
|
|
|
|
|
2002-11-22 00:56:42 +01:00
|
|
|
TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
|
2005-02-21 19:36:47 +01:00
|
|
|
This, hwndOwner, pbc, lpszDisplayName, debugstr_w(lpszDisplayName),
|
|
|
|
pchEaten, ppidl, pdwAttributes);
|
2003-09-16 00:16:41 +02:00
|
|
|
|
|
|
|
if (!lpszDisplayName || !ppidl)
|
2005-02-21 19:36:47 +01:00
|
|
|
return E_INVALIDARG;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
*ppidl = 0;
|
2003-09-16 00:16:41 +02:00
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
if (pchEaten)
|
2005-02-21 19:36:47 +01:00
|
|
|
*pchEaten = 0; /* strange but like the original */
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else if (PathGetDriveNumberW (lpszDisplayName) >= 0)
|
|
|
|
{
|
|
|
|
/* it's a filesystem path with a drive. Let MyComputer parse it */
|
|
|
|
pidlTemp = _ILCreateMyComputer ();
|
|
|
|
szNext = lpszDisplayName;
|
|
|
|
}
|
|
|
|
else if (PathIsUNCW(lpszDisplayName))
|
|
|
|
{
|
|
|
|
pidlTemp = _ILCreateNetwork();
|
|
|
|
szNext = lpszDisplayName;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
2005-02-23 13:45:12 +01:00
|
|
|
else if( (pidlTemp = SHELL32_CreatePidlFromBindCtx(pbc, lpszDisplayName)) )
|
|
|
|
{
|
|
|
|
*ppidl = pidlTemp;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2005-02-21 19:36:47 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* it's a filesystem path on the desktop. Let a FSFolder parse it */
|
|
|
|
|
|
|
|
if (*lpszDisplayName)
|
|
|
|
{
|
2005-03-02 11:16:41 +01:00
|
|
|
WCHAR szPath[MAX_PATH];
|
|
|
|
LPWSTR pathPtr;
|
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
/* build a complete path to create a simple pidl */
|
2005-03-17 14:57:38 +01:00
|
|
|
lstrcpynW(szPath, This->sPathTarget, MAX_PATH);
|
2005-03-02 11:16:41 +01:00
|
|
|
pathPtr = PathAddBackslashW(szPath);
|
|
|
|
if (pathPtr)
|
|
|
|
{
|
2005-03-17 14:57:38 +01:00
|
|
|
lstrcpynW(pathPtr, lpszDisplayName, MAX_PATH - (pathPtr - szPath));
|
2005-03-02 11:16:41 +01:00
|
|
|
hr = _ILCreateFromPathW(szPath, &pidlTemp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* should never reach here, but for completeness */
|
|
|
|
hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
}
|
2005-02-21 19:36:47 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
pidlTemp = _ILCreateMyComputer();
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
szNext = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr) && pidlTemp)
|
|
|
|
{
|
|
|
|
if (szNext && *szNext)
|
|
|
|
{
|
|
|
|
hr = SHELL32_ParseNextElement(iface, hwndOwner, pbc,
|
|
|
|
&pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pdwAttributes && *pdwAttributes)
|
|
|
|
hr = SHELL32_GetItemAttributes(_IShellFolder_ (This),
|
|
|
|
pidlTemp, pdwAttributes);
|
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
*ppidl = pidlTemp;
|
|
|
|
|
|
|
|
TRACE ("(%p)->(-- ret=0x%08lx)\n", This, hr);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2004-04-08 21:50:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
* CreateDesktopEnumList()
|
|
|
|
*/
|
2005-03-02 11:16:41 +01:00
|
|
|
static const WCHAR Desktop_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','\\','D','e','s','k','t','o','p','\\','N','a','m','e','s','p',
|
|
|
|
'a','c','e','\0' };
|
|
|
|
|
2004-04-08 21:50:17 +02:00
|
|
|
static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
BOOL ret = TRUE;
|
2005-02-23 13:45:12 +01:00
|
|
|
WCHAR szPath[MAX_PATH];
|
2004-04-08 21:50:17 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(flags=0x%08lx) \n",list,dwFlags);
|
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
/* enumerate the root folders */
|
|
|
|
if (dwFlags & SHCONTF_FOLDERS)
|
2004-04-08 21:50:17 +02:00
|
|
|
{
|
|
|
|
HKEY hkey;
|
2005-02-21 19:36:47 +01:00
|
|
|
LONG r;
|
2004-04-08 21:50:17 +02:00
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
/* create the pidl for This item */
|
2004-04-08 21:50:17 +02:00
|
|
|
ret = AddToEnumList(list, _ILCreateMyComputer());
|
|
|
|
|
2005-03-02 11:16:41 +01:00
|
|
|
r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, Desktop_NameSpaceW,
|
2005-02-21 19:36:47 +01:00
|
|
|
0, KEY_READ, &hkey);
|
|
|
|
if (ret && ERROR_SUCCESS == r)
|
2004-04-08 21:50:17 +02:00
|
|
|
{
|
2005-02-23 13:45:12 +01:00
|
|
|
WCHAR iid[50];
|
2004-04-08 21:50:17 +02:00
|
|
|
int i=0;
|
|
|
|
BOOL moreKeys = TRUE;
|
|
|
|
|
|
|
|
while (ret && moreKeys)
|
|
|
|
{
|
2005-02-21 19:36:47 +01:00
|
|
|
DWORD size;
|
2004-04-08 21:50:17 +02:00
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
size = sizeof (iid);
|
2005-02-23 13:45:12 +01:00
|
|
|
r = RegEnumKeyExW(hkey, i, iid, &size, 0, NULL, NULL, NULL);
|
2005-02-21 19:36:47 +01:00
|
|
|
if (ERROR_SUCCESS == r)
|
2004-04-08 21:50:17 +02:00
|
|
|
{
|
2005-02-23 13:45:12 +01:00
|
|
|
ret = AddToEnumList(list, _ILCreateGuidFromStrW(iid));
|
2004-04-08 21:50:17 +02:00
|
|
|
i++;
|
|
|
|
}
|
2005-02-21 19:36:47 +01:00
|
|
|
else if (ERROR_NO_MORE_ITEMS == r)
|
2004-04-08 21:50:17 +02:00
|
|
|
moreKeys = FALSE;
|
|
|
|
else
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
/* enumerate the elements in %windir%\desktop */
|
2005-02-23 13:45:12 +01:00
|
|
|
SHGetSpecialFolderPathW(0, szPath, CSIDL_DESKTOPDIRECTORY, FALSE);
|
2004-04-08 21:50:17 +02:00
|
|
|
ret = ret && CreateFolderEnumList(list, szPath, dwFlags);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
/**************************************************************************
|
2005-02-21 19:36:47 +01:00
|
|
|
* ISF_Desktop_fnEnumObjects
|
|
|
|
*/
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
|
2005-02-21 19:36:47 +01:00
|
|
|
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
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
TRACE ("(%p)->(HWND=%p flags=0x%08lx pplist=%p)\n",
|
|
|
|
This, hwndOwner, dwFlags, ppEnumIDList);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2004-04-08 21:50:17 +02:00
|
|
|
*ppEnumIDList = IEnumIDList_Constructor();
|
|
|
|
if (*ppEnumIDList)
|
|
|
|
CreateDesktopEnumList(*ppEnumIDList, dwFlags);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
|
|
|
|
|
2004-04-08 06:37:43 +02:00
|
|
|
return *ppEnumIDList ? S_OK : E_OUTOFMEMORY;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-21 19:36:47 +01:00
|
|
|
* ISF_Desktop_fnBindToObject
|
|
|
|
*/
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI ISF_Desktop_fnBindToObject (IShellFolder2 * iface,
|
2005-02-21 19:36:47 +01:00
|
|
|
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;
|
2005-03-17 14:57:38 +01:00
|
|
|
char szPath[MAX_PATH];
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-21 19:36:47 +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
|
|
|
|
2005-03-17 14:57:38 +01:00
|
|
|
WideCharToMultiByte( CP_ACP, 0, This->sPathTarget, -1,
|
|
|
|
szPath, MAX_PATH, NULL, NULL );
|
|
|
|
return SHELL32_BindToChild( This->pidlRoot, szPath, pidl, riid, ppvOut );
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-21 19:36:47 +01:00
|
|
|
* ISF_Desktop_fnBindToStorage
|
|
|
|
*/
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI ISF_Desktop_fnBindToStorage (IShellFolder2 * iface,
|
2005-02-21 19:36:47 +01:00
|
|
|
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-21 19:36:47 +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-21 19:36:47 +01:00
|
|
|
* ISF_Desktop_fnCompareIDs
|
|
|
|
*/
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI ISF_Desktop_fnCompareIDs (IShellFolder2 * iface,
|
2005-02-21 19:36:47 +01:00
|
|
|
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-21 19:36:47 +01:00
|
|
|
* ISF_Desktop_fnCreateViewObject
|
|
|
|
*/
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI ISF_Desktop_fnCreateViewObject (IShellFolder2 * iface,
|
2005-02-21 19:36:47 +01:00
|
|
|
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-21 19:36:47 +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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-21 19:36:47 +01:00
|
|
|
* ISF_Desktop_fnGetAttributesOf
|
|
|
|
*/
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
|
2005-02-21 19:36:47 +01:00
|
|
|
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;
|
|
|
|
|
2005-05-10 10:28:11 +02:00
|
|
|
TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08lx))\n",
|
|
|
|
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-21 19:36:47 +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-21 19:36:47 +01:00
|
|
|
*rgfInOut = ~0;
|
2004-04-13 02:19:11 +02:00
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
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
|
|
|
|
|
|
|
TRACE ("-- result=0x%08lx\n", *rgfInOut);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-21 19:36:47 +01:00
|
|
|
* ISF_Desktop_fnGetUIObjectOf
|
|
|
|
*
|
|
|
|
* PARAMETERS
|
|
|
|
* HWND hwndOwner, //[in ] Parent window for any output
|
|
|
|
* UINT cidl, //[in ] array size
|
|
|
|
* LPCITEMIDLIST* apidl, //[in ] simple pidl array
|
|
|
|
* REFIID riid, //[in ] Requested Interface
|
|
|
|
* UINT* prgfInOut, //[ ] reserved
|
|
|
|
* LPVOID* ppvObject) //[out] Resulting Interface
|
|
|
|
*
|
|
|
|
*/
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
|
2005-02-21 19:36:47 +01:00
|
|
|
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;
|
|
|
|
|
2002-11-22 00:56:42 +01:00
|
|
|
TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
|
2005-02-21 19:36:47 +01:00
|
|
|
This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
|
|
|
|
|
|
|
|
if (!ppvOut)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*ppvOut = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID (riid, &IID_IContextMenu))
|
|
|
|
{
|
2005-03-14 11:49:03 +01:00
|
|
|
if (cidl > 0)
|
|
|
|
pObj = (LPUNKNOWN) ISvItemCm_Constructor( (IShellFolder *) iface, This->pidlRoot, apidl, cidl);
|
|
|
|
else
|
|
|
|
pObj = (LPUNKNOWN) ISvBgCm_Constructor( (IShellFolder *) iface, TRUE);
|
2005-02-21 19:36:47 +01:00
|
|
|
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;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
2005-02-21 19:36:47 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
hr = E_NOINTERFACE;
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr) && !pObj)
|
|
|
|
hr = E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
*ppvOut = pObj;
|
2002-07-24 03:56:03 +02:00
|
|
|
TRACE ("(%p)->hr=0x%08lx\n", This, hr);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-21 19:36:47 +01:00
|
|
|
* ISF_Desktop_fnGetDisplayNameOf
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* special case: pidl = null gives desktop-name back
|
|
|
|
*/
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
|
2005-02-21 19:36:47 +01:00
|
|
|
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
|
|
|
HRESULT hr = S_OK;
|
|
|
|
|
|
|
|
TRACE ("(%p)->(pidl=%p,0x%08lx,%p)\n", This, pidl, dwFlags, strRet);
|
|
|
|
pdump (pidl);
|
|
|
|
|
|
|
|
if (!strRet)
|
2005-02-21 19:36:47 +01:00
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2005-04-12 12:15:29 +02:00
|
|
|
strRet->uType = STRRET_CSTR;
|
2005-02-21 19:36:47 +01:00
|
|
|
if (_ILIsDesktop (pidl))
|
|
|
|
{
|
|
|
|
if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
|
|
|
|
(GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING))
|
|
|
|
{
|
2005-04-12 12:15:29 +02:00
|
|
|
BOOL defCharUsed;
|
|
|
|
|
2005-03-17 14:57:38 +01:00
|
|
|
WideCharToMultiByte( CP_ACP, 0, This->sPathTarget, -1,
|
2005-04-12 12:15:29 +02:00
|
|
|
strRet->u.cStr, MAX_PATH, NULL, &defCharUsed );
|
|
|
|
if (defCharUsed)
|
|
|
|
{
|
|
|
|
strRet->u.pOleStr = SHAlloc((lstrlenW(This->sPathTarget)+1) *
|
|
|
|
sizeof(WCHAR));
|
|
|
|
if (!strRet->u.pOleStr)
|
|
|
|
hr = E_OUTOFMEMORY;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpyW(strRet->u.pOleStr, This->sPathTarget);
|
|
|
|
strRet->uType = STRRET_WSTR;
|
|
|
|
}
|
|
|
|
}
|
2005-02-21 19:36:47 +01:00
|
|
|
}
|
|
|
|
else
|
2005-04-12 12:15:29 +02:00
|
|
|
{
|
|
|
|
HCR_GetClassNameA(&CLSID_ShellDesktop, strRet->u.cStr, MAX_PATH);
|
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
2005-02-21 19:36:47 +01:00
|
|
|
else if (_ILIsPidlSimple (pidl))
|
|
|
|
{
|
2005-04-12 12:15:29 +02:00
|
|
|
GUID const *clsid;
|
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
if ((clsid = _ILGetGUIDPointer (pidl)))
|
|
|
|
{
|
|
|
|
if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING)
|
|
|
|
{
|
|
|
|
int bWantsForParsing;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We can only get a filesystem path from a shellfolder if the
|
|
|
|
* value WantsFORPARSING in CLSID\\{...}\\shellfolder exists.
|
|
|
|
*
|
|
|
|
* Exception: The MyComputer folder doesn't have this key,
|
|
|
|
* but any other filesystem backed folder it needs it.
|
|
|
|
*/
|
|
|
|
if (IsEqualIID (clsid, &CLSID_MyComputer))
|
|
|
|
{
|
2005-04-12 12:15:29 +02:00
|
|
|
bWantsForParsing = TRUE;
|
2005-02-21 19:36:47 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* get the "WantsFORPARSING" flag from the registry */
|
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 };
|
|
|
|
WCHAR szRegPath[100];
|
2005-02-21 19:36:47 +01:00
|
|
|
LONG r;
|
|
|
|
|
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-21 19:36:47 +01:00
|
|
|
if (r == ERROR_SUCCESS)
|
|
|
|
bWantsForParsing = TRUE;
|
|
|
|
else
|
|
|
|
bWantsForParsing = FALSE;
|
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
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, dwFlags,
|
2005-04-12 12:15:29 +02:00
|
|
|
strRet->u.cStr,
|
|
|
|
MAX_PATH);
|
2005-02-21 19:36:47 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* parsing name like ::{...} */
|
2005-04-12 12:15:29 +02:00
|
|
|
lstrcpyA (strRet->u.cStr, "::");
|
|
|
|
SHELL32_GUIDToStringA (clsid, &strRet->u.cStr[2]);
|
2005-02-21 19:36:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* user friendly name */
|
2005-04-12 12:15:29 +02:00
|
|
|
HCR_GetClassNameA (clsid, strRet->u.cStr, MAX_PATH);
|
2005-02-21 19:36:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* file system folder */
|
2005-04-12 12:15:29 +02:00
|
|
|
_ILSimpleGetText (pidl, strRet->u.cStr, MAX_PATH);
|
2005-02-21 19:36:47 +01:00
|
|
|
|
|
|
|
if (!_ILIsFolder(pidl))
|
2005-04-12 12:15:29 +02:00
|
|
|
SHELL_FS_ProcessDisplayFilename(strRet->u.cStr, dwFlags);
|
2005-02-21 19:36:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* a complex pidl, let the subfolder do the work */
|
2005-04-12 12:15:29 +02:00
|
|
|
hr = SHELL32_GetDisplayNameOfChild (iface, pidl, dwFlags,
|
|
|
|
strRet->u.cStr, MAX_PATH);
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
2005-04-12 12:15:29 +02:00
|
|
|
TRACE ("-- (%p)->(%s,0x%08lx)\n", This,
|
|
|
|
strRet->uType == STRRET_CSTR ? strRet->u.cStr :
|
|
|
|
debugstr_w(strRet->u.pOleStr), hr);
|
2002-07-24 03:56:03 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-02-21 19:36:47 +01:00
|
|
|
* ISF_Desktop_fnSetNameOf
|
|
|
|
* Changes the name of a file object or subfolder, possibly changing its item
|
|
|
|
* identifier in the process.
|
|
|
|
*
|
|
|
|
* PARAMETERS
|
|
|
|
* HWND hwndOwner, //[in ] Owner window for output
|
|
|
|
* LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
|
|
|
|
* LPCOLESTR lpszName, //[in ] the items new display name
|
|
|
|
* DWORD dwFlags, //[in ] SHGNO formatting flags
|
|
|
|
* LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface,
|
|
|
|
HWND hwndOwner, LPCITEMIDLIST pidl, /* simple 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;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl,
|
|
|
|
debugstr_w (lpName), dwFlags, pPidlOut);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
static HRESULT WINAPI ISF_Desktop_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-21 19:36:47 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI ISF_Desktop_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-21 19:36:47 +01:00
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn (IShellFolder2 * iface,
|
2005-02-21 19:36:47 +01:00
|
|
|
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);
|
|
|
|
|
|
|
|
if (pSort)
|
2005-02-21 19:36:47 +01:00
|
|
|
*pSort = 0;
|
2002-07-24 03:56:03 +02:00
|
|
|
if (pDisplay)
|
2005-02-21 19:36:47 +01:00
|
|
|
*pDisplay = 0;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2005-02-21 19:36:47 +01:00
|
|
|
static HRESULT WINAPI ISF_Desktop_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);
|
|
|
|
|
|
|
|
if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
|
2005-02-21 19:36:47 +01:00
|
|
|
return E_INVALIDARG;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
*pcsFlags = DesktopSFHeader[iColumn].pcsFlags;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2005-02-21 19:36:47 +01:00
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx (IShellFolder2 * iface,
|
2005-02-21 19:36:47 +01:00
|
|
|
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;
|
|
|
|
}
|
2005-02-21 19:36:47 +01:00
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface,
|
2005-02-21 19:36:47 +01:00
|
|
|
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
|
|
|
|
2005-04-12 12:15:29 +02:00
|
|
|
HRESULT hr = S_OK;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
|
|
|
|
|
|
|
|
if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
|
2005-02-21 19:36:47 +01:00
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (!pidl)
|
|
|
|
{
|
|
|
|
psd->fmt = DesktopSFHeader[iColumn].fmt;
|
|
|
|
psd->cxChar = DesktopSFHeader[iColumn].cxChar;
|
|
|
|
psd->str.uType = STRRET_CSTR;
|
|
|
|
LoadStringA (shell32_hInstance, DesktopSFHeader[iColumn].colnameid,
|
|
|
|
psd->str.u.cStr, MAX_PATH);
|
|
|
|
return S_OK;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
2005-02-21 19:36:47 +01:00
|
|
|
/* the data from the pidl */
|
2005-04-12 12:15:29 +02:00
|
|
|
psd->str.uType = STRRET_CSTR;
|
2005-02-21 19:36:47 +01:00
|
|
|
switch (iColumn)
|
|
|
|
{
|
|
|
|
case 0: /* name */
|
|
|
|
hr = IShellFolder_GetDisplayNameOf(iface, pidl,
|
|
|
|
SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
|
|
|
|
break;
|
|
|
|
case 1: /* size */
|
|
|
|
_ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);
|
|
|
|
break;
|
|
|
|
case 2: /* type */
|
|
|
|
_ILGetFileType (pidl, psd->str.u.cStr, MAX_PATH);
|
|
|
|
break;
|
|
|
|
case 3: /* date */
|
|
|
|
_ILGetFileDate (pidl, psd->str.u.cStr, MAX_PATH);
|
|
|
|
break;
|
|
|
|
case 4: /* attributes */
|
|
|
|
_ILGetFileAttributes (pidl, psd->str.u.cStr, MAX_PATH);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
return hr;
|
|
|
|
}
|
2005-02-21 19:36:47 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI ISF_Desktop_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;
|
|
|
|
}
|
|
|
|
|
2004-08-13 01:00:51 +02:00
|
|
|
static IShellFolder2Vtbl vt_MCFldr_ShellFolder2 =
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-02-21 19:36:47 +01:00
|
|
|
ISF_Desktop_fnQueryInterface,
|
|
|
|
ISF_Desktop_fnAddRef,
|
|
|
|
ISF_Desktop_fnRelease,
|
|
|
|
ISF_Desktop_fnParseDisplayName,
|
|
|
|
ISF_Desktop_fnEnumObjects,
|
|
|
|
ISF_Desktop_fnBindToObject,
|
|
|
|
ISF_Desktop_fnBindToStorage,
|
|
|
|
ISF_Desktop_fnCompareIDs,
|
|
|
|
ISF_Desktop_fnCreateViewObject,
|
|
|
|
ISF_Desktop_fnGetAttributesOf,
|
|
|
|
ISF_Desktop_fnGetUIObjectOf,
|
|
|
|
ISF_Desktop_fnGetDisplayNameOf,
|
|
|
|
ISF_Desktop_fnSetNameOf,
|
|
|
|
/* ShellFolder2 */
|
|
|
|
ISF_Desktop_fnGetDefaultSearchGUID,
|
|
|
|
ISF_Desktop_fnEnumSearches,
|
|
|
|
ISF_Desktop_fnGetDefaultColumn,
|
|
|
|
ISF_Desktop_fnGetDefaultColumnState,
|
|
|
|
ISF_Desktop_fnGetDetailsEx,
|
|
|
|
ISF_Desktop_fnGetDetailsOf,
|
|
|
|
ISF_Desktop_fnMapColumnToSCID
|
|
|
|
};
|
2005-03-17 14:57:38 +01:00
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_Desktop_Constructor
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI ISF_Desktop_Constructor (
|
|
|
|
IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
|
|
|
|
{
|
|
|
|
IGenericSFImpl *sf;
|
|
|
|
WCHAR szMyPath[MAX_PATH];
|
|
|
|
HRESULT r;
|
|
|
|
|
|
|
|
TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
|
|
|
|
|
|
|
|
if (!ppv)
|
|
|
|
return E_POINTER;
|
|
|
|
if (pUnkOuter)
|
|
|
|
return CLASS_E_NOAGGREGATION;
|
|
|
|
|
|
|
|
if (!SHGetSpecialFolderPathW( 0, szMyPath, CSIDL_DESKTOPDIRECTORY, TRUE ))
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
|
2005-03-17 21:53:37 +01:00
|
|
|
sf = LocalAlloc( LMEM_ZEROINIT, sizeof (IGenericSFImpl) );
|
2005-03-17 14:57:38 +01:00
|
|
|
if (!sf)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
sf->ref = 0;
|
|
|
|
sf->lpVtbl = &vt_MCFldr_ShellFolder2;
|
|
|
|
sf->pidlRoot = _ILCreateDesktop(); /* my qualified pidl */
|
|
|
|
sf->sPathTarget = SHAlloc( (lstrlenW(szMyPath) + 1)*sizeof(WCHAR) );
|
|
|
|
lstrcpyW( sf->sPathTarget, szMyPath );
|
|
|
|
|
|
|
|
r = IUnknown_QueryInterface( _IUnknown_(sf), riid, ppv );
|
|
|
|
if (!SUCCEEDED (r))
|
|
|
|
{
|
|
|
|
IUnknown_Release( _IUnknown_(sf) );
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE ("--(%p)\n", sf);
|
|
|
|
return S_OK;
|
|
|
|
}
|