How to initiate "modern" standby from session 0?

James Clark 6 Reputation points
2023-09-27T15:51:43.1666667+00:00

Windows 8 introduced a new power saving mode called connected standby. In Windows 10, this was extended and re-named "modern" standby". Some Microsoft documents refer to it as “S0 low-power idle mode” or "Always On / Always Connected". The new mode was initially used on the Microsoft Surface range and subsequently seems to be becoming more comment on other high-end laptop such as the Dell XPS.

Traditionally, desktop apps could use the SetSuspendState() to suspend (S1-S3) or hibernate (S4) the PC. However, this no longer works on modern standby systems and will fails with ERROR_NOT_SUPPORTED. A workaround is to turn off the display directly:

SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);

This works fine from normal user session, but can only be used from an application that has access to the display. It cannot be used in a service due to session 0 isolation.

How do you initiate "modern" standby from a service running in session 0?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,620 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Xiaopo Yang - MSFT 12,726 Reputation points Microsoft Vendor
    2023-10-05T01:38:47.6233333+00:00

    Hello @James Clark and @Telly,

    If the issue has a big impact on you, please open an incident at https://developer.microsoft.com/en-us/windows/support/?tabs=Contact-us and choose the 'System Services Development - Power Management API' for Windows SDK for this issue. In-addition, if the support engineer determines that the issue is the result of a bug the service request will be a no-charge case and you won't be charged.

    Or Send feedback to Microsoft with the Feedback Hub app.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.