2
0
Эх сурвалжийг харах

Cleanup: TSetupFileLocationEntry contained a few things which Setup doesn't need and are only for the compiler. Keep those in a separate record and companion list.

Martijn Laan 4 сар өмнө
parent
commit
00d335b7ef

+ 35 - 17
Projects/Src/Compiler.SetupCompiler.pas

@@ -87,6 +87,7 @@ type
     UninstallRunEntries: TList;
     UninstallRunEntries: TList;
 
 
     FileLocationEntryFilenames: THashStringList;
     FileLocationEntryFilenames: THashStringList;
+    FileLocationEntryExtraInfos: TList;
     WarningsList: THashStringList;
     WarningsList: THashStringList;
     ExpectedCustomMessageNames: TStringList;
     ExpectedCustomMessageNames: TStringList;
     MissingMessagesWarning, MissingRunOnceIdsWarning, MissingRunOnceIds, NotRecognizedMessagesWarning, UsedUserAreasWarning: Boolean;
     MissingMessagesWarning, MissingRunOnceIdsWarning, MissingRunOnceIds, NotRecognizedMessagesWarning, UsedUserAreasWarning: Boolean;
@@ -307,6 +308,14 @@ type
     Name, Command: String;
     Name, Command: String;
   end;
   end;
 
 
+  TFileLocationSign = (fsNoSetting, fsYes, fsOnce, fsCheck);
+  PFileLocationEntryExtraInfo = ^TFileLocationEntryExtraInfo;
+  TFileLocationEntryExtraInfo = packed record
+    Flags: set of (floVersionInfoNotValid, floIsUninstExe, floApplyTouchDateTime,
+      floSolidBreak);
+    Sign: TFileLocationSign;
+  end;
+
 var
 var
   ZipInitialized, BzipInitialized, LZMAInitialized: Boolean;
   ZipInitialized, BzipInitialized, LZMAInitialized: Boolean;
   PreprocessorInitialized: Boolean;
   PreprocessorInitialized: Boolean;
@@ -362,6 +371,7 @@ begin
   RunEntries := TLowFragList.Create;
   RunEntries := TLowFragList.Create;
   UninstallRunEntries := TLowFragList.Create;
   UninstallRunEntries := TLowFragList.Create;
   FileLocationEntryFilenames := THashStringList.Create;
   FileLocationEntryFilenames := THashStringList.Create;
+  FileLocationEntryExtraInfos := TLowFragList.Create;
   WarningsList := THashStringList.Create;
   WarningsList := THashStringList.Create;
   WarningsList.IgnoreDuplicates := True;
   WarningsList.IgnoreDuplicates := True;
   ExpectedCustomMessageNames := TStringList.Create;
   ExpectedCustomMessageNames := TStringList.Create;
@@ -409,6 +419,7 @@ begin
   UsedUserAreas.Free;
   UsedUserAreas.Free;
   ExpectedCustomMessageNames.Free;
   ExpectedCustomMessageNames.Free;
   WarningsList.Free;
   WarningsList.Free;
+  FileLocationEntryExtraInfos.Free;
   FileLocationEntryFilenames.Free;
   FileLocationEntryFilenames.Free;
   UninstallRunEntries.Free;
   UninstallRunEntries.Free;
   RunEntries.Free;
   RunEntries.Free;
@@ -4517,7 +4528,7 @@ const
     'uninsnosharedfileprompt', 'createallsubdirs', '32bit', '64bit',
     'uninsnosharedfileprompt', 'createallsubdirs', '32bit', '64bit',
     'solidbreak', 'setntfscompression', 'unsetntfscompression',
     'solidbreak', 'setntfscompression', 'unsetntfscompression',
     'sortfilesbyname', 'gacinstall', 'sign', 'signonce', 'signcheck');
     'sortfilesbyname', 'gacinstall', 'sign', 'signonce', 'signcheck');
