Skip to content

Commit f271beb

Browse files
authored
[SHELL32] Exclude executable extensions from File Types dialog (reactos#7452)
PathIsExeW is used and will exclude exe, com, pif, cmd, bat, scf and scr. The previous reactos#6122 PR added support for the FTA_Exclude flag and that will exclude .lnk files. CORE-19805
1 parent 5443331 commit f271beb

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

dll/win32/shell32/dialogs/filetypes.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ WINE_DEFAULT_DEBUG_CHANNEL (fprop);
2828

2929
/////////////////////////////////////////////////////////////////////////////
3030

31+
EXTERN_C BOOL PathIsExeW(LPCWSTR lpszPath);
32+
3133
#define FTA_MODIFYMASK (FTA_OpenIsSafe) // Bits modified by EditTypeDlg
3234
#define NOASSOCRESID IDI_SHELL_DOCUMENT
3335
#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
741743

742744
if (Assoc[0] == L'.')
743745
{
746+
if (PathIsExeW(Assoc))
747+
{
748+
exclude:
749+
HeapFree(pG->hHeap, 0, Entry);
750+
RegCloseKey(hKey);
751+
return NULL;
752+
}
753+
744754
dwSize = sizeof(Entry->ClassKey);
745755
if (RegQueryValueExW(hKey, NULL, NULL, NULL, LPBYTE(Entry->ClassKey), &dwSize))
746756
{
@@ -754,21 +764,13 @@ FileTypesDlg_InsertToLV(HWND hListView, LPCWSTR Assoc, INT iItem, PFILE_TYPE_GLO
754764
}
755765
#else
756766
if (!Entry->ClassKey[0])
757-
{
758-
HeapFree(pG->hHeap, 0, Entry);
759-
RegCloseKey(hKey);
760-
return NULL;
761-
}
767+
goto exclude;
762768
#endif
763769
}
764770

765771
Entry->EditFlags = GetRegDWORD(hKey, L"EditFlags", 0);
766772
if (Entry->EditFlags & FTA_Exclude)
767-
{
768-
HeapFree(pG->hHeap, 0, Entry);
769-
RegCloseKey(hKey);
770-
return NULL;
771-
}
773+
goto exclude;
772774

773775
wcscpy(Entry->FileExtension, Assoc);
774776

0 commit comments

Comments
 (0)