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