From e86e14d9db9067fa0312470ac1c8363171e57837 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 15 Aug 2015 21:09:22 +0200
Subject: shell32: Set SFGAO_HASSUBFOLDER correctly for unixfs.

---
 dlls/shell32/shfldr_unixfs.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/dlls/shell32/shfldr_unixfs.c b/dlls/shell32/shfldr_unixfs.c
index be1ba81..481ee06 100644
--- a/dlls/shell32/shfldr_unixfs.c
+++ b/dlls/shell32/shfldr_unixfs.c
@@ -1143,8 +1143,10 @@ static HRESULT WINAPI ShellFolder2_GetAttributesOf(IShellFolder2* iface, UINT ci
             SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSTEM;
         lstrcpyA(szAbsolutePath, This->m_pszPath);
         pszRelativePath = szAbsolutePath + lstrlenA(szAbsolutePath);
-        for (i=0; i<cidl; i++) {
-            if (!(This->m_dwAttributes & SFGAO_FILESYSTEM)) {
+        for (i=0; i<cidl; i++)
+        {
+            if (!(This->m_dwAttributes & SFGAO_FILESYSTEM))
+            {
                 WCHAR *dos_name;
                 if (!UNIXFS_filename_from_shitemid(apidl[i], pszRelativePath)) 
                     return E_INVALIDARG;
@@ -1154,8 +1156,23 @@ static HRESULT WINAPI ShellFolder2_GetAttributesOf(IShellFolder2* iface, UINT ci
                     HeapFree( GetProcessHeap(), 0, dos_name );
             }
             if (_ILIsFolder(apidl[i])) 
-                *attrs |= SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR |
-                    SFGAO_STORAGEANCESTOR | SFGAO_STORAGE;
+            {
+                IEnumIDList *enum_list;
+                IShellFolder2 *child;
+
+                *attrs |= SFGAO_FOLDER | SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR | SFGAO_STORAGE;
+
+                if (SUCCEEDED(IShellFolder2_BindToObject(iface, apidl[i], NULL, &IID_IShellFolder2, (void **)&child)))
+                {
+                    if (IShellFolder2_EnumObjects(child, NULL, SHCONTF_FOLDERS|SHCONTF_INCLUDEHIDDEN, &enum_list) == S_OK)
+                    {
+                        if (IEnumIDList_Skip(enum_list, 1) == S_OK)
+                            *attrs |= SFGAO_HASSUBFOLDER;
+                        IEnumIDList_Release(enum_list);
+                    }
+                    IShellFolder2_Release(child);
+                }
+            }
             else
                 *attrs |= SFGAO_STREAM;
         }
-- 
2.7.0

