Hibernation after delay when no timeout set.

J

Josh Einstein

You know who might be able to provide a good explanation as to the behavior
of Windows power profile selection? Raymond Chen.

http://blogs.msdn.com/oldnewthing/

Using the power profiles of the default user would make sense if the machine
has returned to the logon screen after resume, since at that screen, there
is no interactively logged on user (in the Windows architecture). This is
also why some people notice that their pen calibration settings are ignored
at the logon screen.

I think the key is prompting for a password on resume, like you mentioned. I
don't do that so I wouldn't have noticed it but I'll try. I'll reconfigure
my balanced profile to hibernate after 60 minutes so when it resumes, I'll
use it for a little bit, then leave it alone and see how long it takes to
hibernate. It should be reproducible in a virtual machine as well.

Did you use regmon or process monitor to determine the keys it was using?

--
Josh Einstein (Tablet PC MVP)
Einstein Technologies
Tablet Enhancements for Outlook - Try it free: www.tabletoutlook.com


Invalid said:
Josh said:
So now maybe we can try to find a real explanation for this instead of
just bitching back and forth.

I have been experimenting and I think I know what is happening and
possibly how it can be worked around. This is on an XP tablet. Someone
else needs to check Vista.

Symptoms
I have a user defined power policy I use for reading PDF's saved (using
Save As) in my power settings. It is set to stop the disks after 2 minutes
blank the screen after 5 Minutes, standby in 15 and hibernate after 30
Minutes.

After a cold boot it does exactly that. After recovering from hibernation
it goes straight back into hibernation after 5 minutes if I don't use it
at all, or 5 minutes after I have stopped using it with no prior screen
blanking or standby period.

The 5 minute hibernate is the timer described in
http://support.microsoft.com/kb/318355/en-us.

The drop straight into hibernate after some real use+5 minutes idle is the
problem, as this is not the desired behaviour set in the power policy.

Analysis
XP on recovery from hibernation is picking up the wrong power policy.
Saved user defined policies are assigned a number in sequence following on
from the default (0-5). The number of the policy in use is stored in
[HKEY_CURRENT_USER\Control Panel\PowerCfg] "CurrentPowerPolicy"="n" where
n is the number of the policy in use.

On recovery from Hibernation XP picks up the correct value of "n", but
uses it to apply the "n" power policy from the default user
[HKEY_USERS\.DEFAULT\Control Panel\PowerCfg]

Not the "n" policy from the current user
[HKEY_CURRENT_USER\Control Panel\PowerCfg]

This is not a real problem if the user is using one of the six standard
policies - it just seems to go back to the defaults which I suspect most
people leave alone anyway. The problem arises when the user has saved a
particular power policy, so n does not exist in the Default User list -
then the default five minute hibernate timer seems to kick back in.

[I have my machine set up to request a password on recovery from
hibernate - that MAY be the reason it goes to the default user. I think it
is also a problem in W2K. On W2k I seem to remember recovery from
Hibernation picking up the default user desktop colour scheme rather than
the current users until you entered the password].

Fix
The workaround is to ensure that the user's saved policy is defined in the
Default user power config list with the same number "n".

I achieved this by exporting the user saved policy (in my case numbered
6) to a .reg file, editing the .reg file to change occurrences of

HKEY_CURRENT_USER to HKEY_USERS\.DEFAULT

and importing that file back into the registry so that my policy appears
in the default user power configuration list with the correct value of
"n".

On my tablet that fixes the problem, after recovery from hibernation it
now behaves (as far as I can tell from a couple of tries) in line with the
power configuration scheme.

I hope this helps someone. There IS a bug there somewhere.

PS for Gary
One way to fix the mess in your registry is to export the whole
[HKEY_USERS\.DEFAULT\Control Panel\PowerCfg] key set.
This contains all the standard defaults.
Edit it the other way i.e. change all occurrences of

HKEY_USERS\.DEFAULT to HKEY_CURRENT_USER

Then re-import, that should get you back to a clean power config set.
Reboot. Create your own. Export it, edit it and re-import it into the
default user as above. Let us know how you get on.

A good idea might then be to dump the whole current user set as a backup.

Thank you for asking the question, you have caused me to fix something
that has been frustrating me for at least a year, but I couldn't figure
out what was happening!!!

Regards
 
I

Invalid

Josh said:
You know who might be able to provide a good explanation as to the
behavior of Windows power profile selection? Raymond Chen.

http://blogs.msdn.com/oldnewthing/

Using the power profiles of the default user would make sense if the
machine has returned to the logon screen after resume, since at that
screen, there is no interactively logged on user (in the Windows
architecture). This is also why some people notice that their pen
calibration settings are ignored at the logon screen.

I think the key is prompting for a password on resume, like you
mentioned. I don't do that so I wouldn't have noticed it but I'll try.
I'll reconfigure my balanced profile to hibernate after 60 minutes so
when it resumes, I'll use it for a little bit, then leave it alone and
see how long it takes to hibernate. It should be reproducible in a
virtual machine as well.

Did you use regmon or process monitor to determine the keys it was using?
Neither, I hypothesised the problem from my memory of the issues with
W2K desktop colours, applied a little logic about how it might work/fail
and experimented.

I can't see how to use either tool until the recovery from hibernation
is done, by which time the damage is done. It picks up all the proper
keys for the UI if you open the Control Panel Applet - at least that's
what shows in the applet.

The issue seems to be the values that Windows must store in memory
(somewhere) to set/reset the power system timers. It will pick them up
from the registry during the boot/resume/logon cycle and probably only
update them if the scheme is changed.

My suspicion would be that the logon after hibernation mechanism does
not call the process needed transfer the Current User values from the
registry to wherever the power control system keeps them.

If I get round to it I might contact Raymond, but I have spent far too
much time on this thing today :)

Look forward to seeing what your experiments show.
 
I

Invalid

Invalid said:
I have been experimenting and I think I know what is happening and
possibly how it can be worked around. This is on an XP tablet. Someone
else needs to check Vista.
Problem has not gone away.

The fix only works intermittently.

It is definitely the power profile issue, changing the profile to a
different one, and back again after recovery from hibernation ALWAYS
fixes the problem. Sometimes it does it itself, sometimes not. I suspect
it's dependent on the kind of activity.

Sorry!!
 
J

Josh Einstein

Does copying your power settings from the interactive user's profile to the
corresponding HKU\.DEFAULT fix the issue?

If that's the case, then one approach would be to have a utility that copies
the user's power settings to the default (no one logged on) user whenever
the power profile changes. Another approach would be to, in response to a
system event after user switching, re-set the last selected power profile.

Sorry I didn't get a chance to test on Vista yet. I'm behind on two
development projects. :S
 
J

Josh Einstein

Just a quick update. I did get around to trying this out on Vista and could
not reproduce the issue.

I changed my power saver profile to standby after 30 minutes, hibernate
after 60, and prompt for password on resume. I waited the 30 minutes and it
went into standby. Waited another 30 then it went into hibernation. Then a
few hours later I turned it back on, got to the logon screen *and logged in*
and then left the pc alone and it took 30 minutes to go back to sleep.

I should also mention that I made a point of only using the pen, no keyboard
or mouse.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top