Nikolay Sivov : shell32: Add IObjectWithSite stub for context menus.
Alexandre Julliard
julliard at winehq.org
Mon Feb 19 13:52:01 CST 2018
Module: wine
Branch: master
Commit: 308a5ff7c86ffd61e64eebaa6720c3d43a79c41b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=308a5ff7c86ffd61e64eebaa6720c3d43a79c41b
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun Feb 18 19:10:45 2018 +0300
shell32: Add IObjectWithSite stub for context menus.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/shell32/shlview_cmenu.c | 57 ++++++++++++++++++++++++++++++++++++++++++
dlls/shell32/tests/shlfolder.c | 2 --
2 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
index 2b5d526..4a7263e 100644
--- a/dlls/shell32/shlview_cmenu.c
+++ b/dlls/shell32/shlview_cmenu.c
@@ -46,6 +46,7 @@ typedef struct
{
IContextMenu3 IContextMenu3_iface;
IShellExtInit IShellExtInit_iface;
+ IObjectWithSite IObjectWithSite_iface;
LONG ref;
IShellFolder* parent;
@@ -70,6 +71,11 @@ static inline ContextMenu *impl_from_IShellExtInit(IShellExtInit *iface)
return CONTAINING_RECORD(iface, ContextMenu, IShellExtInit_iface);
}
+static inline ContextMenu *impl_from_IObjectWithSite(IObjectWithSite *iface)
+{
+ return CONTAINING_RECORD(iface, ContextMenu, IObjectWithSite_iface);
+}
+
static HRESULT WINAPI ContextMenu_QueryInterface(IContextMenu3 *iface, REFIID riid, LPVOID *ppvObj)
{
ContextMenu *This = impl_from_IContextMenu3(iface);
@@ -89,6 +95,10 @@ static HRESULT WINAPI ContextMenu_QueryInterface(IContextMenu3 *iface, REFIID ri
{
*ppvObj = &This->IShellExtInit_iface;
}
+ else if (IsEqualIID(riid, &IID_IObjectWithSite))
+ {
+ *ppvObj = &This->IObjectWithSite_iface;
+ }
if(*ppvObj)
{
@@ -622,6 +632,51 @@ static const IShellExtInitVtbl ShellExtInitVtbl =
ShellExtInit_Initialize
};
+static HRESULT WINAPI ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID riid, void **obj)
+{
+ ContextMenu *This = impl_from_IObjectWithSite(iface);
+ return IContextMenu3_QueryInterface(&This->IContextMenu3_iface, riid, obj);
+}
+
+static ULONG WINAPI ObjectWithSite_AddRef(IObjectWithSite *iface)
+{
+ ContextMenu *This = impl_from_IObjectWithSite(iface);
+ return IContextMenu3_AddRef(&This->IContextMenu3_iface);
+}
+
+static ULONG WINAPI ObjectWithSite_Release(IObjectWithSite *iface)
+{
+ ContextMenu *This = impl_from_IObjectWithSite(iface);
+ return IContextMenu3_Release(&This->IContextMenu3_iface);
+}
+
+static HRESULT WINAPI ObjectWithSite_SetSite(IObjectWithSite *iface, IUnknown *site)
+{
+ ContextMenu *This = impl_from_IObjectWithSite(iface);
+
+ FIXME("(%p)->(%p): stub\n", This, site);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ObjectWithSite_GetSite(IObjectWithSite *iface, REFIID riid, void **site)
+{
+ ContextMenu *This = impl_from_IObjectWithSite(iface);
+
+ FIXME("(%p)->(%s %p): stub\n", This, debugstr_guid(riid), site);
+
+ return E_NOTIMPL;
+}
+
+static const IObjectWithSiteVtbl ObjectWithSiteVtbl =
+{
+ ObjectWithSite_QueryInterface,
+ ObjectWithSite_AddRef,
+ ObjectWithSite_Release,
+ ObjectWithSite_SetSite,
+ ObjectWithSite_GetSite,
+};
+
HRESULT ItemMenu_Constructor(IShellFolder *parent, LPCITEMIDLIST pidl, const LPCITEMIDLIST *apidl, UINT cidl,
REFIID riid, void **pObj)
{
@@ -634,6 +689,7 @@ HRESULT ItemMenu_Constructor(IShellFolder *parent, LPCITEMIDLIST pidl, const LPC
This->IContextMenu3_iface.lpVtbl = &ItemContextMenuVtbl;
This->IShellExtInit_iface.lpVtbl = &ShellExtInitVtbl;
+ This->IObjectWithSite_iface.lpVtbl = &ObjectWithSiteVtbl;
This->ref = 1;
This->parent = parent;
if (parent) IShellFolder_AddRef(parent);
@@ -943,6 +999,7 @@ HRESULT BackgroundMenu_Constructor(IShellFolder *parent, BOOL desktop, REFIID ri
This->IContextMenu3_iface.lpVtbl = &BackgroundContextMenuVtbl;
This->IShellExtInit_iface.lpVtbl = &ShellExtInitVtbl;
+ This->IObjectWithSite_iface.lpVtbl = &ObjectWithSiteVtbl;
This->ref = 1;
This->parent = parent;
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c
index fac0801..ee7ec49 100644
--- a/dlls/shell32/tests/shlfolder.c
+++ b/dlls/shell32/tests/shlfolder.c
@@ -4358,9 +4358,7 @@ static void test_contextmenu(IContextMenu *menu, BOOL background)
IUnknown_Release(unk);
hr = IContextMenu_QueryInterface(menu, &IID_IObjectWithSite, (void **)&unk);
-todo_wine
ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr);
-if (hr == S_OK)
IUnknown_Release(unk);
hr = IContextMenu_QueryContextMenu(menu, hmenu, 0, baseItem, id_upper_limit, CMF_NORMAL);
More information about the wine-cvs
mailing list