


Restart manager is introduced in Vista to minimize system restarts when installing patches. A grace way to terminate would be to send WM_QUIT, or use Vista’s new restart manager API. This is not want the user want – not only because changes in the previous explorer session are only saved during a clean shutdown, but the restarting also needs to be delayed to allow some time to change the task bar layout. Most of people kill the process by brutal force like taskkill or TerminateProcess, however this approach produces a pretty mess, and if HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoRestartShell is on, Windows would restart explorer.

Traditionally restarting explorer is a hackish process. For example, this posts is inspired by a programmer who want to toggle task bar layout automatically depending on the screen resolution, and is used to demonstrate the new Windows Vista restart manager API like RmStartSession, RmRegisterResources, RmGetList, RmShutdown, RmRestart and RmEndSession. A programmer may also want to force some shell setting changes that would only be read by Explorer on start up. For shell extension programmers, restart Windows Explorer is one of steps in their setup programs.