-  SignFlags: array[TSetupFileLocationSign] of String = (
+  SignFlags: array[TFileLocationSign] of String = (
     '', 'sign', 'signonce', 'signcheck');
     '', 'sign', 'signonce', 'signcheck');
   AttribsFlags: array[0..3] of PChar = (
   AttribsFlags: array[0..3] of PChar = (
     'readonly', 'hidden', 'system', 'notcontentindexed');
     'readonly', 'hidden', 'system', 'notcontentindexed');
@@ -4529,12 +4540,13 @@ var
   Values: array[TParam] of TParamValue;
   Values: array[TParam] of TParamValue;
   NewFileEntry, PrevFileEntry: PSetupFileEntry;
   NewFileEntry, PrevFileEntry: PSetupFileEntry;
   NewFileLocationEntry: PSetupFileLocationEntry;
   NewFileLocationEntry: PSetupFileLocationEntry;
+  NewFileLocationEntryExtraInfo: PFileLocationEntryExtraInfo;
   VersionNumbers: TFileVersionNumbers;
   VersionNumbers: TFileVersionNumbers;
   SourceWildcard, ADestDir, ADestName, AInstallFontName, AStrongAssemblyName: String;
   SourceWildcard, ADestDir, ADestName, AInstallFontName, AStrongAssemblyName: String;
   AExcludes: TStringList;
   AExcludes: TStringList;
   ReadmeFile, ExternalFile, SourceIsWildcard, RecurseSubdirs,
   ReadmeFile, ExternalFile, SourceIsWildcard, RecurseSubdirs,
     AllowUnsafeFiles, Touch, NoCompression, NoEncryption, SolidBreak: Boolean;
     AllowUnsafeFiles, Touch, NoCompression, NoEncryption, SolidBreak: Boolean;
-  Sign: TSetupFileLocationSign;
+  Sign: TFileLocationSign;
 type
 type
   PFileListRec = ^TFileListRec;
   PFileListRec = ^TFileListRec;
   TFileListRec = record
   TFileListRec = record
@@ -4763,8 +4775,8 @@ type
     end;
     end;
   end;
   end;
 
 
