What are INF Files? And what do they do?

INF files are so called because they all have a .INF extension. Each one is a plain text file, more properly known as a Setup Information file, and they have been around for a long time — at least going back as far as Windows 95.

An information file provides installation instructions, commonly being used by Internet Explorer to install and register software components and files that have been downloaded from the internet. One of the most frequent uses of an information file is to install device drivers, which are used by particular devices to communicate with the operating system. Cabinet files (.cab extension) are packages used for software installation that often contain INF files.

The Structure of INF Files

A feature of an INF file is that it can handle complex setup functionality. It does this by having a specific structure, with different named sections that have a particular propose and contain one or more lines. Each INF file also must conform to a set syntax in order to be understood. This includes encoding special characters in URLs (such as a space being represented by %20) and setting file names in a prescribed manner.

All information file section names are enclosed in square brackets, with the main ones being:

[Add.Code], which lists all the files to be installed, both mandatory and optional file

[Setup Hooks], listing all the hooks to be executed before setting up the listed files

[version] applies if using hooks to identify the version of Windows to which the file applies

[section-namex] uniquely identifies each section within the information file and has series of key values. These may identify the file versions to use or from where they can be downloaded.

Using an INF File to Edit the Windows Registry

Although editing of the Windows registry is often done by manual means, it is also possible to use REG files or VB Scripts to do this. Another possibility, although less used nowadays, is to use INF files. These have certain advantages over REG files, including being easier to write, having the ability to delete individual entries rather than only complete keys and having built-in installation procedures and, optionally, uninstall procedures.

Like any information file, one for editing a registry will have a set syntax and sections that define what is required. The first section is [version] and identifies the version of Windows to which it applies. The second section is headed [DefaultInstall] and may have AddReg directives that add or replace registry entries, or DelReg to delete entries. This is followed by [Add.Settings] and [Del.Settings] with entries that indicate what is to be added, replaced or deleted within the registry.

Autorun Information File

A common occurrence of an INF file going back several versions of Windows is the Autorun.inf file. This contains information that tells the operating system what to do with a CD or DVD that is inserted into a drive.

When a disk is inserted for the first time, a prompt for the required action appears. You can select an action for that time only or can, if required, choose the normal action to be followed when a disk is inserted (you may want to open and view the contents in Windows Explorer).

This information is stored in the Autorun.inf file, so Windows will check this file when a disk is inserted and take the specified action. The file also sets the icon to be displayed to represent a CD or DVD and the actions available for the right-click menu. The file starts with an [autorun] section header and then has entries within it.

more information at PCAuthorities.com

Speak Your Mind

*