Browse Source

Add new [Setup] section directive VerifyPrecompiledFiles.

Martijn Laan 3 months ago
parent
commit
af84bf4624

+ 9 - 0
ISHelp/isetup.xml

@@ -1022,6 +1022,7 @@ DefaultGroupName=My Program
 <li><link topic="setup_terminalservicesaware">TerminalServicesAware</link></li>
 <li><link topic="setup_terminalservicesaware">TerminalServicesAware</link></li>
 <li><link topic="setup_useduserareaswarning">UsedUserAreasWarning</link></li>
 <li><link topic="setup_useduserareaswarning">UsedUserAreasWarning</link></li>
 <li><link topic="setup_usesetupldr">UseSetupLdr</link></li>
 <li><link topic="setup_usesetupldr">UseSetupLdr</link></li>
+<li><link topic="setup_verifyprecompiledfiles">VerifyPrecompiledFiles</link></li>
 <li><link topic="setup_versioninfocompany">VersionInfoCompany</link></li>
 <li><link topic="setup_versioninfocompany">VersionInfoCompany</link></li>
 <li><link topic="setup_versioninfocopyright">VersionInfoCopyright</link></li>
 <li><link topic="setup_versioninfocopyright">VersionInfoCopyright</link></li>
 <li><link topic="setup_versioninfodescription">VersionInfoDescription</link></li>
 <li><link topic="setup_versioninfodescription">VersionInfoDescription</link></li>
@@ -5190,6 +5191,14 @@ DiskSliceSize=1457664
 </body>
 </body>
 </setuptopic>
 </setuptopic>
 
 
+<setuptopic directive="VerifyPrecompiledFiles">
+<setupvalid><link topic="yesnonotes"><tt>yes</tt> or <tt>no</tt></link></setupvalid>
+<setupdefault><tt>yes</tt></setupdefault>
+<body>
+<p>Normally the compiler verifies that precompiled files like <i>SetupLdr.e32</i> and <i>Setup.e32</i> remain unchanged before using them. If you wish to disable this feature for some reason, set this directive to <tt>no</tt>.</p>
+</body>
+</setuptopic>
+
 <setuptopic directive="AllowCancelDuringInstall">
 <setuptopic directive="AllowCancelDuringInstall">
 <setupvalid><link topic="yesnonotes"><tt>yes</tt> or <tt>no</tt></link></setupvalid>
 <setupvalid><link topic="yesnonotes"><tt>yes</tt> or <tt>no</tt></link></setupvalid>
 <setupdefault><tt>yes</tt></setupdefault>
 <setupdefault><tt>yes</tt></setupdefault>

+ 10 - 6
Projects/Src/Compiler.SetupCompiler.pas

@@ -113,7 +113,7 @@ type
     InternalCompressLevel, CompressLevel: Integer;
     InternalCompressLevel, CompressLevel: Integer;
     InternalCompressProps, CompressProps: TLZMACompressorProps;
     InternalCompressProps, CompressProps: TLZMACompressorProps;
     UseSolidCompression: Boolean;
     UseSolidCompression: Boolean;
-    DontMergeDuplicateFiles: Boolean;
+    DontMergeDuplicateFiles, DontVerifyPrecompiledFiles: Boolean;
     Password: String;
     Password: String;
     CryptKey: TSetupEncryptionKey;
     CryptKey: TSetupEncryptionKey;
     TimeStampsInUTC: Boolean;
     TimeStampsInUTC: Boolean;
@@ -3129,6 +3129,10 @@ begin
     ssUserInfoPage: begin
     ssUserInfoPage: begin
         SetSetupHeaderOption(shUserInfoPage);
         SetSetupHeaderOption(shUserInfoPage);
       end;
       end;
+    ssVerifyPrecompiledFiles: begin
+      DontVerifyPrecompiledFiles := not StrToBool(Value);
+      CompressProps.WorkerProcessCheckTrust := not DontVerifyPrecompiledFiles;
+    end;
     ssVersionInfoCompany: begin
     ssVersionInfoCompany: begin
         VersionInfoCompany := Value;
         VersionInfoCompany := Value;
       end;
       end;
@@ -7330,7 +7334,7 @@ var
       E32Filename := CompilerDir + 'Setup.e32';
       E32Filename := CompilerDir + 'Setup.e32';
       { make a copy and update icons, version info and if needed manifest }
       { make a copy and update icons, version info and if needed manifest }
       ConvertFilename := OutputDir + OutputBaseFilename + '.e32.tmp';
       ConvertFilename := OutputDir + OutputBaseFilename + '.e32.tmp';
