EstimatedSize registry value not being set for files extracted to app?

22 views
Skip to first unread message

Bill Stewart

unread,
Aug 11, 2026, 1:16:47 PM (2 days ago) Aug 11
to innosetup
I am testing an installer that extracts a downloaded file to {app}, and it seems that the EstimatedSize registry value isn't being set it the registry. Is this by design?

Martijn Laan - Inno Setup

unread,
Aug 11, 2026, 1:44:47 PM (2 days ago) Aug 11
to innosetup
This is likely because you set ExternalSize to 0, saw that in your earlier post. It should actually be set to total uncompressed size of all extracted files, see the help file.

It impacts the progress bar and I think also EstimatedSize, which I didn't realize before.

I suppose it could recalculate this during/after installation, to make sure at least EstimatedSize is always correct. But it doesn't do that now I think (didn't check yet).

Also note this bit from the help file, about the progress bar: If the specified size does not match the actual size, Setup's progress bar will automatically adjust by skipping ahead or pausing as needed during installation.

Greetings,
Martijn 



-------- Original Message --------

On Tuesday, 08/11/26 at 19:16 'Bill Stewart' via innosetup <inno...@googlegroups.com> wrote:
I am testing an installer that extracts a downloaded file to {app}, and it seems that the EstimatedSize registry value isn't being set it the registry. Is this by design?

--
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/d3907f39-012e-4fae-91d5-5e9aca5103dcn%40googlegroups.com.

Bill Stewart

unread,
Aug 11, 2026, 2:20:03 PM (2 days ago) Aug 11
to innosetup
On Tuesday, August 11, 2026 at 11:44:47 AM UTC-6 Martijn Laan - Inno Setup wrote:

This is likely because you set ExternalSize to 0, saw that in your earlier post. It should actually be set to total uncompressed size of all extracted files, see the help file.

In my installer the ExternalSize is not known prior to runtime since the download filename is calculated dynamically (application version as well as platform architecture).

I suppose it could recalculate this during/after installation, to make sure at least EstimatedSize is always correct. But it doesn't do that now I think (didn't check yet).

For now I have worked around this by creating a function:

function GetDirSize(const DirName: string): Int64;
var
  FindRec: TFindRec;
  FilePath: string;
  Size: Int64;
begin
  result := 0;
  if FindFirst(AddBackslash(DirName) + '*', FindRec) then
  try
    repeat
      if (FindRec.Name <> '.') and (FindRec.Name <> '..') then
      begin
        FilePath := AddBackslash(DirName) + FindRec.Name;
        if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0 then
          Size := GetDirSize(FilePath)
        else
          Size := (Int64(FindRec.SizeHigh) shl 32) + FindRec.SizeLow;
        result := result + Size;
      end;
    until not FindNext(FindRec);
  finally
    FindClose(FindRec);
  end;
end;

I use this in CurStepChanged at ssPostInstall time:

procedure CurStepChanged(CurStep: TSetupStep);
var
  Size: Int64;
  RootKey: Integer;
  SubKeyName: string;
begin
  if CurStep = ssPostInstall then
  begin
    Size := GetDirSize(ExpandConstant('{app}'));
    if Size > 0 then
    begin
      Size := Round(Size / 1024);
      if IsAdminInstallMode() then
        RootKey := HKLM
      else
        RootKey := HKCU;
      SubKeyName := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{#AppID}_is1';
      RegWriteDWORDValue(RootKey, SubKeyName, 'EstimatedSize', Size);
    end;
  end;
end;

It would be "nice to have" if I didn't have to do the extra steps.

Reply all
Reply to author
Forward
0 new messages