INF Sections

This page details the various sections used within an INF file for Windows driver installation.

Introduction to INF Sections

An INF (Setup Information) file is a text file that contains information about how to install a device or a software component on a Windows system. This information includes file locations, registry entries, service configurations, and more. INF files are structured into various sections, each serving a specific purpose in the installation process.

Understanding these sections is crucial for developing and debugging device drivers and other Windows software that relies on INF-based installation.

Standard INF Sections

These sections are fundamental to most INF files and provide core installation instructions.

[Version] Section

This section is mandatory and must be the first section in an INF file. It specifies version information for the INF file itself and the associated driver package.

[Version]
Signature="$WINDOWS NT$"
ProviderName="Your Company Name"
DriverVer=MM/DD/YYYY,1.0.0.0
CatalogFile=yourdriver.cat
Class=YourDeviceClass
ClassGuid={your-guid-here}

[DefaultInstall] Section

This section is typically used for a default installation. It can be referenced by other sections to perform common tasks.

[DefaultInstall]
CopyFiles=MyDriver.Copy.Files
AddReg=MyDriver.AddReg
AddService=MyDriverService,,MyDriver.Service.Install

[DDInstall] Section

This section is often used for installing a device. It usually points to other sections that handle file copying, registry modifications, and service installation.

[DDInstall]
; This section often points to DDInstall.NT, DDInstall.NTamd64, etc.
include = mydriver.inf
needs=DDInstall.NT

[SourceDisksNames] Section

Specifies the names of the disk media (CD-ROM, network share, etc.) where the driver files are located.

[SourceDisksNames]
1 = %Disk1%,,,\AMD64

[SourceDisksFiles] Section

Lists the files to be copied and their corresponding disk numbers as specified in SourceDisksNames.

[SourceDisksFiles]
mydriver.sys = 1
mydriver.dll = 1

[DestinationDirs] Section

Specifies the target directories where files should be copied.

[DestinationDirs]
DefaultDestDir = 12  ; 12 is the system directory (e.g., %SystemRoot%\System32)
MyDriver.Files = 13  ; 13 is the driver directory (e.g., %SystemRoot%\System32\drivers)

[DefaultInstall.Services] Section

This section defines services to be installed or started during the default installation process.

[DefaultInstall.Services]
AddService=MyDriverService, 0x00000002, MyDriver.Service.Install

[DDInstall.Services] Section

Similar to DefaultInstall.Services, but specifically for device driver installation.

[DDInstall.Services]
AddService=MyDriverService, 0x00000002, MyDriver.Service.Install

[Install.RegExp] Section

This section is used to specify registry entries that are installed dynamically based on specific conditions.

This section is less commonly used for typical driver installations.

[AddReg] Section

Used to add or modify registry entries during the installation process.

[MyDriver.AddReg]
HKR,,"DeviceData",0x00010001,"MyCustomData"

[Remove] Section

Specifies registry entries, files, or services to be removed during uninstallation.

[MyDriver.Remove]
DelReg=MyDriver.DelReg
DelService=MyDriverService

Platform-Specific Sections

These sections allow INF files to be tailored for different operating system versions or architectures.

[Manufacturer] Section

Lists the manufacturers of the devices for which the INF file provides drivers. This section is typically used by the Add Hardware wizard.

[Manufacturer]
%YourCompanyName%=YourCompany,NTamd64.10.0...x64

[Models] Section

Under a specific manufacturer section (e.g., [YourCompany]), this section lists the different hardware models and the INF sections to use for their installation.

[YourCompany]
%MyDeviceModel%=MyDevice.Install, USB\VID_xxxx&PID_yyyy

[ClassInstall_Header] Section

Used for class installer functions, allowing custom installation logic.

[ClassInstall_Header]
Signature="$WINDOWS NT$"
AddClass=MyDeviceClass
AddPropertyPage=MyDevice.PropertyPage

[Class] Section

Defines a new device setup class or provides information for an existing one.

[MyDeviceClass.X.NT] ; Example for a specific architecture
DeviceData=MyDeviceClassGuid

[LogConfig] Section

Used for configuring hardware resources like IRQs, DMA, and I/O ports.

[MyDevice.LogConfig]
IO_RANGES=0x300-0x30F
IRQ=5

[Install.Custom] Section

Allows for custom installation actions to be performed.

[MyDriver.Install.Custom]
RunOnce=MyCustomInstaller.exe

Service Installation Sections

These sections are dedicated to configuring and installing device drivers as Windows services.

[Service] Section

A common section used to define service parameters. It's often referenced by AddService directives.

[MyDriver.Service.Install]
DisplayName    = %MyDriverServiceName%
ServiceType    = 1          ; SERVICE_KERNEL_DRIVER
StartType      = 3          ; SERVICE_DEMAND_START
ErrorControl   = 1          ; SERVICE_ERROR_NORMAL
ServiceBinary  = %12%\mydriver.sys
LoadOrderGroup = Extended Base

[ServiceInstall] Section

This section might be used in older INF formats or for specific service configurations, but [Service] is more prevalent for driver services.

Other INF Sections

Additional sections that support various aspects of INF file functionality.

[Signatures] Section

Contains information about the digital signatures associated with the driver package, typically referencing a catalog file.

[Signatures]
verifsign = "$WINDOWS NT$"
mycatalog.cat

[CopyFiles] Section

Defines groups of files to be copied. These groups are then referenced by other sections like DefaultInstall or DDInstall.

[MyDriver.Copy.Files]
mydriver.sys,,,1
mydriver.dll,,,1

[UndefSection] Section

Used to undefine a macro or a previously defined section, allowing for conditional logic or overriding defaults.

This section is used for advanced INF manipulation and is less common in standard driver INF files.

Important Note:

The exact sections and their syntax can vary slightly depending on the Windows version and the specific type of device or software being installed. Always refer to the latest Microsoft documentation for the most accurate and up-to-date information.