Windows drivers inf files

Creating International INF Files

Creating installations for international markets requires providing locale-specific INF files and, possibly, locale-specific driver files.

An INF file that will be used in an international market should use %strkey% tokens for all user-viewable text. The strings are defined in an INF Strings section, which is typically at the end of the INF file.

Locale-Specific INF Files

You can create a single INF file that supports several locales, or you can create a separate INF file for each locale, by following these guidelines:

To create a single international INF file, you should include a set of locale-specific Strings.LanguageID sections, as described in the reference page for the INF Strings section. Use this technique if you intend to supply a single installation medium for all international markets.

For installations on Windows 2000 and later versions of Windows, this is the recommended method for supporting international markets.

To create a separate INF file for each locale, start with a main INF file that contains all the necessary sections and entries, except for the Strings section. Then create a second set of files, where each file contains just the Strings section for a supported locale. Concatenate the main file with each strings file to generate the locale-specific INF files.

For installations on Windows 2000 and later versions of Windows, use this technique only if you intend to supply a separate installation medium for each international market. You cannot provide multiple versions of an INF file, for a particular operating system version, on a single installation medium because Windows cannot determine which INF file to use.

Locale-Specific Versions of Driver Files

If you have to provide locale-specific versions of driver files for Windows 2000 and later versions of Windows, mark each version of each file with its locale. Be sure to mark files that are not locale-specific as language-neutral. You can do this by adding the following macro definition to your resource file:

This definition must appear before the preprocessor directive that includes common.ver.

After compiling your files, you can verify that each is marked as language-neutral by doing the following:

Right-click the file in Windows Explorer.

Click Properties.

Click the Version tab.

The Language selection in the Other version information pane contains a value that identifies the file as Language Neutral, or as intended for a specific locale.

Put the locale-specific files in separate, locale-specific subdirectories of the distribution medium, such as /English and /German. In your INF file, do the following:

Within the INF SourceDisksFiles section, specify locale-specific subdirectories by using a string key token such as %LocaleSubDir%.

Provide separate INF Strings sections for each language, and define the appropriate subdirectory name string in each section.

Creating Unicode INF Files

If an INF file contains characters that fall outside the ASCII range (that is, outside the range of 0-127), the INF file should be in Unicode format. One way to create a Unicode INF file is to use an application such as Notepad to save it in Unicode format. If the INF is not in Unicode format, Windows uses the current locale to translate characters. If the INF file is in Unicode format, Windows uses the full Unicode character set.

Some applications, such as Notepad, allow you to create a Unicode file in either little-endian or big-endian format. Windows supports INF files that use either format.

Device Installation Files

The software that is required to support a particular device depends on the kind of device and the ways in which the device is used. Typically, a vendor provides the following software in a driver package to support a device:

A device setup information file (INF file)
An INF file contains information that the system Windows components use to install support for the device. Windows copies this file to the %SystemRoot%\inf directory when it installs the driver. This file is required.

Читайте также:  Размер windows 10 для одного языка

For more information, see Creating an INF File.

One or more drivers for the device
A .sys file is the driver’s image file. Windows copies this file to the %SystemRoot%\system32\drivers directory when the driver is installed. Drivers are required for most devices.

Digital signatures for the driver package (a driver catalog file)
A driver catalog file contains digital signatures. All driver packages should be signed.

A vendor obtains digital signatures by submitting its driver package to the Windows Hardware Quality Lab (WHQL) for testing and signing. WHQL returns the package with a catalog file (.cat file).

Other files
A driver package can contain other files, such as a custom device installation application, a device icon, or a driver library file (such as for video drivers).

Also, see the device-type-specific documentation in the WDK.

The WDK includes various sample installation files. For more information, see Sample Device Installation Files

Using a Universal INF File

Some editions of Windows use only a subset of the driver installation methods that are available on Windows 10 Desktop. An INF file for non-Desktop versions of Windows must perform only additive operations that do not depend on the runtime behavior of the system. An INF file with such restricted syntax is called a universal INF file.

A universal INF file installs predictably, with the same result each time. The results of the installation do not depend on the runtime behavior of the system. For example, co-installer references are not valid in a universal INF file because code in an additional DLL cannot be executed on an offline system.

A driver package with a universal INF file can be configured in advance and added to an offline system.

To test if your INF is universal, use infverif /u .

A Windows Driver must pass infverif /w , which tests /u as well as Driver Package Isolation.

