BatteryClassInitializeDevice function (batclass.h)

The BatteryClassInitializeDevice routine initializes a new battery device for the class driver.

Syntax

NTSTATUS BATTERYCLASSAPI BatteryClassInitializeDevice(
  [in]  PBATTERY_MINIPORT_INFO MiniportInfo,
  [out] PVOID                  *ClassData
);

Parameters

[in] MiniportInfo

Pointer to a BATTERY_MINIPORT_INFO structure.

[out] ClassData

Pointer to a location at which BatteryClassInitializeDevice returns a handle to be used in subsequent calls to BatteryMiniXxx routines.

Return value

BatteryClassInitializeDevice returns STATUS_SUCCESS or, possibly, STATUS_INSUFFICIENT_RESOURCES if not enough memory is available to store the battery miniclass data.

Remarks

Battery miniclass drivers must call BatteryClassInitializeDevice to register each battery device and to pass data about the device and the miniclass driver to the battery class driver.

This routine should be called as part of the device initialization, typically from the miniclass driver's AddDevice routine.

The Context member of the BATTERY_MINIPORT_INFO structure points to an area where the class and miniclass drivers maintain information about the battery device and its drivers. The context area typically contains the pageable device extension from the FDO and can also include other information at the discretion of the driver writer.

The class driver passes a pointer to the context area in calls to battery miniclass driver routines (BatteryMiniXxx routines). In their BatteryMiniXxx routines, miniclass drivers should read and write the device extension data through the passed-in pointer.

Miniclass drivers must use the BATTERY_MINIPORT_INFO structure to supply entry points for all the BatteryMiniXxx routines.

If BatteryClassInitializeDevice successfully initializes the battery device, the caller is responsible for calling the BatteryClassUnload function to free the resources for the battery device when it is no longer in use.

Requirements

Requirement Value
Target Platform Desktop
Header batclass.h (include Batclass.h)
Library Battc.lib

See also

BatteryClassUnload

BatteryMiniDisableStatusNotify

BatteryMiniQueryInformation

BatteryMiniQueryStatus

BatteryMiniQueryTag

BatteryMiniSetInformation

BatteryMiniSetStatusNotify