shell32: Avoid recursing SHELL32_GetItemAttributes() calls.

This commit is contained in:
Martin Fuchs 2006-02-20 11:50:56 +01:00 committed by Alexandre Julliard
parent 5ed59015b2
commit 8167c415ab
1 changed files with 12 additions and 3 deletions

View File

@ -425,11 +425,20 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWO
if (!dwAttributes && has_guid) { if (!dwAttributes && has_guid) {
WCHAR path[MAX_PATH]; WCHAR path[MAX_PATH];
STRRET strret;
/* File attributes are not present in the internal PIDL structure, so get them from the file system. */ /* File attributes are not present in the internal PIDL structure, so get them from the file system. */
if (SHGetPathFromIDListW(pidl, path))
dwAttributes = GetFileAttributesW(path); HRESULT hr = IShellFolder_GetDisplayNameOf(psf, pidl, SHGDN_FORPARSING, &strret);
}
if (SUCCEEDED(hr)) {
hr = StrRetToBufW(&strret, pidl, path, MAX_PATH);
/* call GetFileAttributes() only for file system paths, not for parsing names like "::{...}" */
if (SUCCEEDED(hr) && path[0]!=':')
dwAttributes = GetFileAttributesW(path);
}
}
/* Set common attributes */ /* Set common attributes */
*pdwAttributes |= SFGAO_FILESYSTEM | SFGAO_DROPTARGET | SFGAO_HASPROPSHEET | SFGAO_CANDELETE | *pdwAttributes |= SFGAO_FILESYSTEM | SFGAO_DROPTARGET | SFGAO_HASPROPSHEET | SFGAO_CANDELETE |