[Version]

[Strings]

[SourceDisksNames]

[SourceDisksFiles]

[DestinationDirs]

[Manufacturer]

Abc, Inc.=Abc.Inc

Xyz Ltd=Xyz.Ltd

 [Abc.Inc]

 Product 1=Product1.Install.HardwareId

 Product 2=Product2.Install.HardwareId

  [Product1.Install]

  CopyFiles=Product1.CopyFiles

  AddReg=Product1.AddReg

  [Product1.CopyFiles]

  …

  [Product1.AddReg]

  …

 [Product1.Install.Services]

 AddService=Product1,0x00000002,Product1.Service

  [Product1.Service]

 …

 [Product2.Install]

  …

 …

 [Xyz.Ltd]

  …

Wdm1Free.INF

The quickest way to explain how an INF file works is to use a real example. Listing 11.1 shows the INF file for the Wdm1 driver, Wdm1free.Inf.

It kicks off with a Version section, which says that all the drivers and devices installed by this INF file belong to the Unknown device class. The Provider entry is set to %WDMBook%. The Strings section at the end replaces %WDMBook% with its full name, WDM Book.

The SourceDisksNames section lists the installation disks. The first and only disk is labelled 'Wdm1 build directory.' The SourceDisksFiles section covers W98 and specifies that the only driver file, Wdm1.sys, is found on installation disk 1 and is found in subdirectory obji386free. These options make it easy to install the Wdm1 driver directly from its development location. For a commercial release, it is simpler to put the driver files in the root directory. The SourceDisksFiles.x86 section covers W2000 and specifies that Wdm1.sys is found in the objfrei386 subdirectory.

The Manufacturer section lists just one manufacturer, again called WDM Book. There is just one product model defined here in the WDM.Book section. The Wdm1 model name %Wdm1% is the one that is shown to the user, 'WDM Book: Wdm1 Example, free build'. The %Wdm1% model has a Hardware ID of *wdmBookWdml. Hardware IDs are covered later.

The Wdm1.Install section has the instructions for installing the Wdm1 driver in Windows 98. The files to copy are listed in the Wdm1.Files.Driver section and the registry entries are listed in the Wdm1.AddReg section.

Legacy non-Plug and Play devices may also have LogConfig sections to specify the resources that a device needs. See Chapter 15 for an example of this.

The Wdm1.Files.Driver section simply lists the files that must be installed. The DestinationDirs section specifies where the files listed in the Wdm1.Files.Driver section should go.

The Wdm1.AddReg section specifies that two registry entries should be created for the driver, DevLoader with *ntkern and NTMPDriver with Wdm1.sys. These entries are described in detail later.

That wraps it up for a Windows 98 installation. I shall look at the remaining Windows 2000 sections later.

Listing 11.1 Wdm1free.inf

; Wdm1free.Inf – install information file

; Copyright © 1998,1999 Chris Cant, PHD Computer Consultants Ltd

[Version]

Signature='$Chicago$'

Class=Unknown

Provider=%WDMBook%

DriverVer=04/26/1999,1.0.6.0

[Manufacturer]

%WDMBook% = WDM.Book

[WDM.Book]

%Wdm1%=Wdm1.Install, *wdmBookWdm1

[DestinationDirs]

Wdm1.Files.Driver=10,System32Drivers

Wdm1.Files.Driver.NTx86=10,System32Drivers

[SourceDisksNames]

1='Wdml build directory',,,

[SourceDisksFiles]

Wdm1.sys=1,obji386free

[SourceDisksFiles.x86]

Wdm1.sys=1,objfrei386

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Windows 98

[Wdm1.Install]

CopyFiles=Wdm1.Files.Driver

AddReg=Wdm1.AddReg

[Wdm1.AddReg]

HKR,,DevLoader,,*ntkern

HKR,,NTMPDriver,,Wdm1.sys

[Wdm1.Files.Driver]

Wdm1.sys

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Windows 2000

[Wdm1.Install.NTx86]

CopyFiles=Wdm1.Files.Driver.NTx86

[Wdm1.Files.Driver.NTx86]

Wdm1.sys,,,%COPYFLG_NOSKIP%

[Wdm1.Install.NTx86.Services]

AddService = Wdm1, %SPSVCINST_ASSOCSERVICE%, Wdm1.Service

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату
×