This page details the various sections used within an INF file for Windows driver installation.
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.
These sections are fundamental to most INF files and provide core installation instructions.
[Version] SectionThis 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}
Signature: Identifies the operating system family the INF file is designed for.ProviderName: The name of the driver provider.DriverVer: The date and version of the driver.CatalogFile: The name of the digital signature catalog file.Class: The device setup class for the device.ClassGuid: The GUID of the device setup class.[DefaultInstall] SectionThis 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] SectionThis 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] SectionSpecifies the names of the disk media (CD-ROM, network share, etc.) where the driver files are located.
[SourceDisksNames]
1 = %Disk1%,,,\AMD64
1: A disk number or tag.%Disk1%: A string that can be localized.\AMD64: The subdirectory on the disk containing the files.[SourceDisksFiles] SectionLists the files to be copied and their corresponding disk numbers as specified in SourceDisksNames.
[SourceDisksFiles]
mydriver.sys = 1
mydriver.dll = 1
[DestinationDirs] SectionSpecifies 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] SectionThis section defines services to be installed or started during the default installation process.
[DefaultInstall.Services]
AddService=MyDriverService, 0x00000002, MyDriver.Service.Install
[DDInstall.Services] SectionSimilar to DefaultInstall.Services, but specifically for device driver installation.
[DDInstall.Services]
AddService=MyDriverService, 0x00000002, MyDriver.Service.Install
[Install.RegExp] SectionThis 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] SectionUsed to add or modify registry entries during the installation process.
[MyDriver.AddReg]
HKR,,"DeviceData",0x00010001,"MyCustomData"
HKR: Refers to the device's software key."DeviceData": The name of the registry value.0x00010001: The type of the registry value (REG_SZ)."MyCustomData": The data for the registry value.[Remove] SectionSpecifies registry entries, files, or services to be removed during uninstallation.
[MyDriver.Remove]
DelReg=MyDriver.DelReg
DelService=MyDriverService
These sections allow INF files to be tailored for different operating system versions or architectures.
[Manufacturer] SectionLists 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
%YourCompanyName%: A localized string for the company name.YourCompany: The name of a section that lists the specific models from this manufacturer.NTamd64.10.0...x64: A platform identifier (e.g., Windows 10 x64).[Models] SectionUnder 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
%MyDeviceModel%: A localized string for the device model.MyDevice.Install: The INF section to use for this device.USB\VID_xxxx&PID_yyyy: The hardware ID that matches the device.[ClassInstall_Header] SectionUsed for class installer functions, allowing custom installation logic.
[ClassInstall_Header]
Signature="$WINDOWS NT$"
AddClass=MyDeviceClass
AddPropertyPage=MyDevice.PropertyPage
[Class] SectionDefines a new device setup class or provides information for an existing one.
[MyDeviceClass.X.NT] ; Example for a specific architecture
DeviceData=MyDeviceClassGuid
[LogConfig] SectionUsed for configuring hardware resources like IRQs, DMA, and I/O ports.
[MyDevice.LogConfig]
IO_RANGES=0x300-0x30F
IRQ=5
[Install.Custom] SectionAllows for custom installation actions to be performed.
[MyDriver.Install.Custom]
RunOnce=MyCustomInstaller.exe
These sections are dedicated to configuring and installing device drivers as Windows services.
[Service] SectionA 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
DisplayName: The user-friendly name of the service.ServiceType: Type of service (e.g., Kernel Driver).StartType: How the service is started.ErrorControl: Severity of failure reporting.ServiceBinary: Path to the driver executable.LoadOrderGroup: Specifies the load order.[ServiceInstall] SectionThis section might be used in older INF formats or for specific service configurations, but [Service] is more prevalent for driver services.
Additional sections that support various aspects of INF file functionality.
[Signatures] SectionContains information about the digital signatures associated with the driver package, typically referencing a catalog file.
[Signatures]
verifsign = "$WINDOWS NT$"
mycatalog.cat
[CopyFiles] SectionDefines 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
mydriver.sys: The source file.,,,1: Destination directory code (e.g., 1 for system directory).[UndefSection] SectionUsed 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.
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.