=?UTF-8?Q?Lauri=20Kentt=C3=A4=20?=: shell32: Cosmetic changes to file type names.

Alexandre Julliard julliard at winehq.org
Tue Nov 29 16:01:39 CST 2016


Module: wine
Branch: master
Commit: 1c3d6ab9ccc6a572f48c63ac220c0a89dd5b450d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1c3d6ab9ccc6a572f48c63ac220c0a89dd5b450d

Author: Lauri Kenttä <lauri.kentta at gmail.com>
Date:   Tue Nov 29 20:23:59 2016 +0200

shell32: Cosmetic changes to file type names.

Signed-off-by: Lauri Kenttä <lauri.kentta at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shell32/pidl.c         | 13 ++++++++-----
 dlls/shell32/shell32_main.c | 23 ++++++++++++++++++-----
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c
index 1856c12..c3a753a 100644
--- a/dlls/shell32/pidl.c
+++ b/dlls/shell32/pidl.c
@@ -2408,15 +2408,18 @@ void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
     {
         char sTemp[64];
 
-        if(uOutSize > 0)
-            pOut[0] = 0;
-        if (_ILGetExtension (pidl, sTemp, 64))
+        /* "name" or "name." or any unhandled => "File" */
+        lstrcpynA (pOut, "File", uOutSize);
+
+        /* If there's space for more, try to get a better description. */
+        if (uOutSize > 6 && _ILGetExtension (pidl, sTemp, 64))
         {
             if (!( HCR_MapTypeToValueA(sTemp, sTemp, 64, TRUE)
-                && HCR_MapTypeToValueA(sTemp, pOut, uOutSize, FALSE )))
+                && HCR_MapTypeToValueA(sTemp, pOut, uOutSize, FALSE ))
+                && sTemp[0])
             {
                 lstrcpynA (pOut, sTemp, uOutSize - 6);
-                strcat (pOut, "-file");
+                strcat (pOut, " file");
             }
         }
     }
diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c
index dce1896..7e1c7d5 100644
--- a/dlls/shell32/shell32_main.c
+++ b/dlls/shell32/shell32_main.c
@@ -537,8 +537,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))
         {
@@ -550,17 +551,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);
+                    }
                 }
             }
         }




More information about the wine-cvs mailing list