https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b569195ecfec4ac65185d87a64f3b2c2fad9dad7

commit b569195ecfec4ac65185d87a64f3b2c2fad9dad7
Author:     Mark Jansen <[email protected]>
AuthorDate: Sat Apr 21 13:31:29 2018 +0200
Commit:     Mark Jansen <[email protected]>
CommitDate: Sun Apr 22 17:38:44 2018 +0200

    [SHELL32] Partially sync SHGetFileInfo with wine to improve folder type 
names.
    CORE-14542
---
 dll/win32/shell32/wine/shell32_main.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/dll/win32/shell32/wine/shell32_main.c 
b/dll/win32/shell32/wine/shell32_main.c
index e64ef7f6fb..5b9ca5eae8 100644
--- a/dll/win32/shell32/wine/shell32_main.c
+++ b/dll/win32/shell32/wine/shell32_main.c
@@ -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);
+                    }
                 }
             }
         }

Reply via email to