My Inno Setup script is used to install a driver. It runs my InstallDriver.exe
after this file was copied during step ssInstall
.
I need to ask the user to restart in some cases according to the value returned by InstallDriver.exe
.
This means that I cannot put InstallDriver.exe
in section [Run]
because there's no way to monitor it's return value.
So I put it in function CurStepChanged()
as follows:
procedure CurStepChanged(CurStep: TSetupStep);
var
TmpFileName, ExecStdout, msg: string;
ResultCode: Integer;
begin
if (CurStep=ssPostInstall) then
begin
Log('CurStepChanged(ssPostInstall)');
TmpFileName := ExpandConstant('{app}') + '\InstallDriver.exe';
if Exec(TmpFileName, 'I', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then .......
However, I can't find a way to make my script restart at this stage.
I thought of using function NeedRestart()
to monitor the output of the driver installer, but it is called earlier in the process.
Does it make sense to call the driver installer from within NeedRestart()
?
NeedRestart
does not look like the right place to install anything. But it would work, as it's fortunately called only once. You will probably want to present a progress somehow though, as the wizard form is almost empty during a call toNeedRestart
.An alternative is to use
AfterInstall
parameter of theInstallDriver.exe
or the driver binary itself (whichever is installed later).