安装电池驱动程序 - Windows drivers
A battery driver's INF (.inf) file specifies information about the driver and the devices it controls. 所有电池设备都属于该 Battery 类,电池类安装程序安装驱动程序。 电池驱动程序 INF 文件中的部分包括版本、DestinationDirs、Manufacturer、Models、DDInstall 和 DDInstall.Services。
本文介绍 INF 文件中特定于电池的条目。 有关创建和分发 INF 文件和安装驱动程序的详细信息,请参阅 创建 INF 文件 和 INF 文件节和指令。
Version section
电池驱动程序的 INF 文件使用 INF 版本部分指定Battery类和类 GUID 值。
以下示例演示如何指定“版本”部分:
[Version]
Signature="$WINDOWS NT$"
Class=Battery
ClassGuid={72631e54-78a4-11d0-bcf7-00aa00b7b32a}
Provider=%MyCo%
CatalogFile=ExampleCatalog.cat
PnpLockdown=1
该值 %MyCo% 必须在 INF Strings 节中定义,本示例中未演示该值。
DestinationDirs section
在 INF DestinationDirs 部分中,电池驱动程序的 INF 将 驱动程序存储 指定为所有文件的默认值。
以下示例演示如何指定 驱动程序存储值为 13 的 DestinationDirs 节:
[DestinationDirs]
DefaultDestDir = 13
Manufacturer section
INF 制造商部分定义设备的制造商,如以下示例所示:
[Manufacturer]
%MyCo%=MyCompany,NTamd64.10.0...16299
Models section
INF Models 部分指定电池的 PnP 硬件 ID(如示例中的 IDpnpid)。 如果设备通过高级配置和电源接口(ACPI)枚举,则此 INF 部分还必须指定 EISA 样式 ID(如示例中的 ID acpidevnum )。
有关创建这些标识符的信息,请参阅 ACPI/Power Management 网站上的 ACPI 规范。
以下示例演示如何指定“模型”部分:
[MyCompany.NTamd64.10.0...16299]
%pnpid.DeviceDesc% = NewBatt_Inst,pnpid
%ACPI\acpidevnum.DeviceDesc% = NewBatt_Inst,ACPI\acpidevnum
DDInstall section
在 INF DDInstall 节中, INF CopyFiles 指令 将新的微型类驱动程序复制到 DestinationDirs 指令中指定的目标。 在以下 exmaple 中,DDInstall 节命名 NewBatt_Inst,微型类驱动程序为 NewBatt.sys。 The specification also uses the Include and Needs directives to specify a dependency on the battery class driver by using the Battery_Inst definition from the battery.inf file.
以下示例演示如何指定 DDInstall 节:
[NewBatt_Inst]
CopyFiles = @NewBatt.sys
Include = battery.inf
Needs = Battery_Inst
DDInstall.Services section
INF DDInstall.Services 部分包含一个 INF AddService 指令,该指令指定有关电池驱动程序的详细信息。 电池驱动程序的 INF 文件应指示驱动程序是使用正常错误处理并在作系统初始化期间启动的内核驱动程序。 电池驱动程序指定负载顺序组扩展基。
以下示例演示如何指定 DDInstall.Services 部分:
[NewBatt_Inst.Services]
AddService = NewBatt,2,NewBatt_Service_Inst ; function driver for the device
[NewBatt_Service_Inst]
DisplayName = %NewBatt.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL%
ServiceBinary = %13%\NewBatt.sys