31 Irp->IoStatus.Information = 0;
97 ListHead = &DeviceExtension->BatteryList;
98 NextEntry = ListHead->
Flink;
99 while (NextEntry != ListHead)
106 Tag = DeviceExtension->NextTag;
108 DeviceExtension->Tag =
Tag;
109 DeviceExtension->NextTag =
Tag + 1;
114 DeviceExtension->Tag = 0;
115 NextEntry = NextEntry->
Flink;
167 *
Tag = DeviceExtension->Tag;
192 ListHead = &DeviceExtension->BatteryList;
193 NextEntry = ListHead->
Flink;
194 while (NextEntry != ListHead)
200 NextEntry = NextEntry->
Flink;
241 BatteryInfo->DefaultAlert1 = 0;
242 BatteryInfo->DefaultAlert2 = 0;
243 BatteryInfo->CriticalBias = 0;
247 ListHead = &DeviceExtension->BatteryList;
248 NextEntry = ListHead->
Flink;
249 while (NextEntry != ListHead)
264 if (BatteryData->
Tag)
291 DbgPrint(
"CompBattGetBatteryInformation: Read individual BATTERY_INFORMATION\n"
292 "-------- Capabilities = %x\n-------- Technology = %x\n"
293 "-------- Chemistry[4] = %x\n-------- DesignedCapacity = %x\n"
294 "-------- FullChargedCapacity = %x\n-------- DefaultAlert1 = %x\n"
295 "-------- DefaultAlert2 = %x\n-------- CriticalBias = %x\n"
296 "-------- CycleCount = %x\n",
324 BatteryInfo->DefaultAlert1 =
max(BatteryInfo->DefaultAlert1,
328 BatteryInfo->DefaultAlert2 =
max(BatteryInfo->DefaultAlert2,
332 BatteryInfo->CriticalBias =
max(BatteryInfo->CriticalBias,
342 NextEntry = NextEntry->
Flink;
350 if (!BatteryInfo->FullChargedCapacity)
352 BatteryInfo->FullChargedCapacity = BatteryInfo->DesignedCapacity;
357 DbgPrint(
"CompBattGetBatteryInformation: Returning BATTERY_INFORMATION\n"
358 "-------- Capabilities = %x\n-------- Technology = %x\n"
359 "-------- Chemistry[4] = %x\n-------- DesignedCapacity = %x\n"
360 "-------- FullChargedCapacity = %x\n-------- DefaultAlert1 = %x\n"
361 "-------- DefaultAlert2 = %x\n-------- CriticalBias = %x\n"
362 "-------- CycleCount = %x\n",
363 BatteryInfo->Capabilities,
364 BatteryInfo->Technology,
365 BatteryInfo->Chemistry,
366 BatteryInfo->DesignedCapacity,
367 BatteryInfo->FullChargedCapacity,
368 BatteryInfo->DefaultAlert1,
369 BatteryInfo->DefaultAlert2,
370 BatteryInfo->CriticalBias,
371 BatteryInfo->CycleCount);
376 sizeof(DeviceExtension->BatteryInformation));
399 ReportingScale[0].Granularity = -1;
400 ReportingScale[1].Granularity = -1;
401 ReportingScale[2].Granularity = -1;
402 ReportingScale[3].Granularity = -1;
406 ListHead = &DeviceExtension->BatteryList;
407 NextEntry = ListHead->
Flink;
408 while (NextEntry != ListHead)
422 if (BatteryData->
Tag)
432 sizeof(BatteryScale),
443 for (
i = 0;
i < 4;
i++)
446 if (BatteryScale[
i].Granularity)
449 ReportingScale[
i].Granularity =
min(BatteryScale[
i].Granularity,
450 ReportingScale[
i].Granularity);
462 NextEntry = NextEntry->
Flink;
492 PWCHAR BatteryName =
L"Composite Battery";
496 ULONG QueryLength = 0;
502 if ((
Tag != DeviceExtension->Tag) ||
520 QueryData = &BatteryInfo;
521 QueryLength =
sizeof(BatteryInfo);
528 RtlZeroMemory(&BatteryGranularity,
sizeof(BatteryGranularity));
533 QueryLength =
sizeof(BatteryGranularity);
534 QueryData = &BatteryGranularity;
546 QueryLength =
sizeof(
Time);
555 QueryData = BatteryName;
556 QueryLength =
sizeof(
L"Composite Battery");
573 QueryLength =
sizeof(Dummy);
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG _Out_ PULONG ReturnedLength
_In_ ULONG _In_ PBATTERY_NOTIFY BatteryNotify
#define BATTERY_UNKNOWN_CAPACITY
_In_ ULONG _Out_ PBATTERY_STATUS BatteryStatus
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG AtRate
@ BatteryGranularityInformation
#define IOCTL_BATTERY_QUERY_INFORMATION
enum _BATTERY_QUERY_INFORMATION_LEVEL BATTERY_QUERY_INFORMATION_LEVEL
BCLASSAPI NTSTATUS NTAPI BatteryClassIoctl(PVOID ClassData, PIRP Irp)
NTSTATUS NTAPI CompBattMonitorIrpComplete(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PKEVENT Event)
NTSTATUS NTAPI CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo, IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
NTSTATUS NTAPI CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, IN ULONG Tag, IN BATTERY_QUERY_INFORMATION_LEVEL InfoLevel, IN OPTIONAL LONG AtRate, IN PVOID Buffer, IN ULONG BufferLength, OUT PULONG ReturnedLength)
VOID NTAPI CompBattRecalculateTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
NTSTATUS NTAPI CompBattDisableStatusNotify(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
NTSTATUS NTAPI CompBattSystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI CompBattIoctl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI CompBattOpenClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE ReportingScale, IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
NTSTATUS NTAPI CompBattMonitorIrpCompleteWorker(IN PCOMPBATT_BATTERY_DATA BatteryData)
NTSTATUS NTAPI CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, OUT PULONG Tag)
NTSTATUS NTAPI CompBattSetStatusNotify(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, IN ULONG BatteryTag, IN PBATTERY_NOTIFY BatteryNotify)
NTSTATUS NTAPI CompBattQueryStatus(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, IN ULONG Tag, IN PBATTERY_STATUS BatteryStatus)
NTSTATUS NTAPI CompBattGetEstimatedTime(OUT PULONG Time, IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
NTSTATUS NTAPI CompBattPowerDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI BatteryIoctl(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl)
#define COMPBATT_TAG_ASSIGNED
#define COMPBATT_BATTERY_INFORMATION_PRESENT
NTSTATUS NTAPI CompBattAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PdoDeviceObject)
NTSTATUS NTAPI CompBattPnpDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
#define NT_SUCCESS(StatCode)
DRIVER_INITIALIZE DriverEntry
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
static PLARGE_INTEGER Time
#define IoSkipCurrentIrpStackLocation(Irp)
#define IoCompleteRequest
#define STATUS_NOT_SUPPORTED
#define STATUS_DEVICE_REMOVED
#define STATUS_NOT_IMPLEMENTED
#define IRP_MJ_DEVICE_CONTROL
#define STATUS_BUFFER_TOO_SMALL
PULONG MinorVersion OPTIONAL
PDEVICE_OBJECT DeviceObject
BATTERY_INFORMATION BatteryInformation
BATTERY_WAIT_STATUS WaitStatus
IO_REMOVE_LOCK RemoveLock
PDEVICE_OBJECT AttachedDevice
struct _LIST_ENTRY * Flink
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_PARAMETER
#define STATUS_NO_SUCH_DEVICE
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
#define IoAcquireRemoveLock(RemoveLock, Tag)
#define IoReleaseRemoveLock(_RemoveLock, _Tag)
#define IRP_MJ_SYSTEM_CONTROL