Author: ekohl
Date: Sat May 7 21:59:00 2016
New Revision: 71275
URL:
http://svn.reactos.org/svn/reactos?rev=71275&view=rev
Log:
[SHELL32]
Improvements to the file type property page:
- Read the EditFlags value for each file type from the registry.
- Sort the file type list by extension and description.
- Do not add a file type to the list if the FTA_Exclude flag is set for the file type.
- Disable the delete button if the FTA_NoRemove flag is set fot the file type.
- Set the FTA_Exclude flag for the dllfiles, lnkfiles and piffiles file types.
- Set the FTA_NoRemove flag for the batfile, cmdfile, comfile and exefile file types.
Modified:
trunk/reactos/boot/bootdata/hivecls.inf
trunk/reactos/dll/win32/shell32/dialogs/folder_options.cpp
Modified: trunk/reactos/boot/bootdata/hivecls.inf
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivecls.inf?…
==============================================================================
--- trunk/reactos/boot/bootdata/hivecls.inf [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/hivecls.inf [iso-8859-1] Sat May 7 21:59:00 2016
@@ -58,6 +58,7 @@
; ReactOS Batch Files
HKCR,".bat","",0x00000000,"batfile"
HKCR,"batfile","",0x00000000,"ReactOS Batch File"
+HKCR,"batfile","EditFlags",0x00010001,0x00000010
HKCR,"batfile","FriendlyTypeName",0x00020000,"(a)%SystemRoot%\system32\shell32.dll,-201"
HKCR,"batfile\DefaultIcon","",0x00020000,"%SystemRoot%\system32\shell32.dll,-153"
HKCR,"batfile\shell\edit\command","",0x00020000,"%SystemRoot%\system32\notepad.exe
%1"
@@ -66,6 +67,7 @@
; ReactOS Command Script Files
HKCR,".cmd","",0x00000000,"cmdfile"
HKCR,"cmdfile","",0x00000000,"ReactOS Command Script"
+HKCR,"cmdfile","EditFlags",0x00010001,0x00000010
HKCR,"cmdfile","FriendlyTypeName",0x00020000,"(a)%SystemRoot%\system32\shell32.dll,-202"
HKCR,"cmdfile\DefaultIcon","",0x00020000,"%SystemRoot%\system32\shell32.dll,-153"
HKCR,"cmdfile\shell\edit\command","",0x00020000,"%SystemRoot%\system32\notepad.exe
%1"
@@ -74,6 +76,7 @@
; DOS Applications
HKCR,".com","",0x00000000,"comfile"
HKCR,"comfile","",0x00000000,"DOS Application"
+HKCR,"comfile","EditFlags",0x00010001,0x00000010
HKCR,"comfile","FriendlyTypeName",0x00020000,"(a)%SystemRoot%\system32\shell32.dll,-203"
HKCR,"comfile\DefaultIcon","",0x00020000,"%SystemRoot%\system32\shell32.dll,-3"
HKCR,"comfile\shell\open\command","",0x00000000,"""%1""
%*"
@@ -97,6 +100,7 @@
; Dynamic Link Libraries
HKCR,".dll","",0x00000000,"dllfile"
HKCR,"dllfile","",0x00000000,"Application Extension"
+HKCR,"dllfile","EditFlags",0x00010001,0x00000001
HKCR,"dllfile","FriendlyTypeName",0x00020000,"(a)%SystemRoot%\system32\shell32.dll,-206"
HKCR,"dllfile","NoOpen",0x00000000,""
HKCR,"dllfile\DefaultIcon","",0x00020000,"%SystemRoot%\system32\shell32.dll,-154"
@@ -110,6 +114,7 @@
; Applications
HKCR,".exe","",0x00000000,"exefile"
HKCR,"exefile","",0x00000000,"Application"
+HKCR,"exefile","EditFlags",0x00010001,0x00000010
HKCR,"exefile","FriendlyTypeName",0x00020000,"(a)%SystemRoot%\system32\shell32.dll,-208"
HKCR,"exefile\DefaultIcon","",0x00000000,"%1"
HKCR,"exefile\shell\open\command","",0x00000000,"""%1""
%*"
@@ -261,6 +266,7 @@
HKCR,".lnk\shellnew","",0x00000000,""
HKCR,".lnk\shellnew","command",0x00020000,"%SystemRoot%\system32\rundll32.exe
appwiz.cpl,NewLinkHere %1"
HKCR,"lnkfile","",0x00000000,"Shortcut"
+HKCR,"lnkfile","EditFlags",0x00010001,0x00000001
HKCR,"lnkfile","FriendlyTypeName",0x00020000,"(a)%SystemRoot%\system32\shell32.dll,-215"
HKCR,"lnkfile","IsShortcut",0x00000000,"yes"
HKCR,"lnkfile","NeverShowExt",0x00000000,""
@@ -321,6 +327,7 @@
; Program Information File for NT VDM
HKCR,".pif","",0x00000000,"piffile"
HKCR,"piffile","",0x00000000,"NT VDM Program Information
File"
+HKCR,"piffile","EditFlags",0x00010001,0x00000001
HKCR,"piffile","FriendlyTypeName",0x00020000,"(a)%SystemRoot%\system32\shell32.dll,-216"
HKCR,"piffile","IsShortcut",0x00000000,"yes"
HKCR,"piffile","NeverShowExt",0x00000000,""
Modified: trunk/reactos/dll/win32/shell32/dialogs/folder_options.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/dialogs/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/dialogs/folder_options.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/dialogs/folder_options.cpp [iso-8859-1] Sat May 7
21:59:00 2016
@@ -37,6 +37,7 @@
WCHAR FileExtension[30];
WCHAR FileDescription[100];
WCHAR ClassKey[MAX_PATH];
+ DWORD EditFlags;
} FOLDER_FILE_TYPE_ENTRY, *PFOLDER_FILE_TYPE_ENTRY;
typedef struct
@@ -211,6 +212,7 @@
HKEY hKey;
LVITEMW lvItem;
DWORD dwSize;
+ DWORD dwType;
if (szName[0] != L'.')
{
@@ -264,8 +266,23 @@
RegQueryValueExW(hKey, NULL, NULL, NULL, (LPBYTE)Entry->FileDescription,
&dwSize);
}
+ /* Read the EditFlags value */
+ Entry->EditFlags = 0;
+ if (!RegQueryValueExW(hKey, L"EditFlags", NULL, &dwType, NULL,
&dwSize))
+ {
+ if ((dwType == REG_DWORD || dwType == REG_BINARY) && dwSize ==
sizeof(DWORD))
+ RegQueryValueExW(hKey, L"EditFlags", NULL, NULL,
(LPBYTE)&Entry->EditFlags, &dwSize);
+ }
+
/* close key */
RegCloseKey(hKey);
+
+ /* Do not add excluded entries */
+ if (Entry->EditFlags & 0x00000001) //FTA_Exclude
+ {
+ HeapFree(GetProcessHeap(), 0, Entry);
+ return;
+ }
/* convert extension to upper case */
wcscpy(Entry->FileExtension, szName);
@@ -303,11 +320,16 @@
ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
PFOLDER_FILE_TYPE_ENTRY Entry1, Entry2;
+ int x;
Entry1 = (PFOLDER_FILE_TYPE_ENTRY)lParam1;
Entry2 = (PFOLDER_FILE_TYPE_ENTRY)lParam2;
- return wcsicmp(Entry1->FileExtension, Entry2->FileExtension);
+ x = wcsicmp(Entry1->FileExtension, Entry2->FileExtension);
+ if (x != 0)
+ return x;
+
+ return wcsicmp(Entry1->FileDescription, Entry2->FileDescription);
}
static
@@ -335,7 +357,7 @@
dwName = _countof(szName);
- while(RegEnumKeyExW(HKEY_CLASSES_ROOT, dwIndex++, szName, &dwName, NULL, NULL,
NULL, NULL) == ERROR_SUCCESS)
+ while (RegEnumKeyExW(HKEY_CLASSES_ROOT, dwIndex++, szName, &dwName, NULL, NULL,
NULL, NULL) == ERROR_SUCCESS)
{
InsertFileType(hDlgCtrl, szName, &iItem, szFile);
dwName = _countof(szName);
@@ -388,8 +410,7 @@
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
- LPARAM lParam
-)
+ LPARAM lParam)
{
LPNMLISTVIEW lppl;
LVITEMW lvItem;
@@ -401,7 +422,11 @@
{
case WM_INITDIALOG:
InitializeFileTypesListCtrl(hwndDlg);
+
+ /* Disable the Delete button by default */
+ EnableWindow(GetDlgItem(hwndDlg, 14002), FALSE);
return TRUE;
+
case WM_COMMAND:
switch(LOWORD(wParam))
{
@@ -415,8 +440,8 @@
}
break;
}
-
break;
+
case WM_NOTIFY:
lppl = (LPNMLISTVIEW) lParam;
@@ -455,6 +480,12 @@
swprintf(Buffer, FormatBuffer, &pItem->FileExtension[1],
&pItem->FileDescription[0], &pItem->FileDescription[0]);
/* update dialog */
SetDlgItemTextW(hwndDlg, 14007, Buffer);
+
+ /* Enable the Delete button */
+ if (pItem->EditFlags & 0x00000010) // FTA_NoRemove
+ EnableWindow(GetDlgItem(hwndDlg, 14002), FALSE);
+ else
+ EnableWindow(GetDlgItem(hwndDlg, 14002), TRUE);
}
}
break;