|
@@ -88,6 +88,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;
|
|
@@ -309,6 +310,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, floISSigVerify);
|
|
|
|
+ Sign: TFileLocationSign;
|
|
|
|
+ end;
|
|
|
|
+
|
|
var
|
|
var
|
|
ZipInitialized, BzipInitialized, LZMAInitialized: Boolean;
|
|
ZipInitialized, BzipInitialized, LZMAInitialized: Boolean;
|
|
PreprocessorInitialized: Boolean;
|
|
PreprocessorInitialized: Boolean;
|
|
@@ -365,6 +374,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;
|
|
@@ -412,6 +422,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;
|
|
@@ -4582,7 +4593,7 @@ const
|
|
'solidbreak', 'setntfscompression', 'unsetntfscompression',
|
|
'solidbreak', 'setntfscompression', 'unsetntfscompression',
|
|
'sortfilesbyname', 'gacinstall', 'sign', 'signonce', 'signcheck',
|
|
'sortfilesbyname', 'gacinstall', 'sign', 'signonce', 'signcheck',
|
|
'issigverify');
|
|
'issigverify');
|
|
- 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');
|
|
@@ -4594,12 +4605,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
|
|
@@ -4828,8 +4840,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,
|
|
@@ -4887,33 +4899,36 @@ 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);
|
|
if foISSigVerify in NewFileEntry^.Options then
|
|
if foISSigVerify in NewFileEntry^.Options then
|
|
- Include(NewFileLocationEntry^.Flags, floISSigVerify);
|
|
|
|
|
|
+ Include(NewFileLocationEntryExtraInfo^.Flags, floISSigVerify);
|
|
{ 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
|
|
@@ -4921,7 +4936,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;
|
|
@@ -4930,7 +4945,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;
|
|
@@ -4938,7 +4954,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 }
|
|
@@ -6901,6 +6917,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;
|
|
@@ -6943,10 +6960,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);
|
|
@@ -6961,13 +6979,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;
|
|
|
|
|
|
@@ -6985,7 +7003,7 @@ var
|
|
fdOpenExisting, faRead, fsRead);
|
|
fdOpenExisting, faRead, fsRead);
|
|
try
|
|
try
|
|
var ExpectedFileHash: TSHA256Digest;
|
|
var ExpectedFileHash: TSHA256Digest;
|
|
- if floISSigVerify in FL.Flags then begin
|
|
|
|
|
|
+ if floISSigVerify in FLExtraInfo.Flags then begin
|
|
if Length(ISSigKeys) = 0 then { shouldn't fail: flag stripped already }
|
|
if Length(ISSigKeys) = 0 then { shouldn't fail: flag stripped already }
|
|
AbortCompileFmt(SCompilerCompressInternalError, ['Length(ISSigKeys) = 0']);
|
|
AbortCompileFmt(SCompilerCompressInternalError, ['Length(ISSigKeys) = 0']);
|
|
const SigFilename = FileLocationEntryFilenames[I] + '.issig';
|
|
const SigFilename = FileLocationEntryFilenames[I] + '.issig';
|
|
@@ -7019,7 +7037,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);
|
|
@@ -7047,7 +7065,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));
|
|
@@ -7058,7 +7076,7 @@ var
|
|
CH.CompressFile(SourceFile, FL.OriginalSize,
|
|
CH.CompressFile(SourceFile, FL.OriginalSize,
|
|
floCallInstructionOptimized in FL.Flags, FL.SHA256Sum);
|
|
floCallInstructionOptimized in FL.Flags, FL.SHA256Sum);
|
|
|
|
|
|
- if floISSigVerify in FL.Flags then
|
|
|
|
|
|
+ if floISSigVerify in FLExtraInfo.Flags then
|
|
if not SHA256DigestsEqual(FL.SHA256Sum, ExpectedFileHash) then
|
|
if not SHA256DigestsEqual(FL.SHA256Sum, ExpectedFileHash) then
|
|
AbortCompileFmt(SCompilerSourceFileISSigInvalidSignature,
|
|
AbortCompileFmt(SCompilerSourceFileISSigInvalidSignature,
|
|
[FileLocationEntryFilenames[I], SCompilerSourceFileISSigFileHashIncorrect]);
|
|
[FileLocationEntryFilenames[I], SCompilerSourceFileISSigFileHashIncorrect]);
|