Keith
Keith

Reputation: 797

Detecting that installation was aborted/cancelled in Inno Setup

I have an Inno Setup installer with some code in the DeinitilizeSetup() procedure. Importantly, this procedure includes calls to create/start a service (that it just installed) that hosts a localhost REST API, and then calls to that API to 'finish' the install (that's sort of a misleading name, but that's not important).

Here's the deal: If the installation aborted for any reason (current test case is if the application was open, so the installer couldn't overwrite the exe/etc), it aborts because it's running in /verysilent mode. But I want to KNOW that it is aborting (vs a happy path ending) and call the RESTAPI with a querystring parameter as true vs false.

I'm all set with a conditional like this:

if (InstallerCanceled = true) then begin
    Log('Calling Service''s FinishInstall endpoint with errorOccurred=true')
    WinHttpReq.Open('GET', 'http://localhost:5000/api/update/FinishInstall?errorOccurred=true', False)
  end
  else begin
    Log('Calling Service''s FinishInstall endpoint with errorOccurred=false');
    WinHttpReq.Open('GET', 'http://localhost:5000/api/update/FinishInstall?errorOccurred=false', False);
  end
WinHttpReq.Send('');

But I can't figure out how to define the conditional itself...how do I know if the install was cancelled?

Upvotes: 1

Views: 623

Answers (1)

Related Questions