Share via


Windows Shutdown and Restart 

A high quality application must be able to handle a restart of the operating system in two ways. The first is if the application must initiate the restart and the second is if the application is running when a restart occurs.

Restart Manager

The Restart Manager API can eliminate or reduce the number of system restarts that are required to complete an installation or update. The Restart Manager enables all but the critical system services to be shut down and restarted and guarantees that blocking DLLs and resources are unloaded. For more information, see the following documentation.

Programming Model Documentation Links

Unmanaged

Restart Manager

New Shutdown Procedures

Windows Vista contains a revised set of procedures, including new APIs, for how the operating system notifies applications when the user logs off or the operating system is shutting down or restarting. In Windows XP, the operating system would send the WM_QUERYENDSESSION message to the application to inform the application that the operating system is shutting down. In Windows Vista, in addition to the WM_QUERYENDSESSION message, an application can use a new set of APIs to register a text string that the operating system can display to the user that explains why the application cannot be shutdown. It is also no longer guaranteed that a shutdown will be cancelled if an application returns FALSE from the WM_QUERYENDSESSION message. For more information, see the following documentation.

Programming Model Documentation Links

Unmanaged

Power Management in Windows XP

ShutdownBlockReasonCreate

ShutdownBlockReasonQuery

ShutdownBlockReasonDestroy

There are also other individual APIs that are used to either restart the operating system or to get notified when the operating system restarts. For more information, see the following documentation.

Programming Model Documentation Links

Unmanaged

InitiateShutdown

InitiateSystemShutdown

InitiateSystemShutdownEx

Unmanaged

WM_QUERYENDSESSION

See Also

Concepts

Application Quality