瀏覽代碼

Added new [Setup] section directive UninstallLogging, which defaults to no. If set to yes, the uninstaller will always create a log file if it is launched from the Add/Remove Programs Control Panel applet. Equivalent to passing /LOG on the command line.

Logging starts before the .dat is read which is why it works by altering the ARP UninstallString instead.
Martijn Laan 1 年之前
父節點
當前提交
c2b66e4a1d
共有 6 個文件被更改,包括 23 次插入3 次删除
  1. 10 0
      ISHelp/isetup.xml
  2. 3 0
      Projects/Compile.pas
  3. 7 2
      Projects/Install.pas
  4. 1 0
      Projects/SetupSectionDirectives.pas
  5. 1 1
      Projects/Struct.pas
  6. 1 0
      whatsnew.htm

+ 10 - 0
ISHelp/isetup.xml

@@ -1090,6 +1090,7 @@ DefaultGroupName=My Program
 <li><link topic="setup_uninstalldisplayname">UninstallDisplayName</link></li>
 <li><link topic="setup_uninstalldisplayname">UninstallDisplayName</link></li>
 <li><link topic="setup_uninstalldisplaysize">UninstallDisplaySize</link></li>
 <li><link topic="setup_uninstalldisplaysize">UninstallDisplaySize</link></li>
 <li><link topic="setup_uninstallfilesdir">UninstallFilesDir</link></li>
 <li><link topic="setup_uninstallfilesdir">UninstallFilesDir</link></li>
+<li><link topic="setup_uninstalllogging">UninstallLogging</link></li>
 <li><link topic="setup_uninstalllogmode">UninstallLogMode</link></li>
 <li><link topic="setup_uninstalllogmode">UninstallLogMode</link></li>
 <li><link topic="setup_uninstallrestartcomputer">UninstallRestartComputer</link></li>
 <li><link topic="setup_uninstallrestartcomputer">UninstallRestartComputer</link></li>
 <li><link topic="setup_updateuninstalllogappname">UpdateUninstallLogAppName</link></li>
 <li><link topic="setup_updateuninstalllogappname">UpdateUninstallLogAppName</link></li>
@@ -4499,6 +4500,15 @@ UninstallDisplayIcon={app}\MyProg.exe,1
 </body>
 </body>
 </setuptopic>
 </setuptopic>
 
 
+<setuptopic directive="UninstallLogging">
+<setupvalid><link topic="yesnonotes"><tt>yes</tt> or <tt>no</tt></link></setupvalid>
+<setupdefault><tt>no</tt></setupdefault>
+<body>
+<p>If set to <tt>yes</tt>, the uninstaller will always create a log file if it is launched from the <i>Add/Remove Programs</i> Control Panel applet. Equivalent to passing <link topic="uninstcmdline" anchor="LOG">/LOG</link> on the command line.</p>
+<p>This directive has no effect if <tt>CreateUninstallRegKey</tt> is not set to <tt>yes</tt>.</p>
+</body>
+</setuptopic>
+
 <setuptopic directive="UninstallLogMode">
 <setuptopic directive="UninstallLogMode">
 <setupvalid><tt>append</tt>, <tt>new</tt>, or <tt>overwrite</tt></setupvalid>
 <setupvalid><tt>append</tt>, <tt>new</tt>, or <tt>overwrite</tt></setupvalid>
 <setupdefault><tt>append</tt></setupdefault>
 <setupdefault><tt>append</tt></setupdefault>

+ 3 - 0
Projects/Compile.pas

@@ -4132,6 +4132,9 @@ begin
     ssUninstallIconFile: begin
     ssUninstallIconFile: begin
         WarningsList.Add(Format(SCompilerEntryObsolete, ['Setup', KeyName]));
         WarningsList.Add(Format(SCompilerEntryObsolete, ['Setup', KeyName]));
       end;
       end;
+    ssUninstallLogging: begin
+        SetSetupHeaderOption(shUninstallLogging);
+      end;
     ssUninstallLogMode: begin
     ssUninstallLogMode: begin
         if CompareText(Value, 'append') = 0 then
         if CompareText(Value, 'append') = 0 then
           SetupHeader.UninstallLogMode := lmAppend
           SetupHeader.UninstallLogMode := lmAppend

+ 7 - 2
Projects/Install.pas

@@ -691,8 +691,13 @@ var
         I := 63;
         I := 63;
       SetStringValue(H2, 'DisplayName', Copy(Z, 1, I));
       SetStringValue(H2, 'DisplayName', Copy(Z, 1, I));
       SetStringValueUnlessEmpty(H2, 'DisplayIcon', ExpandConst(SetupHeader.UninstallDisplayIcon));
       SetStringValueUnlessEmpty(H2, 'DisplayIcon', ExpandConst(SetupHeader.UninstallDisplayIcon));
