Skip to content

genosse-einhorn/inf-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

INF Setup Builder

Introduction

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.

Requirements

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.

Command-Line Options

The option --source-dir and one of --make-filedist or --make-iexpress are required.

--source-dir=PATH/TO/SOURCEDIR

Specify the source directory.

TODO: explain DirIds and add example

--short-inf-name=SETUP

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=FooBar

Title of the installed software. Used in the Add/Remove Programs control panel, as window title for dialogs and as shortcut title.

--with-uninstall=UNINSTALLID

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())'.

--shortcut=TARGETFILE

Create a start menu shortcut.

--advanced-inf

Use Advanced INF technology, see below.

--with-bootstrapper

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.

--make-filedist=OUTDIR

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.

--make-iexpress=OUTFILE.EXE

Use IEXPRESS to create a self extracting executable.

You can use --iexpress-binary to specify a custom version of IEXPRESS.EXE.

--make-floppydist=OUTDIR

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.

Advanced INF

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.

Compatibility Issues

SETUPAPI.DLL, SETUPX.DLL and ADVPACK.DLL

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.

Features broken in some OS versions

  • 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.

IEXPRESS issues

  • 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 of IEXPRESS 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 and W95INF32.DLL into the same package.
    • It will also use the included ADVPACK.DLL to update the system-provided ADVPACK.DLL if it is older.
    • It will refuse to install if setupapi.dll is missing, and never use SETUPX.DLL.
    • The version of IEXPRESS shipped with Windows XP and newer does not contain W95INF*.DLL and will complain about that. You can find W95INF*.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.
  • When generating a self-extracting exe using IEXPRESS without --with-bootstrapper and without --advanced-inf, the generated package will launch the INF file using setupapi.dll on NT-based windows and SETUPX.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. Using IEXPRESS 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).

About

Tool to create INF-based installers

Resources

Stars

Watchers

Forks

Packages

No packages published