본문 바로가기

프로그래밍/미분류

[번역] 유저모드에서 최대절전모드 알아내기

반응형
http://www.eggheadcafe.com/conversation.aspx?messageid=34185691&threadid=34169575

 최대전절을 유저모드에서 알아채기
 Detect Hibernation from User Mode - jialg
16-Mar-09 05:12:32

Good morning David

예전에 유저모드에서 스탠바이와 최대절전을 어떻게 구분하느냐는 문제를 다뤄본 적이 있다. 제품 그룹은 디자인적으로 유저모드는 두가지 슬립상태를 구분할 수 없도록 되어 있다고 말했다. 그래서 우린 필요한 작업에 맞추어 이 이슈를 피해가도록 했다. 즉, 고객이 왜 최대절전모드를 훅해야 하느냐? 이벤트 말고 같은 결과를 가져다 줄 방법은 없겠느냐? [후략]

I once dealt with a similar case about how to distinguish standby vs hibernation in user-mode. The product group's comment on that case was that it is by-design that user-mode cannot tell the difference between the different sleep states. We therefore researched and managed to work around the issue based on the underlying business needs, i.e. why does the customer need to hook the hibernation event? Is there any methods to achieve the same result without the event? David, you mentioned that you need to perform an action that is required to occur to ensure proper startup from hibernation.  May I suggest that you provide with us more info of the action? I will perform the researches from this angle.

WM_POWERBROADCAST / PBT_APMSUSPEND 이벤트는 스탠바이와 최대절전 두가지에 들어갈 때 뿌려진다. 윈도우 비스타 이전 시스템에서 시스템이 서스펜드로 들어가기 전의 이벤트 시퀀스는

WM_POWERBROADCAST / PBT_APMQUERYSUSPEND
WM_POWERBROADCAST / PBT_APMSUSPEND

이다.

WM_POWERBROADCAST / PBT_APMSUSPEND events are sent for both Stand-by and Hibernation cases. Before Windows Vista, when the system is suspended (either Standby or Hibernate), the sequence of events is

WM_POWERBROADCAST / PBT_APMQUERYSUSPEND
WM_POWERBROADCAST / PBT_APMSUSPEND

시스템이 돌아올 때에는 :

WM_POWERBROADCAST / PBT_APMRESUMEAUTOMATIC

When the system is resumed:

WM_POWERBROADCAST / PBT_APMRESUMEAUTOMATIC

스탠바이와 최대절전의 이벤트 시퀀스는 동일하다. 그래서, 이벤트로는 두 슬립모드를 구분할 수 없다. 한가지 차이점이라면, "스탠바이" 상태일 때에는 PBT_APMRESUMESUSPEND 가 PBT_APMRESUMEAUTOMATIC 뒤따라 올 수도 있다는 것이다. PBT_APMRESUMESUSPEND 은 시스템 리줌이 사용자 입력때문에 일어났다는 걸 알려주는 이벤트이다.

The sequence of events for Standby and Hibernation is identical, thus, the events cannot distinguish the two sleep modes. One difference between the two cases is that, if it is "StandBy", you may get the event PBT_APMRESUMESUSPEND after PBT_APMRESUMEAUTOMATIC. PBT_APMRESUMESUSPEND indicates that the resume is triggered by user input, such as pressing a key.

PBT_APMSTANDBY 라는 이벤트가 있었지만, 모바일 PC에서만 된다.

There was an  event named PBT_APMSTANDBY that was sent for stand-by cases, but it only works for mobile PC. http://msdn.microsoft.com/en-us/library/ms704147.aspx

마이크가 말한 SYSTEM_POWER_STATE 는 실은 커널모드 데이터 구조체다.

The SYSTEM_POWER_STATE enumeration mentioned by Mike is actually a kernel mode data structure:
http://msdn.microsoft.com/en-us/library/bb264568.aspx
So it does not help in your user-mode code, either.

슬립, 스탠바이, 최대절전, 파워 상태변화, 로우 배터리, 긴급 중지, AC 파워, 배터리 파워, 배터리 라이프 등의 OS 이벤트에 대한 코드프로젝트 기사가 있다.

http://www.codeproject.com/KB/system/OSEvents.aspx

Here is a relevant codeproject article about the OS events like Sleep, Stand-by, Hibernate, Power Status Changed, Low Battery, Critial Suspend, AC Power, Battery Power, Battery Life.
http://www.codeproject.com/KB/system/OSEvents.aspx

Regards,
Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
728x90