Need to delay driver service starting

Need help authoring your installer? Ask the community for tips and advice.
Post Reply
toonetown
Posts: 18
Joined: Wed May 16, 2018 3:46 pm

Need to delay driver service starting

Post by toonetown » Tue Jun 30, 2020 1:42 am

I have an application which installs a driver and some files, and it also runs a command - but it needs to run the command prior to services (including the driver) being started.

I have the following custom actions (in this order)
- InstallFiles (standard action)
- Custom Action (executes a file that is installed)
- PatchFiles (standard action)

The driver ini is installed during the InstallFiles section as well. However, when I look at the installation log, I see the following:

Code: Select all

MSI (s) (C4:34) [18:35:31:737]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI8019.tmp, Entrypoint: InstallDriverPackages
DIFXAPP: ENTER: InstallDriverPackages()
DIFXAPP: INFO: 'CustomActionData' property 'DIFxApp Version' is '2.1.1'.
    <...SNIP...>
DIFXAPP: INFO:   Service 'mydriver' was started
DIFXAPP: SUCCESS:Installation completed with code 0x0.
    <...SNIP...>
DIFXAPP: RETURN: InstallDriverPackages() 0 (0x0)
This happens BEFORE the code which runs my custom action:

Code: Select all

MSI (s) (C4:CC) [18:35:32:393]: Executing op: CustomActionSchedule(Action=MyCustomAction,ActionType=3090,Source=C:\Path\To\My\Binary.exe,Target=-a 123 -b 456,)
However - I need to have "C:\Path\To\My\Binary.exe -a 123 -b 456" execute BEFORE the "mydriver" service is started. How can I defer the starting of the service? The StartServices standard action is even after the PatchFiles standard action.

Catalin
Posts: 2837
Joined: Wed Jun 13, 2018 7:49 am

Re: Need to delay driver service starting

Post by Catalin » Thu Jul 02, 2020 2:50 pm

Hello,

In order to launch your executable before the driver is installed, you can add the .EXE file as a "Temporary File" and then schedule your custom action to execute before the "InstallFiles" standard action.

Unlike Advanced Installer's regular files or resources, "Temporary Files" are copied on the target machine at the beginning of the installation and are deleted at the end of it (you can also opt for not deleting them), ensuring you have access to them throughout the entire install process.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Daniel
Posts: 8064
Joined: Mon Apr 02, 2012 1:11 pm
Contact:

Re: Need to delay driver service starting

Post by Daniel » Thu Jul 02, 2020 3:21 pm

Hi,

The driver install action is executed right after the "InstallFiles" standard action, so if you need your custom action to be executed in between those standrad actions you should proceed like this:

1. go to "Table Editor" page and select the "InstallExecuteSequence" table
2. edit the sequence of "InstallFiles" action to be 3999
3. edit the sequence of your custom action to be the next one after "InstallFiles", i.e. 4000; check the attached screenshot
4. save and rebuild your setup project
screen.jpg
screen.jpg (428.18 KiB) Viewed 41 times
The above step 2 is required because at setup project build time Advanced Installer includes into your setup the "MsiProcessDrivers" standard action with the execution sequence set to 4001. By default this is first sequence right after "InstallFiles" action.

Hope this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

toonetown
Posts: 18
Joined: Wed May 16, 2018 3:46 pm

Re: Need to delay driver service starting

Post by toonetown » Thu Jul 02, 2020 4:12 pm

Thank you both - Daniel's solution worked for us, and is closer to what we are wanting to achieve.

Daniel
Posts: 8064
Joined: Mon Apr 02, 2012 1:11 pm
Contact:

Re: Need to delay driver service starting

Post by Daniel » Fri Jul 03, 2020 5:08 am

You are always welcome.

We are glad you got this working.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Post Reply