The built-in LockPermissions table (the Permission element in WiX) is 
weak. Some might even call it lame. It checks for the user account in 
the immediate mode. Of course, the user is created deferred so it 
doesn't exist yet. Use Util:PermissionEx and that will work.

Rob MacFadyen wrote:
> Hey all,
>
>
>
> I'm very confused. I want to create a local user and set registry
> permissions for that user. Simple enough right?
>
>
>
> Here's a WIX project to illustrate (references wixutilextension):
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";
>
>      xmlns:util="http://schemas.microsoft.com/wix/UtilExtension";
>
>   
>
>   <Product Id="2b30244b-572f-4341-8c0d-5e18b3a243f3" Name="WixProject8"
> Language="1033" Version="1.0.0.0" Manufacturer="WixProject8"
> UpgradeCode="b969e67f-71fb-4bce-8081-b6e745f69826">
>
>     <Package InstallerVersion="200" Compressed="yes" />
>
>
>
>     <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
>
>
>
>     <Directory Id="TARGETDIR" Name="SourceDir">
>
>       <Directory Id="ProgramFilesFolder">
>
>         <Directory Id="INSTALLLOCATION" Name="WixProject8">
>
>
>
>           <Component Id="RegistryValues"
> Guid="{F6043CAA-C53E-4DB0-9586-A5A16C9B1B04}">
>
>
>
>             <util:User Id="User1" Name="ATestUserId" Domain="[ComputerName]"
> Password="abc$%#DEF123" CreateUser="yes" UpdateIfExists="yes" />
>
>
>
>             <RegistryKey Root="HKLM" Key="SOFTWARE\My Company
> Inc\ApplicationName" Action="createAndRemoveOnUninstall">
>
>               <Permission User="Authenticated Users" GenericRead="yes"
> Read="yes" GenericExecute="yes" />
>
>               <Permission User="Administrators" GenericAll="yes" />
>
>               <Permission User="ATestUserId" Domain="[ComputerName]"
> GenericAll="yes" />
>
>               <RegistryValue Name="StringValue1" Value="10" Type="string" />
>
>             </RegistryKey>
>
>           </Component>
>
>
>
>         </Directory>
>
>       </Directory>
>
>     </Directory>
>
>
>
>     <Feature Id="ProductFeature" Title="WixProject8" Level="1">
>
>       <ComponentRef Id="RegistryValues" />
>
>     </Feature>
>
>
>
>   </Product>
>
> </Wix>
>
>
>
> Pretty simple. create a user "ATestUserId" and make sure it has full control
> of the HKLM\SOFTWARE\My CompanyInc\ApplicationName registry key.
>
>
>
> Unfortunately when this runs I get an error "An error occurred while
> applying security settings. MyComputerName\ATestUserId is not a valid user
> or group. This could be a problem with the package, or a problem connecting
> to a domain controller on the network. Check your network connection and
> click Retry, or Cancel to end the installation."
>
>
>
> Here's a bit from a debug log:
>
>
>
> === Logging started: 6/10/2009  1:58:50 ===
>
> Action 1:58:50: INSTALL.
>
> Action start 1:58:50: INSTALL.
>
> Action 1:58:50: ValidateProductID.
>
> Action start 1:58:50: ValidateProductID.
>
> Action ended 1:58:50: ValidateProductID. Return value 1.
>
> Action 1:58:50: CostInitialize. Computing space requirements
>
> Action start 1:58:50: CostInitialize.
>
> Action ended 1:58:50: CostInitialize. Return value 1.
>
> Action 1:58:50: FileCost. Computing space requirements
>
> Action start 1:58:50: FileCost.
>
> Action ended 1:58:50: FileCost. Return value 1.
>
> Action 1:58:50: CostFinalize. Computing space requirements
>
> Action start 1:58:50: CostFinalize.
>
> Action ended 1:58:50: CostFinalize. Return value 1.
>
> Action 1:58:50: ExecuteAction.
>
> Action start 1:58:50: ExecuteAction.
>
> Action start 1:58:50: INSTALL.
>
> Action start 1:58:50: ValidateProductID.
>
> Action ended 1:58:50: ValidateProductID. Return value 1.
>
> Action start 1:58:50: CostInitialize.
>
> Action ended 1:58:50: CostInitialize. Return value 1.
>
> Action start 1:58:50: FileCost.
>
> Action ended 1:58:50: FileCost. Return value 1.
>
> Action start 1:58:50: CostFinalize.
>
> Action ended 1:58:50: CostFinalize. Return value 1.
>
> Action start 1:58:50: InstallValidate.
>
> Action ended 1:58:50: InstallValidate. Return value 1.
>
> Action start 1:58:50: InstallInitialize.
>
> Action ended 1:58:50: InstallInitialize. Return value 1.
>
> Action start 1:58:50: ProcessComponents.
>
> Action ended 1:58:50: ProcessComponents. Return value 1.
>
> Action start 1:58:50: UnpublishFeatures.
>
> Action ended 1:58:50: UnpublishFeatures. Return value 1.
>
> Action start 1:58:50: RemoveRegistryValues.
>
> Action ended 1:58:50: RemoveRegistryValues. Return value 1.
>
> Action start 1:58:50: ConfigureUsers.
>
> Action start 1:58:53: CreateUserRollback.
>
> Action ended 1:58:53: CreateUserRollback. Return value 1.
>
> Action start 1:58:53: CreateUser.
>
> Action ended 1:58:53: CreateUser. Return value 1.
>
> Action ended 1:58:53: ConfigureUsers. Return value 1.
>
> Action start 1:58:53: InstallFiles.
>
> Action ended 1:58:53: InstallFiles. Return value 1.
>
> Action start 1:58:53: WriteRegistryValues.
>
> Error 1609. An error occurred while applying security settings.
> WIN2000SERVER1\ATestUserId is not a valid user or group. This could be a
> problem with the package, or a problem connecting to a domain controller on
> the network. Check your network connection and click Retry, or Cancel to end
> the install. Unable to locate the user's SID, system error 1332
>
> MSI (s) (44:0C) [01:58:54:487]:
>
> Action ended 1:58:54: WriteRegistryValues. Return value 2.
>
> Action ended 1:58:54: INSTALL. Return value 2.
>
>
>
>
>
> What confuses me is that I can see CreateUser occurring at 1:58:53 and
> WriteRegistryValues a bit latter. When the error occurs if I bring up the
> list of local user/groups the new user definitely has not been created.
>
>
>
> So. any ideas where I'm going wrong?
>
>
>
> Thanks,
>
>
>
> Rob
>
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>   

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to