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