Commit 1662fa9a authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

shell32: Stub CLSID_NewMenu.

parent fe4f1382
......@@ -23,6 +23,7 @@ SOURCES = \
enumidlist.c \
folders.c \
iconcache.c \
new_menu.c \
pidl.c \
recyclebin.c \
resources/audio.svg \
......
/*
* Copyright 2015 Michael Müller
*
* 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
*/
#define COBJMACROS
#include "shobjidl.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell);
struct new_menu
{
IShellExtInit IShellExtInit_iface;
LONG refcount;
};
static struct new_menu *impl_from_IShellExtInit(IShellExtInit *iface)
{
return CONTAINING_RECORD(iface, struct new_menu, IShellExtInit_iface);
}
static HRESULT WINAPI ext_init_QueryInterface(IShellExtInit *iface, REFIID iid, void **out)
{
struct new_menu *menu = impl_from_IShellExtInit(iface);
TRACE("menu %p, iid %s, out %p.\n", menu, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IShellExtInit))
*out = &menu->IShellExtInit_iface;
else
{
*out = NULL;
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown *)*out);
return S_OK;
}
static ULONG WINAPI ext_init_AddRef(IShellExtInit *iface)
{
struct new_menu *menu = impl_from_IShellExtInit(iface);
ULONG refcount = InterlockedIncrement(&menu->refcount);
TRACE("%p increasing refcount to %lu.\n", menu, refcount);
return refcount;
}
static ULONG WINAPI ext_init_Release(IShellExtInit *iface)
{
struct new_menu *menu = impl_from_IShellExtInit(iface);
ULONG refcount = InterlockedDecrement(&menu->refcount);
TRACE("%p decreasing refcount to %lu.\n", menu, refcount);
if (!refcount)
free(menu);
return refcount;
}
static HRESULT WINAPI ext_init_Initialize(IShellExtInit *iface, LPCITEMIDLIST pidl, IDataObject *obj, HKEY key)
{
struct new_menu *menu = impl_from_IShellExtInit(iface);
TRACE("menu %p, pidl %p, obj %p, key %p.\n", menu, pidl, obj, key);
return S_OK;
}
static const IShellExtInitVtbl ext_init_vtbl =
{
ext_init_QueryInterface,
ext_init_AddRef,
ext_init_Release,
ext_init_Initialize,
};
HRESULT WINAPI new_menu_create(IUnknown *outer, REFIID iid, void **out)
{
struct new_menu *menu;
HRESULT hr;
if (outer)
return CLASS_E_NOAGGREGATION;
if (!(menu = malloc(sizeof(*menu))))
return E_OUTOFMEMORY;
menu->IShellExtInit_iface.lpVtbl = &ext_init_vtbl;
menu->refcount = 1;
TRACE("Created New menu %p.\n", menu);
hr = IShellExtInit_QueryInterface(&menu->IShellExtInit_iface, iid, out);
IShellExtInit_Release(&menu->IShellExtInit_iface);
return hr;
}
......@@ -183,3 +183,9 @@ coclass KnownFolderManager { interface IKnownFolderManager; }
threading(apartment),
uuid(75048700-ef1f-11d0-9888-006097deacf9)
] coclass ActiveDesktop { interface IActiveDesktop; }
[
threading(apartment),
uuid(d969a300-e7ff-11d0-a93b-00a0c90f2719)
]
coclass NewMenu {}
......@@ -114,6 +114,8 @@ HRESULT WINAPI ApplicationAssociationRegistration_Constructor(IUnknown *outer, R
HRESULT WINAPI ApplicationDestinations_Constructor(IUnknown *outer, REFIID riid, LPVOID *ppv);
HRESULT WINAPI ApplicationDocumentLists_Constructor(IUnknown *outer, REFIID riid, LPVOID *ppv);
HRESULT WINAPI new_menu_create(IUnknown *outer, REFIID iid, void **out);
HRESULT IShellLink_ConstructFromFile(IUnknown * pUnkOuter, REFIID riid, LPCITEMIDLIST pidl, IUnknown **ppv);
LPEXTRACTICONA IExtractIconA_Constructor(LPCITEMIDLIST);
......
......@@ -70,6 +70,7 @@ static const struct {
{&CLSID_MyComputer, ISF_MyComputer_Constructor},
{&CLSID_MyDocuments, MyDocuments_Constructor},
{&CLSID_NetworkPlaces, ISF_NetworkPlaces_Constructor},
{&CLSID_NewMenu, new_menu_create},
{&CLSID_Printers, Printers_Constructor},
{&CLSID_QueryAssociations, QueryAssociations_Constructor},
{&CLSID_RecycleBin, RecycleBin_Constructor},
......
......@@ -1482,25 +1482,21 @@ static void test_newmenu(void)
HRESULT hr;
hr = CoCreateInstance(&CLSID_NewMenu, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
todo_wine
ok(hr == S_OK, "Failed to create NewMenu object, hr %#lx.\n", hr);
if (hr != S_OK)
{
skip("NewMenu is not supported.\n");
return;
}
hr = IUnknown_QueryInterface(unk, &IID_IShellExtInit, (void **)&unk2);
ok(hr == S_OK, "Failed to get IShellExtInit, hr %#lx.\n", hr);
IUnknown_Release(unk2);
hr = IUnknown_QueryInterface(unk, &IID_IContextMenu3, (void **)&unk2);
ok(hr == S_OK, "Failed to get IContextMenu3, hr %#lx.\n", hr);
IUnknown_Release(unk2);
todo_wine ok(hr == S_OK, "Failed to get IContextMenu3, hr %#lx.\n", hr);
if (hr == S_OK)
IUnknown_Release(unk2);
hr = IUnknown_QueryInterface(unk, &IID_IObjectWithSite, (void **)&unk2);
ok(hr == S_OK, "Failed to get IObjectWithSite, hr %#lx.\n", hr);
IUnknown_Release(unk2);
todo_wine ok(hr == S_OK, "Failed to get IObjectWithSite, hr %#lx.\n", hr);
if (hr == S_OK)
IUnknown_Release(unk2);
IUnknown_Release(unk);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment