1

Microsoft Store seems to require nowadays a quite few EXE RETURN (exit) codes during Silent setup that are not available by default. How to e.g. return an exit code when the DISK is FULL? I can see its possible to return error code when reboot is required with /RESTARTEXITCODE=exit but it would be required to have exit codes also in these cases:

I can see the current Inno Setup exit codes here:
https://jrsoftware.org/ishelp/index.php?topic=setupexitcodes

Tom
  • 6,725
  • 24
  • 95
  • 159
  • Hey Tom, I am facing the same problem. How did you go about solving this? Did you manage to implement all the exit codes, or did you take another route? – Wayne Aug 12 '23 at 21:24

1 Answers1

1

Imo, you cannot really implement this cleanly in Inno Setup. You would have to re-implement the disk space check and forcefully abort the installation with the required custom exit code.

I recommend you add a "Store installation" command-line switch to your installer to enable all Store-related hacks you will likely need to implement.

Something like this:

[Code]

function IsStoreInstallation: Boolean;
begin
  Result := WizardSilent() and CmdLineParamExists('/StoreInstallation');
end;

procedure StoreInstallationExit(Code: Integer);
begin
  Log(Format('Aborting store installation with code %d', [Code]));
  ExitProcess(Code);
end;

function PrepareToInstall(var NeedsRestart: Boolean): String;
var
  Free, Total: Int64;
  AbortCode: Integer;
begin
  Log('prepare');
  if IsStoreInstallation() then
  begin
    Log('Store installation, checking for available disk space');
    AbortCode := 0;
    if not GetSpaceOnDisk64(WizardDirValue, Free, Total) then
    begin
      Log('Failed to check for available disk space, aborting');
      AbortCode := 15;
    end
      else
    if Free < Int64(10) * 1024 * 1024 then
    begin
      Log(Format('Too low available disk space (%s), aborting', [
        IntToStr(Free)]));
      AbortCode := 15;
    end
      else
    begin
      Log(Format('Enough available disk space (%s)', [IntToStr(Free)]));
    end;

    if AbortCode <> 0 then 
    begin
      StoreInstallationExit(AbortCode);
    end;
  end;
end;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992