Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code to run after all files are installed with Inno Setup

I got the following little function which I need to call after all files of the [Files] section have been copied

procedure DllAfterInstall(platform: Integer);
begin
    if not installDriver(platform) then
                MsgBox(ExpandConstant('{cm:installDriverFail}'), mbError, MB_OK);
end;

where installDriver(platform) is an external function to one of my dll's.

As soon as I try to call the DllAfterInstall function in the [Run] section like

Filename: "{code:DllAfterInstall}"; Parameters: 0; Check: not IsWin64

I got the error

Invalid prototype for 'DllAfterInstall'

So can anyone tell me what I'm doing wrong? Or maybe is there another way to call a *.dll after all files have been copied? The *.dll function should only be called once so AfterInstall is no option.

like image 223
Nitro.de Avatar asked Sep 05 '25 15:09

Nitro.de


1 Answers

Call your code from CurStepChanged event function when CurStep is ssPostInstall:

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then
  begin
    Log('Post install');
    DllAfterInstall(platform);
  end;
end;

You also need to provide an actual value to the platform parameter of the function.

like image 67
Martin Prikryl Avatar answered Sep 09 '25 00:09

Martin Prikryl