[NDK] potypes.h: Add useful macros for SYSTEM_POWER_CAPABILITIES (#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.
This commit is contained in:
Hermès Bélusca-Maïto
2025-09-07 21:34:13 +02:00
parent 1af29a66ca
commit ae4c5b9a8d

View File

@@ -51,6 +51,33 @@ typedef enum _SYSTEM_DOCK_STATE
SystemDocked
} SYSTEM_DOCK_STATE, *PSYSTEM_DOCK_STATE;
//
// Some useful macros for SYSTEM_POWER_CAPABILITIES,
// similar to the powrprof.dll IsPwr*() functions.
//
/*
* BOOLEAN WINAPI
* IsPwrSuspendAllowed(VOID);
*/
#define IS_PWR_SUSPEND_ALLOWED(PowerCaps) \
((PowerCaps)->SystemS1 || (PowerCaps)->SystemS2 || (PowerCaps)->SystemS3)
/*
* BOOLEAN WINAPI
* IsPwrHibernateAllowed(VOID);
*/
#define IS_PWR_HIBERNATE_ALLOWED(PowerCaps) \
((PowerCaps)->SystemS4 && (PowerCaps)->HiberFilePresent)
/*
* BOOLEAN WINAPI
* IsPwrShutdownAllowed(VOID);
*/
#define IS_PWR_POWEROFF_ALLOWED(PowerCaps) \
(!!(PowerCaps)->SystemS5)
#ifndef NTOS_MODE_USER
//