Hi!
I’m writing Win32 service which needs to know then
system goes to hibernate. Well, I receive
SERVICE_CONTROL_POWEREVENT control code with event ID
PBT_APMSUSPEND. But I don’t know how to retrieve the
type of this transition (e.g. from S0 to S3).
Thank you.
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
“Igor Slewsarev” wrote in message news:xxxxx@ntdev…
>
> SERVICE_CONTROL_POWEREVENT control code with event ID
> PBT_APMSUSPEND. But I don’t know how to retrieve the
> type of this transition (e.g. from S0 to S3).
>
In other words, you can’t tell if as a result of the suspect, you’re going
to standby or hibernate… is that what you’re asking?
Assuming is IS what you’re asking, I don’t believe there’s any way to
determine this… beyond some rather complicated heuristics that may or may
not work all the time.
The folks on this forum are mostly kernel-mode people (myself included), but
I would be interested in hearing if anybody knew the answer to this…
Peter
OSR
I’m not sure if you can tell at the service level from the calls (although
I’d think you should be able to, but I’ve never expolred that area).
However, it should be fairly easy to write a dummy WDM device and hook the
power calls and send the information upwards.
The driver will certainly know whether it is powering up or down, so you can
get the direction of an S0-S3 transition. Whether it is going to hibernate
or power off or suspend might not be totally clear, but I think at least a
couple of those are separate states (S4/S5) so you maqy be able to tell.
Hum, I have a vague memory that there is a HAL routine that gets called on
these transitions, and there might be a hook you can register to it.
Haven’t looked at that code in a couple of years and don’t have the source
handy at the moment.
Loren
You will get a windows message prior to hibernation and your app can tell
that this is going to happen. You will need a windows message queue.