bmt22033
Posts: 21
Joined: Tue Jun 26, 2012 2:14 pm

Custom action using temporary file?

I am trying to build an installer that deploys a driver using dpinst. My driver package is signed and contains the following files:

dpinst_x86.exe
dpinst_x64.exe
driver.inf
driver.cat
amd64\driver.dll
amd64\driver.sys
x86\driver.dll
x86\driver.sys

Can I add these files to my installer as temporary files and then have two custom actions (one that calls dpinst_x86.exe for 32-bit platforms and one that calls dpinst_x64.exe for 64-bit platforms) to deploy the driver?
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: Custom action using temporary file?

Hi,

In order to achieve what you want you can follow the steps below:
- go in the Files and Folders page and use the "Temporary Files" toolbar button to add your files as temporary files
- go in the Custom Actions page and add to "Launch file" custom actions
- right-click on the "File To Launch" text field, select "File..." and choose your file for each custom action
- in the "Command Line" field you can write the commands to the "dpinst.exe" file
- in the "Condition" text field write "VersionNT" for 32-bit custom action and "VersionNT64" for 64-bit custom action
- build and run the project

Let us know if this helped, otherwise give us more details about your scenario.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bmt22033
Posts: 21
Joined: Tue Jun 26, 2012 2:14 pm

Re: Custom action using temporary file?

OK, I set the custom actions as follows:

To install the x64 driver:

Set File To Launch as [&dpinst_x64.exe]
Check "Use 64-bit Launcher"
Condition is VersionNT64

To install the x86 driver:

Set File To Launch as [&dpinst_x86.exe]
Condition is VersionNT

When I run the installer (I'm testing on Win7 x64), I get the UAC prompt for the .msi file. After unpacking the files to the temp directory, I get the UAC prompt for dpinst_x64.exe. The Driver Package Installer runs as it should and indicates that the driver has been installed sucessfully. However, when I click the "Finish" button in the dialag that is shown by dpinst and my installer resumes, I get the following error message: "There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor.". Any ideas?
bmt22033
Posts: 21
Joined: Tue Jun 26, 2012 2:14 pm

Re: Custom action using temporary file?

I think this problem stems from the return code coming back from dpinst. It looks like a non-zero value is what I should be expecting when the driver installs properly but that causes the installer to fail if the "Fail installation if custom action returns an error" checkbox is selected. I'm not sure how I'll detect an actual failure from dpinst but unselecting this option does seem to allow the installer to finish properly.

http://msdn.microsoft.com/en-us/library ... s.85).aspx
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: Custom action using temporary file?

Hi,

Indeed, a non-zero code is interpreted as an error by Advanced Installer. In order to be able to detect an actual failure from "dpinst.exe" you can create a wrapper over it which convert to 0 all the success codes is returned by "dpinst.exe".
- in the "Condition" text field write "VersionNT" for 32-bit custom action and "VersionNT64" for 64-bit custom action
For the 32-bit custom action you should set "VersionNT AND (NOT VersionNT64)" as a condition, sorry for my mistake.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”