Saba
Saba

Reputation: 35

Inno Setup Reboot system on fail

In my Inno Setup project, at some point I run an external command using exec, if exitcode return an error, I have to abort installation and exit.

In order to exit installation I tried to use Abort and WizardForm.Close, in both case, I show a Message through ShowExceptionMessage.

The problem is that after I close the messagebox, the system reboot immediatelly without ask me.

There is a way to avoid the system restart or at least show the choice?

I'm using Inno Setup 6.2.0

EDIT: Below the code:

procedure finalizeInstall;
begin
  try
    if not someOperations() then RaiseException('Some operations has failed');
  except
    ShowExceptionMessage;
    WizardForm.Close;
  end;
end;

        
procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then finalizeInstall;
end;

As described above, in case someOperations() fails, after I click OK on ShowExceptionMessage, the system restarts immediately.

I tried also to move WizardForm.Close to the CurStepChanged procedure but the final result is the same.

When I have to abort the installation due to an error, what I would like is to close WizardForm but without the system being restarted automatically.

The problem is not how Inno Setup determines whether the system should be restarted or not, the problem is to prevent the restart - in case of error - from happening without the user being able to choose whether to do it now or later

Upvotes: 0

Views: 161

Answers (1)

Saba
Saba

Reputation: 35

I've resolved with this: Exit from Inno Setup installation from [Code] and using the ExitProcess WINAPI

Upvotes: -1

Related Questions