-  procedure ApplyNewSign(var Sign: TSetupFileLocationSign;
-    const NewSign: TSetupFileLocationSign; const ErrorMessage: String);
+  procedure ApplyNewSign(var Sign: TFileLocationSign;
+    const NewSign: TFileLocationSign; const ErrorMessage: String);
   begin
   begin
     if not (Sign in [fsNoSetting, NewSign]) then
     if not (Sign in [fsNoSetting, NewSign]) then
       AbortCompileFmt(ErrorMessage,
       AbortCompileFmt(ErrorMessage,
@@ -4822,31 +4834,34 @@ type
           J := FileLocationEntryFilenames.CaseInsensitiveIndexOf(SourceFile);
           J := FileLocationEntryFilenames.CaseInsensitiveIndexOf(SourceFile);
           if J <> -1 then begin
           if J <> -1 then begin
             NewFileLocationEntry := FileLocationEntries[J];
             NewFileLocationEntry := FileLocationEntries[J];
+            NewFileLocationEntryExtraInfo := FileLocationEntryExtraInfos[J];
             NewFileEntry^.LocationEntry := J;
             NewFileEntry^.LocationEntry := J;
           end;
           end;
         end;
         end;
         if NewFileLocationEntry = nil then begin
         if NewFileLocationEntry = nil then begin
           NewFileLocationEntry := AllocMem(SizeOf(TSetupFileLocationEntry));
           NewFileLocationEntry := AllocMem(SizeOf(TSetupFileLocationEntry));
+          NewFileLocationEntryExtraInfo := AllocMem(SizeOf(TFileLocationEntryExtraInfo));
           SetupHeader.CompressMethod := CompressMethod;
           SetupHeader.CompressMethod := CompressMethod;
           FileLocationEntries.Add(NewFileLocationEntry);
           FileLocationEntries.Add(NewFileLocationEntry);
+          FileLocationEntryExtraInfos.Add(NewFileLocationEntryExtraInfo);
           FileLocationEntryFilenames.Add(SourceFile);
           FileLocationEntryFilenames.Add(SourceFile);
           NewFileEntry^.LocationEntry := FileLocationEntries.Count-1;
           NewFileEntry^.LocationEntry := FileLocationEntries.Count-1;
           if NewFileEntry^.FileType = ftUninstExe then
           if NewFileEntry^.FileType = ftUninstExe then
-            Include(NewFileLocationEntry^.Flags, floIsUninstExe);
+            Include(NewFileLocationEntryExtraInfo^.Flags, floIsUninstExe);
           Inc6464(TotalBytesToCompress, FileListRec.Size);
           Inc6464(TotalBytesToCompress, FileListRec.Size);
           if SetupHeader.CompressMethod <> cmStored then
           if SetupHeader.CompressMethod <> cmStored then
             Include(NewFileLocationEntry^.Flags, floChunkCompressed);
             Include(NewFileLocationEntry^.Flags, floChunkCompressed);
           if shEncryptionUsed in SetupHeader.Options then
           if shEncryptionUsed in SetupHeader.Options then
             Include(NewFileLocationEntry^.Flags, floChunkEncrypted);
             Include(NewFileLocationEntry^.Flags, floChunkEncrypted);
           if SolidBreak and UseSolidCompression then begin
           if SolidBreak and UseSolidCompression then begin
-            Include(NewFileLocationEntry^.Flags, floSolidBreak);
+            Include(NewFileLocationEntryExtraInfo^.Flags, floSolidBreak);
             { If the entry matches multiple files, it should only break prior
             { If the entry matches multiple files, it should only break prior
               to compressing the first one }
               to compressing the first one }
             SolidBreak := False;
             SolidBreak := False;
           end;
           end;
         end;
         end;
         if Touch then
         if Touch then
-          Include(NewFileLocationEntry^.Flags, floApplyTouchDateTime);
+          Include(NewFileLocationEntryExtraInfo^.Flags, floApplyTouchDateTime);
         { Note: "nocompression"/"noencryption" on one file makes all merged
         { Note: "nocompression"/"noencryption" on one file makes all merged
           copies uncompressed/unencrypted too }
           copies uncompressed/unencrypted too }
         if NoCompression then
         if NoCompression then
@@ -4854,7 +4869,7 @@ type
         if NoEncryption then
         if NoEncryption then
           Exclude(NewFileLocationEntry^.Flags, floChunkEncrypted);
           Exclude(NewFileLocationEntry^.Flags, floChunkEncrypted);
         if Sign <> fsNoSetting then
         if Sign <> fsNoSetting then
-          ApplyNewSign(NewFileLocationEntry.Sign, Sign, SCompilerParamErrorBadCombo3);
+          ApplyNewSign(NewFileLocationEntryExtraInfo.Sign, Sign, SCompilerParamErrorBadCombo3);
       end
       end
       else begin
       else begin
         NewFileEntry^.SourceFilename := SourceFile;
         NewFileEntry^.SourceFilename := SourceFile;
@@ -4863,7 +4878,8 @@ type
 
 
       { Read version info }
       { Read version info }
       if not ExternalFile and not(foIgnoreVersion in NewFileEntry^.Options) and
       if not ExternalFile and not(foIgnoreVersion in NewFileEntry^.Options) and
-         (NewFileLocationEntry^.Flags * [floVersionInfoValid, floVersionInfoNotValid] = []) then begin
+         (NewFileLocationEntry^.Flags * [floVersionInfoValid] = []) and
+         (NewFileLocationEntryExtraInfo^.Flags * [floVersionInfoNotValid] = []) then begin
         AddStatus(Format(SCompilerStatusFilesVerInfo, [SourceFile]));
         AddStatus(Format(SCompilerStatusFilesVerInfo, [SourceFile]));
         if GetVersionNumbers(SourceFile, VersionNumbers) then begin
         if GetVersionNumbers(SourceFile, VersionNumbers) then begin
           NewFileLocationEntry^.FileVersionMS := VersionNumbers.MS;
           NewFileLocationEntry^.FileVersionMS := VersionNumbers.MS;
@@ -4871,7 +4887,7 @@ type
           Include(NewFileLocationEntry^.Flags, floVersionInfoValid);
           Include(NewFileLocationEntry^.Flags, floVersionInfoValid);
         end
         end
         else
         else
-          Include(NewFileLocationEntry^.Flags, floVersionInfoNotValid);
+          Include(NewFileLocationEntryExtraInfo^.Flags, floVersionInfoNotValid);
       end;
       end;
 
 
       { Safety checks }
       { Safety checks }
@@ -6820,6 +6836,7 @@ var
     ChunkCompressed: Boolean;
     ChunkCompressed: Boolean;
     I: Integer;
     I: Integer;
     FL: PSetupFileLocationEntry;
     FL: PSetupFileLocationEntry;
+    FLExtraInfo: PFileLocationEntryExtraInfo;
     FT: TFileTime;
     FT: TFileTime;
     SourceFile: TFile;
     SourceFile: TFile;
     SignatureAddress, SignatureSize: Cardinal;
     SignatureAddress, SignatureSize: Cardinal;
@@ -6848,10 +6865,11 @@ var
 
 
       for I := 0 to FileLocationEntries.Count-1 do begin
       for I := 0 to FileLocationEntries.Count-1 do begin
         FL := FileLocationEntries[I];
         FL := FileLocationEntries[I];
+        FLExtraInfo := FileLocationEntryExtraInfos[I];
 
 
-        if FL.Sign <> fsNoSetting then begin
+        if FLExtraInfo.Sign <> fsNoSetting then begin
           var SignatureFound := False;
           var SignatureFound := False;
-          if FL.Sign in [fsOnce, fsCheck] then begin
+          if FLExtraInfo.Sign in [fsOnce, fsCheck] then begin
             { Check the file for a signature }
             { Check the file for a signature }
             SourceFile := TFile.Create(FileLocationEntryFilenames[I],
             SourceFile := TFile.Create(FileLocationEntryFilenames[I],
               fdOpenExisting, faRead, fsRead);
               fdOpenExisting, faRead, fsRead);
@@ -6866,13 +6884,13 @@ var
             end;
             end;
           end;
           end;
 
 
-          if (FL.Sign = fsYes) or ((FL.Sign = fsOnce) and not SignatureFound) then begin
+          if (FLExtraInfo.Sign = fsYes) or ((FLExtraInfo.Sign = fsOnce) and not SignatureFound) then begin
             AddStatus(Format(SCompilerStatusSigningSourceFile, [FileLocationEntryFilenames[I]]));
             AddStatus(Format(SCompilerStatusSigningSourceFile, [FileLocationEntryFilenames[I]]));
             Sign(FileLocationEntryFilenames[I]);
             Sign(FileLocationEntryFilenames[I]);
             CallIdleProc;
             CallIdleProc;
-          end else if FL.Sign = fsOnce then
+          end else if FLExtraInfo.Sign = fsOnce then
             AddStatus(Format(SCompilerStatusSourceFileAlreadySigned, [FileLocationEntryFilenames[I]]))
             AddStatus(Format(SCompilerStatusSourceFileAlreadySigned, [FileLocationEntryFilenames[I]]))
-          else if (FL.Sign = fsCheck) and not SignatureFound then
+          else if (FLExtraInfo.Sign = fsCheck) and not SignatureFound then
             AbortCompileFmt(SCompilerSourceFileNotSigned, [FileLocationEntryFilenames[I]]);
             AbortCompileFmt(SCompilerSourceFileNotSigned, [FileLocationEntryFilenames[I]]);
         end;
         end;
 
 
@@ -6896,7 +6914,7 @@ var
               - the compression or encryption status of this file is
               - the compression or encryption status of this file is
                 different from the previous file(s) in the chunk }
                 different from the previous file(s) in the chunk }
             if not UseSolidCompression or
             if not UseSolidCompression or
