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 <devpropdef.h> 8 9 DEFINE_DEVPROPKEY(PROCESSOR_NUMBER_PKEY,0x5724c81d,0xd5af,0x4c1f,0xa1,0x03,0xa0,0x6e,0x28,0xf2,0x04,0xc6,1); 10 11 DEFINE_GUID(GUID_DEVICE_BATTERY,0x72631e54,0x78A4,0x11d0,0xbc,0xf7,0x00,0xaa,0x00,0xb7,0xb3,0x2a); 12 DEFINE_GUID(GUID_DEVICE_APPLICATIONLAUNCH_BUTTON,0x629758ee,0x986e,0x4d9e,0x8e,0x47,0xde,0x27,0xf8,0xab,0x05,0x4d); 13 DEFINE_GUID(GUID_DEVICE_SYS_BUTTON,0x4AFA3D53,0x74A7,0x11d0,0xbe,0x5e,0x00,0xA0,0xC9,0x06,0x28,0x57); 14 DEFINE_GUID(GUID_DEVICE_LID,0x4AFA3D52,0x74A7,0x11d0,0xbe,0x5e,0x00,0xA0,0xC9,0x06,0x28,0x57); 15 DEFINE_GUID(GUID_DEVICE_THERMAL_ZONE,0x4AFA3D51,0x74A7,0x11d0,0xbe,0x5e,0x00,0xA0,0xC9,0x06,0x28,0x57); 16 DEFINE_GUID(GUID_DEVICE_PROCESSOR,0x97fadb10,0x4e33,0x40ae,0x35,0x9c,0x8b,0xef,0x02,0x9d,0xbd,0xd0); 17 DEFINE_GUID(GUID_DEVICE_MEMORY,0x3fd0f03d,0x92e0,0x45fb,0xb7,0x5c,0x5e,0xd8,0xff,0xb0,0x10,0x21); 18 DEFINE_GUID(GUID_DEVICE_ACPI_TIME,0x97f99bf6,0x4497,0x4f18,0xbb,0x22,0x4b,0x9f,0xb2,0xfb,0xef,0x9c); 19 DEFINE_GUID(GUID_DEVICE_MESSAGE_INDICATOR,0xcd48a365,0xfa94,0x4ce2,0xa2,0x32,0xa1,0xb7,0x64,0xe5,0xd8,0xb4); 20 DEFINE_GUID(GUID_CLASS_INPUT,0x4d1e55b2,0xf16f,0x11cf,0x88,0xcb,0x00,0x11,0x11,0x00,0x00,0x30); 21 22 #ifndef _POCLASS_ 23 #define _POCLASS_ 24 25 #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 26 27 #define BATTERY_UNKNOWN_CAPACITY 0xffffffff 28 #define UNKNOWN_CAPACITY BATTERY_UNKNOWN_CAPACITY 29 30 #define BATTERY_SET_CHARGE_SUPPORTED 0x1 31 #define BATTERY_SET_DISCHARGE_SUPPORTED 0x2 32 #define BATTERY_SET_CHARGINGSOURCE_SUPPORTED 0x4 33 #define BATTERY_SET_RESUME_SUPPORTED 0x4 34 #define BATTERY_SEALED 0x10000000 35 #define BATTERY_IS_SHORT_TERM 0x20000000 36 #define BATTERY_CAPACITY_RELATIVE 0x40000000 37 #define BATTERY_SYSTEM_BATTERY 0x80000000 38 39 #define BATTERY_UNKNOWN_TIME 0xffffffff 40 41 #define BATTERY_UNKNOWN_CURRENT 0xffffffff 42 #define UNKNOWN_CURRENT BATTERY_UNKNOWN_CURRENT 43 44 #define BATTERY_UNKNOWN_VOLTAGE 0xffffffff 45 #define BATTERY_UNKNOWN_RATE 0x80000000 46 #define UNKNOWN_RATE BATTERY_UNKNOWN_RATE 47 #define UNKNOWN_VOLTAGE BATTERY_UNKNOWN_VOLTAGE 48 49 #define BATTERY_POWER_ON_LINE 0x1 50 #define BATTERY_DISCHARGING 0x2 51 #define BATTERY_CHARGING 0x4 52 #define BATTERY_CRITICAL 0x8 53 54 #define BATTERY_TAG_INVALID 0 55 56 #define ACTIVE_COOLING 0x0 57 #define PASSIVE_COOLING 0x1 58 59 #define SYS_BUTTON_POWER 0x1 60 #define SYS_BUTTON_SLEEP 0x2 61 #define SYS_BUTTON_LID 0x4 62 #define SYS_BUTTON_WAKE 0x80000000 63 64 #define SYS_BUTTON_LID_STATE_MASK 0x30000 65 #define SYS_BUTTON_LID_OPEN 0x10000 66 #define SYS_BUTTON_LID_CLOSED 0x20000 67 #define SYS_BUTTON_LID_INITIAL 0x40000 68 #define SYS_BUTTON_LID_CHANGED 0x80000 69 70 #define PROCESSOR_PCC_COMMAND_GET_AVERAGE_FREQUENCY 0x0 71 #define PROCESSOR_PCC_COMMAND_SET_DESIRED_FREQUENCY 0x1 72 73 #define ACPI_TIME_ADJUST_DAYLIGHT 0x1 74 #define ACPI_TIME_IN_DAYLIGHT 0x2 75 #define ACPI_TIME_ZONE_UNKNOWN 0x7FF 76 77 #define PROCESSOR_PCC_INTERFACE_STANDARD_VERSION 1 78 79 #define THERMAL_COOLING_INTERFACE_VERSION 1 80 81 #define THERMAL_DEVICE_INTERFACE_VERSION 1 82 83 #define MAX_BATTERY_STRING_SIZE 128 84 #define MAX_ACTIVE_COOLING_LEVELS 10 85 86 #define IOCTL_SET_SYS_MESSAGE_INDICATOR CTL_CODE(FILE_DEVICE_BATTERY,0x70,METHOD_BUFFERED,FILE_WRITE_ACCESS) 87 88 #define IOCTL_SET_WAKE_ALARM_VALUE CTL_CODE(FILE_DEVICE_BATTERY,0x80,METHOD_BUFFERED,FILE_WRITE_ACCESS) 89 #define IOCTL_SET_WAKE_ALARM_POLICY CTL_CODE(FILE_DEVICE_BATTERY,0x81,METHOD_BUFFERED,FILE_WRITE_ACCESS) 90 #define IOCTL_GET_WAKE_ALARM_VALUE CTL_CODE(FILE_DEVICE_BATTERY,0x82,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) 91 #define IOCTL_GET_WAKE_ALARM_POLICY CTL_CODE(FILE_DEVICE_BATTERY,0x83,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) 92 93 #define IOCTL_ACPI_GET_REAL_TIME CTL_CODE(FILE_DEVICE_BATTERY,0x84,METHOD_BUFFERED,FILE_READ_DATA) 94 #define IOCTL_ACPI_SET_REAL_TIME CTL_CODE(FILE_DEVICE_BATTERY,0x85,METHOD_BUFFERED,FILE_WRITE_ACCESS) 95 96 #define IOCTL_BATTERY_QUERY_TAG CTL_CODE(FILE_DEVICE_BATTERY,0x10,METHOD_BUFFERED,FILE_READ_ACCESS) 97 #define IOCTL_BATTERY_QUERY_INFORMATION CTL_CODE(FILE_DEVICE_BATTERY,0x11,METHOD_BUFFERED,FILE_READ_ACCESS) 98 #define IOCTL_BATTERY_SET_INFORMATION CTL_CODE(FILE_DEVICE_BATTERY,0x12,METHOD_BUFFERED,FILE_WRITE_ACCESS) 99 #define IOCTL_BATTERY_QUERY_STATUS CTL_CODE(FILE_DEVICE_BATTERY,0x13,METHOD_BUFFERED,FILE_READ_ACCESS) 100 101 #define IOCTL_THERMAL_QUERY_INFORMATION CTL_CODE(FILE_DEVICE_BATTERY,0x20,METHOD_BUFFERED,FILE_READ_ACCESS) 102 #define IOCTL_THERMAL_SET_COOLING_POLICY CTL_CODE(FILE_DEVICE_BATTERY,0x21,METHOD_BUFFERED,FILE_WRITE_ACCESS) 103 #define IOCTL_RUN_ACTIVE_COOLING_METHOD CTL_CODE(FILE_DEVICE_BATTERY,0x22,METHOD_BUFFERED,FILE_WRITE_ACCESS) 104 #define IOCTL_THERMAL_SET_PASSIVE_LIMIT CTL_CODE(FILE_DEVICE_BATTERY,0x23,METHOD_BUFFERED,FILE_WRITE_ACCESS) 105 #define IOCTL_THERMAL_READ_TEMPERATURE CTL_CODE(FILE_DEVICE_BATTERY,0x24,METHOD_BUFFERED,FILE_READ_ACCESS) 106 #define IOCTL_QUERY_LID CTL_CODE(FILE_DEVICE_BATTERY,0x30,METHOD_BUFFERED,FILE_READ_ACCESS) 107 #define IOCTL_NOTIFY_SWITCH_EVENT CTL_CODE(FILE_DEVICE_BATTERY,0x40,METHOD_BUFFERED,FILE_READ_ACCESS) 108 #define IOCTL_GET_SYS_BUTTON_CAPS CTL_CODE(FILE_DEVICE_BATTERY,0x50,METHOD_BUFFERED,FILE_READ_ACCESS) 109 #define IOCTL_GET_SYS_BUTTON_EVENT CTL_CODE(FILE_DEVICE_BATTERY,0x51,METHOD_BUFFERED,FILE_READ_ACCESS) 110 111 #define IOCTL_GET_PROCESSOR_OBJ_INFO \ 112 CTL_CODE(FILE_DEVICE_BATTERY,0x60,METHOD_BUFFERED,FILE_READ_ACCESS) 113 114 typedef enum { 115 BatteryInformation, BatteryGranularityInformation, BatteryTemperature, BatteryEstimatedTime, 116 BatteryDeviceName, BatteryManufactureDate, BatteryManufactureName, BatteryUniqueID, 117 BatterySerialNumber 118 } BATTERY_QUERY_INFORMATION_LEVEL; 119 120 typedef enum { 121 BatteryCriticalBias, BatteryCharge, BatteryDischarge, BatteryChargingSource 122 } BATTERY_SET_INFORMATION_LEVEL; 123 124 typedef enum _BATTERY_CHARGING_SOURCE_TYPE { 125 BatteryChargingSourceType_None, BatteryChargingSourceType_AC, 126 BatteryChargingSourceType_USB, BatteryChargingSourceType_Wireless 127 } BATTERY_CHARGING_SOURCE_TYPE, *PBATTERY_CHARGING_SOURCE_TYPE; 128 129 typedef struct _BATTERY_QUERY_INFORMATION { 130 ULONG BatteryTag; 131 BATTERY_QUERY_INFORMATION_LEVEL InformationLevel; 132 ULONG AtRate; 133 } BATTERY_QUERY_INFORMATION, *PBATTERY_QUERY_INFORMATION; 134 135 typedef struct _BATTERY_INFORMATION { 136 ULONG Capabilities; 137 UCHAR Technology; 138 UCHAR Reserved[3]; 139 UCHAR Chemistry[4]; 140 ULONG DesignedCapacity; 141 ULONG FullChargedCapacity; 142 ULONG DefaultAlert1; 143 ULONG DefaultAlert2; 144 ULONG CriticalBias; 145 ULONG CycleCount; 146 } BATTERY_INFORMATION, *PBATTERY_INFORMATION; 147 148 typedef struct _BATTERY_CHARGING_SOURCE { 149 BATTERY_CHARGING_SOURCE_TYPE Type; 150 ULONG MaxCurrent; 151 } BATTERY_CHARGING_SOURCE, *PBATTERY_CHARGING_SOURCE; 152 153 typedef struct _BATTERY_SET_INFORMATION { 154 ULONG BatteryTag; 155 BATTERY_SET_INFORMATION_LEVEL InformationLevel; 156 UCHAR Buffer[1]; 157 } BATTERY_SET_INFORMATION, *PBATTERY_SET_INFORMATION; 158 159 typedef struct _BATTERY_WAIT_STATUS { 160 ULONG BatteryTag; 161 ULONG Timeout; 162 ULONG PowerState; 163 ULONG LowCapacity; 164 ULONG HighCapacity; 165 } BATTERY_WAIT_STATUS, *PBATTERY_WAIT_STATUS; 166 167 typedef struct _BATTERY_STATUS { 168 ULONG PowerState; 169 ULONG Capacity; 170 ULONG Voltage; 171 LONG Rate; 172 } BATTERY_STATUS, *PBATTERY_STATUS; 173 174 typedef struct _BATTERY_MANUFACTURE_DATE { 175 UCHAR Day; 176 UCHAR Month; 177 USHORT Year; 178 } BATTERY_MANUFACTURE_DATE, *PBATTERY_MANUFACTURE_DATE; 179 180 typedef struct _THERMAL_INFORMATION { 181 ULONG ThermalStamp; 182 ULONG ThermalConstant1; 183 ULONG ThermalConstant2; 184 KAFFINITY Processors; 185 ULONG SamplingPeriod; 186 ULONG CurrentTemperature; 187 ULONG PassiveTripPoint; 188 ULONG CriticalTripPoint; 189 UCHAR ActiveTripPointCount; 190 ULONG ActiveTripPoint[MAX_ACTIVE_COOLING_LEVELS]; 191 } THERMAL_INFORMATION, *PTHERMAL_INFORMATION; 192 193 typedef struct _THERMAL_WAIT_READ { 194 ULONG Timeout; 195 ULONG LowTemperature; 196 ULONG HighTemperature; 197 } THERMAL_WAIT_READ, *PTHERMAL_WAIT_READ; 198 199 typedef struct { 200 ULONG PhysicalID; 201 ULONG PBlkAddress; 202 UCHAR PBlkLength; 203 } PROCESSOR_OBJECT_INFO, *PPROCESSOR_OBJECT_INFO; 204 205 typedef struct { 206 ULONG PhysicalID; 207 ULONG PBlkAddress; 208 UCHAR PBlkLength; 209 ULONG InitialApicId; 210 } PROCESSOR_OBJECT_INFO_EX, *PPROCESSOR_OBJECT_INFO_EX; 211 212 #ifndef _WINDOWS_ 213 214 #include "pshpack1.h" 215 216 typedef struct _PCC_HEADER { 217 ULONG Signature; 218 USHORT HeaderLength; 219 UCHAR MajorVersion; 220 UCHAR MinorVersion; 221 union { 222 __MINGW_EXTENSION struct { 223 ULONG SciDoorbell : 1; 224 ULONG Reserved : 31; 225 }; 226 ULONG AsULong; 227 } SupportedFeatures; 228 union { 229 __MINGW_EXTENSION struct { 230 USHORT CommandCode : 8; 231 USHORT ReservedZ : 7; 232 USHORT SciDoorbell : 1; 233 }; 234 USHORT AsUShort; 235 } Command; 236 union { 237 __MINGW_EXTENSION struct { 238 USHORT CommandComplete : 1; 239 USHORT SciReceived : 1; 240 USHORT Error : 1; 241 USHORT Reserved : 13; 242 }; 243 USHORT AsUShort; 244 } Status; 245 ULONG Latency; 246 ULONG MinimumCommandInterval; 247 ULONG MaximumCommandInterval; 248 ULONG NominalFrequency; 249 ULONG MinimumFrequency; 250 ULONG MinimumUnthrottledFrequency; 251 } PCC_HEADER, *PPCC_HEADER; 252 253 typedef struct _PCC_INPUT_BUFFER { 254 UCHAR ControlEnabled; 255 __MINGW_EXTENSION union { 256 struct { 257 UCHAR ReservedZ[3]; 258 } GetAverageFrequency; 259 struct { 260 UCHAR DesiredFrequency; 261 UCHAR ReservedZ[2]; 262 } SetDesiredFrequency; 263 }; 264 } PCC_INPUT_BUFFER, *PPCC_INPUT_BUFFER; 265 266 typedef union _PCC_OUTPUT_BUFFER { 267 struct { 268 UCHAR AverageFrequency; 269 UCHAR FrequencyLimit; 270 UCHAR Reserved[2]; 271 } GetAverageFrequency; 272 struct { 273 UCHAR Reserved[4]; 274 } SetDesiredFrequency; 275 } PCC_OUTPUT_BUFFER, *PPCC_OUTPUT_BUFFER; 276 277 #include "poppack.h" 278 279 typedef VOID (*PPROCESSOR_PCC_DOORBELL_CALLBACK)(ULONG Status, ULONG_PTR Context); 280 typedef NTSTATUS (*PPROCESSOR_PCC_RING_DOORBELL)(UCHAR Command, PPROCESSOR_PCC_DOORBELL_CALLBACK Callback, ULONG_PTR Context); 281 282 typedef struct _PROCESSOR_PCC_INTERFACE_STANDARD { 283 USHORT Size; 284 USHORT Version; 285 PVOID Context; 286 PINTERFACE_REFERENCE InterfaceReference; 287 PINTERFACE_DEREFERENCE InterfaceDereference; 288 PPROCESSOR_PCC_RING_DOORBELL PccRingDoorbell; 289 PPCC_HEADER PccHeader; 290 ULONG PccHeaderLength; 291 } PROCESSOR_PCC_INTERFACE_STANDARD, *PPROCESSOR_PCC_INTERFACE_STANDARD; 292 293 typedef VOID (*PDEVICE_ACTIVE_COOLING)(PVOID Context, BOOLEAN Engaged); 294 typedef VOID (*PDEVICE_PASSIVE_COOLING)(PVOID Context, ULONG Percentage); 295 296 typedef struct _THERMAL_COOLING_INTERFACE { 297 USHORT Size; 298 USHORT Version; 299 PVOID Context; 300 PINTERFACE_REFERENCE InterfaceReference; 301 PINTERFACE_DEREFERENCE InterfaceDereference; 302 ULONG Flags; 303 PDEVICE_ACTIVE_COOLING ActiveCooling; 304 PDEVICE_PASSIVE_COOLING PassiveCooling; 305 } THERMAL_COOLING_INTERFACE, *PTHERMAL_COOLING_INTERFACE; 306 307 typedef THERMAL_COOLING_INTERFACE THERMAL_DEVICE_INTERFACE; 308 typedef THERMAL_COOLING_INTERFACE *PTHERMAL_DEVICE_INTERFACE; 309 310 typedef enum _THERMAL_DEVICE_INTERFACE_FLAGS { 311 ThermalDeviceFlagActiveCooling = 1, 312 ThermalDeviceFlagPassiveCooling = 2 313 } THERMAL_DEVICE_INTERFACE_FLAGS, *PTHERMAL_DEVICE_INTERFACE_FLAGS; 314 315 #endif // _WINDOWS_ 316 317 typedef struct _WAKE_ALARM_INFORMATION { 318 ULONG TimerIdentifier; 319 ULONG Timeout; 320 } WAKE_ALARM_INFORMATION, *PWAKE_ALARM_INFORMATION; 321 322 typedef struct _ACPI_REAL_TIME { 323 UINT16 Year; 324 UINT8 Month; 325 UINT8 Day; 326 UINT8 Hour; 327 UINT8 Minute; 328 UINT8 Second; 329 UINT8 Valid; 330 UINT16 Milliseconds; 331 INT16 TimeZone; 332 UINT8 DayLight; 333 UINT8 Reserved1[3]; 334 } ACPI_REAL_TIME, *PACPI_REAL_TIME; 335 336 #endif /* WINAPI_PARTITION_DESKTOP. */ 337 338 #endif 339 340