Holding off Windows 2000/3 Server in Shutdown

Posted by user1668993 on Server Fault See other posts from Server Fault or by user1668993
Published on 2012-11-08T18:46:34Z Indexed on 2012/11/09 11:06 UTC
Read the original article Hit count: 224

Filed under:
|

We have a C# VS2010 application running on a Windows 2000 Server box (there is also a Windows 2003 Server box) as pretty much the only application running.

We remove power from the box. There is a short duration battery (maybe 3 minutes of power) which then waits 10 seconds and then decides things are coming down and notifies Windows that it needs to shut down.

Windows sends a CTRL_SHUTDOWN_EVENT event to the application which fields it and tries to keep Windows from going down for a while to let another computer which communicates with this one time to do some file work on the first computer. It does this by a timing loop and after the loop is over, it exits gracefully and the computer shuts down.

Nice plan but it doesn't work. The application gets to maybe 20 seconds and the application is forcibly killed by Windows and Windows shuts down. At 90 seconds, the hardware firmware running the battery turns off power to the computer.

I have tried searching to find out how to hold off Windows for a bit of time. I tried creating (it wasn't there) the HKEY_LOCAL_MACHINE subtree: \SYSTEM\CurrentControlSet\Control\WaitToKillAppTimeout registry key to 60000 but though it seemed to keep the popup from happening, Windows itself died at about the same amount of time -- we think without having the opportunity to shut itself down gracefully. Maybe the registry key worked but wasn't enough.

Basically I have an "ill-mannered" application which is refusing to shut down (for the best of reasons) and without the registry key thing, Windows eventually shuts it down anyway and then shuts itself down.

With the registry change, we think what is happening is that Windows doesn't shut down the application but Windows itself is killed suddenly without shutting down but power is still not pulled for about another minute, and then power is pulled.

So maybe we have layers here. First there is how long the application tries to stay open. Then there is how long Windows is prepared to allow it to stay open. Then there is ... something... which kills windows. Then there is the power loss.

Anyone have any ideas how we can get windows to stay open and in operation say to 70 seconds instead of about 20? Is our registry key right, but not enough? Is there some additional key we need to set to determine how long after windows is notified of a shutdown before it just kills itself?

Thanks in advance.

© Server Fault or respective owner

Related posts about Windows

Related posts about registry