shell32: Support BHID_SFUIObject and BHID_DataObject in IShellItem::BindToHandler.

This commit is contained in:
David Hedberg 2010-08-24 10:56:20 +02:00 committed by Alexandre Julliard
parent b88c3e2ecb
commit 1f73f3a591
2 changed files with 57 additions and 14 deletions

View File

@ -190,6 +190,26 @@ static HRESULT WINAPI ShellItem_BindToHandler(IShellItem *iface, IBindCtx *pbc,
}
return ret;
}
else if (IsEqualGUID(rbhid, &BHID_SFUIObject))
{
IShellFolder *psf_parent;
if (_ILIsDesktop(This->pidl))
ret = SHGetDesktopFolder(&psf_parent);
else
ret = ShellItem_get_parent_shellfolder(This, &psf_parent);
if (SUCCEEDED(ret))
{
LPCITEMIDLIST pidl = ILFindLastID(This->pidl);
ret = IShellFolder_GetUIObjectOf(psf_parent, NULL, 1, &pidl, riid, NULL, ppvOut);
IShellFolder_Release(psf_parent);
}
return ret;
}
else if (IsEqualGUID(rbhid, &BHID_DataObject))
{
return ShellItem_BindToHandler((IShellItem*)This, pbc, &BHID_SFUIObject, &IID_IDataObject, ppvOut);
}
FIXME("Unsupported BHID %s.\n", debugstr_guid(rbhid));

View File

@ -1888,7 +1888,7 @@ static void test_SHCreateShellItem(void)
{
IShellItem *shellitem, *shellitem2;
IPersistIDList *persistidl;
LPITEMIDLIST pidl_cwd=NULL, pidl_testfile, pidl_abstestfile, pidl_test;
LPITEMIDLIST pidl_cwd=NULL, pidl_testfile, pidl_abstestfile, pidl_test, pidl_desktop;
HRESULT ret;
char curdirA[MAX_PATH];
WCHAR curdirW[MAX_PATH];
@ -1910,6 +1910,17 @@ static void test_SHCreateShellItem(void)
return;
}
if(pSHGetSpecialFolderLocation)
{
ret = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
ok(ret == S_OK, "Got 0x%08x\n", ret);
}
else
{
win_skip("pSHGetSpecialFolderLocation missing.\n");
pidl_desktop = NULL;
}
MultiByteToWideChar(CP_ACP, 0, curdirA, -1, curdirW, MAX_PATH);
ret = SHGetDesktopFolder(&desktopfolder);
@ -2058,6 +2069,17 @@ static void test_SHCreateShellItem(void)
}
IPersistIDList_Release(persistidl);
}
IShellItem_Release(shellitem);
}
ret = pSHCreateShellItem(NULL, NULL, pidl_desktop, &shellitem);
ok(SUCCEEDED(ret), "SHCreateShellItem returned %x\n", ret);
if (SUCCEEDED(ret))
{
ret = IShellItem_GetParent(shellitem, &shellitem2);
ok(FAILED(ret), "Got 0x%08x\n", ret);
if(SUCCEEDED(ret)) IShellItem_Release(shellitem2);
IShellItem_Release(shellitem);
}
@ -2161,6 +2183,7 @@ static void test_SHCreateShellItem(void)
DeleteFileA(".\\testfile");
pILFree(pidl_abstestfile);
pILFree(pidl_testfile);
pILFree(pidl_desktop);
pILFree(pidl_cwd);
IShellFolder_Release(currentfolder);
IShellFolder_Release(desktopfolder);
@ -3270,16 +3293,21 @@ static void test_ShellItemBindToHandler(void)
IPersistFolder2_Release(ppf2);
}
/* BHID_SFUIObject */
hr = IShellItem_BindToHandler(psi, NULL, &BHID_SFUIObject, &IID_IDataObject, (void**)&punk);
ok(hr == S_OK || broken(hr == E_NOINTERFACE /* XP */), "Got 0x%08x\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk);
hr = IShellItem_BindToHandler(psi, NULL, &BHID_SFUIObject, &IID_IContextMenu, (void**)&punk);
ok(hr == S_OK || broken(hr == E_NOINTERFACE /* XP */), "Got 0x%08x\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk);
/* BHID_DataObject */
hr = IShellItem_BindToHandler(psi, NULL, &BHID_DataObject, &IID_IDataObject, (void**)&punk);
ok(hr == S_OK || broken(hr == MK_E_NOOBJECT /* XP */), "Got 0x%08x\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk);
todo_wine
{
/* BHID_SFUIObject */
hr = IShellItem_BindToHandler(psi, NULL, &BHID_SFUIObject, &IID_IDataObject, (void**)&punk);
ok(hr == S_OK || broken(hr == E_NOINTERFACE /* XP */), "Got 0x%08x\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk);
hr = IShellItem_BindToHandler(psi, NULL, &BHID_SFUIObject, &IID_IContextMenu, (void**)&punk);
ok(hr == S_OK || broken(hr == E_NOINTERFACE /* XP */), "Got 0x%08x\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk);
/* BHID_SFViewObject */
hr = IShellItem_BindToHandler(psi, NULL, &BHID_SFViewObject, &IID_IShellView, (void**)&punk);
ok(hr == S_OK, "Got 0x%08x\n", hr);
@ -3319,11 +3347,6 @@ static void test_ShellItemBindToHandler(void)
ok(hr == S_OK || broken(hr == MK_E_NOOBJECT /* XP */), "Got 0x%08x\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk);
/* BHID_DataObject */
hr = IShellItem_BindToHandler(psi, NULL, &BHID_DataObject, &IID_IDataObject, (void**)&punk);
ok(hr == S_OK || broken(hr == MK_E_NOOBJECT /* XP */), "Got 0x%08x\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk);
/* BHID_Filter */
hr = IShellItem_BindToHandler(psi, NULL, &BHID_Filter, &IID_IUnknown, (void**)&punk);
ok(hr == S_OK || broken(hr == MK_E_NOOBJECT /* XP */), "Got 0x%08x\n", hr);