[SHELL32] Don't display .zip files in BrowseForFolder (#7437)

.zip files have both SFGAO_STREAM and SFGAO_FOLDER attributes set (https://devblogs.microsoft.com/oldnewthing/20171101-00/?p=97325)

CORE-19751
This commit is contained in:
Whindmar Saksit 2024-10-11 23:57:28 +02:00 committed by GitHub
parent abf3bde91b
commit 325d74c30f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View file

@ -343,6 +343,15 @@ BrFolder_InsertItem(
_In_ PCIDLIST_ABSOLUTE pidlParent, _In_ PCIDLIST_ABSOLUTE pidlParent,
_In_ HTREEITEM hParent) _In_ HTREEITEM hParent)
{ {
if (!(BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags) & SHCONTF_NONFOLDERS))
{
#ifdef BIF_BROWSEFILEJUNCTIONS
if (!(info->lpBrowseInfo->ulFlags & BIF_BROWSEFILEJUNCTIONS))
#endif
if (SHGetAttributes(lpsf, pidlChild, SFGAO_STREAM) & SFGAO_STREAM)
return NULL; // .zip files have both FOLDER and STREAM attributes set
}
WCHAR szName[MAX_PATH]; WCHAR szName[MAX_PATH];
if (!BrFolder_GetName(lpsf, pidlChild, SHGDN_NORMAL, szName)) if (!BrFolder_GetName(lpsf, pidlChild, SHGDN_NORMAL, szName))
return NULL; return NULL;

View file

@ -624,6 +624,7 @@ HRESULT SHELL32_GetFSItemAttributes(IShellFolder * psf, LPCITEMIDLIST pidl, LPDW
WCHAR szFileName[MAX_PATH]; WCHAR szFileName[MAX_PATH];
LPWSTR pExtension; LPWSTR pExtension;
BOOL hasName = _ILSimpleGetTextW(pidl, szFileName, _countof(szFileName)); BOOL hasName = _ILSimpleGetTextW(pidl, szFileName, _countof(szFileName));
dwShellAttributes |= SFGAO_STREAM;
// Vista+ feature: Hidden files with a leading tilde treated as super-hidden // Vista+ feature: Hidden files with a leading tilde treated as super-hidden
// See https://devblogs.microsoft.com/oldnewthing/20170526-00/?p=96235 // See https://devblogs.microsoft.com/oldnewthing/20170526-00/?p=96235
@ -672,10 +673,6 @@ HRESULT SHELL32_GetFSItemAttributes(IShellFolder * psf, LPCITEMIDLIST pidl, LPDW
dwShellAttributes |= (SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR); dwShellAttributes |= (SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR);
} }
} }
else
{
dwShellAttributes |= SFGAO_STREAM;
}
if (dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) if (dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
dwShellAttributes |= SFGAO_HIDDEN | SFGAO_GHOSTED; dwShellAttributes |= SFGAO_HIDDEN | SFGAO_GHOSTED;