4

In my wix project, I have a file "connect.exe" that will usually be running during uninstall or update. During uninstallation and major update Wix will prompt before closing with the usual "The following applications should be closed before continuing the install."

This dialogue will successfully shut down the program:

Action 17:19:59: ShutdownApplications. Shutting down applications
MSI (s) (5C:44) [17:20:02:880]: RESTART MANAGER: Successfully shut down all applications in the service's session that held files in use.
MSI (c) (A4:08) [17:20:02:880]: RESTART MANAGER: Successfully shut down all applications that held files in use.

But then right after, it'll throw an error saying that it could not shut down the application:

MSI (s) (5C:44) [17:20:33:300]: Note: 1: 1611 
MSI (s) (5C:44) [17:20:33:300]: Note: 1: 2205 2:  3: Error 
MSI (s) (5C:44) [17:20:33:300]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1611 
The setup was unable to automatically close all requested applications. Please ensure that the applications holding files in use are closed before continuing with the installation.

Even though the application is clearly shut down on the system. Also, it won't restart it when doing a major update after the installer is finished updating.

Everything else seems to work just fine.

Notably, the program connect.exe runs a window that is hidden most of the time. It's mainly used as an on screen display for service.exe which runs via Windows System Service.

How can I fix this to work? Am I not handling something on the connect.exe application end?

connect.exe component entry:

            <Component Id="ConnectExe" Guid="..." DiskId="1">
                <File Id="connect.exe" Name="connect.exe" Source="..\data\connect.exe" KeyPath="yes">
                    <Shortcut Advertise="yes" Description="Connect front end application." Directory="ApplicationProgramsFolder" Icon="connect.exe" Id="ConnectStartMenuShortcut" Name="Connect" IconIndex="0" WorkingDirectory="INSTALLDIR">
                        <Icon Id="connect.exe" SourceFile="..\data\connect.exe" />
                    </Shortcut>
                    <Shortcut Advertise="yes" Description="Connect front end application." Directory="StartupFolder" Icon="connect.exe" IconIndex="0" Id="ConnectStartupShortcut" Name="Connect" WorkingDirectory="INSTALLDIR"></Shortcut>
                </File>
                <RemoveFolder Id="ApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall" />
            </Component>
Mikey A. Leonetti
  • 2,834
  • 3
  • 22
  • 36
  • 1
    Does the application properly follow restart manager protocol? For restart manager to work, the application needs to handle certain messages and do this in a timely fashion. For instance, if it spends too much time handling `WM_QUERYENDSESSION` / `WM_ENDSESSION`, restart manager will consider it as not responding, which could lead to the error message you see. Also, if the application did not register itself for restart, restart manager won't restart the application. See [Guidelines for Applications](https://docs.microsoft.com/en-us/windows/desktop/RstMgr/guidelines-for-applications). – zett42 Aug 07 '18 at 15:03
  • I have the exact same problem with the exact same log entries, but in my case I’m updating a shell extension. So it’s not my program that fails to restart, it’s explorer.exe. Makes it unlikely that Restart Manager protocol is not followed. – Krishty Oct 11 '20 at 14:40
  • @Krishty - did you resolve how to get WiX to successfully install and uninstall shell extensions? I am really struggling and can't find any good examples on the web. It shuts down explorer.exe, but fails to restart it. – Tim Calladene Mar 02 '22 at 09:38
  • @TimCalladene No. The problem persisted even with manually-built MSIs (no WiX involved). My impression is that this is no bug in either WiX nor the MSIs, but MS screwed this up big time in the Installer service, in Restart Manager, or in Explorer. I resorted to making reboots mandatory for my shell extensions … bad for the user, but I’m out of ideas. – Krishty Mar 03 '22 at 10:10
  • @Krishty - I did some more experimenting and did get a resolution of sorts. See my own answer to this question I posted a few days ago: https://stackoverflow.com/questions/71158991/wix-how-to-restart-windows-explorer-to-install-uninstall-a-shell-extension – Tim Calladene Mar 03 '22 at 10:18
  • 1
    @TimCalladene Thanks, but this is not acceptable to me because I must be sure my shell extension is loaded properly. May be interesting for others, though, so upvoted. – Krishty Mar 03 '22 at 20:38

1 Answers1

3

Improved?: Different ways to create and interpret MSI logs.


Log File: What does the rest of the log file say? Any mention of other files that are locked? Some logging and log-file interpretation hints can be found here.

I wouldn't be surprised if you have found a bug in the restart manager. Though a relatively simple concept, it involves some seriously complicated stuff. Hidden windows are exactly a source of such complexity.

Quick Questions:


Some Links:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • 1
    This answer is pretty phenomenal. My application is built on Qt. But I am listening for both WM_QUERYENDSESSION and WM_ENDSESSION events. The application doesn't get *either* of them. The tray icon disappears, but my application does not stop running. Not sure what other messages are being sent to my application that would kill the system tray icon but the application doesn't quit. – Mikey A. Leonetti Aug 08 '18 at 00:53
  • I also think this is a Restart Manager bug. I have the same problem restarting `explorer.exe` to install a shell extension, and it fails with the exact same error messages. `explorer.exe` is obviously RM-compatible and the operation runs smoothly on Windows 7 (I just tested it). I’ve also tried `MSIDISABLERMRESTART=0 MSIRMSHUTDOWN=2 MSIRESTARTMANAGERCONTROL=0` according to [this answer](https://stackoverflow.com/a/8361988/3091755) with no luck. I assume the Windows 10 Restart Manager is simply broken under many circumstances. – Krishty Oct 11 '20 at 15:39