diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c index 3f09413f612..2b5d526994e 100644 --- a/dlls/shell32/shlview_cmenu.c +++ b/dlls/shell32/shlview_cmenu.c @@ -45,6 +45,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); typedef struct { IContextMenu3 IContextMenu3_iface; + IShellExtInit IShellExtInit_iface; LONG ref; IShellFolder* parent; @@ -64,6 +65,11 @@ static inline ContextMenu *impl_from_IContextMenu3(IContextMenu3 *iface) return CONTAINING_RECORD(iface, ContextMenu, IContextMenu3_iface); } +static inline ContextMenu *impl_from_IShellExtInit(IShellExtInit *iface) +{ + return CONTAINING_RECORD(iface, ContextMenu, IShellExtInit_iface); +} + static HRESULT WINAPI ContextMenu_QueryInterface(IContextMenu3 *iface, REFIID riid, LPVOID *ppvObj) { ContextMenu *This = impl_from_IContextMenu3(iface); @@ -79,9 +85,9 @@ static HRESULT WINAPI ContextMenu_QueryInterface(IContextMenu3 *iface, REFIID ri { *ppvObj = &This->IContextMenu3_iface; } - else if (IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/ + else if (IsEqualIID(riid, &IID_IShellExtInit)) { - FIXME("-- LPSHELLEXTINIT pointer requested\n"); + *ppvObj = &This->IShellExtInit_iface; } if(*ppvObj) @@ -580,6 +586,42 @@ static const IContextMenu3Vtbl ItemContextMenuVtbl = ContextMenu_HandleMenuMsg2 }; +static HRESULT WINAPI ShellExtInit_QueryInterface(IShellExtInit *iface, REFIID riid, void **obj) +{ + ContextMenu *This = impl_from_IShellExtInit(iface); + return IContextMenu3_QueryInterface(&This->IContextMenu3_iface, riid, obj); +} + +static ULONG WINAPI ShellExtInit_AddRef(IShellExtInit *iface) +{ + ContextMenu *This = impl_from_IShellExtInit(iface); + return IContextMenu3_AddRef(&This->IContextMenu3_iface); +} + +static ULONG WINAPI ShellExtInit_Release(IShellExtInit *iface) +{ + ContextMenu *This = impl_from_IShellExtInit(iface); + return IContextMenu3_Release(&This->IContextMenu3_iface); +} + +static HRESULT WINAPI ShellExtInit_Initialize(IShellExtInit *iface, LPCITEMIDLIST folder, + IDataObject *dataobj, HKEY progidkey) +{ + ContextMenu *This = impl_from_IShellExtInit(iface); + + FIXME("(%p)->(%p %p %p): stub\n", This, folder, dataobj, progidkey); + + return E_NOTIMPL; +} + +static const IShellExtInitVtbl ShellExtInitVtbl = +{ + ShellExtInit_QueryInterface, + ShellExtInit_AddRef, + ShellExtInit_Release, + ShellExtInit_Initialize +}; + HRESULT ItemMenu_Constructor(IShellFolder *parent, LPCITEMIDLIST pidl, const LPCITEMIDLIST *apidl, UINT cidl, REFIID riid, void **pObj) { @@ -591,6 +633,7 @@ HRESULT ItemMenu_Constructor(IShellFolder *parent, LPCITEMIDLIST pidl, const LPC if (!This) return E_OUTOFMEMORY; This->IContextMenu3_iface.lpVtbl = &ItemContextMenuVtbl; + This->IShellExtInit_iface.lpVtbl = &ShellExtInitVtbl; This->ref = 1; This->parent = parent; if (parent) IShellFolder_AddRef(parent); @@ -899,6 +942,7 @@ HRESULT BackgroundMenu_Constructor(IShellFolder *parent, BOOL desktop, REFIID ri if (!This) return E_OUTOFMEMORY; This->IContextMenu3_iface.lpVtbl = &BackgroundContextMenuVtbl; + This->IShellExtInit_iface.lpVtbl = &ShellExtInitVtbl; This->ref = 1; This->parent = parent; diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index 1cf04b5bbc9..fac08018e73 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -4354,9 +4354,7 @@ static void test_contextmenu(IContextMenu *menu, BOOL background) HRESULT hr; hr = IContextMenu_QueryInterface(menu, &IID_IShellExtInit, (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_QueryInterface(menu, &IID_IObjectWithSite, (void **)&unk);