简体   繁体   中英

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM