More robust code for querying ShellFolder attributes (some

ShellFolders ignore the flag mask in GetAttributesOf).
This commit is contained in:
Michael Jung 2005-11-07 20:11:27 +00:00 committed by Alexandre Julliard
parent 6c0fc4205c
commit 14d9eec51a
1 changed files with 5 additions and 2 deletions

View File

@ -388,7 +388,7 @@ static void BrsFolder_CheckValidSelection( browse_info *info, LPTV_ITEMDATA lptv
dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1,
(LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes);
if (FAILED(r) || !dwAttributes)
if (FAILED(r) || !(dwAttributes & (SFGAO_FILESYSANCESTOR|SFGAO_FILESYSTEM)))
bEnabled = FALSE;
}
if (lpBrowseInfo->ulFlags & BIF_RETURNONLYFSDIRS)
@ -396,8 +396,11 @@ static void BrsFolder_CheckValidSelection( browse_info *info, LPTV_ITEMDATA lptv
dwAttributes = SFGAO_FOLDER | SFGAO_FILESYSTEM;
r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1,
(LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes);
if (FAILED(r) || (dwAttributes != (SFGAO_FOLDER | SFGAO_FILESYSTEM)))
if (FAILED(r) ||
((dwAttributes & (SFGAO_FOLDER|SFGAO_FILESYSTEM)) != (SFGAO_FOLDER|SFGAO_FILESYSTEM)))
{
bEnabled = FALSE;
}
}
SendMessageW(info->hWnd, BFFM_ENABLEOK, 0, (LPARAM)bEnabled);
}