From 14d9eec51a16c9f2fd73c5bb16785577a0d9f3f3 Mon Sep 17 00:00:00 2001 From: Michael Jung Date: Mon, 7 Nov 2005 20:11:27 +0000 Subject: [PATCH] More robust code for querying ShellFolder attributes (some ShellFolders ignore the flag mask in GetAttributesOf). --- dlls/shell32/brsfolder.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c index 7be1e3262bb..9bd72610bf0 100644 --- a/dlls/shell32/brsfolder.c +++ b/dlls/shell32/brsfolder.c @@ -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); }