[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.

svn path=/trunk/; revision=71275
This commit is contained in:
Eric Kohl 2016-05-07 21:59:00 +00:00
parent 94edad6a7f
commit c5cff1ce1b
2 changed files with 43 additions and 5 deletions

View file

@ -58,6 +58,7 @@ HKCR,"anifile\DefaultIcon","",0x00000000,"%1"
; ReactOS Batch Files
HKCR,".bat","",0x00000000,"batfile"
HKCR,"batfile","",0x00000000,"ReactOS Batch File"
HKCR,"batfile","EditFlags",0x00010001,0x00000010
HKCR,"batfile","FriendlyTypeName",0x00020000,"@%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 @@ HKCR,"batfile\shell\open\command","",0x00000000,"""%1"" %*"
; ReactOS Command Script Files
HKCR,".cmd","",0x00000000,"cmdfile"
HKCR,"cmdfile","",0x00000000,"ReactOS Command Script"
HKCR,"cmdfile","EditFlags",0x00010001,0x00000010
HKCR,"cmdfile","FriendlyTypeName",0x00020000,"@%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 @@ HKCR,"cmdfile\shell\open\command","",0x00000000,"""%1"" %*"
; DOS Applications
HKCR,".com","",0x00000000,"comfile"
HKCR,"comfile","",0x00000000,"DOS Application"
HKCR,"comfile","EditFlags",0x00010001,0x00000010
HKCR,"comfile","FriendlyTypeName",0x00020000,"@%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 @@ HKCR,"curfile\DefaultIcon","",0x00000000,"%1"
; Dynamic Link Libraries
HKCR,".dll","",0x00000000,"dllfile"
HKCR,"dllfile","",0x00000000,"Application Extension"
HKCR,"dllfile","EditFlags",0x00010001,0x00000001
HKCR,"dllfile","FriendlyTypeName",0x00020000,"@%SystemRoot%\system32\shell32.dll,-206"
HKCR,"dllfile","NoOpen",0x00000000,""
HKCR,"dllfile\DefaultIcon","",0x00020000,"%SystemRoot%\system32\shell32.dll,-154"
@ -110,6 +114,7 @@ HKCR,"drvfile\DefaultIcon","",0x00020000,"%SystemRoot%\system32\shell32.dll,-154
; Applications
HKCR,".exe","",0x00000000,"exefile"
HKCR,"exefile","",0x00000000,"Application"
HKCR,"exefile","EditFlags",0x00010001,0x00000010
HKCR,"exefile","FriendlyTypeName",0x00020000,"@%SystemRoot%\system32\shell32.dll,-208"
HKCR,"exefile\DefaultIcon","",0x00000000,"%1"
HKCR,"exefile\shell\open\command","",0x00000000,"""%1"" %*"
@ -261,6 +266,7 @@ HKCR,".lnk","",0x00000000,"lnkfile"
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,"@%SystemRoot%\system32\shell32.dll,-215"
HKCR,"lnkfile","IsShortcut",0x00000000,"yes"
HKCR,"lnkfile","NeverShowExt",0x00000000,""
@ -321,6 +327,7 @@ HKCR,"Msi.Package\shell\Uninstall\command","",0x00020000,"%SystemRoot%\system32\
; 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,"@%SystemRoot%\system32\shell32.dll,-216"
HKCR,"piffile","IsShortcut",0x00000000,"yes"
HKCR,"piffile","NeverShowExt",0x00000000,""

View file

@ -37,6 +37,7 @@ typedef struct
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 @@ InsertFileType(HWND hDlgCtrl, WCHAR * szName, PINT iItem, WCHAR * szFile)
HKEY hKey;
LVITEMW lvItem;
DWORD dwSize;
DWORD dwType;
if (szName[0] != L'.')
{
@ -264,9 +266,24 @@ InsertFileType(HWND hDlgCtrl, WCHAR * szName, PINT iItem, WCHAR * szFile)
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);
_wcsupr(Entry->FileExtension);
@ -303,11 +320,16 @@ CALLBACK
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 @@ InitializeFileTypesListCtrl(HWND hwndDlg)
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 @@ FolderOptionsFileTypesDlg(
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
LPARAM lParam)
{
LPNMLISTVIEW lppl;
LVITEMW lvItem;
@ -401,7 +422,11 @@ FolderOptionsFileTypesDlg(
{
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 @@ FolderOptionsFileTypesDlg(
}
break;
}
break;
case WM_NOTIFY:
lppl = (LPNMLISTVIEW) lParam;
@ -455,6 +480,12 @@ FolderOptionsFileTypesDlg(
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;