Commit ad412b11 authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

shell32: Implement IID_IContextMenu in CreateViewObject() methods for shell…

shell32: Implement IID_IContextMenu in CreateViewObject() methods for shell folders that support it. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=39841Signed-off-by: 's avatarDamjan Jovanovic <damjan.jov@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent fc8bf8d3
......@@ -524,15 +524,15 @@ static HRESULT WINAPI ISF_ControlPanel_fnCreateViewObject(IShellFolder2 *iface,
if (IsEqualIID(riid, &IID_IDropTarget)) {
WARN("IDropTarget not implemented\n");
hr = E_NOTIMPL;
} else if (IsEqualIID(riid, &IID_IContextMenu)) {
WARN("IContextMenu not implemented\n");
hr = E_NOTIMPL;
} else if (IsEqualIID(riid, &IID_IShellView)) {
pShellView = IShellView_Constructor((IShellFolder *) iface);
if (pShellView) {
hr = IShellView_QueryInterface(pShellView, riid, ppvOut);
IShellView_Release(pShellView);
}
} else {
FIXME("invalid/unsupported interface %s\n", shdebugstr_guid(riid));
hr = E_NOINTERFACE;
}
}
TRACE("--(%p)->(interface=%p)\n", This, ppvOut);
......
......@@ -490,6 +490,8 @@ static HRESULT WINAPI RecycleBin_CreateViewObject(IShellFolder2 *iface, HWND hwn
*ppv = tmp;
return ret;
}
else
FIXME("invalid/unsupported interface %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
......
......@@ -428,8 +428,7 @@ static HRESULT WINAPI ISF_Desktop_fnCreateViewObject (IShellFolder2 * iface,
}
else if (IsEqualIID (riid, &IID_IContextMenu))
{
WARN ("IContextMenu not implemented\n");
hr = E_NOTIMPL;
hr = BackgroundMenu_Constructor((IShellFolder*)iface, TRUE, riid, ppvOut);
}
else if (IsEqualIID (riid, &IID_IShellView))
{
......
......@@ -467,8 +467,7 @@ IShellFolder_fnCreateViewObject (IShellFolder2 * iface, HWND hwndOwner,
if (IsEqualIID (riid, &IID_IDropTarget)) {
hr = IShellFolder2_QueryInterface (iface, &IID_IDropTarget, ppvOut);
} else if (IsEqualIID (riid, &IID_IContextMenu)) {
FIXME ("IContextMenu not implemented\n");
hr = E_NOTIMPL;
hr = BackgroundMenu_Constructor((IShellFolder*)iface, FALSE, riid, ppvOut);
} else if (IsEqualIID (riid, &IID_IShellView)) {
pShellView = IShellView_Constructor ((IShellFolder *) iface);
if (pShellView) {
......
......@@ -438,8 +438,7 @@ static HRESULT WINAPI ISF_MyComputer_fnCreateViewObject (IShellFolder2 *iface,
}
else if (IsEqualIID (riid, &IID_IContextMenu))
{
WARN ("IContextMenu not implemented\n");
hr = E_NOTIMPL;
hr = BackgroundMenu_Constructor((IShellFolder*)iface, FALSE, riid, ppvOut);
}
else if (IsEqualIID (riid, &IID_IShellView))
{
......
......@@ -321,11 +321,6 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnCreateViewObject (IShellFolder2 * ifac
WARN ("IDropTarget not implemented\n");
hr = E_NOTIMPL;
}
else if (IsEqualIID (riid, &IID_IContextMenu))
{
WARN ("IContextMenu not implemented\n");
hr = E_NOTIMPL;
}
else if (IsEqualIID (riid, &IID_IShellView))
{
pShellView = IShellView_Constructor ((IShellFolder *) iface);
......@@ -335,6 +330,11 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnCreateViewObject (IShellFolder2 * ifac
IShellView_Release (pShellView);
}
}
else
{
FIXME ("invalid/unsupported interface %s\n", shdebugstr_guid (riid));
hr = E_NOINTERFACE;
}
TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
return hr;
}
......
......@@ -195,7 +195,10 @@ static HRESULT WINAPI IShellFolder_Printers_fnCreateViewObject(IShellFolder2 *if
}
}
else
WARN("unsupported interface %s\n", shdebugstr_guid (riid));
{
FIXME("unsupported interface %s\n", shdebugstr_guid (riid));
hr = E_NOINTERFACE;
}
return hr;
}
......
......@@ -1117,6 +1117,8 @@ static HRESULT WINAPI ShellFolder2_CreateViewObject(IShellFolder2* iface, HWND h
}
} else if (IsEqualIID(&IID_IDropTarget, riid)) {
hr = IShellFolder2_QueryInterface(iface, &IID_IDropTarget, ppv);
} else if (IsEqualIID(&IID_IContextMenu, riid)) {
hr = BackgroundMenu_Constructor((IShellFolder*)iface, FALSE, riid, ppv);
}
return hr;
......
......@@ -4471,6 +4471,77 @@ static void test_GetUIObject(void)
Cleanup();
}
static void test_CreateViewObject_contextmenu(void)
{
IShellFolder *desktop;
IShellFolder *folder;
IContextMenu *cmenu;
WCHAR path[MAX_PATH];
LPITEMIDLIST pidl;
HRESULT hr;
DWORD ret;
hr = CoCreateInstance(&CLSID_ControlPanel, NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder, (void**)&folder);
ok(SUCCEEDED(hr), "got 0x%08x\n", hr);
hr = IShellFolder_CreateViewObject(folder, NULL, &IID_IContextMenu, (void**)&cmenu);
ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
if (SUCCEEDED(hr))
IContextMenu_Release(cmenu);
IShellFolder_Release(folder);
hr = CoCreateInstance(&CLSID_MyComputer, NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder, (void**)&folder);
ok(SUCCEEDED(hr), "got 0x%08x\n", hr);
hr = IShellFolder_CreateViewObject(folder, NULL, &IID_IContextMenu, (void**)&cmenu);
ok(hr == S_OK, "got 0x%08x\n", hr);
if (SUCCEEDED(hr))
IContextMenu_Release(cmenu);
IShellFolder_Release(folder);
hr = CoCreateInstance(&CLSID_NetworkPlaces, NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder, (void**)&folder);
ok(SUCCEEDED(hr), "got 0x%08x\n", hr);
hr = IShellFolder_CreateViewObject(folder, NULL, &IID_IContextMenu, (void**)&cmenu);
ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
if (SUCCEEDED(hr))
IContextMenu_Release(cmenu);
IShellFolder_Release(folder);
hr = CoCreateInstance(&CLSID_Printers, NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder, (void**)&folder);
ok(SUCCEEDED(hr), "got 0x%08x\n", hr);
hr = IShellFolder_CreateViewObject(folder, NULL, &IID_IContextMenu, (void**)&cmenu);
ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
if (SUCCEEDED(hr))
IContextMenu_Release(cmenu);
IShellFolder_Release(folder);
hr = CoCreateInstance(&CLSID_RecycleBin, NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder, (void**)&folder);
ok(SUCCEEDED(hr), "got 0x%08x\n", hr);
hr = IShellFolder_CreateViewObject(folder, NULL, &IID_IContextMenu, (void**)&cmenu);
ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
if (SUCCEEDED(hr))
IContextMenu_Release(cmenu);
IShellFolder_Release(folder);
hr = SHGetDesktopFolder(&desktop);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IContextMenu, (void**)&cmenu);
ok(hr == S_OK, "got 0x%08x\n", hr);
if (SUCCEEDED(hr))
IContextMenu_Release(cmenu);
ret = GetCurrentDirectoryW(MAX_PATH, path);
ok(ret, "got %d\n", GetLastError());
hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, path, NULL, &pidl, 0);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IShellFolder_BindToObject(desktop, pidl, NULL, &IID_IShellFolder, (void**)&folder);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IShellFolder_CreateViewObject(folder, NULL, &IID_IContextMenu, (void**)&cmenu);
ok(hr == S_OK, "got 0x%08x\n", hr);
if (SUCCEEDED(hr))
IContextMenu_Release(cmenu);
IShellFolder_Release(folder);
ILFree(pidl);
IShellFolder_Release(desktop);
}
#define verify_pidl(i,p) r_verify_pidl(__LINE__, i, p)
static void r_verify_pidl(unsigned l, LPCITEMIDLIST pidl, const WCHAR *path)
{
......@@ -5313,6 +5384,7 @@ START_TEST(shlfolder)
test_ShellItemArrayEnumItems();
test_desktop_IPersist();
test_GetUIObject();
test_CreateViewObject_contextmenu();
test_SHSimpleIDListFromPath();
test_ParseDisplayNamePBC();
test_SHGetNameFromIDList();
......
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