About INF Files
An INF file is a text file divided into different types of formatted sections. Each section is designed for a particular purpose; for example, to copy files or to add entries to the registry. Number and type of sections in an INF file depends on the particular installation procedure. Each section consists of lines that contribute to that section's purpose.
INF files store information in a format that is described in the General Guidelines for INF File and INF File Sections and Directives sections of the Microsoft Windows 2000 Driver Development Kit. You should refer to these resources in the Microsoft Windows Driver Development Kit (DDK) if you plan to author INF files. The setup functions uses this format to retrieve information from the INF file
The following INF sections can be used with the setup functions to create an installation application. When you create an INF file, you do not have to include every type of section. The sections used depend on the installation procedure.
Section | Description |
---|---|
[Version] | Contains information about the INF file. This is the only section that is required. The setup functions use this section to recognize for which version of Windows the INF file was intended. |
[Install] | Provides an overview of the installation process and contains a list of INF sections that the setup functions process during the installation. See the INF Install Section Example. |
[Add Registry] | Contains information used to add subkeys or value names to the registry. |
[Copy Files] | Contains source filenames and can specify additional copying behavior. |
[Delete Registry] | Contains information used to delete a subkey or value name from the registry. |
[Delete Files] | Contains the filenames of files to delete, and can specify additional deletion behavior. |
[INI File to Registry] | Contains information used to move lines or sections from an INI file to the registry. |
[ProfileItems] | Contains information used to add or remove items from the Start Menu. Available only with Windows 2000. |
[Rename Files] | Contains the source and target filenames for renaming operations. |
[Update INI Fields] | Contains information used to replace, add, or delete fields in an INI entry. |
[Update INI File] | Contains information used to replace, add, or delete an INI entry. |
[Services] | Lists the services to add or install. |
[Service Install] | Contains information used to install the service listed in the AddService key of the Services section. |
[DestinationDirs] | Maps Copy Files sections to a destination directory. Defines the destination directory for files listed in Copy Files, Rename Files, or Delete Files sections. |
[SourceDisksFiles] | Maps the source files to the ordinal values assigned in the SourceDisksNames section. See INF SourceDisksNames and SourceDisksFiles Sections Example. |
[SourceDisksNames] | Assigns an ordinal value to each source disks and can store additional information about the source disks. See INF SourceDisksNames and SourceDisksFiles Sections Example. |
[EventLog Install] | Contains information used to add an event message to the registry. |
[Strings] | Values in INF files may be expressed as replaceable strings using the form %strkey%. Each strkey in an INF file must specify a unique name consisting of printable characters. To include a % character in the string, use %%. The strkey must be defined in a Strings section of the INF file. You can use string keys as placeholders in an INF file for information that changes frequently or needs to be localized. |
An INF file can also contain private sections. The format of a private section depends on the setup application. Private sections in an INF file can be used to store specialized information used by a specific setup application. The Setup API includes functions, such as SetupGetLineTextand SetupGetIntField, that can retrieve information from the private sections of INF files at the level lines and fields within lines.