Alexandre Julliard : shell32: Fix the shell folder file attributes.

Alexandre Julliard julliard at winehq.org
Tue Sep 14 16:00:12 CDT 2021


Module: wine
Branch: master
Commit: 0ecd807ea62d1854a2abc97d1718c616a3ffa3fe
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0ecd807ea62d1854a2abc97d1718c616a3ffa3fe

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Sep 14 12:38:52 2021 +0200

shell32: Fix the shell folder file attributes.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shell32/shlfolder.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c
index e663d9486d9..f288b7f7ab1 100644
--- a/dlls/shell32/shlfolder.c
+++ b/dlls/shell32/shlfolder.c
@@ -427,9 +427,9 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder2 *psf, LPCITEMIDLIST pidl, LPDWO
     } else if (has_guid && HCR_GetFolderAttributes(pidl, &dwAttributes)) {
 	*pdwAttributes = dwAttributes;
     } else if (_ILGetDataPointer (pidl)) {
-	dwAttributes = _ILGetFileAttributes (pidl, NULL, 0);
+	DWORD file_attr = _ILGetFileAttributes (pidl, NULL, 0);
 
-        if (!dwAttributes && has_guid) {
+        if (!file_attr && has_guid) {
 	    WCHAR path[MAX_PATH];
 	    STRRET strret;
 
@@ -441,25 +441,28 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder2 *psf, LPCITEMIDLIST pidl, LPDWO
 
 		/* call GetFileAttributes() only for file system paths, not for parsing names like "::{...}" */
 		if (SUCCEEDED(hr) && path[0]!=':')
-		    dwAttributes = GetFileAttributesW(path);
+		    file_attr = GetFileAttributesW(path);
 	    }
 	}
 
         /* Set common attributes */
-        *pdwAttributes |= SFGAO_FILESYSTEM | SFGAO_DROPTARGET | SFGAO_HASPROPSHEET | SFGAO_CANDELETE | 
+        *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);
+	if (file_attr & FILE_ATTRIBUTE_DIRECTORY)
+	    *pdwAttributes |=  (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR | SFGAO_STORAGE);
 	else
-	    *pdwAttributes &= ~(SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR);
+        {
+	    *pdwAttributes &= ~(SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR | SFGAO_STORAGE);
+	    *pdwAttributes |= SFGAO_STREAM;
+        }
 
-	if (dwAttributes & FILE_ATTRIBUTE_HIDDEN)
+	if (file_attr & FILE_ATTRIBUTE_HIDDEN)
 	    *pdwAttributes |=  SFGAO_HIDDEN;
 	else
 	    *pdwAttributes &= ~SFGAO_HIDDEN;
 
-	if (dwAttributes & FILE_ATTRIBUTE_READONLY)
+	if (file_attr & FILE_ATTRIBUTE_READONLY)
 	    *pdwAttributes |=  SFGAO_READONLY;
 	else
 	    *pdwAttributes &= ~SFGAO_READONLY;




More information about the wine-cvs mailing list