include devpropdef.inc
include winapifamily.inc

DEFINE_DEVPROPKEY(PROCESSOR_NUMBER_PKEY,    0x5724c81d, 0xd5af, 0x4c1f, 0xa1, 0x03, 0xa0, 0x6e, 0x28, 0xf2, 0x04, 0xc6, 1)
DEFINE_GUID( GUID_DEVICE_BATTERY,	    0x72631e54, 0x78A4, 0x11d0, 0xbc, 0xf7, 0x00, 0xaa, 0x00, 0xb7, 0xb3, 0x2a )
DEFINE_GUID( GUID_DEVICE_APPLICATIONLAUNCH_BUTTON, 0x629758ee, 0x986e, 0x4d9e, 0x8e, 0x47, 0xde, 0x27, 0xf8, 0xab, 0x05, 0x4d )
DEFINE_GUID( GUID_DEVICE_SYS_BUTTON,	    0x4AFA3D53, 0x74A7, 0x11d0, 0xbe, 0x5e, 0x00, 0xA0, 0xC9, 0x06, 0x28, 0x57 )
DEFINE_GUID( GUID_DEVICE_LID,		    0x4AFA3D52, 0x74A7, 0x11d0, 0xbe, 0x5e, 0x00, 0xA0, 0xC9, 0x06, 0x28, 0x57 )
DEFINE_GUID( GUID_DEVICE_THERMAL_ZONE,	    0x4AFA3D51, 0x74A7, 0x11d0, 0xbe, 0x5e, 0x00, 0xA0, 0xC9, 0x06, 0x28, 0x57 )
DEFINE_GUID( GUID_DEVICE_FAN,		    0x05ecd13d, 0x81da, 0x4a2a, 0x8a, 0x4c, 0x52, 0x4f, 0x23, 0xdd, 0x4d, 0xc9 )
DEFINE_GUID( GUID_DEVICE_PROCESSOR,	    0x97fadb10, 0x4e33, 0x40ae, 0x35, 0x9c, 0x8b, 0xef, 0x02, 0x9d, 0xbd, 0xd0 )
DEFINE_GUID( GUID_DEVICE_MEMORY,	    0x3fd0f03d, 0x92e0, 0x45fb, 0xb7, 0x5c, 0x5e, 0xd8, 0xff, 0xb0, 0x10, 0x21 )
DEFINE_GUID( GUID_DEVICE_ACPI_TIME,	    0x97f99bf6, 0x4497, 0x4f18, 0xbb, 0x22, 0x4b, 0x9f, 0xb2, 0xfb, 0xef, 0x9c )
DEFINE_GUID( GUID_DEVICE_MESSAGE_INDICATOR, 0XCD48A365, 0xfa94, 0x4ce2, 0xa2, 0x32, 0xa1, 0xb7, 0x64, 0xe5, 0xd8, 0xb4 )
DEFINE_GUID( GUID_CLASS_INPUT,		    0x4D1E55B2, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 )

ifndef _POCLASS_
define _POCLASS_

if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)

.enum BATTERY_QUERY_INFORMATION_LEVEL {
    BatteryInformation,
    BatteryGranularityInformation,
    BatteryTemperature,
    BatteryEstimatedTime,
    BatteryDeviceName,
    BatteryManufactureDate,
    BatteryManufactureName,
    BatteryUniqueID,
    BatterySerialNumber
    }

BATTERY_QUERY_INFORMATION  STRUC
BatteryTag		ULONG ?
InformationLevel	BATTERY_QUERY_INFORMATION_LEVEL ?
AtRate			ULONG ?
BATTERY_QUERY_INFORMATION ENDS
PBATTERY_QUERY_INFORMATION typedef ptr BATTERY_QUERY_INFORMATION

BATTERY_INFORMATION	STRUC
Capabilities		ULONG ?
Technology		UCHAR ?
Reserved		UCHAR 3 dup(?)
Chemistry		UCHAR 4 dup(?)
DesignedCapacity	ULONG ?
FullChargedCapacity	ULONG ?
DefaultAlert1		ULONG ?
DefaultAlert2		ULONG ?
CriticalBias		ULONG ?
CycleCount		ULONG ?
BATTERY_INFORMATION	ENDS
PBATTERY_INFORMATION	typedef ptr BATTERY_INFORMATION

