[Def_Install] ; Windows 98

[Def_Install .NTx86]

; Windows 2000 x86 platform

Note that the Windows 98 setup code needs commas for all the optional values, while Windows 2000 can survive without them. For example, in the SourceDisksFiles section, each entry is documented as

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

The filename entry has two optional values. If you are going to leave these out in an INF file, make sure that you put two commas in, so that it works in Windows 98.

filename=diskid,,

Installing Wdm1 in Windows 2000

The Wdm1free.INF installation file in Listing 11.1 has separate installation instructions for Windows 2000.

The base section name for the Wdm1 device installation is Wdm1.Install. As there is a section named Wdm1.Install.NTx86 present, this section's instructions are used for the Windows 2000 x86 platform.

Wdm1.Install.NTx86 has just a CopyFiles directive. The Wdm1.Files. Driver.NTx86 section lists just Wdm1.sys, as before. This time, %COPYFLG_NOSKIP% is specified in the fourth field.

This indicates that the user cannot skip this file. There is no point in skipping the driver file in a Wdm1 installation. Note how the COPYFLG_NOSKIP string is used to hide the value 2.

[Wdm1.Files.Driver.NTx86]

Wdm1.sys,,,%COPYFLG_NOSKIP%

[Strings]

COPYFLG_NOSKIP=2 ; Do not allow user to skip file

Windows 2000 Service Registry Entries

A Windows 2000 device driver needs to be installed as a service. This means creating a registry key with the same name as the driver executable in HKLMSystemCurrentControlSetServices .

The default installer finds the Wdm1.Install.NTx86.Services section. It first adds the relevant decoration .NTx86 and then adds .Services. This section lists the services that must be added. The service is called Wdm1. The %SPSVCINST_ASSOCSERVICE% value means that the service is associated with a device. The final field says that the Wdm1.Service section has the service registry details.

[Wdm1.Install.NTx86.Services]

AddService = Wdm1, %SPSVCINST_ASSOCSERVICE%, Wdm1.Service

[Wdm1.Service]

DisplayName = %Wdm1.ServiceName%

ServiceType =%SERVICE_KERNEL_DRIVER%

StartType = %SERVICE_DEMAND_START%

ErrorControl = %SERVICE_ERROR_NORMAL%

ServiceBinary = %10%System32DriversWdm1.sys

A Windows 2000 service key must have ServiceType, StartType, ErrorControl, and ServiceBinary entries. These eventually appear as Type, Start, ErrorControl, and ImagePath registry entries, respectively. A DisplayName value and registry entry are usually added, as well.

The ServiceType entry must be %SERVICE_KERNEL_DRIVER% (1) for a kernel mode driver. Various other bits can be set such as %SERVICE_FILE_SYSTEM_DRIVER% (2).

The StartType entry specifies when the driver must be started, as shown in the list in Table 11.4. WDM device drivers should specify %SERVICE_DEMAND_START% (3).

Table 11.4 Service StartType values

Value Constant Description
0 SERVICE_BOOT_START Start when W2000 is loaded.
1 SERVICE_SYSTEM_START Start when W2000 is initializing itself.
2 SERVICE_AUTO_START Start when W2000 is up and running.
3 SERVICE_DEMAND_START Start manually or when an associated device is added.
4 SERVICE_DISABLED Never start.

The ErrorControl entry specifies how the system should respond if the driver cannot load, as shown in the list in Table 11.5. The Wdm1 installation opts for normal error logging.

Table 11.5 Service ErrorControl values

Value Constant Description
0 SERVICE_ERROR_IGNORE Log error but do not display a message to the user.
1 SERVICE_ERROR_NORMAL Log error and display a warning message.
2 SERVICE_ERROR_SEVERE Log error and restart with last known good configuration.
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

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

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