If you are building a Windows Desktop Driver package, you don’t have to use a universal INF file, but doing so is recommended because of the performance benefits.

Which INF sections are invalid in a universal INF file?

You can use any INF section in a universal INF file except for the following:

The INF Manufacturer Section is valid as long as the TargetOSVersion decoration does not contain a ProductType flag or SuiteMask flag.

The INF DefaultInstall Section is valid only if it has an architecture decoration, for example [DefaultInstall.NTAMD64] .

Which INF directives are invalid in a universal INF file?

You can use any INF directive in a universal INF file except for the following:

The following directives are valid with some caveats:

The INF AddReg Directive is valid if entries in the specified add-registry-section have a reg-root value of HKR, or in the following cases:

  • For registration of Component Object Model (COM) objects, a key may be written under:
    • HKCR
    • HKLM\SOFTWARE\Classes
  • For creation of Hardware Media Foundation Transforms (MFTs), a key may be written under:
    • HKLM\SOFTWARE\Microsoft\Windows Media Foundation
    • HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows Media Foundation
    • HKLM\SOFTWARE\WOW3232Node\Microsoft\Windows Media Foundation
  • 11 (corresponds to %WINDIR%\System32)
  • 12 (corresponds to %WINDIR%\System32\Drivers)
  • 13 (corresponds to the directory under %WINDIR%\System32\DriverStore\FileRepository where the driver is stored)
    Note: CopyFiles may not be used to rename a file for which DestinationDirs includes dirid 13. Also, dirid 13 is only valid on Windows 10 products for a limited subset of device installation scenarios. Please consult guidance and samples for your specific device class for more details.
  • 10,SysWOW64 (corresponds to %WINDIR%\SysWOW64)
  • 10,vendor-specific subdirectory name
    Note: In Windows 10, version 1709, using dirid 10 with a vendor-specific subdirectory name is valid in a universal INF as measured using the InfVerif tool. In later releases, this value may not be supported. We recommend moving to dirid 13.

General Syntax Rules for INF Files

An INF file is a text file organized into named sections. Some sections have system-defined names and some sections have names determined by the writer of the INF file.

Each section contains section-specific entries that are interpreted by device installation components (class installers, co-installers, SetupAPI). Some entries begin with a predefined keyword. These entries are called directives.

Some INF file entries are basically pointers from one section to another, for a specific purpose. For example, an INF AddReg directive identifies a section that contains entries that instruct Windows to modify the registry. These entries sometimes include additional arguments (required or optional) for Windows to interpret during installation.

Читайте также:  Minecraft linux mac windows downloads

Other INF file entries do not point to other sections, but supply information that Windows uses during installation, such as file names, registry values, hardware configuration information, flags, and so on. For example, an INF DriverVer directive supplies driver version information.

When Windows begins an installation, it first looks for an INF Version section to verify the validity of the INF file and to determine where installation files are located. Then it starts the installation by finding an INF Manufacturer section. This section contains directives to INF Models sections, which in turn provide directives leading to various INF DDInstall sections, based on the hardware ID of the device being installed.

The following syntax rules govern the required and optional contents of INF files, the format of section names by using string tokens, and line format, continuation, and comments.

Case Sensitivity

  • Section names, entries, and directives are case-insensitive. For example, version, VERSION, and Version are equally valid section name specifications within an INF file.

Required and Optional Contents

The set of required and optional sections, entries, and directives in any particular INF file depends on the type of device/driver or component (such as an application or device class installer DLL) to be installed.

The set of sections, section-specific entries, and directives required to install any particular device and its drivers also depends somewhat on the corresponding class installer. For more information about how the system-supplied class installers handle device-type-specific INF files, see the device-type specific documentation in the WDK.

Within syntax definitions, optional entries are delimited by unbolded brackets ([,]). On the other hand, bold brackets ([, ]) are required elements of the entry in which they are contained. In the following example, the brackets around Version are required, while the brackets around Class=class-name indicate this entry is optional.

Section Names

Sections can be specified in any order. Most INF files list sections in a particular order, by convention, but Windows finds sections by name, not by location within the INF file.

Each section in an INF file begins with the section name enclosed in brackets ([ ]). The section name can be system-defined or INF-writer-defined.

For example, [Manufacturer] specifies the start of the system-named Manufacturer section, while [Std.Mfg] represents a particular INF-writer-defined Models section name.

A section name has a maximum length of 255 characters on Windows 2000 and later versions of Windows.

