Rediger

Del via


Install a battery driver

A battery driver's INF (.inf) file specifies information about the driver and the devices it controls. All battery devices belong to the Battery class, and the battery class installer installs the driver. The sections in a battery driver's INF file include Version, DestinationDirs, Manufacturer, Models, DDInstall, and DDInstall.Services.

This article describes the battery-specific entries in the INF file. For more information about creating and distributing INF files and installing drivers, see Creating an INF File and INF File Sections and Directives.

Version section

A battery driver's INF file specifies the Battery class and the class GUID value by using the INF Version section.

The following example shows how to specify the Version section:

[Version]
Signature="$WINDOWS NT$"
Class=Battery
ClassGuid={72631e54-78a4-11d0-bcf7-00aa00b7b32a}
Provider=%MyCo%
CatalogFile=ExampleCatalog.cat
PnpLockdown=1

The %MyCo% value must be defined in an INF Strings section, which isn't demonstrated in the example.

DestinationDirs section

In the INF DestinationDirs section, a battery driver's INF specifies the driver store as the default for all files.

The following example shows how to specify the DestinationDirs section where the driver store value is 13:

[DestinationDirs]
DefaultDestDir = 13

Manufacturer section

The INF Manufacturer section defines the manufacturer of the device, as shown in the following example:

[Manufacturer]
%MyCo%=MyCompany,NTamd64.10.0...16299

Models section

The INF Models section specifies the PnP hardware ID of the battery (shown as the ID pnpid in the example). If the device is enumerated through an Advanced Configuration and Power Interface (ACPI), this INF section must also specify the EISA-style ID (shown as the ID acpidevnum in the example).

For information about creating these identifiers, see the ACPI Specification on the ACPI / Power Management website.

The following example shows how to specify the Models section:

[MyCompany.NTamd64.10.0...16299]
%pnpid.DeviceDesc% = NewBatt_Inst,pnpid
%ACPI\acpidevnum.DeviceDesc% = NewBatt_Inst,ACPI\acpidevnum

DDInstall section

In the INF DDInstall section, an INF CopyFiles directive copies the new miniclass driver to the destination specified in the DestinationDirs directive. In the following exmaple, the DDInstall section is named NewBatt_Inst, and the miniclass driver is 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.

The following example shows how to specify the DDInstall section:

[NewBatt_Inst]
CopyFiles = @NewBatt.sys
Include = battery.inf
Needs = Battery_Inst

DDInstall.Services section

The INF DDInstall.Services section includes an INF AddService directive that specifies more information about the battery driver. A battery driver's INF file should indicate the driver is a kernel driver that uses normal error handling and starts during initialization of the operating system. Battery drivers specify the load order group Extended Base.

The following example shows how to specify the DDInstall.Services section:

[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