Skip to content

Commit 325d74c

Browse files
authored
[SHELL32] Don't display .zip files in BrowseForFolder (reactos#7437)
.zip files have both SFGAO_STREAM and SFGAO_FOLDER attributes set (https://devblogs.microsoft.com/oldnewthing/20171101-00/?p=97325) CORE-19751
1 parent abf3bde commit 325d74c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

dll/win32/shell32/brfolder.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,15 @@ BrFolder_InsertItem(
343343
_In_ PCIDLIST_ABSOLUTE pidlParent,
344344
_In_ HTREEITEM hParent)
345345
{
346+
if (!(BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags) & SHCONTF_NONFOLDERS))
347+
{
348+
#ifdef BIF_BROWSEFILEJUNCTIONS
349+
if (!(info->lpBrowseInfo->ulFlags & BIF_BROWSEFILEJUNCTIONS))
350+
#endif
351+
if (SHGetAttributes(lpsf, pidlChild, SFGAO_STREAM) & SFGAO_STREAM)
352+
return NULL; // .zip files have both FOLDER and STREAM attributes set
353+
}
354+
346355
WCHAR szName[MAX_PATH];
347356
if (!BrFolder_GetName(lpsf, pidlChild, SHGDN_NORMAL, szName))
348357
return NULL;

dll/win32/shell32/folders/CFSFolder.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ HRESULT SHELL32_GetFSItemAttributes(IShellFolder * psf, LPCITEMIDLIST pidl, LPDW
624624
WCHAR szFileName[MAX_PATH];
625625
LPWSTR pExtension;
626626
BOOL hasName = _ILSimpleGetTextW(pidl, szFileName, _countof(szFileName));
627+
dwShellAttributes |= SFGAO_STREAM;
627628

628629
// Vista+ feature: Hidden files with a leading tilde treated as super-hidden
629630
// See https://devblogs.microsoft.com/oldnewthing/20170526-00/?p=96235
@@ -672,10 +673,6 @@ HRESULT SHELL32_GetFSItemAttributes(IShellFolder * psf, LPCITEMIDLIST pidl, LPDW
672673
dwShellAttributes |= (SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR);
673674
}
674675
}
675-
else
676-
{
677-
dwShellAttributes |= SFGAO_STREAM;
678-
}
679676

680677
if (dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
681678
dwShellAttributes |= SFGAO_HIDDEN | SFGAO_GHOSTED;

0 commit comments

Comments
 (0)