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
if (regKeyButtons.Open(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FlyoutMenuSettings", KEY_READ) == ERROR_SUCCESS)
7717
+
{
7718
+
DWORD dwValue = 1;
7719
+
if (regKeyButtons.QueryDWORDValue(L"ShowHibernateOption", dwValue) == ERROR_SUCCESS)
7720
+
if (dwValue == 0)
7721
+
bHibernate = false;
7722
+
7723
+
if (regKeyButtons.QueryDWORDValue(L"ShowLockOption", dwValue) == ERROR_SUCCESS)
7724
+
if (dwValue == 0)
7725
+
bLock = false;
7714
7726
7715
-
bool bHibernate=false;
7716
-
if (powerCaps.HiberFilePresent)
7727
+
if (regKeyButtons.QueryDWORDValue(L"ShowSleepOption", dwValue) == ERROR_SUCCESS)
7728
+
if (dwValue == 0)
7729
+
bSleep = false;
7730
+
}
7731
+
}
7732
+
7733
+
if (bHibernate || bSleep)
7717
7734
{
7718
-
bHibernate=true;
7719
-
/* 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))
7735
+
SYSTEM_POWER_CAPABILITIES powerCaps;
7736
+
GetPwrCapabilities(&powerCaps);
7737
+
7738
+
// no sleep capabilities, turn off the sleep option
7739
+
if (!(powerCaps.SystemS1 || powerCaps.SystemS2 || powerCaps.SystemS3 || powerCaps.AoAc))
7723
7740
{
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
-
}*/
7741
+
bSleep = false;
7742
+
}
7743
+
7744
+
// no hibernate capabilities, turn off hibernate option
7745
+
if (!powerCaps.HiberFilePresent)
7746
+
{
7747
+
bHibernate = false;
7748
+
/* disabled for now, use group policy to hide Hibernate
7749
+
// disable hibernate if hybrid sleep (fast s4) is enabled
7750
+
SYSTEM_POWER_STATUS status;
7751
+
if (GetSystemPowerStatus(&status) && (status.ACLineStatus==0 || status.ACLineStatus==1))
7752
+
{
7753
+
GUID *pScheme;
7754
+
if (PowerGetActiveScheme(NULL,&pScheme)==ERROR_SUCCESS)
7755
+
{
7756
+
DWORD index;
7757
+
if ((status.ACLineStatus==1?PowerReadACValueIndex:PowerReadDCValueIndex)(NULL,pScheme,&GUID_SLEEP_SUBGROUP,&GUID_HIBERNATE_FASTS4_POLICY,&index)==ERROR_SUCCESS && index)
0 commit comments