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.
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).
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";
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.
Related
To understand how I use the software:
When starting the installer, the user can choose whether to install or update the software. If he installs the software with the install option, then the software can also be uninstalled regularly via the uninstaller.
I now also misuse the installation function as an update function. Here let's distinguish between the normal upgrade function of Inno Setup and my created update option via code. The update option is nothing more than a normal installation. However, the user must specify any paths to the pre-installed software beforehand. This has to do with the fact that most of our users have already installed the software manually before. (Java, Tomcat and our web application).
The normal installation and my specially created update option work fine so far.
By means of registry entries set during installation or update, I can distinguish whether the software has been installed or updated using the "Installer" or "Updater" option.
If the user has now installed the software via the normal installation option, then it should be possible to uninstall it completely. This means that the (Inno Setup) Uninstaller should delete all files. However, this should not be the case if the user uses the update option. The update function works by backing up some files before the regular installation, deleting unnecessary files using DelTree, and then letting the installation recreate them.
Is it possible to set a condition so that the uninstaller does not delete these files in the Files section if the user has previously used the Update option?
Normally, of course, the uninstaller should delete these files if the user has previously installed the software using the install option. However, I would like these files not to be deleted if the user has previously selected the update option in the installer.
The following is a brief portion of my options:
[Setup]
UninstallFilesDir={code:UnInstallerPath}
[Files]
Source: "<source>\Tomcat9\*"; DestDir: "{code:GetTomcatSourcepath}"; Excludes: "webapps"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "<source>\{#JAVA}\*"; DestDir: "{code:GetJAVAExtractpath}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "<source>\Tomcat9\webapps\ROOT\*"; DestDir: "{code:GetWebAppSourcepath}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "<source>\config\*"; DestDir: "{code:GetConfigInstallPath}"; Check: IsInstaller; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "<source>\libraries\{#DLLFile}"; DestDir: "{code:GetConfigInstallPath}"; Flags: ignoreversion
[UninstallDelete]
Type: filesandordirs; Name: "{code:GetUninstallPath}"; Check: IsInstalledviaProgram;
Type: filesandordirs; Name: "{code:UnInstallerPath}";
So the uninstaller should not delete any files other than its own exe and the associated data file if the installer was only used for the update using my created update function.
Due to the fact that I want to be able to uninstall the application if it was previously installed by the installation option, I unfortunately cannot use the uninsneveruninstall flag.
For better understanding, you can see in the following picture the first page that is displayed after starting the installer.
All Check functions (including those in the UninstallDelete section are evaluated on install time. Not on uninstall time.
Based on the name of your IsInstalledviaProgram function, I guess that it is implemented in a way to work in the uninstaller (by checking the registry entries?). But it is actually executed during the installation. So you should check for the radio buttons, not the registry entries (whose state at the time the function is called likely do not correspond yet). Maybe the IsInstaller is the function you should use.
I have a couple of questions about Inno.
One is that I have a hi-res good-looking desktop icon that I made 256x256. But when Inno installs it, a low-res one appears on the desktop.
(The one appearing in the start menu looks Ok and hi-res).
Edit: this became a question to do with the exported format of the .ICO file (an icon file exported from Photoshop was not exporting correctly - see answers below), as well as a caching problem which was alleviated with a reboot.
(Sometimes, when I make an icon change in Inno, its not reflected on the computer I just tested the install on. Its only when I go to another computer and install it, do I see the new changes. Is there a cache or something that I have to clear to see new changes?)
#define MyAppExeName "navdraw.exe"
#define MyAppIcoName "C:\kivymd\Inno\IGPDesktopIcon.ico"
[Setup]
SetupIconFile="C:\kivymd\Inno\IGPInstallerIcon.ico"
[Files]
Source: "C:\kivymd\exe\dist\navdraw\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\kivymd\Inno\IGPDesktopIcon.ico"; DestDir: "{app}"; Flags: ignoreversion
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "C:\kivymd\Inno\IGPDesktopIcon.ico"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "C:\kivymd\Inno\IGPDesktopIcon.ico"; Tasks: desktopicon
I do not know why even the low res icon appears, as your script is wrong.
The IconFilename parameter must point to a file on the target machine. So like this:
IconFilename: {app}\IGPDesktopIcon.ico
That also explains your "caching problem".
I include a symbolic link from the source machine into Inno Setup. When running the installer on the target machine, it deploys a copy of the source file in place of the symbolic link. How do I make the installer preserve the symbolic links?
[Files]
Source: "c:\source path*"; Excludes:"*.log"; DestDir: "C:\destination path"; \
Flags: ignoreversion recursesubdirs createallsubdirs
You cannot "install" a symbolic link using the Files section. Inno Setup does not support symlinks.
You have to create the link explicitly on the target machine. For that, see How can I create a symbolic link with Inno Setup?
To avoid installing the symlinked file twice, you may need to exclude it from the installation using the Excludes parameter.
I would like to install an external file.
My installer is located in
c:\somedir\setup.exe
And the external file is located in
c:\somedir\download\MyApp.exe
My code to do that is
[Files]
Source:"\download\MyApp.exe"; DestDir: "{app}";Flags: external skipifsourcedoesntexist
For some reason, Inno Setup does not seem to find this file.
Can anybody tell me what I'm doing wrong?
Thank you.
You have two problems:
The path \download\MyApp.exe relative to c:\somedir\ resolves to c:\download\MyApp.exe, as the leading \ goes back to the root folder. You would need to use download\MyApp.exe.
The Inno Setup does not resolve external file paths relatively to the installer anyway. You have to use a full path, see the documentation for the Source parameter:
When the flag external is specified, Source must be the full pathname of an existing file (or wildcard) on the distribution media or the user's system (e.g. "{src}\license.ini").
You can use the {src} constant to get a full path to the installer folder.
[Files]
Source: "{src}\download\MyApp.exe"; DestDir: "{app}"; \
Flags: external skipifsourcedoesntexist
Use the {src} constant:
[Files]
Source:"{src}\download\MyApp.exe"; DestDir: "{app}";Flags: external skipifsourcedoesntexist
I am trying to install drivers with Inno Setup and it looks like there are (at least) two ways to do this: add dpinst.exe to the or run rundll against the .inf file.
I know there is two different version of DPinst for x86 and x64. Are there different version depending on the OS (I need to support XP, Vista and 7)?
Do I need admin permission for these methods?
Which method is recommended?
You use the same DPInst version for all versions of the operating systems; the only distinction is 32-bit vs. 64-bit. The WDK comes with both 32-bit and 64-bit versions.
Personally, here's what I do (on InnoSetup):
[Files]
...
Source: ...\dpinst32.exe; DestDir: {#DpInstPath}; DestName: dpinst.exe; \
Check: not IsWin64; Flags: ignoreversion
Source: ...\dpinst64.exe; DestDir: {#DpInstPath}; DestName: dpinst.exe; \
Check: IsWin64; Flags: ignoreversion
Using run32dll setupapi.dll,InstallHinfSection ... is outdated and generally not recommended unless you have some very specific needs.