-               (floSolidBreak in FL.Flags) or
+               (floSolidBreak in FLExtraInfo.Flags) or
                (ChunkCompressed <> (floChunkCompressed in FL.Flags)) or
                (ChunkCompressed <> (floChunkCompressed in FL.Flags)) or
                (CH.ChunkEncrypted <> (floChunkEncrypted in FL.Flags)) then
                (CH.ChunkEncrypted <> (floChunkEncrypted in FL.Flags)) then
               FinalizeChunk(CH, I-1);
               FinalizeChunk(CH, I-1);
@@ -6924,7 +6942,7 @@ var
           end
           end
           else
           else
             FileTimeToLocalFileTime(FT, FL.SourceTimeStamp);
             FileTimeToLocalFileTime(FT, FL.SourceTimeStamp);
-          if floApplyTouchDateTime in FL.Flags then
+          if floApplyTouchDateTime in FLExtraInfo.Flags then
             ApplyTouchDateTime(FL.SourceTimeStamp);
             ApplyTouchDateTime(FL.SourceTimeStamp);
           if TimeStampRounding > 0 then
           if TimeStampRounding > 0 then
             Dec64(Integer64(FL.SourceTimeStamp), Mod64(Integer64(FL.SourceTimeStamp), TimeStampRounding * 10000000));
             Dec64(Integer64(FL.SourceTimeStamp), Mod64(Integer64(FL.SourceTimeStamp), TimeStampRounding * 10000000));

