Skip to content

Commit ae4c5b9

Browse files
committed
[NDK] potypes.h: Add useful macros for SYSTEM_POWER_CAPABILITIES (reactos#8386)
Add useful macros, similar to the powrprof.dll `IsPwr*()` functions, but that are suitable when one has a `SYSTEM_POWER_CAPABILITIES` structure initialized from `NtPowerInformation(SystemPowerCapabilities)`. - `IS_PWR_SUSPEND_ALLOWED()`, equivalent to `IsPwrSuspendAllowed()`, indicating whether any of the S1, S2, S3 sleep states are supported. - `IS_PWR_HIBERNATE_ALLOWED()`, equivalent to `IsPwrHibernateAllowed()`, indicating whether the S4 sleep state is supported and the hibernation file is present. - `IS_PWR_POWEROFF_ALLOWED()`, equivalent to `IsPwrShutdownAllowed()`, indicating whether the S5 "soft-off" state is supported.
1 parent 1af29a6 commit ae4c5b9

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

sdk/include/ndk/potypes.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,33 @@ typedef enum _SYSTEM_DOCK_STATE
5151
SystemDocked
5252
} SYSTEM_DOCK_STATE, *PSYSTEM_DOCK_STATE;
5353

54+
//
55+
// Some useful macros for SYSTEM_POWER_CAPABILITIES,
56+
// similar to the powrprof.dll IsPwr*() functions.
57+
//
58+
59+
/*
60+
* BOOLEAN WINAPI
61+
* IsPwrSuspendAllowed(VOID);
62+
*/
63+
#define IS_PWR_SUSPEND_ALLOWED(PowerCaps) \
64+
((PowerCaps)->SystemS1 || (PowerCaps)->SystemS2 || (PowerCaps)->SystemS3)
65+
66+
/*
67+
* BOOLEAN WINAPI
68+
* IsPwrHibernateAllowed(VOID);
69+
*/
70+
#define IS_PWR_HIBERNATE_ALLOWED(PowerCaps) \
71+
((PowerCaps)->SystemS4 && (PowerCaps)->HiberFilePresent)
72+
73+
/*
74+
* BOOLEAN WINAPI
75+
* IsPwrShutdownAllowed(VOID);
76+
*/
77+
#define IS_PWR_POWEROFF_ALLOWED(PowerCaps) \
78+
(!!(PowerCaps)->SystemS5)
79+
80+
5481
#ifndef NTOS_MODE_USER
5582

5683
//

0 commit comments

Comments
 (0)