Browse Source

Add CheckTrust setting at the right level.

Martijn Laan 3 months ago
parent
commit
273d83e2c3

+ 1 - 0
Projects/Src/Compiler.SetupCompiler.pas

@@ -7562,6 +7562,7 @@ begin
     CompressMethod := cmLZMA2;
     CompressLevel := clLZMAMax;
     CompressProps := TLZMACompressorProps.Create;
+    CompressProps.WorkerProcessCheckTrust := True;
     UseSetupLdr := True;
     TerminalServicesAware := True;
     DEPCompatible := True;

+ 6 - 2
Projects/Src/Compression.LZMACompressor.pas

@@ -40,6 +40,7 @@ type
     NumBlockThreads: Integer;
     NumFastBytes: Integer;
     NumThreads: Integer;
+    WorkerProcessCheckTrust: Boolean;
     WorkerProcessFilename: String;
     constructor Create;
   end;
@@ -882,7 +883,6 @@ const
 var
   EncProps: TLZMAEncoderProps;
   Props: TLZMACompressorProps;
-  WorkerProcessFilename: String;
 begin
   if (CompressionLevel < Low(algorithm)) or (CompressionLevel > High(algorithm)) then
     LZMAInternalError('TLZMACompressor.Create got invalid CompressionLevel ' + IntToStr(CompressionLevel));
@@ -895,6 +895,9 @@ begin
   EncProps.NumFastBytes := numFastBytes[CompressionLevel];
   EncProps.NumThreads := -1;
 
+  var WorkerProcessCheckTrust := False;
+  var WorkerProcessFilename := '';
+
   if ACompressorProps is TLZMACompressorProps then begin
     Props := (ACompressorProps as TLZMACompressorProps);
     if Props.Algorithm <> -1 then
@@ -910,6 +913,7 @@ begin
       EncProps.NumFastBytes := Props.NumFastBytes;
     if Props.NumThreads <> 0 then
       EncProps.NumThreads := Props.NumThreads;
+    WorkerProcessCheckTrust := Props.WorkerProcessCheckTrust;
     WorkerProcessFilename := Props.WorkerProcessFilename;
   end;
 
@@ -917,7 +921,7 @@ begin
 
   if WorkerProcessFilename <> '' then begin
     FWorker := TLZMAWorkerProcess.Create(@FEvents);
-    (FWorker as TLZMAWorkerProcess).CheckTrust := True;
+    (FWorker as TLZMAWorkerProcess).CheckTrust := WorkerProcessCheckTrust;
     (FWorker as TLZMAWorkerProcess).ExeFilename := WorkerProcessFilename;
   end
   else begin