Shell32 patch 7

Martin Fuchs martin-fuchs at gmx.net
Sat Jan 17 07:33:11 CST 2004


Changelog:
- move from IShellFolder_fnGetDisplayNameOf() into 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


Index: shfldr.h
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shfldr.h,v
retrieving revision 1.4
diff -u -p -d -r1.4 shfldr.h
--- shfldr.h	30 Dec 2003 19:24:22 -0000	1.4
+++ shfldr.h	17 Jan 2004 13:32:10 -0000
@@ -54,3 +54,5 @@ static inline void SHELL32_GUIDToStringA
             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);
Index: shfldr_desktop.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shfldr_desktop.c,v
retrieving revision 1.14
diff -u -p -d -r1.14 shfldr_desktop.c
--- shfldr_desktop.c	30 Dec 2003 19:24:22 -0000	1.14
+++ shfldr_desktop.c	17 Jan 2004 13:32:10 -0000
@@ -510,6 +510,9 @@ static HRESULT WINAPI ISF_Desktop_fnGetD
 	} 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 */
Index: shfldr_fs.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shfldr_fs.c,v
retrieving revision 1.16
diff -u -p -d -r1.16 shfldr_fs.c
--- shfldr_fs.c	17 Sep 2003 04:17:33 -0000	1.16
+++ shfldr_fs.c	17 Jan 2004 13:32:10 -0000
@@ -587,6 +587,48 @@ IShellFolder_fnGetUIObjectOf (IShellFold
     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 (IShellF
 	}
 	_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 */




More information about the wine-patches mailing list