Each section ends at the beginning of a new [section-name] or at the end-of-file mark.

If more than one section in an INF file has the same name, the system merges their entries and directives into a single section.

Unless it is enclosed in double quotation marks characters («), an INF-writer-defined section name must be a unique-to-the-INF unquoted string of explicitly visible characters, excluding certain characters with INF-specific meanings. In particular, an unquoted section name referenced by a section entry or directive cannot have leading or trailing spaces, a linefeed character, a return character, or any invisible control character, and it should not contain tabs. In addition, it cannot contain either of the bracket ([ ]) characters, a single percent (%) character, a semicolon (;), or any internal double quotation marks («) characters, and it cannot have a backslash (\) as its last character.

For example, Std.Mfg and Std_Mfg are unique and valid section names when referenced by an INF file entry or directive, but Std;Mfg (with its internal semicolon) is invalid unless it is enclosed by double quotation marks («).

Specifying an INF-writer-defined section name as a «quoted string« overrides most of the restrictions that were previously described on characters in referenced section names. Such a delimited section name can contain almost any explicitly or implicitly visible characters except the closing bracket (]) as long as the corresponding section in the INF file matches this «quoted string« exactly.

Читайте также:  Conexant 20672 smartaudio hd драйвер windows 10

For example, «;; Std Mfg « is a valid section-name reference if the corresponding section declaration in the INF file exactly matches the name inside the double quotation marks with respect to its space and semicolon characters as [;; Std Mfg ].

Using String Tokens

Many values in an INF file, including INF-writer-defined section names, can be expressed as string key tokens of the form %strkey%. In the INF Strings section of the INF file, each string key must be associated with a string value that consists of a sequence of explicitly visible characters. If necessary, the setup code converts the string value, into Unicode.

For more information about how to define %strkey% tokens and their respective values, see the description of the INF Strings section.

Line Format, Continuation, and Comments

Each entry and directive in a section ends with a return or linefeed character. Therefore, the text editor used to create an INF file must not insert return or linefeed characters after some arbitrary, editor-determined number of characters.

The backslash character (\) can be used as an explicit line continuator in an entry or directive. However, backslash characters are used also in path specifications. To ensure that a backslash character that appears in a path specification is not misinterpreted as a line continuator, use the following strategy:

For a directive that spans two lines, one of which is an entry that contains a backslash, use quotation marks to delimit the entry that contains the backslash.

Avoid using the backslash character in the manner shown in the following example. Windows ignores the first backslash and interprets the second backslash as a line continuator.

The following syntax is valid and is equivalent to CopyFiles = «SomeDirectory\»,SomeFile ; comment .

Because text after a semicolon is ignored, CopyFiles = «SomeDirectory\» ; comment ,SomeFile does not work.

Comments begin with a semicolon (;) character. When parsing and interpreting an INF file, the system assumes that the following have no relevance to the installation process:

  • Any characters following a semicolon on the same line, unless the semicolon appears within a «quoted string« or %strkey% token
  • Any empty line that contains nothing except a linefeed or return character

Commas separate the values supplied in section entries and directives.

An INF file entry or directive can omit an optional value in the middle of a list of values, but the commas must remain. INF files can omit trailing commas.

For example, consider the syntax for a SourceDisksFiles section entry:

filename=diskid[,[subdir][,size]]

An entry that omits the subdir value but supplies the size value must specify the comma delimiters for both values, as shown in the following example:

filename=diskid,,size

An entry in an INF file that omits the two optional values can have this format:

filename=diskid

In order to include a percent (%) character in values supplied in section entries and directives, escape the percent character with another percent character.

For example, consider this statement in an [add-registry-section] section:

The registry value will be set with the following value:

In order to include a double quote («) character in values supplied in section entries and directives, escape the double quote character with another double quote character. Note that the string must be within a «quoted string«.

For example, consider this statement in an [add-registry-section] section:

HKR,,Example,,»Display an «»example»» string»

The registry value will be set with the following value:

Display an «example» string

INF Size Limits

The maximum length, in characters, of an INF file field, before string substitution and including a terminating NULL character, is 4096.

After string substitution, the maximum length, in characters, of an INF file string is 4096, which includes a terminating NULL character.

However, be aware that Plug and Play (PnP) may impose a more restrictive limit for certain INF file fields that it recognizes or uses, such as device description, driver provider, and device manufacturer.

Оцените статью