Difference between ResumeAutomatic & ResumeSuspend Windows Service Modes

According to MSDN documentation

ResumeAutomatic: the computer automatically woke up to handle the event.

Note. If the system detects user activity after broadcasting ResumeAutomatic, it will broadcast the ResumeSuspend event so that applications know that they can resume full user interaction.

ResumeSuspend: the system resumed operation after a suspension.

Does this mean that "ResumeAutomatic" is called when the computer wakes up from sleep, and "ResumeSuspend" is called when the user logs in after entering the credentials?

I am using tcp socket to communicate with the server. Therefore, in order to reconnect to the service when the system returned from sleep state, I have the following code

protected override bool OnPowerEvent(PowerBroadcastStatus powerStatus) { Logger.Log("Power status is : " + powerStatus); if (powerStatus == PowerBroadcastStatus.ResumeAutomatic) { ConnectionWatchdog.ReConnect(); } return base.OnPowerEvent(powerStatus); } 

But I notice that the enum values ​​are random. Below are 3 different tracks in 3 different wake modes.

20150525 # 094449 :: Power Status: Pause

20150525 # 094716 :: Power Status: ResumeSuspend


20150525 # 103431 :: Power Status: Suspended

20150525 # 103525 :: Power Status: ResumeSuspend

20150525 # 103525 :: Power Condition: ResumeAutomatic


20150525 # 103558 :: Power Status: Suspended

20150525 # 103835 :: Power Condition: ResumeAutomatic

+5
source share
1 answer

How it should work

(This is not how it all works in practice - see below.)

ResumeAutomatic

This message is always sent when the computer resumes operation after sleep.

Resumeuspend

The computer resumed operation after sleep, and Windows believes that the user is present, that is, the person sitting in front of the machine. This message is sent when: a) the occurrence is caused by human interaction (someone pressed the power button, pressing a key, moving the mouse, etc.); or b) at the first human interaction after the machine automatically wakes up due to a tracking timer.

To answer your question, ResumeSuspend is sent when the user first contacts the computer. It can enter a password to unlock it, but it is not necessary. If the user just moves the mouse, ResumeSuspend will still be sent.

Summarizing:

  • ResumeAutomatic is always sent when the computer resumes sleep mode.
  • ResumeSuspend is sent, as well as ResumeAutomatic, when the computer resumes work during sleep, and Windows considers that the user is present.

How does it really work

  • ResumeAutomatic is sometimes not sent at all. This is a long-standing error, presumably in Windows itself. Fortunately, I have never seen a computer working with ResumeAutomatic and ResumeSuspend. If you need to know that the system has resumed, but still whether the user is needed there or not, you need to listen to both ResumeAutomatic and ResumeSuspend and consider them as one and the same.
  • ResumeSuspend is extremely unreliable. I have never seen him go when he should have been, but he often leaves when he should not be - when in fact there is no user there. Whether this is due to one or more errors in Windows, third-party drivers, firmware or hardware, I have no idea.
  • When ResumeAutomatic is sent without the corresponding ResumeSuspend, the system idle timeout is short (the default in Windows 10 is 2 minutes by default), and the connected displays are stored in power saving mode. When the corresponding ResumeSuspend message is sent, the system idle timeout is normal (30 minutes by default in Windows 10) and the connected displays wake up. This is so that the computer enters sleep mode as soon as possible if it automatically wakes up to perform maintenance, etc. It would be great if Microsoft could make it work reliably.

I had the misfortune of having to go deep into the rabbit hole of Windows support for power management, profiles, etc. Vista-style material is disappointing because it is based on a quality and thoughtful design, but both the implementation and the documentation are not completely there and have never been fixed. I do not deal with many other problems. All this is a little embarrassing.

+7
source

All Articles