[SHELL32] Partially sync SHGetFileInfo with wine to improve folder type names. 507/head
authorMark Jansen <mark.jansen@reactos.org>
Sat, 21 Apr 2018 11:31:29 +0000 (13:31 +0200)
committerMark Jansen <mark.jansen@reactos.org>
Sun, 22 Apr 2018 15:38:44 +0000 (17:38 +0200)
CORE-14542

dll/win32/shell32/wine/shell32_main.c

index e64ef7f..5b9ca5e 100644 (file)
@@ -553,8 +553,9 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
     /* get the type name */
     if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
     {
+        static const WCHAR szFolder[] = { 'F','o','l','d','e','r',0 };
         static const WCHAR szFile[] = { 'F','i','l','e',0 };
-        static const WCHAR szDashFile[] = { '-','f','i','l','e',0 };
+        static const WCHAR szSpaceFile[] = { ' ','f','i','l','e',0 };
 
         if (!(flags & SHGFI_USEFILEATTRIBUTES) || (flags & SHGFI_PIDL))
         {
@@ -566,17 +567,29 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
         else
         {
             if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
-                strcatW (psfi->szTypeName, szFile);
+                strcatW (psfi->szTypeName, szFolder);
             else 
             {
                 WCHAR sTemp[64];
 
                 lstrcpyW(sTemp,PathFindExtensionW(szFullPath));
-                if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) &&
+                if (sTemp[0] == 0 || (sTemp[0] == '.' && sTemp[1] == 0))
+                {
+                    /* "name" or "name." => "File" */
+                    lstrcpynW (psfi->szTypeName, szFile, 64);
+                }
+                else if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) &&
                     HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE )))
                 {
-                    lstrcpynW (psfi->szTypeName, sTemp, 64);
-                    strcatW (psfi->szTypeName, szDashFile);
+                    if (sTemp[0])
+                    {
+                        lstrcpynW (psfi->szTypeName, sTemp, 64);
+                        strcatW (psfi->szTypeName, szSpaceFile);
+                    }
+                    else
+                    {
+                        lstrcpynW (psfi->szTypeName, szFile, 64);
+                    }
                 }
             }
         }