1 | /**
|
---|
2 | * This file is part of the mingw-w64 runtime package.
|
---|
3 | * No warranty is given; refer to the file DISCLAIMER within this package.
|
---|
4 | */
|
---|
5 |
|
---|
6 | #include <winapifamily.h>
|
---|
7 | #include <poclass.h>
|
---|
8 |
|
---|
9 | DEFINE_GUID (BATTERY_STATUS_WMI_GUID, 0xfc4670d1, 0xebbf, 0x416e, 0x87, 0xce, 0x37, 0x4a, 0x4e, 0xbc, 0x11, 0x1a);
|
---|
10 | DEFINE_GUID (BATTERY_RUNTIME_WMI_GUID, 0x535a3767, 0x1ac2, 0x49bc, 0xa0, 0x77, 0x3f, 0x7a, 0x02, 0xe4, 0x0a, 0xec);
|
---|
11 | DEFINE_GUID (BATTERY_TEMPERATURE_WMI_GUID, 0x1a52a14d, 0xadce, 0x4a44, 0x9a, 0x3e, 0xc8, 0xd8, 0xf1, 0x5f, 0xf2, 0xc2);
|
---|
12 | DEFINE_GUID (BATTERY_FULL_CHARGED_CAPACITY_WMI_GUID, 0x40b40565, 0x96f7, 0x4435, 0x86, 0x94, 0x97, 0xe0, 0xe4, 0x39, 0x59, 0x05);
|
---|
13 | DEFINE_GUID (BATTERY_CYCLE_COUNT_WMI_GUID, 0xef98db24, 0x0014, 0x4c25, 0xa5, 0x0b, 0xc7, 0x24, 0xae, 0x5c, 0xd3, 0x71);
|
---|
14 | DEFINE_GUID (BATTERY_STATIC_DATA_WMI_GUID, 0x05e1e463, 0xe4e2, 0x4ea9, 0x80, 0xcb, 0x9b, 0xd4, 0xb3, 0xca, 0x06, 0x55);
|
---|
15 | DEFINE_GUID (BATTERY_STATUS_CHANGE_WMI_GUID, 0xcddfa0c3, 0x7c5b, 0x4e43, 0xa0, 0x34, 0x05, 0x9f, 0xa5, 0xb8, 0x43, 0x64);
|
---|
16 | DEFINE_GUID (BATTERY_TAG_CHANGE_WMI_GUID, 0x5e1f6e19, 0x8786, 0x4d23, 0x94, 0xfc, 0x9e, 0x74, 0x6b, 0xd5, 0xd8, 0x88);
|
---|
17 |
|
---|
18 | #ifndef _BATCLASS_
|
---|
19 | #define _BATCLASS_
|
---|
20 |
|
---|
21 | #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
|
---|
22 | #ifndef _WINDOWS_
|
---|
23 |
|
---|
24 | typedef NTSTATUS (BCLASS_QUERY_TAG_CALLBACK) (PVOID Context, PULONG BatteryTag);
|
---|
25 | typedef BCLASS_QUERY_TAG_CALLBACK *PBCLASS_QUERY_TAG_CALLBACK;
|
---|
26 | typedef NTSTATUS (BCLASS_QUERY_INFORMATION_CALLBACK) (PVOID Context, ULONG BatteryTag, BATTERY_QUERY_INFORMATION_LEVEL Level, LONG AtRate, PVOID Buffer, ULONG BufferLength, PULONG ReturnedLength);
|
---|
27 | typedef BCLASS_QUERY_INFORMATION_CALLBACK *PBCLASS_QUERY_INFORMATION_CALLBACK;
|
---|
28 | typedef NTSTATUS (BCLASS_QUERY_STATUS_CALLBACK) (PVOID Context, ULONG BatteryTag, PBATTERY_STATUS BatteryStatus);
|
---|
29 | typedef BCLASS_QUERY_STATUS_CALLBACK *PBCLASS_QUERY_STATUS_CALLBACK;
|
---|
30 |
|
---|
31 | typedef struct {
|
---|
32 | ULONG PowerState;
|
---|
33 | ULONG LowCapacity;
|
---|
34 | ULONG HighCapacity;
|
---|
35 | } BATTERY_NOTIFY,*PBATTERY_NOTIFY;
|
---|
36 |
|
---|
37 | typedef NTSTATUS (BCLASS_SET_STATUS_NOTIFY_CALLBACK) (PVOID Context, ULONG BatteryTag, PBATTERY_NOTIFY BatteryNotify);
|
---|
38 | typedef BCLASS_SET_STATUS_NOTIFY_CALLBACK *PBCLASS_SET_STATUS_NOTIFY_CALLBACK;
|
---|
39 | typedef NTSTATUS (BCLASS_SET_INFORMATION_CALLBACK) (PVOID Context, ULONG BatteryTag, BATTERY_SET_INFORMATION_LEVEL Level, PVOID Buffer);
|
---|
40 | typedef BCLASS_SET_INFORMATION_CALLBACK *PBCLASS_SET_INFORMATION_CALLBACK;
|
---|
41 | typedef NTSTATUS (BCLASS_DISABLE_STATUS_NOTIFY_CALLBACK) (PVOID Context);
|
---|
42 | typedef BCLASS_DISABLE_STATUS_NOTIFY_CALLBACK *PBCLASS_DISABLE_STATUS_NOTIFY_CALLBACK;
|
---|
43 | typedef PBCLASS_QUERY_TAG_CALLBACK BCLASS_QUERY_TAG;
|
---|
44 | typedef PBCLASS_QUERY_INFORMATION_CALLBACK BCLASS_QUERY_INFORMATION;
|
---|
45 | typedef PBCLASS_QUERY_STATUS_CALLBACK BCLASS_QUERY_STATUS;
|
---|
46 | typedef PBCLASS_SET_STATUS_NOTIFY_CALLBACK BCLASS_SET_STATUS_NOTIFY;
|
---|
47 | typedef PBCLASS_SET_INFORMATION_CALLBACK BCLASS_SET_INFORMATION;
|
---|
48 | typedef PBCLASS_DISABLE_STATUS_NOTIFY_CALLBACK BCLASS_DISABLE_STATUS_NOTIFY;
|
---|
49 |
|
---|
50 | typedef struct {
|
---|
51 | USHORT MajorVersion;
|
---|
52 | USHORT MinorVersion;
|
---|
53 | PVOID Context;
|
---|
54 | BCLASS_QUERY_TAG QueryTag;
|
---|
55 | BCLASS_QUERY_INFORMATION QueryInformation;
|
---|
56 | BCLASS_SET_INFORMATION SetInformation;
|
---|
57 | BCLASS_QUERY_STATUS QueryStatus;
|
---|
58 | BCLASS_SET_STATUS_NOTIFY SetStatusNotify;
|
---|
59 | BCLASS_DISABLE_STATUS_NOTIFY DisableStatusNotify;
|
---|
60 | PDEVICE_OBJECT Pdo;
|
---|
61 | PUNICODE_STRING DeviceName;
|
---|
62 | } BATTERY_MINIPORT_INFO,*PBATTERY_MINIPORT_INFO;
|
---|
63 |
|
---|
64 | #define BATTERY_CLASS_MAJOR_VERSION 0x0001
|
---|
65 | #define BATTERY_CLASS_MINOR_VERSION 0x0000
|
---|
66 |
|
---|
67 | typedef struct _BATTERY_WMI_STATUS {
|
---|
68 | ULONG Tag;
|
---|
69 | ULONG RemainingCapacity;
|
---|
70 | LONG ChargeRate;
|
---|
71 | LONG DischargeRate;
|
---|
72 | ULONG Voltage;
|
---|
73 | BOOLEAN PowerOnline;
|
---|
74 | BOOLEAN Charging;
|
---|
75 | BOOLEAN Discharging;
|
---|
76 | BOOLEAN Critical;
|
---|
77 | } BATTERY_WMI_STATUS,*PBATTERY_WMI_STATUS;
|
---|
78 |
|
---|
79 | typedef struct _BATTERY_WMI_RUNTIME {
|
---|
80 | ULONG Tag;
|
---|
81 | ULONG EstimatedRuntime;
|
---|
82 | } BATTERY_WMI_RUNTIME,*PBATTERY_WMI_RUNTIME;
|
---|
83 |
|
---|
84 | typedef struct _BATTERY_WMI_TEMPERATURE {
|
---|
85 | ULONG Tag;
|
---|
86 | ULONG Temperature;
|
---|
87 | } BATTERY_WMI_TEMPERATURE,*PBATTERY_WMI_TEMPERATURE;
|
---|
88 |
|
---|
89 | typedef struct _BATTERY_WMI_FULL_CHARGED_CAPACITY {
|
---|
90 | ULONG Tag;
|
---|
91 | ULONG FullChargedCapacity;
|
---|
92 | } BATTERY_WMI_FULL_CHARGED_CAPACITY,*PBATTERY_WMI_FULL_CHARGED_CAPACITY;
|
---|
93 |
|
---|
94 | typedef struct _BATTERY_WMI_CYCLE_COUNT {
|
---|
95 | ULONG Tag;
|
---|
96 | ULONG CycleCount;
|
---|
97 | } BATTERY_WMI_CYCLE_COUNT,*PBATTERY_WMI_CYCLE_COUNT;
|
---|
98 |
|
---|
99 | typedef struct _BATTERY_WMI_STATIC_DATA {
|
---|
100 | ULONG Tag;
|
---|
101 | WCHAR ManufactureDate[25];
|
---|
102 | BATTERY_REPORTING_SCALE Granularity [4];
|
---|
103 | ULONG Capabilities;
|
---|
104 | UCHAR Technology;
|
---|
105 | ULONG Chemistry;
|
---|
106 | ULONG DesignedCapacity;
|
---|
107 | ULONG DefaultAlert1;
|
---|
108 | ULONG DefaultAlert2;
|
---|
109 | ULONG CriticalBias;
|
---|
110 | WCHAR Strings[1];
|
---|
111 | } BATTERY_WMI_STATIC_DATA,*PBATTERY_WMI_STATIC_DATA;
|
---|
112 |
|
---|
113 | typedef struct _BATTERY_WMI_STATUS_CHANGE {
|
---|
114 | ULONG Tag;
|
---|
115 | BOOLEAN PowerOnline;
|
---|
116 | BOOLEAN Charging;
|
---|
117 | BOOLEAN Discharging;
|
---|
118 | BOOLEAN Critical;
|
---|
119 | } BATTERY_WMI_STATUS_CHANGE,*PBATTERY_WMI_STATUS_CHANGE;
|
---|
120 |
|
---|
121 | typedef struct _BATTERY_TAG_CHANGE {
|
---|
122 | ULONG Tag;
|
---|
123 | } BATTERY_TAG_CHANGE,*PBATTERY_TAG_CHANGE;
|
---|
124 |
|
---|
125 | #ifndef BATTERYCLASS
|
---|
126 | #define BATTERYCLASSAPI DECLSPEC_IMPORT
|
---|
127 | #else
|
---|
128 | #define BATTERYCLASSAPI
|
---|
129 | #endif
|
---|
130 |
|
---|
131 | NTSTATUS BATTERYCLASSAPI BatteryClassInitializeDevice (PBATTERY_MINIPORT_INFO MiniportInfo, PVOID *ClassData);
|
---|
132 | NTSTATUS BATTERYCLASSAPI BatteryClassUnload (PVOID ClassData);
|
---|
133 | NTSTATUS BATTERYCLASSAPI BatteryClassIoctl (PVOID ClassData, PIRP Irp);
|
---|
134 | NTSTATUS BATTERYCLASSAPI BatteryClassSystemControl (PVOID ClassData, PVOID WmiLibContext, PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Disposition);
|
---|
135 | NTSTATUS BATTERYCLASSAPI BatteryClassQueryWmiDataBlock (PVOID ClassData, PDEVICE_OBJECT DeviceObject, PIRP Irp, ULONG GuidIndex, PULONG InstanceLengthArray, ULONG OutBufferSize, PUCHAR Buffer);
|
---|
136 | NTSTATUS BATTERYCLASSAPI BatteryClassStatusNotify (PVOID ClassData);
|
---|
137 |
|
---|
138 | #endif
|
---|
139 | #endif
|
---|
140 |
|
---|
141 | #endif
|
---|