+ 3 - 6
Projects/Src/Shared.Struct.pas

@@ -33,7 +33,7 @@ const
     this file it's recommended you change SetupID. Any change will do (like
     this file it's recommended you change SetupID. Any change will do (like
     changing the letters or numbers), as long as your format is
     changing the letters or numbers), as long as your format is
     unrecognizable by the standard Inno Setup. }
     unrecognizable by the standard Inno Setup. }
-  SetupID: TSetupID = 'Inno Setup Setup Data (6.4.2)';
+  SetupID: TSetupID = 'Inno Setup Setup Data (6.4.3)';
   UninstallLogID: array[Boolean] of TUninstallLogID =
   UninstallLogID: array[Boolean] of TUninstallLogID =
     ('Inno Setup Uninstall Log (b)', 'Inno Setup Uninstall Log (b) 64-bit');
     ('Inno Setup Uninstall Log (b)', 'Inno Setup Uninstall Log (b) 64-bit');
   MessagesHdrID: TMessagesHdrID = 'Inno Setup Messages (6.4.0) (u)';
   MessagesHdrID: TMessagesHdrID = 'Inno Setup Messages (6.4.0) (u)';
@@ -247,7 +247,6 @@ const
   SetupFileLocationEntryStrings = 0;
   SetupFileLocationEntryStrings = 0;
   SetupFileLocationEntryAnsiStrings = 0;
   SetupFileLocationEntryAnsiStrings = 0;
 type
 type
-  TSetupFileLocationSign = (fsNoSetting, fsYes, fsOnce, fsCheck);
   PSetupFileLocationEntry = ^TSetupFileLocationEntry;
   PSetupFileLocationEntry = ^TSetupFileLocationEntry;
   TSetupFileLocationEntry = packed record
   TSetupFileLocationEntry = packed record
     FirstSlice, LastSlice: Integer;
     FirstSlice, LastSlice: Integer;
@@ -258,10 +257,8 @@ type
     SHA256Sum: TSHA256Digest;
     SHA256Sum: TSHA256Digest;
     SourceTimeStamp: TFileTime;
     SourceTimeStamp: TFileTime;
     FileVersionMS, FileVersionLS: DWORD;
     FileVersionMS, FileVersionLS: DWORD;
-    Flags: set of (floVersionInfoValid, floVersionInfoNotValid, floTimeStampInUTC,
-      floIsUninstExe, floCallInstructionOptimized, floApplyTouchDateTime,
-      floChunkEncrypted, floChunkCompressed, floSolidBreak);
-    Sign: TSetupFileLocationSign;
+    Flags: set of (floVersionInfoValid, floTimeStampInUTC, floCallInstructionOptimized,
+      floChunkEncrypted, floChunkCompressed);
   end;
   end;
 const
 const
   SetupIconEntryStrings = 13;
   SetupIconEntryStrings = 13;