INF File Documentation
Table of Contents
Introduction to INF Files
INF (Setup Information) files are text files that contain installation instructions for hardware devices on Windows. They are a critical component of driver packages, guiding the Windows Plug and Play manager and Setup API through the process of installing, configuring, and removing devices and their associated software.
These files are human-readable and can be edited with any text editor, but their syntax is specific and must be followed precisely. Understanding INF files is essential for any developer creating drivers for Windows hardware.
Purpose and Role
INF files serve several key purposes:
- Device Identification: They contain information that uniquely identifies hardware devices (e.g., Vendor ID, Device ID, Subsystem ID).
- Driver Association: They link specific hardware IDs to the appropriate driver files (e.g., .sys, .dll, .cat).
- Installation Configuration: They specify how drivers should be copied, registered, and configured, including registry entries and other system settings.
- Installation Actions: They define actions to be performed during installation, such as copying files, adding registry values, or running custom commands.
- Device Property Configuration: They allow for the configuration of device properties, such as device description, services, and power management settings.
- Uninstallation: They can contain instructions for cleanly removing a device and its associated drivers and settings.
INF File Structure
An INF file is organized into sections. Each section is denoted by a name enclosed in square brackets (e.g., [Version]). The first section in a valid INF file must be the [Version] section.
Within each section, information is typically presented as key-value pairs or lists of items. Directives are special commands that instruct the setup process. Comments are denoted by a semicolon (;) at the beginning of a line.
Common Sections
INF files commonly include the following sections:
[Version]: Specifies the version of the INF file and the Windows operating systems it supports.[DestinationDirs]: Defines default directories where files should be copied.[SourceDisksNames]and[SourceDisksFiles]: Specify the location of source files for installation.[Manufacturer]: Lists the manufacturers for the devices described in the INF.[Models]: Describes the hardware models and associates them with INF file entries that contain the actual installation instructions.[InstallSection](or custom names): Contains directives that perform installation actions.[AddReg]: Specifies registry entries to be added or modified.[DDInstall]: The primary section for installing a specific device, often referenced by the[Models]section. It specifies which files to copy and what registry entries to create.[DDInstall.HW]: Used for hardware-specific configuration.[DDInstall.Services]: Used for configuring device services.
Key Directives
INF files use directives to control installation. Some of the most common include:
Signature: Identifies the INF file as a system setup file.ClassandClassGuid: Specify the device class and its GUID.ProviderName: Specifies the name of the INF file provider.DriverVer: Specifies the driver version and date.CopyFiles: Copies files from the source to the destination.AddReg: Adds or modifies registry entries.DelReg: Deletes registry entries.RenFiles: Renames files.BitReg: Modifies bits in registry values.
For example, the [Version] section typically looks like this:
;
; INF file for MyDevice
;
[Version]
Signature="$WINDOWS NT$"
ProviderName="MyCompany"
Class="USBDevice"
ClassGuid="{36FC9E60-C465-11CF-8056-444553540000}"
DriverVer=07/15/2023,1.0.0.0
CatalogFile=mydevice.cat
Getting Started with INF Files
To begin creating or understanding INF files:
- Familiarize yourself with the basic structure: Understand sections and directives.
- Identify your device hardware IDs: Use tools like Device Manager to find the VENdor and DEVICE IDs for your hardware.
- Start with a template: If you're developing a new driver, the Windows Driver Kit (WDK) provides template INF files that can be a great starting point.
- Consult the official documentation: Refer to the detailed documentation for each directive and section.
- Test thoroughly: Use the Windows Driver Verification tools and test your INF file on various Windows versions.
Creating a correct INF file is crucial for a smooth driver installation experience. For more in-depth information on specific sections and directives, please navigate the documentation tree on the left.