This was a feature request that I also required for correct operation
of my installer.

Basically, I extended the SecureObjects table to add an Inherit field
for use by the SecureObjects custom action. It would be great if this
or something like it could make it to the mainline branch. I really
don't want to maintain a custom build of Wix for my installer.

See request at:

http://sourceforge.net/tracker/index.php?func=detail&aid=1241592&group_id=105970&atid=642717
Index: src/ca/wixca/dll/secureobj.cpp
===================================================================
RCS file: /cvsroot/wix/wix2.0/src/ca/wixca/dll/secureobj.cpp,v
retrieving revision 1.4
diff -u -p -r1.4 secureobj.cpp
--- src/ca/wixca/dll/secureobj.cpp      24 May 2006 23:29:30 -0000      1.4
+++ src/ca/wixca/dll/secureobj.cpp      27 Jun 2006 17:16:20 -0000
@@ -20,7 +20,8 @@
 
 // structs
 LPCWSTR wzQUERY_SECUREOBJECTS = L"SELECT `SecureObject`, `Table`, `Domain`, 
`User`, `Permission` FROM `SecureObjects`";
-enum eQUERY_SECUREOBJECTS { QSO_SECUREOBJECT = 1, QSO_TABLE, QSO_DOMAIN, 
QSO_USER, QSO_PERMISSION };
+LPCWSTR wzQUERY_SECUREOBJECTS_2 = L"SELECT `SecureObject`, `Table`, `Domain`, 
`User`, `Permission`, `Inherit` FROM `SecureObjects`";
+enum eQUERY_SECUREOBJECTS { QSO_SECUREOBJECT = 1, QSO_TABLE, QSO_DOMAIN, 
QSO_USER, QSO_PERMISSION, QSO_INHERIT };
 
 LPCWSTR wzQUERY_SERVICECOMPONENT = L"SELECT `Component_`, `Name` FROM 
`ServiceInstall` WHERE `ServiceInstall`=?";
 LPCWSTR wzQUERY_CREATEFOLDERCOMPONENT = L"SELECT `Component_`, `Directory_` 
FROM `CreateFolder` WHERE `Directory_`=?";
@@ -81,7 +82,11 @@ extern "C" UINT __stdcall SchedSecureObj
        //
        // loop through all the objects to be secured
        //
