Browse Source

Don't set unnecessary SupportedTypes key on file associations.

https://groups.google.com/g/innosetup/c/r6-_em0DGNs/m/KE7p9uqhBAAJ

Jordan Russell 8 months ago
parent
commit
4b05dce297

+ 0 - 1
Examples/Example3.iss

@@ -43,7 +43,6 @@ Root: HKA; Subkey: "Software\Classes\.myp\OpenWithProgids"; ValueType: string; V
 Root: HKA; Subkey: "Software\Classes\MyProgramFile.myp"; ValueType: string; ValueName: ""; ValueData: "My Program File"; Flags: uninsdeletekey
 Root: HKA; Subkey: "Software\Classes\MyProgramFile.myp\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\MyProg.exe,0"
 Root: HKA; Subkey: "Software\Classes\MyProgramFile.myp\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\MyProg.exe"" ""%1"""
-Root: HKA; Subkey: "Software\Classes\Applications\MyProg.exe\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: ""
 ; HKA (and HKCU) should only be used for settings which are compatible with
 ; roaming profiles so settings like paths should be written to HKLM, which
 ; is only possible in administrative install mode.

+ 8 - 4
Projects/Src/IDE.FileAssocFunc.pas

@@ -2,7 +2,7 @@ unit IDE.FileAssocFunc;
 
 {
   Inno Setup
-  Copyright (C) 1997-2020 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
 
@@ -83,8 +83,6 @@ begin
   SetKeyValue(Rootkey, 'Software\Classes\InnoSetupScriptFile\shell\Compile\command', nil,
     '"' + SelfName + '" /cc "%1"');
 
-  SetKeyValue(Rootkey, PChar('Software\Classes\Applications\' + PathExtractName(SelfName) + '\SupportedTypes'), '.iss', '');
-
   { If we just associated for all users, remove our existing association for the current user if it exists. }
   if AllUsers then
     UnregisterISSFileAssociationDo(HKEY_CURRENT_USER, False);
@@ -144,7 +142,9 @@ var
   SelfName: String;
   NumSubkeys, NumValues: DWORD;
 begin
-  if not KeyExists(Rootkey, 'Software\Classes\InnoSetupScriptFile') and not KeyExists(Rootkey, 'Software\Classes\.iss') then
+  if not KeyExists(Rootkey, 'Software\Classes\InnoSetupScriptFile') and
+     not KeyExists(Rootkey, 'Software\Classes\.iss') and
+     not KeyExists(Rootkey, 'Software\Classes\Applications\Compil32.exe') then
     Exit;
 
   SelfName := NewParamStr(0);
@@ -176,6 +176,10 @@ begin
   end;
   RegDeleteKeyIfEmpty(rvDefault, RootKey, 'Software\Classes\.iss');
 
+  { Remove unnecessary key set by previous versions }
+  RegDeleteKeyIncludingSubkeys(rvDefault, Rootkey,
+    'Software\Classes\Applications\Compil32.exe');
+
   if ChangeNotify then
     SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);
 end;

+ 0 - 1
Projects/Src/IDE.Wizard.WizardForm.pas

@@ -974,7 +974,6 @@ begin
       Registry := Registry + 'Root: HKA; Subkey: "Software\Classes\' + AppAssocKey + '"; ValueType: string; ValueName: ""; ValueData: "' + AppAssocNameEdit.Text + '"; Flags: uninsdeletekey' + SNewLine;
       Registry := Registry + 'Root: HKA; Subkey: "Software\Classes\' + AppAssocKey + '\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\' + AppExeName + ',0"' + SNewLine;
       Registry := Registry + 'Root: HKA; Subkey: "Software\Classes\' + AppAssocKey + '\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\' + AppExeName + '"" ""%1"""' + SNewLine;
-      Registry := Registry + 'Root: HKA; Subkey: "Software\Classes\Applications\' + AppExeName + '\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: ""' + SNewLine;
     end;
 
     FFilesHelper.AddScript(Files);