Necip
Necip

Reputation: 341

How can I set the exit code of uninstallation in Inno-Setup?

I would like to set the exit code for my uninstallation in Inno Setup. By doing this I want the Inno Setup to show some sort of "uninstallation failed" dialog box to the user.

I know that defining custom exit code for installation can be done via GetCustomSetupExitCode function.

Is it possible to notify Inno Setup that the custom uninstallation procedure has failed and to prevent Inno Setup from showing the silly "Uninstall Successful" message no matter what happens?

Upvotes: 2

Views: 1258

Answers (2)

lepe
lepe

Reputation: 25200

One possibility is to Implement your own Pascal Script. Probably in DeinitializeUninstall() event, (check the manual to know exactly in which step you want it), you can add these code:

[Code]
var error: Boolean;

procedure ExitProcess(exitCode:integer);
  external '[email protected] stdcall';

procedure TheEventYouFeelIsBetterHere():
begin
 if error then begin
   MsgBox('Installation Failed!', mbError, MB_OK);
   ExitProcess(1);
 end;
end;

Upvotes: 0

Robert Love
Robert Love

Reputation: 12581

I did a code review of the Uninstall.pas in InnoSetup and there is currently no way to do what you would like to do.

Upvotes: 1

Related Questions