|
|
dd89bb |
#ifndef _NT_PNP_H_
|
|
|
dd89bb |
#define _NT_PNP_H_
|
|
|
dd89bb |
|
|
|
414ad3 |
#include "nt_abi.h"
|
|
|
dd89bb |
#include "nt_object.h"
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef enum _nt_latency_time {
|
|
|
dd89bb |
NT_LT_DONT_CARE,
|
|
|
dd89bb |
NT_LT_LOWEST_LATENCY
|
|
|
dd89bb |
} nt_latency_time;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef enum _nt_device_power_state {
|
|
|
dd89bb |
NT_POWER_DEVICE_UNSPECIFIED,
|
|
|
dd89bb |
NT_POWER_DEVICE_D0,
|
|
|
dd89bb |
NT_POWER_DEVICE_D1,
|
|
|
dd89bb |
NT_POWER_DEVICE_D2,
|
|
|
dd89bb |
NT_POWER_DEVICE_D3
|
|
|
dd89bb |
} nt_device_power_state;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef enum _nt_power_action {
|
|
|
dd89bb |
NT_POWER_ACTION_NONE,
|
|
|
dd89bb |
NT_POWER_ACTION_RESERVED,
|
|
|
dd89bb |
NT_POWER_ACTION_SLEEP,
|
|
|
dd89bb |
NT_POWER_ACTION_HIBERNATE,
|
|
|
dd89bb |
NT_POWER_ACTION_SHUTDOWN,
|
|
|
dd89bb |
NT_POWER_ACTION_SHUTDOWN_RESET,
|
|
|
dd89bb |
NT_POWER_ACTION_SHUTDOWN_OFF,
|
|
|
dd89bb |
} nt_power_action;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef enum _nt_system_power_state {
|
|
|
dd89bb |
NT_POWER_SYSTEM_UNSPECIFIED,
|
|
|
dd89bb |
NT_POWER_SYSTEM_WORKING,
|
|
|
dd89bb |
NT_POWER_SYSTEM_SLEEPING1,
|
|
|
dd89bb |
NT_POWER_SYSTEM_SLEEPING2,
|
|
|
dd89bb |
NT_POWER_SYSTEM_SLEEPING3,
|
|
|
dd89bb |
NT_POWER_SYSTEM_HIBERNATE,
|
|
|
dd89bb |
NT_POWER_SYSTEM_SHUTDOWN
|
|
|
dd89bb |
} nt_system_power_state;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef enum _nt_power_info_level {
|
|
|
dd89bb |
NT_SYSTEM_POWER_POLICY_AC,
|
|
|
dd89bb |
NT_SYSTEM_POWER_POLICY_DC,
|
|
|
dd89bb |
NT_VERIFY_SYSTEM_POLICY_AC,
|
|
|
dd89bb |
NT_VERIFY_SYSTEM_POLICY_DC,
|
|
|
dd89bb |
NT_SYSTEM_POWER_CAPABILITIES,
|
|
|
dd89bb |
NT_SYSTEM_BATTERY_STATE,
|
|
|
dd89bb |
NT_SYSTEM_POWER_STATE_HANDLER,
|
|
|
dd89bb |
NT_PROCESSOR_STATE_HANDLER,
|
|
|
dd89bb |
NT_SYSTEM_POWER_POLICY_CURRENT,
|
|
|
dd89bb |
NT_ADMINISTRATOR_POWER_POLICY,
|
|
|
dd89bb |
NT_SYSTEM_RESERVE_HIBER_FILE,
|
|
|
dd89bb |
NT_PROCESSOR_INFORMATION,
|
|
|
dd89bb |
NT_SYSTEM_POWER_INFORMATION
|
|
|
dd89bb |
} nt_power_info_level;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
/* execution state bits */
|
|
|
dd89bb |
#define NT_ES_SYSTEM_REQUIRED (0x00000001)
|
|
|
dd89bb |
#define NT_ES_DISPLAY_REQUIRED (0x00000002)
|
|
|
dd89bb |
#define NT_ES_USER_PRESENT (0x00000004)
|
|
|
dd89bb |
#define NT_ES_AWAYMODE_REQUIRED (0x00000040)
|
|
|
dd89bb |
#define NT_ES_CONTINUOUS (0x80000000)
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
/* power action flag bits */
|
|
|
dd89bb |
#define NT_POWER_ACTION_QUERY_ALLOWED (0x00000001)
|
|
|
dd89bb |
#define NT_POWER_ACTION_UI_ALLOWED (0x00000002)
|
|
|
dd89bb |
#define NT_POWER_ACTION_OVERRIDE_APPS (0x00000004)
|
|
|
dd89bb |
#define NT_POWER_ACTION_LIGHTEST_FIRST (0x10000000)
|
|
|
dd89bb |
#define NT_POWER_ACTION_LOCK_CONSOLE (0x20000000)
|
|
|
dd89bb |
#define NT_POWER_ACTION_DISABLE_WAKES (0x40000000)
|
|
|
dd89bb |
#define NT_POWER_ACTION_CRITICAL (0x80000000)
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
/* power state event codes */
|
|
|
dd89bb |
#define NT_POWER_LEVEL_USER_NOTIFY_TEXT (0x00000001)
|
|
|
dd89bb |
#define NT_POWER_LEVEL_USER_NOTIFY_SOUND (0x00000002)
|
|
|
dd89bb |
#define NT_POWER_LEVEL_USER_NOTIFY_EXEC (0x00000004)
|
|
|
dd89bb |
#define NT_POWER_USER_NOTIFY_BUTTON (0x00000008)
|
|
|
dd89bb |
#define NT_POWER_USER_NOTIFY_SHUTDOWN (0x00000010)
|
|
|
dd89bb |
#define NT_POWER_FORCE_TRIGGER_RESET (0x80000000)
|
|
|
dd89bb |
|
|
|
dd89bb |
/* system power policy */
|
|
|
dd89bb |
#define NT_NUM_DISCHARGE_POLICIES (0x00000004)
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_power_action_policy {
|
|
|
dd89bb |
nt_power_action action;
|
|
|
dd89bb |
uint32_t action_flags;
|
|
|
dd89bb |
uint32_t event_code;
|
|
|
dd89bb |
} nt_power_action_policy;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_system_power_level {
|
|
|
dd89bb |
unsigned char enable;
|
|
|
dd89bb |
unsigned char padding[3];
|
|
|
dd89bb |
uint32_t battery_level;
|
|
|
dd89bb |
nt_power_action_policy power_policy;
|
|
|
dd89bb |
nt_system_power_state min_system_state;
|
|
|
dd89bb |
} nt_system_power_level;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_system_power_policy {
|
|
|
dd89bb |
uint32_t revision;
|
|
|
dd89bb |
nt_power_action_policy power_button;
|
|
|
dd89bb |
nt_power_action_policy sleep_button;
|
|
|
dd89bb |
nt_power_action_policy lid_close;
|
|
|
dd89bb |
nt_system_power_state lid_open_wake;
|
|
|
dd89bb |
uint32_t reserved_1st;
|
|
|
dd89bb |
nt_power_action_policy idle;
|
|
|
dd89bb |
uint32_t idle_timeout;
|
|
|
dd89bb |
unsigned char idle_sensitivity;
|
|
|
dd89bb |
unsigned char dynamic_throttle;
|
|
|
dd89bb |
unsigned char padding[2];
|
|
|
dd89bb |
nt_system_power_state min_sleep;
|
|
|
dd89bb |
nt_system_power_state max_sleep;
|
|
|
dd89bb |
nt_system_power_state reduced_latency_sleep;
|
|
|
dd89bb |
uint32_t win_logon_flags;
|
|
|
dd89bb |
uint32_t reserved_2nd;
|
|
|
dd89bb |
uint32_t doze_s4_timeout;
|
|
|
dd89bb |
uint32_t broadcast_capacity_resolution;
|
|
|
dd89bb |
nt_system_power_level discharge_policy[NT_NUM_DISCHARGE_POLICIES];
|
|
|
dd89bb |
uint32_t video_timeout;
|
|
|
dd89bb |
unsigned char video_dim_display;
|
|
|
dd89bb |
uint32_t video_reserved[3];
|
|
|
dd89bb |
uint32_t spindown_timeout;
|
|
|
dd89bb |
unsigned char optimize_for_power;
|
|
|
dd89bb |
unsigned char fan_throttle_tolerance;
|
|
|
dd89bb |
unsigned char forced_throttle;
|
|
|
dd89bb |
unsigned char min_throttle;
|
|
|
dd89bb |
nt_power_action_policy over_throttled;
|
|
|
dd89bb |
} nt_system_power_policy;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_system_battery_state {
|
|
|
dd89bb |
unsigned char ac_on_line;
|
|
|
dd89bb |
unsigned char battery_present;
|
|
|
dd89bb |
unsigned char charging;
|
|
|
dd89bb |
unsigned char discharging;
|
|
|
dd89bb |
unsigned char padding[4];
|
|
|
dd89bb |
uint32_t max_capacity;
|
|
|
dd89bb |
uint32_t remaining_capacity;
|
|
|
dd89bb |
uint32_t rate;
|
|
|
dd89bb |
uint32_t estimated_time;
|
|
|
dd89bb |
uint32_t default_alert1;
|
|
|
dd89bb |
uint32_t default_alert2;
|
|
|
dd89bb |
} nt_system_battery_state;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_battery_reporting_scale {
|
|
|
dd89bb |
uint32_t granularity;
|
|
|
dd89bb |
uint32_t capacity;
|
|
|
dd89bb |
} nt_battery_reporting_scale;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_system_power_capabilities {
|
|
|
dd89bb |
unsigned char power_button_present;
|
|
|
dd89bb |
unsigned char sleep_button_present;
|
|
|
dd89bb |
unsigned char lid_present;
|
|
|
dd89bb |
unsigned char system_s1;
|
|
|
dd89bb |
unsigned char system_s2;
|
|
|
dd89bb |
unsigned char system_s3;
|
|
|
dd89bb |
unsigned char system_s4;
|
|
|
dd89bb |
unsigned char system_s5;
|
|
|
dd89bb |
unsigned char hiber_file_present;
|
|
|
dd89bb |
unsigned char full_wake;
|
|
|
dd89bb |
unsigned char video_dim_present;
|
|
|
dd89bb |
unsigned char apm_present;
|
|
|
dd89bb |
unsigned char ups_present;
|
|
|
dd89bb |
unsigned char thermal_control;
|
|
|
dd89bb |
unsigned char processor_throttle;
|
|
|
dd89bb |
unsigned char processor_min_throttle;
|
|
|
dd89bb |
unsigned char processor_max_throttle;
|
|
|
dd89bb |
unsigned char fast_system_s4;
|
|
|
dd89bb |
unsigned char hiber_boot;
|
|
|
dd89bb |
unsigned char wake_alarm_present;
|
|
|
dd89bb |
unsigned char ao_ac;
|
|
|
dd89bb |
unsigned char disk_spin_down;
|
|
|
dd89bb |
unsigned char padding[8];
|
|
|
dd89bb |
unsigned char system_batteries_present;
|
|
|
dd89bb |
unsigned char batteries_are_short_term;
|
|
|
dd89bb |
nt_battery_reporting_scale battery_scale[3];
|
|
|
dd89bb |
nt_system_power_state ac_on_line_wake;
|
|
|
dd89bb |
nt_system_power_state soft_lid_wake;
|
|
|
dd89bb |
nt_system_power_state rtc_wake;
|
|
|
dd89bb |
nt_system_power_state min_device_wake_state;
|
|
|
dd89bb |
nt_system_power_state default_low_latency_wake;
|
|
|
dd89bb |
} nt_system_power_capabilities;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_system_power_information {
|
|
|
dd89bb |
uint32_t max_idleness_allowed;
|
|
|
dd89bb |
uint32_t idleness;
|
|
|
dd89bb |
uint32_t time_remaining;
|
|
|
dd89bb |
unsigned char cooling_mode;
|
|
|
dd89bb |
} nt_system_power_information;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_system_power_status {
|
|
|
dd89bb |
unsigned char ac_line_status;
|
|
|
dd89bb |
unsigned char battery_flag;
|
|
|
dd89bb |
unsigned char battery_life_percent;
|
|
|
dd89bb |
unsigned char reserved;
|
|
|
dd89bb |
uint32_t battery_life_time;
|
|
|
dd89bb |
uint32_t battery_full_life_time;
|
|
|
dd89bb |
} nt_system_power_status;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_administrator_power_policy {
|
|
|
dd89bb |
nt_system_power_state min_sleep;
|
|
|
dd89bb |
nt_system_power_state max_sleep;
|
|
|
dd89bb |
uint32_t min_video_timeout;
|
|
|
dd89bb |
uint32_t max_video_timeout;
|
|
|
dd89bb |
uint32_t min_spindown_timeout;
|
|
|
dd89bb |
uint32_t max_spindown_timeout;
|
|
|
dd89bb |
} nt_administrator_power_policy;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_user_power_policy {
|
|
|
dd89bb |
uint32_t revision;
|
|
|
dd89bb |
nt_power_action_policy idle_ac;
|
|
|
dd89bb |
nt_power_action_policy idle_dc;
|
|
|
dd89bb |
uint32_t idle_timeout_ac;
|
|
|
dd89bb |
uint32_t idle_timeout_dc;
|
|
|
dd89bb |
unsigned char idle_sensitivity_ac;
|
|
|
dd89bb |
unsigned char idle_sensitivity_dc;
|
|
|
dd89bb |
unsigned char throttle_policy_ac;
|
|
|
dd89bb |
unsigned char throttle_policy_dc;
|
|
|
dd89bb |
nt_system_power_state max_sleep_ac;
|
|
|
dd89bb |
nt_system_power_state max_sleep_dc;
|
|
|
dd89bb |
uint32_t reserved[2];
|
|
|
dd89bb |
uint32_t video_timeout_ac;
|
|
|
dd89bb |
uint32_t video_timeout_dc;
|
|
|
dd89bb |
uint32_t spindown_timeout_ac;
|
|
|
dd89bb |
uint32_t spindown_timeout_dc;
|
|
|
dd89bb |
unsigned char optimize_for_power_ac;
|
|
|
dd89bb |
unsigned char optimize_for_power_dc;
|
|
|
dd89bb |
unsigned char fan_throttle_tolerance_ac;
|
|
|
dd89bb |
unsigned char fan_throttle_tolerance_dc;
|
|
|
dd89bb |
unsigned char forced_throttle_ac;
|
|
|
dd89bb |
unsigned char forced_throttle_dc;
|
|
|
dd89bb |
} nt_user_power_policy;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_processor_power_information {
|
|
|
dd89bb |
uint32_t number;
|
|
|
dd89bb |
uint32_t max_mhz;
|
|
|
dd89bb |
uint32_t current_mhz;
|
|
|
dd89bb |
uint32_t mhz_limit;
|
|
|
dd89bb |
uint32_t max_idle_state;
|
|
|
dd89bb |
uint32_t current_idle_state;
|
|
|
dd89bb |
} nt_processor_power_information;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef struct _nt_plug_play_notification_header {
|
|
|
dd89bb |
uint16_t version;
|
|
|
dd89bb |
uint16_t size;
|
|
|
dd89bb |
nt_guid event;
|
|
|
dd89bb |
} nt_plug_play_notification_header;
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
/* ZwRequestWakeupLatency: no longer present */
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_request_wakeup_latency(
|
|
|
dd89bb |
__in nt_latency_time latency);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
/* ZwRequestDeviceWakeup: no longer present */
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_request_device_wakeup(
|
|
|
dd89bb |
__in void * hdevice);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
/* ZwCancelDeviceWakeupRequest: no longer present */
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_cancel_device_wakeup_request(
|
|
|
dd89bb |
__in void * hdevice);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_is_system_resume_automatic(void);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_set_thread_execution_state(
|
|
|
dd89bb |
__in uint32_t execution_state,
|
|
|
dd89bb |
__out uint32_t * prev_execution_state);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_get_device_power_state(
|
|
|
dd89bb |
__in void * hdevice,
|
|
|
dd89bb |
__out nt_device_power_state * device_power_state);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_set_system_power_state(
|
|
|
dd89bb |
__in nt_power_action system_action,
|
|
|
dd89bb |
__in nt_system_power_state min_system_state,
|
|
|
dd89bb |
__in uint32_t system_power_state_flags);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_initiate_power_action(
|
|
|
dd89bb |
__in nt_power_action system_action,
|
|
|
dd89bb |
__in nt_system_power_state min_system_statem,
|
|
|
dd89bb |
__in uint32_t system_power_state_flags,
|
|
|
dd89bb |
__in unsigned char async);
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_power_information(
|
|
|
dd89bb |
__in nt_power_info_level power_info_level,
|
|
|
dd89bb |
__in void * input_buffer __optional,
|
|
|
dd89bb |
__in uint32_t input_buffer_length,
|
|
|
dd89bb |
__out void * output_buffer __optional,
|
|
|
dd89bb |
__in uint32_t output_buffer_length);
|
|
|
dd89bb |
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_plug_play_control(
|
|
|
dd89bb |
__in uint32_t pnp_control_code,
|
|
|
dd89bb |
__in_out void * buffer,
|
|
|
dd89bb |
__in uint32_t buffer_length);
|
|
|
dd89bb |
|
|
|
dd89bb |
typedef int32_t __stdcall ntapi_zw_get_plug_play_event(
|
|
|
dd89bb |
__in uint32_t reserved_1st,
|
|
|
dd89bb |
__in uint32_t reserved_2nd,
|
|
|
dd89bb |
__out void * buffer,
|
|
|
dd89bb |
__in uint32_t buffer_length);
|
|
|
dd89bb |
|
|
|
dd89bb |
#endif
|