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