shell32: Cosmetic changes to file type names.

Signed-off-by: Lauri Kenttä <lauri.kentta@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Lauri Kenttä 2016-11-29 20:23:59 +02:00 committed by Alexandre Julliard
parent 590c908088
commit 1c3d6ab9cc
2 changed files with 26 additions and 10 deletions

View File

@ -2408,15 +2408,18 @@ void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
{ {
char sTemp[64]; char sTemp[64];
if(uOutSize > 0) /* "name" or "name." or any unhandled => "File" */
pOut[0] = 0; lstrcpynA (pOut, "File", uOutSize);
if (_ILGetExtension (pidl, sTemp, 64))
/* 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) 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); lstrcpynA (pOut, sTemp, uOutSize - 6);
strcat (pOut, "-file"); strcat (pOut, " file");
} }
} }
} }

View File

@ -537,8 +537,9 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
/* get the type name */ /* get the type name */
if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME)) 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 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)) if (!(flags & SHGFI_USEFILEATTRIBUTES) || (flags & SHGFI_PIDL))
{ {
@ -550,17 +551,29 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
else else
{ {
if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
strcatW (psfi->szTypeName, szFile); strcatW (psfi->szTypeName, szFolder);
else else
{ {
WCHAR sTemp[64]; WCHAR sTemp[64];
lstrcpyW(sTemp,PathFindExtensionW(szFullPath)); 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 ))) HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE )))
{ {
lstrcpynW (psfi->szTypeName, sTemp, 64); if (sTemp[0])
strcatW (psfi->szTypeName, szDashFile); {
lstrcpynW (psfi->szTypeName, sTemp, 64);
strcatW (psfi->szTypeName, szSpaceFile);
}
else
{
lstrcpynW (psfi->szTypeName, szFile, 64);
}
} }
} }
} }