|
@@ -127,6 +127,7 @@ type
|
|
|
TouchTimeOption: (ttCurrent, ttNone, ttExplicit);
|
|
|
TouchTimeHour, TouchTimeMinute, TouchTimeSecond: Integer;
|
|
|
|
|
|
+ SetupMainHeader: TSetupMainHeader;
|
|
|
SetupHeader: TSetupHeader;
|
|
|
|
|
|
SetupDirectiveLines: array[TSetupSectionDirective] of Integer;
|
|
@@ -631,7 +632,7 @@ end;
|
|
|
|
|
|
function TSetupCompiler.GetEncryptionBaseNonce: TSetupEncryptionNonce;
|
|
|
begin
|
|
|
- Result := SetupHeader.EncryptionBaseNonce;
|
|
|
+ Result := SetupMainHeader.EncryptionBaseNonce;
|
|
|
end;
|
|
|
|
|
|
function TSetupCompiler.GetExeFilename: String;
|
|
@@ -2837,20 +2838,20 @@ begin
|
|
|
end;
|
|
|
ssEncryption: begin
|
|
|
if CompareText(Value, 'full') = 0 then
|
|
|
- SetupHeader.EncryptionUse := euFull
|
|
|
+ SetupMainHeader.EncryptionUse := euFull
|
|
|
else if StrToBool(Value) then
|
|
|
- SetupHeader.EncryptionUse := euFiles
|
|
|
+ SetupMainHeader.EncryptionUse := euFiles
|
|
|
else
|
|
|
- SetupHeader.EncryptionUse := euNone;
|
|
|
+ SetupMainHeader.EncryptionUse := euNone;
|
|
|
end;
|
|
|
ssEncryptionKeyDerivation: begin
|
|
|
if Value = 'pbkdf2' then
|
|
|
- SetupHeader.EncryptionKDFIterations := 200000
|
|
|
+ SetupMainHeader.EncryptionKDFIterations := 200000
|
|
|
else if Copy(Value, 1, 7) = 'pbkdf2/' then begin
|
|
|
I := StrToIntDef(Copy(Value, 8, Maxint), -1);
|
|
|
if I < 1 then
|
|
|
Invalid;
|
|
|
- SetupHeader.EncryptionKDFIterations := I;
|
|
|
+ SetupMainHeader.EncryptionKDFIterations := I;
|
|
|
end else
|
|
|
Invalid;
|
|
|
end;
|
|
@@ -5010,7 +5011,7 @@ type
|
|
|
if NewFileLocationEntry = nil then begin
|
|
|
NewFileLocationEntry := AllocMem(SizeOf(TSetupFileLocationEntry));
|
|
|
NewFileLocationEntryExtraInfo := AllocMem(SizeOf(TFileLocationEntryExtraInfo));
|
|
|
- SetupHeader.CompressMethod := CompressMethod;
|
|
|
+ SetupMainHeader.CompressMethod := CompressMethod;
|
|
|
FileLocationEntries.Add(NewFileLocationEntry);
|
|
|
FileLocationEntryExtraInfos.Add(NewFileLocationEntryExtraInfo);
|
|
|
FileLocationEntryFilenames.Add(SourceFile);
|
|
@@ -5018,9 +5019,9 @@ type
|
|
|
if NewFileEntry^.FileType = ftUninstExe then
|
|
|
Include(NewFileLocationEntryExtraInfo^.Flags, floIsUninstExe);
|
|
|
Inc6464(TotalBytesToCompress, FileListRec.Size);
|
|
|
- if SetupHeader.CompressMethod <> cmStored then
|
|
|
+ if SetupMainHeader.CompressMethod <> cmStored then
|
|
|
Include(NewFileLocationEntry^.Flags, floChunkCompressed);
|
|
|
- if SetupHeader.EncryptionUse <> euNone then
|
|
|
+ if SetupMainHeader.EncryptionUse <> euNone then
|
|
|
Include(NewFileLocationEntry^.Flags, floChunkEncrypted);
|
|
|
if SolidBreak and UseSolidCompression then begin
|
|
|
Include(NewFileLocationEntryExtraInfo^.Flags, floSolidBreak);
|
|
@@ -6891,14 +6892,10 @@ var
|
|
|
const StartPosition = F.Position;
|
|
|
|
|
|
F.WriteBuffer(SetupID, SizeOf(SetupID));
|
|
|
- F.WriteBuffer(SetupHeader.EncryptionUse, SizeOf(SetupHeader.EncryptionUse));
|
|
|
- if SetupHeader.EncryptionUse = euFull then begin
|
|
|
- F.WriteBuffer(SetupHeader.EncryptionKDFSalt, SizeOf(SetupHeader.EncryptionKDFSalt));
|
|
|
- F.WriteBuffer(SetupHeader.EncryptionKDFIterations, SizeOf(SetupHeader.EncryptionKDFIterations));
|
|
|
- F.WriteBuffer(SetupHeader.EncryptionBaseNonce, SizeOf(SetupHeader.EncryptionBaseNonce));
|
|
|
- F.WriteBuffer(SetupHeader.PasswordTest, SizeOf(SetupHeader.PasswordTest));
|
|
|
- F.WriteBuffer(SetupHeader.CompressMethod, SizeOf(SetupHeader.CompressMethod));
|
|
|
- end;
|
|
|
+ const SetupMainHeaderCRC = GetCRC32(SetupMainHeader, SizeOf(SetupMainHeader));
|
|
|
+ F.WriteBuffer(SetupMainHeaderCRC, SizeOf(SetupMainHeaderCRC));
|
|
|
+ F.WriteBuffer(SetupMainHeader, SizeOf(SetupMainHeader));
|
|
|
+
|
|
|
SetupHeader.NumLanguageEntries := LanguageEntries.Count;
|
|
|
SetupHeader.NumCustomMessageEntries := CustomMessageEntries.Count;
|
|
|
SetupHeader.NumPermissionEntries := PermissionEntries.Count;
|
|
@@ -6924,8 +6921,8 @@ var
|
|
|
W := TCompressedBlockWriter.Create(F, TLZMACompressor, InternalCompressLevel,
|
|
|
InternalCompressProps);
|
|
|
try
|
|
|
- if SetupHeader.EncryptionUse = euFull then
|
|
|
- W.InitEncryption(CryptKey, SetupHeader.EncryptionBaseNonce, -2);
|
|
|
+ if SetupMainHeader.EncryptionUse = euFull then
|
|
|
+ W.InitEncryption(CryptKey, SetupMainHeader.EncryptionBaseNonce, -2);
|
|
|
|
|
|
SECompressedBlockWrite(W, SetupHeader, SizeOf(SetupHeader),
|
|
|
SetupHeaderStrings, SetupHeaderAnsiStrings);
|
|
@@ -6985,7 +6982,7 @@ var
|
|
|
W.Write(WizardSmallImages.Count, SizeOf(Integer));
|
|
|
for J := 0 to WizardSmallImages.Count-1 do
|
|
|
WriteStream(WizardSmallImages[J], W);
|
|
|
- if SetupHeader.CompressMethod in [cmZip, cmBzip] then
|
|
|
+ if SetupMainHeader.CompressMethod in [cmZip, cmBzip] then
|
|
|
WriteStream(DecompressorDLL, W);
|
|
|
if SetupHeader.SevenZipLibraryName <> '' then
|
|
|
WriteStream(SevenZipDLL, W);
|
|
@@ -7003,8 +7000,8 @@ var
|
|
|
{ ^ When disk spanning is enabled, the Setup Compiler requires that
|
|
|
FileLocationEntries be a fixed size, so don't compress them }
|
|
|
try
|
|
|
- if SetupHeader.EncryptionUse = euFull then
|
|
|
- W.InitEncryption(CryptKey, SetupHeader.EncryptionBaseNonce, -3);
|
|
|
+ if SetupMainHeader.EncryptionUse = euFull then
|
|
|
+ W.InitEncryption(CryptKey, SetupMainHeader.EncryptionBaseNonce, -3);
|
|
|
for J := 0 to FileLocationEntries.Count-1 do
|
|
|
W.Write(FileLocationEntries[J]^, SizeOf(TSetupFileLocationEntry));
|
|
|
W.Finish;
|
|
@@ -7083,7 +7080,7 @@ var
|
|
|
if not UseCompression then
|
|
|
Result := TStoredCompressor
|
|
|
else begin
|
|
|
- case SetupHeader.CompressMethod of
|
|
|
+ case SetupMainHeader.CompressMethod of
|
|
|
cmStored: begin
|
|
|
Result := TStoredCompressor;
|
|
|
end;
|
|
@@ -7147,7 +7144,7 @@ var
|
|
|
HdrChecksum, ErrorCode: DWORD;
|
|
|
ISSigAvailableKeys: TArrayOfECDSAKey;
|
|
|
begin
|
|
|
- if (SetupHeader.CompressMethod in [cmLZMA, cmLZMA2]) and
|
|
|
+ if (SetupMainHeader.CompressMethod in [cmLZMA, cmLZMA2]) and
|
|
|
(CompressProps.WorkerProcessFilename <> '') then
|
|
|
AddStatus(Format(' Using separate process for LZMA compression (%s)',
|
|
|
[PathExtractName(CompressProps.WorkerProcessFilename)]));
|
|
@@ -7709,6 +7706,7 @@ begin
|
|
|
SevenZipDLL := nil;
|
|
|
|
|
|
try
|
|
|
+ FillChar(SetupMainHeader, SizeOf(SetupMainHeader), 0);
|
|
|
Finalize(SetupHeader);
|
|
|
FillChar(SetupHeader, SizeOf(SetupHeader), 0);
|
|
|
InitDebugInfo;
|
|
@@ -7777,7 +7775,7 @@ begin
|
|
|
NotRecognizedMessagesWarning := True;
|
|
|
UsedUserAreasWarning := True;
|
|
|
SetupHeader.WizardStyle := wsClassic;
|
|
|
- SetupHeader.EncryptionKDFIterations := 220000;
|
|
|
+ SetupMainHeader.EncryptionKDFIterations := 220000;
|
|
|
|
|
|
{ Read [Setup] section }
|
|
|
EnumIniSection(EnumSetupProc, 'Setup', 0, True, True, '', False, False);
|
|
@@ -7924,7 +7922,7 @@ begin
|
|
|
else
|
|
|
VersionInfoProductTextVersion := VersionInfoProductVersionOriginalValue;
|
|
|
end;
|
|
|
- if (SetupHeader.EncryptionUse <> euNone) and (Password = '') then begin
|
|
|
+ if (SetupMainHeader.EncryptionUse <> euNone) and (Password = '') then begin
|
|
|
LineNumber := SetupDirectiveLines[ssEncryption];
|
|
|
AbortCompileFmt(SCompilerEntryMissing2, ['Setup', 'Password']);
|
|
|
end;
|
|
@@ -7995,10 +7993,10 @@ begin
|
|
|
end;
|
|
|
|
|
|
if Password <> '' then begin
|
|
|
- GenerateEncryptionKDFSalt(SetupHeader.EncryptionKDFSalt);
|
|
|
- GenerateEncryptionKey(Password, SetupHeader.EncryptionKDFSalt, SetupHeader.EncryptionKDFIterations, CryptKey);
|
|
|
- GenerateEncryptionBaseNonce(SetupHeader.EncryptionBaseNonce);
|
|
|
- GeneratePasswordTest(CryptKey, SetupHeader.EncryptionBaseNonce, SetupHeader.PasswordTest);
|
|
|
+ GenerateEncryptionKDFSalt(SetupMainHeader.EncryptionKDFSalt);
|
|
|
+ GenerateEncryptionKey(Password, SetupMainHeader.EncryptionKDFSalt, SetupMainHeader.EncryptionKDFIterations, CryptKey);
|
|
|
+ GenerateEncryptionBaseNonce(SetupMainHeader.EncryptionBaseNonce);
|
|
|
+ GeneratePasswordTest(CryptKey, SetupMainHeader.EncryptionBaseNonce, SetupMainHeader.PasswordTest);
|
|
|
Include(SetupHeader.Options, shPassword);
|
|
|
end;
|
|
|
|
|
@@ -8225,7 +8223,7 @@ begin
|
|
|
|
|
|
{ Read decompressor DLL. Must be done after [Files] is parsed, since
|
|
|
SetupHeader.CompressMethod isn't set until then }
|
|
|
- case SetupHeader.CompressMethod of
|
|
|
+ case SetupMainHeader.CompressMethod of
|
|
|
cmZip: begin
|
|
|
AddStatus(Format(SCompilerStatusReadingFile, ['isunzlib.dll']));
|
|
|
DecompressorDLL := CreateMemoryStreamFromFile(CompilerDir + 'isunzlib.dll',
|