I created an installer based on the WixUI_Advanced Dialog Set, and I am
running into the following problem.

On XP SP3, when installing to a limited user account (i.e. not admin, not
Privileged), just selecting the defaults, the installation starts and then
fails, saying you lack admin privileges.  I have configured to support both
admin and limited account installs:
        <WixVariable Id="WixUISupportPerUser" Value="1" Overridable="yes" />
        <WixVariable Id="WixUISupportPerMachine" Value="1" Overridable="yes"
/>

When you get to the InstallScopeDlg, you do not see the choices of
installation (all users vs. current user), but get the message:
        <String Id="InstallScopeDlgPerUserDescription" Overridable="yes">
(from WixUI_en-us.wxl)
        [ProductName] will be installed in a per-user folder and be
available just for your user account. You do not need local Administrator
privileges.</String>

Which is fine.  So I expect that it should install to the user-defined
location.  Instead, based on the log files, ALLUSERS gets set to 1 and it
attempts to perform an all users install anyways, which is causing the
failure.

I have tested this with an admin account, selecting current user install and
all does work fine then.

I did dig into this, and found that the issue is with the default setting
for the radio buttons in InstallScopeDlg.  These are defined as follows:
        <Control Id="BothScopes" Type="RadioButtonGroup" X="20" Y="55"
Width="330" Height="120" Property="WixAppFolder" Hidden="yes">
                <RadioButtonGroup Property="WixAppFolder">
                        <RadioButton Value="WixPerUserFolder" X="0" Y="0"
Width="295" Height="16" Text="!(loc.InstallScopeDlgPerUser)" />
                        <RadioButton Value="WixPerMachineFolder" X="0"
Y="60" Width="295" Height="16" Text="!(loc.InstallScopeDlgPerMachine)" />
                </RadioButtonGroup>
                <Condition Action="show">Privileged AND
(!(wix.WixUISupportPerUser) AND !(wix.WixUISupportPerMachine))</Condition>
        </Control>

For some reason when the .MSI is compiled, the default value for
WixAppFolder is set to "WixPerMachineFolder".  This is fine when the radio
buttons are displayed, as the user can change them.  When they are not
displayed (as in the case I describe above), because the setting for
WixAppFolder is still set to WixPerMachineFolder" when the Next button is
processed it sets ALLUSERS to 1 and then attempts to install for all users.

I did come up with a fix in my code as follows (in my version of
WixUI_Advanced.wxs):

        ...
        <CustomAction Id="WixSetInstallThisUser" Property="WixAppFolder"
Value="WixPerUserFolder" Execute="immediate" />
        <CustomAction Id="WixSetInstallAllUsers" Property="WixAppFolder"
Value="WixPerMachineFolder" Execute="immediate" />
        ...

        <InstallExecuteSequence>
                ...
                <Custom Action="WixSetInstallThisUser"
After="WixSetPerMachineFolder">NOT Privileged</Custom>
                <Custom Action="WixSetInstallAllUsers"
After="WixSetInstallThisUser">Privileged</Custom>
        </InstallExecuteSequence>
        <InstallUISequence>
                ...
                <Custom Action="WixSetInstallThisUser"
After="WixSetPerMachineFolder">NOT Privileged</Custom>
                <Custom Action="WixSetInstallAllUsers"
After="WixSetInstallThisUser">Privileged</Custom>
        </InstallUISequence>

So first off, is this a known issue?  Is there a better way of dealing with
this problem than I am aware of?  Has a patch already been released?
Second, does this fix look correct?  I am still learning all the nuances of
Wix and MSI coding, and would be happy to hear any suggestions on doing this
better.

Thanks,

Andreas Mertens


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to