Author: gadamopoulos
Date: Fri Aug 28 15:08:19 2015
New Revision: 68849
URL:
http://svn.reactos.org/svn/reactos?rev=68849&view=rev
Log:
[SHELL32]
- Only return the flags that the caller asked for in SHELL32_GetFSItemAttributes. Allows
us to get rid of a hell lot of calls to CFSFolder::BindToChild which lead to many calls to
FindFirstFile.
Modified:
trunk/reactos/dll/win32/shell32/shlfolder.cpp
Modified: trunk/reactos/dll/win32/shell32/shlfolder.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlfolde…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shlfolder.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shlfolder.cpp [iso-8859-1] Fri Aug 28 15:08:19 2015
@@ -521,7 +521,7 @@
HRESULT SHELL32_GetFSItemAttributes(IShellFolder * psf, LPCITEMIDLIST pidl, LPDWORD
pdwAttributes)
{
- DWORD dwAttributes;
+ DWORD dwFileAttributes, dwShellAttributes;
if (!_ILIsFolder(pidl) && !_ILIsValue(pidl))
{
@@ -536,35 +536,36 @@
*pdwAttributes &= dwSupportedAttr;
}
- dwAttributes = _ILGetFileAttributes(pidl, NULL, 0);
+ dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0);
/* Set common attributes */
- *pdwAttributes |= SFGAO_FILESYSTEM | SFGAO_DROPTARGET | SFGAO_HASPROPSHEET |
SFGAO_CANDELETE |
- SFGAO_CANRENAME | SFGAO_CANLINK | SFGAO_CANMOVE | SFGAO_CANCOPY;
-
- if (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)
- {
- *pdwAttributes |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR);
- }
- else
- *pdwAttributes &= ~(SFGAO_FOLDER | SFGAO_HASSUBFOLDER |
SFGAO_FILESYSANCESTOR);
-
- if (dwAttributes & FILE_ATTRIBUTE_HIDDEN)
- *pdwAttributes |= SFGAO_HIDDEN;
- else
- *pdwAttributes &= ~SFGAO_HIDDEN;
-
- if (dwAttributes & FILE_ATTRIBUTE_READONLY)
- *pdwAttributes |= SFGAO_READONLY;
- else
- *pdwAttributes &= ~SFGAO_READONLY;
+ dwShellAttributes = *pdwAttributes;
+ dwShellAttributes |= SFGAO_FILESYSTEM | SFGAO_DROPTARGET | SFGAO_HASPROPSHEET |
SFGAO_CANDELETE |
+ SFGAO_CANRENAME | SFGAO_CANLINK | SFGAO_CANMOVE |
SFGAO_CANCOPY;
+
+ if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ {
+ dwShellAttributes |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER |
SFGAO_FILESYSANCESTOR);
+ }
+ else
+ dwShellAttributes &= ~(SFGAO_FOLDER | SFGAO_HASSUBFOLDER |
SFGAO_FILESYSANCESTOR);
+
+ if (dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
+ dwShellAttributes |= SFGAO_HIDDEN;
+ else
+ dwShellAttributes &= ~SFGAO_HIDDEN;
+
+ if (dwFileAttributes & FILE_ATTRIBUTE_READONLY)
+ dwShellAttributes |= SFGAO_READONLY;
+ else
+ dwShellAttributes &= ~SFGAO_READONLY;
if (SFGAO_LINK & *pdwAttributes)
{
char ext[MAX_PATH];
if (!_ILGetExtension(pidl, ext, MAX_PATH) || lstrcmpiA(ext, "lnk"))
- *pdwAttributes &= ~SFGAO_LINK;
+ dwShellAttributes &= ~SFGAO_LINK;
}
if (SFGAO_HASSUBFOLDER & *pdwAttributes)
@@ -576,10 +577,12 @@
if (SUCCEEDED(psf2->EnumObjects(0, SHCONTF_FOLDERS, &pEnumIL)))
{
if (pEnumIL->Skip(1) != S_OK)
- *pdwAttributes &= ~SFGAO_HASSUBFOLDER;
+ dwShellAttributes &= ~SFGAO_HASSUBFOLDER;
}
}
}
+
+ *pdwAttributes &= dwShellAttributes;
TRACE ("-- 0x%08x\n", *pdwAttributes);
return S_OK;