shell32: IShellItem::GetAttributes should also work on the desktop shellfolder.

This commit is contained in:
David Hedberg 2010-12-19 23:15:12 +01:00 committed by Alexandre Julliard
parent 7b67d4f5c6
commit 0d87e1f9fd
2 changed files with 48 additions and 1 deletions

View File

@ -259,7 +259,10 @@ static HRESULT WINAPI ShellItem_GetAttributes(IShellItem *iface, SFGAOF sfgaoMas
TRACE("(%p,%x,%p)\n", iface, sfgaoMask, psfgaoAttribs);
ret = ShellItem_get_parent_shellfolder(This, &parent_folder);
if (_ILIsDesktop(This->pidl))
ret = SHGetDesktopFolder(&parent_folder);
else
ret = ShellItem_get_parent_shellfolder(This, &parent_folder);
if (SUCCEEDED(ret))
{
child_pidl = ILFindLastID(This->pidl);

View File

@ -3670,6 +3670,49 @@ static void test_ShellItemBindToHandler(void)
pILFree(pidl_desktop);
}
void test_ShellItemGetAttributes(void)
{
IShellItem *psi;
LPITEMIDLIST pidl_desktop;
SFGAOF sfgao;
HRESULT hr;
if(!pSHCreateShellItem)
{
skip("SHCreateShellItem missing.\n");
return;
}
hr = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
ok(hr == S_OK, "Got 0x%08x\n", hr);
if(SUCCEEDED(hr))
{
hr = pSHCreateShellItem(NULL, NULL, pidl_desktop, &psi);
ok(hr == S_OK, "Got 0x%08x\n", hr);
pILFree(pidl_desktop);
}
if(FAILED(hr))
{
skip("Skipping tests.");
return;
}
if(0)
{
/* Crashes on native (Win 7) */
hr = IShellItem_GetAttributes(psi, 0, NULL);
ok(hr == S_OK, "Got 0x%08x\n", hr);
}
/* Test GetAttributes on the desktop folder. */
sfgao = 0xdeadbeef;
hr = IShellItem_GetAttributes(psi, SFGAO_FOLDER, &sfgao);
ok(hr == S_OK || broken(hr == E_FAIL) /* <Vista */, "Got 0x%08x\n", hr);
ok(sfgao == SFGAO_FOLDER || broken(sfgao == 0) /* <Vista */, "Got 0x%08x\n", sfgao);
IShellItem_Release(psi);
}
static void test_SHParseDisplayName(void)
{
LPITEMIDLIST pidl1, pidl2;
@ -4432,6 +4475,7 @@ START_TEST(shlfolder)
test_ShellItemCompare();
test_SHChangeNotify();
test_ShellItemBindToHandler();
test_ShellItemGetAttributes();
OleUninitialize();
}