ReactOS 0.4.15-dev-8145-ga541a46
batclass.h
Go to the documentation of this file.
1/*
2 * batclass.h
3 *
4 * Battery class driver interface
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22
23#pragma once
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/* Battery device GUIDs */
30
31DEFINE_GUID(GUID_DEVICE_BATTERY,
32 0x72631e54L, 0x78A4, 0x11d0, 0xbc, 0xf7, 0x00, 0xaa, 0x00, 0xb7, 0xb3, 0x2a);
33
34#if (NTDDI_VERSION >= NTDDI_WINXP)
35DEFINE_GUID(BATTERY_STATUS_WMI_GUID,
36 0xfc4670d1, 0xebbf, 0x416e, 0x87, 0xce, 0x37, 0x4a, 0x4e, 0xbc, 0x11, 0x1a);
37DEFINE_GUID(BATTERY_RUNTIME_WMI_GUID,
38 0x535a3767, 0x1ac2, 0x49bc, 0xa0, 0x77, 0x3f, 0x7a, 0x02, 0xe4, 0x0a, 0xec);
39DEFINE_GUID(BATTERY_TEMPERATURE_WMI_GUID,
40 0x1a52a14d, 0xadce, 0x4a44, 0x9a, 0x3e, 0xc8, 0xd8, 0xf1, 0x5f, 0xf2, 0xc2);
41DEFINE_GUID(BATTERY_FULL_CHARGED_CAPACITY_WMI_GUID,
42 0x40b40565, 0x96f7, 0x4435, 0x86, 0x94, 0x97, 0xe0, 0xe4, 0x39, 0x59, 0x05);
43DEFINE_GUID(BATTERY_CYCLE_COUNT_WMI_GUID,
44 0xef98db24, 0x0014, 0x4c25, 0xa5, 0x0b, 0xc7, 0x24, 0xae, 0x5c, 0xd3, 0x71);
45DEFINE_GUID(BATTERY_STATIC_DATA_WMI_GUID,
46 0x05e1e463, 0xe4e2, 0x4ea9, 0x80, 0xcb, 0x9b, 0xd4, 0xb3, 0xca, 0x06, 0x55);
47DEFINE_GUID(BATTERY_STATUS_CHANGE_WMI_GUID,
48 0xcddfa0c3, 0x7c5b, 0x4e43, 0xa0, 0x34, 0x05, 0x9f, 0xa5, 0xb8, 0x43, 0x64);
49DEFINE_GUID(BATTERY_TAG_CHANGE_WMI_GUID,
50 0x5e1f6e19, 0x8786, 0x4d23, 0x94, 0xfc, 0x9e, 0x74, 0x6b, 0xd5, 0xd8, 0x88);
51#endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
52
53#ifndef _BATCLASS_
54#define _BATCLASS_
55
56/* BATTERY_INFORMATION.Capabilities constants */
57#define BATTERY_SET_CHARGE_SUPPORTED 0x00000001
58#define BATTERY_SET_DISCHARGE_SUPPORTED 0x00000002
59#define BATTERY_SET_RESUME_SUPPORTED 0x00000004
60#define BATTERY_IS_SHORT_TERM 0x20000000
61#define BATTERY_CAPACITY_RELATIVE 0x40000000
62#define BATTERY_SYSTEM_BATTERY 0x80000000
63
64/* BATTERY_INFORMATION.Capacity constants */
65#define BATTERY_UNKNOWN_CAPACITY 0xFFFFFFFF
66
67/* BatteryEstimatedTime constant */
68#define BATTERY_UNKNOWN_TIME 0x80000000
69
70#define MAX_BATTERY_STRING_SIZE 128
71
72/* BATTERY_STATUS.PowerState flags */
73#define BATTERY_POWER_ON_LINE 0x00000001
74#define BATTERY_DISCHARGING 0x00000002
75#define BATTERY_CHARGING 0x00000004
76#define BATTERY_CRITICAL 0x00000008
77
78/* BATTERY_STATUS.Voltage constant */
79#define BATTERY_UNKNOWN_VOLTAGE 0xFFFFFFFF
80
81/* BATTERY_STATUS.Rate constant */
82#define BATTERY_UNKNOWN_RATE 0x80000000
83
84#define IOCTL_BATTERY_QUERY_TAG \
85 CTL_CODE(FILE_DEVICE_BATTERY, 0x10, METHOD_BUFFERED, FILE_READ_ACCESS)
86#define IOCTL_BATTERY_QUERY_INFORMATION \
87 CTL_CODE(FILE_DEVICE_BATTERY, 0x11, METHOD_BUFFERED, FILE_READ_ACCESS)
88#define IOCTL_BATTERY_SET_INFORMATION \
89 CTL_CODE(FILE_DEVICE_BATTERY, 0x12, METHOD_BUFFERED, FILE_WRITE_ACCESS)
90#define IOCTL_BATTERY_QUERY_STATUS \
91 CTL_CODE(FILE_DEVICE_BATTERY, 0x13, METHOD_BUFFERED, FILE_READ_ACCESS)
92
93/* NTSTATUS possibly returned by BCLASS_QUERY_STATUS */
94#define BATTERY_TAG_INVALID 0
95
107
113
114typedef struct _BATTERY_INFORMATION {
126
132
138
144
145typedef struct _BATTERY_WAIT_STATUS {
152
153typedef struct _BATTERY_STATUS {
159
160#ifndef _WINDOWS_H
161
162/* BATTERY_MINIPORT_INFO.XxxVersion */
163#define BATTERY_CLASS_MAJOR_VERSION 0x0001
164#define BATTERY_CLASS_MINOR_VERSION 0x0000
165
166_Function_class_(BCLASS_QUERY_TAG_CALLBACK)
170typedef NTSTATUS
171(NTAPI BCLASS_QUERY_TAG_CALLBACK)(
174typedef BCLASS_QUERY_TAG_CALLBACK *PBCLASS_QUERY_TAG_CALLBACK;
175
176_Function_class_(BCLASS_QUERY_INFORMATION_CALLBACK)
180typedef NTSTATUS
181(NTAPI BCLASS_QUERY_INFORMATION_CALLBACK)(
189typedef BCLASS_QUERY_INFORMATION_CALLBACK *PBCLASS_QUERY_INFORMATION_CALLBACK;
190
191_Function_class_(BCLASS_QUERY_STATUS_CALLBACK)
195typedef NTSTATUS
196(NTAPI BCLASS_QUERY_STATUS_CALLBACK)(
200typedef BCLASS_QUERY_STATUS_CALLBACK *PBCLASS_QUERY_STATUS_CALLBACK;
201
202typedef struct _BATTERY_NOTIFY {
207
208_Function_class_(BCLASS_SET_STATUS_NOTIFY_CALLBACK)
212typedef NTSTATUS
213(NTAPI BCLASS_SET_STATUS_NOTIFY_CALLBACK)(
217typedef BCLASS_SET_STATUS_NOTIFY_CALLBACK *PBCLASS_SET_STATUS_NOTIFY_CALLBACK;
218
219_Function_class_(BCLASS_SET_INFORMATION_CALLBACK)
223typedef NTSTATUS
224(NTAPI BCLASS_SET_INFORMATION_CALLBACK)(
229typedef BCLASS_SET_INFORMATION_CALLBACK *PBCLASS_SET_INFORMATION_CALLBACK;
230
231_Function_class_(BCLASS_DISABLE_STATUS_NOTIFY_CALLBACK)
235typedef NTSTATUS
236(NTAPI BCLASS_DISABLE_STATUS_NOTIFY_CALLBACK)(
238typedef BCLASS_DISABLE_STATUS_NOTIFY_CALLBACK *PBCLASS_DISABLE_STATUS_NOTIFY_CALLBACK;
239
246
260
261#if (NTDDI_VERSION >= NTDDI_WINXP)
262
263typedef struct _BATTERY_WMI_STATUS {
274
275typedef struct _BATTERY_WMI_RUNTIME {
279
284
289
294
308
316
317typedef struct _BATTERY_TAG_CHANGE {
320
321#endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
322
323#if defined(_BATTERYCLASS_)
324#define BCLASSAPI
325#else
326#define BCLASSAPI DECLSPEC_IMPORT
327#endif
328
333NTAPI
335 _In_ PBATTERY_MINIPORT_INFO MiniportInfo,
337
342NTAPI
346
350NTAPI
353
354#if (NTDDI_VERSION >= NTDDI_WINXP)
355
360NTAPI
366 _Out_writes_(1) PULONG InstanceLengthArray,
369
374NTAPI
377 _In_ PVOID WmiLibContext, /* PWMILIB_CONTEXT */
380 _Out_ PVOID Disposition); /* PSYSCTL_IRP_DISPOSITION */
381
382#endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
383
387NTAPI
390
391#endif /* _WINDOWS_H */
392
393#endif /* _BATCLASS_ */
394
395#ifdef __cplusplus
396}
397#endif
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
struct _BATTERY_TAG_CHANGE * PBATTERY_TAG_CHANGE
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG _Out_ PULONG ReturnedLength
Definition: batclass.h:188
BCLASS_QUERY_INFORMATION_CALLBACK * PBCLASS_QUERY_INFORMATION_CALLBACK
Definition: batclass.h:189
BCLASS_SET_STATUS_NOTIFY_CALLBACK * PBCLASS_SET_STATUS_NOTIFY_CALLBACK
Definition: batclass.h:217
struct _BATTERY_WAIT_STATUS * PBATTERY_WAIT_STATUS
struct _BATTERY_QUERY_INFORMATION BATTERY_QUERY_INFORMATION
struct _BATTERY_WMI_FULL_CHARGED_CAPACITY BATTERY_WMI_FULL_CHARGED_CAPACITY
_Inout_ PDEVICE_OBJECT _Inout_ PIRP _In_ ULONG GuidIndex
Definition: batclass.h:365
BCLASS_SET_INFORMATION_CALLBACK * PBCLASS_SET_INFORMATION_CALLBACK
Definition: batclass.h:229
_Out_ PVOID * ClassData
Definition: batclass.h:336
_In_ PVOID _In_ PDEVICE_OBJECT _Inout_ PIRP _Out_ PVOID Disposition
Definition: batclass.h:380
struct _BATTERY_WMI_STATUS_CHANGE * PBATTERY_WMI_STATUS_CHANGE
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG BufferLength
Definition: batclass.h:187
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL Level
Definition: batclass.h:184
_In_ PVOID WmiLibContext
Definition: batclass.h:377
struct _BATTERY_WMI_STATUS BATTERY_WMI_STATUS
struct _BATTERY_STATUS * PBATTERY_STATUS
struct _BATTERY_WAIT_STATUS BATTERY_WAIT_STATUS
BCLASS_DISABLE_STATUS_NOTIFY_CALLBACK * PBCLASS_DISABLE_STATUS_NOTIFY_CALLBACK
Definition: batclass.h:238
struct _BATTERY_WMI_STATIC_DATA * PBATTERY_WMI_STATIC_DATA
_BATTERY_SET_INFORMATION_LEVEL
Definition: batclass.h:133
@ BatteryDischarge
Definition: batclass.h:136
@ BatteryCharge
Definition: batclass.h:135
@ BatteryCriticalBias
Definition: batclass.h:134
_In_ ULONG _In_ PBATTERY_NOTIFY BatteryNotify
Definition: batclass.h:216
PBCLASS_SET_INFORMATION_CALLBACK BCLASS_SET_INFORMATION
Definition: batclass.h:244
_Out_ PULONG BatteryTag
Definition: batclass.h:173
_In_ ULONG _Out_ PBATTERY_STATUS BatteryStatus
Definition: batclass.h:199
struct _BATTERY_WMI_TEMPERATURE * PBATTERY_WMI_TEMPERATURE
struct _BATTERY_WMI_STATUS * PBATTERY_WMI_STATUS
BCLASS_QUERY_TAG_CALLBACK * PBCLASS_QUERY_TAG_CALLBACK
Definition: batclass.h:174
struct _BATTERY_WMI_CYCLE_COUNT * PBATTERY_WMI_CYCLE_COUNT
struct _BATTERY_WMI_FULL_CHARGED_CAPACITY * PBATTERY_WMI_FULL_CHARGED_CAPACITY
struct _BATTERY_INFORMATION * PBATTERY_INFORMATION
struct _BATTERY_QUERY_INFORMATION * PBATTERY_QUERY_INFORMATION
struct _BATTERY_NOTIFY * PBATTERY_NOTIFY
struct _BATTERY_WMI_TEMPERATURE BATTERY_WMI_TEMPERATURE
struct _BATTERY_SET_INFORMATION BATTERY_SET_INFORMATION
PBCLASS_QUERY_INFORMATION_CALLBACK BCLASS_QUERY_INFORMATION
Definition: batclass.h:241
struct _BATTERY_WMI_STATIC_DATA BATTERY_WMI_STATIC_DATA
struct _BATTERY_TAG_CHANGE BATTERY_TAG_CHANGE
struct _BATTERY_WMI_RUNTIME * PBATTERY_WMI_RUNTIME
struct _BATTERY_WMI_CYCLE_COUNT BATTERY_WMI_CYCLE_COUNT
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG AtRate
Definition: batclass.h:185
PBCLASS_SET_STATUS_NOTIFY_CALLBACK BCLASS_SET_STATUS_NOTIFY
Definition: batclass.h:243
struct _BATTERY_MINIPORT_INFO BATTERY_MINIPORT_INFO
PBCLASS_DISABLE_STATUS_NOTIFY_CALLBACK BCLASS_DISABLE_STATUS_NOTIFY
Definition: batclass.h:245
struct _BATTERY_INFORMATION BATTERY_INFORMATION
#define BCLASSAPI
Definition: batclass.h:326
struct _BATTERY_WMI_STATUS_CHANGE BATTERY_WMI_STATUS_CHANGE
struct _BATTERY_MINIPORT_INFO * PBATTERY_MINIPORT_INFO
enum _BATTERY_SET_INFORMATION_LEVEL BATTERY_SET_INFORMATION_LEVEL
_BATTERY_QUERY_INFORMATION_LEVEL
Definition: batclass.h:96
@ BatteryInformation
Definition: batclass.h:97
@ BatteryManufactureName
Definition: batclass.h:103
@ BatteryGranularityInformation
Definition: batclass.h:98
@ BatterySerialNumber
Definition: batclass.h:105
@ BatteryUniqueID
Definition: batclass.h:104
@ BatteryEstimatedTime
Definition: batclass.h:100
@ BatteryDeviceName
Definition: batclass.h:101
@ BatteryTemperature
Definition: batclass.h:99
@ BatteryManufactureDate
Definition: batclass.h:102
struct _BATTERY_MANUFACTURE_DATE * PBATTERY_MANUFACTURE_DATE
PBCLASS_QUERY_STATUS_CALLBACK BCLASS_QUERY_STATUS
Definition: batclass.h:242
struct _BATTERY_WMI_RUNTIME BATTERY_WMI_RUNTIME
struct _BATTERY_MANUFACTURE_DATE BATTERY_MANUFACTURE_DATE
_In_ ULONG _In_ BATTERY_SET_INFORMATION_LEVEL _In_opt_ PVOID Buffer
Definition: batclass.h:228
BCLASS_QUERY_STATUS_CALLBACK * PBCLASS_QUERY_STATUS_CALLBACK
Definition: batclass.h:200
enum _BATTERY_QUERY_INFORMATION_LEVEL BATTERY_QUERY_INFORMATION_LEVEL
struct _BATTERY_STATUS BATTERY_STATUS
PBCLASS_QUERY_TAG_CALLBACK BCLASS_QUERY_TAG
Definition: batclass.h:240
struct _BATTERY_NOTIFY BATTERY_NOTIFY
struct _BATTERY_SET_INFORMATION * PBATTERY_SET_INFORMATION
BCLASSAPI NTSTATUS NTAPI BatteryClassQueryWmiDataBlock(PVOID ClassData, PDEVICE_OBJECT DeviceObject, PIRP Irp, ULONG GuidIndex, PULONG InstanceLengthArray, ULONG OutBufferSize, PUCHAR Buffer)
Definition: battc.c:63
BCLASSAPI NTSTATUS NTAPI BatteryClassStatusNotify(PVOID ClassData)
Definition: battc.c:79
BCLASSAPI NTSTATUS NTAPI BatteryClassInitializeDevice(PBATTERY_MINIPORT_INFO MiniportInfo, PVOID *ClassData)
Definition: battc.c:137
BCLASSAPI NTSTATUS NTAPI BatteryClassIoctl(PVOID ClassData, PIRP Irp)
Definition: battc.c:189
BCLASSAPI NTSTATUS NTAPI BatteryClassSystemControl(PVOID ClassData, PVOID WmiLibContext, PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Disposition)
Definition: battc.c:49
BCLASSAPI NTSTATUS NTAPI BatteryClassUnload(PVOID ClassData)
Definition: battc.c:27
Definition: bufpool.h:45
_In_ PIRP Irp
Definition: csq.h:116
#define NTSTATUS
Definition: precomp.h:21
#define _IRQL_requires_same_
Definition: driverspecs.h:232
#define _IRQL_requires_max_(irql)
Definition: driverspecs.h:230
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define _Function_class_(x)
Definition: ms_sal.h:2946
#define _Inout_
Definition: ms_sal.h:378
#define _Out_writes_bytes_to_(size, count)
Definition: ms_sal.h:360
#define _Check_return_
Definition: ms_sal.h:557
#define _Out_writes_(size)
Definition: ms_sal.h:348
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
#define _Out_writes_bytes_opt_(size)
Definition: ms_sal.h:351
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
Definition: guiddef.h:68
UCHAR Chemistry[4]
Definition: batclass.h:118
ULONG FullChargedCapacity
Definition: batclass.h:120
BCLASS_QUERY_INFORMATION QueryInformation
Definition: batclass.h:252
PDEVICE_OBJECT Pdo
Definition: batclass.h:257
BCLASS_SET_STATUS_NOTIFY SetStatusNotify
Definition: batclass.h:255
BCLASS_SET_INFORMATION SetInformation
Definition: batclass.h:253
PUNICODE_STRING DeviceName
Definition: batclass.h:258
BCLASS_DISABLE_STATUS_NOTIFY DisableStatusNotify
Definition: batclass.h:256
BCLASS_QUERY_STATUS QueryStatus
Definition: batclass.h:254
BCLASS_QUERY_TAG QueryTag
Definition: batclass.h:251
ULONG LowCapacity
Definition: batclass.h:204
ULONG HighCapacity
Definition: batclass.h:205
ULONG PowerState
Definition: batclass.h:203
BATTERY_QUERY_INFORMATION_LEVEL InformationLevel
Definition: batclass.h:110
BATTERY_SET_INFORMATION_LEVEL InformationLevel
Definition: batclass.h:141
ULONG PowerState
Definition: batclass.h:154
ULONG Capacity
Definition: batclass.h:155
WCHAR ManufactureDate[25]
Definition: batclass.h:297
BATTERY_REPORTING_SCALE Granularity[4]
Definition: batclass.h:298
BOOLEAN Discharging
Definition: batclass.h:271
BOOLEAN PowerOnline
Definition: batclass.h:269
ULONG RemainingCapacity
Definition: batclass.h:265
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
_In_ ULONG OutBufferSize
Definition: wdfwmi.h:87
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180