[Wdm1.Service]

DisplayName = %Wdm1.ServiceName%

ServiceType = %SERVICE_KERNEL_DRIVER%

StartType = %SERVICE_DEMAND_START%

ErrorControl = %SERVICE_ERROR_NORMAL%

ServiceBinary = %10%System32DriversWdm1.sys

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

; Strings

[Strings]

WDMBook='WDM Book'

Wdm1='WDM Book: Wdm1 Example, free build'

Wdm1.ServiceName='WDM Book Wdm1 Driver'

SPSVCINST_ASSOCSERVICE=0x00000002 ; Driver service is associated with device being installed

COPYFLG_NOSKIP=2 ; Do not allow user to skip file

SERVICE_KERNEL_DRIVER=1

SERVICE_AUTO_START=2

SERVICE_DEMAND_START=3

SERVICE_ERROR_NORMAL=1

DestinationDirs Section

Each line in the DestinationDirs section specifies the base directory for files listed in a CopyFiles section.

The W2000 DDK lists the directory codes. For Windows 2000, code 12 means System32 drivers in the Windows directory, but in Windows 98, it means System32ioSubsys. However, WDM drivers must be installed in the Windows System32drivers directory in both versions of Windows. Therefore, code 10 (for the Windows directory) must be used, with System32Drivers specified as a subdirectory.

The Wdm1.Files.Driver entry is therefore set to 10,System32Drivers, where 10 is code for the Windows directory (e.g., C:Windows or C:WINNT). The second field is the subdirectory to add to this base directory. Therefore, the Wdm1 driver files are stored in the Windows System32Drivers directory.

AddReg Section

An AddReg section specifies what entries to add to the registry. Each line specifies an entry of the form:

reg_root,[subkey],[value_entry_name],[flags],[value]

reg_root specifies the root registry key, from the list in Table 11.3. The optional subkey field specifies a subkey off the root key. value_entry_name is the entry name to add, flags indicates the entry type, and value is its value, flags can be omitted for REG_SZ values.

Table 11.3 Possible AddReg reg_root values

HKCR HKEY_CLASSES_ROOT
HKCU HKEY_CURRENT_USER
HKLM HKEY_LOCAL_MACHINE
HKU HKEY_USERS
HKR The most relevant relative registry key

HKR is the most useful root registry key. It specifies the 'relevant' registry entry for the section in which it appears. In the case of the Wdm1.AddReg section, it is the driver key. In Windows 98 for the Wdm1 driver, this key is HKLMSystemCurrentControlSetServicesClassUnknown000. The 0000 will be replaced with the appropriate Unknown device number.

For the Wdm1.AddReg section, the default installer consequently adds DevLoader and NTMP-Driver values to this key. The DDK does not state why these particular entries are necessary; just do it. This driver key ends up with other values, as you can see if you inspect it using RegEdit.

In this INF file, Windows 2000 does not use the Wdm1.AddReg section. Instead, as I shall show, the Wdm1.Service section makes some different registry entries for the driver (in HKLM SystemCurrentControlSetServicesWdm1).

Other Registry Entries

The installation process also creates various entries for the Wdm1 device that was just installed. The INF file does not have to alter or add to these entries.

In Windows 98, the device has a registry key at HKLMEnumRootUnknown000, with 0000 changed to a different Unknown device number, if appropriate. In Windows 2000, the device registry key is HKLMSystemCurrentControlSetControlClass{4D36E97E…}000, where {4D36E97E… } is the GUID for Unknown type devices.

When the Wdm1 driver runs, it also registers its device interface with GUID {C0CF0640-5F6E-11d2-B677-00C0DFE4C1F3}, WDM1_GUID. In both Windows 98 and Windows 2000, the registry key for this is HKLMSystemCurrentControlSetControlDeviceClasses{C0CF0640…}. There are various subkeys for each device and their associated symbolic links.

Windows 98 remembers that the INF file has been installed in the registry. The HKLMSoftwareMicrosoftWindowsCurrentVersionSetupSetupXINFOEM Name key has a value C:W98INF OTHERWDM BookWDM1.INF set to 'WDM BookWDM1.INF'. This entry is not deleted if you remove the Wdm1 device.

InfEdit

The InfEdit program in the Windows 98 DDK can be used to edit simple INF files. InfEdit does not display its main menu in Windows 2000 and is, therefore, unusable there.

As Figure 11.1 shows, InfEdit displays the section names as folders in a tree in its left-hand pane. The entries in each section are shown in the right-hand pane. InfEdit lists all the possible section names and entries. Or, at least, all the ones that were possible when the program was written.

The InfEdit program has some distinct drawbacks, so I would advise against its use. I asked it to read the Wdm1Free.INF file. When it wrote the file out again, it had lost the SourceDisksNames subdirectory information. All the strings were replaced with new unhelpful names. It displayed all the Windows 2000 specific sections in a Miscellaneous Sections category. Worse, it did not recognize the strings within these sections and deleted them from the Strings section.

Figure 11.1 InfEdit program

Cross-Platform and WDM INF Files

You can create a single INF file that handles all the necessary details for the different Windows 2000 platforms and Windows 98.

The Version section Signature entry value is not used to determine the supported platforms. Instead, each platform has a different install section indicating what to do for that platform. The sections have a common base name, with additional 'decoration' characters at the end of the section name to indicate the platform. If there are no section platform variants, the basic section covers all W2000 platforms and W98.

If there are sections with different platform variants, the following rules apply. If there is no decoration, the section covers W98. .NTx86 covers the W2000 x86 platform. .NTalpha covers the W2000 alpha platform. . NT covers all W2000 platforms. You need to supply only the relevant sections.

This install section covers all platforms:

[Abc_Install]

These two sections handle Windows 98 and Windows 2000 x86 cases.

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

0

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

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