BATTERY_UNKNOWN_CAPACITY equ 0xFFFFFFFF
UNKNOWN_CAPACITY	equ BATTERY_UNKNOWN_CAPACITY

BATTERY_SYSTEM_BATTERY	equ 0x80000000
BATTERY_CAPACITY_RELATIVE equ 0x40000000
BATTERY_IS_SHORT_TERM	equ 0x20000000
BATTERY_SEALED		equ 0x10000000
BATTERY_SET_CHARGE_SUPPORTED equ 0x00000001
BATTERY_SET_DISCHARGE_SUPPORTED equ 0x00000002
BATTERY_SET_CHARGINGSOURCE_SUPPORTED equ 0x00000004

BATTERY_UNKNOWN_TIME	equ 0xFFFFFFFF

.enum BATTERY_SET_INFORMATION_LEVEL {
    BatteryCriticalBias,
    BatteryCharge,
    BatteryDischarge,
    BatteryChargingSource
    }

.enum BATTERY_CHARGING_SOURCE_TYPE {
    BatteryChargingSourceType_AC = 1,
    BatteryChargingSourceType_USB,
    BatteryChargingSourceType_Wireless,
    BatteryChargingSourceType_Max
    }

BATTERY_CHARGING_SOURCE	 STRUC
Type			BATTERY_CHARGING_SOURCE_TYPE ?
MaxCurrent		ULONG ?
BATTERY_CHARGING_SOURCE ENDS
PBATTERY_CHARGING_SOURCE typedef ptr BATTERY_CHARGING_SOURCE

BATTERY_CHARGING_SOURCE_INFORMATION  STRUC
Type			BATTERY_CHARGING_SOURCE_TYPE ?
SourceOnline		BOOLEAN ?
BATTERY_CHARGING_SOURCE_INFORMATION ENDS
PBATTERY_CHARGING_SOURCE_INFORMATION typedef ptr BATTERY_CHARGING_SOURCE_INFORMATION

BATTERY_UNKNOWN_CURRENT equ 0xFFFFFFFF
UNKNOWN_CURRENT		equ BATTERY_UNKNOWN_CURRENT

BATTERY_SET_INFORMATION	 STRUC
BatteryTag		ULONG ?
InformationLevel	BATTERY_SET_INFORMATION_LEVEL ?
Buffer			UCHAR 1 dup(?)
BATTERY_SET_INFORMATION ENDS
PBATTERY_SET_INFORMATION typedef ptr BATTERY_SET_INFORMATION

BATTERY_WAIT_STATUS	STRUC
BatteryTag		ULONG ?
Timeout			ULONG ?
PowerState		ULONG ?
LowCapacity		ULONG ?
HighCapacity		ULONG ?
BATTERY_WAIT_STATUS	ENDS
PBATTERY_WAIT_STATUS	typedef ptr BATTERY_WAIT_STATUS

BATTERY_STATUS		STRUC
PowerState		ULONG ?
Capacity		ULONG ?
Voltage			ULONG ?
Rate			LONG ?
BATTERY_STATUS		ENDS
PBATTERY_STATUS		typedef ptr BATTERY_STATUS

BATTERY_UNKNOWN_VOLTAGE equ 0xFFFFFFFF
BATTERY_UNKNOWN_RATE	equ 0x80000000
UNKNOWN_RATE		equ BATTERY_UNKNOWN_RATE
UNKNOWN_VOLTAGE		equ BATTERY_UNKNOWN_VOLTAGE

BATTERY_POWER_ON_LINE	equ 0x00000001
BATTERY_DISCHARGING	equ 0x00000002
BATTERY_CHARGING	equ 0x00000004
BATTERY_CRITICAL	equ 0x00000008

MAX_BATTERY_STRING_SIZE equ 128

BATTERY_MANUFACTURE_DATE STRUC
Day			UCHAR ?
Month			UCHAR ?
Year			USHORT ?
BATTERY_MANUFACTURE_DATE ENDS
PBATTERY_MANUFACTURE_DATE typedef ptr BATTERY_MANUFACTURE_DATE

