From 236c8a2452ae610707da23ce92d9d76643677336 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Mon, 19 Jan 2004 23:54:55 +0000 Subject: [PATCH] - move IShellFolder_fnGetDisplayNameOf() contents into a new function SHELL_FS_ProcessDisplayFilename() to call it also in ISF_Desktop_fnGetDisplayNameOf() and do the same file system processing for the desktop level - handle hidden file extensions in SHELL_FS_ProcessDisplayFilename(), that are configured by "NeverShowExt" in the registry --- dlls/shell32/shfldr.h | 2 ++ dlls/shell32/shfldr_desktop.c | 3 ++ dlls/shell32/shfldr_fs.c | 64 ++++++++++++++++++++++++----------- 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/dlls/shell32/shfldr.h b/dlls/shell32/shfldr.h index e2121bd0fa1..d73bb5d23ab 100644 --- a/dlls/shell32/shfldr.h +++ b/dlls/shell32/shfldr.h @@ -54,3 +54,5 @@ static inline void SHELL32_GUIDToStringA (REFGUID guid, LPSTR str) guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]); } + +void SHELL_FS_ProcessDisplayFilename(LPSTR szPath, DWORD dwFlags); diff --git a/dlls/shell32/shfldr_desktop.c b/dlls/shell32/shfldr_desktop.c index 868907ccaf9..bf70f19e288 100644 --- a/dlls/shell32/shfldr_desktop.c +++ b/dlls/shell32/shfldr_desktop.c @@ -510,6 +510,9 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface, } else { /* file system folder */ _ILSimpleGetText (pidl, szPath, MAX_PATH); + + if (!_ILIsFolder(pidl)) + SHELL_FS_ProcessDisplayFilename(szPath, dwFlags); } } else { /* a complex pidl, let the subfolder do the work */ diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c index bba68086983..00d3162e98e 100644 --- a/dlls/shell32/shfldr_fs.c +++ b/dlls/shell32/shfldr_fs.c @@ -587,6 +587,48 @@ IShellFolder_fnGetUIObjectOf (IShellFolder2 * iface, return hr; } +void SHELL_FS_ProcessDisplayFilename(LPSTR szPath, DWORD dwFlags) +{ + /*FIXME: MSDN also mentions SHGDN_FOREDITING which is not yet handled. */ + if (!(dwFlags & SHGDN_FORPARSING) && + ((dwFlags & SHGDN_INFOLDER) || (dwFlags == SHGDN_NORMAL))) { + HKEY hKey; + DWORD dwData; + DWORD dwDataSize = sizeof (DWORD); + BOOL doHide = FALSE; /* The default value is FALSE (win98 at least) */ + + if (!RegCreateKeyExA (HKEY_CURRENT_USER, + "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", + 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) { + if (!RegQueryValueExA (hKey, "HideFileExt", 0, 0, (LPBYTE) & dwData, &dwDataSize)) + doHide = dwData; + + RegCloseKey (hKey); + } + + if (!doHide) { + LPSTR ext = PathFindExtensionA(szPath); + + if (ext) { + HKEY hkey; + char classname[MAX_PATH]; + LONG classlen = MAX_PATH; + + if (!RegQueryValueA(HKEY_CLASSES_ROOT, ext, classname, &classlen)) + if (!RegOpenKeyA(HKEY_CLASSES_ROOT, classname, &hkey)) { + if (!RegQueryValueExA(hkey, "NeverShowExt", 0, NULL, NULL, NULL)) + doHide = TRUE; + + RegCloseKey(hkey); + } + } + } + + if (doHide && szPath[0] != '.') + PathRemoveExtensionA (szPath); + } +} + /************************************************************************** * IShellFolder_fnGetDisplayNameOf * Retrieves the display name for the specified file object or subfolder @@ -632,26 +674,8 @@ IShellFolder_fnGetDisplayNameOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, DWOR } _ILSimpleGetText (pidl, szPath + len, MAX_PATH - len); /* append my own path */ - /* MSDN also mentions SHGDN_FOREDITING, which isn't defined in wine */ - if (!_ILIsFolder (pidl) && !(dwFlags & SHGDN_FORPARSING) && - ((dwFlags & SHGDN_INFOLDER) || (dwFlags == SHGDN_NORMAL))) { - HKEY hKey; - DWORD dwData; - DWORD dwDataSize = sizeof (DWORD); - BOOL doHide = 0; /* The default value is FALSE (win98 at least) */ - - /* XXX should it do this only for known file types? -- that would make it even slower! */ - /* XXX That's what the prompt says!! */ - if (!RegCreateKeyExA (HKEY_CURRENT_USER, - "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", - 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) { - if (!RegQueryValueExA (hKey, "HideFileExt", 0, 0, (LPBYTE) & dwData, &dwDataSize)) - doHide = dwData; - RegCloseKey (hKey); - } - if (doHide && szPath[0] != '.') - PathRemoveExtensionA (szPath); - } + if (!_ILIsFolder(pidl)) + SHELL_FS_ProcessDisplayFilename(szPath, dwFlags); } if ((dwFlags & SHGDN_FORPARSING) && !bSimplePidl) { /* go deeper if needed */