Extraction speed and/or built in hash-check

36 views
Skip to first unread message

Fabian Grob

unread,
Sep 2, 2025, 10:47:16 AM (5 days ago) Sep 2
to innosetup
The help for my software is a website, which I copy with the installer. It contains a lot of small files (~12000 files, ~500MB size).

The installation is a lot faster, when I pack all the files into one 7z-archive, install the archive and then extract it manually with ExtractArchive instead of add all the files to the [Files]-section.

Can I somehow improve the speed with the files in the [Files]-section? Or can the speed in general be improved somehow?


If not:
I want somehow compare the existing 7z-file with the one in the installer. If they are equal, the file does not have to be installed and extracted. I currently do this with a custom method in the "check"-parameter of my [Files]-entry calling checkHash.

Function checkHash(verifyHash: String): Boolean;
Var
  filePath: String;
Begin
  Result := true;
  filePath := ExpandConstant(CurrentFileName);
  if FileExists(filePath) Then
    Begin
      Result := LowerCase(GetSHA256OfFile(filePath)) <> LowerCase(verifyHash);
    End;
End;

It would be nice to have such a functionality built in. As far as I know currently only the version of the file or the timestamp can be compared, but first works only for Executables and DLLs and second is not recommended by the help.

Martijn Laan

unread,
Sep 3, 2025, 4:42:59 AM (4 days ago) Sep 3
to innosetup
Hi,

Op 2-9-2025 om 16:47 schreef 'Fabian Grob' via innosetup:
The help for my software is a website, which I copy with the installer. It contains a lot of small files (~12000 files, ~500MB size).

The installation is a lot faster, when I pack all the files into one 7z-archive, install the archive and then extract it manually with ExtractArchive instead of add all the files to the [Files]-section.

Can I somehow improve the speed with the files in the [Files]-section? Or can the speed in general be improved somehow?

You can't really compare ExtractArchive and [Files]. ExtractArchive is a straight forward extraction of the entire archive which does very few other things, it doesn't even show progress. The [Files] section uses a per-file extraction which does many things, per file, and that's why the docs say not to use a solid archive.

To extract an entire archive but still show progress use CreateExtractionPage instead of ExtractArchive. It doesn't do anything else extra compared to ExtractArchive so it should be fast as possible, but it also requires you to do the other stuff manually, like handling uninstallation, probably by adding an [UninstallDelete] entry.


I want somehow compare the existing 7z-file with the one in the installer. If they are equal, the file does not have to be installed and extracted. I currently do this with a custom method in the "check"-parameter of my [Files]-entry calling checkHash.

There's not enough information in your question, for example details on how this 7z-file is 'installed and extracted' are missing, but Setup has built-in support for hash comparisons between an already existing file and the new file if they both have version numbers. It does this when you set the replacesameversion flag and the existing file and the new file have the same version number.

Greetings,
Martijn Laan

Fabian Grob

unread,
Sep 3, 2025, 5:07:59 AM (4 days ago) Sep 3
to innosetup
Hi,

I install the 7z-file with an entry in the [Files]-section:
[Files]
Source: "Shared\Help\Help.7z"; DestDir: {app}\docs; Check: checkHash('a5c00063b7a7a15d922d3934bfe98184d7c7a5db5602327e729a1f85de90d893') AND includeHelpFiles(); AfterInstall: extractAfterInstall();

My goal is to not install the file (and thus not trigger AfterInstall) if this exact same file already exists.

Something like the (not recommended) flag 'comparetimestamp', which does not compare the timestamp but the hash of the files.

My current solution works but in my opinion it has the big downside, that when I want to install a new Help.7z that I always also have to adjust the hash in the installer - if the hash would be generated and stored at compiletime, this would be much easier.

Thanks!

Martijn Laan

unread,
Sep 3, 2025, 5:15:22 AM (4 days ago) Sep 3
to innosetup
Hi,

You should really use CreateExtractionPage to extract such a big file.

For the hash to can use ISPP's GetSHA256OfFile to generate and store it at compile time.

Greetings,
Martijn

Op 3-9-2025 om 11:07 schreef 'Fabian Grob' via innosetup:
--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/innosetup/1e20889e-0ac1-4870-bc77-bb8b71924a23n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages