INF Setup Builder
A small python script which creates a .INF
file for software installation. This tool cannot create .INF files for drivers.
.INF
files were introduced during the Win95 era. Apart from .INF files for drivers, things are basically on life support.
You should expect INF-based installations to become more buggy over time.
The tool makeinf.py
takes a directory of files and creates a .INF file to install these files.
It can place the files into a directory (to be copied on a CD or whatever), pack them in CAB files
and distribute them onto floppies, or use IEXPRESS.EXE
to create a self-extracting archive.
Also, a bootstrap EXE is included which will launch the INF file using the right DLL and
makes sure to install with administrator privileges under Vista or newer.
The python script needs at least Python 3.4 (upgrading to a newer version of Python is not planned for the foreseeable future so that it will continue to run on Windows XP).
Generating a self-extracting archive exe requires IEXPRESS
which is only available on Windows.
Generating a floppy distribution requires MAKECAB
, which is also only available on Windows.
The other features work fine under other operating systems.
The bootstrap executable is compiled using MSVC6, and can also be compiled with MinGW on Linux.
Setup INF files created with this tool will work from Windows 95 and NT4 (with IE4 installed) up to Windows 10, but see below for compatibility issues.
The option --source-dir
and one of --make-filedist
or --make-iexpress
are required.
Specify the source directory.
TODO: explain DirIds and add example
Filename for the generated INF file (without extension). By default, it will be named SETUP.INF
.
The name is also used for the bootstrap EXE, if using --with-bootstrapper
.
Title of the installed software. Used in the Add/Remove Programs
control panel, as window title for dialogs and as shortcut title.
Generate an uninstaller and write uninstall information into the registry. The given UNINSTALLID
is used as registry key
and will be the filename for the uninstall INF file copied to %SystemRoot%\INF
.
If in doubt, generate a random UUID, i.e. python3 -c 'import uuid; print(uuid.uuid4())'
.
Create a start menu shortcut.
Use Advanced INF technology, see below.
Copy the bootstrapper exe. The bootstrapper ensures that the installation runs with administrator permissions
and will take care to launch the INF file using advpack.dll
or setupapi.dll
as appropriate.
It is recommended to always use the bootstrapper.
Copy the generated INF file, the bootstrapper (if --with-bootstrapper
is specified) and all source files into the
given directory. The source files will be renamed to 8.3 filenames.
Use IEXPRESS
to create a self extracting executable.
You can use --iexpress-binary
to specify a custom version of IEXPRESS.EXE
.
Use MAKECAB
to compress all source files and split the CAB files onto multiple floppy disks.
Subdirectories with the files for each floppy disk will be created under OUTDIR.
INF files using Advanced INF technology can show a begin and finish prompt and delete empty directories on uninstall.
Advanced INF functionality is only available when the INF file is launched using advpack.dll
instead of setupapi.dll
(or setupx.dll
).
advpack.dll
is shipped with IE4 and comes preinstalled on Win98 and newer.
There are three ways to launch an INF file: setupapi.dll
(installed by NT-based Windows and IE4 or newer),
setupx.dll
(16bit, only on Win9x), and advpack.dll
(installed by IE4 or newer).
When you install an INF file by using right-click -> Install
, the installation will be launched with setupapi.dll
on any NT-based version of windows and with SETUPX.DLL
on Win9x.
The 16bit SETUPX.DLL
does not support long filenames.
Advanced INF functionality (enabled with --advanced-inf
) needs advpack.dll
, which is not present in vanilla Win95/NT, but
IE4 and Win98 or newer ship a compatible version of advpack.dll
. For some setup functions, advpack.dll
itself piggybacks on either setupapi.dll
or setupx.dll
,
though the INF files generated by this tool contain a directive to always use setupapi.dll
.
- CSIDL-based DirIds (e.g.
16422
=C:\Program Files
) require WinME/Win2k. On Win95/98/NT, the files will end up in%SystemRoot%\SYSTEM\unknown
. - On Windows 10, spaces in shortcut titles will be changed to underscores.
- Deletion of empty directories on uninstall requires a version of
advpack.dll
shipped with IE5 or newer. On older versions, empty directories will stay behind after uninstall.
- When generating a self-extracting exe using
IEXPRESS
without--with-bootstrapper
, the install might or might not be launched with administrator privileges on Vista and newer, depending on the version ofIEXPRESS
used to create the package and possibly the filename of the generated EXE. - When generating a self-extracting exe using
IEXPRESS
without--with-bootstrapper
but with--advanced-inf
,- IEXPRESS will include
ADVPACK.DLL
,W95INF16.DLL
andW95INF32.DLL
into the same package. - It will also use the included
ADVPACK.DLL
to update the system-providedADVPACK.DLL
if it is older. - It will refuse to install if
setupapi.dll
is missing, and never useSETUPX.DLL
. - The version of
IEXPRESS
shipped with Windows XP and newer does not containW95INF*.DLL
and will complain about that. You can findW95INF*.DLL
in IEAK up to version 6. - The version of
ADVPACK.DLL
from IEAK6 or Windows XP and newer does not work on Win95. Use the versions from IEAK5 (--iexpress-binary=PATH\TO\IEAK5\IEXPRESS.EXE
) if your package needs to run on Win95.
- IEXPRESS will include
- When generating a self-extracting exe using
IEXPRESS
without--with-bootstrapper
and without--advanced-inf
, the generated package will launch the INF file usingsetupapi.dll
on NT-based windows andSETUPX.DLL
on Win9x.SETUPX.DLL
does not support long filenames. - Self-extracting packages generated with
IEXPRESS
from Vista and newer might not run on older versions of Windows. UsingIEXPRESS
on Windows XP is mostly fine unless you target Win95. For maximum compatibility, I recommend to use the version from IEAK5 (--iexpress-binary=PATH\TO\IEAK5\IEXPRESS.EXE
).