mirror of
https://github.com/Open-Shell/Open-Shell-Menu.git
synced 2026-04-13 20:28:31 +10:00
@@ -7709,13 +7709,42 @@ HWND CMenuContainer::ToggleStartMenu( int taskbarId, bool bKeyboard, bool bAllPr
|
||||
|
||||
s_bHasUpdates=(!bRemote || GetSettingBool(L"RemoteShutdown")) && GetSettingBool(L"CheckWinUpdates") && CheckForUpdates();
|
||||
|
||||
// Check control panel options for power buttons
|
||||
bool bHibernate = true, bSleep = true, bLock = true;
|
||||
{
|
||||
CRegKey regKeyButtons;
|
||||
if (regKeyButtons.Open(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FlyoutMenuSettings", KEY_READ) == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD dwValue = 1;
|
||||
if (regKeyButtons.QueryDWORDValue(L"ShowHibernateOption", dwValue) == ERROR_SUCCESS)
|
||||
if (dwValue == 0)
|
||||
bHibernate = false;
|
||||
|
||||
if (regKeyButtons.QueryDWORDValue(L"ShowLockOption", dwValue) == ERROR_SUCCESS)
|
||||
if (dwValue == 0)
|
||||
bLock = false;
|
||||
|
||||
if (regKeyButtons.QueryDWORDValue(L"ShowSleepOption", dwValue) == ERROR_SUCCESS)
|
||||
if (dwValue == 0)
|
||||
bSleep = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (bHibernate || bSleep)
|
||||
{
|
||||
SYSTEM_POWER_CAPABILITIES powerCaps;
|
||||
GetPwrCapabilities(&powerCaps);
|
||||
|
||||
bool bHibernate=false;
|
||||
if (powerCaps.HiberFilePresent)
|
||||
// no sleep capabilities, turn off the sleep option
|
||||
if (!(powerCaps.SystemS1 || powerCaps.SystemS2 || powerCaps.SystemS3 || powerCaps.AoAc))
|
||||
{
|
||||
bHibernate=true;
|
||||
bSleep = false;
|
||||
}
|
||||
|
||||
// no hibernate capabilities, turn off hibernate option
|
||||
if (!powerCaps.HiberFilePresent)
|
||||
{
|
||||
bHibernate = false;
|
||||
/* disabled for now, use group policy to hide Hibernate
|
||||
// disable hibernate if hybrid sleep (fast s4) is enabled
|
||||
SYSTEM_POWER_STATUS status;
|
||||
@@ -7731,6 +7760,7 @@ HWND CMenuContainer::ToggleStartMenu( int taskbarId, bool bKeyboard, bool bAllPr
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0;i<_countof(g_StdOptions);i++)
|
||||
{
|
||||
@@ -7939,8 +7969,11 @@ HWND CMenuContainer::ToggleStartMenu( int taskbarId, bool bKeyboard, bool bAllPr
|
||||
g_StdOptions[i].options=MENU_ENABLED|MENU_EXPANDED;
|
||||
}
|
||||
break;
|
||||
case MENU_LOCK:
|
||||
g_StdOptions[i].options=(bLock)?MENU_ENABLED|MENU_EXPANDED:0;
|
||||
break;
|
||||
case MENU_SLEEP:
|
||||
g_StdOptions[i].options=(!s_bNoClose && (powerCaps.SystemS1 || powerCaps.SystemS2 || powerCaps.SystemS3 || powerCaps.AoAc))?MENU_ENABLED|MENU_EXPANDED:0;
|
||||
g_StdOptions[i].options=(!s_bNoClose && bSleep)?MENU_ENABLED|MENU_EXPANDED:0;
|
||||
break;
|
||||
case MENU_HIBERNATE:
|
||||
g_StdOptions[i].options=(!s_bNoClose && bHibernate)?MENU_ENABLED|MENU_EXPANDED:0;
|
||||
|
||||
Reference in New Issue
Block a user