Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
powrprof.h
Go to the documentation of this file.
1/* Copyright (C) 2010 Wildfire Games.
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining
4 * a copy of this software and associated documentation files (the
5 * "Software"), to deal in the Software without restriction, including
6 * without limitation the rights to use, copy, modify, merge, publish,
7 * distribute, sublicense, and/or sell copies of the Software, and to
8 * permit persons to whom the Software is furnished to do so, subject to
9 * the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23/*
24 * bring in powrprof library.
25 */
26
27#ifndef INCLUDED_POWRPROF
28#define INCLUDED_POWRPROF
29
31
32#include <powrprof.h>
33
34// the VC7 headers are missing some parts:
35
36// MinGW headers are already correct; only change on VC
37#if MSC_VERSION && MSC_VERSION < 1400
38
39#ifndef NTSTATUS
40#define NTSTATUS long
41#endif
42#ifndef STATUS_SUCCESS
43#define STATUS_SUCCESS 0
44#endif
45
46#if WINVER < 0x500
47
48typedef enum {
49 SystemPowerPolicyAc,
50 SystemPowerPolicyDc,
51 VerifySystemPolicyAc,
52 VerifySystemPolicyDc,
53 SystemPowerCapabilities,
54 SystemBatteryState,
55 SystemPowerStateHandler,
56 ProcessorStateHandler,
57 SystemPowerPolicyCurrent,
58 AdministratorPowerPolicy,
59 SystemReserveHiberFile,
60 ProcessorInformation,
61 SystemPowerInformation,
62 ProcessorStateHandler2,
63 LastWakeTime, // Compare with KeQueryInterruptTime()
64 LastSleepTime, // Compare with KeQueryInterruptTime()
65 SystemExecutionState,
66 SystemPowerStateNotifyHandler,
67 ProcessorPowerPolicyAc,
68 ProcessorPowerPolicyDc,
69 VerifyProcessorPowerPolicyAc,
70 VerifyProcessorPowerPolicyDc,
71 ProcessorPowerPolicyCurrent,
72 SystemPowerStateLogging,
73 SystemPowerLoggingEntry
74} POWER_INFORMATION_LEVEL;
75
76
77typedef struct {
78 DWORD Granularity;
79 DWORD Capacity;
80} BATTERY_REPORTING_SCALE, *PBATTERY_REPORTING_SCALE;
81
82typedef enum _SYSTEM_POWER_STATE {
83 PowerSystemUnspecified = 0,
84 PowerSystemWorking = 1,
85 PowerSystemSleeping1 = 2,
86 PowerSystemSleeping2 = 3,
87 PowerSystemSleeping3 = 4,
88 PowerSystemHibernate = 5,
89 PowerSystemShutdown = 6,
90 PowerSystemMaximum = 7
91} SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE;
92
93typedef struct {
94 // Misc supported system features
95 BOOLEAN PowerButtonPresent;
96 BOOLEAN SleepButtonPresent;
97 BOOLEAN LidPresent;
98 BOOLEAN SystemS1;
99 BOOLEAN SystemS2;
100 BOOLEAN SystemS3;
101 BOOLEAN SystemS4; // hibernate
102 BOOLEAN SystemS5; // off
103 BOOLEAN HiberFilePresent;
104 BOOLEAN FullWake;
105 BOOLEAN VideoDimPresent;
106 BOOLEAN ApmPresent;
107 BOOLEAN UpsPresent;
108
109 // Processors
110 BOOLEAN ThermalControl;
111 BOOLEAN ProcessorThrottle;
112 BYTE ProcessorMinThrottle;
113 BYTE ProcessorMaxThrottle;
114 BYTE spare2[4];
115
116 // Disk
117 BOOLEAN DiskSpinDown;
118 BYTE spare3[8];
119
120 // System Battery
121 BOOLEAN SystemBatteriesPresent;
122 BOOLEAN BatteriesAreShortTerm;
123 BATTERY_REPORTING_SCALE BatteryScale[3];
124
125 // Wake
126 SYSTEM_POWER_STATE AcOnLineWake;
127 SYSTEM_POWER_STATE SoftLidWake;
128 SYSTEM_POWER_STATE RtcWake;
129 SYSTEM_POWER_STATE MinDeviceWakeState; // note this may change on driver load
130 SYSTEM_POWER_STATE DefaultLowLatencyWake;
131} SYSTEM_POWER_CAPABILITIES, *PSYSTEM_POWER_CAPABILITIES;
132
133#endif // WINVER < 0x500
134
135typedef struct _SYSTEM_POWER_INFORMATION
136{
137 ULONG MaxIdlenessAllowed;
138 ULONG Idleness;
139 ULONG TimeRemaining;
140 UCHAR CoolingMode;
141} SYSTEM_POWER_INFORMATION, *PSYSTEM_POWER_INFORMATION;
142
143// SPI.CoolingMode
144#define PO_TZ_INVALID_MODE 0 // The system does not support CPU throttling,
145// or there is no thermal zone defined [..]
146
147#endif // #if MSC_VERSION
148
149// neither VC7.1 nor MinGW define this
151{
152 ULONG Number;
153 ULONG MaxMhz;
155 ULONG MhzLimit;
159
160#endif // #ifndef INCLUDED_POWRPROF
struct _PROCESSOR_POWER_INFORMATION PROCESSOR_POWER_INFORMATION
struct _PROCESSOR_POWER_INFORMATION * PPROCESSOR_POWER_INFORMATION
Definition: powrprof.h:151
ULONG CurrentMhz
Definition: powrprof.h:154
ULONG Number
Definition: powrprof.h:152
ULONG MhzLimit
Definition: powrprof.h:155
ULONG MaxIdleState
Definition: powrprof.h:156
ULONG CurrentIdleState
Definition: powrprof.h:157
ULONG MaxMhz
Definition: powrprof.h:153