You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* disabled for now, use group policy to hide Hibernate
7720
-
// disable hibernate if hybrid sleep (fast s4) is enabled
7721
-
SYSTEM_POWER_STATUS status;
7722
-
if (GetSystemPowerStatus(&status) && (status.ACLineStatus==0 || status.ACLineStatus==1))
7718
+
CRegKey regKeyButtons;
7719
+
if (regKeyButtons.Open(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FlyoutMenuSettings", KEY_READ) == ERROR_SUCCESS)
7723
7720
{
7724
-
GUID *pScheme;
7725
-
if (PowerGetActiveScheme(NULL,&pScheme)==ERROR_SUCCESS)
7726
-
{
7727
-
DWORD index;
7728
-
if ((status.ACLineStatus==1?PowerReadACValueIndex:PowerReadDCValueIndex)(NULL,pScheme,&GUID_SLEEP_SUBGROUP,&GUID_HIBERNATE_FASTS4_POLICY,&index)==ERROR_SUCCESS && index)
7729
-
bHibernate=false;
7730
-
LocalFree(pScheme);
7731
-
}
7732
-
}*/
7721
+
DWORD dwValue = 1;
7722
+
if (regKeyButtons.QueryDWORDValue(L"ShowHibernateOption", dwValue) == ERROR_SUCCESS)
7723
+
if (dwValue == 0)
7724
+
bHibernate = false;
7725
+
7726
+
if (regKeyButtons.QueryDWORDValue(L"ShowLockOption", dwValue) == ERROR_SUCCESS)
7727
+
if (dwValue == 0)
7728
+
bLock = false;
7729
+
7730
+
if (regKeyButtons.QueryDWORDValue(L"ShowSleepOption", dwValue) == ERROR_SUCCESS)
7731
+
if (dwValue == 0)
7732
+
bSleep = false;
7733
+
}
7734
+
}
7735
+
7736
+
if (bHibernate || bSleep)
7737
+
{
7738
+
SYSTEM_POWER_CAPABILITIES powerCaps;
7739
+
GetPwrCapabilities(&powerCaps);
7740
+
7741
+
// no sleep capabilities, turn off the sleep option
7742
+
if (!powerCaps.SystemS1 && !powerCaps.SystemS2 && !powerCaps.SystemS3 && !powerCaps.AoAc)
7743
+
{
7744
+
bSleep = false;
7745
+
}
7746
+
7747
+
// no hibernate capabilities, turn off hibernate option
7748
+
if (!powerCaps.HiberFilePresent)
7749
+
{
7750
+
bHibernate = false;
7751
+
/* disabled for now, use group policy to hide Hibernate
7752
+
// disable hibernate if hybrid sleep (fast s4) is enabled
7753
+
SYSTEM_POWER_STATUS status;
7754
+
if (GetSystemPowerStatus(&status) && (status.ACLineStatus==0 || status.ACLineStatus==1))
7755
+
{
7756
+
GUID *pScheme;
7757
+
if (PowerGetActiveScheme(NULL,&pScheme)==ERROR_SUCCESS)
7758
+
{
7759
+
DWORD index;
7760
+
if ((status.ACLineStatus==1?PowerReadACValueIndex:PowerReadDCValueIndex)(NULL,pScheme,&GUID_SLEEP_SUBGROUP,&GUID_HIBERNATE_FASTS4_POLICY,&index)==ERROR_SUCCESS && index)
0 commit comments