浏览代码

Add constants support to ExtractArchivePassword + cleanup: take password from CurFile param if available.

Martijn Laan 3 月之前
父节点
当前提交
73f39438c5
共有 4 个文件被更改,包括 12 次插入9 次删除
  1. 1 1
      ISHelp/isetup.xml
  2. 2 1
      Projects/Src/Compiler.SetupCompiler.pas
  3. 4 3
      Projects/Src/Setup.Install.pas
  4. 5 4
      Projects/Src/Setup.MainFunc.pas

+ 1 - 1
ISHelp/isetup.xml

@@ -1665,7 +1665,7 @@ ExternalSize: 1_048_576; Flags: external
 </param>
 
 <param name="ExtractArchivePassword">
-<p>Specifies the password of the archive. Please be aware that this password is stored in an unencrypted form in the resulting Setup file(s), even if you have enabled encryption (using the [Setup] section directive <tt>Encryption</tt>).</p>
+<p>Specifies the password of the archive, which can include constants. Please be aware that this password is stored in an unencrypted form in the resulting Setup file(s), even if you have enabled encryption (using the [Setup] section directive <tt>Encryption</tt>).</p>
 <p>This parameter is ignored if the <tt>extractarchive</tt> flag isn't also specified.</p>
 </param>
 

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

@@ -5485,7 +5485,8 @@ begin
         CheckCheckOrInstall(ParamCommonCheck, Check, cikCheck);
         CheckCheckOrInstall(ParamCommonBeforeInstall, BeforeInstall, cikInstall);
         CheckCheckOrInstall(ParamCommonAfterInstall, AfterInstall, cikInstall);
-      end;
+        CheckConst(ExtractArchivePassword, MinVersion, []);
+     end;
 
       FileList := TList.Create();
       DirList := TList.Create();

+ 4 - 3
Projects/Src/Setup.Install.pas

@@ -1941,7 +1941,7 @@ var
     end;
 
     function RecurseExternalArchiveCopyFiles(const DisableFsRedir: Boolean;
-      const ArchiveFilename, Password: String; const Excludes: TStrings;
+      const ArchiveFilename: String; const Excludes: TStrings;
       const CurFile: PSetupFileEntry; var ExpectedBytesLeft: Integer64;
       var ConfirmOverwriteOverwriteAll, PromptIfOlderOverwriteAll: TOverwriteAll;
       var WarnedPerUserFonts: Boolean): Boolean;
@@ -1982,7 +1982,8 @@ var
             end;
 
             H := ArchiveFindFirstFileRedir(DisableFsRedir, ArchiveFilename, DestDir,
-              Password, foRecurseSubDirsExternal in CurFile^.Options, True, FindData);
+              ExpandConst(CurFile^.ExtractArchivePassword), foRecurseSubDirsExternal in CurFile^.Options,
+              True, FindData);
             Failed := '';
           except
             if ExceptObject is EAbort then
@@ -2098,7 +2099,7 @@ var
               ExpectedBytesLeft := CurFile^.ExternalSize;
               if foExtractArchive in CurFile^.Options then
                 FoundFiles := RecurseExternalArchiveCopyFiles(DisableFsRedir,
-                  SourceWildcard, CurFile^.ExtractArchivePassword, Excludes, CurFile,
+                  SourceWildcard, Excludes, CurFile,
                   ExpectedBytesLeft, ConfirmOverwriteOverwriteAll, PromptIfOlderOverwriteAll,
                   WarnedPerUserFonts)
               else

+ 5 - 4
Projects/Src/Setup.MainFunc.pas

@@ -1804,7 +1804,7 @@ function EnumFiles(const EnumFilesProc: TEnumFilesProc;
   end;
 
   function RecurseExternalArchiveFiles(const DisableFsRedir: Boolean;
-    const ArchiveFilename, Password: String; const Excludes: TStrings;
+    const ArchiveFilename: String; const Excludes: TStrings;
     const CurFile: PSetupFileEntry): Boolean;
   begin
     { See above }
@@ -1816,7 +1816,8 @@ function EnumFiles(const EnumFilesProc: TEnumFilesProc;
 
     var FindData: TWin32FindData;
     var H := ArchiveFindFirstFileRedir(DisableFsRedir, ArchiveFilename, DestDir,
-      Password, foRecurseSubDirsExternal in CurFile^.Options, False, FindData);
+      ExpandConst(CurFile^.ExtractArchivePassword), foRecurseSubDirsExternal in CurFile^.Options,
+      False, FindData);
     if H <> INVALID_HANDLE_VALUE then begin
       try
         repeat
@@ -1869,7 +1870,7 @@ begin
           if foExtractArchive in CurFile^.Options then begin
             try
               if not RecurseExternalArchiveFiles(DisableFsRedir, SourceWildcard,
-                 CurFile^.ExtractArchivePassword, Excludes, CurFile) then
+                 Excludes, CurFile) then
                 Exit(False);
             except on E: ESevenZipError do
               { Ignore archive errors for now, will show up with proper UI during
@@ -3521,7 +3522,7 @@ begin
               if foExtractArchive in Options then begin
                 ExternalSize := RecurseExternalArchiveGetSizeOfFiles(
                   ShouldDisableFsRedirForFileEntry(PSetupFileEntry(Entries[seFile][I])),
-                  ExpandConst(SourceFilename), ExtractArchivePassword, LExcludes,
+                  ExpandConst(SourceFilename), ExpandConst(ExtractArchivePassword), LExcludes,
                   foRecurseSubDirsExternal in Options);
               end else begin
                 if FileType <> ftUserFile then