[wix-users] Custom Action Process Isolation

Marc Reyhner marcre at exchange.microsoft.com
Thu Apr 28 09:25:51 PDT 2016


I was hoping to do the minimal change to this legacy code as possible.  I know custom actions are launched in a separate worker process from the main installer.  If there are some nobs to control the worker lifetime, that will save me a bunch of time for refactoring this old code.

The DLL is dynamically loaded so it's definitely possible to unload it.  This code is shared outside of setup, I'm a bit worried about regressions if I change it too much.  My experience has been that code that never expected to get unloaded frequently has issues when you change that pattern.

Thanks,
-Marc

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Walter Dexter
Sent: Thursday, April 28, 2016 9:04 AM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] Custom Action Process Isolation

Far from a WiX expert, but could you have your CA DLL spawn an EXE that loads the DLL in the product install directory?

Then when that EXE exits the DLL would be released.

Or could you explicitly load and unload the product DLL via the Windows API? I would expect that to release it.

It's the nature of DLLs that they run in their same space as the process - they're not separate processes, they're just libraries that are dynamically linked at run time, hence the name.

On Wed, Apr 27, 2016 at 3:13 PM, Marc Reyhner <marcre at exchange.microsoft.com
> wrote:

> Hi, is there any way to isolate the process used to run a custom 
> action such that when the action is done the process terminates?  My 
> problem is a custom action used for uninstall that loads a dll in the 
> product install directory internally.  This leads to the user getting 
> a prompt to reboot the system on either uninstall or upgrade.  The dll 
> is getting leaked by the code, and so isn't cleaned up until the custom action process exits.
> This is some legacy code so refactoring it to unload the dll as custom 
> action completion would be a risky change.  Ideally, I'd like to find 
> an option to make windows installer recycle the custom action worker 
> process before it moves to removing files.
>
> In case it helps this is the current definition of the custom action:
>
>     <CustomAction Id="_PrepareForRemove" BinaryKey="CAApm"
> DllEntry="PrepareForRemove" Execute="deferred" Impersonate="no" />
>
>     <InstallExecuteSequence>
>
>       <Custom Action="_PrepareForRemove"
> After="InstallInitialize"><![CDATA[$C_InterceptSvc=2]]></Custom>
>
> Thanks,
> Marc
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant 
> http://www.firegiant.com/
>

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/



More information about the wix-users mailing list