shell32: Handle parent folders in SHCreateShellItem.

This commit is contained in:
Vincent Povirk 2009-05-21 13:13:11 -05:00 committed by Alexandre Julliard
parent 1d57a31d92
commit 5b95a43d5e
2 changed files with 32 additions and 7 deletions

View File

@ -280,16 +280,41 @@ HRESULT WINAPI SHCreateShellItem(LPCITEMIDLIST pidlParent,
{
return E_INVALIDARG;
}
else if (!pidlParent && !psfParent)
else if (pidlParent || psfParent)
{
new_pidl = ILClone(pidl);
LPITEMIDLIST temp_parent=NULL;
if (!pidlParent)
{
IPersistFolder2* ppf2Parent;
if (!SUCCEEDED(IPersistFolder2_QueryInterface(psfParent, &IID_IPersistFolder2, (void**)&ppf2Parent)))
{
FIXME("couldn't get IPersistFolder2 interface of parent\n");
return E_NOINTERFACE;
}
if (!SUCCEEDED(IPersistFolder2_GetCurFolder(ppf2Parent, &temp_parent)))
{
FIXME("couldn't get parent PIDL\n");
IPersistFolder2_Release(ppf2Parent);
return E_NOINTERFACE;
}
pidlParent = temp_parent;
IPersistFolder2_Release(ppf2Parent);
}
new_pidl = ILCombine(pidlParent, pidl);
ILFree(temp_parent);
if (!new_pidl)
return E_OUTOFMEMORY;
}
else
{
FIXME("(%p,%p,%p) not implemented\n", pidlParent, psfParent, pidl);
return E_NOINTERFACE;
new_pidl = ILClone(pidl);
if (!new_pidl)
return E_OUTOFMEMORY;
}
ret = IShellItem_Constructor(NULL, &IID_IShellItem, (void**)&This);

View File

@ -1814,7 +1814,7 @@ static void test_SHCreateShellItem(void)
}
ret = pSHCreateShellItem(pidl_cwd, NULL, pidl_testfile, &shellitem);
todo_wine ok(SUCCEEDED(ret), "SHCreateShellItem returned %x\n", ret);
ok(SUCCEEDED(ret), "SHCreateShellItem returned %x\n", ret);
if (SUCCEEDED(ret))
{
ret = IShellItem_QueryInterface(shellitem, &IID_IPersistIDList, (void**)&persistidl);
@ -1834,7 +1834,7 @@ static void test_SHCreateShellItem(void)
}
ret = pSHCreateShellItem(NULL, currentfolder, pidl_testfile, &shellitem);
todo_wine ok(SUCCEEDED(ret), "SHCreateShellItem returned %x\n", ret);
ok(SUCCEEDED(ret), "SHCreateShellItem returned %x\n", ret);
if (SUCCEEDED(ret))
{
ret = IShellItem_QueryInterface(shellitem, &IID_IPersistIDList, (void**)&persistidl);
@ -1855,7 +1855,7 @@ static void test_SHCreateShellItem(void)
/* if a parent pidl and shellfolder are specified, the shellfolder is ignored */
ret = pSHCreateShellItem(pidl_cwd, desktopfolder, pidl_testfile, &shellitem);
todo_wine ok(SUCCEEDED(ret), "SHCreateShellItem returned %x\n", ret);
ok(SUCCEEDED(ret), "SHCreateShellItem returned %x\n", ret);
if (SUCCEEDED(ret))
{
ret = IShellItem_QueryInterface(shellitem, &IID_IPersistIDList, (void**)&persistidl);