I'd like to install a driver for a serial port using Inno Setup. I have the inf
file, and I can install the driver manually through device manager, but I'd like to be able to include the driver in my installer so that users don't have to go through the trouble of installing the driver themselves.

- 188,800
- 56
- 490
- 992

- 4,612
- 6
- 32
- 33
3 Answers
See InstallHinfSection
in Microsoft documentation. The documentation also mentions how to invoke an installation by calling Rundll32.exe
. Probably you'll end up with something like this:
[Files]
..
Source: "driver\my_x86driver.inf"; DestDir: {app}\driver;
Source: "driver\my_x86driver.sys"; DestDir: {app}\driver;
[Run]
..
Filename: {sys}\rundll32.exe; \
Parameters: "setupapi,InstallHinfSection DefaultInstall 128 {app}\driver\my_x86driver.inf"; \
WorkingDir: {app}\driver; Flags: 32bit;
Note that you might need to run the setup in 64bit mode in 64bit systems to be able to install the driver:
[Setup]
..
ArchitecturesInstallIn64BitMode=x64
Also you can put checks as to run the version of .inf
file depending on machine architecture (e.g. Check: Is64BitInstallMode
).

- 188,800
- 56
- 490
- 992

- 54,131
- 4
- 102
- 169
-
3The 64 bit mode of InnoSetup does *not* produce a 64-bit installer executable! You need to use a small helper 64 bit executable just to invoke the needed API. The APIs to use are `UpdateDriverForPlugAndPlayDevices` on XP, and `DiInstallDriver` on anything past XP. – Kuba hasn't forgotten Monica Mar 12 '13 at 16:14
This is a better answer: Install drivers with rundll32 or dpinst in Inno Setup?
Using InstallHinfSection
on Windows 7 and beyond seems to be either broken or fraught with difficulty. Making it work from a batch file is difficult, making it work from Inno Setup is even more difficult. dpinst
seems preferable, and is simpler.

- 188,800
- 56
- 490
- 992

- 151
- 1
- 3
I used dpinst like this:
[Files]
Source: "Source\dpinst\dpinst32.exe"; DestDir: "{app}\driver"; DestName: dpinst.exe; Check: not IsWin64; Flags: ignoreversion
Source: "Source\dpinst\dpinst64.exe"; DestDir: "{app}\driver"; DestName: dpinst.exe; Check: IsWin64; Flags: ignoreversion
[Run]
Filename: "{app}\driver\dpinst.exe"; Parameters: "/A /LM";

- 51
- 1
- 1