-      CopyFileOrAbort(E32Filename, ConvertFilename, True, [cftoTrustAllOnDebug]);
+      CopyFileOrAbort(E32Filename, ConvertFilename, not DontVerifyPrecompiledFiles, [cftoTrustAllOnDebug]);
       SetFileAttributes(PChar(ConvertFilename), FILE_ATTRIBUTE_ARCHIVE);
       SetFileAttributes(PChar(ConvertFilename), FILE_ATTRIBUTE_ARCHIVE);
       TempFilename := ConvertFilename;
       TempFilename := ConvertFilename;
       if SetupIconFilename <> '' then begin
       if SetupIconFilename <> '' then begin
@@ -8055,18 +8059,18 @@ begin
     case SetupHeader.CompressMethod of
     case SetupHeader.CompressMethod of
       cmZip: begin
       cmZip: begin
           AddStatus(Format(SCompilerStatusReadingFile, ['isunzlib.dll']));
           AddStatus(Format(SCompilerStatusReadingFile, ['isunzlib.dll']));
-          DecompressorDLL := CreateMemoryStreamFromFile(CompilerDir + 'isunzlib.dll', True);
+          DecompressorDLL := CreateMemoryStreamFromFile(CompilerDir + 'isunzlib.dll', not DontVerifyPrecompiledFiles);
         end;
         end;
       cmBzip: begin
       cmBzip: begin
           AddStatus(Format(SCompilerStatusReadingFile, ['isbunzip.dll']));
           AddStatus(Format(SCompilerStatusReadingFile, ['isbunzip.dll']));
-          DecompressorDLL := CreateMemoryStreamFromFile(CompilerDir + 'isbunzip.dll', True);
+          DecompressorDLL := CreateMemoryStreamFromFile(CompilerDir + 'isbunzip.dll', not DontVerifyPrecompiledFiles);
         end;
         end;
     end;
     end;
 
 
     { Read 7-Zip DLL }
     { Read 7-Zip DLL }
     if SetupHeader.SevenZipLibraryName <> '' then begin
     if SetupHeader.SevenZipLibraryName <> '' then begin
       AddStatus(Format(SCompilerStatusReadingFile, [SetupHeader.SevenZipLibraryName]));
       AddStatus(Format(SCompilerStatusReadingFile, [SetupHeader.SevenZipLibraryName]));
-      SevenZipDLL := CreateMemoryStreamFromFile(CompilerDir + SetupHeader.SevenZipLibraryName, True);
+      SevenZipDLL := CreateMemoryStreamFromFile(CompilerDir + SetupHeader.SevenZipLibraryName, not DontVerifyPrecompiledFiles);
     end;
     end;
 
 
     { Add default types if necessary }
     { Add default types if necessary }
@@ -8124,7 +8128,7 @@ begin
           end;
           end;
         end
         end
         else begin
         else begin
-          CopyFileOrAbort(CompilerDir + 'SetupLdr.e32', ExeFilename, True, [cftoTrustAllOnDebug]);
+          CopyFileOrAbort(CompilerDir + 'SetupLdr.e32', ExeFilename, not DontVerifyPrecompiledFiles, [cftoTrustAllOnDebug]);
           { if there was a read-only attribute, remove it }
           { if there was a read-only attribute, remove it }
           SetFileAttributes(PChar(ExeFilename), FILE_ATTRIBUTE_ARCHIVE);
           SetFileAttributes(PChar(ExeFilename), FILE_ATTRIBUTE_ARCHIVE);
           if SetupIconFilename <> '' then begin
           if SetupIconFilename <> '' then begin

+ 1 - 0
Projects/Src/Shared.SetupSectionDirectives.pas

@@ -155,6 +155,7 @@ type
     ssUsePreviousUserInfo,
     ssUsePreviousUserInfo,
     ssUseSetupLdr,
     ssUseSetupLdr,
     ssUserInfoPage,
     ssUserInfoPage,
+    ssVerifyPrecompiledFiles,
     ssVersionInfoCompany,
     ssVersionInfoCompany,
     ssVersionInfoCopyright,
     ssVersionInfoCopyright,
     ssVersionInfoDescription,
     ssVersionInfoDescription,

+ 1 - 1
whatsnew.htm

@@ -104,7 +104,7 @@ issigtool --key-file="MyKey.ispublickey" verify "MyProg.dll"</pre>
   </li>
   </li>
   <li>Other related changes:
   <li>Other related changes:
   <ul>
   <ul>
-    <li>The compiler now verifies that precompiled files like <i>SetupLdr.e32</i> and <i>Setup.e32</i> remain unchanged before using them.</li>
+    <li>The compiler now verifies that precompiled files like <i>SetupLdr.e32</i> and <i>Setup.e32</i> remain unchanged before using them. Can be disabled using new [Setup] section directive <tt>VerifyPrecompiledFiles</tt>.</li>
     <li>Pascal Scripting: Added new <tt>ISSigVerify</tt> support function.</li>
     <li>Pascal Scripting: Added new <tt>ISSigVerify</tt> support function.</li>
   </ul>
   </ul>
   </li>
   </li>