I know that to hibernate the system, you can call the following API:
SetSuspendState(TRUE, FALSE, FALSE);
But is there a way to find out if real hibernation is available for the current Windows user?
Here is what I mean:
If the administrator calls:
powercfg.exe /hibernate off
The above API puts the system to sleep. So, how do you know (from a C ++ program) that this will happen instead of sleep mode?
I'm not sure if there is a group policy that can prevent a user from sleeping on a computer connected to Active Directory?
Edit I know the (dated) IsPwrHibernateAllowed
API. I believe that it does not work: it still returns the same result, even if powercfg.exe /hibernate off
was called. Am I doing something there? Can someone explain why IsPwrHibernateAllowed
not working for me?
ahmd0 source share