Search code examples
wixwindows-installerwix3.8silent-installerrestartmanager

Restart Manager behavior with Windows installer


With Windows installer 4.0 and Restart Manager, would it be safe to assume that "Restart Manager" would take care of shutting down applications and hence there is no need for any sort of custom actions to handle shutdown of processes holding files, meant to be updated?

Are there any exceptions where "Restart Manager" might not shut down applications? Of course, I understand that when a policy such as DisableAutomaticApplicationShutdown is enforced, Restart Manager is disabled.

Does the process to be shutdown have to satisfy some criteria to be able to be shutdown by Restart Manager? I am running my msi packages silently.

What do I infer if a msi package requests for a reboot, even if "Restart Manager" is enabled?


Solution

  • Restart Manager is primarily a better detection scheme (than previously) for detecting the files that are in use during an installation operation. For example, the old scheme detected only running apps with a top level Window (excluding tray apps). The only apps that get automatically closed down and restarted are those that have signed up to do that. Basically that means your app calls RegisterApplicationRestart() telling it what command line you wish to be restarted with. The app watches for WM_QUERYENDSESSION messages that tell it that it's about to be shutdown, and it writes recovery info for its subsequent restart.

    Example here:

    http://www.advancedinstaller.com/user-guide/qa-vista-restart-manager.html

    So some of your questions don't apply, but obviously the point is to prevent reboots, whether it's a silent install or not. If a silent install needs a reboot it will just do it, because silent really means silent, there's nobody to ask, and the install isn't complete until after the reboot.

    When apps don't do this work people usually resort to things like WiX Util CloseApplication calls to shut them down.

    Note that services that are marked as Stop at Install (or uninstall, as the case may be) do not result in files-in-use situations. The file-in-use detection mechanism ignores files that are in use by services that are marked to be stopped in the ServiceControl table. So services are generally fine, but if the service spawns off other processes then they can result in files-in-use situations.