Windows Vista Restart Manager

Starting with Windows Vista, Microsoft provides the Restart Manager API to help software installers to update files that are in use during the installation. The Restart Manager implements functionality to:

  1. identify which active processes (including services) are using files that must be updated;
  2. perform an orderly shutdown of those processes;
  3. restart the same processes after the files in question have been updated.

InstallMate uses this functionality when available to reduce the chance of a system reboot due to in-use files.

Note: Because of the way InstallMate updates in-use files, it can typically replace files that are in use by another process even without the help of Restart Manager. This is achieved by renaming the existing file to a different temporary name (which usually succeeds even if the file is currently open in a different process), installing the new file under the desired name, then deleting the original, renamed file. This last step might fail if the original file is in use, but that is usually not a critical problem and is resolved by registering the file for a removal during the next, optional, system restart.

Interaction between InstallMate and Restart Manager

If the target system contains Restart Manager, then InstallMate will use it. The detailed interaction between InstallMate's Setup.exe program and Windows' Restart Manager takes place as follows.

During the StartProcessing standard action

  1. Setup.exe creates a list of all files that must be replaced during the session. This list does not include files that are up to date on the target system or that are protected by Windows File Protection (because those will never be replaced), and it also does not include files that are not yet present on the target system.
  2. This list of files is passed to Restart Manager.
  3. Restart Manager is asked to provide a list of processes that are using any of the files passed in the previous step. At the same time, Restart Manager also indicates if a reboot will be necessary because not all processes can be shut down. Setup.exe uses this reboot indicator to update the TsuRebootRequired status.
  4. Setup.exe requests Restart Manager to shut down any processes that it can.

Installation proper

At this point the installation proper starts. It performs all required actions without reference to Restart Manager.

During the EndProcessing standard action

When the EndProcessing action is reached:

  1. Setup.exe requests Restart Manager to restart any processes that were shut down.
  2. If necessary, a system restart is scheduled, but this is still subject to user approval.

There are additional safeguards that ensure that processes are restarted even if the installation process is terminated prematurely.

More information

The details of the Restart Manager can be found in the Microsoft Windows Platform SDK documentation. Please note that the shut down and restart of processes are subject to the Restart Manager and application implementation details beyond InstallMate's control. Some processes cannot be shut down automatically (for example, critical system services) and others cannot be restarted automatically (applications must register themselves through the RegisterApplicationRestart() Windows function to be eligible for automatic restart).