Книга: Writing Windows WDM Device Drivers

Standard Sections

Standard Sections

Table 11.1 shows the typical sections of an INF file. Sections that you must name are given in italics. The DDK has full details of these sections and the other ones that you can include. Most section names may also exist in a decorated form, as described in the following text. For example, Strings.LangIdSubLangId indicates a locale and SectionName.NT indicates a platform.

The Version section is usually placed at the start of the INF file. Any of the given values for Signature work for both Windows 98 and Windows 2000. See later for details of how to write cross-platform INF files for both Windows 98 and Windows 2000.

Once your driver has passed the Microsoft Hardware Compatibility Tests, you should include a reference to your digital signature file in the CatalogFile entry.

Table 11.1 Typical sections for an INF file

Section Entry Value description
Version Signature $Windows NT$, $Windows 95$ or $Chicago$
Provider INF file creator
Class One of the system-defined classnames (listed in the DDK) or your new class name.
ClassGuid The matching class GUID.
DriverVer mm/dd/yyyy [,a.b.c.d].
CatalogFile[.NTetc] Digitally-signed catalog file.
Strings %string%="value" Specifies a string.
SourceDisksNames For each distribution floppy disk or CD-ROM, specifies its descriptionand possibly the cabinet file and directory.
SourceDisksFiles Specifies the filename, the source disk ID and optionally the subdirectory and file size. This section can be empty if all the files are in the root directory.
DestinationDirs DefaultDestDir=dirid[,subdir] filelist=dirid[,subdir] Specifies the directory ID, and optionally the subdirectory, for default file copies and file copies in the filelist section. The dirid is a number indicating in which standard location to put the files (see the following).
Manufacturer %manufacturer_name%=models Specifies the manufacturer name and the name of the corresponding models section.
models Specifies a product name, the name of the corresponding install section, a Hardware ID, and zero or more Compatible IDs.
install.Interfaces List of device interfaces to add. Further AddInterface sections can specify more details, such as registry entries to add to the device interface key.
install CopyFiles=@filename | filelist Specifies a file to copy, or the name of the filelist section where the files are listed.
AddReg=addreg Specifies the name of the addreg section.
LogConfig=logconfig For legacy devices, specifies the name of the logconfig section, in which I/O addresses, IRQ configurations, etc., are detailed.
DriverVer mm/dd/yyyy [,a.b.c.d]
ProfileItems List of ProfileItem sections specifying items to add to the Start Menu.
filelist A list of the files to be installed
addreg Add new keys and values.
logconfig Legacy device configurations.
install.AddService ServiceType=1 StartType=start-code ErrorControl=error-control-level ServiceBinary=path-to-driver etc. For W2000 drivers, specifies the driver service details.

Strings

The Strings section defines strings that are substituted wherever else they are used. For example, if the Strings section looks like this:

[Strings]
Msft="Microsoft"

Any instance elsewhere of %Msft% is replaced with Microsoft. Strings are particularly useful for representing GUIDs, but can be used for any type of string, even bit values.

You can internationalize your INF file using strings in two ways. One way is to create a base INF file without any strings in an .inx file, and have a separate .txt file for each locale with the appropriate Strings section. Alternatively, have a common INF file but different Strings sections for each locale, appending .LangIDSubLangID to detail which language and sublanguage applies to this section. LangID and SubLangID are both two digits, as defined in winnt.h. SubLangID 00 is a neutral sublanguage. The following example shows how a different string is defined for UK English.

[Strings]
PrinterName="Abc Color printer"
[Strings.0902]
PrinterName="Abc Colour printer"

Оглавление книги


Генерация: 1.297. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз