Added function/enum/structs for power management API.

This commit is contained in:
Benjamin Cutler 2005-04-11 18:49:10 +00:00 committed by Alexandre Julliard
parent 93eb433ec2
commit ee59cad92d
2 changed files with 346 additions and 0 deletions

135
include/powrprof.h Normal file
View File

@ -0,0 +1,135 @@
/*
* Copyright (C) 2005 Benjamin Cutler
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_POWRPROF_H
#define __WINE_POWRPROF_H 1
#define EnableSysTrayBatteryMeter 0x01
#define EnableMultiBatteryDisplay 0x02
#define EnablePasswordLogon 0x04
#define EnableWakeOnRing 0x08
#define EnableVideoDimDisplay 0x10
typedef struct _GLOBAL_MACHINE_POWER_POLICY {
ULONG Revision;
SYSTEM_POWER_STATE LidOpenWakeAc;
SYSTEM_POWER_STATE LidOpenWakeDc;
ULONG BroadcastCapacityResolution;
} GLOBAL_MACHINE_POWER_POLICY,
*PGLOBAL_MACHINE_POWER_POLICY;
typedef struct _GLOBAL_USER_POWER_POLICY {
ULONG Revision;
POWER_ACTION_POLICY PowerButtonAc;
POWER_ACTION_POLICY PowerButtonDc;
POWER_ACTION_POLICY SleepButtonAc;
POWER_ACTION_POLICY SleepButtonDc;
POWER_ACTION_POLICY LidCloseAc;
POWER_ACTION_POLICY LidCloseDc;
SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
ULONG GlobalFlags;
} GLOBAL_USER_POWER_POLICY,
*PGLOBAL_USER_POWER_POLICY;
typedef struct _GLOBAL_POWER_POLICY {
GLOBAL_USER_POWER_POLICY user;
GLOBAL_MACHINE_POWER_POLICY mach;
} GLOBAL_POWER_POLICY,
*PGLOBAL_POWER_POLICY;
typedef struct _MACHINE_POWER_POLICY {
ULONG Revision;
SYSTEM_POWER_STATE MinSleepAc;
SYSTEM_POWER_STATE MinSleepDc;
SYSTEM_POWER_STATE ReducedLatencySleepAc;
SYSTEM_POWER_STATE ReducedLatencySleepDc;
ULONG DozeTimeoutAc;
ULONG DozeTimeoutDc;
ULONG DozeS4TimeoutAc;
ULONG DozeS4TimeoutDc;
UCHAR MinThrottleAc;
UCHAR MinThrottleDc;
UCHAR pad1[2];
POWER_ACTION_POLICY OverThrottledAc;
POWER_ACTION_POLICY OverThrottledDc;
} MACHINE_POWER_POLICY,
*PMACHINE_POWER_POLICY;
typedef struct _MACHINE_PROCESSOR_POWER_POLICY {
ULONG Revision;
PROCESSOR_POWER_POLICY ProcessorPolicyAc;
PROCESSOR_POWER_POLICY ProcessorPolicyDc;
} MACHINE_PROCESSOR_POWER_POLICY,
*PMACHINE_PROCESSOR_POWER_POLICY;
typedef struct _USER_POWER_POLICY {
ULONG Revision;
POWER_ACTION_POLICY IdleAc;
POWER_ACTION_POLICY IdleDc;
ULONG IdleTimeoutAc;
ULONG IdleTimeoutDc;
UCHAR IdleSensitivityAc;
UCHAR IdleSensitivityDc;
UCHAR ThrottlePolicyAc;
UCHAR ThrottlePolicyDc;
SYSTEM_POWER_STATE MaxSleepAc;
SYSTEM_POWER_STATE MaxSleepDc;
ULONG Reserved[2];
ULONG VideoTimeoutAc;
ULONG VideoTimeoutDc;
ULONG SpindownTimeoutAc;
ULONG SpindownTimeoutDc;
BOOLEAN OptimizeForPowerAc;
BOOLEAN OptimizeForPowerDc;
UCHAR FanThrottleToleranceAc;
UCHAR FanThrottleToleranceDc;
UCHAR ForcedThrottleAc;
UCHAR ForcedThrottleDc;
} USER_POWER_POLICY,
*PUSER_POWER_POLICY;
typedef struct _POWER_POLICY {
USER_POWER_POLICY user;
MACHINE_POWER_POLICY mach;
} POWER_POLICY,
*PPOWER_POLICY;
typedef BOOLEAN (CALLBACK* PWRSCHEMESENUMPROC)(UINT, DWORD, LPWSTR, DWORD, LPWSTR, PPOWER_POLICY, LPARAM);
NTSTATUS WINAPI CallNtPowerInformation(POWER_INFORMATION_LEVEL, PVOID, ULONG, PVOID, ULONG);
BOOLEAN WINAPI CanUserWritePwrScheme(VOID);
BOOLEAN WINAPI DeletePwrScheme(UINT);
BOOLEAN WINAPI EnumPwrSchemes(PWRSCHEMESENUMPROC, LPARAM);
BOOLEAN WINAPI GetActivePwrScheme(PUINT);
BOOLEAN WINAPI GetCurrentPowerPolicies(PGLOBAL_POWER_POLICY, PPOWER_POLICY);
BOOLEAN WINAPI GetPwrCapabilities(PSYSTEM_POWER_CAPABILITIES);
BOOLEAN WINAPI GetPwrDiskSpindownRange(PUINT, PUINT);
BOOLEAN WINAPI IsAdminOverrideActive(PADMINISTRATOR_POWER_POLICY);
BOOLEAN WINAPI IsPwrHibernateAllowed(VOID);
BOOLEAN WINAPI IsPwrShutdownAllowed(VOID);
BOOLEAN WINAPI IsPwrSuspendAllowed(VOID);
BOOLEAN WINAPI ReadGlobalPwrPolicy(PGLOBAL_POWER_POLICY);
BOOLEAN WINAPI ReadProcessorPwrScheme(UINT, PMACHINE_PROCESSOR_POWER_POLICY);
BOOLEAN WINAPI ReadPwrScheme(UINT, PPOWER_POLICY);
BOOLEAN WINAPI SetActivePwrScheme(UINT, PGLOBAL_POWER_POLICY, PPOWER_POLICY);
BOOLEAN WINAPI SetSuspendState(BOOLEAN, BOOLEAN, BOOLEAN);
BOOLEAN WINAPI WriteGlobalPwrPolicy(PGLOBAL_POWER_POLICY);
BOOLEAN WINAPI WriteProcessorPwrScheme(UINT, PMACHINE_PROCESSOR_POWER_POLICY);
BOOLEAN WINAPI WritePwrScheme(PUINT, LPWSTR, LPWSTR, PPOWER_POLICY);
#endif /* _POWRPROF_H */

