Files in Use and Restart manager are two big features of Windows Installer 4. These features provide excellent support to MSI packagers when customizing an application which needs a restart for optimal functionality.
Files in Use:
Files-In-Use functionality is among the countless services that Windows Installer exposes for setup authors to leverage for their application install/maintenance. This functionality lets setup authors display the processes that hold on to files that would be updated by this install. The user would want to shut those processes before continuing with the install to ensure that the install wouldn't require a reboot.
The current Files-In-Use mechanism involves enumeration of the HKEY_PERFORMANCE_DATA key using registry API for information on processes and the PE images that they have held in-use. This works well in scenarios where the process holding the file in use has a visible window that the user can shut down.
These following properties can be used to achieve this feature in an MSI package:
This property is used to determine how applications and services that have locked files that need to be updated, will be handled after the update.
Setting this property to '0' will force all the services that were shut down during an update to be restarted and applications registered with the Restart Manager to be restarted after the update.
Setting this property to '1' will force all the processes (services & applications) that were shutdown during an update to not be restarted.
This property is used to determine how applications and services that are using files affected by an update should be handled during an update.
Setting this property to '0' will cause all the processes using files affected by the update to be shut down.
Setting this property to '1' will force all the processes using files affected by the update to be shutdown even if they don't respond to Restart Manager.
Setting this property to '2' will cause the processes using files affected by the update to be shutdown only if they are registered to be restarted by the Restart Manager. If any process is not registered for a restart, then it will not be shut down.
The Restart Manager APIs allow the Windows Installer to display processes such as: system services, tray applications or applications that have no visible window that require shutting down to avoid a reboot. Additionally, Restart Manager provides additional functionality above-and-beyond enhanced files in use detection, including:
- Shutting down of all or selected processes.
- Automatic restart of processes that were shutdown to install the in-use files.
- Ability to join a currently running Restart Manager session to consolidate shutdown/reboot across multiple installations.
- Applications that had been shut down have the opportunity to be restarted to a state that they were before being shut down.
These following properties can be used to achieve this feature in an MSI package.
This property enables setup authors to specify whether the package will use the Restart Manager or FileInUse Dialog to handle locked files at installation time.
The default value of this property is '0', which forces the setup to interact with Restart Manager in case a locked file is encountered by the msi package.
Setting this property to 'Disable' will force the msi package to use FileInUse Dialog instead.
This property can also be set to "DisableShutDown", which will mitigate Restart Manager's ability to restart the machine in case of a reboot being triggered by the windows installer package. Using this property however does not disable Restart Manager from identifying files locked by applications and displaying the Restart Manager dialog.
This value of this property is set to the Restart Manager session by the Microsoft installer.
Few blog posts on Windows Installer 4.0 and MSDN
Hope this piece of information is useful for all.