views:

38

answers:

1

Hi

I have an installer done with WiX. When it's done installing, it starts an application that injects some code in the Explorer process.

Currently when I uninstall, the Restart Manager kicks in and offers to shut down my application and Explorer. Instead of that I want to close my application manually (this is done by running it again with -exit on the command line). I have a custom action that does it.

Here's what I tried so far:

<CustomAction ExeCommand="-exit" FileKey="MyApp.exe" Id="CloseMyApp" Impersonate="yes" Return="ignore" />

<InstallExecuteSequence>
    <RemoveExistingProducts After="InstallInitialize" />
    <Custom Action="CloseMyApp" Before="RemoveFiles" />
</InstallExecuteSequence>

This doesn't work. The action is done way after the Restart Manager session. So the Restart Manager pops up and asks to close my app and Explorer. The action runs later, but by then the app is already gone.

So then I tried this:

<InstallExecuteSequence>
    <RemoveExistingProducts After="InstallInitialize" />
    <Custom Action="CloseMyApp" Before="RemoveExistingProducts" />
</InstallExecuteSequence>

This also doesn't work. The action is done too late still. I also get "warning LGHT1076 : ICE63: Some action falls between InstallInitialize and RemoveExistingProducts.".

So basically - how do I execute my custom action during uninstall and before the Restart Manager session?

I'm guessing if I use Impersonate="no" it might run at the right time, however that's not an option. That's because the new process must run for the same user as the process that has to close because it looks up its window and sends messages. That's much trickier to do if the processes belong to different users.

Any ideas?

Thanks

Ivo

+1  A: 

You would need the CloseMyApp custom action to run before InstallValidate since that is when the restart manager is processed (doc). Alternatively, you could disable restart manager with MSIDISABLERMRESTART or MSIRESTARTMANAGERCONTROL Properties.

Rob Mensching