View File

@ -3387,6 +3387,217 @@ typedef enum _LATENCY_TIME {
LT_LOWEST_LATENCY
} LATENCY_TIME, *PLATENCY_TIME;
#define DISCHARGE_POLICY_CRITICAL 0
#define DISCHARGE_POLICY_LOW 1
#define NUM_DISCHARGE_POLICIES 4
#define PO_THROTTLE_NONE 0
#define PO_THROTTLE_CONSTANT 1
#define PO_THROTTLE_DEGRADE 2
#define PO_THROTTLE_ADAPTIVE 3
typedef enum _POWER_ACTION {
PowerActionNone = 0,
PowerActionReserved,
PowerActionSleep,
PowerActionHibernate,
PowerActionShutdown,
PowerActionShutdownReset,
PowerActionShutdownOff,
PowerActionWarmEject
} POWER_ACTION,
*PPOWER_ACTION;
typedef enum _SYSTEM_POWER_STATE {
PowerSystemUnspecified = 0,
PowerSystemWorking = 1,
PowerSystemSleeping1 = 2,
PowerSystemSleeping2 = 3,
PowerSystemSleeping3 = 4,
PowerSystemHibernate = 5,
PowerSystemShutdown = 6,
PowerSystemMaximum = 7
} SYSTEM_POWER_STATE,
*PSYSTEM_POWER_STATE;
typedef enum _POWER_INFORMATION_LEVEL {
SystemPowerPolicyAc,
SystemPowerPolicyDc,
VerifySystemPolicyAc,
VerifySystemPolicyDc,
SystemPowerCapabilities,
SystemBatteryState,
SystemPowerStateHandler,
ProcessorStateHandler,
SystemPowerPolicyCurrent,
AdministratorPowerPolicy,
SystemReserveHiberFile,
ProcessorInformation,
SystemPowerInformation,
ProcessorStateHandler2,
LastWakeTime,
LastSleepTime,
SystemExecutionState,
SystemPowerStateNotifyHandler,
ProcessorPowerPolicyAc,
ProcessorPowerPolicyDc,
VerifyProcessorPowerPolicyAc,
VerifyProcessorPowerPolicyDc,
ProcessorPowerPolicyCurrent
} POWER_INFORMATION_LEVEL;
typedef struct _ADMINISTRATOR_POWER_POLICY {
SYSTEM_POWER_STATE MinSleep;
SYSTEM_POWER_STATE MaxSleep;
ULONG MinVideoTimeout;
ULONG MaxVideoTimeout;
ULONG MinSpindownTimeout;
ULONG MaxSpindownTimeout;
} ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY;
typedef struct {
ULONG Granularity;
ULONG Capacity;
} BATTERY_REPORTING_SCALE,
*PBATTERY_REPORTING_SCALE;
typedef struct {
POWER_ACTION Action;
ULONG Flags;
ULONG EventCode;
} POWER_ACTION_POLICY,
*PPOWER_ACTION_POLICY;
typedef struct _PROCESSOR_POWER_INFORMATION {
ULONG Number;
ULONG MaxMhz;
ULONG CurrentMhz;
ULONG MhzLimit;
ULONG MaxIdleState;
ULONG CurrentIdleState;
} PROCESSOR_POWER_INFORMATION,
*PPROCESSOR_POWER_INFORMATION;
typedef struct _PROCESSOR_POWER_POLICY_INFO {
ULONG TimeCheck;
ULONG DemoteLimit;
ULONG PromoteLimit;
UCHAR DemotePercent;
UCHAR PromotePercent;
UCHAR Spare[2];
ULONG AllowDemotion:1;
ULONG AllowPromotion:1;
ULONG Reserved:30;
} PROCESSOR_POWER_POLICY_INFO,
*PPROCESSOR_POWER_POLICY_INFO;
typedef struct _PROCESSOR_POWER_POLICY {
DWORD Revision;
BYTE DynamicThrottle;
BYTE Spare[3];
DWORD DisableCStates:1;
DWORD Reserved:31;
DWORD PolicyCount;
PROCESSOR_POWER_POLICY_INFO Policy[3];
} PROCESSOR_POWER_POLICY,
*PPROCESSOR_POWER_POLICY;
typedef struct {
BOOLEAN AcOnLine;
BOOLEAN BatteryPresent;
BOOLEAN Charging;
BOOLEAN Discharging;
BOOLEAN Spare1[4];
ULONG MaxCapacity;
ULONG RemainingCapacity;
ULONG Rate;
ULONG EstimatedTime;
ULONG DefaultAlert1;
ULONG DefaultAlert2;
} SYSTEM_BATTERY_STATE,
*PSYSTEM_BATTERY_STATE;
typedef struct {
BOOLEAN PowerButtonPresent;
BOOLEAN SleepButtonPresent;
BOOLEAN LidPresent;
BOOLEAN SystemS1;
BOOLEAN SystemS2;
BOOLEAN SystemS3;
BOOLEAN SystemS4;
BOOLEAN SystemS5;
BOOLEAN HiberFilePresent;
BOOLEAN FullWake;
BOOLEAN VideoDimPresent;
BOOLEAN ApmPresent;
BOOLEAN UpsPresent;
BOOLEAN ThermalControl;
BOOLEAN ProcessorThrottle;
UCHAR ProcessorMinThrottle;
UCHAR ProcessorMaxThrottle;
UCHAR spare2[4];
BOOLEAN DiskSpinDown;
UCHAR spare3[8];
BOOLEAN SystemBatteriesPresent;
BOOLEAN BatteriesAreShortTerm;
BATTERY_REPORTING_SCALE BatteryScale[3];
SYSTEM_POWER_STATE AcOnLineWake;
SYSTEM_POWER_STATE SoftLidWake;
SYSTEM_POWER_STATE RtcWake;
SYSTEM_POWER_STATE MinDeviceWakeState;
SYSTEM_POWER_STATE DefaultLowLatencyWake;
} SYSTEM_POWER_CAPABILITIES,
*PSYSTEM_POWER_CAPABILITIES;
typedef struct _SYSTEM_POWER_INFORMATION {
ULONG MaxIdlenessAllowed;
ULONG Idleness;
ULONG TimeRemaining;
UCHAR CoolingMode;
} SYSTEM_POWER_INFORMATION,
*PSYSTEM_POWER_INFORMATION;
typedef struct _SYSTEM_POWER_LEVEL {
BOOLEAN Enable;
UCHAR Spare[3];
ULONG BatteryLevel;
POWER_ACTION_POLICY PowerPolicy;
SYSTEM_POWER_STATE MinSystemState;
} SYSTEM_POWER_LEVEL,
*PSYSTEM_POWER_LEVEL;
typedef struct _SYSTEM_POWER_POLICY {
ULONG Revision;
POWER_ACTION_POLICY PowerButton;
POWER_ACTION_POLICY SleepButton;
POWER_ACTION_POLICY LidClose;
SYSTEM_POWER_STATE LidOpenWake;
ULONG Reserved;
POWER_ACTION_POLICY Idle;
ULONG IdleTimeout;
UCHAR IdleSensitivity;
UCHAR DynamicThrottle;
UCHAR Spare2[2];
SYSTEM_POWER_STATE MinSleep;
SYSTEM_POWER_STATE MaxSleep;
SYSTEM_POWER_STATE ReducedLatencySleep;
ULONG WinLogonFlags;
ULONG Spare3;
ULONG DozeS4Timeout;
ULONG BroadcastCapacityResolution;
SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
ULONG VideoTimeout;
BOOLEAN VideoDimDisplay;
ULONG VideoReserved[3];
ULONG SpindownTimeout;
BOOLEAN OptimizeForPower;
UCHAR FanThrottleTolerance;
UCHAR ForcedThrottle;
UCHAR MinThrottle;
POWER_ACTION_POLICY OverThrottled;
} SYSTEM_POWER_POLICY,
*PSYSTEM_POWER_POLICY;
/* ----------------------------- begin registry ----------------------------- */
/* Registry security values */