This commit is contained in:
Katayama Hirofumi MZ 2024-05-15 15:11:23 +09:00
parent d10f8bd42d
commit 2bb042177e

View file

@ -14,35 +14,31 @@ START_TEST(SHSimpleIDListFromPath)
WCHAR szPath[MAX_PATH];
GetWindowsDirectoryW(szPath, _countof(szPath));
LPITEMIDLIST pidl1 = SHSimpleIDListFromPath(szPath);
LPITEMIDLIST pidl2 = ILCreateFromPathW(szPath);
// We will compare pidl1 and pidl2
CComHeapPtr<ITEMIDLIST> pidl1(SHSimpleIDListFromPath(szPath));
CComHeapPtr<ITEMIDLIST> pidl2(ILCreateFromPathW(szPath));
LPITEMIDLIST pidl1Last = ILFindLastID(pidl1);
LPITEMIDLIST pidl2Last = ILFindLastID(pidl2);
ok_int(ILIsEqual(pidl1, pidl2), TRUE);
ok_int(ILIsEqual(pidl1Last, pidl2Last), TRUE);
IShellFolder *psf1 = NULL;
IShellFolder *psf2 = NULL;
CComPtr<IShellFolder> psf1, psf2;
hr = SHBindToParent(pidl1, IID_PPV_ARG(IShellFolder, &psf1), NULL);
ok_long(hr, S_OK);
hr = SHBindToParent(pidl2, IID_PPV_ARG(IShellFolder, &psf2), NULL);
ok_long(hr, S_OK);
DWORD attrs1 = SFGAO_FOLDER;
DWORD attrs2 = SFGAO_FOLDER;
DWORD attrs1 = SFGAO_FOLDER, attrs2 = SFGAO_FOLDER;
hr = (psf1 ? psf1->GetAttributesOf(1, &pidl1Last, &attrs1) : E_UNEXPECTED);
ok_long(hr, S_OK);
hr = (psf2 ? psf2->GetAttributesOf(1, &pidl2Last, &attrs2) : E_UNEXPECTED);
ok_long(hr, S_OK);
// This fact is important:
ok_long((attrs1 & SFGAO_FOLDER), 0);
ok_long((attrs2 & SFGAO_FOLDER), SFGAO_FOLDER);
ILFree(pidl1);
ILFree(pidl2);
if (psf1)
psf1->Release();
if (psf2)
psf2->Release();
}