-      SetStringValue(H2, 'UninstallString', '"' + UninstallExeFilename + '"');
-      SetStringValue(H2, 'QuietUninstallString', '"' + UninstallExeFilename + '" /SILENT');
+      var ExtraUninstallString: String;
+      if shUninstallLogging in SetupHeader.Options then
+        ExtraUninstallString := ' /LOG'
+      else
+        ExtraUninstallString := '';
+      SetStringValue(H2, 'UninstallString', '"' + UninstallExeFilename + '"' + ExtraUninstallString);
+      SetStringValue(H2, 'QuietUninstallString', '"' + UninstallExeFilename + '" /SILENT' + ExtraUninstallString);
       SetStringValueUnlessEmpty(H2, 'DisplayVersion', ExpandConst(SetupHeader.AppVersion));
       SetStringValueUnlessEmpty(H2, 'DisplayVersion', ExpandConst(SetupHeader.AppVersion));
       SetStringValueUnlessEmpty(H2, 'Publisher', ExpandConst(SetupHeader.AppPublisher));
       SetStringValueUnlessEmpty(H2, 'Publisher', ExpandConst(SetupHeader.AppPublisher));
       SetStringValueUnlessEmpty(H2, 'URLInfoAbout', ExpandConst(SetupHeader.AppPublisherURL));
       SetStringValueUnlessEmpty(H2, 'URLInfoAbout', ExpandConst(SetupHeader.AppPublisherURL));

+ 1 - 0
Projects/SetupSectionDirectives.pas

@@ -136,6 +136,7 @@ type
     ssUninstallDisplaySize,
     ssUninstallDisplaySize,
     ssUninstallFilesDir,
     ssUninstallFilesDir,
     ssUninstallIconFile,
     ssUninstallIconFile,
+    ssUninstallLogging,
     ssUninstallLogMode,
     ssUninstallLogMode,
     ssUninstallRestartComputer,
     ssUninstallRestartComputer,
     ssUninstallStyle,
     ssUninstallStyle,

+ 1 - 1
Projects/Struct.pas

@@ -66,7 +66,7 @@ type
     shSignedUninstaller, shUsePreviousLanguage, shDisableWelcomePage,
     shSignedUninstaller, shUsePreviousLanguage, shDisableWelcomePage,
     shCloseApplications, shRestartApplications, shAllowNetworkDrive,
     shCloseApplications, shRestartApplications, shAllowNetworkDrive,
     shForceCloseApplications, shAppNameHasConsts, shUsePreviousPrivileges,
     shForceCloseApplications, shAppNameHasConsts, shUsePreviousPrivileges,
-    shWizardResizable);
+    shWizardResizable, shUninstallLogging);
   TSetupLanguageDetectionMethod = (ldUILanguage, ldLocale, ldNone);
   TSetupLanguageDetectionMethod = (ldUILanguage, ldLocale, ldNone);
   TSetupCompressMethod = (cmStored, cmZip, cmBzip, cmLZMA, cmLZMA2);
   TSetupCompressMethod = (cmStored, cmZip, cmBzip, cmLZMA, cmLZMA2);
   TSetupSalt = array[0..7] of Byte;
   TSetupSalt = array[0..7] of Byte;

+ 1 - 0
whatsnew.htm

@@ -42,6 +42,7 @@ For conditions of distribution and use, see <a href="https://jrsoftware.org/file
     <li>Support function <tt>LoadStringsFromFile</tt> now also supports UTF8-encoded files without an UTF-8 preamble.</li>
     <li>Support function <tt>LoadStringsFromFile</tt> now also supports UTF8-encoded files without an UTF-8 preamble.</li>
     <li>Added new <tt>SaveStringsToUTF8FileNoPreamble</tt> support function.</li>
     <li>Added new <tt>SaveStringsToUTF8FileNoPreamble</tt> support function.</li>
   </ul>
   </ul>
+  <li>Added new [Setup] section directive <tt>UninstallLogging</tt>, which defaults to <tt>no</tt>. If set to <tt>yes</tt>, the uninstaller will always create a log file if it is launched from the <i>Add/Remove Programs</i> Control Panel applet. Equivalent to passing /LOG on the command line.</li>
   <li>During startup Setup would always ask Windows to create any missing <tt>{usercf}</tt>, <tt>{userpf}</tt>, and <tt>{usersavedgames}</tt> folders. It no longer does until the script asks for the folder. Note that scripts running in administrative install mode should not do this because it violates the <a href="https://jrsoftware.org/ishelp/index.php?topic=setup_useduserareaswarning">used user areas warning</a>.</li>
   <li>During startup Setup would always ask Windows to create any missing <tt>{usercf}</tt>, <tt>{userpf}</tt>, and <tt>{usersavedgames}</tt> folders. It no longer does until the script asks for the folder. Note that scripts running in administrative install mode should not do this because it violates the <a href="https://jrsoftware.org/ishelp/index.php?topic=setup_useduserareaswarning">used user areas warning</a>.</li>
   <li>Added support for IIS group users identifiers (<tt>iisiusrs</tt>) for use in <tt>Permissions</tt> parameters, contributed by Achim Stuy.</li> 
   <li>Added support for IIS group users identifiers (<tt>iisiusrs</tt>) for use in <tt>Permissions</tt> parameters, contributed by Achim Stuy.</li> 
   <li>Pascal Scripting change: type <tt>TShellFolderID</tt> was removed because it wasn't used by any support function.</a>
   <li>Pascal Scripting change: type <tt>TShellFolderID</tt> was removed because it wasn't used by any support function.</a>