Using Windows Installer with Restart Manager
Applications that use Windows Installer 4.0 for installation and servicing on Windows Vista automatically use the Restart Manager to reduce system restarts. The default behavior on Windows Vista is to shut down applications rather than shut down and restart the operating system whenever possible. In cases where a system restart is unavoidable, installers can use the Restart Manager API to schedule restarts in such a way that it minimizes the disruption of the user's work flow.
Windows Installer developers can perform the following actions to prepare their package to work with the Restart Manager.
- Add the MsiRMFilesInUse dialog box to your package. If the MsiRMFilesInUse dialog box is present in the package, the Windows Vista user running an installation at the Full UI user interface level is given the option to automatically close and restart applications. An installation package can contain information for both the MsiRMFilesInUse dialog box and the FilesInUse dialog box . The MsiRMFilesInUse dialog box is only displayed if the package is installed with at least Windows Installer 4.0 on Windows Vista, and is otherwise ignored. Existing packages that do not have the MsiRMFilesInUse dialog box continue to function using the FilesInUse dialog box. A customization transform can be used to add an MsiRMFilesInUse dialog box to existing packages.
End-users typically run installations at the Full UI user interface level. Basic UI or Reduced UI level installations give the user the option of using the Restart Manager to reduce system restarts even if the MsiRMFilesInUse dialog box is not present. Silent UI level installations always shut down applications and services, and on Windows Vista, always use Restart Manager.
- Register applications for a restart using the RegisterApplicationRestart function. Restart Manager can only restart applications that have been registered for restart. Restart Manager restarts registered applications after the installation. If the installation requires a system restart, Restart Manager restarts the registered application after the system restart.
- Specify INSTALLLOGMODE_RMFILESINUSE when enabling an external user-interface handler with the MsiSetExternalUI and MsiSetExternalUIRecord functions. Windows Installer will send a INSTALLMESSAGE_RMFILESINUSE message for external user-interface handlers that support the Restart Manager. If no registered or internal user-interface handles the INSTALLMESSAGE_RMFILESINUSE message, the installer sends a INSTALLMESSAGE_FILESINUSE message for user-interface handlers that support the FilesInUse dialog box. For more information, see Using Restart Manager with an External UI.
- Custom actions can add resources belonging to a Restart Manager session. The custom action should be sequenced before the InstallValidate action. Custom actions can use the MsiRestartManagerSessionKey property to obtain the session key, and should call the RmJoinSession and RmEndSession functions of the Restart Manager API. Custom actions cannot remove resources belonging to a Restart Manager session. Custom actions should not attempt to shutdown or restart applications using the RmShutdown, RmGetList and RmRestart functions.
- Package authors can base a condition in the LaunchCondition table on the MsiSystemRebootPending property to prevent the installation of their package when a system restart is pending.
- Package authors and administrators can control the interaction of the Windows Installer and Restart Manager by using the MSIRESTARTMANAGERCONTROL, MSIDISABLERMRESTART, MSIRMSHUTDOWN properties and the DisableAutomaticApplicationShutdown policy.
- Applications and services should follow the guidelines described in the Using Restart Manager section of the Restart Manager documentation.