How to cancel installer using Inno Setup

abortinno-setupinstallation

I am using Inno setup to install a product of mine, in the setup I execute an extern program (Validator.exe) if this program is canceled or aborted I have to cancell my own installer.

I save the Validator.exe in {app} path and the execute it.

When the installer is running I call Validator.exe file and I get the result of the execution with:
Exec(ExpandConstant('{app}/Validator.exe'), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode).

But this are the problems with all the solutions that I have tried:

InitializeSetup: The Validator.exe File is not copied in {app} yet, so it will never be executed.

Abort:can be called only in (InitializeSetup,InitializeWizard,CurStepChanged(ssInstall)) so in these cases the Validator is not copied yet.

DeinitializeSetup: I can execute Validator.exe after the installation but I can't abort the my installer from this point.

I need some way to cancel the installation after Validator.exe has been copied and executed, maybe call uninstall but I couldn't do it.

Thanks for any help.

Best Answer

You could simply use the ExtractTemporaryFile() helper function to extract validator.exe at any earlier installation step. See the question inno setup extracting files at the start up setup instead of the end and my answer to it.

Related Topic