[wix-users] Elevated priviledges for custom actions
Blair Murri
osito at live.com
Mon Apr 29 18:25:19 PDT 2019
In the execute sequence, immediate actions are able to "write" into the execute and rollback "scripts", which are then run by certain actions. A deferred action in the sequence in effect writes itself into the script.
So, you set properties the deferred action can access before the deferred action in the sequence. Then you can set other properties before the next deferred action, if needed. The properties corresponding to the deferred actions get the values of those properties at the moment of their own place in the script.
Note that is why deferred actions can't set most properties, they run as a side effect of running the sequence, not as a part of it.
Somewhere the web used to contain a great sawtooth diagram illustrating all of this. My students generally found that sawtooth description helpful. My Google-fu has been letting me down lately, and I'm concerned it may have been on one of the old msdn blogs that no longer exist.
So, if you are doing both installation and removal, I'd recommend looking at "semi-custom actions" by one Bob Arnson to see if you can take advantage of that. If not, you need to place your executive-decision-level code in immediate CA(s), and linemen-level field activity code in deferred CA(s), and keep track of considerations of failure modes, repairs, upgrades, removals, etc. in implementing your solutions.
Get Outlook for Android<https://aka.ms/ghei36>
________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Todd Hoatson via wix-users <wix-users at lists.wixtoolset.org>
Sent: Monday, April 29, 2019 5:50:16 PM
To: Rob Mensching
Cc: Todd Hoatson; WiX Toolset Users Mailing List
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> 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> 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>
> Cc: Todd Hoatson <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
www.linkedin.com/in/toddhoatson<http://www.linkedin.com/in/toddhoatson>
____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
More information about the wix-users
mailing list