Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

695 lines
20 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ntpoapi.h
  5. Abstract:
  6. This module contains the user APIs for the NT Power Management.
  7. Author:
  8. Revision History:
  9. --*/
  10. #ifndef _NTPOAPI_
  11. #define _NTPOAPI_
  12. #if _MSC_VER > 1000
  13. #pragma once
  14. #endif
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. //
  19. // Power Management user APIs
  20. //
  21. // begin_ntddk begin_ntifs begin_nthal begin_ntminiport begin_wdm
  22. #ifndef _PO_DDK_
  23. #define _PO_DDK_
  24. // begin_winnt
  25. typedef enum _SYSTEM_POWER_STATE {
  26. PowerSystemUnspecified = 0,
  27. PowerSystemWorking = 1,
  28. PowerSystemSleeping1 = 2,
  29. PowerSystemSleeping2 = 3,
  30. PowerSystemSleeping3 = 4,
  31. PowerSystemHibernate = 5,
  32. PowerSystemShutdown = 6,
  33. PowerSystemMaximum = 7
  34. } SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE;
  35. #define POWER_SYSTEM_MAXIMUM 7
  36. typedef enum {
  37. PowerActionNone = 0,
  38. PowerActionReserved,
  39. PowerActionSleep,
  40. PowerActionHibernate,
  41. PowerActionShutdown,
  42. PowerActionShutdownReset,
  43. PowerActionShutdownOff,
  44. PowerActionWarmEject
  45. } POWER_ACTION, *PPOWER_ACTION;
  46. typedef enum _DEVICE_POWER_STATE {
  47. PowerDeviceUnspecified = 0,
  48. PowerDeviceD0,
  49. PowerDeviceD1,
  50. PowerDeviceD2,
  51. PowerDeviceD3,
  52. PowerDeviceMaximum
  53. } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
  54. // end_winnt
  55. typedef union _POWER_STATE {
  56. SYSTEM_POWER_STATE SystemState;
  57. DEVICE_POWER_STATE DeviceState;
  58. } POWER_STATE, *PPOWER_STATE;
  59. typedef enum _POWER_STATE_TYPE {
  60. SystemPowerState = 0,
  61. DevicePowerState
  62. } POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
  63. //
  64. // Generic power related IOCTLs
  65. //
  66. #define IOCTL_QUERY_DEVICE_POWER_STATE \
  67. CTL_CODE(FILE_DEVICE_BATTERY, 0x0, METHOD_BUFFERED, FILE_READ_ACCESS)
  68. #define IOCTL_SET_DEVICE_WAKE \
  69. CTL_CODE(FILE_DEVICE_BATTERY, 0x1, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  70. #define IOCTL_CANCEL_DEVICE_WAKE \
  71. CTL_CODE(FILE_DEVICE_BATTERY, 0x2, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  72. //
  73. // Defines for W32 interfaces
  74. //
  75. // begin_winnt
  76. #define ES_SYSTEM_REQUIRED ((ULONG)0x00000001)
  77. #define ES_DISPLAY_REQUIRED ((ULONG)0x00000002)
  78. #define ES_USER_PRESENT ((ULONG)0x00000004)
  79. #define ES_CONTINUOUS ((ULONG)0x80000000)
  80. typedef ULONG EXECUTION_STATE;
  81. typedef enum {
  82. LT_DONT_CARE,
  83. LT_LOWEST_LATENCY
  84. } LATENCY_TIME;
  85. // end_ntminiport end_ntifs end_wdm end_ntddk
  86. //-----------------------------------------------------------------------------
  87. // Device Power Information
  88. // Accessable via CM_Get_DevInst_Registry_Property_Ex(CM_DRP_DEVICE_POWER_DATA)
  89. //-----------------------------------------------------------------------------
  90. #define PDCAP_D0_SUPPORTED 0x00000001
  91. #define PDCAP_D1_SUPPORTED 0x00000002
  92. #define PDCAP_D2_SUPPORTED 0x00000004
  93. #define PDCAP_D3_SUPPORTED 0x00000008
  94. #define PDCAP_WAKE_FROM_D0_SUPPORTED 0x00000010
  95. #define PDCAP_WAKE_FROM_D1_SUPPORTED 0x00000020
  96. #define PDCAP_WAKE_FROM_D2_SUPPORTED 0x00000040
  97. #define PDCAP_WAKE_FROM_D3_SUPPORTED 0x00000080
  98. #define PDCAP_WARM_EJECT_SUPPORTED 0x00000100
  99. typedef struct CM_Power_Data_s {
  100. ULONG PD_Size;
  101. DEVICE_POWER_STATE PD_MostRecentPowerState;
  102. ULONG PD_Capabilities;
  103. ULONG PD_D1Latency;
  104. ULONG PD_D2Latency;
  105. ULONG PD_D3Latency;
  106. DEVICE_POWER_STATE PD_PowerStateMapping[POWER_SYSTEM_MAXIMUM];
  107. SYSTEM_POWER_STATE PD_DeepestSystemWake;
  108. } CM_POWER_DATA, *PCM_POWER_DATA;
  109. // begin_ntddk
  110. typedef enum {
  111. SystemPowerPolicyAc,
  112. SystemPowerPolicyDc,
  113. VerifySystemPolicyAc,
  114. VerifySystemPolicyDc,
  115. SystemPowerCapabilities,
  116. SystemBatteryState,
  117. SystemPowerStateHandler,
  118. ProcessorStateHandler,
  119. SystemPowerPolicyCurrent,
  120. AdministratorPowerPolicy,
  121. SystemReserveHiberFile,
  122. ProcessorInformation,
  123. SystemPowerInformation,
  124. ProcessorStateHandler2,
  125. LastWakeTime, // Compare with KeQueryInterruptTime()
  126. LastSleepTime, // Compare with KeQueryInterruptTime()
  127. SystemExecutionState,
  128. SystemPowerStateNotifyHandler,
  129. ProcessorPowerPolicyAc,
  130. ProcessorPowerPolicyDc,
  131. VerifyProcessorPowerPolicyAc,
  132. VerifyProcessorPowerPolicyDc,
  133. ProcessorPowerPolicyCurrent,
  134. SystemPowerStateLogging,
  135. SystemPowerLoggingEntry
  136. } POWER_INFORMATION_LEVEL;
  137. // begin_wdm
  138. //
  139. // System power manager capabilities
  140. //
  141. typedef struct {
  142. ULONG Granularity;
  143. ULONG Capacity;
  144. } BATTERY_REPORTING_SCALE, *PBATTERY_REPORTING_SCALE;
  145. // end_winnt
  146. // begin_ntminiport begin_ntifs
  147. #endif // !_PO_DDK_
  148. // end_ntddk end_ntminiport end_wdm end_ntifs
  149. #define POWER_PERF_SCALE 100
  150. #define PERF_LEVEL_TO_PERCENT(_x_) ((_x_ * 1000) / (POWER_PERF_SCALE * 10))
  151. #define PERCENT_TO_PERF_LEVEL(_x_) ((_x_ * POWER_PERF_SCALE * 10) / 1000)
  152. //
  153. // Policy manager state handler interfaces
  154. //
  155. // power state handlers
  156. typedef enum {
  157. PowerStateSleeping1 = 0,
  158. PowerStateSleeping2 = 1,
  159. PowerStateSleeping3 = 2,
  160. PowerStateSleeping4 = 3,
  161. PowerStateSleeping4Firmware = 4,
  162. PowerStateShutdownReset = 5,
  163. PowerStateShutdownOff = 6,
  164. PowerStateMaximum = 7
  165. } POWER_STATE_HANDLER_TYPE, *PPOWER_STATE_HANDLER_TYPE;
  166. #define POWER_STATE_HANDLER_TYPE_MAX 8
  167. typedef
  168. NTSTATUS
  169. (*PENTER_STATE_SYSTEM_HANDLER)(
  170. IN PVOID SystemContext
  171. );
  172. typedef
  173. NTSTATUS
  174. (*PENTER_STATE_HANDLER)(
  175. IN PVOID Context,
  176. IN PENTER_STATE_SYSTEM_HANDLER SystemHandler OPTIONAL,
  177. IN PVOID SystemContext,
  178. IN LONG NumberProcessors,
  179. IN volatile PLONG Number
  180. );
  181. typedef struct {
  182. POWER_STATE_HANDLER_TYPE Type;
  183. BOOLEAN RtcWake;
  184. UCHAR Spare[3];
  185. PENTER_STATE_HANDLER Handler;
  186. PVOID Context;
  187. } POWER_STATE_HANDLER, *PPOWER_STATE_HANDLER;
  188. typedef
  189. NTSTATUS
  190. (*PENTER_STATE_NOTIFY_HANDLER)(
  191. IN POWER_STATE_HANDLER_TYPE State,
  192. IN PVOID Context,
  193. IN BOOLEAN Entering
  194. );
  195. typedef struct {
  196. PENTER_STATE_NOTIFY_HANDLER Handler;
  197. PVOID Context;
  198. } POWER_STATE_NOTIFY_HANDLER, *PPOWER_STATE_NOTIFY_HANDLER;
  199. NTSYSCALLAPI
  200. NTSTATUS
  201. NTAPI
  202. NtPowerInformation(
  203. IN POWER_INFORMATION_LEVEL InformationLevel,
  204. IN PVOID InputBuffer OPTIONAL,
  205. IN ULONG InputBufferLength,
  206. OUT PVOID OutputBuffer OPTIONAL,
  207. IN ULONG OutputBufferLength
  208. );
  209. // processor idle functions
  210. typedef struct {
  211. ULONGLONG StartTime;
  212. ULONGLONG EndTime;
  213. ULONG IdleHandlerReserved[4];
  214. } PROCESSOR_IDLE_TIMES, *PPROCESSOR_IDLE_TIMES;
  215. typedef
  216. BOOLEAN
  217. (FASTCALL *PPROCESSOR_IDLE_HANDLER) (
  218. IN OUT PPROCESSOR_IDLE_TIMES IdleTimes
  219. );
  220. typedef struct {
  221. ULONG HardwareLatency;
  222. PPROCESSOR_IDLE_HANDLER Handler;
  223. } PROCESSOR_IDLE_HANDLER_INFO, *PPROCESSOR_IDLE_HANDLER_INFO;
  224. typedef
  225. VOID
  226. (FASTCALL *PSET_PROCESSOR_THROTTLE) (
  227. IN UCHAR Throttle
  228. );
  229. typedef
  230. NTSTATUS
  231. (FASTCALL *PSET_PROCESSOR_THROTTLE2) (
  232. IN UCHAR Throttle
  233. );
  234. #define MAX_IDLE_HANDLERS 3
  235. typedef struct {
  236. UCHAR ThrottleScale;
  237. BOOLEAN ThrottleOnIdle;
  238. PSET_PROCESSOR_THROTTLE SetThrottle;
  239. ULONG NumIdleHandlers;
  240. PROCESSOR_IDLE_HANDLER_INFO IdleHandler[MAX_IDLE_HANDLERS];
  241. } PROCESSOR_STATE_HANDLER, *PPROCESSOR_STATE_HANDLER;
  242. // Processor_Perf_Level Flags
  243. #define PROCESSOR_STATE_TYPE_PERFORMANCE 0x1
  244. #define PROCESSOR_STATE_TYPE_THROTTLE 0x2
  245. typedef struct {
  246. UCHAR PercentFrequency; // max == POWER_PERF_SCALE
  247. UCHAR Reserved;
  248. USHORT Flags;
  249. } PROCESSOR_PERF_LEVEL, *PPROCESSOR_PERF_LEVEL;
  250. typedef struct {
  251. UCHAR PercentFrequency; // max == POWER_PERF_SCALE
  252. UCHAR MinCapacity; // battery capacity %
  253. USHORT Power; // in milliwatts
  254. UCHAR IncreaseLevel; // goto higher state
  255. UCHAR DecreaseLevel; // goto lower state
  256. USHORT Flags;
  257. ULONG IncreaseTime; // in tick counts
  258. ULONG DecreaseTime; // in tick counts
  259. ULONG IncreaseCount; // goto higher state
  260. ULONG DecreaseCount; // goto lower state
  261. ULONGLONG PerformanceTime; // Tick count
  262. } PROCESSOR_PERF_STATE, *PPROCESSOR_PERF_STATE;
  263. typedef struct {
  264. ULONG NumIdleHandlers;
  265. PROCESSOR_IDLE_HANDLER_INFO IdleHandler[MAX_IDLE_HANDLERS];
  266. PSET_PROCESSOR_THROTTLE2 SetPerfLevel;
  267. ULONG HardwareLatency;
  268. UCHAR NumPerfStates;
  269. PROCESSOR_PERF_LEVEL PerfLevel[1]; // variable size
  270. } PROCESSOR_STATE_HANDLER2, *PPROCESSOR_STATE_HANDLER2;
  271. // begin_winnt
  272. //
  273. // Power Policy Management interfaces
  274. //
  275. typedef struct {
  276. POWER_ACTION Action;
  277. ULONG Flags;
  278. ULONG EventCode;
  279. } POWER_ACTION_POLICY, *PPOWER_ACTION_POLICY;
  280. // POWER_ACTION_POLICY->Flags:
  281. #define POWER_ACTION_QUERY_ALLOWED 0x00000001
  282. #define POWER_ACTION_UI_ALLOWED 0x00000002
  283. #define POWER_ACTION_OVERRIDE_APPS 0x00000004
  284. #define POWER_ACTION_LIGHTEST_FIRST 0x10000000
  285. #define POWER_ACTION_LOCK_CONSOLE 0x20000000
  286. #define POWER_ACTION_DISABLE_WAKES 0x40000000
  287. #define POWER_ACTION_CRITICAL 0x80000000
  288. // POWER_ACTION_POLICY->EventCode flags
  289. #define POWER_LEVEL_USER_NOTIFY_TEXT 0x00000001
  290. #define POWER_LEVEL_USER_NOTIFY_SOUND 0x00000002
  291. #define POWER_LEVEL_USER_NOTIFY_EXEC 0x00000004
  292. #define POWER_USER_NOTIFY_BUTTON 0x00000008
  293. #define POWER_USER_NOTIFY_SHUTDOWN 0x00000010
  294. #define POWER_FORCE_TRIGGER_RESET 0x80000000
  295. // system battery drain policies
  296. typedef struct {
  297. BOOLEAN Enable;
  298. UCHAR Spare[3];
  299. ULONG BatteryLevel;
  300. POWER_ACTION_POLICY PowerPolicy;
  301. SYSTEM_POWER_STATE MinSystemState;
  302. } SYSTEM_POWER_LEVEL, *PSYSTEM_POWER_LEVEL;
  303. // Discharge policy constants
  304. #define NUM_DISCHARGE_POLICIES 4
  305. #define DISCHARGE_POLICY_CRITICAL 0
  306. #define DISCHARGE_POLICY_LOW 1
  307. //
  308. // Throttling policies
  309. //
  310. #define PO_THROTTLE_NONE 0
  311. #define PO_THROTTLE_CONSTANT 1
  312. #define PO_THROTTLE_DEGRADE 2
  313. #define PO_THROTTLE_ADAPTIVE 3
  314. #define PO_THROTTLE_MAXIMUM 4 // not a policy, just a limit
  315. // system power policies
  316. typedef struct _SYSTEM_POWER_POLICY {
  317. ULONG Revision; // 1
  318. // events
  319. POWER_ACTION_POLICY PowerButton;
  320. POWER_ACTION_POLICY SleepButton;
  321. POWER_ACTION_POLICY LidClose;
  322. SYSTEM_POWER_STATE LidOpenWake;
  323. ULONG Reserved;
  324. // "system idle" detection
  325. POWER_ACTION_POLICY Idle;
  326. ULONG IdleTimeout;
  327. UCHAR IdleSensitivity;
  328. // dynamic throttling policy
  329. // PO_THROTTLE_NONE, PO_THROTTLE_CONSTANT, PO_THROTTLE_DEGRADE, or PO_THROTTLE_ADAPTIVE
  330. UCHAR DynamicThrottle;
  331. UCHAR Spare2[2];
  332. // meaning of power action "sleep"
  333. SYSTEM_POWER_STATE MinSleep;
  334. SYSTEM_POWER_STATE MaxSleep;
  335. SYSTEM_POWER_STATE ReducedLatencySleep;
  336. ULONG WinLogonFlags;
  337. // parameters for dozing
  338. ULONG Spare3;
  339. ULONG DozeS4Timeout;
  340. // battery policies
  341. ULONG BroadcastCapacityResolution;
  342. SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
  343. // video policies
  344. ULONG VideoTimeout;
  345. BOOLEAN VideoDimDisplay;
  346. ULONG VideoReserved[3];
  347. // hard disk policies
  348. ULONG SpindownTimeout;
  349. // processor policies
  350. BOOLEAN OptimizeForPower;
  351. UCHAR FanThrottleTolerance;
  352. UCHAR ForcedThrottle;
  353. UCHAR MinThrottle;
  354. POWER_ACTION_POLICY OverThrottled;
  355. } SYSTEM_POWER_POLICY, *PSYSTEM_POWER_POLICY;
  356. // processor power policy state
  357. typedef struct _PROCESSOR_POWER_POLICY_INFO {
  358. // Time based information (will be converted to kernel units)
  359. ULONG TimeCheck; // in US
  360. ULONG DemoteLimit; // in US
  361. ULONG PromoteLimit; // in US
  362. // Percentage based information
  363. UCHAR DemotePercent;
  364. UCHAR PromotePercent;
  365. UCHAR Spare[2];
  366. // Flags
  367. ULONG AllowDemotion:1;
  368. ULONG AllowPromotion:1;
  369. ULONG Reserved:30;
  370. } PROCESSOR_POWER_POLICY_INFO, *PPROCESSOR_POWER_POLICY_INFO;
  371. // processor power policy
  372. typedef struct _PROCESSOR_POWER_POLICY {
  373. ULONG Revision; // 1
  374. // Dynamic Throttling Policy
  375. UCHAR DynamicThrottle;
  376. UCHAR Spare[3];
  377. // Flags
  378. ULONG DisableCStates:1;
  379. ULONG Reserved:31;
  380. // System policy information
  381. // The Array is last, in case it needs to be grown and the structure
  382. // revision incremented.
  383. ULONG PolicyCount;
  384. PROCESSOR_POWER_POLICY_INFO Policy[3];
  385. } PROCESSOR_POWER_POLICY, *PPROCESSOR_POWER_POLICY;
  386. // administrator power policy overrides
  387. typedef struct _ADMINISTRATOR_POWER_POLICY {
  388. // meaning of power action "sleep"
  389. SYSTEM_POWER_STATE MinSleep;
  390. SYSTEM_POWER_STATE MaxSleep;
  391. // video policies
  392. ULONG MinVideoTimeout;
  393. ULONG MaxVideoTimeout;
  394. // disk policies
  395. ULONG MinSpindownTimeout;
  396. ULONG MaxSpindownTimeout;
  397. } ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY;
  398. // end_winnt
  399. NTSYSCALLAPI
  400. NTSTATUS
  401. NTAPI
  402. NtSetThreadExecutionState(
  403. IN EXECUTION_STATE esFlags, // ES_xxx flags
  404. OUT EXECUTION_STATE *PreviousFlags
  405. );
  406. NTSYSCALLAPI
  407. NTSTATUS
  408. NTAPI
  409. NtRequestWakeupLatency(
  410. IN LATENCY_TIME latency
  411. );
  412. NTSYSCALLAPI
  413. NTSTATUS
  414. NTAPI
  415. NtInitiatePowerAction(
  416. IN POWER_ACTION SystemAction,
  417. IN SYSTEM_POWER_STATE MinSystemState,
  418. IN ULONG Flags, // POWER_ACTION_xxx flags
  419. IN BOOLEAN Asynchronous
  420. );
  421. NTSYSCALLAPI // only called by WinLogon
  422. NTSTATUS
  423. NTAPI
  424. NtSetSystemPowerState(
  425. IN POWER_ACTION SystemAction,
  426. IN SYSTEM_POWER_STATE MinSystemState,
  427. IN ULONG Flags // POWER_ACTION_xxx flags
  428. );
  429. NTSYSCALLAPI
  430. NTSTATUS
  431. NTAPI
  432. NtGetDevicePowerState(
  433. IN HANDLE Device,
  434. OUT DEVICE_POWER_STATE *State
  435. );
  436. NTSYSCALLAPI
  437. NTSTATUS
  438. NTAPI
  439. NtCancelDeviceWakeupRequest(
  440. IN HANDLE Device
  441. );
  442. NTSYSCALLAPI
  443. BOOLEAN
  444. NTAPI
  445. NtIsSystemResumeAutomatic(
  446. VOID
  447. );
  448. NTSYSCALLAPI
  449. NTSTATUS
  450. NTAPI
  451. NtRequestDeviceWakeup(
  452. IN HANDLE Device
  453. );
  454. // WinLogonFlags:
  455. #define WINLOGON_LOCK_ON_SLEEP 0x00000001
  456. // begin_winnt
  457. typedef struct {
  458. // Misc supported system features
  459. BOOLEAN PowerButtonPresent;
  460. BOOLEAN SleepButtonPresent;
  461. BOOLEAN LidPresent;
  462. BOOLEAN SystemS1;
  463. BOOLEAN SystemS2;
  464. BOOLEAN SystemS3;
  465. BOOLEAN SystemS4; // hibernate
  466. BOOLEAN SystemS5; // off
  467. BOOLEAN HiberFilePresent;
  468. BOOLEAN FullWake;
  469. BOOLEAN VideoDimPresent;
  470. BOOLEAN ApmPresent;
  471. BOOLEAN UpsPresent;
  472. // Processors
  473. BOOLEAN ThermalControl;
  474. BOOLEAN ProcessorThrottle;
  475. UCHAR ProcessorMinThrottle;
  476. UCHAR ProcessorMaxThrottle;
  477. UCHAR spare2[4];
  478. // Disk
  479. BOOLEAN DiskSpinDown;
  480. UCHAR spare3[8];
  481. // System Battery
  482. BOOLEAN SystemBatteriesPresent;
  483. BOOLEAN BatteriesAreShortTerm;
  484. BATTERY_REPORTING_SCALE BatteryScale[3];
  485. // Wake
  486. SYSTEM_POWER_STATE AcOnLineWake;
  487. SYSTEM_POWER_STATE SoftLidWake;
  488. SYSTEM_POWER_STATE RtcWake;
  489. SYSTEM_POWER_STATE MinDeviceWakeState; // note this may change on driver load
  490. SYSTEM_POWER_STATE DefaultLowLatencyWake;
  491. } SYSTEM_POWER_CAPABILITIES, *PSYSTEM_POWER_CAPABILITIES;
  492. typedef struct {
  493. BOOLEAN AcOnLine;
  494. BOOLEAN BatteryPresent;
  495. BOOLEAN Charging;
  496. BOOLEAN Discharging;
  497. BOOLEAN Spare1[4];
  498. ULONG MaxCapacity;
  499. ULONG RemainingCapacity;
  500. ULONG Rate;
  501. ULONG EstimatedTime;
  502. ULONG DefaultAlert1;
  503. ULONG DefaultAlert2;
  504. } SYSTEM_BATTERY_STATE, *PSYSTEM_BATTERY_STATE;
  505. // end_winnt
  506. //
  507. // valid flags for SYSTEM_POWER_STATE_DISABLE_REASON.PowerReasonCode
  508. //
  509. #define SPSD_REASON_NONE 0x00000000
  510. #define SPSD_REASON_NOBIOSSUPPORT 0x00000001
  511. #define SPSD_REASON_BIOSINCOMPATIBLE 0x00000002
  512. #define SPSD_REASON_NOOSPM 0x00000003
  513. #define SPSD_REASON_LEGACYDRIVER 0x00000004
  514. #define SPSD_REASON_HIBERSTACK 0x00000005
  515. #define SPSD_REASON_HIBERFILE 0x00000006
  516. #define SPSD_REASON_POINTERNAL 0x00000007
  517. #define SPSD_REASON_PAEMODE 0x00000008
  518. #define SPSD_REASON_MPOVERRIDE 0x00000009
  519. #define SPSD_REASON_DRIVERDOWNGRADE 0x0000000A
  520. #define SPSD_REASON_PREVIOUSATTEMPTFAILED 0x0000000B
  521. #define SPSD_REASON_UNKNOWN 0xFFFFFFFF
  522. typedef struct _SYSTEM_POWER_STATE_DISABLE_REASON {
  523. BOOLEAN AffectedState[POWER_STATE_HANDLER_TYPE_MAX];
  524. ULONG PowerReasonCode;
  525. ULONG PowerReasonLength;
  526. //UCHAR PowerReasonInfo[ANYSIZE_ARRAY];
  527. } SYSTEM_POWER_STATE_DISABLE_REASON, *PSYSTEM_POWER_STATE_DISABLE_REASON;
  528. //
  529. // valid flags for SYSTEM_POWER_LOGGING_ENTRY.LoggingType
  530. //
  531. #define LOGGING_TYPE_SPSD 0x00000001
  532. #define LOGGING_TYPE_POWERTRANSITION 0x00000002
  533. typedef struct _SYSTEM_POWER_LOGGING_ENTRY {
  534. ULONG LoggingType;
  535. PVOID LoggingEntry;
  536. } SYSTEM_POWER_LOGGING_ENTRY, *PSYSTEM_POWER_LOGGING_ENTRY;
  537. // end_nthal
  538. typedef struct _PROCESSOR_POWER_INFORMATION {
  539. ULONG Number;
  540. ULONG MaxMhz;
  541. ULONG CurrentMhz;
  542. ULONG MhzLimit;
  543. ULONG MaxIdleState;
  544. ULONG CurrentIdleState;
  545. } PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION;
  546. typedef struct _SYSTEM_POWER_INFORMATION {
  547. ULONG MaxIdlenessAllowed;
  548. ULONG Idleness;
  549. ULONG TimeRemaining;
  550. UCHAR CoolingMode;
  551. } SYSTEM_POWER_INFORMATION, *PSYSTEM_POWER_INFORMATION;
  552. #ifdef __cplusplus
  553. }
  554. #endif
  555. #endif // _NTPOAPI_