Setting directory security

Jun 25, 2015 at 2:51 PM
I am trying to create an MSI for an Outlook add-in, which requires that the MSI creates a directory under "C:\Program Files (x86)" and grants full permissions to all users to this directory.
So far I have tried:
        Dir rootDir = new Dir(targetPath, installedfiles);
        DirPermission permissionsToAll = new DirPermission("Everyone", GenericPermission.Execute | GenericPermission.Read | GenericPermission.Write);
        DirPermission[] allPermissions = new DirPermission[] { permissionsToAll };
        rootDir.Permissions = allPermissions;
...which results in the wxs:
    <Component Id="Component.1" Guid="8208b126-5129-4018-8106-83ddc6c27eee">
        <util:PermissionEx User="Everyone" GenericAll="yes" />
When I run the MSI (I am an Administrator on this machine), I get a system error (-2147024891) on the directory ""Failed to set security descriptor on object".
Any idea?
Jun 26, 2015 at 8:10 AM
The Permissions sample produces the same output and it doesn't trigger the error when running msi:
 <Component Id="Component" Guid="6f330b47-2577-43ad-9095-186186840a0a">
        <PermissionEx User="Everyone" GenericAll="yes" xmlns="" />
So I am not sure the error related to the WiX emitted code. The same error happens when installing on the mapped drives though.
Jun 26, 2015 at 3:28 PM
I ended up doing a custom action to programmatically change the permissions. I read somewhere that PermissionEx is running under the local system account...