2
0
Эх сурвалжийг харах

Output LastError if GetFileTime fails.

Martijn Laan 6 жил өмнө
parent
commit
9300c2c17b

+ 1 - 0
Projects/CompMsgs.pas

@@ -168,6 +168,7 @@ const
   SCompilerCompileCodeError = 'An error occurred while trying to compile the [Code] section:' + SNewLine2 + '%s';
   SCompilerISCryptMissing = 'Cannot use encryption because ISCrypt.dll is missing.' + SNewLine2 +
     'Note: This file is not installed with Inno Setup. A link to obtain it can be found on the Inno Setup web site';
+  SCompilerFunctionFailedWithCode = '%s failed. Error %d: %s';
 
   { [Setup] }
   SCompilerUnknownDirective = 'Unrecognized [%s] section directive "%s"';

+ 10 - 7
Projects/Compile.pas

@@ -1094,16 +1094,16 @@ begin
     if not CryptAcquireContext(CryptProv, nil, nil, PROV_RSA_FULL,
        CRYPT_VERIFYCONTEXT) then begin
       ErrorCode := GetLastError;
-      raise Exception.CreateFmt('CryptAcquireContext failed with code 0x%.8x: %s',
-        [ErrorCode, Win32ErrorString(ErrorCode)]);
+      raise Exception.CreateFmt(SCompilerFunctionFailedWithCode,
+        ['CryptAcquireContext', ErrorCode, Win32ErrorString(ErrorCode)]);
     end;
     { Note: CryptProv is released in the 'finalization' section of this unit }
   end;
   FillChar(Buffer, Bytes, 0);
   if not CryptGenRandom(CryptProv, Bytes, @Buffer) then begin
     ErrorCode := GetLastError;
-    raise Exception.CreateFmt('CryptGenRandom failed with code 0x%.8x: %s',
-      [ErrorCode, Win32ErrorString(ErrorCode)]);
+    raise Exception.CreateFmt(SCompilerFunctionFailedWithCode,
+      ['CryptGenRandom', ErrorCode, Win32ErrorString(ErrorCode)]);
   end;
 end;
 
@@ -8134,7 +8134,7 @@ var
     FT: TFileTime;
     SourceFile: TFile;
     SignatureAddress, SignatureSize: Cardinal;
-    HdrChecksum: DWORD;
+    HdrChecksum, ErrorCode: DWORD;
   begin
     if (SetupHeader.CompressMethod in [cmLZMA, cmLZMA2]) and
        (CompressProps.WorkerProcessFilename <> '') then
@@ -8229,8 +8229,11 @@ var
           FL.ChunkSuboffset := CH.ChunkBytesRead;
           FL.OriginalSize := SourceFile.Size;
 
-          if not GetFileTime(SourceFile.Handle, nil, nil, @FT) then
-            AbortCompile('CompressFiles: GetFileTime failed');
+          if not GetFileTime(SourceFile.Handle, nil, nil, @FT) then begin
+            ErrorCode := GetLastError;
+            AbortCompileFmt(SCompilerFunctionFailedWithCode,
+              ['CompressFiles: GetFileTime', ErrorCode, Win32ErrorString(ErrorCode)]);
+          end;
           if TimeStampsInUTC then begin
             FL.SourceTimeStamp := FT;
             Include(FL.Flags, foTimeStampInUTC);

+ 5 - 0
whatsnew.htm

@@ -26,6 +26,11 @@ Portions Copyright &copy; 2000-2019 Martijn Laan. All rights reserved.<br />
 For conditions of distribution and use, see <a href="http://www.jrsoftware.org/files/is/license.txt">LICENSE.TXT</a>.
 </p>
 
+<p><a name="6.0.4"></a><span class="ver">6.0.4-dev </span><span class="date">(?)</span></p>
+<ul>
+  <li>Minor tweaks.</li>
+</ul>
+
 <p><a name="6.0.3"></a><span class="ver">6.0.3 </span><span class="date">(2019-10-11)</span></p>
 <ul>
   <li>/LOG: Now logs Windows compatibility mode when this is activated by the user.</li>