IOCTL_BATTERY_QUERY_TAG equ CTL_CODE(FILE_DEVICE_BATTERY, 0x10, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_BATTERY_QUERY_INFORMATION equ CTL_CODE(FILE_DEVICE_BATTERY, 0x11, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_BATTERY_SET_INFORMATION equ CTL_CODE(FILE_DEVICE_BATTERY, 0x12, METHOD_BUFFERED, FILE_WRITE_ACCESS)
IOCTL_BATTERY_QUERY_STATUS equ CTL_CODE(FILE_DEVICE_BATTERY, 0x13, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_BATTERY_CHARGING_SOURCE_CHANGE equ CTL_CODE(FILE_DEVICE_BATTERY, 0x14, METHOD_BUFFERED, FILE_READ_ACCESS)

BATTERY_TAG_INVALID	equ 0
MAX_ACTIVE_COOLING_LEVELS equ 10

THERMAL_INFORMATION	STRUC
ThermalStamp		ULONG ?
ThermalConstant1	ULONG ?
ThermalConstant2	ULONG ?
Processors		KAFFINITY ?
SamplingPeriod		ULONG ?
CurrentTemperature	ULONG ?
PassiveTripPoint	ULONG ?
CriticalTripPoint	ULONG ?
ActiveTripPointCount	UCHAR ?
ActiveTripPoint		ULONG MAX_ACTIVE_COOLING_LEVELS dup(?)
THERMAL_INFORMATION	ENDS
PTHERMAL_INFORMATION	typedef ptr THERMAL_INFORMATION

ACTIVE_COOLING		equ 0x0
PASSIVE_COOLING		equ 0x1

THERMAL_WAIT_READ	STRUC
Timeout			ULONG ?
LowTemperature		ULONG ?
HighTemperature		ULONG ?
THERMAL_WAIT_READ	ENDS
PTHERMAL_WAIT_READ	typedef ptr THERMAL_WAIT_READ

TZ_ACTIVATION_REASON_THERMAL equ 0x00000001
TZ_ACTIVATION_REASON_CURRENT equ 0x00000002

THERMAL_POLICY		STRUC
Version			ULONG ?
WaitForUpdate		BOOLEAN ?
Hibernate		BOOLEAN ?
Critical		BOOLEAN ?
ActivationReasons	ULONG ?
PassiveLimit		ULONG ?
ActiveLevel		ULONG ?
THERMAL_POLICY		ENDS
PTHERMAL_POLICY		typedef ptr THERMAL_POLICY

THERMAL_POLICY_VERSION_1 equ 1

IOCTL_THERMAL_QUERY_INFORMATION		equ CTL_CODE(FILE_DEVICE_BATTERY, 0x20, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_THERMAL_SET_COOLING_POLICY	equ CTL_CODE(FILE_DEVICE_BATTERY, 0x21, METHOD_BUFFERED, FILE_WRITE_ACCESS)
IOCTL_RUN_ACTIVE_COOLING_METHOD		equ CTL_CODE(FILE_DEVICE_BATTERY, 0x22, METHOD_BUFFERED, FILE_WRITE_ACCESS)
IOCTL_THERMAL_SET_PASSIVE_LIMIT		equ CTL_CODE(FILE_DEVICE_BATTERY, 0x23, METHOD_BUFFERED, FILE_WRITE_ACCESS)
IOCTL_THERMAL_READ_TEMPERATURE		equ CTL_CODE(FILE_DEVICE_BATTERY, 0x24, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_THERMAL_READ_POLICY		equ CTL_CODE(FILE_DEVICE_BATTERY, 0x25, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_QUERY_LID				equ CTL_CODE(FILE_DEVICE_BATTERY, 0x30, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_NOTIFY_SWITCH_EVENT		equ CTL_CODE(FILE_DEVICE_BATTERY, 0x40, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_GET_SYS_BUTTON_CAPS		equ CTL_CODE(FILE_DEVICE_BATTERY, 0x50, METHOD_BUFFERED, FILE_READ_ACCESS)
IOCTL_GET_SYS_BUTTON_EVENT		equ CTL_CODE(FILE_DEVICE_BATTERY, 0x51, METHOD_BUFFERED, FILE_READ_ACCESS)

SYS_BUTTON_POWER	equ 0x00000001
SYS_BUTTON_SLEEP	equ 0x00000002
SYS_BUTTON_LID		equ 0x00000004
SYS_BUTTON_WAKE		equ 0x80000000

SYS_BUTTON_LID_STATE_MASK equ 0x00030000
SYS_BUTTON_LID_OPEN	equ 0x00010000
SYS_BUTTON_LID_CLOSED	equ 0x00020000
SYS_BUTTON_LID_INITIAL	equ 0x00040000
SYS_BUTTON_LID_CHANGED	equ 0x00080000


PROCESSOR_OBJECT_INFO	STRUC
PhysicalID		ULONG ?
PBlkAddress		ULONG ?
PBlkLength		UCHAR ?
PROCESSOR_OBJECT_INFO	ENDS
PPROCESSOR_OBJECT_INFO	typedef ptr PROCESSOR_OBJECT_INFO

PROCESSOR_OBJECT_INFO_EX STRUC
PhysicalID		ULONG ?
PBlkAddress		ULONG ?
PBlkLength		UCHAR ?
InitialApicId		ULONG ?
PROCESSOR_OBJECT_INFO_EX ENDS
PPROCESSOR_OBJECT_INFO_EX typedef ptr PROCESSOR_OBJECT_INFO_EX

IOCTL_GET_PROCESSOR_OBJ_INFO equ CTL_CODE(FILE_DEVICE_BATTERY, 0x60, METHOD_BUFFERED, FILE_READ_ACCESS)

ifndef _WINDOWS_

PCC_HEADER		STRUC
Signature		ULONG ?
HeaderLength		USHORT ?
MajorVersion		UCHAR ?
MinorVersion		UCHAR ?
AsULong			ULONG ?
AsUShort		USHORT ?
AsUShort2		USHORT ?
Latency			ULONG ?
MinimumCommandInterval	ULONG ?
MaximumCommandInterval	ULONG ?
NominalFrequency	ULONG ?
MinimumFrequency	ULONG ?
MinimumUnthrottledFrequency ULONG ?
PCC_HEADER		ENDS
PPCC_HEADER		typedef ptr PCC_HEADER

PCC_INPUT_BUFFER	STRUC
ControlEnabled		UCHAR ?
UNION
 STRUC GetAverageFrequency
  ReservedZ		UCHAR 3 dup(?)
 ENDS
 STRUC SetDesiredFrequency
  DesiredFrequency	UCHAR ?
  ReservedZ		UCHAR 2 dup(?)
 ENDS
ENDS
PCC_INPUT_BUFFER	ENDS
PPCC_INPUT_BUFFER	typedef ptr PCC_INPUT_BUFFER

PCC_OUTPUT_BUFFER	UNION
STRUC GetAverageFrequency
 AverageFrequency	UCHAR ?
 FrequencyLimit		UCHAR ?
 Reserved		UCHAR 2 dup(?)
ENDS
STRUC SetDesiredFrequency
 Reserved		UCHAR 4 dup(?)
ENDS
PCC_OUTPUT_BUFFER	ENDS
PPCC_OUTPUT_BUFFER	typedef ptr PCC_OUTPUT_BUFFER

CALLBACK(PPROCESSOR_PCC_DOORBELL_CALLBACK, :ULONG, :ULONG_PTR)

PROCESSOR_PCC_COMMAND_GET_AVERAGE_FREQUENCY equ 0x00
PROCESSOR_PCC_COMMAND_SET_DESIRED_FREQUENCY equ 0x01

CALLBACK(PPROCESSOR_PCC_RING_DOORBELL, :UCHAR, :PPROCESSOR_PCC_DOORBELL_CALLBACK, :ULONG_PTR)

PROCESSOR_PCC_INTERFACE_STANDARD STRUC
Size			USHORT ?
Version			USHORT ?
Context			PVOID ?
InterfaceReference	PVOID ? ;PINTERFACE_REFERENCE ?
InterfaceDereference	PVOID ? ;PINTERFACE_DEREFERENCE ?
PccRingDoorbell		PPROCESSOR_PCC_RING_DOORBELL ?
PccHeader		PPCC_HEADER ?
PccHeaderLength		ULONG ?
PROCESSOR_PCC_INTERFACE_STANDARD ENDS
PPROCESSOR_PCC_INTERFACE_STANDARD typedef ptr PROCESSOR_PCC_INTERFACE_STANDARD

PROCESSOR_PCC_INTERFACE_STANDARD_VERSION equ 1

CALLBACK(PDEVICE_ACTIVE_COOLING, :PVOID, :BOOLEAN)
CALLBACK(PDEVICE_PASSIVE_COOLING, :PVOID, :ULONG)

THERMAL_COOLING_INTERFACE  STRUC
Size			USHORT ?
Version			USHORT ?
Context			PVOID ?
InterfaceReference	PVOID ? ;PINTERFACE_REFERENCE ?
InterfaceDereference	PVOID ? ;PINTERFACE_DEREFERENCE ?
Flags			ULONG ?
ActiveCooling		PDEVICE_ACTIVE_COOLING ?
PassiveCooling		PDEVICE_PASSIVE_COOLING ?
THERMAL_COOLING_INTERFACE ENDS
PTHERMAL_COOLING_INTERFACE typedef ptr THERMAL_COOLING_INTERFACE

THERMAL_COOLING_INTERFACE_VERSION equ 1
THERMAL_DEVICE_INTERFACE_VERSION equ 1

THERMAL_DEVICE_INTERFACE typedef THERMAL_COOLING_INTERFACE
PTHERMAL_DEVICE_INTERFACE typedef ptr THERMAL_COOLING_INTERFACE

.enum THERMAL_DEVICE_INTERFACE_FLAGS {
    ThermalDeviceFlagActiveCooling = 1,
    ThermalDeviceFlagPassiveCooling = 2
    }

endif

IOCTL_SET_SYS_MESSAGE_INDICATOR equ CTL_CODE(FILE_DEVICE_BATTERY, 0x70, METHOD_BUFFERED, FILE_WRITE_ACCESS)
IOCTL_SET_WAKE_ALARM_VALUE	equ CTL_CODE(FILE_DEVICE_BATTERY, 0x80, METHOD_BUFFERED, FILE_WRITE_ACCESS)
IOCTL_SET_WAKE_ALARM_POLICY	equ CTL_CODE(FILE_DEVICE_BATTERY, 0x81, METHOD_BUFFERED, FILE_WRITE_ACCESS)
IOCTL_GET_WAKE_ALARM_VALUE	equ CTL_CODE(FILE_DEVICE_BATTERY, 0x82, METHOD_BUFFERED, FILE_READ_ACCESS or FILE_WRITE_ACCESS)
IOCTL_GET_WAKE_ALARM_POLICY	equ CTL_CODE(FILE_DEVICE_BATTERY, 0x83, METHOD_BUFFERED, FILE_READ_ACCESS or FILE_WRITE_ACCESS)

WAKE_ALARM_INFORMATION	STRUC
TimerIdentifier		ULONG ?
Timeout			ULONG ?
WAKE_ALARM_INFORMATION	ENDS
PWAKE_ALARM_INFORMATION typedef ptr WAKE_ALARM_INFORMATION

ACPI_TIME_ADJUST_DAYLIGHT equ 0x01
ACPI_TIME_IN_DAYLIGHT	equ 0x02
ACPI_TIME_ZONE_UNKNOWN	equ 0x7FF

IOCTL_ACPI_GET_REAL_TIME equ CTL_CODE(FILE_DEVICE_BATTERY, 0x84, METHOD_BUFFERED, FILE_READ_DATA)
IOCTL_ACPI_SET_REAL_TIME equ CTL_CODE(FILE_DEVICE_BATTERY, 0x85, METHOD_BUFFERED, FILE_WRITE_ACCESS)

ACPI_REAL_TIME		STRUC
Year			UINT16 ?
Month			UINT8 ?
Day			UINT8 ?
Hour			UINT8 ?
Minute			UINT8 ?
Second			UINT8 ?
Valid			UINT8 ?
Milliseconds		UINT16 ?
TimeZone		INT16 ?
DayLight		UINT8 ?
Reserved1		UINT8 3 dup(?)
ACPI_REAL_TIME		ENDS
PACPI_REAL_TIME		typedef ptr ACPI_REAL_TIME

endif
endif

