2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
/*
|
2005-03-01 11:41:14 +01:00
|
|
|
* file system folder
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
2005-03-01 11:41:14 +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"
|
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);
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* IShellFolder implementation
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct {
|
2005-06-06 21:50:35 +02:00
|
|
|
const IUnknownVtbl *lpVtbl;
|
2005-07-03 14:03:35 +02:00
|
|
|
LONG ref;
|
2005-06-06 21:50:35 +02:00
|
|
|
const IShellFolder2Vtbl *lpvtblShellFolder;
|
|
|
|
const IPersistFolder3Vtbl *lpvtblPersistFolder3;
|
|
|
|
const IDropTargetVtbl *lpvtblDropTarget;
|
|
|
|
const ISFHelperVtbl *lpvtblSFHelper;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
IUnknown *pUnkOuter; /* used for aggregation */
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
CLSID *pclsid;
|
|
|
|
|
|
|
|
/* both paths are parsible from the desktop */
|
2006-01-16 21:31:48 +01:00
|
|
|
LPWSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
LPITEMIDLIST pidlRoot; /* absolute pidl */
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
UINT cfShellIDList; /* clipboardformat for IDropTarget */
|
|
|
|
BOOL fAcceptFmt; /* flag for pending Drop */
|
2002-07-24 03:56:03 +02:00
|
|
|
} IGenericSFImpl;
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IUnknownVtbl unkvt;
|
|
|
|
static const IShellFolder2Vtbl sfvt;
|
|
|
|
static const IPersistFolder3Vtbl vt_FSFldr_PersistFolder3; /* IPersistFolder3 for a FS_Folder */
|
|
|
|
static const IDropTargetVtbl dtvt;
|
|
|
|
static const ISFHelperVtbl shvt;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-07-27 13:10:52 +02:00
|
|
|
static inline IGenericSFImpl *impl_from_IShellFolder2( IShellFolder2 *iface )
|
|
|
|
{
|
|
|
|
return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblShellFolder));
|
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-07-27 13:10:52 +02:00
|
|
|
static inline IGenericSFImpl *impl_from_IPersistFolder3( IPersistFolder3 *iface )
|
|
|
|
{
|
|
|
|
return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblPersistFolder3));
|
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-07-27 13:10:52 +02:00
|
|
|
static inline IGenericSFImpl *impl_from_IDropTarget( IDropTarget *iface )
|
|
|
|
{
|
|
|
|
return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblDropTarget));
|
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-07-27 13:10:52 +02:00
|
|
|
static inline IGenericSFImpl *impl_from_ISFHelper( ISFHelper *iface )
|
|
|
|
{
|
|
|
|
return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblSFHelper));
|
|
|
|
}
|
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
|
|
|
*/
|
2009-02-18 22:45:59 +01:00
|
|
|
#define _IUnknown_(This) ((IUnknown*)&(This)->lpVtbl)
|
|
|
|
#define _IShellFolder_(This) ((IShellFolder*)&(This)->lpvtblShellFolder)
|
|
|
|
#define _IShellFolder2_(This) ((IShellFolder2*)&(This)->lpvtblShellFolder)
|
|
|
|
#define _IPersist_(This) (&(This)->lpvtblPersistFolder3)
|
|
|
|
#define _IPersistFolder_(This) (&(This)->lpvtblPersistFolder3)
|
|
|
|
#define _IPersistFolder2_(This) (&(This)->lpvtblPersistFolder3)
|
|
|
|
#define _IPersistFolder3_(This) (&(This)->lpvtblPersistFolder3)
|
|
|
|
#define _IDropTarget_(This) (&(This)->lpvtblDropTarget)
|
|
|
|
#define _ISFHelper_(This) (&(This)->lpvtblSFHelper)
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
/**************************************************************************
|
2005-03-01 11:41:14 +01:00
|
|
|
* registers clipboardformat once
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
|
|
|
static void SF_RegisterClipFmt (IGenericSFImpl * This)
|
|
|
|
{
|
|
|
|
TRACE ("(%p)\n", This);
|
|
|
|
|
|
|
|
if (!This->cfShellIDList) {
|
2008-06-18 17:04:46 +02:00
|
|
|
This->cfShellIDList = RegisterClipboardFormatW (CFSTR_SHELLIDLISTW);
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-03-01 11:41:14 +01:00
|
|
|
* we need a separate IUnknown to handle aggregation
|
|
|
|
* (inner IUnknown)
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
|
|
|
static HRESULT WINAPI IUnknown_fnQueryInterface (IUnknown * iface, REFIID riid, LPVOID * ppvObj)
|
|
|
|
{
|
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-03-01 11:41:14 +01:00
|
|
|
*ppvObj = _IUnknown_ (This);
|
2002-07-24 03:56:03 +02:00
|
|
|
else if (IsEqualIID (riid, &IID_IShellFolder))
|
2005-03-01 11:41:14 +01:00
|
|
|
*ppvObj = _IShellFolder_ (This);
|
2002-07-24 03:56:03 +02:00
|
|
|
else if (IsEqualIID (riid, &IID_IShellFolder2))
|
2005-03-01 11:41:14 +01:00
|
|
|
*ppvObj = _IShellFolder_ (This);
|
2002-07-24 03:56:03 +02:00
|
|
|
else if (IsEqualIID (riid, &IID_IPersist))
|
2005-03-01 11:41:14 +01:00
|
|
|
*ppvObj = _IPersist_ (This);
|
2002-07-24 03:56:03 +02:00
|
|
|
else if (IsEqualIID (riid, &IID_IPersistFolder))
|
2005-03-01 11:41:14 +01:00
|
|
|
*ppvObj = _IPersistFolder_ (This);
|
2002-07-24 03:56:03 +02:00
|
|
|
else if (IsEqualIID (riid, &IID_IPersistFolder2))
|
2005-03-01 11:41:14 +01:00
|
|
|
*ppvObj = _IPersistFolder2_ (This);
|
2002-07-24 03:56:03 +02:00
|
|
|
else if (IsEqualIID (riid, &IID_IPersistFolder3))
|
2005-03-01 11:41:14 +01:00
|
|
|
*ppvObj = _IPersistFolder3_ (This);
|
2002-07-24 03:56:03 +02:00
|
|
|
else if (IsEqualIID (riid, &IID_ISFHelper))
|
2005-03-01 11:41:14 +01:00
|
|
|
*ppvObj = _ISFHelper_ (This);
|
2002-07-24 03:56:03 +02:00
|
|
|
else if (IsEqualIID (riid, &IID_IDropTarget)) {
|
2005-03-01 11:41:14 +01:00
|
|
|
*ppvObj = _IDropTarget_ (This);
|
|
|
|
SF_RegisterClipFmt (This);
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (*ppvObj) {
|
2005-03-01 11:41:14 +01:00
|
|
|
IUnknown_AddRef ((IUnknown *) (*ppvObj));
|
|
|
|
TRACE ("-- Interface = %p\n", *ppvObj);
|
|
|
|
return S_OK;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
TRACE ("-- Interface: E_NOINTERFACE\n");
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IUnknown_fnAddRef (IUnknown * 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 IUnknown_fnRelease (IUnknown * 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-01-14 17:02:20 +01:00
|
|
|
if (!refCount) {
|
2005-03-01 11:41:14 +01:00
|
|
|
TRACE ("-- destroying IShellFolder(%p)\n", This);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-10-07 03:06:26 +02:00
|
|
|
SHFree (This->pidlRoot);
|
|
|
|
SHFree (This->sPathTarget);
|
2009-02-18 22:46:39 +01:00
|
|
|
LocalFree (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-06-06 21:50:35 +02:00
|
|
|
static const IUnknownVtbl unkvt =
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2004-08-23 21:39:48 +02:00
|
|
|
IUnknown_fnQueryInterface,
|
2002-07-24 03:56:03 +02:00
|
|
|
IUnknown_fnAddRef,
|
|
|
|
IUnknown_fnRelease,
|
|
|
|
};
|
|
|
|
|
2006-11-28 11:38:58 +01:00
|
|
|
static const shvheader GenericSFHeader[] = {
|
2002-07-24 03:56:03 +02:00
|
|
|
{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 GENERICSHELLVIEWCOLUMNS 5
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-03-01 11:41:14 +01:00
|
|
|
* IFSFolder_Constructor
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* creating undocumented ShellFS_Folder as part of an aggregation
|
|
|
|
* {F3364BA0-65B9-11CE-A9BA-00AA004AE837}
|
|
|
|
*
|
|
|
|
*/
|
2005-03-01 11:41:14 +01:00
|
|
|
HRESULT WINAPI
|
|
|
|
IFSFolder_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
|
|
|
IGenericSFImpl *sf;
|
|
|
|
|
|
|
|
TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
|
|
|
|
|
|
|
|
if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown))
|
2005-03-01 11:41:14 +01:00
|
|
|
return CLASS_E_NOAGGREGATION;
|
2008-11-05 23:00:50 +01:00
|
|
|
sf = LocalAlloc (LMEM_ZEROINIT, sizeof (IGenericSFImpl));
|
2002-07-24 03:56:03 +02:00
|
|
|
if (!sf)
|
2005-03-01 11:41:14 +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 = &unkvt;
|
2002-07-24 03:56:03 +02:00
|
|
|
sf->lpvtblShellFolder = &sfvt;
|
|
|
|
sf->lpvtblPersistFolder3 = &vt_FSFldr_PersistFolder3;
|
|
|
|
sf->lpvtblDropTarget = &dtvt;
|
|
|
|
sf->lpvtblSFHelper = &shvt;
|
|
|
|
sf->pclsid = (CLSID *) & CLSID_ShellFSFolder;
|
|
|
|
sf->pUnkOuter = pUnkOuter ? pUnkOuter : _IUnknown_ (sf);
|
|
|
|
|
2008-10-08 01:32:38 +02:00
|
|
|
if (FAILED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv))) {
|
2005-03-01 11:41:14 +01:00
|
|
|
IUnknown_Release (_IUnknown_ (sf));
|
|
|
|
return E_NOINTERFACE;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TRACE ("--%p\n", *ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IShellFolder_fnQueryInterface
|
|
|
|
*
|
|
|
|
* PARAMETERS
|
2005-03-01 11:41:14 +01:00
|
|
|
* REFIID riid [in ] Requested InterfaceID
|
|
|
|
* LPVOID* ppvObject [out] Interface* to hold the result
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
2005-03-01 11:41:14 +01:00
|
|
|
static HRESULT WINAPI
|
|
|
|
IShellFolder_fnQueryInterface (IShellFolder2 * iface, REFIID riid,
|
|
|
|
LPVOID * ppvObj)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
return IUnknown_QueryInterface (This->pUnkOuter, riid, ppvObj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IShellFolder_AddRef
|
|
|
|
*/
|
|
|
|
|
|
|
|
static ULONG WINAPI IShellFolder_fnAddRef (IShellFolder2 * iface)
|
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(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 (This->pUnkOuter);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IShellFolder_fnRelease
|
|
|
|
*/
|
|
|
|
static ULONG WINAPI IShellFolder_fnRelease (IShellFolder2 * iface)
|
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(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 (This->pUnkOuter);
|
|
|
|
}
|
|
|
|
|
2005-02-22 16:47:21 +01:00
|
|
|
/**************************************************************************
|
|
|
|
* SHELL32_CreatePidlFromBindCtx [internal]
|
|
|
|
*
|
|
|
|
* If the caller bound File System Bind Data, assume it is the
|
|
|
|
* find data for the path.
|
2005-03-02 14:53:50 +01:00
|
|
|
* This allows binding of paths that don't exist.
|
2005-02-22 16:47:21 +01:00
|
|
|
*/
|
|
|
|
LPITEMIDLIST SHELL32_CreatePidlFromBindCtx(IBindCtx *pbc, LPCWSTR path)
|
|
|
|
{
|
2006-09-29 23:13:48 +02:00
|
|
|
static WCHAR szfsbc[] = {
|
2005-02-22 16:47:21 +01:00
|
|
|
'F','i','l','e',' ','S','y','s','t','e','m',' ',
|
|
|
|
'B','i','n','d',' ','D','a','t','a',0 };
|
|
|
|
IFileSystemBindData *fsbd = NULL;
|
|
|
|
LPITEMIDLIST pidl = NULL;
|
2011-01-18 20:45:03 +01:00
|
|
|
IUnknown *unk = NULL;
|
2005-02-22 16:47:21 +01:00
|
|
|
HRESULT r;
|
|
|
|
|
|
|
|
TRACE("%p %s\n", pbc, debugstr_w(path));
|
|
|
|
|
|
|
|
if (!pbc)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* see if the caller bound File System Bind Data */
|
2011-01-18 20:45:03 +01:00
|
|
|
r = IBindCtx_GetObjectParam( pbc, szfsbc, &unk );
|
2005-02-22 16:47:21 +01:00
|
|
|
if (FAILED(r))
|
|
|
|
return NULL;
|
|
|
|
|
2011-01-18 20:45:03 +01:00
|
|
|
r = IUnknown_QueryInterface( unk, &IID_IFileSystemBindData, (void**)&fsbd );
|
2005-02-22 16:47:21 +01:00
|
|
|
if (SUCCEEDED(r))
|
|
|
|
{
|
2011-01-18 20:45:03 +01:00
|
|
|
WIN32_FIND_DATAW wfd;
|
|
|
|
|
2005-02-22 16:47:21 +01:00
|
|
|
r = IFileSystemBindData_GetFindData( fsbd, &wfd );
|
|
|
|
if (SUCCEEDED(r))
|
|
|
|
{
|
|
|
|
lstrcpynW( &wfd.cFileName[0], path, MAX_PATH );
|
|
|
|
pidl = _ILCreateFromFindDataW( &wfd );
|
|
|
|
}
|
|
|
|
IFileSystemBindData_Release( fsbd );
|
|
|
|
}
|
2011-01-18 20:45:03 +01:00
|
|
|
IUnknown_Release( unk );
|
2005-02-22 16:47:21 +01:00
|
|
|
|
|
|
|
return pidl;
|
|
|
|
}
|
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
/**************************************************************************
|
2003-03-18 19:35:48 +01:00
|
|
|
* IShellFolder_ParseDisplayName {SHELL32}
|
|
|
|
*
|
|
|
|
* Parse a display name.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hwndOwner [in] Parent window for any message's
|
2003-09-17 06:17:33 +02:00
|
|
|
* pbc [in] optional FileSystemBindData context
|
2003-03-18 19:35:48 +01:00
|
|
|
* lpszDisplayName [in] Unicode displayname.
|
|
|
|
* pchEaten [out] (unicode) characters processed
|
|
|
|
* ppidl [out] complex pidl to item
|
|
|
|
* pdwAttributes [out] items attributes
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
|
|
|
* NOTES
|
2003-03-18 19:35:48 +01:00
|
|
|
* Every folder tries to parse only its own (the leftmost) pidl and creates a
|
|
|
|
* subfolder to evaluate the remaining parts.
|
|
|
|
* Now we can parse into namespaces implemented by shell extensions
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
2005-03-01 11:41:14 +01:00
|
|
|
* Behaviour on win98: lpszDisplayName=NULL -> crash
|
|
|
|
* lpszDisplayName="" -> returns mycoputer-pidl
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* FIXME
|
|
|
|
* pdwAttributes is not set
|
|
|
|
* pchEaten is not set like in windows
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
|
|
|
IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
|
2005-03-01 11:41:14 +01:00
|
|
|
HWND hwndOwner,
|
|
|
|
LPBC pbc,
|
|
|
|
LPOLESTR lpszDisplayName,
|
|
|
|
DWORD * pchEaten, LPITEMIDLIST * ppidl,
|
|
|
|
DWORD * pdwAttributes)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2004-01-23 21:45:41 +01:00
|
|
|
HRESULT hr = E_INVALIDARG;
|
2002-07-24 03:56:03 +02:00
|
|
|
LPCWSTR szNext = NULL;
|
|
|
|
WCHAR szElement[MAX_PATH];
|
2005-02-22 16:47:21 +01:00
|
|
|
WCHAR szPath[MAX_PATH];
|
2002-07-24 03:56:03 +02:00
|
|
|
LPITEMIDLIST pidlTemp = NULL;
|
2003-03-27 00:35:23 +01:00
|
|
|
DWORD len;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2002-11-22 00:56:42 +01:00
|
|
|
TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
|
2005-03-01 11:41:14 +01:00
|
|
|
This, hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName),
|
|
|
|
pchEaten, ppidl, pdwAttributes);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
if (!lpszDisplayName || !ppidl)
|
2005-03-01 11:41:14 +01:00
|
|
|
return E_INVALIDARG;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
if (pchEaten)
|
2005-03-01 11:41:14 +01:00
|
|
|
*pchEaten = 0; /* strange but like the original */
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-02-22 16:47:21 +01:00
|
|
|
pidlTemp = SHELL32_CreatePidlFromBindCtx(pbc, lpszDisplayName);
|
|
|
|
if (!pidlTemp && *lpszDisplayName)
|
|
|
|
{
|
2005-03-01 11:41:14 +01:00
|
|
|
/* get the next element */
|
|
|
|
szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
/* build the full pathname to the element */
|
2006-01-16 21:31:48 +01:00
|
|
|
lstrcpynW(szPath, This->sPathTarget, MAX_PATH - 1);
|
2005-02-22 16:47:21 +01:00
|
|
|
PathAddBackslashW(szPath);
|
|
|
|
len = lstrlenW(szPath);
|
|
|
|
lstrcpynW(szPath + len, szElement, MAX_PATH - len);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
/* get the pidl */
|
|
|
|
hr = _ILCreateFromPathW(szPath, &pidlTemp);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
if (szNext && *szNext) {
|
|
|
|
/* try to analyse the next element */
|
|
|
|
hr = SHELL32_ParseNextElement (iface, hwndOwner, pbc,
|
|
|
|
&pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
|
|
|
|
} else {
|
|
|
|
/* it's the last element */
|
|
|
|
if (pdwAttributes && *pdwAttributes) {
|
|
|
|
hr = SHELL32_GetItemAttributes (_IShellFolder_ (This),
|
|
|
|
pidlTemp, pdwAttributes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
2004-04-15 01:57:46 +02:00
|
|
|
if (SUCCEEDED(hr))
|
2005-03-01 11:41:14 +01:00
|
|
|
*ppidl = pidlTemp;
|
2002-07-24 03:56:03 +02:00
|
|
|
else
|
2005-03-01 11:41:14 +01:00
|
|
|
*ppidl = NULL;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2010-05-18 01:31:40 +02:00
|
|
|
TRACE ("(%p)->(-- pidl=%p ret=0x%08x)\n", This, *ppidl, hr);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-03-01 11:41:14 +01:00
|
|
|
* IShellFolder_fnEnumObjects
|
2002-07-24 03:56:03 +02:00
|
|
|
* PARAMETERS
|
|
|
|
* HWND hwndOwner, //[in ] Parent Window
|
|
|
|
* DWORD grfFlags, //[in ] SHCONTF enumeration mask
|
|
|
|
* LPENUMIDLIST* ppenumIDList //[out] IEnumIDList interface
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
2005-03-01 11:41:14 +01:00
|
|
|
IShellFolder_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner,
|
|
|
|
DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(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, hwndOwner,
|
2005-03-01 11:41:14 +01:00
|
|
|
dwFlags, ppEnumIDList);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2004-04-08 21:50:17 +02:00
|
|
|
*ppEnumIDList = IEnumIDList_Constructor();
|
|
|
|
if (*ppEnumIDList)
|
2006-01-16 21:31:48 +01:00
|
|
|
CreateFolderEnumList(*ppEnumIDList, This->sPathTarget, 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-03-01 11:41:14 +01:00
|
|
|
* IShellFolder_fnBindToObject
|
2002-07-24 03:56:03 +02:00
|
|
|
* PARAMETERS
|
|
|
|
* LPCITEMIDLIST pidl, //[in ] relative pidl to open
|
2003-09-17 06:17:33 +02:00
|
|
|
* LPBC pbc, //[in ] optional FileSystemBindData context
|
2002-07-24 03:56:03 +02:00
|
|
|
* REFIID riid, //[in ] Initial Interface
|
|
|
|
* LPVOID* ppvObject //[out] Interface*
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
2005-03-01 11:41:14 +01:00
|
|
|
IShellFolder_fnBindToObject (IShellFolder2 * iface, LPCITEMIDLIST pidl,
|
|
|
|
LPBC pbc, REFIID riid, LPVOID * ppvOut)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This, pidl, pbc,
|
|
|
|
shdebugstr_guid (riid), ppvOut);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-01-16 21:31:48 +01:00
|
|
|
return SHELL32_BindToChild (This->pidlRoot, This->sPathTarget, pidl, riid,
|
2005-03-01 11:41:14 +01:00
|
|
|
ppvOut);
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IShellFolder_fnBindToStorage
|
|
|
|
* PARAMETERS
|
|
|
|
* LPCITEMIDLIST pidl, //[in ] complex pidl to store
|
|
|
|
* LPBC pbc, //[in ] reserved
|
|
|
|
* REFIID riid, //[in ] Initial storage interface
|
|
|
|
* LPVOID* ppvObject //[out] Interface* returned
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
2005-03-01 11:41:14 +01:00
|
|
|
IShellFolder_fnBindToStorage (IShellFolder2 * iface, LPCITEMIDLIST pidl,
|
|
|
|
LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-03-01 11:41:14 +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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IShellFolder_fnCompareIDs
|
|
|
|
*/
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
2005-03-01 11:41:14 +01:00
|
|
|
IShellFolder_fnCompareIDs (IShellFolder2 * iface, LPARAM lParam,
|
|
|
|
LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(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-03-01 11:41:14 +01:00
|
|
|
* IShellFolder_fnCreateViewObject
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
2005-03-01 11:41:14 +01:00
|
|
|
IShellFolder_fnCreateViewObject (IShellFolder2 * iface, HWND hwndOwner,
|
|
|
|
REFIID riid, LPVOID * ppvOut)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
LPSHELLVIEW pShellView;
|
|
|
|
HRESULT hr = E_INVALIDARG;
|
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This, hwndOwner, shdebugstr_guid (riid),
|
|
|
|
ppvOut);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
if (ppvOut) {
|
2005-03-01 11:41:14 +01:00
|
|
|
*ppvOut = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID (riid, &IID_IDropTarget)) {
|
|
|
|
hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, ppvOut);
|
|
|
|
} else if (IsEqualIID (riid, &IID_IContextMenu)) {
|
|
|
|
FIXME ("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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IShellFolder_fnGetAttributesOf
|
|
|
|
*
|
|
|
|
* PARAMETERS
|
|
|
|
* UINT cidl, //[in ] num elements in pidl array
|
|
|
|
* LPCITEMIDLIST* apidl, //[in ] simple pidl array
|
|
|
|
* ULONG* rgfInOut) //[out] result array
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
2005-03-01 11:41:14 +01:00
|
|
|
IShellFolder_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl,
|
|
|
|
LPCITEMIDLIST * apidl, DWORD * rgfInOut)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(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", This, cidl, apidl,
|
2005-05-10 10:28:11 +02:00
|
|
|
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-03-01 11:41:14 +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-03-01 11:41:14 +01:00
|
|
|
*rgfInOut = ~0;
|
2004-04-13 02:19:11 +02:00
|
|
|
|
2005-05-26 18:09:12 +02:00
|
|
|
if(cidl == 0){
|
|
|
|
IShellFolder *psfParent = NULL;
|
|
|
|
LPCITEMIDLIST rpidl = NULL;
|
|
|
|
|
2008-01-19 17:54:28 +01:00
|
|
|
hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (LPVOID*)&psfParent, &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;
|
|
|
|
}
|
|
|
|
|
2010-11-10 14:19:29 +01:00
|
|
|
/**************************************************************************
|
|
|
|
* SHELL32_CreateExtensionUIObject (internal)
|
|
|
|
*/
|
|
|
|
HRESULT SHELL32_CreateExtensionUIObject(IShellFolder2 *iface,
|
|
|
|
LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
|
|
|
|
{
|
|
|
|
static const WCHAR reg_blockedW[] = {'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','\\',
|
|
|
|
'S','h','e','l','l',' ','E','x','t','e','n','s','i','o','n','s','\\',
|
|
|
|
'B','l','o','c','k','e','d',0};
|
|
|
|
static const WCHAR formatW[] = {'.','%','s','\\','S','h','e','l','l','E','x','\\',
|
|
|
|
'{','%','0','8','x','-','%','0','4','x','-','%','0','4','x','-',
|
|
|
|
'%','0','2','x','%','0','2','x','-','%','0','2','x','%','0','2','x',
|
|
|
|
'%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','}',0};
|
|
|
|
|
|
|
|
IPersistFile *persist_file;
|
|
|
|
char extensionA[20];
|
|
|
|
WCHAR extensionW[20], buf[MAX_PATH];
|
|
|
|
DWORD size = MAX_PATH;
|
|
|
|
STRRET path;
|
|
|
|
WCHAR *file;
|
|
|
|
GUID guid;
|
|
|
|
HKEY key;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
|
|
|
|
if(!_ILGetExtension(pidl, extensionA, 20))
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, extensionA, -1, extensionW, 20);
|
|
|
|
|
|
|
|
sprintfW(buf, formatW, extensionW, riid->Data1, riid->Data2, riid->Data3,
|
|
|
|
riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
|
|
|
|
riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]);
|
|
|
|
|
|
|
|
if(RegGetValueW(HKEY_CLASSES_ROOT, buf, NULL, RRF_RT_REG_SZ,
|
|
|
|
NULL, buf, &size) != ERROR_SUCCESS)
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
if(RegCreateKeyExW(HKEY_LOCAL_MACHINE, reg_blockedW, 0, 0, 0,
|
|
|
|
KEY_READ, NULL, &key, NULL) != ERROR_SUCCESS)
|
|
|
|
return E_FAIL;
|
|
|
|
if(RegQueryValueExW(key, buf, 0, NULL, NULL, NULL)
|
|
|
|
!= ERROR_FILE_NOT_FOUND)
|
|
|
|
return E_ACCESSDENIED;
|
|
|
|
RegCloseKey(key);
|
|
|
|
|
|
|
|
if(RegCreateKeyExW(HKEY_CURRENT_USER, reg_blockedW, 0, 0, 0,
|
|
|
|
KEY_READ, NULL, &key, NULL) != ERROR_SUCCESS)
|
|
|
|
return E_FAIL;
|
|
|
|
if(RegQueryValueExW(key, buf, 0, NULL, NULL, NULL)
|
|
|
|
!= ERROR_FILE_NOT_FOUND)
|
|
|
|
return E_ACCESSDENIED;
|
|
|
|
RegCloseKey(key);
|
|
|
|
|
|
|
|
if(!GUIDFromStringW(buf, &guid))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&guid, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IPersistFile, (void**)&persist_file);
|
|
|
|
if(FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_FORPARSING, &path);
|
|
|
|
if(SUCCEEDED(hr))
|
|
|
|
hr = StrRetToStrW(&path, NULL, &file);
|
|
|
|
if(FAILED(hr)) {
|
|
|
|
IPersistFile_Release(persist_file);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = IPersistFile_Load(persist_file, file, STGM_READ);
|
|
|
|
CoTaskMemFree(file);
|
|
|
|
if(FAILED(hr)) {
|
|
|
|
IPersistFile_Release(persist_file);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = IPersistFile_QueryInterface(persist_file, riid, ppvOut);
|
|
|
|
IPersistFile_Release(persist_file);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
/**************************************************************************
|
|
|
|
* IShellFolder_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
|
|
|
|
*
|
|
|
|
* NOTES
|
2005-03-01 11:41:14 +01:00
|
|
|
* This function gets asked to return "view objects" for one or more (multiple
|
|
|
|
* select) items:
|
|
|
|
* The viewobject typically is an COM object with one of the following
|
|
|
|
* interfaces:
|
2002-07-24 03:56:03 +02:00
|
|
|
* IExtractIcon,IDataObject,IContextMenu
|
|
|
|
* In order to support icon positions in the default Listview your DataObject
|
2005-03-01 11:41:14 +01:00
|
|
|
* must implement the SetData method (in addition to GetData :) - the shell
|
|
|
|
* passes a barely documented "Icon positions" structure to SetData when the
|
|
|
|
* drag starts, and GetData's it if the drop is in another explorer window that
|
|
|
|
* needs the positions.
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
|
|
|
IShellFolder_fnGetUIObjectOf (IShellFolder2 * iface,
|
2005-03-01 11:41:14 +01:00
|
|
|
HWND hwndOwner,
|
|
|
|
UINT cidl, LPCITEMIDLIST * apidl, REFIID riid,
|
|
|
|
UINT * prgfInOut, LPVOID * ppvOut)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(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-03-01 11:41:14 +01:00
|
|
|
This, hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
if (ppvOut) {
|
2005-03-01 11:41:14 +01:00
|
|
|
*ppvOut = NULL;
|
|
|
|
|
2010-11-10 14:19:29 +01:00
|
|
|
if(cidl == 1) {
|
|
|
|
hr = SHELL32_CreateExtensionUIObject(iface, *apidl, riid, ppvOut);
|
|
|
|
if(hr != S_FALSE)
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
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);
|
|
|
|
} else {
|
|
|
|
hr = E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr) && !pObj)
|
|
|
|
hr = E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
*ppvOut = pObj;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
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-03-02 11:16:41 +01:00
|
|
|
static const WCHAR AdvancedW[] = { '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','\\','A','d','v','a','n','c','e','d',0 };
|
|
|
|
static const WCHAR HideFileExtW[] = { 'H','i','d','e','F','i','l','e','E','x',
|
|
|
|
't',0 };
|
|
|
|
static const WCHAR NeverShowExtW[] = { 'N','e','v','e','r','S','h','o','w','E',
|
|
|
|
'x','t',0 };
|
|
|
|
|
2005-07-18 11:12:20 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* SHELL_FS_HideExtension [Internal]
|
|
|
|
*
|
|
|
|
* Query the registry if the filename extension of a given path should be
|
|
|
|
* hidden.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* szPath [I] Relative or absolute path of a file
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE, if the filename's extension should be hidden
|
|
|
|
* FALSE, otherwise.
|
|
|
|
*/
|
2007-10-28 16:46:30 +01:00
|
|
|
BOOL SHELL_FS_HideExtension(LPCWSTR szPath)
|
2004-01-20 00:54:55 +01:00
|
|
|
{
|
2005-04-15 18:11:45 +02:00
|
|
|
HKEY hKey;
|
|
|
|
DWORD dwData;
|
|
|
|
DWORD dwDataSize = sizeof (DWORD);
|
|
|
|
BOOL doHide = FALSE; /* The default value is FALSE (win98 at least) */
|
|
|
|
|
|
|
|
if (!RegCreateKeyExW(HKEY_CURRENT_USER, AdvancedW, 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) {
|
|
|
|
if (!RegQueryValueExW(hKey, HideFileExtW, 0, 0, (LPBYTE) &dwData, &dwDataSize))
|
|
|
|
doHide = dwData;
|
|
|
|
RegCloseKey (hKey);
|
|
|
|
}
|
2005-03-01 11:41:14 +01:00
|
|
|
|
2005-04-15 18:11:45 +02:00
|
|
|
if (!doHide) {
|
|
|
|
LPWSTR ext = PathFindExtensionW(szPath);
|
2005-03-01 11:41:14 +01:00
|
|
|
|
2005-04-15 18:11:45 +02:00
|
|
|
if (*ext != '\0') {
|
|
|
|
WCHAR classname[MAX_PATH];
|
|
|
|
LONG classlen = sizeof(classname);
|
2005-03-01 11:41:14 +01:00
|
|
|
|
2005-04-15 18:11:45 +02:00
|
|
|
if (!RegQueryValueW(HKEY_CLASSES_ROOT, ext, classname, &classlen))
|
|
|
|
if (!RegOpenKeyW(HKEY_CLASSES_ROOT, classname, &hKey)) {
|
|
|
|
if (!RegQueryValueExW(hKey, NeverShowExtW, 0, NULL, NULL, NULL))
|
|
|
|
doHide = TRUE;
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
}
|
2005-03-01 11:41:14 +01:00
|
|
|
}
|
2005-04-15 18:11:45 +02:00
|
|
|
}
|
|
|
|
return doHide;
|
|
|
|
}
|
|
|
|
|
2006-01-16 21:31:48 +01:00
|
|
|
void SHELL_FS_ProcessDisplayFilename(LPWSTR szPath, DWORD dwFlags)
|
2005-04-15 18:11:45 +02:00
|
|
|
{
|
|
|
|
/*FIXME: MSDN also mentions SHGDN_FOREDITING which is not yet handled. */
|
|
|
|
if (!(dwFlags & SHGDN_FORPARSING) &&
|
|
|
|
((dwFlags & SHGDN_INFOLDER) || (dwFlags == SHGDN_NORMAL))) {
|
2006-01-16 21:31:48 +01:00
|
|
|
if (SHELL_FS_HideExtension(szPath) && szPath[0] != '.')
|
|
|
|
PathRemoveExtensionW(szPath);
|
2004-01-20 00:54:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
/**************************************************************************
|
|
|
|
* IShellFolder_fnGetDisplayNameOf
|
|
|
|
* Retrieves the display name for the specified file object or subfolder
|
|
|
|
*
|
|
|
|
* PARAMETERS
|
|
|
|
* LPCITEMIDLIST pidl, //[in ] complex pidl to item
|
|
|
|
* DWORD dwFlags, //[in ] SHGNO formatting flags
|
|
|
|
* LPSTRRET lpName) //[out] Returned display name
|
|
|
|
*
|
|
|
|
* FIXME
|
|
|
|
* if the name is in the pidl the ret value should be a STRRET_OFFSET
|
|
|
|
*/
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
2005-03-01 11:41:14 +01:00
|
|
|
IShellFolder_fnGetDisplayNameOf (IShellFolder2 * iface, LPCITEMIDLIST pidl,
|
|
|
|
DWORD dwFlags, LPSTRRET strRet)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
2007-04-10 11:20:48 +02:00
|
|
|
LPWSTR pszPath;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-05-05 12:30:51 +02:00
|
|
|
HRESULT hr = S_OK;
|
2002-07-24 03:56:03 +02:00
|
|
|
int len = 0;
|
2004-01-23 21:45:41 +01: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 (!pidl || !strRet)
|
2005-03-01 11:41:14 +01:00
|
|
|
return E_INVALIDARG;
|
2006-01-16 21:31:48 +01:00
|
|
|
|
2007-04-10 11:20:48 +02:00
|
|
|
pszPath = CoTaskMemAlloc((MAX_PATH +1) * sizeof(WCHAR));
|
|
|
|
if (!pszPath)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2005-05-05 12:30:51 +02:00
|
|
|
if (_ILIsDesktop(pidl)) { /* empty pidl */
|
2005-05-23 18:31:42 +02:00
|
|
|
if ((GET_SHGDN_FOR(dwFlags) & SHGDN_FORPARSING) &&
|
2005-05-05 12:30:51 +02:00
|
|
|
(GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER))
|
|
|
|
{
|
|
|
|
if (This->sPathTarget)
|
2007-04-10 11:20:48 +02:00
|
|
|
lstrcpynW(pszPath, This->sPathTarget, MAX_PATH);
|
2005-03-01 11:41:14 +01:00
|
|
|
} else {
|
2005-05-05 12:30:51 +02:00
|
|
|
/* pidl has to contain exactly one non null SHITEMID */
|
|
|
|
hr = E_INVALIDARG;
|
2005-03-01 11:41:14 +01:00
|
|
|
}
|
2005-05-05 12:30:51 +02:00
|
|
|
} else if (_ILIsPidlSimple(pidl)) {
|
2005-05-23 18:31:42 +02:00
|
|
|
if ((GET_SHGDN_FOR(dwFlags) & SHGDN_FORPARSING) &&
|
2005-05-05 12:30:51 +02:00
|
|
|
(GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER) &&
|
|
|
|
This->sPathTarget)
|
|
|
|
{
|
2007-04-10 11:20:48 +02:00
|
|
|
lstrcpynW(pszPath, This->sPathTarget, MAX_PATH);
|
|
|
|
PathAddBackslashW(pszPath);
|
|
|
|
len = lstrlenW(pszPath);
|
2005-03-01 11:41:14 +01:00
|
|
|
}
|
2007-04-10 11:20:48 +02:00
|
|
|
_ILSimpleGetTextW(pidl, pszPath + len, MAX_PATH + 1 - len);
|
|
|
|
if (!_ILIsFolder(pidl)) SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
|
2005-05-05 12:30:51 +02:00
|
|
|
} else {
|
2007-04-10 11:20:48 +02:00
|
|
|
hr = SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, pszPath, MAX_PATH);
|
2006-01-16 21:31:48 +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;
|
|
|
|
}
|
|
|
|
} 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));
|
2005-05-05 12:30:51 +02:00
|
|
|
return hr;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IShellFolder_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
|
|
|
|
*/
|
2005-03-01 11:41:14 +01:00
|
|
|
static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface,
|
|
|
|
HWND hwndOwner,
|
|
|
|
LPCITEMIDLIST pidl,
|
|
|
|
LPCOLESTR lpName,
|
|
|
|
DWORD dwFlags,
|
|
|
|
LPITEMIDLIST * pPidlOut)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
2006-01-16 21:31:48 +01:00
|
|
|
WCHAR szSrc[MAX_PATH + 1], szDest[MAX_PATH + 1];
|
2005-03-02 11:16:41 +01:00
|
|
|
LPWSTR ptr;
|
2002-07-24 03:56:03 +02:00
|
|
|
BOOL bIsFolder = _ILIsFolder (ILFindLastID (pidl));
|
|
|
|
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", This, hwndOwner, pidl,
|
2005-03-01 11:41:14 +01:00
|
|
|
debugstr_w (lpName), dwFlags, pPidlOut);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
/* build source path */
|
2006-01-16 21:31:48 +01:00
|
|
|
lstrcpynW(szSrc, This->sPathTarget, MAX_PATH);
|
2005-04-15 18:11:45 +02:00
|
|
|
ptr = PathAddBackslashW (szSrc);
|
|
|
|
if (ptr)
|
2006-01-16 21:31:48 +01:00
|
|
|
_ILSimpleGetTextW (pidl, ptr, MAX_PATH + 1 - (ptr - szSrc));
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
/* build destination path */
|
2005-04-15 18:11:45 +02:00
|
|
|
if (dwFlags == SHGDN_NORMAL || dwFlags & SHGDN_INFOLDER) {
|
2006-01-16 21:31:48 +01:00
|
|
|
lstrcpynW(szDest, This->sPathTarget, MAX_PATH);
|
2005-04-15 18:11:45 +02:00
|
|
|
ptr = PathAddBackslashW (szDest);
|
|
|
|
if (ptr)
|
2006-01-16 21:31:48 +01:00
|
|
|
lstrcpynW(ptr, lpName, MAX_PATH + 1 - (ptr - szDest));
|
2005-04-15 18:11:45 +02:00
|
|
|
} else
|
|
|
|
lstrcpynW(szDest, lpName, MAX_PATH);
|
|
|
|
|
2005-07-18 11:12:20 +02:00
|
|
|
if(!(dwFlags & SHGDN_FORPARSING) && SHELL_FS_HideExtension(szSrc)) {
|
2005-04-15 18:11:45 +02:00
|
|
|
WCHAR *ext = PathFindExtensionW(szSrc);
|
|
|
|
if(*ext != '\0') {
|
|
|
|
INT len = strlenW(szDest);
|
|
|
|
lstrcpynW(szDest + len, ext, MAX_PATH - len);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-02 11:16:41 +01:00
|
|
|
TRACE ("src=%s dest=%s\n", debugstr_w(szSrc), debugstr_w(szDest));
|
2005-04-15 18:11:45 +02:00
|
|
|
|
2005-03-02 11:16:41 +01:00
|
|
|
if (MoveFileW (szSrc, szDest)) {
|
2005-03-01 11:41:14 +01:00
|
|
|
HRESULT hr = S_OK;
|
2004-04-15 01:57:46 +02:00
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
if (pPidlOut)
|
2005-03-02 11:16:41 +01:00
|
|
|
hr = _ILCreateFromPathW(szDest, pPidlOut);
|
2004-04-15 01:57:46 +02:00
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
SHChangeNotify (bIsFolder ? SHCNE_RENAMEFOLDER : SHCNE_RENAMEITEM,
|
2005-03-02 11:16:41 +01:00
|
|
|
SHCNF_PATHW, szSrc, szDest);
|
2004-04-15 01:57:46 +02:00
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
return hr;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
2004-04-15 01:57:46 +02:00
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
static HRESULT WINAPI IShellFolder_fnGetDefaultSearchGUID (IShellFolder2 *iface,
|
|
|
|
GUID * pguid)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
2005-03-01 11:41:14 +01:00
|
|
|
FIXME ("(%p)\n", This);
|
2002-07-24 03:56:03 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2005-03-01 11:41:14 +01:00
|
|
|
static HRESULT WINAPI IShellFolder_fnEnumSearches (IShellFolder2 * iface,
|
|
|
|
IEnumExtraSearch ** ppenum)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
2005-03-01 11:41:14 +01:00
|
|
|
FIXME ("(%p)\n", This);
|
2002-07-24 03:56:03 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2005-03-01 11:41:14 +01:00
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI
|
2005-03-01 11:41:14 +01:00
|
|
|
IShellFolder_fnGetDefaultColumn (IShellFolder2 * iface, DWORD dwRes,
|
|
|
|
ULONG * pSort, ULONG * pDisplay)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
TRACE ("(%p)\n", This);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
if (pSort)
|
2005-03-01 11:41:14 +01:00
|
|
|
*pSort = 0;
|
2002-07-24 03:56:03 +02:00
|
|
|
if (pDisplay)
|
2005-03-01 11:41:14 +01:00
|
|
|
*pDisplay = 0;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2005-03-01 11:41:14 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
IShellFolder_fnGetDefaultColumnState (IShellFolder2 * iface, UINT iColumn,
|
|
|
|
DWORD * pcsFlags)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
TRACE ("(%p)\n", This);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
if (!pcsFlags || iColumn >= GENERICSHELLVIEWCOLUMNS)
|
2005-03-01 11:41:14 +01:00
|
|
|
return E_INVALIDARG;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
*pcsFlags = GenericSFHeader[iColumn].pcsFlags;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2005-03-01 11:41:14 +01:00
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI
|
2005-03-01 11:41:14 +01:00
|
|
|
IShellFolder_fnGetDetailsEx (IShellFolder2 * iface, LPCITEMIDLIST pidl,
|
|
|
|
const SHCOLUMNID * pscid, VARIANT * pv)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
2005-03-01 11:41:14 +01:00
|
|
|
FIXME ("(%p)\n", This);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2005-03-01 11:41:14 +01:00
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
static HRESULT WINAPI
|
2005-03-01 11:41:14 +01:00
|
|
|
IShellFolder_fnGetDetailsOf (IShellFolder2 * iface, LPCITEMIDLIST pidl,
|
|
|
|
UINT iColumn, SHELLDETAILS * psd)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
HRESULT hr = E_FAIL;
|
|
|
|
|
|
|
|
TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
|
|
|
|
|
|
|
|
if (!psd || iColumn >= GENERICSHELLVIEWCOLUMNS)
|
2005-03-01 11:41:14 +01:00
|
|
|
return E_INVALIDARG;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
if (!pidl) {
|
2005-03-01 11:41:14 +01:00
|
|
|
/* the header titles */
|
|
|
|
psd->fmt = GenericSFHeader[iColumn].fmt;
|
|
|
|
psd->cxChar = GenericSFHeader[iColumn].cxChar;
|
|
|
|
psd->str.uType = STRRET_CSTR;
|
|
|
|
LoadStringA (shell32_hInstance, GenericSFHeader[iColumn].colnameid,
|
|
|
|
psd->str.u.cStr, MAX_PATH);
|
|
|
|
return S_OK;
|
2002-07-24 03:56:03 +02:00
|
|
|
} else {
|
2006-01-16 21:32:06 +01:00
|
|
|
hr = S_OK;
|
|
|
|
psd->str.uType = STRRET_CSTR;
|
2005-03-01 11:41:14 +01:00
|
|
|
/* the data from the pidl */
|
|
|
|
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-03-01 11:41:14 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
IShellFolder_fnMapColumnToSCID (IShellFolder2 * iface, UINT column,
|
|
|
|
SHCOLUMNID * pscid)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IShellFolder2(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 sfvt =
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-03-01 11:41:14 +01:00
|
|
|
IShellFolder_fnQueryInterface,
|
|
|
|
IShellFolder_fnAddRef,
|
|
|
|
IShellFolder_fnRelease,
|
|
|
|
IShellFolder_fnParseDisplayName,
|
|
|
|
IShellFolder_fnEnumObjects,
|
|
|
|
IShellFolder_fnBindToObject,
|
|
|
|
IShellFolder_fnBindToStorage,
|
|
|
|
IShellFolder_fnCompareIDs,
|
|
|
|
IShellFolder_fnCreateViewObject,
|
|
|
|
IShellFolder_fnGetAttributesOf,
|
|
|
|
IShellFolder_fnGetUIObjectOf,
|
|
|
|
IShellFolder_fnGetDisplayNameOf,
|
|
|
|
IShellFolder_fnSetNameOf,
|
|
|
|
/* ShellFolder2 */
|
|
|
|
IShellFolder_fnGetDefaultSearchGUID,
|
|
|
|
IShellFolder_fnEnumSearches,
|
|
|
|
IShellFolder_fnGetDefaultColumn,
|
|
|
|
IShellFolder_fnGetDefaultColumnState,
|
|
|
|
IShellFolder_fnGetDetailsEx,
|
|
|
|
IShellFolder_fnGetDetailsOf,
|
|
|
|
IShellFolder_fnMapColumnToSCID
|
2002-07-24 03:56:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* ISFHelper for IShellFolder implementation
|
|
|
|
*/
|
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
static HRESULT WINAPI
|
|
|
|
ISFHelper_fnQueryInterface (ISFHelper * iface, REFIID riid, LPVOID * ppvObj)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_ISFHelper(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_QueryInterface (This->pUnkOuter, riid, ppvObj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ISFHelper_fnAddRef (ISFHelper * iface)
|
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_ISFHelper(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 (This->pUnkOuter);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ISFHelper_fnRelease (ISFHelper * iface)
|
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_ISFHelper(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)\n", This);
|
|
|
|
|
|
|
|
return IUnknown_Release (This->pUnkOuter);
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2010-06-25 22:20:04 +02:00
|
|
|
* ISFHelper_fnGetUniqueName
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
|
|
|
* creates a unique folder name
|
|
|
|
*/
|
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
static HRESULT WINAPI
|
2006-03-05 13:25:23 +01:00
|
|
|
ISFHelper_fnGetUniqueName (ISFHelper * iface, LPWSTR pwszName, UINT uLen)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_ISFHelper(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
IEnumIDList *penum;
|
|
|
|
HRESULT hr;
|
2006-03-05 13:25:23 +01:00
|
|
|
WCHAR wszText[MAX_PATH];
|
2007-12-06 10:20:48 +01:00
|
|
|
WCHAR wszNewFolder[25];
|
2006-03-05 13:25:23 +01:00
|
|
|
const WCHAR wszFormat[] = {'%','s',' ','%','d',0 };
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-03-05 13:25:23 +01:00
|
|
|
TRACE ("(%p)(%p %u)\n", This, pwszName, uLen);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2007-12-06 10:20:48 +01:00
|
|
|
LoadStringW(shell32_hInstance, IDS_NEWFOLDER, wszNewFolder, sizeof(wszNewFolder)/sizeof(WCHAR));
|
2006-03-05 13:25:23 +01:00
|
|
|
if (uLen < sizeof(wszNewFolder)/sizeof(WCHAR) + 3)
|
2005-03-01 11:41:14 +01:00
|
|
|
return E_POINTER;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-03-05 13:25:23 +01:00
|
|
|
lstrcpynW (pwszName, wszNewFolder, uLen);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
hr = IShellFolder_fnEnumObjects (_IShellFolder2_ (This), 0,
|
2005-03-01 11:41:14 +01:00
|
|
|
SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &penum);
|
2002-07-24 03:56:03 +02:00
|
|
|
if (penum) {
|
2005-03-01 11:41:14 +01:00
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
DWORD dwFetched;
|
|
|
|
int i = 1;
|
|
|
|
|
|
|
|
next:
|
|
|
|
IEnumIDList_Reset (penum);
|
|
|
|
while (S_OK == IEnumIDList_Next (penum, 1, &pidl, &dwFetched) &&
|
|
|
|
dwFetched) {
|
2006-03-05 13:25:23 +01:00
|
|
|
_ILSimpleGetTextW (pidl, wszText, MAX_PATH);
|
|
|
|
if (0 == lstrcmpiW (wszText, pwszName)) {
|
|
|
|
snprintfW (pwszName, uLen, wszFormat, wszNewFolder, i++);
|
2005-03-01 11:41:14 +01:00
|
|
|
if (i > 99) {
|
|
|
|
hr = E_FAIL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
IEnumIDList_Release (penum);
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* ISFHelper_fnAddFolder
|
|
|
|
*
|
|
|
|
* adds a new folder.
|
|
|
|
*/
|
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
static HRESULT WINAPI
|
2006-03-05 13:25:23 +01:00
|
|
|
ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCWSTR pwszName,
|
2005-03-01 11:41:14 +01:00
|
|
|
LPITEMIDLIST * ppidlOut)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_ISFHelper(iface);
|
2006-03-05 13:25:23 +01:00
|
|
|
WCHAR wszNewDir[MAX_PATH];
|
2002-07-24 03:56:03 +02:00
|
|
|
DWORD bRes;
|
|
|
|
HRESULT hres = E_FAIL;
|
|
|
|
|
2006-03-05 13:25:23 +01:00
|
|
|
TRACE ("(%p)(%s %p)\n", This, debugstr_w(pwszName), ppidlOut);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-03-05 13:25:23 +01:00
|
|
|
wszNewDir[0] = 0;
|
|
|
|
if (This->sPathTarget)
|
|
|
|
lstrcpynW(wszNewDir, This->sPathTarget, MAX_PATH);
|
|
|
|
PathAppendW(wszNewDir, pwszName);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-03-05 13:25:23 +01:00
|
|
|
bRes = CreateDirectoryW (wszNewDir, NULL);
|
2002-07-24 03:56:03 +02:00
|
|
|
if (bRes) {
|
2010-12-03 18:50:12 +01:00
|
|
|
LPITEMIDLIST relPidl;
|
2004-04-15 01:57:46 +02:00
|
|
|
|
2010-12-03 18:50:12 +01:00
|
|
|
lstrcpyW(wszNewDir, pwszName);
|
|
|
|
|
|
|
|
hres = IShellFolder_ParseDisplayName((IShellFolder*)&This->lpvtblShellFolder,
|
|
|
|
hwnd, NULL, wszNewDir, NULL, &relPidl, NULL);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hres)) {
|
|
|
|
LPITEMIDLIST fullPidl;
|
|
|
|
|
|
|
|
fullPidl = ILCombine(This->pidlRoot, relPidl);
|
|
|
|
|
|
|
|
if (fullPidl) {
|
|
|
|
SHChangeNotify(SHCNE_MKDIR, SHCNF_IDLIST, fullPidl, NULL);
|
|
|
|
ILFree(fullPidl);
|
|
|
|
|
|
|
|
if (ppidlOut)
|
|
|
|
*ppidlOut = relPidl;
|
|
|
|
else
|
|
|
|
ILFree(relPidl);
|
|
|
|
} else {
|
|
|
|
WARN("failed to combine %s into a full PIDL\n", wine_dbgstr_w(pwszName));
|
|
|
|
ILFree(relPidl);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else
|
|
|
|
WARN("failed to parse %s into a PIDL\n", wine_dbgstr_w(pwszName));
|
2004-04-15 01:57:46 +02:00
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
} else {
|
2006-03-05 13:25:23 +01:00
|
|
|
WCHAR wszText[128 + MAX_PATH];
|
|
|
|
WCHAR wszTempText[128];
|
|
|
|
WCHAR wszCaption[256];
|
2005-03-01 11:41:14 +01:00
|
|
|
|
|
|
|
/* Cannot Create folder because of permissions */
|
2006-03-05 13:25:23 +01:00
|
|
|
LoadStringW (shell32_hInstance, IDS_CREATEFOLDER_DENIED, wszTempText,
|
2008-02-15 11:06:20 +01:00
|
|
|
sizeof (wszTempText)/sizeof (wszTempText[0]));
|
2006-03-05 13:25:23 +01:00
|
|
|
LoadStringW (shell32_hInstance, IDS_CREATEFOLDER_CAPTION, wszCaption,
|
2008-02-15 11:06:20 +01:00
|
|
|
sizeof (wszCaption)/sizeof (wszCaption[0]));
|
2006-03-05 13:25:23 +01:00
|
|
|
sprintfW (wszText, wszTempText, wszNewDir);
|
|
|
|
MessageBoxW (hwnd, wszText, wszCaption, MB_OK | MB_ICONEXCLAMATION);
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2006-06-29 21:03:41 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* build_paths_list
|
|
|
|
*
|
|
|
|
* Builds a list of paths like the one used in SHFileOperation from a table of
|
|
|
|
* PIDLs relative to the given base folder
|
|
|
|
*/
|
2007-10-28 16:46:30 +01:00
|
|
|
static WCHAR *build_paths_list(LPCWSTR wszBasePath, int cidl, const LPCITEMIDLIST *pidls)
|
2006-06-29 21:03:41 +02:00
|
|
|
{
|
|
|
|
WCHAR *wszPathsList;
|
|
|
|
WCHAR *wszListPos;
|
|
|
|
int iPathLen;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
iPathLen = lstrlenW(wszBasePath);
|
|
|
|
wszPathsList = HeapAlloc(GetProcessHeap(), 0, MAX_PATH*sizeof(WCHAR)*cidl+1);
|
|
|
|
wszListPos = wszPathsList;
|
|
|
|
|
|
|
|
for (i = 0; i < cidl; i++) {
|
|
|
|
if (!_ILIsFolder(pidls[i]) && !_ILIsValue(pidls[i]))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
lstrcpynW(wszListPos, wszBasePath, MAX_PATH);
|
|
|
|
/* FIXME: abort if path too long */
|
|
|
|
_ILSimpleGetTextW(pidls[i], wszListPos+iPathLen, MAX_PATH-iPathLen);
|
|
|
|
wszListPos += lstrlenW(wszListPos)+1;
|
|
|
|
}
|
|
|
|
*wszListPos=0;
|
|
|
|
return wszPathsList;
|
|
|
|
}
|
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* ISFHelper_fnDeleteItems
|
|
|
|
*
|
|
|
|
* deletes items in folder
|
|
|
|
*/
|
2005-03-01 11:41:14 +01:00
|
|
|
static HRESULT WINAPI
|
|
|
|
ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_ISFHelper(iface);
|
2002-12-13 01:36:52 +01:00
|
|
|
UINT i;
|
2006-06-29 21:03:41 +02:00
|
|
|
SHFILEOPSTRUCTW op;
|
2006-06-02 17:08:58 +02:00
|
|
|
WCHAR wszPath[MAX_PATH];
|
2006-06-29 21:03:41 +02:00
|
|
|
WCHAR *wszPathsList;
|
|
|
|
HRESULT ret;
|
|
|
|
WCHAR *wszCurrentPath;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)(%u %p)\n", This, cidl, apidl);
|
2006-06-29 21:03:41 +02:00
|
|
|
if (cidl==0) return S_OK;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-06-02 17:08:58 +02:00
|
|
|
if (This->sPathTarget)
|
|
|
|
lstrcpynW(wszPath, This->sPathTarget, MAX_PATH);
|
|
|
|
else
|
|
|
|
wszPath[0] = '\0';
|
|
|
|
PathAddBackslashW(wszPath);
|
2006-06-29 21:03:41 +02:00
|
|
|
wszPathsList = build_paths_list(wszPath, cidl, apidl);
|
|
|
|
|
|
|
|
ZeroMemory(&op, sizeof(op));
|
|
|
|
op.hwnd = GetActiveWindow();
|
|
|
|
op.wFunc = FO_DELETE;
|
|
|
|
op.pFrom = wszPathsList;
|
2006-07-19 18:37:02 +02:00
|
|
|
op.fFlags = FOF_ALLOWUNDO;
|
2006-06-29 21:03:41 +02:00
|
|
|
if (SHFileOperationW(&op))
|
|
|
|
{
|
|
|
|
WARN("SHFileOperation failed\n");
|
|
|
|
ret = E_FAIL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = S_OK;
|
2005-03-01 11:41:14 +01:00
|
|
|
|
2006-06-29 21:03:41 +02:00
|
|
|
/* we currently need to manually send the notifies */
|
|
|
|
wszCurrentPath = wszPathsList;
|
|
|
|
for (i = 0; i < cidl; i++)
|
|
|
|
{
|
|
|
|
LONG wEventId;
|
2005-03-01 11:41:14 +01:00
|
|
|
|
2006-06-29 21:03:41 +02:00
|
|
|
if (_ILIsFolder(apidl[i]))
|
|
|
|
wEventId = SHCNE_RMDIR;
|
|
|
|
else if (_ILIsValue(apidl[i]))
|
|
|
|
wEventId = SHCNE_DELETE;
|
|
|
|
else
|
|
|
|
continue;
|
2005-03-01 11:41:14 +01:00
|
|
|
|
2006-06-29 21:03:41 +02:00
|
|
|
/* check if file exists */
|
|
|
|
if (GetFileAttributesW(wszCurrentPath) == INVALID_FILE_ATTRIBUTES)
|
|
|
|
{
|
|
|
|
LPITEMIDLIST pidl = ILCombine(This->pidlRoot, apidl[i]);
|
|
|
|
SHChangeNotify(wEventId, SHCNF_IDLIST, pidl, NULL);
|
|
|
|
SHFree(pidl);
|
2005-03-01 11:41:14 +01:00
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-06-29 21:03:41 +02:00
|
|
|
wszCurrentPath += lstrlenW(wszCurrentPath)+1;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
2006-06-29 21:03:41 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, wszPathsList);
|
|
|
|
return ret;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* ISFHelper_fnCopyItems
|
|
|
|
*
|
|
|
|
* copies items to this folder
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
2005-03-01 11:41:14 +01:00
|
|
|
ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl,
|
|
|
|
LPCITEMIDLIST * apidl)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2011-07-19 18:25:15 +02:00
|
|
|
HRESULT ret=E_FAIL;
|
2002-07-24 03:56:03 +02:00
|
|
|
IPersistFolder2 *ppf2 = NULL;
|
2011-07-19 18:25:15 +02:00
|
|
|
WCHAR wszSrcPathRoot[MAX_PATH],
|
|
|
|
wszDstPath[MAX_PATH+1];
|
|
|
|
WCHAR *wszSrcPathsList;
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_ISFHelper(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2011-07-19 18:25:15 +02:00
|
|
|
SHFILEOPSTRUCTW fop;
|
|
|
|
|
2002-07-24 03:56:03 +02:00
|
|
|
TRACE ("(%p)->(%p,%u,%p)\n", This, pSFFrom, cidl, apidl);
|
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
IShellFolder_QueryInterface (pSFFrom, &IID_IPersistFolder2,
|
|
|
|
(LPVOID *) & ppf2);
|
2002-07-24 03:56:03 +02:00
|
|
|
if (ppf2) {
|
2005-03-01 11:41:14 +01:00
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
|
|
|
|
if (SUCCEEDED (IPersistFolder2_GetCurFolder (ppf2, &pidl))) {
|
2011-07-19 18:25:15 +02:00
|
|
|
SHGetPathFromIDListW (pidl, wszSrcPathRoot);
|
|
|
|
ZeroMemory(wszDstPath, MAX_PATH+1);
|
|
|
|
if (This->sPathTarget)
|
|
|
|
lstrcpynW(wszDstPath, This->sPathTarget, MAX_PATH);
|
|
|
|
PathAddBackslashW(wszSrcPathRoot);
|
|
|
|
PathAddBackslashW(wszDstPath);
|
|
|
|
wszSrcPathsList = build_paths_list(wszSrcPathRoot, cidl, apidl);
|
|
|
|
ZeroMemory(&fop, sizeof(fop));
|
|
|
|
fop.hwnd = GetActiveWindow();
|
|
|
|
fop.wFunc = FO_COPY;
|
|
|
|
fop.pFrom = wszSrcPathsList;
|
|
|
|
fop.pTo = wszDstPath;
|
|
|
|
fop.fFlags = FOF_ALLOWUNDO;
|
|
|
|
ret = S_OK;
|
|
|
|
if(SHFileOperationW(&fop))
|
|
|
|
{
|
|
|
|
WARN("Copy failed\n");
|
|
|
|
ret = E_FAIL;
|
2005-03-01 11:41:14 +01:00
|
|
|
}
|
2011-07-19 18:25:15 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, wszSrcPathsList);
|
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
}
|
2011-07-19 18:25:15 +02:00
|
|
|
SHFree(pidl);
|
|
|
|
IPersistFolder2_Release(ppf2);
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
2011-07-19 18:25:15 +02:00
|
|
|
return ret;
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const ISFHelperVtbl shvt =
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-03-01 11:41:14 +01:00
|
|
|
ISFHelper_fnQueryInterface,
|
|
|
|
ISFHelper_fnAddRef,
|
|
|
|
ISFHelper_fnRelease,
|
|
|
|
ISFHelper_fnGetUniqueName,
|
|
|
|
ISFHelper_fnAddFolder,
|
|
|
|
ISFHelper_fnDeleteItems,
|
|
|
|
ISFHelper_fnCopyItems
|
2002-07-24 03:56:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/************************************************************************
|
2005-03-01 11:41:14 +01:00
|
|
|
* IFSFldr_PersistFolder3_QueryInterface
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
|
|
|
*/
|
2005-03-01 11:41:14 +01:00
|
|
|
static HRESULT WINAPI
|
|
|
|
IFSFldr_PersistFolder3_QueryInterface (IPersistFolder3 * 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_IPersistFolder3(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)\n", This);
|
|
|
|
|
|
|
|
return IUnknown_QueryInterface (This->pUnkOuter, iid, ppvObj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2005-03-01 11:41:14 +01:00
|
|
|
* IFSFldr_PersistFolder3_AddRef
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
|
|
|
*/
|
2005-03-01 11:41:14 +01:00
|
|
|
static ULONG WINAPI
|
|
|
|
IFSFldr_PersistFolder3_AddRef (IPersistFolder3 * iface)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IPersistFolder3(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 (This->pUnkOuter);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2005-03-01 11:41:14 +01:00
|
|
|
* IFSFldr_PersistFolder3_Release
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
|
|
|
*/
|
2005-03-01 11:41:14 +01:00
|
|
|
static ULONG WINAPI
|
|
|
|
IFSFldr_PersistFolder3_Release (IPersistFolder3 * iface)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IPersistFolder3(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 (This->pUnkOuter);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2005-03-01 11:41:14 +01:00
|
|
|
* IFSFldr_PersistFolder3_GetClassID
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
2005-03-01 11:41:14 +01:00
|
|
|
static HRESULT WINAPI
|
|
|
|
IFSFldr_PersistFolder3_GetClassID (IPersistFolder3 * iface, CLSID * lpClassId)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IPersistFolder3(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)\n", This);
|
|
|
|
|
|
|
|
if (!lpClassId)
|
2005-03-01 11:41:14 +01:00
|
|
|
return E_POINTER;
|
2002-07-24 03:56:03 +02:00
|
|
|
*lpClassId = *This->pclsid;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2005-03-01 11:41:14 +01:00
|
|
|
* IFSFldr_PersistFolder3_Initialize
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* sPathTarget is not set. Don't know how to handle in a non rooted environment.
|
|
|
|
*/
|
2005-03-01 11:41:14 +01:00
|
|
|
static HRESULT WINAPI
|
|
|
|
IFSFldr_PersistFolder3_Initialize (IPersistFolder3 * iface, LPCITEMIDLIST pidl)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2006-01-16 21:31:48 +01:00
|
|
|
WCHAR wszTemp[MAX_PATH];
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IPersistFolder3(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)->(%p)\n", This, pidl);
|
|
|
|
|
2006-10-07 03:06:26 +02:00
|
|
|
SHFree (This->pidlRoot); /* free the old pidl */
|
2005-03-01 11:41:14 +01:00
|
|
|
This->pidlRoot = ILClone (pidl); /* set my pidl */
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2006-10-07 03:06:26 +02:00
|
|
|
SHFree (This->sPathTarget);
|
|
|
|
This->sPathTarget = NULL;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
/* set my path */
|
2006-01-16 21:31:48 +01:00
|
|
|
if (SHGetPathFromIDListW (pidl, wszTemp)) {
|
|
|
|
int len = strlenW(wszTemp);
|
|
|
|
This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR));
|
|
|
|
if (!This->sPathTarget)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
memcpy(This->sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
2006-01-16 21:31:48 +01:00
|
|
|
TRACE ("--(%p)->(%s)\n", This, debugstr_w(This->sPathTarget));
|
2002-07-24 03:56:03 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-03-01 11:41:14 +01:00
|
|
|
* IFSFldr_PersistFolder3_GetCurFolder
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
2005-03-01 11:41:14 +01:00
|
|
|
static HRESULT WINAPI
|
|
|
|
IFSFldr_PersistFolder3_fnGetCurFolder (IPersistFolder3 * iface,
|
|
|
|
LPITEMIDLIST * pidl)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IPersistFolder3(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)->(%p)\n", This, pidl);
|
|
|
|
|
|
|
|
if (!pidl) return E_POINTER;
|
|
|
|
*pidl = ILClone (This->pidlRoot);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2005-03-01 11:41:14 +01:00
|
|
|
* IFSFldr_PersistFolder3_InitializeEx
|
2002-07-24 03:56:03 +02:00
|
|
|
*
|
2005-03-01 11:41:14 +01:00
|
|
|
* FIXME: error handling
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
|
|
|
IFSFldr_PersistFolder3_InitializeEx (IPersistFolder3 * iface,
|
2005-03-01 11:41:14 +01:00
|
|
|
IBindCtx * pbc, LPCITEMIDLIST pidlRoot,
|
|
|
|
const PERSIST_FOLDER_TARGET_INFO * ppfti)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2006-01-16 21:31:48 +01:00
|
|
|
WCHAR wszTemp[MAX_PATH];
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IPersistFolder3(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)->(%p,%p,%p)\n", This, pbc, pidlRoot, ppfti);
|
|
|
|
if (ppfti)
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE ("--%p %s %s 0x%08x 0x%08x\n",
|
2005-03-01 11:41:14 +01:00
|
|
|
ppfti->pidlTargetFolder, debugstr_w (ppfti->szTargetParsingName),
|
|
|
|
debugstr_w (ppfti->szNetworkProvider), ppfti->dwAttributes,
|
|
|
|
ppfti->csidl);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
pdump (pidlRoot);
|
|
|
|
if (ppfti && ppfti->pidlTargetFolder)
|
2005-03-01 11:41:14 +01:00
|
|
|
pdump (ppfti->pidlTargetFolder);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
if (This->pidlRoot)
|
2005-03-01 11:41:14 +01:00
|
|
|
__SHFreeAndNil (&This->pidlRoot); /* free the old */
|
2002-07-24 03:56:03 +02:00
|
|
|
if (This->sPathTarget)
|
2005-03-01 11:41:14 +01:00
|
|
|
__SHFreeAndNil (&This->sPathTarget);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Root path and pidl
|
|
|
|
*/
|
|
|
|
This->pidlRoot = ILClone (pidlRoot);
|
|
|
|
|
|
|
|
/*
|
2008-01-16 12:20:50 +01:00
|
|
|
* the target folder is specified in csidl OR pidlTargetFolder OR
|
2005-03-01 11:41:14 +01:00
|
|
|
* szTargetParsingName
|
2002-07-24 03:56:03 +02:00
|
|
|
*/
|
|
|
|
if (ppfti) {
|
2005-03-01 11:41:14 +01:00
|
|
|
if (ppfti->csidl != -1) {
|
2006-01-16 21:31:48 +01:00
|
|
|
if (SHGetSpecialFolderPathW (0, wszTemp, ppfti->csidl,
|
2005-03-01 11:41:14 +01:00
|
|
|
ppfti->csidl & CSIDL_FLAG_CREATE)) {
|
2006-01-16 21:31:48 +01:00
|
|
|
int len = strlenW(wszTemp);
|
|
|
|
This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR));
|
|
|
|
if (!This->sPathTarget)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
memcpy(This->sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
|
2005-03-01 11:41:14 +01:00
|
|
|
}
|
|
|
|
} else if (ppfti->szTargetParsingName[0]) {
|
2006-01-16 21:31:48 +01:00
|
|
|
int len = strlenW(ppfti->szTargetParsingName);
|
|
|
|
This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR));
|
|
|
|
if (!This->sPathTarget)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
memcpy(This->sPathTarget, ppfti->szTargetParsingName,
|
|
|
|
(len + 1) * sizeof(WCHAR));
|
2005-03-01 11:41:14 +01:00
|
|
|
} else if (ppfti->pidlTargetFolder) {
|
2006-01-16 21:31:48 +01:00
|
|
|
if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTemp)) {
|
|
|
|
int len = strlenW(wszTemp);
|
|
|
|
This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR));
|
|
|
|
if (!This->sPathTarget)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
memcpy(This->sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
|
2005-03-01 11:41:14 +01:00
|
|
|
}
|
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
|
2006-01-16 21:31:48 +01:00
|
|
|
TRACE ("--(%p)->(target=%s)\n", This, debugstr_w(This->sPathTarget));
|
2002-07-24 03:56:03 +02:00
|
|
|
pdump (This->pidlRoot);
|
|
|
|
return (This->sPathTarget) ? S_OK : E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
2005-03-01 11:41:14 +01:00
|
|
|
IFSFldr_PersistFolder3_GetFolderTargetInfo (IPersistFolder3 * iface,
|
|
|
|
PERSIST_FOLDER_TARGET_INFO * ppfti)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IPersistFolder3(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
FIXME ("(%p)->(%p)\n", This, ppfti);
|
2010-01-08 09:23:40 +01:00
|
|
|
ZeroMemory (ppfti, sizeof (*ppfti));
|
2002-07-24 03:56:03 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IPersistFolder3Vtbl vt_FSFldr_PersistFolder3 =
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-03-01 11:41:14 +01:00
|
|
|
IFSFldr_PersistFolder3_QueryInterface,
|
|
|
|
IFSFldr_PersistFolder3_AddRef,
|
|
|
|
IFSFldr_PersistFolder3_Release,
|
|
|
|
IFSFldr_PersistFolder3_GetClassID,
|
|
|
|
IFSFldr_PersistFolder3_Initialize,
|
|
|
|
IFSFldr_PersistFolder3_fnGetCurFolder,
|
|
|
|
IFSFldr_PersistFolder3_InitializeEx,
|
|
|
|
IFSFldr_PersistFolder3_GetFolderTargetInfo
|
2002-07-24 03:56:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* ISFDropTarget implementation
|
|
|
|
*/
|
2005-03-01 11:41:14 +01:00
|
|
|
static BOOL
|
|
|
|
ISFDropTarget_QueryDrop (IDropTarget * iface, DWORD dwKeyState,
|
|
|
|
LPDWORD pdwEffect)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
|
|
|
DWORD dwEffect = *pdwEffect;
|
|
|
|
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IDropTarget(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
*pdwEffect = DROPEFFECT_NONE;
|
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
if (This->fAcceptFmt) { /* Does our interpretation of the keystate ... */
|
|
|
|
*pdwEffect = KeyStateToDropEffect (dwKeyState);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
/* ... matches the desired effect ? */
|
|
|
|
if (dwEffect & *pdwEffect) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
2002-07-24 03:56:03 +02:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
static HRESULT WINAPI
|
|
|
|
ISFDropTarget_QueryInterface (IDropTarget * iface, REFIID riid, LPVOID * ppvObj)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IDropTarget(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)\n", This);
|
|
|
|
|
|
|
|
return IUnknown_QueryInterface (This->pUnkOuter, riid, ppvObj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ISFDropTarget_AddRef (IDropTarget * iface)
|
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IDropTarget(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)\n", This);
|
|
|
|
|
|
|
|
return IUnknown_AddRef (This->pUnkOuter);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ISFDropTarget_Release (IDropTarget * iface)
|
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IDropTarget(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)\n", This);
|
|
|
|
|
|
|
|
return IUnknown_Release (This->pUnkOuter);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
2005-03-01 11:41:14 +01:00
|
|
|
ISFDropTarget_DragEnter (IDropTarget * iface, IDataObject * pDataObject,
|
|
|
|
DWORD dwKeyState, POINTL pt, DWORD * pdwEffect)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
|
|
|
FORMATETC fmt;
|
|
|
|
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IDropTarget(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)->(DataObject=%p)\n", This, pDataObject);
|
|
|
|
|
|
|
|
InitFormatEtc (fmt, This->cfShellIDList, TYMED_HGLOBAL);
|
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
This->fAcceptFmt = (S_OK == IDataObject_QueryGetData (pDataObject, &fmt)) ?
|
|
|
|
TRUE : FALSE;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
ISFDropTarget_QueryDrop (iface, dwKeyState, pdwEffect);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-03-01 11:41:14 +01:00
|
|
|
static HRESULT WINAPI
|
|
|
|
ISFDropTarget_DragOver (IDropTarget * iface, DWORD dwKeyState, POINTL pt,
|
|
|
|
DWORD * pdwEffect)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IDropTarget(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)\n", This);
|
|
|
|
|
|
|
|
if (!pdwEffect)
|
2005-03-01 11:41:14 +01:00
|
|
|
return E_INVALIDARG;
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
ISFDropTarget_QueryDrop (iface, dwKeyState, pdwEffect);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ISFDropTarget_DragLeave (IDropTarget * iface)
|
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IDropTarget(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
TRACE ("(%p)\n", This);
|
|
|
|
|
|
|
|
This->fAcceptFmt = FALSE;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
2005-03-01 11:41:14 +01:00
|
|
|
ISFDropTarget_Drop (IDropTarget * iface, IDataObject * pDataObject,
|
|
|
|
DWORD dwKeyState, POINTL pt, DWORD * pdwEffect)
|
2002-07-24 03:56:03 +02:00
|
|
|
{
|
2005-07-27 13:10:52 +02:00
|
|
|
IGenericSFImpl *This = impl_from_IDropTarget(iface);
|
2002-07-24 03:56:03 +02:00
|
|
|
|
|
|
|
FIXME ("(%p) object dropped\n", This);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IDropTargetVtbl dtvt = {
|
2005-03-01 11:41:14 +01:00
|
|
|
ISFDropTarget_QueryInterface,
|
|
|
|
ISFDropTarget_AddRef,
|
|
|
|
ISFDropTarget_Release,
|
|
|
|
ISFDropTarget_DragEnter,
|
|
|
|
ISFDropTarget_DragOver,
|
|
|
|
ISFDropTarget_DragLeave,
|
|
|
|
ISFDropTarget_Drop
|
2002-07-24 03:56:03 +02:00
|
|
|
};
|