shell32: Implement IID_IContextMenu in CreateViewObject() methods for shell folders that support it.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=39841
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit ad412b11a7)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
Damjan Jovanovic 2021-05-03 03:12:07 +02:00 committed by Michael Stefaniuc
parent 5703c14110
commit 26c1f7c83b
9 changed files with 91 additions and 15 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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))
{

View File

@ -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) {

View File

@ -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))
{

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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();