[wix-users] Elevated priviledges for custom actions

Rob Mensching rob at firegiant.com
Mon Apr 29 22:55:28 PDT 2019


"Immediate" is basically the opposite of "deferred".

Deferred run elevated (part of the installation transaction) unless impersonating. Immediate do not run elevated (unless Windows Installer was launched elevated then everything obviously is elevated).

At this point, I think best documentation is still in MSDN: https://docs.microsoft.com/en-us/windows/desktop/Msi/deferred-execution-custom-actions

Custom actions are hard and introduce error. Avoid them if at all possible. If you cannot, accept some amount the failure and prepare for more work and deeper understanding of MSI: http://robmensching.com/blog/posts/2007/8/17/zataoca-custom-actions-are-generally-an-admission-of-failure/

_____________________________________________________________
Short replies here. Complete answers over there: http://www.firegiant.com/

From: Todd Hoatson <todd.hoatson at gmail.com>
Sent: Monday, April 29, 2019 5:50 PM
To: Rob Mensching <rob at firegiant.com>
Cc: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] Elevated priviledges for custom actions

Thanks for the quick response, Rob...

> Deferred custom actions are elevated (unless impersonating).

In the installer code I'm looking at, the custom action is in the InstallExecuteSequence, After="AppSearch".  And the custom action is defined with Execute="immediate".  So it would seem something's amiss here.  Being in the Execute sequence, it should be deferred, and therefore elevated.  But it is set to execute after AppSearch, which is in the UI sequence!  But I don't get any error message(s) about this.  The fact that it is set for immediate execution makes me think it was originally written to be part of the UI sequence, but then the custom action was moved to the Execute sequence without this action being thought through very carefully.

This custom action is primarily for setting properties to indicate which fonts need to be installed.  But it contains a call to delete the font file from the system if it's an older version than the one provided with the installer, and I assume this is the reason it is in the Execute sequence.

Since I'm still relatively new to WiX, I want to double-check my understanding...

It seems that I have 2 options in order to make things more consistent:
1)  change the custom action to fire After="InstallValidate", but still Execute="immediate".
2)  change the custom action to fire After="InstallInitialize", but with Execute="deferred".

I'm not sure how to evaluate which approach is more appropriate (i.e. playing by the rules of Windows installer).  Any input on this?

thanks,
Todd

On Mon, Apr 29, 2019 at 12:53 PM Rob Mensching <rob at firegiant.com<mailto:rob at firegiant.com>> wrote:
Deferred custom actions are elevated (unless impersonating).
_____________________________________________________________
 Short replies here. Complete answers over there: http://www.firegiant.com/

-----Original Message-----
From: wix-users <wix-users-bounces at lists.wixtoolset.org<mailto:wix-users-bounces at lists.wixtoolset.org>> On Behalf Of Todd Hoatson via wix-users
Sent: Monday, April 29, 2019 9:39 AM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>>
Cc: Todd Hoatson <todd.hoatson at gmail.com<mailto:todd.hoatson at gmail.com>>
Subject: [wix-users] Elevated priviledges for custom actions

Hi, while pursuing a font installation issue on another forum, I received the following comment from another poster:  "Even if your installer is running with elevated privilege It is possible that your custom action is not running elevated."

Can someone comment about how this works with WiX?  Is there a default for custom actions?  Is there a way to set the priviledge to elevated for a custom action?

thanks,
Todd Hoatson


--
Todd Hoatson
Mobile: 763-291-3312
Email:   todd.hoatson at gmail.com<mailto:todd.hoatson at gmail.com>
www.linkedin.com/in/<http://www.linkedin.com/in/>toddhoatson


More information about the wix-users mailing list