2011-01-18 19:35:41 +01:00
|
|
|
/*
|
|
|
|
* IShellDispatch implementation
|
|
|
|
*
|
|
|
|
* Copyright 2010 Alexander Morozov for Etersoft
|
|
|
|
*
|
|
|
|
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2011-01-18 19:37:20 +01:00
|
|
|
#include "winreg.h"
|
2012-05-07 11:42:27 +02:00
|
|
|
#include "winsvc.h"
|
2011-01-18 19:37:20 +01:00
|
|
|
#include "shlwapi.h"
|
2011-01-18 19:35:41 +01:00
|
|
|
#include "shlobj.h"
|
|
|
|
#include "shldisp.h"
|
|
|
|
#include "debughlp.h"
|
|
|
|
|
2015-05-08 06:44:13 +02:00
|
|
|
#include "shell32_main.h"
|
2017-09-19 21:24:23 +02:00
|
|
|
#include "pidl.h"
|
2015-05-08 06:44:13 +02:00
|
|
|
|
2011-01-18 19:35:41 +01:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
|
|
|
|
2013-11-19 13:12:33 +01:00
|
|
|
static ITypeLib *typelib;
|
2014-01-14 13:49:42 +01:00
|
|
|
static const IID * const tid_ids[] =
|
2013-11-19 13:12:33 +01:00
|
|
|
{
|
|
|
|
&IID_NULL,
|
2015-05-06 07:38:53 +02:00
|
|
|
&IID_IShellDispatch6,
|
2015-05-08 06:44:13 +02:00
|
|
|
&IID_IShellFolderViewDual3,
|
2013-11-19 13:12:33 +01:00
|
|
|
&IID_Folder3,
|
2015-05-10 20:02:55 +02:00
|
|
|
&IID_FolderItem2,
|
2016-07-07 07:35:42 +02:00
|
|
|
&IID_FolderItems3,
|
2015-05-10 20:37:00 +02:00
|
|
|
&IID_FolderItemVerb,
|
2020-09-14 22:52:16 +02:00
|
|
|
&IID_FolderItemVerbs,
|
|
|
|
&IID_IShellLinkDual2
|
2013-11-19 13:12:33 +01:00
|
|
|
};
|
|
|
|
static ITypeInfo *typeinfos[LAST_tid];
|
|
|
|
|
2011-01-18 19:35:41 +01:00
|
|
|
typedef struct {
|
2015-05-06 07:38:53 +02:00
|
|
|
IShellDispatch6 IShellDispatch6_iface;
|
2011-01-18 19:35:41 +01:00
|
|
|
LONG ref;
|
|
|
|
} ShellDispatch;
|
|
|
|
|
2011-01-18 19:37:20 +01:00
|
|
|
typedef struct {
|
2013-09-03 15:09:07 +02:00
|
|
|
Folder3 Folder3_iface;
|
2011-01-18 19:37:20 +01:00
|
|
|
LONG ref;
|
2017-09-13 12:58:32 +02:00
|
|
|
IDispatch *application;
|
2017-09-19 21:24:23 +02:00
|
|
|
IShellFolder2 *folder;
|
|
|
|
PIDLIST_ABSOLUTE pidl;
|
2017-09-28 10:25:46 +02:00
|
|
|
BSTR path;
|
2011-01-18 19:37:20 +01:00
|
|
|
} FolderImpl;
|
|
|
|
|
2016-07-07 07:35:42 +02:00
|
|
|
typedef struct {
|
|
|
|
FolderItems3 FolderItems3_iface;
|
|
|
|
LONG ref;
|
2017-09-13 12:58:32 +02:00
|
|
|
FolderImpl *folder;
|
2017-09-28 10:25:46 +02:00
|
|
|
BSTR *item_names;
|
2017-09-12 07:16:41 +02:00
|
|
|
LONG item_count;
|
2016-07-07 07:35:42 +02:00
|
|
|
} FolderItemsImpl;
|
|
|
|
|
2011-02-02 18:11:19 +01:00
|
|
|
typedef struct {
|
2014-05-24 16:23:52 +02:00
|
|
|
FolderItem2 FolderItem2_iface;
|
2011-02-02 18:11:19 +01:00
|
|
|
LONG ref;
|
2017-09-15 12:14:17 +02:00
|
|
|
FolderImpl *folder;
|
2017-09-26 11:57:50 +02:00
|
|
|
WCHAR *path; /* if NULL, folder path is used */
|
2017-09-26 11:57:51 +02:00
|
|
|
DWORD attributes;
|
2011-02-02 18:11:19 +01:00
|
|
|
} FolderItemImpl;
|
|
|
|
|
2015-05-10 20:02:55 +02:00
|
|
|
typedef struct {
|
|
|
|
FolderItemVerbs FolderItemVerbs_iface;
|
|
|
|
LONG ref;
|
2015-05-10 20:34:58 +02:00
|
|
|
|
2015-05-10 21:45:52 +02:00
|
|
|
IContextMenu *contextmenu;
|
|
|
|
HMENU hMenu;
|
2015-05-10 20:34:58 +02:00
|
|
|
LONG count;
|
2015-05-10 20:02:55 +02:00
|
|
|
} FolderItemVerbsImpl;
|
|
|
|
|
2015-05-10 20:37:00 +02:00
|
|
|
typedef struct {
|
|
|
|
FolderItemVerb FolderItemVerb_iface;
|
|
|
|
LONG ref;
|
2015-05-10 21:45:52 +02:00
|
|
|
|
|
|
|
IContextMenu *contextmenu;
|
|
|
|
BSTR name;
|
2015-05-10 20:37:00 +02:00
|
|
|
} FolderItemVerbImpl;
|
|
|
|
|
2020-09-14 22:52:16 +02:00
|
|
|
typedef struct {
|
|
|
|
IShellLinkDual2 IShellLinkDual2_iface;
|
|
|
|
LONG ref;
|
2020-09-14 22:52:47 +02:00
|
|
|
|
|
|
|
IShellLinkW *shell_link;
|
2020-09-14 22:52:16 +02:00
|
|
|
} ShellLinkObjectImpl;
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static inline ShellDispatch *impl_from_IShellDispatch6(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
2015-05-06 07:38:53 +02:00
|
|
|
return CONTAINING_RECORD(iface, ShellDispatch, IShellDispatch6_iface);
|
2011-01-18 19:35:41 +01:00
|
|
|
}
|
|
|
|
|
2011-01-18 19:37:20 +01:00
|
|
|
static inline FolderImpl *impl_from_Folder(Folder3 *iface)
|
|
|
|
{
|
2013-09-03 15:09:07 +02:00
|
|
|
return CONTAINING_RECORD(iface, FolderImpl, Folder3_iface);
|
2011-01-18 19:37:20 +01:00
|
|
|
}
|
|
|
|
|
2016-07-07 07:35:42 +02:00
|
|
|
static inline FolderItemsImpl *impl_from_FolderItems(FolderItems3 *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, FolderItemsImpl, FolderItems3_iface);
|
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static inline FolderItemImpl *impl_from_FolderItem(FolderItem2 *iface)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
2014-05-24 16:23:52 +02:00
|
|
|
return CONTAINING_RECORD(iface, FolderItemImpl, FolderItem2_iface);
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2015-05-10 20:02:55 +02:00
|
|
|
static inline FolderItemVerbsImpl *impl_from_FolderItemVerbs(FolderItemVerbs *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, FolderItemVerbsImpl, FolderItemVerbs_iface);
|
|
|
|
}
|
|
|
|
|
2015-05-10 20:37:00 +02:00
|
|
|
static inline FolderItemVerbImpl *impl_from_FolderItemVerb(FolderItemVerb *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, FolderItemVerbImpl, FolderItemVerb_iface);
|
|
|
|
}
|
|
|
|
|
2020-09-14 22:52:16 +02:00
|
|
|
static inline ShellLinkObjectImpl *impl_from_IShellLinkDual(IShellLinkDual2 *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, ShellLinkObjectImpl, IShellLinkDual2_iface);
|
|
|
|
}
|
|
|
|
|
2013-11-19 13:12:33 +01:00
|
|
|
static HRESULT load_typelib(void)
|
2011-01-20 13:55:48 +01:00
|
|
|
{
|
2013-11-19 13:12:33 +01:00
|
|
|
ITypeLib *tl;
|
|
|
|
HRESULT hr;
|
2011-01-20 13:55:48 +01:00
|
|
|
|
2013-11-19 13:12:33 +01:00
|
|
|
hr = LoadRegTypeLib(&LIBID_Shell32, 1, 0, LOCALE_SYSTEM_DEFAULT, &tl);
|
|
|
|
if (FAILED(hr)) {
|
|
|
|
ERR("LoadRegTypeLib failed: %08x\n", hr);
|
|
|
|
return hr;
|
2011-01-20 13:55:48 +01:00
|
|
|
}
|
|
|
|
|
2013-11-19 13:12:33 +01:00
|
|
|
if (InterlockedCompareExchangePointer((void**)&typelib, tl, NULL))
|
|
|
|
ITypeLib_Release(tl);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void release_typelib(void)
|
|
|
|
{
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
if (!typelib)
|
|
|
|
return;
|
|
|
|
|
2018-03-19 08:11:27 +01:00
|
|
|
for (i = 0; i < ARRAY_SIZE(typeinfos); i++)
|
2013-11-19 13:12:33 +01:00
|
|
|
if (typeinfos[i])
|
|
|
|
ITypeInfo_Release(typeinfos[i]);
|
|
|
|
|
2011-01-20 13:55:48 +01:00
|
|
|
ITypeLib_Release(typelib);
|
2013-11-19 13:12:33 +01:00
|
|
|
}
|
2011-01-20 13:55:48 +01:00
|
|
|
|
2015-05-08 06:44:13 +02:00
|
|
|
HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo)
|
2013-11-19 13:12:33 +01:00
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (!typelib)
|
|
|
|
hr = load_typelib();
|
|
|
|
if (!typelib)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
if (!typeinfos[tid])
|
|
|
|
{
|
|
|
|
ITypeInfo *ti;
|
|
|
|
|
|
|
|
hr = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], &ti);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_ids[tid]), hr);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (InterlockedCompareExchangePointer((void**)(typeinfos+tid), ti, NULL))
|
|
|
|
ITypeInfo_Release(ti);
|
|
|
|
}
|
|
|
|
|
|
|
|
*typeinfo = typeinfos[tid];
|
|
|
|
return S_OK;
|
2011-01-20 13:55:48 +01:00
|
|
|
}
|
|
|
|
|
2015-05-10 20:37:00 +02:00
|
|
|
/* FolderItemVerb */
|
|
|
|
static HRESULT WINAPI FolderItemVerbImpl_QueryInterface(FolderItemVerb *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
FolderItemVerbImpl *This = impl_from_FolderItemVerb(iface);
|
|
|
|
|
2017-09-24 19:38:44 +02:00
|
|
|
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppv);
|
2015-05-10 20:37:00 +02:00
|
|
|
|
|
|
|
if (IsEqualIID(&IID_IUnknown, riid) ||
|
|
|
|
IsEqualIID(&IID_IDispatch, riid) ||
|
|
|
|
IsEqualIID(&IID_FolderItemVerb, riid))
|
|
|
|
*ppv = &This->FolderItemVerb_iface;
|
|
|
|
else
|
|
|
|
{
|
2017-09-24 19:38:44 +02:00
|
|
|
WARN("not implemented for %s\n", debugstr_guid(riid));
|
2015-05-10 20:37:00 +02:00
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI FolderItemVerbImpl_AddRef(FolderItemVerb *iface)
|
|
|
|
{
|
|
|
|
FolderItemVerbImpl *This = impl_from_FolderItemVerb(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p), new refcount=%i\n", iface, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI FolderItemVerbImpl_Release(FolderItemVerb *iface)
|
|
|
|
{
|
|
|
|
FolderItemVerbImpl *This = impl_from_FolderItemVerb(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p), new refcount=%i\n", iface, ref);
|
|
|
|
|
|
|
|
if (!ref)
|
2015-05-10 21:45:52 +02:00
|
|
|
{
|
|
|
|
IContextMenu_Release(This->contextmenu);
|
|
|
|
SysFreeString(This->name);
|
2018-02-22 08:43:28 +01:00
|
|
|
heap_free(This);
|
2015-05-10 21:45:52 +02:00
|
|
|
}
|
2015-05-10 20:37:00 +02:00
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbImpl_GetTypeInfoCount(FolderItemVerb *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p)\n", iface, pctinfo);
|
|
|
|
*pctinfo = 1;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbImpl_GetTypeInfo(FolderItemVerb *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p,%u,%d,%p)\n", iface, iTInfo, lcid, ppTInfo);
|
|
|
|
|
|
|
|
hr = get_typeinfo(FolderItemVerb_tid, ppTInfo);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
ITypeInfo_AddRef(*ppTInfo);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbImpl_GetIDsOfNames(FolderItemVerb *iface,
|
|
|
|
REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
ITypeInfo *ti;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2016-07-07 07:35:41 +02:00
|
|
|
TRACE("(%p,%s,%p,%u,%d,%p)\n", iface, shdebugstr_guid(riid), rgszNames, cNames, lcid,
|
2015-05-10 20:37:00 +02:00
|
|
|
rgDispId);
|
|
|
|
|
|
|
|
hr = get_typeinfo(FolderItemVerb_tid, &ti);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(ti, rgszNames, cNames, rgDispId);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbImpl_Invoke(FolderItemVerb *iface,
|
|
|
|
DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
|
|
|
|
DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
|
|
|
|
UINT *puArgErr)
|
|
|
|
{
|
|
|
|
ITypeInfo *ti;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2016-07-07 07:35:41 +02:00
|
|
|
TRACE("(%p,%d,%s,%d,%u,%p,%p,%p,%p)\n", iface, dispIdMember, shdebugstr_guid(riid), lcid,
|
2015-05-10 20:37:00 +02:00
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
|
|
|
|
hr = get_typeinfo(FolderItemVerb_tid, &ti);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = ITypeInfo_Invoke(ti, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbImpl_get_Application(FolderItemVerb *iface, IDispatch **disp)
|
|
|
|
{
|
2017-09-18 09:39:42 +02:00
|
|
|
TRACE("(%p, %p)\n", iface, disp);
|
|
|
|
|
|
|
|
if (disp)
|
|
|
|
*disp = NULL;
|
2015-05-10 20:37:00 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbImpl_get_Parent(FolderItemVerb *iface, IDispatch **disp)
|
|
|
|
{
|
2017-09-18 09:39:41 +02:00
|
|
|
TRACE("(%p, %p)\n", iface, disp);
|
|
|
|
|
|
|
|
if (disp)
|
|
|
|
*disp = NULL;
|
2015-05-10 20:37:00 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbImpl_get_Name(FolderItemVerb *iface, BSTR *name)
|
|
|
|
{
|
2015-05-10 21:45:52 +02:00
|
|
|
FolderItemVerbImpl *This = impl_from_FolderItemVerb(iface);
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", iface, name);
|
|
|
|
|
|
|
|
*name = SysAllocString(This->name);
|
|
|
|
return *name ? S_OK : E_OUTOFMEMORY;
|
2015-05-10 20:37:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbImpl_DoIt(FolderItemVerb *iface)
|
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static FolderItemVerbVtbl folderitemverbvtbl = {
|
|
|
|
FolderItemVerbImpl_QueryInterface,
|
|
|
|
FolderItemVerbImpl_AddRef,
|
|
|
|
FolderItemVerbImpl_Release,
|
|
|
|
FolderItemVerbImpl_GetTypeInfoCount,
|
|
|
|
FolderItemVerbImpl_GetTypeInfo,
|
|
|
|
FolderItemVerbImpl_GetIDsOfNames,
|
|
|
|
FolderItemVerbImpl_Invoke,
|
|
|
|
FolderItemVerbImpl_get_Application,
|
|
|
|
FolderItemVerbImpl_get_Parent,
|
|
|
|
FolderItemVerbImpl_get_Name,
|
|
|
|
FolderItemVerbImpl_DoIt
|
|
|
|
};
|
|
|
|
|
2015-05-10 21:45:52 +02:00
|
|
|
static HRESULT FolderItemVerb_Constructor(IContextMenu *contextmenu, BSTR name, FolderItemVerb **verb)
|
2015-05-10 20:37:00 +02:00
|
|
|
{
|
|
|
|
FolderItemVerbImpl *This;
|
|
|
|
|
2015-05-10 21:45:52 +02:00
|
|
|
TRACE("%p, %s\n", contextmenu, debugstr_w(name));
|
2015-05-10 20:37:00 +02:00
|
|
|
|
2018-02-22 08:43:28 +01:00
|
|
|
This = heap_alloc(sizeof(*This));
|
2015-05-10 20:37:00 +02:00
|
|
|
if (!This)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
This->FolderItemVerb_iface.lpVtbl = &folderitemverbvtbl;
|
|
|
|
This->ref = 1;
|
2015-05-10 21:45:52 +02:00
|
|
|
This->contextmenu = contextmenu;
|
|
|
|
IContextMenu_AddRef(contextmenu);
|
|
|
|
This->name = name;
|
2015-05-10 20:37:00 +02:00
|
|
|
|
|
|
|
*verb = &This->FolderItemVerb_iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2015-05-10 20:02:55 +02:00
|
|
|
/* FolderItemVerbs */
|
|
|
|
static HRESULT WINAPI FolderItemVerbsImpl_QueryInterface(FolderItemVerbs *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
FolderItemVerbsImpl *This = impl_from_FolderItemVerbs(iface);
|
|
|
|
|
2017-09-24 19:38:44 +02:00
|
|
|
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppv);
|
2015-05-10 20:02:55 +02:00
|
|
|
|
|
|
|
if (IsEqualIID(&IID_IUnknown, riid) ||
|
|
|
|
IsEqualIID(&IID_IDispatch, riid) ||
|
|
|
|
IsEqualIID(&IID_FolderItemVerbs, riid))
|
|
|
|
*ppv = &This->FolderItemVerbs_iface;
|
|
|
|
else
|
|
|
|
{
|
2017-09-24 19:38:44 +02:00
|
|
|
WARN("not implemented for %s\n", debugstr_guid(riid));
|
2015-05-10 20:02:55 +02:00
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI FolderItemVerbsImpl_AddRef(FolderItemVerbs *iface)
|
|
|
|
{
|
|
|
|
FolderItemVerbsImpl *This = impl_from_FolderItemVerbs(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p), new refcount=%i\n", iface, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI FolderItemVerbsImpl_Release(FolderItemVerbs *iface)
|
|
|
|
{
|
|
|
|
FolderItemVerbsImpl *This = impl_from_FolderItemVerbs(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p), new refcount=%i\n", iface, ref);
|
|
|
|
|
|
|
|
if (!ref)
|
2015-05-10 20:34:58 +02:00
|
|
|
{
|
2015-05-10 21:45:52 +02:00
|
|
|
IContextMenu_Release(This->contextmenu);
|
|
|
|
DestroyMenu(This->hMenu);
|
2018-02-22 08:43:28 +01:00
|
|
|
heap_free(This);
|
2015-05-10 20:34:58 +02:00
|
|
|
}
|
2015-05-10 20:02:55 +02:00
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbsImpl_GetTypeInfoCount(FolderItemVerbs *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p)\n", iface, pctinfo);
|
|
|
|
*pctinfo = 1;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbsImpl_GetTypeInfo(FolderItemVerbs *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p,%u,%d,%p)\n", iface, iTInfo, lcid, ppTInfo);
|
|
|
|
|
|
|
|
hr = get_typeinfo(FolderItemVerbs_tid, ppTInfo);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
ITypeInfo_AddRef(*ppTInfo);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbsImpl_GetIDsOfNames(FolderItemVerbs *iface,
|
|
|
|
REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
ITypeInfo *ti;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2016-07-07 07:35:41 +02:00
|
|
|
TRACE("(%p,%s,%p,%u,%d,%p)\n", iface, shdebugstr_guid(riid), rgszNames, cNames, lcid,
|
2015-05-10 20:02:55 +02:00
|
|
|
rgDispId);
|
|
|
|
|
|
|
|
hr = get_typeinfo(FolderItemVerbs_tid, &ti);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(ti, rgszNames, cNames, rgDispId);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbsImpl_Invoke(FolderItemVerbs *iface,
|
|
|
|
DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
|
|
|
|
DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
|
|
|
|
UINT *puArgErr)
|
|
|
|
{
|
|
|
|
ITypeInfo *ti;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2016-07-07 07:35:41 +02:00
|
|
|
TRACE("(%p,%d,%s,%d,%u,%p,%p,%p,%p)\n", iface, dispIdMember, shdebugstr_guid(riid), lcid,
|
2015-05-10 20:02:55 +02:00
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
|
|
|
|
hr = get_typeinfo(FolderItemVerbs_tid, &ti);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = ITypeInfo_Invoke(ti, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbsImpl_get_Count(FolderItemVerbs *iface, LONG *count)
|
|
|
|
{
|
2015-05-10 20:34:58 +02:00
|
|
|
FolderItemVerbsImpl *This = impl_from_FolderItemVerbs(iface);
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", iface, count);
|
|
|
|
|
2015-05-10 21:45:52 +02:00
|
|
|
if (!count)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2015-05-10 20:34:58 +02:00
|
|
|
*count = This->count;
|
|
|
|
return S_OK;
|
2015-05-10 20:02:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbsImpl_get_Application(FolderItemVerbs *iface, IDispatch **disp)
|
|
|
|
{
|
2017-09-18 09:39:42 +02:00
|
|
|
TRACE("(%p, %p)\n", iface, disp);
|
|
|
|
|
|
|
|
if (disp)
|
|
|
|
*disp = NULL;
|
2015-05-10 20:02:55 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbsImpl_get_Parent(FolderItemVerbs *iface, IDispatch **disp)
|
|
|
|
{
|
2017-09-18 09:39:41 +02:00
|
|
|
TRACE("(%p, %p)\n", iface, disp);
|
|
|
|
|
|
|
|
if (disp)
|
|
|
|
*disp = NULL;
|
2015-05-10 20:02:55 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbsImpl_Item(FolderItemVerbs *iface, VARIANT index, FolderItemVerb **verb)
|
|
|
|
{
|
2015-05-10 21:45:52 +02:00
|
|
|
FolderItemVerbsImpl *This = impl_from_FolderItemVerbs(iface);
|
|
|
|
MENUITEMINFOW info;
|
|
|
|
HRESULT hr;
|
|
|
|
VARIANT v;
|
|
|
|
BSTR name;
|
|
|
|
|
|
|
|
TRACE("(%p, %s, %p)\n", iface, debugstr_variant(&index), verb);
|
|
|
|
|
|
|
|
if (!verb)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*verb = NULL;
|
|
|
|
|
|
|
|
VariantInit(&v);
|
|
|
|
VariantCopyInd(&v, &index);
|
|
|
|
|
|
|
|
hr = VariantChangeType(&v, &v, 0, VT_I4);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
FIXME("failed to coerce to VT_I4, %s\n", debugstr_variant(&v));
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (V_I4(&v) > This->count)
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
if (V_I4(&v) == This->count)
|
|
|
|
name = SysAllocStringLen(NULL, 0);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* get item name */
|
|
|
|
memset(&info, 0, sizeof(info));
|
|
|
|
info.cbSize = sizeof(info);
|
|
|
|
info.fMask = MIIM_STRING;
|
|
|
|
if (!GetMenuItemInfoW(This->hMenu, V_I4(&v), TRUE, &info))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
name = SysAllocStringLen(NULL, info.cch);
|
|
|
|
if (name)
|
|
|
|
{
|
|
|
|
info.dwTypeData = name;
|
|
|
|
info.cch++;
|
|
|
|
GetMenuItemInfoW(This->hMenu, V_I4(&v), TRUE, &info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!name)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
return FolderItemVerb_Constructor(This->contextmenu, name, verb);
|
2015-05-10 20:02:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemVerbsImpl__NewEnum(FolderItemVerbs *iface, IUnknown **ret)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p)\n", iface, ret);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static FolderItemVerbsVtbl folderitemverbsvtbl = {
|
|
|
|
FolderItemVerbsImpl_QueryInterface,
|
|
|
|
FolderItemVerbsImpl_AddRef,
|
|
|
|
FolderItemVerbsImpl_Release,
|
|
|
|
FolderItemVerbsImpl_GetTypeInfoCount,
|
|
|
|
FolderItemVerbsImpl_GetTypeInfo,
|
|
|
|
FolderItemVerbsImpl_GetIDsOfNames,
|
|
|
|
FolderItemVerbsImpl_Invoke,
|
|
|
|
FolderItemVerbsImpl_get_Count,
|
|
|
|
FolderItemVerbsImpl_get_Application,
|
|
|
|
FolderItemVerbsImpl_get_Parent,
|
|
|
|
FolderItemVerbsImpl_Item,
|
|
|
|
FolderItemVerbsImpl__NewEnum
|
|
|
|
};
|
|
|
|
|
2015-05-10 20:34:58 +02:00
|
|
|
static HRESULT FolderItemVerbs_Constructor(BSTR path, FolderItemVerbs **verbs)
|
2015-05-10 20:02:55 +02:00
|
|
|
{
|
|
|
|
FolderItemVerbsImpl *This;
|
2015-05-10 20:34:58 +02:00
|
|
|
IShellFolder *folder;
|
|
|
|
LPCITEMIDLIST child;
|
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
HRESULT hr;
|
2015-05-10 20:02:55 +02:00
|
|
|
|
2017-09-27 10:13:46 +02:00
|
|
|
*verbs = NULL;
|
|
|
|
|
2018-02-22 08:43:28 +01:00
|
|
|
This = heap_alloc(sizeof(*This));
|
2015-05-10 20:02:55 +02:00
|
|
|
if (!This)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
This->FolderItemVerbs_iface.lpVtbl = &folderitemverbsvtbl;
|
|
|
|
This->ref = 1;
|
2015-05-10 20:34:58 +02:00
|
|
|
|
|
|
|
/* build context menu for this path */
|
|
|
|
hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL);
|
|
|
|
if (FAILED(hr))
|
|
|
|
goto failed;
|
|
|
|
|
|
|
|
hr = SHBindToParent(pidl, &IID_IShellFolder, (void**)&folder, &child);
|
|
|
|
CoTaskMemFree(pidl);
|
|
|
|
if (FAILED(hr))
|
|
|
|
goto failed;
|
|
|
|
|
2015-05-10 21:45:52 +02:00
|
|
|
hr = IShellFolder_GetUIObjectOf(folder, NULL, 1, &child, &IID_IContextMenu, NULL, (void**)&This->contextmenu);
|
2015-05-10 20:34:58 +02:00
|
|
|
IShellFolder_Release(folder);
|
|
|
|
if (FAILED(hr))
|
|
|
|
goto failed;
|
|
|
|
|
2015-05-10 21:45:52 +02:00
|
|
|
This->hMenu = CreatePopupMenu();
|
|
|
|
hr = IContextMenu_QueryContextMenu(This->contextmenu, This->hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
FolderItemVerbs_Release(&This->FolderItemVerbs_iface);
|
|
|
|
return hr;
|
|
|
|
}
|
2015-05-10 20:02:55 +02:00
|
|
|
|
2015-05-10 21:45:52 +02:00
|
|
|
This->count = GetMenuItemCount(This->hMenu);
|
2015-05-10 20:02:55 +02:00
|
|
|
*verbs = &This->FolderItemVerbs_iface;
|
|
|
|
return S_OK;
|
2015-05-10 20:34:58 +02:00
|
|
|
|
|
|
|
failed:
|
2018-02-22 08:43:28 +01:00
|
|
|
heap_free(This);
|
2015-05-10 20:34:58 +02:00
|
|
|
return hr;
|
2015-05-10 20:02:55 +02:00
|
|
|
}
|
|
|
|
|
2020-09-14 22:52:16 +02:00
|
|
|
static HRESULT WINAPI ShellLinkObject_QueryInterface(IShellLinkDual2 *iface, REFIID riid,
|
|
|
|
LPVOID *ppv)
|
|
|
|
{
|
|
|
|
ShellLinkObjectImpl *This = impl_from_IShellLinkDual(iface);
|
|
|
|
|
|
|
|
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
if (!ppv) return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (IsEqualIID(&IID_IUnknown, riid) ||
|
|
|
|
IsEqualIID(&IID_IDispatch, riid) ||
|
|
|
|
IsEqualIID(&IID_IShellLinkDual, riid) ||
|
|
|
|
IsEqualIID(&IID_IShellLinkDual2, riid))
|
|
|
|
*ppv = &This->IShellLinkDual2_iface;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WARN("not implemented for %s\n", debugstr_guid(riid));
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ShellLinkObject_AddRef(IShellLinkDual2 *iface)
|
|
|
|
{
|
|
|
|
ShellLinkObjectImpl *This = impl_from_IShellLinkDual(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p), new refcount=%i\n", iface, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ShellLinkObject_Release(IShellLinkDual2 *iface)
|
|
|
|
{
|
|
|
|
ShellLinkObjectImpl *This = impl_from_IShellLinkDual(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p), new refcount=%i\n", iface, ref);
|
|
|
|
|
|
|
|
if (!ref)
|
|
|
|
{
|
2020-09-14 22:52:47 +02:00
|
|
|
if (This->shell_link) IShellLinkW_Release(This->shell_link);
|
2020-09-14 22:52:16 +02:00
|
|
|
heap_free(This);
|
|
|
|
}
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_GetTypeInfoCount(IShellLinkDual2 *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p)\n", iface, pctinfo);
|
|
|
|
|
|
|
|
*pctinfo = 1;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_GetTypeInfo(IShellLinkDual2 *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p,%u,%d,%p)\n", iface, iTInfo, lcid, ppTInfo);
|
|
|
|
|
|
|
|
hr = get_typeinfo(IShellLinkDual2_tid, ppTInfo);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
ITypeInfo_AddRef(*ppTInfo);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_GetIDsOfNames(IShellLinkDual2 *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
ITypeInfo *ti;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p,%s,%p,%u,%d,%p)\n", iface, shdebugstr_guid(riid), rgszNames, cNames, lcid,
|
|
|
|
rgDispId);
|
|
|
|
|
|
|
|
hr = get_typeinfo(IShellLinkDual2_tid, &ti);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(ti, rgszNames, cNames, rgDispId);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_Invoke(IShellLinkDual2 *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
ShellLinkObjectImpl *This = impl_from_IShellLinkDual(iface);
|
|
|
|
ITypeInfo *ti;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p,%d,%s,%d,%u,%p,%p,%p,%p)\n", iface, dispIdMember, shdebugstr_guid(riid), lcid,
|
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
|
|
|
|
hr = get_typeinfo(IShellLinkDual2_tid, &ti);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = ITypeInfo_Invoke(ti, This, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_get_Path(IShellLinkDual2 *iface, BSTR *pbs)
|
|
|
|
{
|
2020-09-14 22:52:47 +02:00
|
|
|
ShellLinkObjectImpl *This = impl_from_IShellLinkDual(iface);
|
|
|
|
WCHAR path[MAX_PATH];
|
|
|
|
HRESULT hr;
|
2020-09-14 22:52:16 +02:00
|
|
|
|
2020-09-14 22:52:47 +02:00
|
|
|
TRACE("(%p, %p)\n", iface, pbs);
|
|
|
|
|
|
|
|
*pbs = NULL;
|
|
|
|
|
|
|
|
hr = IShellLinkW_GetPath(This->shell_link, path, MAX_PATH, NULL, 0);
|
|
|
|
if (hr != S_OK)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*pbs = SysAllocString(path);
|
|
|
|
return hr;
|
2020-09-14 22:52:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_put_Path(IShellLinkDual2 *iface, BSTR bs)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %s)\n", iface, debugstr_w(bs));
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_get_Description(IShellLinkDual2 *iface, BSTR *pbs)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p)\n", iface, pbs);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_put_Description(IShellLinkDual2 *iface, BSTR bs)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %s)\n", iface, debugstr_w(bs));
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_get_WorkingDirectory(IShellLinkDual2 *iface, BSTR *pbs)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p)\n", iface, pbs);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_put_WorkingDirectory(IShellLinkDual2 *iface, BSTR bs)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %s)\n", iface, debugstr_w(bs));
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_get_Arguments(IShellLinkDual2 *iface, BSTR *pbs)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p)\n", iface, pbs);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_put_Arguments(IShellLinkDual2 *iface, BSTR bs)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %s)\n", iface, debugstr_w(bs));
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_get_Hotkey(IShellLinkDual2 *iface, int *piHK)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p)\n", iface, piHK);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_put_Hotkey(IShellLinkDual2 *iface, int iHK)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %d)\n", iface, iHK);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_get_ShowCommand(IShellLinkDual2 *iface, int *piShowCommand)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p)\n", iface, piShowCommand);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_put_ShowCommand(IShellLinkDual2 *iface, int iShowCommand)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %d)\n", iface, iShowCommand);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_Resolve(IShellLinkDual2 *iface, int fFlags)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %d)\n", iface, fFlags);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_GetIconLocation(IShellLinkDual2 *iface, BSTR *pbs,
|
|
|
|
int *piIcon)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p, %p)\n", iface, pbs, piIcon);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_SetIconLocation(IShellLinkDual2 *iface, BSTR bs,
|
|
|
|
int iIcon)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %s, %d)\n", iface, debugstr_w(bs), iIcon);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_Save(IShellLinkDual2 *iface, VARIANT vWhere)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %s)\n", iface, debugstr_variant(&vWhere));
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellLinkObject_get_Target(IShellLinkDual2 *iface, FolderItem **ppfi)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p)\n", iface, ppfi);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IShellLinkDual2Vtbl ShellLinkObjectVtbl = {
|
|
|
|
ShellLinkObject_QueryInterface,
|
|
|
|
ShellLinkObject_AddRef,
|
|
|
|
ShellLinkObject_Release,
|
|
|
|
ShellLinkObject_GetTypeInfoCount,
|
|
|
|
ShellLinkObject_GetTypeInfo,
|
|
|
|
ShellLinkObject_GetIDsOfNames,
|
|
|
|
ShellLinkObject_Invoke,
|
|
|
|
ShellLinkObject_get_Path,
|
|
|
|
ShellLinkObject_put_Path,
|
|
|
|
ShellLinkObject_get_Description,
|
|
|
|
ShellLinkObject_put_Description,
|
|
|
|
ShellLinkObject_get_WorkingDirectory,
|
|
|
|
ShellLinkObject_put_WorkingDirectory,
|
|
|
|
ShellLinkObject_get_Arguments,
|
|
|
|
ShellLinkObject_put_Arguments,
|
|
|
|
ShellLinkObject_get_Hotkey,
|
|
|
|
ShellLinkObject_put_Hotkey,
|
|
|
|
ShellLinkObject_get_ShowCommand,
|
|
|
|
ShellLinkObject_put_ShowCommand,
|
|
|
|
ShellLinkObject_Resolve,
|
|
|
|
ShellLinkObject_GetIconLocation,
|
|
|
|
ShellLinkObject_SetIconLocation,
|
|
|
|
ShellLinkObject_Save,
|
|
|
|
ShellLinkObject_get_Target,
|
|
|
|
};
|
|
|
|
|
2020-09-14 22:52:47 +02:00
|
|
|
static HRESULT ShellLinkObject_Constructor(FolderItemImpl *item, IShellLinkDual2 **link)
|
2020-09-14 22:52:16 +02:00
|
|
|
{
|
2020-09-14 22:52:47 +02:00
|
|
|
HRESULT hr;
|
|
|
|
IPersistFile *persist_file = NULL;
|
2020-09-14 22:52:16 +02:00
|
|
|
ShellLinkObjectImpl *This;
|
|
|
|
|
2020-09-14 22:52:47 +02:00
|
|
|
TRACE("(%p, %p)\n", item, link);
|
2020-09-14 22:52:16 +02:00
|
|
|
|
|
|
|
*link = NULL;
|
|
|
|
|
|
|
|
This = heap_alloc(sizeof(*This));
|
|
|
|
if (!This) return E_OUTOFMEMORY;
|
|
|
|
This->IShellLinkDual2_iface.lpVtbl = &ShellLinkObjectVtbl;
|
|
|
|
This->ref = 1;
|
|
|
|
|
2020-09-14 22:52:47 +02:00
|
|
|
This->shell_link = NULL;
|
|
|
|
hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IShellLinkW, (LPVOID*)&This->shell_link);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
heap_free(This);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = IShellLinkW_QueryInterface(This->shell_link, &IID_IPersistFile,
|
|
|
|
(LPVOID*)&persist_file);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
IShellLinkW_Release(This->shell_link);
|
|
|
|
heap_free(This);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = IPersistFile_Load(persist_file, item->path, STGM_READ);
|
|
|
|
IPersistFile_Release(persist_file);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
IShellLinkW_Release(This->shell_link);
|
|
|
|
heap_free(This);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2020-09-28 21:28:06 +02:00
|
|
|
*link = &This->IShellLinkDual2_iface;
|
2020-09-14 22:52:16 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_QueryInterface(FolderItem2 *iface,
|
2011-02-02 18:11:19 +01:00
|
|
|
REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
|
|
|
FolderItemImpl *This = impl_from_FolderItem(iface);
|
|
|
|
|
2017-09-24 19:38:44 +02:00
|
|
|
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppv);
|
2011-02-02 18:11:19 +01:00
|
|
|
|
|
|
|
if (!ppv) return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (IsEqualIID(&IID_IUnknown, riid) ||
|
|
|
|
IsEqualIID(&IID_IDispatch, riid) ||
|
2014-05-24 16:23:52 +02:00
|
|
|
IsEqualIID(&IID_FolderItem, riid) ||
|
|
|
|
IsEqualIID(&IID_FolderItem2, riid))
|
|
|
|
*ppv = &This->FolderItem2_iface;
|
2011-02-02 18:11:19 +01:00
|
|
|
else
|
|
|
|
{
|
2017-09-24 19:38:44 +02:00
|
|
|
WARN("not implemented for %s\n", debugstr_guid(riid));
|
2011-02-02 18:11:19 +01:00
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static ULONG WINAPI FolderItemImpl_AddRef(FolderItem2 *iface)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
|
|
|
FolderItemImpl *This = impl_from_FolderItem(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p), new refcount=%i\n", iface, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static ULONG WINAPI FolderItemImpl_Release(FolderItem2 *iface)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
|
|
|
FolderItemImpl *This = impl_from_FolderItem(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p), new refcount=%i\n", iface, ref);
|
|
|
|
|
|
|
|
if (!ref)
|
|
|
|
{
|
2017-09-15 12:14:17 +02:00
|
|
|
Folder3_Release(&This->folder->Folder3_iface);
|
2018-02-22 08:43:28 +01:00
|
|
|
heap_free(This->path);
|
|
|
|
heap_free(This);
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_GetTypeInfoCount(FolderItem2 *iface,
|
2011-02-02 18:11:19 +01:00
|
|
|
UINT *pctinfo)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p)\n", iface, pctinfo);
|
|
|
|
|
|
|
|
*pctinfo = 1;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_GetTypeInfo(FolderItem2 *iface, UINT iTInfo,
|
2011-02-02 18:11:19 +01:00
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
2013-11-19 13:12:33 +01:00
|
|
|
HRESULT hr;
|
2011-02-02 18:11:19 +01:00
|
|
|
|
|
|
|
TRACE("(%p,%u,%d,%p)\n", iface, iTInfo, lcid, ppTInfo);
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
hr = get_typeinfo(FolderItem2_tid, ppTInfo);
|
2013-11-19 13:12:33 +01:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
ITypeInfo_AddRef(*ppTInfo);
|
|
|
|
return hr;
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_GetIDsOfNames(FolderItem2 *iface,
|
2011-02-02 18:11:19 +01:00
|
|
|
REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid,
|
|
|
|
DISPID *rgDispId)
|
|
|
|
{
|
2013-11-19 13:12:33 +01:00
|
|
|
ITypeInfo *ti;
|
|
|
|
HRESULT hr;
|
2011-02-02 18:11:19 +01:00
|
|
|
|
2016-07-07 07:35:41 +02:00
|
|
|
TRACE("(%p,%s,%p,%u,%d,%p)\n", iface, shdebugstr_guid(riid), rgszNames, cNames, lcid,
|
2011-02-02 18:11:19 +01:00
|
|
|
rgDispId);
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
hr = get_typeinfo(FolderItem2_tid, &ti);
|
2013-11-19 13:12:33 +01:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(ti, rgszNames, cNames, rgDispId);
|
|
|
|
return hr;
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_Invoke(FolderItem2 *iface,
|
2011-02-02 18:11:19 +01:00
|
|
|
DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
|
|
|
|
DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
|
|
|
|
UINT *puArgErr)
|
|
|
|
{
|
|
|
|
FolderItemImpl *This = impl_from_FolderItem(iface);
|
2013-11-19 13:12:33 +01:00
|
|
|
ITypeInfo *ti;
|
|
|
|
HRESULT hr;
|
2011-02-02 18:11:19 +01:00
|
|
|
|
2016-07-07 07:35:41 +02:00
|
|
|
TRACE("(%p,%d,%s,%d,%u,%p,%p,%p,%p)\n", iface, dispIdMember, shdebugstr_guid(riid), lcid,
|
2011-02-02 18:11:19 +01:00
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
hr = get_typeinfo(FolderItem2_tid, &ti);
|
2013-11-19 13:12:33 +01:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = ITypeInfo_Invoke(ti, This, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
return hr;
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2017-09-15 12:14:17 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_get_Application(FolderItem2 *iface, IDispatch **disp)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
2017-09-15 12:14:17 +02:00
|
|
|
FolderItemImpl *This = impl_from_FolderItem(iface);
|
2011-02-02 18:11:19 +01:00
|
|
|
|
2017-09-15 12:14:17 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, disp);
|
|
|
|
|
|
|
|
return Folder3_get_Application(&This->folder->Folder3_iface, disp);
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2017-09-18 09:39:41 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_get_Parent(FolderItem2 *iface, IDispatch **disp)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
2017-09-18 09:39:41 +02:00
|
|
|
FolderItemImpl *This = impl_from_FolderItem(iface);
|
2011-02-02 18:11:19 +01:00
|
|
|
|
2017-09-18 09:39:41 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, disp);
|
|
|
|
|
|
|
|
if (disp)
|
|
|
|
{
|
|
|
|
*disp = (IDispatch *)&This->folder->Folder3_iface;
|
|
|
|
IDispatch_AddRef(*disp);
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2017-09-28 10:25:44 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_get_Name(FolderItem2 *iface, BSTR *name)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
2017-09-28 10:25:44 +02:00
|
|
|
FolderItemImpl *This = impl_from_FolderItem(iface);
|
|
|
|
LPCITEMIDLIST last_part;
|
|
|
|
IShellFolder2 *parent;
|
|
|
|
HRESULT hr = S_OK;
|
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
STRRET strret;
|
2011-02-02 18:11:19 +01:00
|
|
|
|
2017-09-28 10:25:44 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, name);
|
|
|
|
|
|
|
|
*name = NULL;
|
|
|
|
|
|
|
|
if (This->path)
|
|
|
|
hr = SHParseDisplayName(This->path, NULL, &pidl, 0, NULL);
|
|
|
|
else
|
|
|
|
pidl = This->folder->pidl;
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
hr = SHBindToParent(pidl, &IID_IShellFolder2, (void **)&parent, &last_part);
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IShellFolder2_GetDisplayNameOf(parent, last_part, SHGDN_INFOLDER, &strret);
|
|
|
|
|
|
|
|
IShellFolder2_Release(parent);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = StrRetToBSTR(&strret, last_part, name);
|
|
|
|
|
|
|
|
if (This->path)
|
|
|
|
ILFree(pidl);
|
|
|
|
|
|
|
|
return hr;
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_put_Name(FolderItem2 *iface, BSTR bs)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p,%s)\n", iface, debugstr_w(bs));
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2017-09-26 11:57:50 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_get_Path(FolderItem2 *iface, BSTR *path)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
2011-02-02 19:12:15 +01:00
|
|
|
FolderItemImpl *This = impl_from_FolderItem(iface);
|
|
|
|
|
2017-09-26 11:57:50 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, path);
|
2011-02-02 18:11:19 +01:00
|
|
|
|
2017-09-26 11:57:50 +02:00
|
|
|
*path = SysAllocString(This->path ? This->path : This->folder->path);
|
|
|
|
return *path ? S_OK : E_OUTOFMEMORY;
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_get_GetLink(FolderItem2 *iface,
|
2011-02-02 18:11:19 +01:00
|
|
|
IDispatch **ppid)
|
|
|
|
{
|
2020-09-14 22:52:16 +02:00
|
|
|
IShellLinkDual2 *link;
|
|
|
|
HRESULT hr;
|
|
|
|
FolderItemImpl *This = impl_from_FolderItem(iface);
|
|
|
|
|
|
|
|
TRACE("(%p,%p)\n", iface, ppid);
|
2011-02-02 18:11:19 +01:00
|
|
|
|
|
|
|
*ppid = NULL;
|
2020-09-14 22:52:16 +02:00
|
|
|
|
|
|
|
if (!(This->attributes & SFGAO_LINK))
|
|
|
|
return E_NOTIMPL;
|
|
|
|
|
2020-09-14 22:52:47 +02:00
|
|
|
hr = ShellLinkObject_Constructor(This, &link);
|
2020-09-14 22:52:16 +02:00
|
|
|
if (hr != S_OK)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*ppid = (IDispatch*)link;
|
|
|
|
return S_OK;
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_get_GetFolder(FolderItem2 *iface,
|
2011-02-02 18:11:19 +01:00
|
|
|
IDispatch **ppid)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p)\n", iface, ppid);
|
|
|
|
|
|
|
|
*ppid = NULL;
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2017-09-26 11:57:51 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_get_IsLink(FolderItem2 *iface, VARIANT_BOOL *b)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
2017-09-26 11:57:51 +02:00
|
|
|
FolderItemImpl *This = impl_from_FolderItem(iface);
|
2011-02-02 18:11:19 +01:00
|
|
|
|
2017-09-26 11:57:51 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, b);
|
|
|
|
|
|
|
|
*b = This->attributes & SFGAO_LINK ? VARIANT_TRUE : VARIANT_FALSE;
|
|
|
|
|
|
|
|
return S_OK;
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2017-09-26 11:57:51 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_get_IsFolder(FolderItem2 *iface, VARIANT_BOOL *b)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
2017-09-26 11:57:51 +02:00
|
|
|
FolderItemImpl *This = impl_from_FolderItem(iface);
|
2011-02-02 18:11:19 +01:00
|
|
|
|
2017-09-26 11:57:51 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, b);
|
|
|
|
|
|
|
|
*b = This->attributes & SFGAO_FOLDER ? VARIANT_TRUE : VARIANT_FALSE;
|
|
|
|
|
|
|
|
return S_OK;
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2017-09-26 11:57:51 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_get_IsFileSystem(FolderItem2 *iface, VARIANT_BOOL *b)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
2017-09-26 11:57:51 +02:00
|
|
|
FolderItemImpl *This = impl_from_FolderItem(iface);
|
2011-02-02 18:11:19 +01:00
|
|
|
|
2017-09-26 11:57:51 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, b);
|
|
|
|
|
|
|
|
*b = This->attributes & SFGAO_FILESYSTEM ? VARIANT_TRUE : VARIANT_FALSE;
|
|
|
|
|
|
|
|
return S_OK;
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2017-09-26 11:57:51 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_get_IsBrowsable(FolderItem2 *iface, VARIANT_BOOL *b)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
2017-09-26 11:57:51 +02:00
|
|
|
FolderItemImpl *This = impl_from_FolderItem(iface);
|
2011-02-02 18:11:19 +01:00
|
|
|
|
2017-09-26 11:57:51 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, b);
|
|
|
|
|
|
|
|
*b = This->attributes & SFGAO_BROWSABLE ? VARIANT_TRUE : VARIANT_FALSE;
|
|
|
|
|
|
|
|
return S_OK;
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_get_ModifyDate(FolderItem2 *iface,
|
2011-02-02 18:11:19 +01:00
|
|
|
DATE *pdt)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p)\n", iface, pdt);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_put_ModifyDate(FolderItem2 *iface, DATE dt)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p,%f)\n", iface, dt);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_get_Size(FolderItem2 *iface, LONG *pul)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p,%p)\n", iface, pul);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_get_Type(FolderItem2 *iface, BSTR *pbs)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p,%p)\n", iface, pbs);
|
|
|
|
|
|
|
|
*pbs = NULL;
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-10 20:02:55 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_Verbs(FolderItem2 *iface, FolderItemVerbs **verbs)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
2017-09-27 10:13:46 +02:00
|
|
|
FolderItemImpl *This = impl_from_FolderItem(iface);
|
2015-05-10 20:34:58 +02:00
|
|
|
|
2015-05-10 20:02:55 +02:00
|
|
|
TRACE("(%p, %p)\n", iface, verbs);
|
2011-02-02 18:11:19 +01:00
|
|
|
|
2015-05-10 20:02:55 +02:00
|
|
|
if (!verbs)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2017-09-27 10:13:46 +02:00
|
|
|
return FolderItemVerbs_Constructor(This->path ? This->path : This->folder->path, verbs);
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_InvokeVerb(FolderItem2 *iface,
|
2011-02-02 18:11:19 +01:00
|
|
|
VARIANT vVerb)
|
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
static HRESULT WINAPI FolderItemImpl_InvokeVerbEx(FolderItem2 *iface, VARIANT verb, VARIANT args)
|
|
|
|
{
|
|
|
|
FIXME("(%p): stub\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemImpl_ExtendedProperty(FolderItem2 *iface, BSTR propname, VARIANT *ret)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%s %p): stub\n", iface, debugstr_w(propname), ret);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const FolderItem2Vtbl FolderItemImpl_Vtbl = {
|
2011-02-02 18:11:19 +01:00
|
|
|
FolderItemImpl_QueryInterface,
|
|
|
|
FolderItemImpl_AddRef,
|
|
|
|
FolderItemImpl_Release,
|
|
|
|
FolderItemImpl_GetTypeInfoCount,
|
|
|
|
FolderItemImpl_GetTypeInfo,
|
|
|
|
FolderItemImpl_GetIDsOfNames,
|
|
|
|
FolderItemImpl_Invoke,
|
|
|
|
FolderItemImpl_get_Application,
|
|
|
|
FolderItemImpl_get_Parent,
|
|
|
|
FolderItemImpl_get_Name,
|
|
|
|
FolderItemImpl_put_Name,
|
|
|
|
FolderItemImpl_get_Path,
|
|
|
|
FolderItemImpl_get_GetLink,
|
|
|
|
FolderItemImpl_get_GetFolder,
|
|
|
|
FolderItemImpl_get_IsLink,
|
|
|
|
FolderItemImpl_get_IsFolder,
|
|
|
|
FolderItemImpl_get_IsFileSystem,
|
|
|
|
FolderItemImpl_get_IsBrowsable,
|
|
|
|
FolderItemImpl_get_ModifyDate,
|
|
|
|
FolderItemImpl_put_ModifyDate,
|
|
|
|
FolderItemImpl_get_Size,
|
|
|
|
FolderItemImpl_get_Type,
|
|
|
|
FolderItemImpl_Verbs,
|
2014-05-24 16:23:52 +02:00
|
|
|
FolderItemImpl_InvokeVerb,
|
|
|
|
FolderItemImpl_InvokeVerbEx,
|
|
|
|
FolderItemImpl_ExtendedProperty
|
2011-02-02 18:11:19 +01:00
|
|
|
};
|
|
|
|
|
2017-09-26 11:57:50 +02:00
|
|
|
static HRESULT FolderItem_Constructor(FolderImpl *folder, const WCHAR *path, FolderItem **item)
|
2011-02-02 18:11:19 +01:00
|
|
|
{
|
2017-09-26 11:57:51 +02:00
|
|
|
PIDLIST_ABSOLUTE pidl;
|
2011-02-02 18:11:19 +01:00
|
|
|
FolderItemImpl *This;
|
|
|
|
|
2017-09-26 11:57:50 +02:00
|
|
|
TRACE("%s\n", debugstr_w(path));
|
2015-05-10 19:00:55 +02:00
|
|
|
|
2017-09-26 11:57:50 +02:00
|
|
|
*item = NULL;
|
|
|
|
|
2018-02-22 08:43:28 +01:00
|
|
|
This = heap_alloc_zero(sizeof(*This));
|
2017-09-26 11:57:50 +02:00
|
|
|
if (!This)
|
|
|
|
return E_OUTOFMEMORY;
|
2011-02-02 18:11:19 +01:00
|
|
|
|
2014-05-24 16:23:52 +02:00
|
|
|
This->FolderItem2_iface.lpVtbl = &FolderItemImpl_Vtbl;
|
2011-02-02 18:11:19 +01:00
|
|
|
This->ref = 1;
|
2017-09-26 11:57:50 +02:00
|
|
|
if (path)
|
|
|
|
This->path = strdupW(path);
|
2011-02-02 18:11:19 +01:00
|
|
|
|
2017-09-15 12:14:17 +02:00
|
|
|
This->folder = folder;
|
|
|
|
Folder3_AddRef(&folder->Folder3_iface);
|
|
|
|
|
2017-09-26 11:57:51 +02:00
|
|
|
if (SHParseDisplayName(This->path, NULL, &pidl, ~0u, &This->attributes) == S_OK)
|
|
|
|
ILFree(pidl);
|
|
|
|
|
2017-09-26 11:57:50 +02:00
|
|
|
*item = (FolderItem *)&This->FolderItem2_iface;
|
|
|
|
return S_OK;
|
2011-02-02 18:11:19 +01:00
|
|
|
}
|
|
|
|
|
2016-07-07 07:35:42 +02:00
|
|
|
static HRESULT WINAPI FolderItemsImpl_QueryInterface(FolderItems3 *iface,
|
|
|
|
REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
|
|
|
FolderItemsImpl *This = impl_from_FolderItems(iface);
|
|
|
|
|
2017-09-24 19:38:44 +02:00
|
|
|
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppv);
|
2016-07-07 07:35:42 +02:00
|
|
|
|
|
|
|
if (!ppv) return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (IsEqualIID(&IID_IUnknown, riid) ||
|
|
|
|
IsEqualIID(&IID_IDispatch, riid) ||
|
|
|
|
IsEqualIID(&IID_FolderItems, riid) ||
|
|
|
|
IsEqualIID(&IID_FolderItems2, riid) ||
|
|
|
|
IsEqualIID(&IID_FolderItems3, riid))
|
|
|
|
*ppv = &This->FolderItems3_iface;
|
|
|
|
else
|
|
|
|
{
|
2017-09-24 19:38:44 +02:00
|
|
|
WARN("not implemented for %s\n", debugstr_guid(riid));
|
2016-07-07 07:35:42 +02:00
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI FolderItemsImpl_AddRef(FolderItems3 *iface)
|
|
|
|
{
|
|
|
|
FolderItemsImpl *This = impl_from_FolderItems(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p), new refcount=%i\n", iface, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI FolderItemsImpl_Release(FolderItems3 *iface)
|
|
|
|
{
|
|
|
|
FolderItemsImpl *This = impl_from_FolderItems(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
2017-09-12 07:16:41 +02:00
|
|
|
LONG i;
|
2016-07-07 07:35:42 +02:00
|
|
|
|
|
|
|
TRACE("(%p), new refcount=%i\n", iface, ref);
|
|
|
|
|
|
|
|
if (!ref)
|
2017-09-12 07:16:41 +02:00
|
|
|
{
|
2017-09-13 12:58:32 +02:00
|
|
|
Folder3_Release(&This->folder->Folder3_iface);
|
2017-09-12 07:16:41 +02:00
|
|
|
for (i = 0; i < This->item_count; i++)
|
2017-09-28 10:25:46 +02:00
|
|
|
SysFreeString(This->item_names[i]);
|
2018-02-22 08:43:28 +01:00
|
|
|
heap_free(This->item_names);
|
|
|
|
heap_free(This);
|
2017-09-12 07:16:41 +02:00
|
|
|
}
|
2016-07-07 07:35:42 +02:00
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemsImpl_GetTypeInfoCount(FolderItems3 *iface,
|
|
|
|
UINT *count)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p)\n", iface, count);
|
|
|
|
|
|
|
|
*count = 1;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemsImpl_GetTypeInfo(FolderItems3 *iface,
|
|
|
|
UINT type, LCID lcid, ITypeInfo **ppti)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p,%u,%d,%p)\n", iface, type, lcid, ppti);
|
|
|
|
|
|
|
|
hr = get_typeinfo(FolderItems3_tid, ppti);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
ITypeInfo_AddRef(*ppti);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemsImpl_GetIDsOfNames(FolderItems3 *iface,
|
|
|
|
REFIID riid, LPOLESTR *names, UINT count, LCID lcid, DISPID *dispid)
|
|
|
|
{
|
|
|
|
ITypeInfo *ti;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p,%s,%p,%u,%d,%p)\n", iface, shdebugstr_guid(riid), names, count, lcid, dispid);
|
|
|
|
|
|
|
|
hr = get_typeinfo(FolderItems3_tid, &ti);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(ti, names, count, dispid);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemsImpl_Invoke(FolderItems3 *iface,
|
|
|
|
DISPID dispid, REFIID riid, LCID lcid, WORD flags, DISPPARAMS *params,
|
|
|
|
VARIANT *result, EXCEPINFO *ei, UINT *err)
|
|
|
|
{
|
|
|
|
FolderItemsImpl *This = impl_from_FolderItems(iface);
|
|
|
|
ITypeInfo *ti;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p,%d,%s,%d,%u,%p,%p,%p,%p)\n", iface, dispid, shdebugstr_guid(riid), lcid, flags, params, result, ei, err);
|
|
|
|
|
|
|
|
hr = get_typeinfo(FolderItems3_tid, &ti);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = ITypeInfo_Invoke(ti, This, dispid, flags, params, result, ei, err);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2017-09-28 10:25:45 +02:00
|
|
|
static BOOL shellfolder_exists(const WCHAR *path)
|
|
|
|
{
|
|
|
|
PIDLIST_ABSOLUTE pidl = NULL;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL);
|
|
|
|
ILFree(pidl);
|
|
|
|
|
|
|
|
return SUCCEEDED(hr);
|
|
|
|
}
|
|
|
|
|
2016-07-07 07:35:42 +02:00
|
|
|
static HRESULT WINAPI FolderItemsImpl_get_Count(FolderItems3 *iface, LONG *count)
|
|
|
|
{
|
2017-09-12 07:16:42 +02:00
|
|
|
FolderItemsImpl *This = impl_from_FolderItems(iface);
|
2016-07-07 07:35:42 +02:00
|
|
|
|
2017-09-12 07:16:42 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, count);
|
|
|
|
|
2017-09-28 10:25:45 +02:00
|
|
|
*count = shellfolder_exists(This->folder->path) ? This->item_count : 0;
|
2017-09-12 07:16:42 +02:00
|
|
|
return S_OK;
|
2016-07-07 07:35:42 +02:00
|
|
|
}
|
|
|
|
|
2017-09-13 12:58:32 +02:00
|
|
|
static HRESULT WINAPI FolderItemsImpl_get_Application(FolderItems3 *iface, IDispatch **disp)
|
2016-07-07 07:35:42 +02:00
|
|
|
{
|
2017-09-13 12:58:32 +02:00
|
|
|
FolderItemsImpl *This = impl_from_FolderItems(iface);
|
2016-07-07 07:35:42 +02:00
|
|
|
|
2017-09-13 12:58:32 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, disp);
|
2016-07-07 07:35:44 +02:00
|
|
|
|
2017-09-13 12:58:32 +02:00
|
|
|
return Folder3_get_Application(&This->folder->Folder3_iface, disp);
|
2016-07-07 07:35:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemsImpl_get_Parent(FolderItems3 *iface, IDispatch **ppid)
|
|
|
|
{
|
2016-07-07 07:35:45 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, ppid);
|
|
|
|
|
|
|
|
if (ppid)
|
|
|
|
*ppid = NULL;
|
2016-07-07 07:35:42 +02:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2018-08-12 21:40:50 +02:00
|
|
|
static HRESULT WINAPI FolderItemsImpl_Item(FolderItems3 *iface, VARIANT var, FolderItem **item)
|
2016-07-07 07:35:42 +02:00
|
|
|
{
|
2017-09-12 07:16:41 +02:00
|
|
|
FolderItemsImpl *This = impl_from_FolderItems(iface);
|
2017-09-28 10:25:46 +02:00
|
|
|
BSTR display_name = NULL;
|
2018-08-12 21:40:50 +02:00
|
|
|
VARIANT index;
|
2017-09-26 11:57:49 +02:00
|
|
|
HRESULT hr;
|
2017-09-12 07:16:41 +02:00
|
|
|
|
2018-08-12 21:40:50 +02:00
|
|
|
TRACE("(%p,%s,%p)\n", iface, debugstr_variant(&var), item);
|
2016-07-07 07:35:42 +02:00
|
|
|
|
2017-09-26 11:57:49 +02:00
|
|
|
*item = NULL;
|
2017-09-12 07:16:41 +02:00
|
|
|
|
2017-09-28 10:25:45 +02:00
|
|
|
if (!shellfolder_exists(This->folder->path))
|
2017-09-12 07:16:41 +02:00
|
|
|
return S_FALSE;
|
|
|
|
|
2018-08-12 21:40:50 +02:00
|
|
|
VariantInit(&index);
|
|
|
|
if (FAILED(hr = VariantCopyInd(&index, &var)))
|
|
|
|
return hr;
|
|
|
|
|
2017-09-12 07:16:41 +02:00
|
|
|
switch (V_VT(&index))
|
|
|
|
{
|
|
|
|
case VT_I2:
|
|
|
|
VariantChangeType(&index, &index, 0, VT_I4);
|
|
|
|
/* fall through */
|
|
|
|
|
|
|
|
case VT_I4:
|
|
|
|
if (V_I4(&index) >= This->item_count || V_I4(&index) < 0)
|
|
|
|
return S_FALSE;
|
|
|
|
|
2017-09-28 10:25:46 +02:00
|
|
|
display_name = SysAllocString(This->item_names[V_I4(&index)]);
|
2017-09-12 07:16:41 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case VT_BSTR:
|
2017-09-26 11:57:49 +02:00
|
|
|
{
|
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
STRRET strret;
|
2017-09-12 07:16:41 +02:00
|
|
|
|
2017-09-26 11:57:49 +02:00
|
|
|
if (!V_BSTR(&index))
|
2017-09-12 07:16:41 +02:00
|
|
|
return S_FALSE;
|
|
|
|
|
2018-08-12 21:40:50 +02:00
|
|
|
hr = IShellFolder2_ParseDisplayName(This->folder->folder, NULL, NULL, V_BSTR(&index), NULL, &pidl, NULL);
|
|
|
|
VariantClear(&index);
|
|
|
|
if (FAILED(hr))
|
2017-09-12 07:16:41 +02:00
|
|
|
return S_FALSE;
|
|
|
|
|
2017-09-28 10:25:46 +02:00
|
|
|
if (IShellFolder2_GetDisplayNameOf(This->folder->folder, pidl, SHGDN_FORPARSING, &strret) == S_OK)
|
|
|
|
StrRetToBSTR(&strret, pidl, &display_name);
|
2017-09-26 11:57:49 +02:00
|
|
|
ILFree(pidl);
|
2017-09-12 07:16:41 +02:00
|
|
|
break;
|
2017-09-26 11:57:49 +02:00
|
|
|
}
|
2017-09-12 07:16:41 +02:00
|
|
|
case VT_ERROR:
|
2017-09-28 10:25:46 +02:00
|
|
|
break;
|
2017-09-12 07:16:41 +02:00
|
|
|
|
|
|
|
default:
|
2018-08-12 21:40:50 +02:00
|
|
|
FIXME("Index type %#x not handled.\n", V_VT(&index));
|
|
|
|
VariantClear(&index);
|
2017-09-26 11:57:52 +02:00
|
|
|
/* fall through */
|
|
|
|
case VT_EMPTY:
|
2017-09-12 07:16:41 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2017-09-28 10:25:46 +02:00
|
|
|
hr = FolderItem_Constructor(This->folder, display_name, item);
|
|
|
|
SysFreeString(display_name);
|
|
|
|
return hr;
|
2016-07-07 07:35:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemsImpl__NewEnum(FolderItems3 *iface, IUnknown **ppunk)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p)\n", iface, ppunk);
|
|
|
|
|
2016-07-07 07:35:44 +02:00
|
|
|
if (!ppunk)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2016-07-07 07:35:45 +02:00
|
|
|
*ppunk = NULL;
|
2016-07-07 07:35:42 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemsImpl_InvokeVerbEx(FolderItems3 *iface, VARIANT verb, VARIANT args)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%s,%s)\n", iface, debugstr_variant(&verb), debugstr_variant(&args));
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemsImpl_Filter(FolderItems3 *iface, LONG flags, BSTR spec)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%d,%s)\n", iface, flags, wine_dbgstr_w(spec));
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderItemsImpl_get_Verbs(FolderItems3 *iface, FolderItemVerbs **ppfic)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p)\n", iface, ppfic);
|
|
|
|
|
2016-07-07 07:35:44 +02:00
|
|
|
if (!ppfic)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2016-07-07 07:35:45 +02:00
|
|
|
*ppfic = NULL;
|
2016-07-07 07:35:42 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const FolderItems3Vtbl FolderItemsImpl_Vtbl = {
|
|
|
|
FolderItemsImpl_QueryInterface,
|
|
|
|
FolderItemsImpl_AddRef,
|
|
|
|
FolderItemsImpl_Release,
|
|
|
|
FolderItemsImpl_GetTypeInfoCount,
|
|
|
|
FolderItemsImpl_GetTypeInfo,
|
|
|
|
FolderItemsImpl_GetIDsOfNames,
|
|
|
|
FolderItemsImpl_Invoke,
|
|
|
|
FolderItemsImpl_get_Count,
|
|
|
|
FolderItemsImpl_get_Application,
|
|
|
|
FolderItemsImpl_get_Parent,
|
|
|
|
FolderItemsImpl_Item,
|
|
|
|
FolderItemsImpl__NewEnum,
|
|
|
|
FolderItemsImpl_InvokeVerbEx,
|
|
|
|
FolderItemsImpl_Filter,
|
|
|
|
FolderItemsImpl_get_Verbs
|
|
|
|
};
|
|
|
|
|
2017-09-26 11:57:49 +02:00
|
|
|
static void idlist_sort(LPITEMIDLIST *idlist, unsigned int l, unsigned int r, IShellFolder2 *folder)
|
2016-07-07 07:35:42 +02:00
|
|
|
{
|
2017-09-26 11:57:49 +02:00
|
|
|
unsigned int m;
|
|
|
|
|
|
|
|
if (l == r)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (r < l)
|
|
|
|
{
|
|
|
|
idlist_sort(idlist, r, l, folder);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m = (l + r) / 2;
|
|
|
|
idlist_sort(idlist, l, m, folder);
|
|
|
|
idlist_sort(idlist, m + 1, r, folder);
|
|
|
|
|
|
|
|
/* join the two sides */
|
|
|
|
while (l <= m && m < r)
|
|
|
|
{
|
|
|
|
if ((short)IShellFolder2_CompareIDs(folder, 0, idlist[l], idlist[m + 1]) > 0)
|
|
|
|
{
|
|
|
|
LPITEMIDLIST t = idlist[m + 1];
|
|
|
|
memmove(&idlist[l + 1], &idlist[l], (m - l + 1) * sizeof(idlist[l]));
|
|
|
|
idlist[l] = t;
|
|
|
|
|
|
|
|
m++;
|
|
|
|
}
|
|
|
|
l++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT FolderItems_Constructor(FolderImpl *folder, FolderItems **ret)
|
|
|
|
{
|
|
|
|
IEnumIDList *enumidlist;
|
2016-07-07 07:35:42 +02:00
|
|
|
FolderItemsImpl *This;
|
2017-09-26 11:57:49 +02:00
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
unsigned int i;
|
|
|
|
HRESULT hr;
|
2016-07-07 07:35:42 +02:00
|
|
|
|
2017-09-28 10:25:45 +02:00
|
|
|
TRACE("(%s,%p)\n", debugstr_w(folder->path), ret);
|
2016-07-07 07:35:42 +02:00
|
|
|
|
2017-09-26 11:57:49 +02:00
|
|
|
*ret = NULL;
|
2016-07-07 07:35:42 +02:00
|
|
|
|
2018-02-22 08:43:28 +01:00
|
|
|
This = heap_alloc_zero(sizeof(*This));
|
2017-09-26 11:57:49 +02:00
|
|
|
if (!This)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2016-07-07 07:35:42 +02:00
|
|
|
This->FolderItems3_iface.lpVtbl = &FolderItemsImpl_Vtbl;
|
|
|
|
This->ref = 1;
|
2017-09-13 12:58:32 +02:00
|
|
|
This->folder = folder;
|
|
|
|
Folder3_AddRef(&folder->Folder3_iface);
|
2017-09-12 07:16:41 +02:00
|
|
|
|
2017-09-26 11:57:49 +02:00
|
|
|
enumidlist = NULL;
|
|
|
|
if (FAILED(hr = IShellFolder2_EnumObjects(folder->folder, NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS,
|
|
|
|
&enumidlist)))
|
2017-09-12 07:16:41 +02:00
|
|
|
{
|
2017-09-26 11:57:49 +02:00
|
|
|
goto failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (IEnumIDList_Next(enumidlist, 1, &pidl, NULL) == S_OK)
|
|
|
|
{
|
|
|
|
This->item_count++;
|
|
|
|
ILFree(pidl);
|
|
|
|
}
|
2017-09-12 07:16:41 +02:00
|
|
|
|
2017-09-26 11:57:49 +02:00
|
|
|
if (This->item_count)
|
|
|
|
{
|
2017-09-27 10:13:45 +02:00
|
|
|
LPITEMIDLIST *pidls;
|
|
|
|
ULONG fetched;
|
|
|
|
|
2018-02-22 08:43:28 +01:00
|
|
|
pidls = heap_alloc(This->item_count * sizeof(*pidls));
|
|
|
|
This->item_names = heap_alloc_zero(This->item_count * sizeof(*This->item_names));
|
2017-09-26 11:57:49 +02:00
|
|
|
|
|
|
|
if (!pidls || !This->item_names)
|
2017-09-12 07:16:41 +02:00
|
|
|
{
|
2018-02-22 08:43:28 +01:00
|
|
|
heap_free(pidls);
|
|
|
|
heap_free(This->item_names);
|
2017-09-26 11:57:49 +02:00
|
|
|
hr = E_OUTOFMEMORY;
|
|
|
|
goto failed;
|
2017-09-12 07:16:41 +02:00
|
|
|
}
|
|
|
|
|
2017-09-26 11:57:49 +02:00
|
|
|
IEnumIDList_Reset(enumidlist);
|
2017-09-27 10:13:45 +02:00
|
|
|
if (IEnumIDList_Next(enumidlist, This->item_count, pidls, &fetched) == S_OK)
|
2017-09-26 11:57:49 +02:00
|
|
|
idlist_sort(pidls, 0, This->item_count - 1, folder->folder);
|
|
|
|
|
|
|
|
for (i = 0; i < This->item_count; i++)
|
|
|
|
{
|
|
|
|
STRRET strret;
|
|
|
|
|
2017-09-28 10:25:46 +02:00
|
|
|
if (IShellFolder2_GetDisplayNameOf(folder->folder, pidls[i], SHGDN_FORPARSING, &strret) == S_OK)
|
|
|
|
StrRetToBSTR(&strret, pidls[i], &This->item_names[i]);
|
2017-09-26 11:57:49 +02:00
|
|
|
|
|
|
|
ILFree(pidls[i]);
|
|
|
|
}
|
2018-02-22 08:43:28 +01:00
|
|
|
heap_free(pidls);
|
2017-09-12 07:16:41 +02:00
|
|
|
}
|
2017-09-26 11:57:49 +02:00
|
|
|
IEnumIDList_Release(enumidlist);
|
2017-09-12 07:16:41 +02:00
|
|
|
|
2017-09-26 11:57:49 +02:00
|
|
|
*ret = (FolderItems *)&This->FolderItems3_iface;
|
2016-07-07 07:35:42 +02:00
|
|
|
return S_OK;
|
2017-09-12 07:16:41 +02:00
|
|
|
|
2017-09-26 11:57:49 +02:00
|
|
|
failed:
|
|
|
|
if (enumidlist)
|
|
|
|
IEnumIDList_Release(enumidlist);
|
|
|
|
return hr;
|
2016-07-07 07:35:42 +02:00
|
|
|
}
|
|
|
|
|
2011-01-18 19:37:20 +01:00
|
|
|
static HRESULT WINAPI FolderImpl_QueryInterface(Folder3 *iface, REFIID riid,
|
|
|
|
LPVOID *ppv)
|
|
|
|
{
|
|
|
|
FolderImpl *This = impl_from_Folder(iface);
|
|
|
|
|
2017-09-24 19:38:44 +02:00
|
|
|
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppv);
|
2011-01-18 19:37:20 +01:00
|
|
|
|
|
|
|
if (!ppv) return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (IsEqualIID(&IID_IUnknown, riid) ||
|
|
|
|
IsEqualIID(&IID_IDispatch, riid) ||
|
|
|
|
IsEqualIID(&IID_Folder, riid) ||
|
|
|
|
IsEqualIID(&IID_Folder2, riid) ||
|
|
|
|
IsEqualIID(&IID_Folder3, riid))
|
2013-09-03 15:09:07 +02:00
|
|
|
*ppv = &This->Folder3_iface;
|
2011-01-18 19:37:20 +01:00
|
|
|
else
|
|
|
|
{
|
2017-09-24 19:38:44 +02:00
|
|
|
WARN("not implemented for %s\n", debugstr_guid(riid));
|
2011-01-18 19:37:20 +01:00
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI FolderImpl_AddRef(Folder3 *iface)
|
|
|
|
{
|
|
|
|
FolderImpl *This = impl_from_Folder(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p), new refcount=%i\n", iface, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI FolderImpl_Release(Folder3 *iface)
|
|
|
|
{
|
|
|
|
FolderImpl *This = impl_from_Folder(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p), new refcount=%i\n", iface, ref);
|
|
|
|
|
|
|
|
if (!ref)
|
|
|
|
{
|
2017-09-19 21:24:23 +02:00
|
|
|
ILFree(This->pidl);
|
2017-09-28 10:25:46 +02:00
|
|
|
SysFreeString(This->path);
|
2017-09-19 21:24:23 +02:00
|
|
|
IShellFolder2_Release(This->folder);
|
2017-09-13 12:58:32 +02:00
|
|
|
IDispatch_Release(This->application);
|
2018-02-22 08:43:28 +01:00
|
|
|
heap_free(This);
|
2011-01-18 19:37:20 +01:00
|
|
|
}
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderImpl_GetTypeInfoCount(Folder3 *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p)\n", iface, pctinfo);
|
|
|
|
|
|
|
|
*pctinfo = 1;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderImpl_GetTypeInfo(Folder3 *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
2013-11-19 13:12:33 +01:00
|
|
|
HRESULT hr;
|
2011-01-18 19:37:20 +01:00
|
|
|
|
|
|
|
TRACE("(%p,%u,%d,%p)\n", iface, iTInfo, lcid, ppTInfo);
|
|
|
|
|
2013-11-19 13:12:33 +01:00
|
|
|
hr = get_typeinfo(Folder3_tid, ppTInfo);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
ITypeInfo_AddRef(*ppTInfo);
|
|
|
|
|
|
|
|
return hr;
|
2011-01-18 19:37:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderImpl_GetIDsOfNames(Folder3 *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
2013-11-19 13:12:33 +01:00
|
|
|
ITypeInfo *ti;
|
|
|
|
HRESULT hr;
|
2011-01-18 19:37:20 +01:00
|
|
|
|
2016-07-07 07:35:41 +02:00
|
|
|
TRACE("(%p,%s,%p,%u,%d,%p)\n", iface, shdebugstr_guid(riid), rgszNames, cNames, lcid,
|
2011-01-18 19:37:20 +01:00
|
|
|
rgDispId);
|
|
|
|
|
2013-11-19 13:12:33 +01:00
|
|
|
hr = get_typeinfo(Folder3_tid, &ti);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(ti, rgszNames, cNames, rgDispId);
|
|
|
|
return hr;
|
2011-01-18 19:37:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderImpl_Invoke(Folder3 *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
FolderImpl *This = impl_from_Folder(iface);
|
2013-11-19 13:12:33 +01:00
|
|
|
ITypeInfo *ti;
|
|
|
|
HRESULT hr;
|
2011-01-18 19:37:20 +01:00
|
|
|
|
2016-07-07 07:35:41 +02:00
|
|
|
TRACE("(%p,%d,%s,%d,%u,%p,%p,%p,%p)\n", iface, dispIdMember, shdebugstr_guid(riid), lcid,
|
2011-01-18 19:37:20 +01:00
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
|
2013-11-19 13:12:33 +01:00
|
|
|
hr = get_typeinfo(Folder3_tid, &ti);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = ITypeInfo_Invoke(ti, This, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
return hr;
|
2011-01-18 19:37:20 +01:00
|
|
|
}
|
|
|
|
|
2017-09-19 21:24:23 +02:00
|
|
|
static HRESULT WINAPI FolderImpl_get_Title(Folder3 *iface, BSTR *title)
|
2011-01-18 19:37:20 +01:00
|
|
|
{
|
2011-01-18 19:37:39 +01:00
|
|
|
FolderImpl *This = impl_from_Folder(iface);
|
2017-09-19 21:24:23 +02:00
|
|
|
PCUITEMID_CHILD last_part;
|
|
|
|
IShellFolder2 *parent;
|
|
|
|
SHELLDETAILS sd;
|
|
|
|
HRESULT hr;
|
2011-01-18 19:37:39 +01:00
|
|
|
|
2017-09-19 21:24:23 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, title);
|
2011-01-18 19:37:20 +01:00
|
|
|
|
2017-09-19 21:24:23 +02:00
|
|
|
*title = NULL;
|
2011-01-18 19:37:39 +01:00
|
|
|
|
2017-09-19 21:24:23 +02:00
|
|
|
if (FAILED(hr = SHBindToParent(This->pidl, &IID_IShellFolder2, (void **)&parent, &last_part)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
hr = IShellFolder2_GetDetailsOf(parent, last_part, 0, &sd);
|
|
|
|
IShellFolder2_Release(parent);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2017-09-28 10:25:46 +02:00
|
|
|
return StrRetToBSTR(&sd.str, last_part, title);
|
2011-01-18 19:37:20 +01:00
|
|
|
}
|
|
|
|
|
2017-09-13 12:58:32 +02:00
|
|
|
static HRESULT WINAPI FolderImpl_get_Application(Folder3 *iface, IDispatch **disp)
|
2011-01-18 19:37:20 +01:00
|
|
|
{
|
2017-09-13 12:58:32 +02:00
|
|
|
FolderImpl *This = impl_from_Folder(iface);
|
2011-01-18 19:37:20 +01:00
|
|
|
|
2017-09-13 12:58:32 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, disp);
|
|
|
|
|
|
|
|
if (!disp)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*disp = This->application;
|
|
|
|
IDispatch_AddRef(*disp);
|
|
|
|
|
|
|
|
return S_OK;
|
2011-01-18 19:37:20 +01:00
|
|
|
}
|
|
|
|
|
2017-09-18 09:39:41 +02:00
|
|
|
static HRESULT WINAPI FolderImpl_get_Parent(Folder3 *iface, IDispatch **disp)
|
2011-01-18 19:37:20 +01:00
|
|
|
{
|
2017-09-18 09:39:41 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, disp);
|
2011-01-18 19:37:20 +01:00
|
|
|
|
2017-09-18 09:39:41 +02:00
|
|
|
if (disp)
|
|
|
|
*disp = NULL;
|
2011-01-18 19:37:20 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderImpl_get_ParentFolder(Folder3 *iface, Folder **ppsf)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p)\n", iface, ppsf);
|
|
|
|
|
|
|
|
*ppsf = NULL;
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderImpl_Items(Folder3 *iface, FolderItems **ppid)
|
|
|
|
{
|
2017-09-12 07:16:41 +02:00
|
|
|
FolderImpl *This = impl_from_Folder(iface);
|
|
|
|
|
|
|
|
TRACE("(%p,%p)\n", iface, ppid);
|
2011-01-18 19:37:20 +01:00
|
|
|
|
2017-09-13 12:58:32 +02:00
|
|
|
return FolderItems_Constructor(This, ppid);
|
2011-01-18 19:37:20 +01:00
|
|
|
}
|
|
|
|
|
2015-05-10 19:00:55 +02:00
|
|
|
static HRESULT WINAPI FolderImpl_ParseName(Folder3 *iface, BSTR name, FolderItem **item)
|
2011-01-18 19:37:20 +01:00
|
|
|
{
|
2017-09-15 12:14:17 +02:00
|
|
|
FolderImpl *This = impl_from_Folder(iface);
|
2017-09-27 10:13:44 +02:00
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
STRRET strret;
|
2015-05-10 19:00:55 +02:00
|
|
|
HRESULT hr;
|
2017-09-28 10:25:46 +02:00
|
|
|
BSTR path;
|
2011-01-18 19:37:20 +01:00
|
|
|
|
2015-05-10 19:00:55 +02:00
|
|
|
TRACE("(%p,%s,%p)\n", iface, debugstr_w(name), item);
|
|
|
|
|
|
|
|
*item = NULL;
|
|
|
|
|
2017-09-27 10:13:44 +02:00
|
|
|
if (FAILED(IShellFolder2_ParseDisplayName(This->folder, NULL, NULL, name, NULL, &pidl, NULL)))
|
2015-05-10 19:00:55 +02:00
|
|
|
return S_FALSE;
|
|
|
|
|
2017-09-28 10:25:46 +02:00
|
|
|
if ((hr = IShellFolder2_GetDisplayNameOf(This->folder, pidl, SHGDN_FORPARSING, &strret)) == S_OK)
|
2017-10-03 10:41:10 +02:00
|
|
|
hr = StrRetToBSTR(&strret, pidl, &path);
|
2017-09-28 10:25:46 +02:00
|
|
|
|
2017-09-27 10:13:44 +02:00
|
|
|
ILFree(pidl);
|
2017-10-03 10:41:10 +02:00
|
|
|
if (hr != S_OK)
|
2015-05-10 19:00:55 +02:00
|
|
|
return S_FALSE;
|
|
|
|
|
2017-09-28 10:25:46 +02:00
|
|
|
hr = FolderItem_Constructor(This, path, item);
|
|
|
|
SysFreeString(path);
|
|
|
|
return hr;
|
2011-01-18 19:37:20 +01:00
|
|
|
}
|
|
|
|
|
2017-09-28 10:25:47 +02:00
|
|
|
static HRESULT WINAPI FolderImpl_NewFolder(Folder3 *iface, BSTR name, VARIANT options)
|
2011-01-18 19:37:20 +01:00
|
|
|
{
|
2017-09-28 10:25:47 +02:00
|
|
|
FIXME("(%p,%s,%s)\n", iface, debugstr_w(name), debugstr_variant(&options));
|
2011-01-18 19:37:20 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2017-09-28 10:25:47 +02:00
|
|
|
static HRESULT WINAPI FolderImpl_MoveHere(Folder3 *iface, VARIANT item, VARIANT options)
|
2011-01-18 19:37:20 +01:00
|
|
|
{
|
2017-09-28 10:25:47 +02:00
|
|
|
FIXME("(%p,%s,%s)\n", iface, debugstr_variant(&item), debugstr_variant(&options));
|
2011-01-18 19:37:20 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2017-09-28 10:25:47 +02:00
|
|
|
static HRESULT WINAPI FolderImpl_CopyHere(Folder3 *iface, VARIANT item, VARIANT options)
|
2011-01-18 19:37:20 +01:00
|
|
|
{
|
2017-09-28 10:25:47 +02:00
|
|
|
FIXME("(%p,%s,%s)\n", iface, debugstr_variant(&item), debugstr_variant(&options));
|
2011-01-18 19:37:20 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2017-09-28 10:25:47 +02:00
|
|
|
static HRESULT WINAPI FolderImpl_GetDetailsOf(Folder3 *iface, VARIANT item, int column, BSTR *str)
|
2011-01-18 19:37:20 +01:00
|
|
|
{
|
2017-09-28 10:25:47 +02:00
|
|
|
FIXME("(%p,%s,%d,%p)\n", iface, debugstr_variant(&item), column, str);
|
2011-01-18 19:37:20 +01:00
|
|
|
|
2017-09-28 10:25:47 +02:00
|
|
|
*str = NULL;
|
2011-01-18 19:37:20 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2017-09-26 11:57:50 +02:00
|
|
|
static HRESULT WINAPI FolderImpl_get_Self(Folder3 *iface, FolderItem **item)
|
2011-01-18 19:37:20 +01:00
|
|
|
{
|
2011-02-02 18:11:19 +01:00
|
|
|
FolderImpl *This = impl_from_Folder(iface);
|
2011-01-18 19:37:20 +01:00
|
|
|
|
2017-09-26 11:57:50 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, item);
|
2011-02-02 18:11:19 +01:00
|
|
|
|
2017-09-26 11:57:50 +02:00
|
|
|
return FolderItem_Constructor(This, NULL, item);
|
2011-01-18 19:37:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderImpl_get_OfflineStatus(Folder3 *iface, LONG *pul)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p)\n", iface, pul);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderImpl_Synchronize(Folder3 *iface)
|
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderImpl_get_HaveToShowWebViewBarricade(Folder3 *iface,
|
|
|
|
VARIANT_BOOL *pbHaveToShowWebViewBarricade)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p)\n", iface, pbHaveToShowWebViewBarricade);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderImpl_DismissedWebViewBarricade(Folder3 *iface)
|
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderImpl_get_ShowWebViewBarricade(Folder3 *iface,
|
|
|
|
VARIANT_BOOL *pbShowWebViewBarricade)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p)\n", iface, pbShowWebViewBarricade);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FolderImpl_put_ShowWebViewBarricade(Folder3 *iface,
|
|
|
|
VARIANT_BOOL bShowWebViewBarricade)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%d)\n", iface, bShowWebViewBarricade);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const Folder3Vtbl FolderImpl_Vtbl = {
|
|
|
|
FolderImpl_QueryInterface,
|
|
|
|
FolderImpl_AddRef,
|
|
|
|
FolderImpl_Release,
|
|
|
|
FolderImpl_GetTypeInfoCount,
|
|
|
|
FolderImpl_GetTypeInfo,
|
|
|
|
FolderImpl_GetIDsOfNames,
|
|
|
|
FolderImpl_Invoke,
|
|
|
|
FolderImpl_get_Title,
|
|
|
|
FolderImpl_get_Application,
|
|
|
|
FolderImpl_get_Parent,
|
|
|
|
FolderImpl_get_ParentFolder,
|
|
|
|
FolderImpl_Items,
|
|
|
|
FolderImpl_ParseName,
|
|
|
|
FolderImpl_NewFolder,
|
|
|
|
FolderImpl_MoveHere,
|
|
|
|
FolderImpl_CopyHere,
|
|
|
|
FolderImpl_GetDetailsOf,
|
|
|
|
FolderImpl_get_Self,
|
|
|
|
FolderImpl_get_OfflineStatus,
|
|
|
|
FolderImpl_Synchronize,
|
|
|
|
FolderImpl_get_HaveToShowWebViewBarricade,
|
|
|
|
FolderImpl_DismissedWebViewBarricade,
|
|
|
|
FolderImpl_get_ShowWebViewBarricade,
|
|
|
|
FolderImpl_put_ShowWebViewBarricade
|
|
|
|
};
|
|
|
|
|
2017-09-28 10:25:45 +02:00
|
|
|
static HRESULT Folder_Constructor(IShellFolder2 *folder, LPITEMIDLIST pidl, Folder **ret)
|
2011-01-18 19:37:20 +01:00
|
|
|
{
|
2017-09-26 11:57:50 +02:00
|
|
|
PCUITEMID_CHILD last_part;
|
|
|
|
IShellFolder2 *parent;
|
2011-01-18 19:37:20 +01:00
|
|
|
FolderImpl *This;
|
2017-09-26 11:57:50 +02:00
|
|
|
STRRET strret;
|
2017-09-19 21:24:23 +02:00
|
|
|
HRESULT hr;
|
2011-01-18 19:37:20 +01:00
|
|
|
|
2017-09-19 21:24:23 +02:00
|
|
|
*ret = NULL;
|
2011-01-18 19:37:20 +01:00
|
|
|
|
2018-02-22 08:43:28 +01:00
|
|
|
This = heap_alloc(sizeof(*This));
|
2017-09-19 21:24:23 +02:00
|
|
|
if (!This)
|
|
|
|
return E_OUTOFMEMORY;
|
2011-01-18 19:37:20 +01:00
|
|
|
|
2013-09-03 15:09:07 +02:00
|
|
|
This->Folder3_iface.lpVtbl = &FolderImpl_Vtbl;
|
2011-01-18 19:37:20 +01:00
|
|
|
This->ref = 1;
|
2017-09-19 21:24:23 +02:00
|
|
|
This->folder = folder;
|
2018-02-23 13:15:48 +01:00
|
|
|
This->pidl = ILClone(pidl);
|
2017-09-26 11:57:50 +02:00
|
|
|
|
|
|
|
hr = SHBindToParent(pidl, &IID_IShellFolder2, (void **)&parent, &last_part);
|
|
|
|
IShellFolder2_GetDisplayNameOf(parent, last_part, SHGDN_FORPARSING, &strret);
|
2017-09-28 10:25:46 +02:00
|
|
|
StrRetToBSTR(&strret, last_part, &This->path);
|
2017-09-26 11:57:50 +02:00
|
|
|
IShellFolder2_Release(parent);
|
|
|
|
|
2017-09-13 12:58:32 +02:00
|
|
|
IShellDispatch_Constructor(NULL, &IID_IDispatch, (void **)&This->application);
|
2011-01-18 19:37:20 +01:00
|
|
|
|
2017-09-19 21:24:23 +02:00
|
|
|
*ret = (Folder *)&This->Folder3_iface;
|
|
|
|
return hr;
|
2011-01-18 19:37:20 +01:00
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_QueryInterface(IShellDispatch6 *iface,
|
2011-01-18 19:35:41 +01:00
|
|
|
REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
2015-05-06 07:38:53 +02:00
|
|
|
ShellDispatch *This = impl_from_IShellDispatch6(iface);
|
2011-01-18 19:35:41 +01:00
|
|
|
|
2017-09-24 19:38:44 +02:00
|
|
|
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(riid), ppv);
|
2011-01-18 19:35:41 +01:00
|
|
|
|
|
|
|
if (!ppv) return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (IsEqualIID(&IID_IUnknown, riid) ||
|
|
|
|
IsEqualIID(&IID_IDispatch, riid) ||
|
2012-05-07 07:07:21 +02:00
|
|
|
IsEqualIID(&IID_IShellDispatch, riid) ||
|
2013-11-13 19:50:01 +01:00
|
|
|
IsEqualIID(&IID_IShellDispatch2, riid) ||
|
|
|
|
IsEqualIID(&IID_IShellDispatch3, riid) ||
|
|
|
|
IsEqualIID(&IID_IShellDispatch4, riid) ||
|
2015-05-06 07:38:53 +02:00
|
|
|
IsEqualIID(&IID_IShellDispatch5, riid) ||
|
|
|
|
IsEqualIID(&IID_IShellDispatch6, riid))
|
|
|
|
*ppv = &This->IShellDispatch6_iface;
|
2011-01-18 19:35:41 +01:00
|
|
|
else
|
|
|
|
{
|
2017-09-24 19:38:44 +02:00
|
|
|
WARN("not implemented for %s\n", debugstr_guid(riid));
|
2011-01-18 19:35:41 +01:00
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
2012-05-07 07:07:21 +02:00
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
IShellDispatch6_AddRef(iface);
|
2011-01-18 19:35:41 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static ULONG WINAPI ShellDispatch_AddRef(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
2015-05-06 07:38:53 +02:00
|
|
|
ShellDispatch *This = impl_from_IShellDispatch6(iface);
|
2011-01-18 19:35:41 +01:00
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p), new refcount=%i\n", iface, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static ULONG WINAPI ShellDispatch_Release(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
2015-05-06 07:38:53 +02:00
|
|
|
ShellDispatch *This = impl_from_IShellDispatch6(iface);
|
2011-01-18 19:35:41 +01:00
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p), new refcount=%i\n", iface, ref);
|
|
|
|
|
|
|
|
if (!ref)
|
2018-02-22 08:43:28 +01:00
|
|
|
heap_free(This);
|
2013-11-19 13:12:33 +01:00
|
|
|
|
2011-01-18 19:35:41 +01:00
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_GetTypeInfoCount(IShellDispatch6 *iface,
|
2011-01-18 19:35:41 +01:00
|
|
|
UINT *pctinfo)
|
|
|
|
{
|
2011-01-20 13:55:48 +01:00
|
|
|
TRACE("(%p,%p)\n", iface, pctinfo);
|
2011-01-18 19:35:41 +01:00
|
|
|
|
2011-01-20 13:55:48 +01:00
|
|
|
*pctinfo = 1;
|
|
|
|
return S_OK;
|
2011-01-18 19:35:41 +01:00
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_GetTypeInfo(IShellDispatch6 *iface,
|
2011-01-18 19:35:41 +01:00
|
|
|
UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
2013-11-19 13:12:33 +01:00
|
|
|
HRESULT hr;
|
2011-01-18 19:35:41 +01:00
|
|
|
|
2011-01-20 13:55:48 +01:00
|
|
|
TRACE("(%p,%u,%d,%p)\n", iface, iTInfo, lcid, ppTInfo);
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
hr = get_typeinfo(IShellDispatch6_tid, ppTInfo);
|
2013-11-19 13:12:33 +01:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
ITypeInfo_AddRef(*ppTInfo);
|
|
|
|
return hr;
|
2011-01-18 19:35:41 +01:00
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_GetIDsOfNames(IShellDispatch6 *iface,
|
2011-01-18 19:35:41 +01:00
|
|
|
REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
2013-11-19 13:12:33 +01:00
|
|
|
ITypeInfo *ti;
|
|
|
|
HRESULT hr;
|
2011-01-20 13:55:48 +01:00
|
|
|
|
2016-07-07 07:35:41 +02:00
|
|
|
TRACE("(%p,%s,%p,%u,%d,%p)\n", iface, shdebugstr_guid(riid), rgszNames, cNames, lcid,
|
2011-01-18 19:35:41 +01:00
|
|
|
rgDispId);
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
hr = get_typeinfo(IShellDispatch6_tid, &ti);
|
2013-11-19 13:12:33 +01:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(ti, rgszNames, cNames, rgDispId);
|
|
|
|
return hr;
|
2011-01-18 19:35:41 +01:00
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_Invoke(IShellDispatch6 *iface,
|
2011-01-18 19:35:41 +01:00
|
|
|
DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
|
|
|
|
DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
|
|
|
|
UINT *puArgErr)
|
|
|
|
{
|
2015-05-06 07:38:53 +02:00
|
|
|
ShellDispatch *This = impl_from_IShellDispatch6(iface);
|
2013-11-19 13:12:33 +01:00
|
|
|
ITypeInfo *ti;
|
|
|
|
HRESULT hr;
|
2011-01-20 13:55:48 +01:00
|
|
|
|
2016-07-07 07:35:41 +02:00
|
|
|
TRACE("(%p,%d,%s,%d,%u,%p,%p,%p,%p)\n", iface, dispIdMember, shdebugstr_guid(riid), lcid,
|
2011-01-18 19:35:41 +01:00
|
|
|
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
hr = get_typeinfo(IShellDispatch6_tid, &ti);
|
2013-11-19 13:12:33 +01:00
|
|
|
if (SUCCEEDED(hr))
|
2015-05-06 07:38:53 +02:00
|
|
|
hr = ITypeInfo_Invoke(ti, &This->IShellDispatch6_iface, dispIdMember, wFlags, pDispParams,
|
2013-11-19 13:12:33 +01:00
|
|
|
pVarResult, pExcepInfo, puArgErr);
|
|
|
|
return hr;
|
2011-01-18 19:35:41 +01:00
|
|
|
}
|
|
|
|
|
2017-09-18 09:39:42 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_get_Application(IShellDispatch6 *iface, IDispatch **disp)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
2017-09-18 09:39:42 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, disp);
|
2011-01-18 19:35:41 +01:00
|
|
|
|
2017-09-18 09:39:42 +02:00
|
|
|
if (!disp)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*disp = (IDispatch *)iface;
|
|
|
|
IDispatch_AddRef(*disp);
|
|
|
|
return S_OK;
|
2011-01-18 19:35:41 +01:00
|
|
|
}
|
|
|
|
|
2017-09-18 09:39:41 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_get_Parent(IShellDispatch6 *iface, IDispatch **disp)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
2017-09-18 09:39:41 +02:00
|
|
|
TRACE("(%p,%p)\n", iface, disp);
|
2011-01-18 19:35:41 +01:00
|
|
|
|
2017-09-18 09:39:41 +02:00
|
|
|
if (disp)
|
|
|
|
{
|
|
|
|
*disp = (IDispatch *)iface;
|
|
|
|
IDispatch_AddRef(*disp);
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2011-01-18 19:35:41 +01:00
|
|
|
}
|
|
|
|
|
2018-02-23 13:15:48 +01:00
|
|
|
static HRESULT create_folder_for_pidl(LPITEMIDLIST pidl, Folder **ret)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
2017-09-19 21:24:23 +02:00
|
|
|
IShellFolder2 *folder;
|
|
|
|
IShellFolder *desktop;
|
2018-02-23 13:15:48 +01:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
*ret = NULL;
|
|
|
|
|
|
|
|
if (FAILED(hr = SHGetDesktopFolder(&desktop)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
if (_ILIsDesktop(pidl))
|
|
|
|
hr = IShellFolder_QueryInterface(desktop, &IID_IShellFolder2, (void **)&folder);
|
|
|
|
else
|
|
|
|
hr = IShellFolder_BindToObject(desktop, pidl, NULL, &IID_IShellFolder2, (void **)&folder);
|
|
|
|
|
|
|
|
IShellFolder_Release(desktop);
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
return Folder_Constructor(folder, pidl, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ShellDispatch_NameSpace(IShellDispatch6 *iface,
|
|
|
|
VARIANT dir, Folder **ret)
|
|
|
|
{
|
2017-09-19 21:24:23 +02:00
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p,%s,%p)\n", iface, debugstr_variant(&dir), ret);
|
|
|
|
|
|
|
|
*ret = NULL;
|
|
|
|
|
|
|
|
switch (V_VT(&dir))
|
|
|
|
{
|
|
|
|
case VT_I2:
|
|
|
|
if (FAILED(hr = VariantChangeType(&dir, &dir, 0, VT_I4)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
/* fallthrough */
|
|
|
|
case VT_I4:
|
|
|
|
if (FAILED(hr = SHGetFolderLocation(NULL, V_I4(&dir), NULL, 0, &pidl)))
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case VT_BSTR:
|
|
|
|
if (FAILED(hr = SHParseDisplayName(V_BSTR(&dir), NULL, &pidl, 0, NULL)))
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
WARN("Ignoring directory value %s\n", debugstr_variant(&dir));
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2018-02-23 13:15:48 +01:00
|
|
|
hr = create_folder_for_pidl(pidl, ret);
|
|
|
|
ILFree(pidl);
|
2017-09-19 21:24:23 +02:00
|
|
|
|
2018-02-23 13:15:48 +01:00
|
|
|
return hr;
|
|
|
|
}
|
2011-01-18 19:35:41 +01:00
|
|
|
|
2018-02-23 13:15:48 +01:00
|
|
|
static BOOL is_optional_argument(const VARIANT *arg)
|
|
|
|
{
|
|
|
|
return V_VT(arg) == VT_ERROR && V_ERROR(arg) == DISP_E_PARAMNOTFOUND;
|
2011-01-18 19:35:41 +01:00
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_BrowseForFolder(IShellDispatch6 *iface,
|
2018-02-23 13:15:48 +01:00
|
|
|
LONG hwnd, BSTR title, LONG options, VARIANT rootfolder, Folder **folder)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
2018-02-23 13:15:48 +01:00
|
|
|
PIDLIST_ABSOLUTE selection;
|
|
|
|
BROWSEINFOW bi = { 0 };
|
|
|
|
HRESULT hr;
|
2011-01-18 19:35:41 +01:00
|
|
|
|
2018-02-23 13:15:48 +01:00
|
|
|
TRACE("(%p,%x,%s,%x,%s,%p)\n", iface, hwnd, debugstr_w(title), options, debugstr_variant(&rootfolder), folder);
|
|
|
|
|
|
|
|
*folder = NULL;
|
|
|
|
|
|
|
|
if (!is_optional_argument(&rootfolder))
|
|
|
|
FIXME("root folder is ignored\n");
|
|
|
|
|
|
|
|
bi.hwndOwner = LongToHandle(hwnd);
|
|
|
|
bi.lpszTitle = title;
|
|
|
|
bi.ulFlags = options;
|
|
|
|
|
|
|
|
selection = SHBrowseForFolderW(&bi);
|
|
|
|
if (selection)
|
|
|
|
{
|
|
|
|
hr = create_folder_for_pidl(selection, folder);
|
|
|
|
ILFree(selection);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
hr = S_FALSE;
|
|
|
|
|
|
|
|
return hr;
|
2011-01-18 19:35:41 +01:00
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_Windows(IShellDispatch6 *iface,
|
2011-01-18 19:35:41 +01:00
|
|
|
IDispatch **ppid)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p)\n", iface, ppid);
|
|
|
|
|
|
|
|
*ppid = NULL;
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2017-09-28 10:25:47 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_Open(IShellDispatch6 *iface, VARIANT dir)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
2017-09-28 10:25:47 +02:00
|
|
|
FIXME("(%p,%s)\n", iface, debugstr_variant(&dir));
|
2011-01-18 19:35:41 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2017-09-28 10:25:47 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_Explore(IShellDispatch6 *iface, VARIANT dir)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
2017-09-28 10:25:47 +02:00
|
|
|
FIXME("(%p,%s)\n", iface, debugstr_variant(&dir));
|
2011-01-18 19:35:41 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_MinimizeAll(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_UndoMinimizeALL(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_FileRun(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_CascadeWindows(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_TileVertically(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_TileHorizontally(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_ShutdownWindows(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_Suspend(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_EjectPC(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_SetTime(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_TrayProperties(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_Help(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_FindFiles(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_FindComputer(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_RefreshMenu(IShellDispatch6 *iface)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_ControlPanelItem(IShellDispatch6 *iface,
|
2011-01-18 19:35:41 +01:00
|
|
|
BSTR szDir)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%s)\n", iface, debugstr_w(szDir));
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_IsRestricted(IShellDispatch6 *iface, BSTR group, BSTR restriction, LONG *value)
|
2012-05-07 07:07:21 +02:00
|
|
|
{
|
|
|
|
FIXME("(%s, %s, %p): stub\n", debugstr_w(group), debugstr_w(restriction), value);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-10-21 15:31:19 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_ShellExecute(IShellDispatch6 *iface,
|
|
|
|
BSTR file, VARIANT v_args, VARIANT v_dir, VARIANT v_op, VARIANT v_show)
|
2012-05-07 07:07:21 +02:00
|
|
|
{
|
2015-10-21 15:31:19 +02:00
|
|
|
VARIANT args_str, dir_str, op_str, show_int;
|
|
|
|
WCHAR *args = NULL, *dir = NULL, *op = NULL;
|
|
|
|
INT show = 0;
|
|
|
|
HINSTANCE ret;
|
|
|
|
|
|
|
|
TRACE("(%s, %s, %s, %s, %s)\n", debugstr_w(file), debugstr_variant(&v_args),
|
|
|
|
debugstr_variant(&v_dir), debugstr_variant(&v_op), debugstr_variant(&v_show));
|
|
|
|
|
|
|
|
VariantInit(&args_str);
|
|
|
|
VariantChangeType(&args_str, &v_args, 0, VT_BSTR);
|
|
|
|
if (V_VT(&args_str) == VT_BSTR)
|
|
|
|
args = V_BSTR(&args_str);
|
|
|
|
|
|
|
|
VariantInit(&dir_str);
|
|
|
|
VariantChangeType(&dir_str, &v_dir, 0, VT_BSTR);
|
|
|
|
if (V_VT(&dir_str) == VT_BSTR)
|
|
|
|
dir = V_BSTR(&dir_str);
|
|
|
|
|
|
|
|
VariantInit(&op_str);
|
|
|
|
VariantChangeType(&op_str, &v_op, 0, VT_BSTR);
|
|
|
|
if (V_VT(&op_str) == VT_BSTR)
|
|
|
|
op = V_BSTR(&op_str);
|
|
|
|
|
|
|
|
VariantInit(&show_int);
|
|
|
|
VariantChangeType(&show_int, &v_show, 0, VT_I4);
|
|
|
|
if (V_VT(&show_int) == VT_I4)
|
|
|
|
show = V_I4(&show_int);
|
|
|
|
|
|
|
|
ret = ShellExecuteW(NULL, op, file, args, dir, show);
|
|
|
|
|
|
|
|
VariantClear(&args_str);
|
|
|
|
VariantClear(&dir_str);
|
|
|
|
VariantClear(&op_str);
|
|
|
|
VariantClear(&show_int);
|
|
|
|
|
|
|
|
return (ULONG_PTR)ret > 32 ? S_OK : S_FALSE;
|
2012-05-07 07:07:21 +02:00
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_FindPrinter(IShellDispatch6 *iface, BSTR name, BSTR location, BSTR model)
|
2012-05-07 07:07:21 +02:00
|
|
|
{
|
|
|
|
FIXME("(%s, %s, %s): stub\n", debugstr_w(name), debugstr_w(location), debugstr_w(model));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_GetSystemInformation(IShellDispatch6 *iface, BSTR name, VARIANT *ret)
|
2012-05-07 07:07:21 +02:00
|
|
|
{
|
|
|
|
FIXME("(%s, %p): stub\n", debugstr_w(name), ret);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_ServiceStart(IShellDispatch6 *iface, BSTR service, VARIANT persistent, VARIANT *ret)
|
2012-05-07 07:07:21 +02:00
|
|
|
{
|
2017-09-28 10:25:47 +02:00
|
|
|
FIXME("(%s, %s, %p): stub\n", debugstr_w(service), debugstr_variant(&persistent), ret);
|
2012-05-07 07:07:21 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_ServiceStop(IShellDispatch6 *iface, BSTR service, VARIANT persistent, VARIANT *ret)
|
2012-05-07 07:07:21 +02:00
|
|
|
{
|
2017-09-28 10:25:47 +02:00
|
|
|
FIXME("(%s, %s, %p): stub\n", debugstr_w(service), debugstr_variant(&persistent), ret);
|
2012-05-07 07:07:21 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_IsServiceRunning(IShellDispatch6 *iface, BSTR name, VARIANT *running)
|
2012-05-07 07:07:21 +02:00
|
|
|
{
|
2012-05-07 11:42:27 +02:00
|
|
|
SERVICE_STATUS_PROCESS status;
|
|
|
|
SC_HANDLE scm, service;
|
|
|
|
DWORD dummy;
|
|
|
|
|
|
|
|
TRACE("(%s, %p)\n", debugstr_w(name), running);
|
|
|
|
|
|
|
|
V_VT(running) = VT_BOOL;
|
|
|
|
V_BOOL(running) = VARIANT_FALSE;
|
|
|
|
|
|
|
|
scm = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT);
|
|
|
|
if (!scm)
|
|
|
|
{
|
|
|
|
ERR("failed to connect to service manager\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
service = OpenServiceW(scm, name, SERVICE_QUERY_STATUS);
|
|
|
|
if (!service)
|
|
|
|
{
|
|
|
|
ERR("Failed to open service %s (%u)\n", debugstr_w(name), GetLastError());
|
2012-10-28 16:17:01 +01:00
|
|
|
CloseServiceHandle(scm);
|
2012-05-07 11:42:27 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!QueryServiceStatusEx(service, SC_STATUS_PROCESS_INFO, (BYTE *)&status,
|
|
|
|
sizeof(SERVICE_STATUS_PROCESS), &dummy))
|
|
|
|
{
|
|
|
|
TRACE("failed to query service status (%u)\n", GetLastError());
|
|
|
|
CloseServiceHandle(service);
|
|
|
|
CloseServiceHandle(scm);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (status.dwCurrentState == SERVICE_RUNNING)
|
|
|
|
V_BOOL(running) = VARIANT_TRUE;
|
|
|
|
|
|
|
|
CloseServiceHandle(service);
|
|
|
|
CloseServiceHandle(scm);
|
|
|
|
|
|
|
|
return S_OK;
|
2012-05-07 07:07:21 +02:00
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_CanStartStopService(IShellDispatch6 *iface, BSTR service, VARIANT *ret)
|
2012-05-07 07:07:21 +02:00
|
|
|
{
|
|
|
|
FIXME("(%s, %p): stub\n", debugstr_w(service), ret);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_ShowBrowserBar(IShellDispatch6 *iface, BSTR clsid, VARIANT show, VARIANT *ret)
|
2012-05-07 07:07:21 +02:00
|
|
|
{
|
2017-09-28 10:25:47 +02:00
|
|
|
FIXME("(%s, %s, %p): stub\n", debugstr_w(clsid), debugstr_variant(&show), ret);
|
2012-05-07 07:07:21 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_AddToRecent(IShellDispatch6 *iface, VARIANT file, BSTR category)
|
2013-11-13 19:50:01 +01:00
|
|
|
{
|
2017-09-28 10:25:47 +02:00
|
|
|
FIXME("(%s, %s): stub\n", debugstr_variant(&file), debugstr_w(category));
|
2013-11-13 19:50:01 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_WindowsSecurity(IShellDispatch6 *iface)
|
2013-11-13 19:50:01 +01:00
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_ToggleDesktop(IShellDispatch6 *iface)
|
2013-11-13 19:50:01 +01:00
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_ExplorerPolicy(IShellDispatch6 *iface, BSTR policy, VARIANT *value)
|
2013-11-13 19:50:01 +01:00
|
|
|
{
|
|
|
|
FIXME("(%s, %p): stub\n", debugstr_w(policy), value);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_GetSetting(IShellDispatch6 *iface, LONG setting, VARIANT_BOOL *result)
|
2013-11-13 19:50:01 +01:00
|
|
|
{
|
|
|
|
FIXME("(%d %p): stub\n", setting, result);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_WindowSwitcher(IShellDispatch6 *iface)
|
2013-11-13 19:50:01 +01:00
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
static HRESULT WINAPI ShellDispatch_SearchCommand(IShellDispatch6 *iface)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IShellDispatch6Vtbl ShellDispatchVtbl = {
|
2011-01-18 19:35:41 +01:00
|
|
|
ShellDispatch_QueryInterface,
|
|
|
|
ShellDispatch_AddRef,
|
|
|
|
ShellDispatch_Release,
|
|
|
|
ShellDispatch_GetTypeInfoCount,
|
|
|
|
ShellDispatch_GetTypeInfo,
|
|
|
|
ShellDispatch_GetIDsOfNames,
|
|
|
|
ShellDispatch_Invoke,
|
|
|
|
ShellDispatch_get_Application,
|
|
|
|
ShellDispatch_get_Parent,
|
|
|
|
ShellDispatch_NameSpace,
|
|
|
|
ShellDispatch_BrowseForFolder,
|
|
|
|
ShellDispatch_Windows,
|
|
|
|
ShellDispatch_Open,
|
|
|
|
ShellDispatch_Explore,
|
|
|
|
ShellDispatch_MinimizeAll,
|
|
|
|
ShellDispatch_UndoMinimizeALL,
|
|
|
|
ShellDispatch_FileRun,
|
|
|
|
ShellDispatch_CascadeWindows,
|
|
|
|
ShellDispatch_TileVertically,
|
|
|
|
ShellDispatch_TileHorizontally,
|
|
|
|
ShellDispatch_ShutdownWindows,
|
|
|
|
ShellDispatch_Suspend,
|
|
|
|
ShellDispatch_EjectPC,
|
|
|
|
ShellDispatch_SetTime,
|
|
|
|
ShellDispatch_TrayProperties,
|
|
|
|
ShellDispatch_Help,
|
|
|
|
ShellDispatch_FindFiles,
|
|
|
|
ShellDispatch_FindComputer,
|
|
|
|
ShellDispatch_RefreshMenu,
|
2012-05-07 07:07:21 +02:00
|
|
|
ShellDispatch_ControlPanelItem,
|
|
|
|
ShellDispatch_IsRestricted,
|
|
|
|
ShellDispatch_ShellExecute,
|
|
|
|
ShellDispatch_FindPrinter,
|
|
|
|
ShellDispatch_GetSystemInformation,
|
|
|
|
ShellDispatch_ServiceStart,
|
|
|
|
ShellDispatch_ServiceStop,
|
|
|
|
ShellDispatch_IsServiceRunning,
|
|
|
|
ShellDispatch_CanStartStopService,
|
2013-11-13 19:50:01 +01:00
|
|
|
ShellDispatch_ShowBrowserBar,
|
|
|
|
ShellDispatch_AddToRecent,
|
|
|
|
ShellDispatch_WindowsSecurity,
|
|
|
|
ShellDispatch_ToggleDesktop,
|
|
|
|
ShellDispatch_ExplorerPolicy,
|
|
|
|
ShellDispatch_GetSetting,
|
2015-05-06 07:38:53 +02:00
|
|
|
ShellDispatch_WindowSwitcher,
|
|
|
|
ShellDispatch_SearchCommand
|
2011-01-18 19:35:41 +01:00
|
|
|
};
|
|
|
|
|
2012-05-07 07:07:21 +02:00
|
|
|
HRESULT WINAPI IShellDispatch_Constructor(IUnknown *outer, REFIID riid, void **ppv)
|
2011-01-18 19:35:41 +01:00
|
|
|
{
|
|
|
|
ShellDispatch *This;
|
|
|
|
HRESULT ret;
|
|
|
|
|
2012-05-07 07:07:21 +02:00
|
|
|
TRACE("(%p, %s)\n", outer, debugstr_guid(riid));
|
2011-01-18 19:35:41 +01:00
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
2012-05-07 07:07:21 +02:00
|
|
|
if (outer) return CLASS_E_NOAGGREGATION;
|
2011-01-18 19:35:41 +01:00
|
|
|
|
2018-02-22 08:43:28 +01:00
|
|
|
This = heap_alloc(sizeof(*This));
|
2011-01-18 19:35:41 +01:00
|
|
|
if (!This) return E_OUTOFMEMORY;
|
2015-05-06 07:38:53 +02:00
|
|
|
This->IShellDispatch6_iface.lpVtbl = &ShellDispatchVtbl;
|
2011-01-18 19:35:41 +01:00
|
|
|
This->ref = 1;
|
|
|
|
|
2015-05-06 07:38:53 +02:00
|
|
|
ret = IShellDispatch6_QueryInterface(&This->IShellDispatch6_iface, riid, ppv);
|
|
|
|
IShellDispatch6_Release(&This->IShellDispatch6_iface);
|
2011-01-18 19:35:41 +01:00
|
|
|
return ret;
|
|
|
|
}
|