Ver Fonte

Improve the ISSigVerifyError exceptions a bit, without requiring a Default.isl change.

Martijn Laan há 4 meses atrás
pai
commit
5e106ba1c2
1 ficheiros alterados com 6 adições e 6 exclusões
  1. 6 6
      Projects/Src/Setup.Install.pas

+ 6 - 6
Projects/Src/Setup.Install.pas

@@ -250,10 +250,10 @@ begin
   end;
   end;
 end;
 end;
 
 
-procedure ISSigVerifyError(const AReason: String);
+procedure ISSigVerifyError(const AReason, AExceptionMessage: String);
 begin
 begin
   Log('ISSig verification error: ' + AddPeriod(AReason));
   Log('ISSig verification error: ' + AddPeriod(AReason));
-  raise Exception.Create(SetupMessages[msgSourceIsCorrupted]);
+  raise Exception.Create(AExceptionMessage);
 end;
 end;
 
 
 procedure CopySourceFileToDestFile(const SourceF, DestF: TFile;
 procedure CopySourceFileToDestFile(const SourceF, DestF: TFile;
@@ -279,7 +279,7 @@ begin
   if ISSigVerify then begin
   if ISSigVerify then begin
     { See Compiler.SetupCompiler's TSetupCompiler.Compile for similar code }
     { See Compiler.SetupCompiler's TSetupCompiler.Compile for similar code }
     if not NewFileExists(ISSigFilename) then
     if not NewFileExists(ISSigFilename) then
-      ISSigVerifyError(ISSigMissingFile);
+      ISSigVerifyError(ISSigMissingFile, FmtSetupMessage1(msgSourceDoesntExist, ISSigFilename));
     const SigText = ISSigLoadTextFromFile(ISSigFilename);
     const SigText = ISSigLoadTextFromFile(ISSigFilename);
     var ExpectedFileSize: Int64;
     var ExpectedFileSize: Int64;
     const VerifyResult = ISSigVerifySignatureText(ISSigKeys, SigText,
     const VerifyResult = ISSigVerifySignatureText(ISSigKeys, SigText,
@@ -292,10 +292,10 @@ begin
       else
       else
         VerifyResultAsString := ISSigUnknownVerifyResult;
         VerifyResultAsString := ISSigUnknownVerifyResult;
       end;
       end;
-      ISSigVerifyError(VerifyResultAsString);
+      ISSigVerifyError(VerifyResultAsString, SetupMessages[msgSourceIsCorrupted]);
     end;
     end;
     if Int64(SourceF.Size) <> ExpectedFileSize then
     if Int64(SourceF.Size) <> ExpectedFileSize then
-      ISSigVerifyError(ISSigFileSizeIncorrect);
+      ISSigVerifyError(ISSigFileSizeIncorrect, SetupMessages[msgSourceIsCorrupted]);
     { ExpectedFileHash checked below after copy }
     { ExpectedFileHash checked below after copy }
 
 
     SHA256Init(Context);
     SHA256Init(Context);
@@ -335,7 +335,7 @@ begin
 
 
   if ISSigVerify then
   if ISSigVerify then
     if not SHA256DigestsEqual(SHA256Final(Context), ExpectedFileHash) then
     if not SHA256DigestsEqual(SHA256Final(Context), ExpectedFileHash) then
-      ISSigVerifyError(ISSigFileHashIncorrect);
+      ISSigVerifyError(ISSigFileHashIncorrect, SetupMessages[msgSourceIsCorrupted]);
 
 
   { In case the source file was shorter than we thought it was, bump the
   { In case the source file was shorter than we thought it was, bump the
     progress bar to the maximum amount }
     progress bar to the maximum amount }