I want a C# function that will change the number of minutes in Windows' "hibernate after".
In Windows 7 this is under "Control Panel"-"Hardware & Sound"-"Power Options"-"Change Plan Settings (Balance/Energy Star)"-"Change Advanced power settings"-"Sleep"-"Hibernate After"
In Windows XP under "Control Panel"- "Performance & Maintenance" - "Power options" - "System hibernates"
This function has to excecute **immediately before a windows logoff** and must work for all users (even those under minimum priveleges).
The number of minutes to hibernate for can be hardcoded into the function.
It should also store the number of minutes that was originally in the "hibernate after" setting (the original number of minutes-before any change was made) because I want the code to detect when a user **logs back on** and then changes the "hibernate after" minutes back to what it was before.
The purpose of this project is to make a users pc hibernate at a certain time but this time can change throughout the day. This time is stored in an xml file that is on the users pc and is updated by a web service.