I know that one can call the following API to hibernate the system:
SetSuspendState(TRUE, FALSE, FALSE);
But is there any way to find out if "real" hibernation is available for the current Windows user?
Here's what I mean:
If an admin calls:
powercfg.exe /hibernate off
the API above will put system into a Sleep mode. So how do you know (from a C++ program) that this will happen instead of hibernation?
I'm not sure if there's a group policy that can prohibit a user from hibernating a computer connected to an Active Directory?
Edit I am aware of the (dated)
IsPwrHibernateAllowed
API. I find that it doesn't work: it still returns the same result even ifpowercfg.exe /hibernate off
was called. Am I doing something wrong there? Can someone explain whyIsPwrHibernateAllowed
doesn't work for me?
Take a look at SYSTEM_POWER_CAPABILITIES
structure that can be obtained with CallNtPowerInformation. Specifically, look at HiberFilePresent
field.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With