aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/Compiler_2.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/Compiler_2.cs')
-rw-r--r--src/WixToolset.Core/Compiler_2.cs341
1 files changed, 211 insertions, 130 deletions
diff --git a/src/WixToolset.Core/Compiler_2.cs b/src/WixToolset.Core/Compiler_2.cs
index 84961f9b..234c1ebc 100644
--- a/src/WixToolset.Core/Compiler_2.cs
+++ b/src/WixToolset.Core/Compiler_2.cs
@@ -2621,6 +2621,9 @@ namespace WixToolset.Core
2621 this.Core.UnexpectedAttribute(child, attrib); 2621 this.Core.UnexpectedAttribute(child, attrib);
2622 } 2622 }
2623 break; 2623 break;
2624 case "Condition":
2625 condition = this.Core.GetAttributeValue(childSourceLineNumbers, attrib);
2626 break;
2624 case "Dialog": 2627 case "Dialog":
2625 if (showDialog) 2628 if (showDialog)
2626 { 2629 {
@@ -2678,7 +2681,10 @@ namespace WixToolset.Core
2678 } 2681 }
2679 2682
2680 // Get the condition from the inner text of the element. 2683 // Get the condition from the inner text of the element.
2681 condition = this.Core.GetConditionInnerText(child); 2684 if (condition == null)
2685 {
2686 condition = this.Core.GetConditionInnerText(child);
2687 }
2682 2688
2683 if (customAction && "Custom" == actionName) 2689 if (customAction && "Custom" == actionName)
2684 { 2690 {
@@ -2901,128 +2907,7 @@ namespace WixToolset.Core
2901 switch (child.Name.LocalName) 2907 switch (child.Name.LocalName)
2902 { 2908 {
2903 case "RequiredPrivilege": 2909 case "RequiredPrivilege":
2904 var privilege = this.Core.GetTrimmedInnerText(child); 2910 requiredPrivileges = this.ParseRequiredPrivilege(child, requiredPrivileges);
2905 switch (privilege)
2906 {
2907 case "assignPrimaryToken":
2908 privilege = "SeAssignPrimaryTokenPrivilege";
2909 break;
2910 case "audit":
2911 privilege = "SeAuditPrivilege";
2912 break;
2913 case "backup":
2914 privilege = "SeBackupPrivilege";
2915 break;
2916 case "changeNotify":
2917 privilege = "SeChangeNotifyPrivilege";
2918 break;
2919 case "createGlobal":
2920 privilege = "SeCreateGlobalPrivilege";
2921 break;
2922 case "createPagefile":
2923 privilege = "SeCreatePagefilePrivilege";
2924 break;
2925 case "createPermanent":
2926 privilege = "SeCreatePermanentPrivilege";
2927 break;
2928 case "createSymbolicLink":
2929 privilege = "SeCreateSymbolicLinkPrivilege";
2930 break;
2931 case "createToken":
2932 privilege = "SeCreateTokenPrivilege";
2933 break;
2934 case "debug":
2935 privilege = "SeDebugPrivilege";
2936 break;
2937 case "enableDelegation":
2938 privilege = "SeEnableDelegationPrivilege";
2939 break;
2940 case "impersonate":
2941 privilege = "SeImpersonatePrivilege";
2942 break;
2943 case "increaseBasePriority":
2944 privilege = "SeIncreaseBasePriorityPrivilege";
2945 break;
2946 case "increaseQuota":
2947 privilege = "SeIncreaseQuotaPrivilege";
2948 break;
2949 case "increaseWorkingSet":
2950 privilege = "SeIncreaseWorkingSetPrivilege";
2951 break;
2952 case "loadDriver":
2953 privilege = "SeLoadDriverPrivilege";
2954 break;
2955 case "lockMemory":
2956 privilege = "SeLockMemoryPrivilege";
2957 break;
2958 case "machineAccount":
2959 privilege = "SeMachineAccountPrivilege";
2960 break;
2961 case "manageVolume":
2962 privilege = "SeManageVolumePrivilege";
2963 break;
2964 case "profileSingleProcess":
2965 privilege = "SeProfileSingleProcessPrivilege";
2966 break;
2967 case "relabel":
2968 privilege = "SeRelabelPrivilege";
2969 break;
2970 case "remoteShutdown":
2971 privilege = "SeRemoteShutdownPrivilege";
2972 break;
2973 case "restore":
2974 privilege = "SeRestorePrivilege";
2975 break;
2976 case "security":
2977 privilege = "SeSecurityPrivilege";
2978 break;
2979 case "shutdown":
2980 privilege = "SeShutdownPrivilege";
2981 break;
2982 case "syncAgent":
2983 privilege = "SeSyncAgentPrivilege";
2984 break;
2985 case "systemEnvironment":
2986 privilege = "SeSystemEnvironmentPrivilege";
2987 break;
2988 case "systemProfile":
2989 privilege = "SeSystemProfilePrivilege";
2990 break;
2991 case "systemTime":
2992 case "modifySystemTime":
2993 privilege = "SeSystemtimePrivilege";
2994 break;
2995 case "takeOwnership":
2996 privilege = "SeTakeOwnershipPrivilege";
2997 break;
2998 case "tcb":
2999 case "trustedComputerBase":
3000 privilege = "SeTcbPrivilege";
3001 break;
3002 case "timeZone":
3003 case "modifyTimeZone":
3004 privilege = "SeTimeZonePrivilege";
3005 break;
3006 case "trustedCredManAccess":
3007 case "trustedCredentialManagerAccess":
3008 privilege = "SeTrustedCredManAccessPrivilege";
3009 break;
3010 case "undock":
3011 privilege = "SeUndockPrivilege";
3012 break;
3013 case "unsolicitedInput":
3014 privilege = "SeUnsolicitedInputPrivilege";
3015 break;
3016 default:
3017 // allow everything else to pass through that are hopefully "formatted" Properties.
3018 break;
3019 }
3020
3021 if (null != requiredPrivileges)
3022 {
3023 requiredPrivileges = String.Concat(requiredPrivileges, "[~]");
3024 }
3025 requiredPrivileges = String.Concat(requiredPrivileges, privilege);
3026 break; 2911 break;
3027 default: 2912 default:
3028 this.Core.UnexpectedElement(node, child); 2913 this.Core.UnexpectedElement(node, child);
@@ -3128,6 +3013,157 @@ namespace WixToolset.Core
3128 } 3013 }
3129 } 3014 }
3130 3015
3016 private string ParseRequiredPrivilege(XElement node, string requiredPrivileges)
3017 {
3018 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
3019 string privilege = null;
3020
3021 foreach (var attrib in node.Attributes())
3022 {
3023 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
3024 {
3025 switch (attrib.Name.LocalName)
3026 {
3027 case "Name":
3028 privilege = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
3029 switch (privilege)
3030 {
3031 case "assignPrimaryToken":
3032 privilege = "SeAssignPrimaryTokenPrivilege";
3033 break;
3034 case "audit":
3035 privilege = "SeAuditPrivilege";
3036 break;
3037 case "backup":
3038 privilege = "SeBackupPrivilege";
3039 break;
3040 case "changeNotify":
3041 privilege = "SeChangeNotifyPrivilege";
3042 break;
3043 case "createGlobal":
3044 privilege = "SeCreateGlobalPrivilege";
3045 break;
3046 case "createPagefile":
3047 privilege = "SeCreatePagefilePrivilege";
3048 break;
3049 case "createPermanent":
3050 privilege = "SeCreatePermanentPrivilege";
3051 break;
3052 case "createSymbolicLink":
3053 privilege = "SeCreateSymbolicLinkPrivilege";
3054 break;
3055 case "createToken":
3056 privilege = "SeCreateTokenPrivilege";
3057 break;
3058 case "debug":
3059 privilege = "SeDebugPrivilege";
3060 break;
3061 case "enableDelegation":
3062 privilege = "SeEnableDelegationPrivilege";
3063 break;
3064 case "impersonate":
3065 privilege = "SeImpersonatePrivilege";
3066 break;
3067 case "increaseBasePriority":
3068 privilege = "SeIncreaseBasePriorityPrivilege";
3069 break;
3070 case "increaseQuota":
3071 privilege = "SeIncreaseQuotaPrivilege";
3072 break;
3073 case "increaseWorkingSet":
3074 privilege = "SeIncreaseWorkingSetPrivilege";
3075 break;
3076 case "loadDriver":
3077 privilege = "SeLoadDriverPrivilege";
3078 break;
3079 case "lockMemory":
3080 privilege = "SeLockMemoryPrivilege";
3081 break;
3082 case "machineAccount":
3083 privilege = "SeMachineAccountPrivilege";
3084 break;
3085 case "manageVolume":
3086 privilege = "SeManageVolumePrivilege";
3087 break;
3088 case "profileSingleProcess":
3089 privilege = "SeProfileSingleProcessPrivilege";
3090 break;
3091 case "relabel":
3092 privilege = "SeRelabelPrivilege";
3093 break;
3094 case "remoteShutdown":
3095 privilege = "SeRemoteShutdownPrivilege";
3096 break;
3097 case "restore":
3098 privilege = "SeRestorePrivilege";
3099 break;
3100 case "security":
3101 privilege = "SeSecurityPrivilege";
3102 break;
3103 case "shutdown":
3104 privilege = "SeShutdownPrivilege";
3105 break;
3106 case "syncAgent":
3107 privilege = "SeSyncAgentPrivilege";
3108 break;
3109 case "systemEnvironment":
3110 privilege = "SeSystemEnvironmentPrivilege";
3111 break;
3112 case "systemProfile":
3113 privilege = "SeSystemProfilePrivilege";
3114 break;
3115 case "systemTime":
3116 case "modifySystemTime":
3117 privilege = "SeSystemtimePrivilege";
3118 break;
3119 case "takeOwnership":
3120 privilege = "SeTakeOwnershipPrivilege";
3121 break;
3122 case "tcb":
3123 case "trustedComputerBase":
3124 privilege = "SeTcbPrivilege";
3125 break;
3126 case "timeZone":
3127 case "modifyTimeZone":
3128 privilege = "SeTimeZonePrivilege";
3129 break;
3130 case "trustedCredManAccess":
3131 case "trustedCredentialManagerAccess":
3132 privilege = "SeTrustedCredManAccessPrivilege";
3133 break;
3134 case "undock":
3135 privilege = "SeUndockPrivilege";
3136 break;
3137 case "unsolicitedInput":
3138 privilege = "SeUnsolicitedInputPrivilege";
3139 break;
3140 default:
3141 // allow everything else to pass through that are hopefully "formatted" Properties.
3142 break;
3143 }
3144 break;
3145 default:
3146 this.Core.UnexpectedAttribute(node, attrib);
3147 break;
3148 }
3149 }
3150 }
3151
3152 if (privilege == null)
3153 {
3154 privilege = Common.GetInnerText(node);
3155 }
3156
3157 if (privilege == null)
3158 {
3159 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name"));
3160 }
3161
3162 this.Core.ParseForExtensionElements(node);
3163
3164 return (requiredPrivileges == null) ? privilege : String.Concat(requiredPrivileges, "[~]", privilege);
3165 }
3166
3131 /// <summary> 3167 /// <summary>
3132 /// Parses a service config failure actions element. 3168 /// Parses a service config failure actions element.
3133 /// </summary> 3169 /// </summary>
@@ -3427,11 +3463,7 @@ namespace WixToolset.Core
3427 switch (child.Name.LocalName) 3463 switch (child.Name.LocalName)
3428 { 3464 {
3429 case "ServiceArgument": 3465 case "ServiceArgument":
3430 if (null != arguments) 3466 arguments = this.ParseServiceArgument(child, arguments);
3431 {
3432 arguments = String.Concat(arguments, "[~]");
3433 }
3434 arguments = String.Concat(arguments, this.Core.GetTrimmedInnerText(child));
3435 break; 3467 break;
3436 default: 3468 default:
3437 this.Core.UnexpectedElement(node, child); 3469 this.Core.UnexpectedElement(node, child);
@@ -3462,6 +3494,42 @@ namespace WixToolset.Core
3462 } 3494 }
3463 } 3495 }
3464 3496
3497 private string ParseServiceArgument(XElement node, string arguments)
3498 {
3499 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
3500 string argument = null;
3501
3502 foreach (var attrib in node.Attributes())
3503 {
3504 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
3505 {
3506 switch (attrib.Name.LocalName)
3507 {
3508 case "Value":
3509 argument = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
3510 break;
3511 default:
3512 this.Core.UnexpectedAttribute(node, attrib);
3513 break;
3514 }
3515 }
3516 }
3517
3518 if (argument == null)
3519 {
3520 argument = this.Core.GetTrimmedInnerText(node);
3521 }
3522
3523 if (argument == null)
3524 {
3525 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value"));
3526 }
3527
3528 this.Core.ParseForExtensionElements(node);
3529
3530 return (arguments == null) ? argument : String.Concat(arguments, "[~]", argument);
3531 }
3532
3465 /// <summary> 3533 /// <summary>
3466 /// Parses a service dependency element. 3534 /// Parses a service dependency element.
3467 /// </summary> 3535 /// </summary>
@@ -3746,6 +3814,9 @@ namespace WixToolset.Core
3746 case "Action": 3814 case "Action":
3747 actionName = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3815 actionName = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3748 break; 3816 break;
3817 case "Condition":
3818 condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
3819 break;
3749 case "Id": 3820 case "Id":
3750 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3821 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3751 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Directory, id); 3822 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Directory, id);
@@ -3786,7 +3857,10 @@ namespace WixToolset.Core
3786 } 3857 }
3787 } 3858 }
3788 3859
3789 condition = this.Core.GetConditionInnerText(node); 3860 if (condition == null)
3861 {
3862 condition = this.Core.GetConditionInnerText(node);
3863 }
3790 3864
3791 if (null == id) 3865 if (null == id)
3792 { 3866 {
@@ -3831,6 +3905,7 @@ namespace WixToolset.Core
3831 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 3905 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
3832 string actionName = null; 3906 string actionName = null;
3833 string id = null; 3907 string id = null;
3908 string condition = null;
3834 string afterAction = null; 3909 string afterAction = null;
3835 string beforeAction = null; 3910 string beforeAction = null;
3836 var executionType = CustomActionExecutionType.Immediate; 3911 var executionType = CustomActionExecutionType.Immediate;
@@ -3849,6 +3924,9 @@ namespace WixToolset.Core
3849 case "Id": 3924 case "Id":
3850 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3925 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3851 break; 3926 break;
3927 case "Condition":
3928 condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
3929 break;
3852 case "After": 3930 case "After":
3853 afterAction = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3931 afterAction = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3854 break; 3932 break;
@@ -3914,7 +3992,10 @@ namespace WixToolset.Core
3914 } 3992 }
3915 } 3993 }
3916 3994
3917 var condition = this.Core.GetConditionInnerText(node); 3995 if (condition == null)
3996 {
3997 condition = this.Core.GetConditionInnerText(node);
3998 }
3918 3999
3919 if (null == id) 4000 if (null == id)
3920 { 4001 {