-       hr = WcaOpenExecuteView(wzQUERY_SECUREOBJECTS, &hView);
+       
+       //attempt load for extended table, otherwise drop back to previous 
version
+       hr = WcaOpenExecuteView(wzQUERY_SECUREOBJECTS_2, &hView);
+       if (E_FAIL == hr)
+               hr = WcaOpenExecuteView(wzQUERY_SECUREOBJECTS, &hView);
        ExitOnFailure(hr, "failed to open view on SecureObjects table");
        while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
        {
@@ -301,6 +306,12 @@ extern "C" UINT __stdcall SchedSecureObj
                        hr = WcaWriteStringToCaData(pwzData, 
&pwzCustomActionData);
                        ExitOnFailure(hr, "failed to add data to 
CustomActionData");
 
+                       hr = WcaGetRecordString(hRec, QSO_INHERIT, &pwzData);
+                       if (S_OK == hr) {
+                               hr = WcaWriteStringToCaData(pwzData, 
&pwzCustomActionData);
+                               ExitOnFailure(hr, "failed to add data to 
CustomActionData");
+                       }
+
                        cObjects++;
                }
        }
@@ -346,7 +357,7 @@ extern "C" UINT __stdcall ExecSecureObje
        __in MSIHANDLE hInstall
        )
 {
-//     AssertSz(FALSE, "debug ExecSecureObjects");
+       //      AssertSz(FALSE, "debug ExecSecureObjects");
        HRESULT hr = S_OK;
        DWORD er = ERROR_SUCCESS;
 
@@ -358,6 +369,7 @@ extern "C" UINT __stdcall ExecSecureObje
        DWORD dwRevision = 0;
        LPWSTR pwzUser = NULL;
        DWORD dwPermissions = 0;
+       DWORD dwInherit = NO_INHERITANCE;
        LPWSTR pwzAccount = NULL;
        PSID psid = NULL;
 
@@ -400,6 +412,8 @@ extern "C" UINT __stdcall ExecSecureObje
                ExitOnFailure(hr, "failed to process CustomActionData");
                hr = WcaReadIntegerFromCaData(&pwz, 
reinterpret_cast<int*>(&dwPermissions));
                ExitOnFailure(hr, "failed to processCustomActionData");
+               
+               WcaReadIntegerFromCaData(&pwz, 
reinterpret_cast<int*>(&dwInherit));
 
                WcaLog(LOGMSG_VERBOSE, "Securing Object: %S Type: %S User: %S", 
pwzObject, pwzTable, pwzUser);
 
@@ -463,14 +477,13 @@ extern "C" UINT __stdcall ExecSecureObje
                ea.grfAccessPermissions = dwPermissions;
                ea.grfAccessMode = SET_ACCESS;
 
+               //backwards compatibiltiy with older version of Wix
                if (0 == lstrcmpW(L"CreateFolder", pwzTable))
-               {
-                       ea.grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT;
-               }
-               else
-               {
-                       ea.grfInheritance = NO_INHERITANCE;
+               {                       
+                       dwInherit = SUB_CONTAINERS_AND_OBJECTS_INHERIT;
                }
+               
+               ea.grfInheritance = dwInherit;
 
                ::BuildTrusteeWithSidW(&ea.Trustee, psid);
 
Index: src/dutil/dutil.vcproj
===================================================================
Index: src/wix/Compiler.cs
===================================================================
RCS file: /cvsroot/wix/wix2.0/src/wix/Compiler.cs,v
retrieving revision 1.11
diff -u -p -r1.11 Compiler.cs
--- src/wix/Compiler.cs 14 Jun 2006 08:29:46 -0000      1.11
+++ src/wix/Compiler.cs 27 Jun 2006 17:02:22 -0000
@@ -8680,10 +8680,11 @@ namespace Microsoft.Tools.WindowsInstall
         private void ParsePermissionElement(XmlNode node, string objectId, 
string tableName)
         {
             SourceLineNumberCollection sourceLineNumbers = 
this.core.GetSourceLineNumbers(node);
-            long bits = 0;
+            long bits = 0;            
             string domain = null;
             string[] specialPermissions = null;
             string user = null;
+            long inheritBits = 0;
 
             PermissionType permissionType = PermissionType.LockPermissions;
 
@@ -8731,6 +8732,11 @@ namespace Microsoft.Tools.WindowsInstall
                     case "User":
                         user = this.core.GetAttributeValue(sourceLineNumbers, 
attrib);
                         break;
+                    case "Inherit": 
+                        // Only works for extended!
+                        // SUB_CONTAINERS_AND_OBJECTS_INHERIT;
+                        inheritBits = 0x3;
+                        break;
                     default:
                         YesNoType attribValue = 
this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
                         long bit = 
Compiler.NameToBit(MsiInterop.StandardPermissions, attrib.Name, attribValue);
@@ -8803,6 +8809,7 @@ namespace Microsoft.Tools.WindowsInstall
                 row[2] = domain;
                 row[3] = user;
                 row[4] = bits;
+                row[5] = inheritBits;
 
                 // Reference SchedSecureObjects since nothing will happen 
without it
                 this.core.AddValidReference("CustomAction", 
"SchedSecureObjects");
Index: src/wix/Data/smalltables.xml
===================================================================
RCS file: /cvsroot/wix/wix2.0/src/wix/Data/smalltables.xml,v
retrieving revision 1.3
diff -u -p -r1.3 smalltables.xml
--- src/wix/Data/smalltables.xml        24 May 2006 23:29:33 -0000      1.3
+++ src/wix/Data/smalltables.xml        27 Jun 2006 17:00:38 -0000
@@ -971,6 +971,8 @@
                 category='text' description='Username half of user account to 
secure'/>
         <columnDefinition name='Permission' type='number' length='4' 
nullable='yes'
                 minValue='-2147483647' maxValue='2147483647' 
description='Permissions to grant to User'/>
+       <columnDefinition name='Inherit' type='number' length='4' nullable='yes'
+                minValue='-2147483647' maxValue='2147483647' 
description='Specificy Inherit flags to ACE object'/>
     </tableDefinition>
     <tableDefinition name='ServiceControl'>
         <columnDefinition name='ServiceControl' type='string' length='72' 
primaryKey='yes' symbol='yes' modularize='column'
Index: src/wix/Data/tables.xml
===================================================================
RCS file: /cvsroot/wix/wix2.0/src/wix/Data/tables.xml,v
retrieving revision 1.10
diff -u -p -r1.10 tables.xml
--- src/wix/Data/tables.xml     24 May 2006 23:29:33 -0000      1.10
+++ src/wix/Data/tables.xml     27 Jun 2006 17:00:50 -0000
@@ -975,6 +975,8 @@
                 category="text" description="Username half of user account to 
secure"/>
         <columnDefinition name="Permission" type="number" length="4" 
nullable="yes"
                 minValue="-2147483647" maxValue="2147483647" 
description="Permissions to grant to User"/>
+        <columnDefinition name='Inherit' type='number' length='4' 
nullable='yes'
+                minValue='-2147483647' maxValue='2147483647' 
description='Specificy Inherit flags to ACE object'/>
     </tableDefinition>
     <tableDefinition name="ServiceControl">
         <columnDefinition name="ServiceControl" type="string" length="72" 
primaryKey="yes" symbol="yes" modularize="column"
Index: src/wix/Serialize/wix.cs
===================================================================
RCS file: /cvsroot/wix/wix2.0/src/wix/Serialize/wix.cs,v
retrieving revision 1.2
diff -u -p -r1.2 wix.cs
--- src/wix/Serialize/wix.cs    24 May 2006 23:29:35 -0000      1.2
+++ src/wix/Serialize/wix.cs    27 Jun 2006 17:13:36 -0000
@@ -3077,6 +3077,10 @@ namespace Microsoft.Tools.WindowsInstall
         
         private bool serviceUserDefinedControlFieldSet;
         
+        private YesNoType inheritField;
+
+        private bool inheritFieldSet;
+        
         public string Domain
         {
             get
@@ -3576,6 +3580,17 @@ namespace Microsoft.Tools.WindowsInstall
                     writer.WriteAttributeString("Extended", "yes");
                 }
             }
+            if (this.inheritFieldSet)
+            {
+                if ((this.inheritField == YesNoType.no))
+                {
+                    writer.WriteAttributeString("Inherit", "no");
+                }
+                if ((this.inheritField == YesNoType.yes))
+                {
+                    writer.WriteAttributeString("Inherit", "yes");
+                }
+            }
             if (this.userFieldSet)
             {
                 writer.WriteAttributeString("User", this.userField);
@@ -3956,6 +3971,19 @@ namespace Microsoft.Tools.WindowsInstall
             }
             writer.WriteEndElement();
         }
+
+        public YesNoType Inherit
+        {
+            get
+            {
+                return this.inheritField;
+            }
+            set
+            {
+                this.inheritFieldSet = true;
+                this.inheritField = value;
+            }
+        }
     }
     
     public class UnregisterComPlus : ActionSequenceType, ISchemaElement
Index: src/wix/Xsd/wix.xsd
===================================================================
RCS file: /cvsroot/wix/wix2.0/src/wix/Xsd/wix.xsd,v
retrieving revision 1.14
diff -u -p -r1.14 wix.xsd
--- src/wix/Xsd/wix.xsd 12 Jun 2006 01:44:42 -0000      1.14
+++ src/wix/Xsd/wix.xsd 27 Jun 2006 17:11:11 -0000
@@ -2081,6 +2081,13 @@
             <xs:attribute name="ServiceUserDefinedControl" type="YesNoType">
                 <xs:annotation><xs:documentation>Required to call the 
ControlService function to specify a user-defined control code.  Only valid 
under a 'ServiceInstall' parent.</xs:documentation></xs:annotation>
             </xs:attribute>
+           <xs:attribute name="Inherit" use="optional" type="YesNoType">
+            <xs:annotation>
+              <xs:documentation>
+              Enable Inheritable on children and objects. This is used for 
folders and registry keys. Use with extended attribute.
+              </xs:documentation>
+            </xs:annotation>
+          </xs:attribute>
         </xs:complexType>
     </xs:element>
 
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
WiX-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-devs

Reply via email to