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

commit f271bebb7171bb7d0a7a7a8979cf5b9d201c35a1
Author:     Whindmar Saksit <whinds...@proton.me>
AuthorDate: Wed Oct 16 14:09:33 2024 +0200
Commit:     GitHub <nore...@github.com>
CommitDate: Wed Oct 16 14:09:33 2024 +0200

    [SHELL32] Exclude executable extensions from File Types dialog (#7452)
    
    PathIsExeW is used and will exclude exe, com, pif, cmd, bat, scf and scr. 
The previous #6122 PR added support for the FTA_Exclude flag and that will 
exclude .lnk files.
    
    CORE-19805
---
 dll/win32/shell32/dialogs/filetypes.cpp | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/dll/win32/shell32/dialogs/filetypes.cpp 
b/dll/win32/shell32/dialogs/filetypes.cpp
index 33a7a1376bc..c02de0eee10 100644
--- a/dll/win32/shell32/dialogs/filetypes.cpp
+++ b/dll/win32/shell32/dialogs/filetypes.cpp
@@ -28,6 +28,8 @@ WINE_DEFAULT_DEBUG_CHANNEL (fprop);
 
 /////////////////////////////////////////////////////////////////////////////
 
+EXTERN_C BOOL PathIsExeW(LPCWSTR lpszPath);
+
 #define FTA_MODIFYMASK (FTA_OpenIsSafe) // Bits modified by EditTypeDlg
 #define NOASSOCRESID IDI_SHELL_DOCUMENT
 #define SUPPORT_EXTENSIONWITHOUTPROGID 1 // NT5 does not support these but NT6 
does
@@ -741,6 +743,14 @@ FileTypesDlg_InsertToLV(HWND hListView, LPCWSTR Assoc, INT 
iItem, PFILE_TYPE_GLO
 
     if (Assoc[0] == L'.')
     {
+        if (PathIsExeW(Assoc))
+        {
+exclude:
+            HeapFree(pG->hHeap, 0, Entry);
+            RegCloseKey(hKey);
+            return NULL;
+        }
+
         dwSize = sizeof(Entry->ClassKey);
         if (RegQueryValueExW(hKey, NULL, NULL, NULL, LPBYTE(Entry->ClassKey), 
&dwSize))
         {
@@ -754,21 +764,13 @@ FileTypesDlg_InsertToLV(HWND hListView, LPCWSTR Assoc, 
INT iItem, PFILE_TYPE_GLO
         }
 #else
         if (!Entry->ClassKey[0])
-        {
-            HeapFree(pG->hHeap, 0, Entry);
-            RegCloseKey(hKey);
-            return NULL;
-        }
+            goto exclude;
 #endif
     }
 
     Entry->EditFlags = GetRegDWORD(hKey, L"EditFlags", 0);
     if (Entry->EditFlags & FTA_Exclude)
-    {
-        HeapFree(pG->hHeap, 0, Entry);
-        RegCloseKey(hKey);
-        return NULL;
-    }
+        goto exclude;
 
     wcscpy(Entry->FileExtension, Assoc);
 

Reply via email to