From cbc09b6cd6d0d0b8bf095a88d4d8333616637f71 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Mon, 4 Feb 2019 20:05:54 -0600 Subject: Import code from old v4 repo --- src/wixext/ComPlusCompiler.cs | 2188 +++++++++++++++++++++++++++++++++ src/wixext/ComPlusDecompiler.cs | 1843 +++++++++++++++++++++++++++ src/wixext/ComPlusExtensionData.cs | 64 + src/wixext/WixComPlusExtension.csproj | 50 + src/wixext/complus.xsd | 944 ++++++++++++++ src/wixext/messages.xml | 77 ++ src/wixext/tables.xml | 250 ++++ 7 files changed, 5416 insertions(+) create mode 100644 src/wixext/ComPlusCompiler.cs create mode 100644 src/wixext/ComPlusDecompiler.cs create mode 100644 src/wixext/ComPlusExtensionData.cs create mode 100644 src/wixext/WixComPlusExtension.csproj create mode 100644 src/wixext/complus.xsd create mode 100644 src/wixext/messages.xml create mode 100644 src/wixext/tables.xml (limited to 'src/wixext') diff --git a/src/wixext/ComPlusCompiler.cs b/src/wixext/ComPlusCompiler.cs new file mode 100644 index 00000000..7f22c56b --- /dev/null +++ b/src/wixext/ComPlusCompiler.cs @@ -0,0 +1,2188 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Extensions +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Globalization; + using System.Reflection; + using System.Xml; + using System.Xml.Linq; + using System.Xml.Schema; + using WixToolset.Data; + using WixToolset.Extensibility; + + /// + /// The compiler for the WiX Toolset Internet Information Services Extension. + /// + public sealed class ComPlusCompiler : CompilerExtension + { + /// + /// Instantiate a new ComPlusCompiler. + /// + public ComPlusCompiler() + { + this.Namespace = "http://wixtoolset.org/schemas/v4/wxs/complus"; + } + + /// + /// + /// + public enum CpiAssemblyAttributes + { + EventClass = (1 << 0), + DotNetAssembly = (1 << 1), + DllPathFromGAC = (1 << 2), + RegisterInCommit = (1 << 3) + } + + /// + /// Processes an element for the Compiler. + /// + /// Source line number for the parent element. + /// Parent element of element to process. + /// Element to process. + /// Extra information about the context in which this element is being parsed. + public override void ParseElement(XElement parentElement, XElement element, IDictionary context) + { + switch (parentElement.Name.LocalName) + { + case "Component": + string componentId = context["ComponentId"]; + string directoryId = context["DirectoryId"]; + bool win64 = Boolean.Parse(context["Win64"]); + + switch (element.Name.LocalName) + { + case "ComPlusPartition": + this.ParseComPlusPartitionElement(element, componentId, win64); + break; + case "ComPlusPartitionRole": + this.ParseComPlusPartitionRoleElement(element, componentId, null); + break; + case "ComPlusUserInPartitionRole": + this.ParseComPlusUserInPartitionRoleElement(element, componentId, null); + break; + case "ComPlusGroupInPartitionRole": + this.ParseComPlusGroupInPartitionRoleElement(element, componentId, null); + break; + case "ComPlusPartitionUser": + this.ParseComPlusPartitionUserElement(element, componentId, null); + break; + case "ComPlusApplication": + this.ParseComPlusApplicationElement(element, componentId, win64, null); + break; + case "ComPlusApplicationRole": + this.ParseComPlusApplicationRoleElement(element, componentId, null); + break; + case "ComPlusUserInApplicationRole": + this.ParseComPlusUserInApplicationRoleElement(element, componentId, null); + break; + case "ComPlusGroupInApplicationRole": + this.ParseComPlusGroupInApplicationRoleElement(element, componentId, null); + break; + case "ComPlusAssembly": + this.ParseComPlusAssemblyElement(element, componentId, win64, null); + break; + case "ComPlusRoleForComponent": + this.ParseComPlusRoleForComponentElement(element, componentId, null); + break; + case "ComPlusRoleForInterface": + this.ParseComPlusRoleForInterfaceElement(element, componentId, null); + break; + case "ComPlusRoleForMethod": + this.ParseComPlusRoleForMethodElement(element, componentId, null); + break; + case "ComPlusSubscription": + this.ParseComPlusSubscriptionElement(element, componentId, null); + break; + default: + this.Core.UnexpectedElement(parentElement, element); + break; + } + break; + case "Fragment": + case "Module": + case "Product": + switch (element.Name.LocalName) + { + case "ComPlusPartition": + this.ParseComPlusPartitionElement(element, null, false); + break; + case "ComPlusPartitionRole": + this.ParseComPlusPartitionRoleElement(element, null, null); + break; + case "ComPlusApplication": + this.ParseComPlusApplicationElement(element, null, false, null); + break; + case "ComPlusApplicationRole": + this.ParseComPlusApplicationRoleElement(element, null, null); + break; + default: + this.Core.UnexpectedElement(parentElement, element); + break; + } + break; + default: + this.Core.UnexpectedElement(parentElement, element); + break; + } + } + + /// + /// Parses a COM+ partition element. + /// + /// Element to parse. + /// Identifier of parent component. + private void ParseComPlusPartitionElement(XElement node, string componentKey, bool win64) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string id = null; + string name = null; + + Hashtable properties = new Hashtable(); + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "PartitionId": + id = TryFormatGuidValue(this.Core.GetAttributeValue(sourceLineNumbers, attrib)); + break; + case "Name": + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Changeable": + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + break; + case "Deleteable": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["Deleteable"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "Description": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["Description"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null != componentKey && null == name) + { + this.Core.OnMessage(ComPlusErrors.RequiredAttributeUnderComponent(sourceLineNumbers, node.Name.LocalName, "Name")); + } + if (null == componentKey && null == id && null == name) + { + this.Core.OnMessage(ComPlusErrors.RequiredAttributeNotUnderComponent(sourceLineNumbers, node.Name.LocalName, "Id", "Name")); + } + + foreach (XElement child in node.Elements()) + { + if (this.Namespace == child.Name.Namespace) + { + switch (child.Name.LocalName) + { + case "ComPlusPartitionRole": + this.ParseComPlusPartitionRoleElement(child, componentKey, key); + break; + case "ComPlusPartitionUser": + this.ParseComPlusPartitionUserElement(child, componentKey, key); + break; + case "ComPlusApplication": + this.ParseComPlusApplicationElement(child, componentKey, win64, key); + break; + default: + this.Core.UnexpectedElement(node, child); + break; + } + } + else + { + this.Core.ParseExtensionElement(node, child); + } + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusPartition"); + row[0] = key; + row[1] = componentKey; + row[2] = id; + row[3] = name; + + IDictionaryEnumerator propertiesEnumerator = properties.GetEnumerator(); + while (propertiesEnumerator.MoveNext()) + { + Row propertyRow = this.Core.CreateRow(sourceLineNumbers, "ComPlusPartitionProperty"); + propertyRow[0] = key; + propertyRow[1] = (string)propertiesEnumerator.Key; + propertyRow[2] = (string)propertiesEnumerator.Value; + } + + if (componentKey != null) + { + if (win64) + { + if (this.Core.CurrentPlatform == Platform.IA64) + { + this.Core.OnMessage(WixErrors.UnsupportedPlatformForElement(sourceLineNumbers, "ia64", node.Name.LocalName)); + } + else + { + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "ConfigureComPlusInstall_x64"); + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "ConfigureComPlusUninstall_x64"); + } + } + else + { + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "ConfigureComPlusInstall"); + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "ConfigureComPlusUninstall"); + } + } + } + + /// + /// Parses a COM+ partition role element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Optional identifier of parent application. + private void ParseComPlusPartitionRoleElement(XElement node, string componentKey, string partitionKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string name = null; + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "Partition": + if (null != partitionKey) + { + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + } + partitionKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "ComPlusPartition", partitionKey); + break; + case "Name": + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null == partitionKey) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Partition")); + } + + foreach (XElement child in node.Elements()) + { + if (this.Namespace == child.Name.Namespace) + { + switch (child.Name.LocalName) + { + case "ComPlusUserInPartitionRole": + this.ParseComPlusUserInPartitionRoleElement(child, componentKey, key); + break; + case "ComPlusGroupInPartitionRole": + this.ParseComPlusGroupInPartitionRoleElement(child, componentKey, key); + break; + default: + this.Core.UnexpectedElement(node, child); + break; + } + } + else + { + this.Core.ParseExtensionElement(node, child); + } + } + + // add table row + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusPartitionRole"); + row[0] = key; + row[1] = partitionKey; + row[3] = name; + } + + /// + /// Parses a COM+ partition role user element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Optional identifier of parent application role. + private void ParseComPlusUserInPartitionRoleElement(XElement node, string componentKey, string partitionRoleKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string user = null; + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "PartitionRole": + if (null != partitionRoleKey) + { + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + } + partitionRoleKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "ComPlusPartitionRole", partitionRoleKey); + break; + case "User": + user = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "User", user); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null == partitionRoleKey) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "PartitionRole")); + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusUserInPartitionRole"); + row[0] = key; + row[1] = partitionRoleKey; + row[2] = componentKey; + row[3] = user; + } + + /// + /// Parses a COM+ partition role user element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Optional identifier of parent application role. + private void ParseComPlusGroupInPartitionRoleElement(XElement node, string componentKey, string partitionRoleKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string group = null; + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "PartitionRole": + if (null != partitionRoleKey) + { + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + } + partitionRoleKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "ComPlusPartitionRole", partitionRoleKey); + break; + case "Group": + group = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Group", group); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null == partitionRoleKey) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "PartitionRole")); + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusGroupInPartitionRole"); + row[0] = key; + row[1] = partitionRoleKey; + row[2] = componentKey; + row[3] = group; + } + + /// + /// Parses a COM+ partition element. + /// + /// Element to parse. + /// Identifier of parent component. + private void ParseComPlusPartitionUserElement(XElement node, string componentKey, string partitionKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string user = null; + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "Partition": + if (null != partitionKey) + { + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + } + partitionKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "ComPlusPartition", partitionKey); + break; + case "User": + user = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "User", user); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null == partitionKey) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Partition")); + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusPartitionUser"); + row[0] = key; + row[1] = partitionKey; + row[2] = componentKey; + row[3] = user; + } + + /// + /// Parses a COM+ application element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Optional identifier of parent partition. + private void ParseComPlusApplicationElement(XElement node, string componentKey, bool win64, string partitionKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string id = null; + string name = null; + + Hashtable properties = new Hashtable(); + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "Partition": + if (null != partitionKey) + { + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + } + partitionKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "ComPlusPartition", partitionKey); + break; + case "ApplicationId": + id = TryFormatGuidValue(this.Core.GetAttributeValue(sourceLineNumbers, attrib)); + break; + case "Name": + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "ThreeGigSupportEnabled": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["3GigSupportEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "AccessChecksLevel": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + string accessChecksLevelValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (accessChecksLevelValue) + { + case "applicationLevel": + properties["AccessChecksLevel"] = "0"; + break; + case "applicationComponentLevel": + properties["AccessChecksLevel"] = "1"; + break; + default: + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "ComPlusApplication", "AccessChecksLevel", accessChecksLevelValue, "applicationLevel", "applicationComponentLevel")); + break; + } + break; + case "Activation": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + string activationValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (activationValue) + { + case "inproc": + properties["Activation"] = "Inproc"; + break; + case "local": + properties["Activation"] = "Local"; + break; + default: + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "ComPlusApplication", "Activation", activationValue, "inproc", "local")); + break; + } + break; + case "ApplicationAccessChecksEnabled": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["ApplicationAccessChecksEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "ApplicationDirectory": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["ApplicationDirectory"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Authentication": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + string authenticationValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (authenticationValue) + { + case "default": + properties["Authentication"] = "0"; + break; + case "none": + properties["Authentication"] = "1"; + break; + case "connect": + properties["Authentication"] = "2"; + break; + case "call": + properties["Authentication"] = "3"; + break; + case "packet": + properties["Authentication"] = "4"; + break; + case "integrity": + properties["Authentication"] = "5"; + break; + case "privacy": + properties["Authentication"] = "6"; + break; + default: + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "ComPlusApplication", "Authentication", authenticationValue, "default", "none", "connect", "call", "packet", "integrity", "privacy")); + break; + } + break; + case "AuthenticationCapability": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + string authenticationCapabilityValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (authenticationCapabilityValue) + { + case "none": + properties["AuthenticationCapability"] = "0"; + break; + case "secureReference": + properties["AuthenticationCapability"] = "2"; + break; + case "staticCloaking": + properties["AuthenticationCapability"] = "32"; + break; + case "dynamicCloaking": + properties["AuthenticationCapability"] = "64"; + break; + default: + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "ComPlusApplication", "AuthenticationCapability", authenticationCapabilityValue, "none", "secureReference", "staticCloaking", "dynamicCloaking")); + break; + } + break; + case "Changeable": + this.Core.OnMessage(WixWarnings.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + break; + case "CommandLine": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["CommandLine"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "ConcurrentApps": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["ConcurrentApps"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "CreatedBy": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["CreatedBy"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "CRMEnabled": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["CRMEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "CRMLogFile": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["CRMLogFile"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Deleteable": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["Deleteable"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "Description": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["Description"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "DumpEnabled": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["DumpEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "DumpOnException": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["DumpOnException"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "DumpOnFailfast": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["DumpOnFailfast"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "DumpPath": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["DumpPath"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "EventsEnabled": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["EventsEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "Identity": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["Identity"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "ImpersonationLevel": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + string impersonationLevelValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (impersonationLevelValue) + { + case "anonymous": + properties["ImpersonationLevel"] = "1"; + break; + case "identify": + properties["ImpersonationLevel"] = "2"; + break; + case "impersonate": + properties["ImpersonationLevel"] = "3"; + break; + case "delegate": + properties["ImpersonationLevel"] = "4"; + break; + default: + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "ComPlusApplication", "ImpersonationLevel", impersonationLevelValue, "anonymous", "identify", "impersonate", "delegate")); + break; + } + break; + case "IsEnabled": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["IsEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "MaxDumpCount": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["MaxDumpCount"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Password": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["Password"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "QCAuthenticateMsgs": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + string qcAuthenticateMsgsValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (qcAuthenticateMsgsValue) + { + case "secureApps": + properties["QCAuthenticateMsgs"] = "0"; + break; + case "off": + properties["QCAuthenticateMsgs"] = "1"; + break; + case "on": + properties["QCAuthenticateMsgs"] = "2"; + break; + default: + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "ComPlusApplication", "QCAuthenticateMsgs", qcAuthenticateMsgsValue, "secureApps", "off", "on")); + break; + } + break; + case "QCListenerMaxThreads": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["QCListenerMaxThreads"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "QueueListenerEnabled": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["QueueListenerEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "QueuingEnabled": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["QueuingEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "RecycleActivationLimit": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["RecycleActivationLimit"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "RecycleCallLimit": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["RecycleCallLimit"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "RecycleExpirationTimeout": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["RecycleExpirationTimeout"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "RecycleLifetimeLimit": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["RecycleLifetimeLimit"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "RecycleMemoryLimit": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["RecycleMemoryLimit"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Replicable": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["Replicable"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "RunForever": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["RunForever"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "ShutdownAfter": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["ShutdownAfter"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "SoapActivated": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["SoapActivated"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "SoapBaseUrl": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["SoapBaseUrl"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "SoapMailTo": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["SoapMailTo"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "SoapVRoot": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["SoapVRoot"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "SRPEnabled": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["SRPEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "SRPTrustLevel": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + string srpTrustLevelValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (srpTrustLevelValue) + { + case "disallowed": + properties["SRPTrustLevel"] = "0"; + break; + case "fullyTrusted": + properties["SRPTrustLevel"] = "262144"; + break; + default: + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "ComPlusApplication", "SRPTrustLevel", srpTrustLevelValue, "disallowed", "fullyTrusted")); + break; + } + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null != componentKey && null == name) + { + this.Core.OnMessage(ComPlusErrors.RequiredAttributeUnderComponent(sourceLineNumbers, node.Name.LocalName, "Name")); + } + if (null == componentKey && null == id && null == name) + { + this.Core.OnMessage(ComPlusErrors.RequiredAttributeNotUnderComponent(sourceLineNumbers, node.Name.LocalName, "Id", "Name")); + } + + foreach (XElement child in node.Elements()) + { + if (this.Namespace == child.Name.Namespace) + { + switch (child.Name.LocalName) + { + case "ComPlusApplicationRole": + this.ParseComPlusApplicationRoleElement(child, componentKey, key); + break; + case "ComPlusAssembly": + this.ParseComPlusAssemblyElement(child, componentKey, win64, key); + break; + default: + this.Core.UnexpectedElement(node, child); + break; + } + } + else + { + this.Core.ParseExtensionElement(node, child); + } + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusApplication"); + row[0] = key; + row[1] = partitionKey; + row[2] = componentKey; + row[3] = id; + row[4] = name; + + IDictionaryEnumerator propertiesEnumerator = properties.GetEnumerator(); + while (propertiesEnumerator.MoveNext()) + { + Row propertyRow = this.Core.CreateRow(sourceLineNumbers, "ComPlusApplicationProperty"); + propertyRow[0] = key; + propertyRow[1] = (string)propertiesEnumerator.Key; + propertyRow[2] = (string)propertiesEnumerator.Value; + } + + if (componentKey != null) + { + if (win64) + { + if (this.Core.CurrentPlatform == Platform.IA64) + { + this.Core.OnMessage(WixErrors.UnsupportedPlatformForElement(sourceLineNumbers, "ia64", node.Name.LocalName)); + } + else + { + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "ConfigureComPlusInstall_x64"); + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "ConfigureComPlusUninstall_x64"); + } + } + else + { + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "ConfigureComPlusInstall"); + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "ConfigureComPlusUninstall"); + } + } + } + + /// + /// Parses a COM+ application role element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Optional identifier of parent application. + private void ParseComPlusApplicationRoleElement(XElement node, string componentKey, string applicationKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string name = null; + + Hashtable properties = new Hashtable(); + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "Application": + if (null != applicationKey) + { + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + } + applicationKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "ComPlusApplication", applicationKey); + break; + case "Name": + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Description": + if (null == componentKey) + { + this.Core.OnMessage(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); + } + properties["Description"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null == applicationKey) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Application")); + } + + foreach (XElement child in node.Elements()) + { + if (this.Namespace == child.Name.Namespace) + { + switch (child.Name.LocalName) + { + case "ComPlusUserInApplicationRole": + this.ParseComPlusUserInApplicationRoleElement(child, componentKey, key); + break; + case "ComPlusGroupInApplicationRole": + this.ParseComPlusGroupInApplicationRoleElement(child, componentKey, key); + break; + default: + this.Core.UnexpectedElement(node, child); + break; + } + } + else + { + this.Core.ParseExtensionElement(node, child); + } + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusApplicationRole"); + row[0] = key; + row[1] = applicationKey; + row[2] = componentKey; + row[3] = name; + + IDictionaryEnumerator propertiesEnumerator = properties.GetEnumerator(); + while (propertiesEnumerator.MoveNext()) + { + Row propertyRow = this.Core.CreateRow(sourceLineNumbers, "ComPlusApplicationRoleProperty"); + propertyRow[0] = key; + propertyRow[1] = (string)propertiesEnumerator.Key; + propertyRow[2] = (string)propertiesEnumerator.Value; + } + } + + /// + /// Parses a COM+ application role user element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Optional identifier of parent application role. + private void ParseComPlusUserInApplicationRoleElement(XElement node, string componentKey, string applicationRoleKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string user = null; + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "ApplicationRole": + if (null != applicationRoleKey) + { + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + } + applicationRoleKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "ComPlusApplicationRole", applicationRoleKey); + break; + case "User": + user = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "User", user); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null == applicationRoleKey) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ApplicationRole")); + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusUserInApplicationRole"); + row[0] = key; + row[1] = applicationRoleKey; + row[2] = componentKey; + row[3] = user; + } + + /// + /// Parses a COM+ application role group element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Optional identifier of parent application role. + private void ParseComPlusGroupInApplicationRoleElement(XElement node, string componentKey, string applicationRoleKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string group = null; + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "ApplicationRole": + if (null != applicationRoleKey) + { + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + } + applicationRoleKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "ComPlusApplicationRole", applicationRoleKey); + break; + case "Group": + group = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "Group", group); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null == applicationRoleKey) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ApplicationRole")); + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusGroupInApplicationRole"); + row[0] = key; + row[1] = applicationRoleKey; + row[2] = componentKey; + row[3] = group; + } + + /// + /// Parses a COM+ assembly element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Optional identifier of parent application. + private void ParseComPlusAssemblyElement(XElement node, string componentKey, bool win64, string applicationKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string assemblyName = null; + string dllPath = null; + string tlbPath = null; + string psDllPath = null; + int attributes = 0; + + bool hasComponents = false; + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "Application": + if (null != applicationKey) + { + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + } + applicationKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "ComPlusApplication", applicationKey); + break; + case "AssemblyName": + assemblyName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "DllPath": + dllPath = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "TlbPath": + tlbPath = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "PSDllPath": + psDllPath = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Type": + string typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (typeValue) + { + case ".net": + attributes |= (int)CpiAssemblyAttributes.DotNetAssembly; + break; + case "native": + attributes &= ~(int)CpiAssemblyAttributes.DotNetAssembly; + break; + default: + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "ComPlusAssembly", "Type", typeValue, ".net", "native")); + break; + } + break; + case "EventClass": + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + { + attributes |= (int)CpiAssemblyAttributes.EventClass; + } + else + { + attributes &= ~(int)CpiAssemblyAttributes.EventClass; + } + break; + case "DllPathFromGAC": + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + { + attributes |= (int)CpiAssemblyAttributes.DllPathFromGAC; + } + else + { + attributes &= ~(int)CpiAssemblyAttributes.DllPathFromGAC; + } + break; + case "RegisterInCommit": + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + { + attributes |= (int)CpiAssemblyAttributes.RegisterInCommit; + } + else + { + attributes &= ~(int)CpiAssemblyAttributes.RegisterInCommit; + } + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null == applicationKey && 0 == (attributes & (int)CpiAssemblyAttributes.DotNetAssembly)) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Application", "Type", "native")); + } + if (null != assemblyName && 0 == (attributes & (int)CpiAssemblyAttributes.DllPathFromGAC)) + { + this.Core.OnMessage(ComPlusErrors.UnexpectedAttributeWithoutOtherValue(sourceLineNumbers, node.Name.LocalName, "AssemblyName", "DllPathFromGAC", "no")); + } + if (null == tlbPath && 0 != (attributes & (int)CpiAssemblyAttributes.DotNetAssembly)) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "TlbPath", "Type", ".net")); + } + if (null != psDllPath && 0 != (attributes & (int)CpiAssemblyAttributes.DotNetAssembly)) + { + this.Core.OnMessage(ComPlusErrors.UnexpectedAttributeWithOtherValue(sourceLineNumbers, node.Name.LocalName, "PSDllPath", "Type", ".net")); + } + if (0 != (attributes & (int)CpiAssemblyAttributes.EventClass) && 0 != (attributes & (int)CpiAssemblyAttributes.DotNetAssembly)) + { + this.Core.OnMessage(ComPlusErrors.UnexpectedAttributeWithOtherValue(sourceLineNumbers, node.Name.LocalName, "EventClass", "yes", "Type", ".net")); + } + + foreach (XElement child in node.Elements()) + { + if (this.Namespace == child.Name.Namespace) + { + switch (child.Name.LocalName) + { + case "ComPlusAssemblyDependency": + this.ParseComPlusAssemblyDependencyElement(child, key); + break; + case "ComPlusComponent": + this.ParseComPlusComponentElement(child, componentKey, key); + hasComponents = true; + break; + default: + this.Core.UnexpectedElement(node, child); + break; + } + } + else + { + this.Core.ParseExtensionElement(node, child); + } + } + + if (0 == (attributes & (int)CpiAssemblyAttributes.DotNetAssembly) && !hasComponents) + { + this.Core.OnMessage(ComPlusWarnings.MissingComponents(sourceLineNumbers)); + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusAssembly"); + row[0] = key; + row[1] = applicationKey; + row[2] = componentKey; + row[3] = assemblyName; + row[4] = dllPath; + row[5] = tlbPath; + row[6] = psDllPath; + row[7] = attributes; + + if (win64) + { + if (this.Core.CurrentPlatform == Platform.IA64) + { + this.Core.OnMessage(WixErrors.UnsupportedPlatformForElement(sourceLineNumbers, "ia64", node.Name.LocalName)); + } + else + { + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "ConfigureComPlusInstall_x64"); + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "ConfigureComPlusUninstall_x64"); + } + } + else + { + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "ConfigureComPlusInstall"); + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "ConfigureComPlusUninstall"); + } + } + + /// + /// Parses a COM+ assembly dependency element. + /// + /// Element to parse. + /// Identifier of parent assembly. + private void ParseComPlusAssemblyDependencyElement(XElement node, string assemblyKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string requiredAssemblyKey = null; + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "RequiredAssembly": + requiredAssemblyKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusAssemblyDependency"); + row[0] = assemblyKey; + row[1] = requiredAssemblyKey; + } + + /// + /// Parses a COM+ component element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Identifier of parent assembly. + private void ParseComPlusComponentElement(XElement node, string componentKey, string assemblyKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string clsid = null; + + Hashtable properties = new Hashtable(); + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "CLSID": + clsid = "{" + this.Core.GetAttributeValue(sourceLineNumbers, attrib) + "}"; + break; + case "AllowInprocSubscribers": + properties["AllowInprocSubscribers"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "ComponentAccessChecksEnabled": + properties["ComponentAccessChecksEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "ComponentTransactionTimeout": + properties["ComponentTransactionTimeout"] = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, 3600).ToString(); + break; + case "ComponentTransactionTimeoutEnabled": + properties["ComponentTransactionTimeoutEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "COMTIIntrinsics": + properties["COMTIIntrinsics"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "ConstructionEnabled": + properties["ConstructionEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "ConstructorString": + properties["ConstructorString"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "CreationTimeout": + properties["CreationTimeout"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Description": + properties["Description"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "EventTrackingEnabled": + properties["EventTrackingEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "ExceptionClass": + properties["ExceptionClass"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "FireInParallel": + properties["FireInParallel"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "IISIntrinsics": + properties["IISIntrinsics"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "InitializesServerApplication": + properties["InitializesServerApplication"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "IsEnabled": + properties["IsEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "IsPrivateComponent": + properties["IsPrivateComponent"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "JustInTimeActivation": + properties["JustInTimeActivation"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "LoadBalancingSupported": + properties["LoadBalancingSupported"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "MaxPoolSize": + properties["MaxPoolSize"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "MinPoolSize": + properties["MinPoolSize"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "MultiInterfacePublisherFilterCLSID": + properties["MultiInterfacePublisherFilterCLSID"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "MustRunInClientContext": + properties["MustRunInClientContext"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "MustRunInDefaultContext": + properties["MustRunInDefaultContext"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "ObjectPoolingEnabled": + properties["ObjectPoolingEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "PublisherID": + properties["PublisherID"] = TryFormatGuidValue(this.Core.GetAttributeValue(sourceLineNumbers, attrib)); + break; + case "SoapAssemblyName": + properties["SoapAssemblyName"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "SoapTypeName": + properties["SoapTypeName"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Synchronization": + string synchronizationValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (synchronizationValue) + { + case "ignored": + properties["Synchronization"] = "0"; + break; + case "none": + properties["Synchronization"] = "1"; + break; + case "supported": + properties["Synchronization"] = "2"; + break; + case "required": + properties["Synchronization"] = "3"; + break; + case "requiresNew": + properties["Synchronization"] = "4"; + break; + default: + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "ComPlusComponent", "Synchronization", synchronizationValue, "ignored", "none", "supported", "required", "requiresNew")); + break; + } + break; + case "Transaction": + string transactionValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (transactionValue) + { + case "ignored": + properties["Transaction"] = "0"; + break; + case "none": + properties["Transaction"] = "1"; + break; + case "supported": + properties["Transaction"] = "2"; + break; + case "required": + properties["Transaction"] = "3"; + break; + case "requiresNew": + properties["Transaction"] = "4"; + break; + default: + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "ComPlusComponent", "Transaction", transactionValue, "ignored", "none", "supported", "required", "requiresNew")); + break; + } + break; + case "TxIsolationLevel": + string txIsolationLevelValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + switch (txIsolationLevelValue) + { + case "any": + properties["TxIsolationLevel"] = "0"; + break; + case "readUnCommitted": + properties["TxIsolationLevel"] = "1"; + break; + case "readCommitted": + properties["TxIsolationLevel"] = "2"; + break; + case "repeatableRead": + properties["TxIsolationLevel"] = "3"; + break; + case "serializable": + properties["TxIsolationLevel"] = "4"; + break; + default: + this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, "ComPlusComponent", "TxIsolationLevel", txIsolationLevelValue, "any", "readUnCommitted", "readCommitted", "repeatableRead", "serializable")); + break; + } + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + foreach (XElement child in node.Elements()) + { + if (this.Namespace == child.Name.Namespace) + { + switch (child.Name.LocalName) + { + case "ComPlusRoleForComponent": + this.ParseComPlusRoleForComponentElement(child, componentKey, key); + break; + case "ComPlusInterface": + this.ParseComPlusInterfaceElement(child, componentKey, key); + break; + case "ComPlusSubscription": + this.ParseComPlusSubscriptionElement(child, componentKey, key); + break; + default: + this.Core.UnexpectedElement(node, child); + break; + } + } + else + { + this.Core.ParseExtensionElement(node, child); + } + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusComponent"); + row[0] = key; + row[1] = assemblyKey; + row[2] = clsid; + + IDictionaryEnumerator propertiesEnumerator = properties.GetEnumerator(); + while (propertiesEnumerator.MoveNext()) + { + Row propertyRow = this.Core.CreateRow(sourceLineNumbers, "ComPlusComponentProperty"); + propertyRow[0] = key; + propertyRow[1] = (string)propertiesEnumerator.Key; + propertyRow[2] = (string)propertiesEnumerator.Value; + } + } + + /// + /// Parses a COM+ application role for component element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Identifier of parent COM+ component. + private void ParseComPlusRoleForComponentElement(XElement node, string componentKey, string cpcomponentKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string applicationRoleKey = null; + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "Component": + if (null != cpcomponentKey) + { + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + } + cpcomponentKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "ComPlusComponent", cpcomponentKey); + break; + case "ApplicationRole": + applicationRoleKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null == cpcomponentKey) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Component")); + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusRoleForComponent"); + row[0] = key; + row[1] = cpcomponentKey; + row[2] = applicationRoleKey; + row[3] = componentKey; + } + + /// + /// Parses a COM+ interface element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Identifier of parent COM+ component. + private void ParseComPlusInterfaceElement(XElement node, string componentKey, string cpcomponentKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + // parse attributes + string key = null; + string iid = null; + + Hashtable properties = new Hashtable(); + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "IID": + iid = "{" + this.Core.GetAttributeValue(sourceLineNumbers, attrib) + "}"; + break; + case "Description": + properties["Description"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "QueuingEnabled": + properties["QueuingEnabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + foreach (XElement child in node.Elements()) + { + if (this.Namespace == child.Name.Namespace) + { + switch (child.Name.LocalName) + { + case "ComPlusRoleForInterface": + this.ParseComPlusRoleForInterfaceElement(child, componentKey, key); + break; + case "ComPlusMethod": + this.ParseComPlusMethodElement(child, componentKey, key); + break; + default: + this.Core.UnexpectedElement(node, child); + break; + } + } + else + { + this.Core.ParseExtensionElement(node, child); + } + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusInterface"); + row[0] = key; + row[1] = cpcomponentKey; + row[2] = iid; + + IDictionaryEnumerator propertiesEnumerator = properties.GetEnumerator(); + while (propertiesEnumerator.MoveNext()) + { + Row propertyRow = this.Core.CreateRow(sourceLineNumbers, "ComPlusInterfaceProperty"); + propertyRow[0] = key; + propertyRow[1] = (string)propertiesEnumerator.Key; + propertyRow[2] = (string)propertiesEnumerator.Value; + } + } + + /// + /// Parses a COM+ application role for interface element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Identifier of parent interface. + private void ParseComPlusRoleForInterfaceElement(XElement node, string componentKey, string interfaceKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string applicationRoleKey = null; + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "Interface": + if (null != interfaceKey) + { + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + } + interfaceKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "ComPlusInterface", interfaceKey); + break; + case "ApplicationRole": + applicationRoleKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null == interfaceKey) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Interface")); + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusRoleForInterface"); + row[0] = key; + row[1] = interfaceKey; + row[2] = applicationRoleKey; + row[3] = componentKey; + } + + /// + /// Parses a COM+ method element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Identifier of parent interface. + private void ParseComPlusMethodElement(XElement node, string componentKey, string interfaceKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + int index = CompilerConstants.IntegerNotSet; + string name = null; + + Hashtable properties = new Hashtable(); + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "Index": + index = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); + break; + case "Name": + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "AutoComplete": + properties["AutoComplete"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "Description": + properties["Description"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + foreach (XElement child in node.Elements()) + { + if (this.Namespace == child.Name.Namespace) + { + switch (child.Name.LocalName) + { + case "ComPlusRoleForMethod": + this.ParseComPlusRoleForMethodElement(child, componentKey, key); + break; + default: + this.Core.UnexpectedElement(node, child); + break; + } + } + else + { + this.Core.ParseExtensionElement(node, child); + } + } + + if (CompilerConstants.IntegerNotSet == index && null == name) + { + this.Core.OnMessage(ComPlusErrors.RequiredAttribute(sourceLineNumbers, node.Name.LocalName, "Index", "Name")); + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusMethod"); + row[0] = key; + row[1] = interfaceKey; + if (CompilerConstants.IntegerNotSet != index) + { + row[2] = index; + } + row[3] = name; + + IDictionaryEnumerator propertiesEnumerator = properties.GetEnumerator(); + while (propertiesEnumerator.MoveNext()) + { + Row propertyRow = this.Core.CreateRow(sourceLineNumbers, "ComPlusMethodProperty"); + propertyRow[0] = key; + propertyRow[1] = (string)propertiesEnumerator.Key; + propertyRow[2] = (string)propertiesEnumerator.Value; + } + } + + /// + /// Parses a COM+ application role for method element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Identifier of parent method. + private void ParseComPlusRoleForMethodElement(XElement node, string componentKey, string methodKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string applicationRoleKey = null; + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "Method": + if (null != methodKey) + { + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + } + methodKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "ComPlusMethod", methodKey); + break; + case "ApplicationRole": + applicationRoleKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null == methodKey) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Method")); + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusRoleForMethod"); + row[0] = key; + row[1] = methodKey; + row[2] = applicationRoleKey; + row[3] = componentKey; + } + + /// + /// Parses a COM+ event subscription element. + /// + /// Element to parse. + /// Identifier of parent component. + /// Identifier of parent COM+ component. + private void ParseComPlusSubscriptionElement(XElement node, string componentKey, string cpcomponentKey) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + + string key = null; + string id = null; + string name = null; + string eventCLSID = null; + string publisherID = null; + + Hashtable properties = new Hashtable(); + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + key = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + case "Component": + if (null != cpcomponentKey) + { + this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); + } + cpcomponentKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, "ComPlusComponent", cpcomponentKey); + break; + case "SubscriptionId": + id = TryFormatGuidValue(this.Core.GetAttributeValue(sourceLineNumbers, attrib)); + break; + case "Name": + name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "EventCLSID": + eventCLSID = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "PublisherID": + publisherID = TryFormatGuidValue(this.Core.GetAttributeValue(sourceLineNumbers, attrib)); + break; + case "Description": + properties["Description"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Enabled": + properties["Enabled"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "EventClassPartitionID": + properties["EventClassPartitionID"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "FilterCriteria": + properties["FilterCriteria"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "InterfaceID": + properties["InterfaceID"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "MachineName": + properties["MachineName"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "MethodName": + properties["MethodName"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "PerUser": + properties["PerUser"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "Queued": + properties["Queued"] = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib) ? "1" : "0"; + break; + case "SubscriberMoniker": + properties["SubscriberMoniker"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "UserName": + properties["UserName"] = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null == cpcomponentKey) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Component")); + } + + this.Core.ParseForExtensionElements(node); + + Row row = this.Core.CreateRow(sourceLineNumbers, "ComPlusSubscription"); + row[0] = key; + row[1] = cpcomponentKey; + row[2] = componentKey; + row[3] = id; + row[4] = name; + row[5] = eventCLSID; + row[6] = publisherID; + + IDictionaryEnumerator propertiesEnumerator = properties.GetEnumerator(); + while (propertiesEnumerator.MoveNext()) + { + Row propertyRow = this.Core.CreateRow(sourceLineNumbers, "ComPlusSubscriptionProperty"); + propertyRow[0] = key; + propertyRow[1] = (string)propertiesEnumerator.Key; + propertyRow[2] = (string)propertiesEnumerator.Value; + } + } + + /// + /// Attempts to parse the input value as a GUID, and in case the value is a valid + /// GUID returnes it in the format "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}". + /// + /// + /// + string TryFormatGuidValue(string val) + { + try + { + Guid guid = new Guid(val); + return guid.ToString("B").ToUpper(); + } + catch (FormatException) + { + return val; + } + catch (OverflowException) + { + return val; + } + } + } +} diff --git a/src/wixext/ComPlusDecompiler.cs b/src/wixext/ComPlusDecompiler.cs new file mode 100644 index 00000000..27f1653e --- /dev/null +++ b/src/wixext/ComPlusDecompiler.cs @@ -0,0 +1,1843 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Extensions +{ + using System; + using System.Collections; + using System.Globalization; + using WixToolset.Data; + using WixToolset.Extensibility; + using ComPlus = WixToolset.Extensions.Serialize.ComPlus; + using Wix = WixToolset.Data.Serialize; + + /// + /// The decompiler for the WiX Toolset COM+ Extension. + /// + public sealed class ComPlusDecompiler : DecompilerExtension + { + /// + /// Creates a decompiler for ComPlus Extension. + /// + public ComPlusDecompiler() + { + this.TableDefinitions = ComPlusExtensionData.GetExtensionTableDefinitions(); + } + + /// + /// Get the extensions library to be removed. + /// + /// Table definitions for library. + /// Library to remove from decompiled output. + public override Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions) + { + return ComPlusExtensionData.GetExtensionLibrary(tableDefinitions); + } + + /// + /// Decompiles an extension table. + /// + /// The table to decompile. + public override void DecompileTable(Table table) + { + switch (table.Name) + { + case "ComPlusPartition": + this.DecompileComPlusPartitionTable(table); + break; + case "ComPlusPartitionProperty": + this.DecompileComPlusPartitionPropertyTable(table); + break; + case "ComPlusPartitionRole": + this.DecompileComPlusPartitionRoleTable(table); + break; + case "ComPlusUserInPartitionRole": + this.DecompileComPlusUserInPartitionRoleTable(table); + break; + case "ComPlusGroupInPartitionRole": + this.DecompileComPlusGroupInPartitionRoleTable(table); + break; + case "ComPlusPartitionUser": + this.DecompileComPlusPartitionUserTable(table); + break; + case "ComPlusApplication": + this.DecompileComPlusApplicationTable(table); + break; + case "ComPlusApplicationProperty": + this.DecompileComPlusApplicationPropertyTable(table); + break; + case "ComPlusApplicationRole": + this.DecompileComPlusApplicationRoleTable(table); + break; + case "ComPlusApplicationRoleProperty": + this.DecompileComPlusApplicationRolePropertyTable(table); + break; + case "ComPlusUserInApplicationRole": + this.DecompileComPlusUserInApplicationRoleTable(table); + break; + case "ComPlusGroupInApplicationRole": + this.DecompileComPlusGroupInApplicationRoleTable(table); + break; + case "ComPlusAssembly": + this.DecompileComPlusAssemblyTable(table); + break; + case "ComPlusComponent": + this.DecompileComPlusComponentTable(table); + break; + case "ComPlusComponentProperty": + this.DecompileComPlusComponentPropertyTable(table); + break; + case "ComPlusRoleForComponent": + this.DecompileComPlusRoleForComponentTable(table); + break; + case "ComPlusInterface": + this.DecompileComPlusInterfaceTable(table); + break; + case "ComPlusInterfaceProperty": + this.DecompileComPlusInterfacePropertyTable(table); + break; + case "ComPlusRoleForInterface": + this.DecompileComPlusRoleForInterfaceTable(table); + break; + case "ComPlusMethod": + this.DecompileComPlusMethodTable(table); + break; + case "ComPlusMethodProperty": + this.DecompileComPlusMethodPropertyTable(table); + break; + case "ComPlusRoleForMethod": + this.DecompileComPlusRoleForMethodTable(table); + break; + case "ComPlusSubscription": + this.DecompileComPlusSubscriptionTable(table); + break; + case "ComPlusSubscriptionProperty": + this.DecompileComPlusSubscriptionPropertyTable(table); + break; + default: + base.DecompileTable(table); + break; + } + } + + /// + /// Decompile the ComPlusPartition table. + /// + /// The table to decompile. + private void DecompileComPlusPartitionTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusPartition partition = new ComPlus.ComPlusPartition(); + + partition.Id = (string)row[0]; + + if (null != row[2]) + { + partition.PartitionId = (string)row[2]; + } + + if (null != row[3]) + { + partition.Name = (string)row[3]; + } + + if (null != row[1]) + { + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[1]); + if (null != component) + { + component.AddChild(partition); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[1], "Component")); + } + } + else + { + this.Core.RootElement.AddChild(partition); + } + this.Core.IndexElement(row, partition); + } + } + + /// + /// Decompile the ComPlusPartitionProperty table. + /// + /// The table to decompile. + private void DecompileComPlusPartitionPropertyTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusPartition partition = (ComPlus.ComPlusPartition)this.Core.GetIndexedElement("ComPlusPartition", (string)row[0]); + if (null == partition) + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Partition_", (string)row[0], "ComPlusPartition")); + } + + switch ((string)row[1]) + { + case "Changeable": + switch ((string)row[2]) + { + case "1": + partition.Changeable = ComPlus.YesNoType.yes; + break; + case "0": + partition.Changeable = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "Deleteable": + switch ((string)row[2]) + { + case "1": + partition.Deleteable = ComPlus.YesNoType.yes; + break; + case "0": + partition.Deleteable = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "Description": + partition.Description = (string)row[2]; + break; + default: + // TODO: Warning + break; + } + } + } + + /// + /// Decompile the ComPlusPartitionRole table. + /// + /// The table to decompile. + private void DecompileComPlusPartitionRoleTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusPartitionRole partitionRole = new ComPlus.ComPlusPartitionRole(); + + partitionRole.Id = (string)row[0]; + partitionRole.Partition = (string)row[1]; + partitionRole.Name = (string)row[3]; + + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[2]); + if (null != component) + { + component.AddChild(partitionRole); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component")); + } + } + } + + /// + /// Decompile the ComPlusUserInPartitionRole table. + /// + /// The table to decompile. + private void DecompileComPlusUserInPartitionRoleTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusUserInPartitionRole userInPartitionRole = new ComPlus.ComPlusUserInPartitionRole(); + + userInPartitionRole.Id = (string)row[0]; + userInPartitionRole.PartitionRole = (string)row[1]; + userInPartitionRole.User = (string)row[3]; + + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[2]); + if (null != component) + { + component.AddChild(userInPartitionRole); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component")); + } + } + } + + /// + /// Decompile the ComPlusGroupInPartitionRole table. + /// + /// The table to decompile. + private void DecompileComPlusGroupInPartitionRoleTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusGroupInPartitionRole groupInPartitionRole = new ComPlus.ComPlusGroupInPartitionRole(); + + groupInPartitionRole.Id = (string)row[0]; + groupInPartitionRole.PartitionRole = (string)row[1]; + groupInPartitionRole.Group = (string)row[3]; + + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[2]); + if (null != component) + { + component.AddChild(groupInPartitionRole); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component")); + } + } + } + + /// + /// Decompile the ComPlusPartitionUser table. + /// + /// The table to decompile. + private void DecompileComPlusPartitionUserTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusPartitionUser partitionUser = new ComPlus.ComPlusPartitionUser(); + + partitionUser.Id = (string)row[0]; + partitionUser.Partition = (string)row[1]; + partitionUser.User = (string)row[3]; + + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[2]); + if (null != component) + { + component.AddChild(partitionUser); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component")); + } + } + } + + /// + /// Decompile the ComPlusApplication table. + /// + /// The table to decompile. + private void DecompileComPlusApplicationTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusApplication application = new ComPlus.ComPlusApplication(); + + application.Id = (string)row[0]; + application.Partition = (string)row[1]; + + if (null != row[3]) + { + application.ApplicationId = (string)row[3]; + } + + if (null != row[4]) + { + application.Name = (string)row[4]; + } + + if (null != row[2]) + { + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[1]); + if (null != component) + { + component.AddChild(application); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component")); + } + } + else + { + this.Core.RootElement.AddChild(application); + } + this.Core.IndexElement(row, application); + } + } + + /// + /// Decompile the ComPlusApplicationProperty table. + /// + /// The table to decompile. + private void DecompileComPlusApplicationPropertyTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusApplication application = (ComPlus.ComPlusApplication)this.Core.GetIndexedElement("ComPlusApplication", (string)row[0]); + if (null == application) + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Application_", (string)row[0], "ComPlusApplication")); + } + + switch ((string)row[1]) + { + case "3GigSupportEnabled": + switch ((string)row[2]) + { + case "1": + application.ThreeGigSupportEnabled = ComPlus.YesNoType.yes; + break; + case "0": + application.ThreeGigSupportEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "AccessChecksLevel": + switch ((string)row[2]) + { + case "0": + application.AccessChecksLevel = ComPlus.ComPlusApplication.AccessChecksLevelType.applicationLevel; + break; + case "1": + application.AccessChecksLevel = ComPlus.ComPlusApplication.AccessChecksLevelType.applicationComponentLevel; + break; + default: + // TODO: Warning + break; + } + break; + case "Activation": + switch ((string)row[2]) + { + case "Inproc": + application.Activation = ComPlus.ComPlusApplication.ActivationType.inproc; + break; + case "Local": + application.Activation = ComPlus.ComPlusApplication.ActivationType.local; + break; + default: + // TODO: Warning + break; + } + break; + case "ApplicationAccessChecksEnabled": + switch ((string)row[2]) + { + case "1": + application.ApplicationAccessChecksEnabled = ComPlus.YesNoType.yes; + break; + case "0": + application.ApplicationAccessChecksEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "ApplicationDirectory": + application.ApplicationDirectory = (string)row[2]; + break; + case "Authentication": + switch ((string)row[2]) + { + case "0": + application.Authentication = ComPlus.ComPlusApplication.AuthenticationType.@default; + break; + case "1": + application.Authentication = ComPlus.ComPlusApplication.AuthenticationType.none; + break; + case "2": + application.Authentication = ComPlus.ComPlusApplication.AuthenticationType.connect; + break; + case "3": + application.Authentication = ComPlus.ComPlusApplication.AuthenticationType.call; + break; + case "4": + application.Authentication = ComPlus.ComPlusApplication.AuthenticationType.packet; + break; + case "5": + application.Authentication = ComPlus.ComPlusApplication.AuthenticationType.integrity; + break; + case "6": + application.Authentication = ComPlus.ComPlusApplication.AuthenticationType.privacy; + break; + default: + // TODO: Warning + break; + } + break; + case "AuthenticationCapability": + switch ((string)row[2]) + { + case "0": + application.AuthenticationCapability = ComPlus.ComPlusApplication.AuthenticationCapabilityType.none; + break; + case "2": + application.AuthenticationCapability = ComPlus.ComPlusApplication.AuthenticationCapabilityType.secureReference; + break; + case "32": + application.AuthenticationCapability = ComPlus.ComPlusApplication.AuthenticationCapabilityType.staticCloaking; + break; + case "64": + application.AuthenticationCapability = ComPlus.ComPlusApplication.AuthenticationCapabilityType.dynamicCloaking; + break; + default: + // TODO: Warning + break; + } + break; + case "Changeable": + switch ((string)row[2]) + { + case "1": + application.Changeable = ComPlus.YesNoType.yes; + break; + case "0": + application.Changeable = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "CommandLine": + application.CommandLine = (string)row[2]; + break; + case "ConcurrentApps": + int concurrentApps; + if (Int32.TryParse((string)row[2], out concurrentApps)) + { + application.ConcurrentApps = concurrentApps; + } + else + { + // TODO: Warning + } + break; + case "CreatedBy": + application.CreatedBy = (string)row[2]; + break; + case "CRMEnabled": + switch ((string)row[2]) + { + case "1": + application.CRMEnabled = ComPlus.YesNoType.yes; + break; + case "0": + application.CRMEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "CRMLogFile": + application.CRMLogFile = (string)row[2]; + break; + case "Deleteable": + switch ((string)row[2]) + { + case "1": + application.Deleteable = ComPlus.YesNoType.yes; + break; + case "0": + application.Deleteable = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "Description": + application.Description = (string)row[2]; + break; + case "DumpEnabled": + switch ((string)row[2]) + { + case "1": + application.DumpEnabled = ComPlus.YesNoType.yes; + break; + case "0": + application.DumpEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "DumpOnException": + switch ((string)row[2]) + { + case "1": + application.DumpOnException = ComPlus.YesNoType.yes; + break; + case "0": + application.DumpOnException = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "DumpOnFailfast": + switch ((string)row[2]) + { + case "1": + application.DumpOnFailfast = ComPlus.YesNoType.yes; + break; + case "0": + application.DumpOnFailfast = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "DumpPath": + application.DumpPath = (string)row[2]; + break; + case "EventsEnabled": + switch ((string)row[2]) + { + case "1": + application.EventsEnabled = ComPlus.YesNoType.yes; + break; + case "0": + application.EventsEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "Identity": + application.Identity = (string)row[2]; + break; + case "ImpersonationLevel": + switch ((string)row[2]) + { + case "1": + application.ImpersonationLevel = ComPlus.ComPlusApplication.ImpersonationLevelType.anonymous; + break; + case "2": + application.ImpersonationLevel = ComPlus.ComPlusApplication.ImpersonationLevelType.identify; + break; + case "3": + application.ImpersonationLevel = ComPlus.ComPlusApplication.ImpersonationLevelType.impersonate; + break; + case "4": + application.ImpersonationLevel = ComPlus.ComPlusApplication.ImpersonationLevelType.@delegate; + break; + default: + // TODO: Warning + break; + } + break; + case "IsEnabled": + switch ((string)row[2]) + { + case "1": + application.IsEnabled = ComPlus.YesNoType.yes; + break; + case "0": + application.IsEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "MaxDumpCount": + int maxDumpCount; + if (Int32.TryParse((string)row[2], out maxDumpCount)) + { + application.MaxDumpCount = maxDumpCount; + } + else + { + // TODO: Warning + } + break; + case "Password": + application.Password = (string)row[2]; + break; + case "QCAuthenticateMsgs": + switch ((string)row[2]) + { + case "0": + application.QCAuthenticateMsgs = ComPlus.ComPlusApplication.QCAuthenticateMsgsType.secureApps; + break; + case "1": + application.QCAuthenticateMsgs = ComPlus.ComPlusApplication.QCAuthenticateMsgsType.off; + break; + case "2": + application.QCAuthenticateMsgs = ComPlus.ComPlusApplication.QCAuthenticateMsgsType.on; + break; + default: + // TODO: Warning + break; + } + break; + case "QCListenerMaxThreads": + int qcListenerMaxThreads; + if (Int32.TryParse((string)row[2], out qcListenerMaxThreads)) + { + application.QCListenerMaxThreads = qcListenerMaxThreads; + } + else + { + // TODO: Warning + } + break; + case "QueueListenerEnabled": + switch ((string)row[2]) + { + case "1": + application.QueueListenerEnabled = ComPlus.YesNoType.yes; + break; + case "0": + application.QueueListenerEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "QueuingEnabled": + switch ((string)row[2]) + { + case "1": + application.QueuingEnabled = ComPlus.YesNoType.yes; + break; + case "0": + application.QueuingEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "RecycleActivationLimit": + int recycleActivationLimit; + if (Int32.TryParse((string)row[2], out recycleActivationLimit)) + { + application.RecycleActivationLimit = recycleActivationLimit; + } + else + { + // TODO: Warning + } + break; + case "RecycleCallLimit": + int recycleCallLimit; + if (Int32.TryParse((string)row[2], out recycleCallLimit)) + { + application.RecycleCallLimit = recycleCallLimit; + } + else + { + // TODO: Warning + } + break; + case "RecycleExpirationTimeout": + int recycleExpirationTimeout; + if (Int32.TryParse((string)row[2], out recycleExpirationTimeout)) + { + application.RecycleExpirationTimeout = recycleExpirationTimeout; + } + else + { + // TODO: Warning + } + break; + case "RecycleLifetimeLimit": + int recycleLifetimeLimit; + if (Int32.TryParse((string)row[2], out recycleLifetimeLimit)) + { + application.RecycleLifetimeLimit = recycleLifetimeLimit; + } + else + { + // TODO: Warning + } + break; + case "RecycleMemoryLimit": + int recycleMemoryLimit; + if (Int32.TryParse((string)row[2], out recycleMemoryLimit)) + { + application.RecycleMemoryLimit = recycleMemoryLimit; + } + else + { + // TODO: Warning + } + break; + case "Replicable": + switch ((string)row[2]) + { + case "1": + application.Replicable = ComPlus.YesNoType.yes; + break; + case "0": + application.Replicable = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "RunForever": + switch ((string)row[2]) + { + case "1": + application.RunForever = ComPlus.YesNoType.yes; + break; + case "0": + application.RunForever = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "ShutdownAfter": + int shutdownAfter; + if (Int32.TryParse((string)row[2], out shutdownAfter)) + { + application.ShutdownAfter = shutdownAfter; + } + else + { + // TODO: Warning + } + break; + case "SoapActivated": + switch ((string)row[2]) + { + case "1": + application.SoapActivated = ComPlus.YesNoType.yes; + break; + case "0": + application.SoapActivated = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "SoapBaseUrl": + application.SoapBaseUrl = (string)row[2]; + break; + case "SoapMailTo": + application.SoapMailTo = (string)row[2]; + break; + case "SoapVRoot": + application.SoapVRoot = (string)row[2]; + break; + case "SRPEnabled": + switch ((string)row[2]) + { + case "1": + application.SRPEnabled = ComPlus.YesNoType.yes; + break; + case "0": + application.SRPEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "SRPTrustLevel": + switch ((string)row[2]) + { + case "0": + application.SRPTrustLevel = ComPlus.ComPlusApplication.SRPTrustLevelType.disallowed; + break; + case "262144": + application.SRPTrustLevel = ComPlus.ComPlusApplication.SRPTrustLevelType.fullyTrusted; + break; + default: + // TODO: Warning + break; + } + break; + default: + // TODO: Warning + break; + } + } + } + + /// + /// Decompile the ComPlusApplicationRole table. + /// + /// The table to decompile. + private void DecompileComPlusApplicationRoleTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusApplicationRole applicationRole = new ComPlus.ComPlusApplicationRole(); + + applicationRole.Id = (string)row[0]; + applicationRole.Application = (string)row[1]; + + if (null != row[3]) + { + applicationRole.Name = (string)row[3]; + } + + if (null != row[2]) + { + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[2]); + if (null != component) + { + component.AddChild(applicationRole); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component")); + } + } + else + { + this.Core.RootElement.AddChild(applicationRole); + } + this.Core.IndexElement(row, applicationRole); + } + } + + /// + /// Decompile the ComPlusApplicationRoleProperty table. + /// + /// The table to decompile. + private void DecompileComPlusApplicationRolePropertyTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusApplicationRole applicationRole = (ComPlus.ComPlusApplicationRole)this.Core.GetIndexedElement("ComPlusApplicationRole", (string)row[0]); + if (null == applicationRole) + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ApplicationRole_", (string)row[0], "ComPlusApplicationRole")); + } + + switch ((string)row[1]) + { + case "Description": + applicationRole.Description = (string)row[2]; + break; + default: + // TODO: Warning + break; + } + } + } + + /// + /// Decompile the ComPlusUserInApplicationRole table. + /// + /// The table to decompile. + private void DecompileComPlusUserInApplicationRoleTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusUserInApplicationRole userInApplicationRole = new ComPlus.ComPlusUserInApplicationRole(); + + userInApplicationRole.Id = (string)row[0]; + userInApplicationRole.ApplicationRole = (string)row[1]; + userInApplicationRole.User = (string)row[3]; + + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[2]); + if (null != component) + { + component.AddChild(userInApplicationRole); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component")); + } + } + } + + /// + /// Decompile the ComPlusGroupInApplicationRole table. + /// + /// The table to decompile. + private void DecompileComPlusGroupInApplicationRoleTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusGroupInApplicationRole groupInApplicationRole = new ComPlus.ComPlusGroupInApplicationRole(); + + groupInApplicationRole.Id = (string)row[0]; + groupInApplicationRole.ApplicationRole = (string)row[1]; + groupInApplicationRole.Group = (string)row[3]; + + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[2]); + if (null != component) + { + component.AddChild(groupInApplicationRole); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component")); + } + } + } + + /// + /// Decompile the ComPlusAssembly table. + /// + /// The table to decompile. + private void DecompileComPlusAssemblyTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusAssembly assembly = new ComPlus.ComPlusAssembly(); + + assembly.Id = (string)row[0]; + assembly.Application = (string)row[1]; + + if (null != row[3]) + { + assembly.AssemblyName = (string)row[3]; + } + + if (null != row[4]) + { + assembly.DllPath = (string)row[4]; + } + + if (null != row[5]) + { + assembly.TlbPath = (string)row[5]; + } + + if (null != row[6]) + { + assembly.PSDllPath = (string)row[6]; + } + + int attributes = (int)row[7]; + + if (0 != (attributes & (int)ComPlusCompiler.CpiAssemblyAttributes.EventClass)) + { + assembly.EventClass = ComPlus.YesNoType.yes; + } + + if (0 != (attributes & (int)ComPlusCompiler.CpiAssemblyAttributes.DotNetAssembly)) + { + assembly.Type = ComPlus.ComPlusAssembly.TypeType.net; + } + + if (0 != (attributes & (int)ComPlusCompiler.CpiAssemblyAttributes.DllPathFromGAC)) + { + assembly.DllPathFromGAC = ComPlus.YesNoType.yes; + } + + if (0 != (attributes & (int)ComPlusCompiler.CpiAssemblyAttributes.RegisterInCommit)) + { + assembly.RegisterInCommit = ComPlus.YesNoType.yes; + } + + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[2]); + if (null != component) + { + component.AddChild(assembly); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component")); + } + this.Core.IndexElement(row, assembly); + } + } + + /// + /// Decompile the ComPlusAssemblyDependency table. + /// + /// The table to decompile. + private void DecompileComPlusAssemblyDependencyTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusAssemblyDependency assemblyDependency = new ComPlus.ComPlusAssemblyDependency(); + + assemblyDependency.RequiredAssembly = (string)row[1]; + + ComPlus.ComPlusAssembly assembly = (ComPlus.ComPlusAssembly)this.Core.GetIndexedElement("ComPlusAssembly", (string)row[0]); + if (null != assembly) + { + assembly.AddChild(assemblyDependency); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Assembly_", (string)row[0], "ComPlusAssembly")); + } + } + } + + /// + /// Decompile the ComPlusComponent table. + /// + /// The table to decompile. + private void DecompileComPlusComponentTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusComponent comPlusComponent = new ComPlus.ComPlusComponent(); + + comPlusComponent.Id = (string)row[0]; + + try + { + Guid clsid = new Guid((string)row[2]); + comPlusComponent.CLSID = clsid.ToString().ToUpper(); + } + catch + { + // TODO: Warning + } + + ComPlus.ComPlusAssembly assembly = (ComPlus.ComPlusAssembly)this.Core.GetIndexedElement("ComPlusAssembly", (string)row[1]); + if (null != assembly) + { + assembly.AddChild(comPlusComponent); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Assembly_", (string)row[1], "ComPlusAssembly")); + } + this.Core.IndexElement(row, comPlusComponent); + } + } + + /// + /// Decompile the ComPlusComponentProperty table. + /// + /// The table to decompile. + private void DecompileComPlusComponentPropertyTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusComponent comPlusComponent = (ComPlus.ComPlusComponent)this.Core.GetIndexedElement("ComPlusComponent", (string)row[0]); + if (null == comPlusComponent) + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ComPlusComponent_", (string)row[0], "ComPlusComponent")); + } + + switch ((string)row[1]) + { + case "AllowInprocSubscribers": + switch ((string)row[2]) + { + case "1": + comPlusComponent.AllowInprocSubscribers = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.AllowInprocSubscribers = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "ComponentAccessChecksEnabled": + switch ((string)row[2]) + { + case "1": + comPlusComponent.ComponentAccessChecksEnabled = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.ComponentAccessChecksEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "ComponentTransactionTimeout": + int componentTransactionTimeout; + if (Int32.TryParse((string)row[2], out componentTransactionTimeout)) + { + comPlusComponent.ComponentTransactionTimeout = componentTransactionTimeout; + } + else + { + // TODO: Warning + } + break; + case "ComponentTransactionTimeoutEnabled": + switch ((string)row[2]) + { + case "1": + comPlusComponent.ComponentTransactionTimeoutEnabled = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.ComponentTransactionTimeoutEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "COMTIIntrinsics": + switch ((string)row[2]) + { + case "1": + comPlusComponent.COMTIIntrinsics = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.COMTIIntrinsics = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "ConstructionEnabled": + switch ((string)row[2]) + { + case "1": + comPlusComponent.ConstructionEnabled = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.ConstructionEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "ConstructorString": + comPlusComponent.ConstructorString = (string)row[2]; + break; + case "CreationTimeout": + int creationTimeout; + if (Int32.TryParse((string)row[2], out creationTimeout)) + { + comPlusComponent.CreationTimeout = creationTimeout; + } + else + { + // TODO: Warning + } + break; + case "Description": + comPlusComponent.Description = (string)row[2]; + break; + case "EventTrackingEnabled": + switch ((string)row[2]) + { + case "1": + comPlusComponent.EventTrackingEnabled = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.EventTrackingEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "ExceptionClass": + comPlusComponent.ExceptionClass = (string)row[2]; + break; + case "FireInParallel": + switch ((string)row[2]) + { + case "1": + comPlusComponent.FireInParallel = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.FireInParallel = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "IISIntrinsics": + switch ((string)row[2]) + { + case "1": + comPlusComponent.IISIntrinsics = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.IISIntrinsics = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "InitializesServerApplication": + switch ((string)row[2]) + { + case "1": + comPlusComponent.InitializesServerApplication = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.InitializesServerApplication = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "IsEnabled": + switch ((string)row[2]) + { + case "1": + comPlusComponent.IsEnabled = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.IsEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "IsPrivateComponent": + switch ((string)row[2]) + { + case "1": + comPlusComponent.IsPrivateComponent = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.IsPrivateComponent = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "JustInTimeActivation": + switch ((string)row[2]) + { + case "1": + comPlusComponent.JustInTimeActivation = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.JustInTimeActivation = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "LoadBalancingSupported": + switch ((string)row[2]) + { + case "1": + comPlusComponent.LoadBalancingSupported = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.LoadBalancingSupported = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "MaxPoolSize": + int maxPoolSize; + if (Int32.TryParse((string)row[2], out maxPoolSize)) + { + comPlusComponent.MaxPoolSize = maxPoolSize; + } + else + { + // TODO: Warning + } + break; + case "MinPoolSize": + int minPoolSize; + if (Int32.TryParse((string)row[2], out minPoolSize)) + { + comPlusComponent.MinPoolSize = minPoolSize; + } + else + { + // TODO: Warning + } + break; + case "MultiInterfacePublisherFilterCLSID": + comPlusComponent.MultiInterfacePublisherFilterCLSID = (string)row[2]; + break; + case "MustRunInClientContext": + switch ((string)row[2]) + { + case "1": + comPlusComponent.MustRunInClientContext = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.MustRunInClientContext = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "MustRunInDefaultContext": + switch ((string)row[2]) + { + case "1": + comPlusComponent.MustRunInDefaultContext = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.MustRunInDefaultContext = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "ObjectPoolingEnabled": + switch ((string)row[2]) + { + case "1": + comPlusComponent.ObjectPoolingEnabled = ComPlus.YesNoType.yes; + break; + case "0": + comPlusComponent.ObjectPoolingEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "PublisherID": + comPlusComponent.PublisherID = (string)row[2]; + break; + case "SoapAssemblyName": + comPlusComponent.SoapAssemblyName = (string)row[2]; + break; + case "SoapTypeName": + comPlusComponent.SoapTypeName = (string)row[2]; + break; + case "Synchronization": + switch ((string)row[2]) + { + case "0": + comPlusComponent.Synchronization = ComPlus.ComPlusComponent.SynchronizationType.ignored; + break; + case "1": + comPlusComponent.Synchronization = ComPlus.ComPlusComponent.SynchronizationType.none; + break; + case "2": + comPlusComponent.Synchronization = ComPlus.ComPlusComponent.SynchronizationType.supported; + break; + case "3": + comPlusComponent.Synchronization = ComPlus.ComPlusComponent.SynchronizationType.required; + break; + case "4": + comPlusComponent.Synchronization = ComPlus.ComPlusComponent.SynchronizationType.requiresNew; + break; + default: + // TODO: Warning + break; + } + break; + case "Transaction": + switch ((string)row[2]) + { + case "0": + comPlusComponent.Transaction = ComPlus.ComPlusComponent.TransactionType.ignored; + break; + case "1": + comPlusComponent.Transaction = ComPlus.ComPlusComponent.TransactionType.none; + break; + case "2": + comPlusComponent.Transaction = ComPlus.ComPlusComponent.TransactionType.supported; + break; + case "3": + comPlusComponent.Transaction = ComPlus.ComPlusComponent.TransactionType.required; + break; + case "4": + comPlusComponent.Transaction = ComPlus.ComPlusComponent.TransactionType.requiresNew; + break; + default: + // TODO: Warning + break; + } + break; + case "TxIsolationLevel": + switch ((string)row[2]) + { + case "0": + comPlusComponent.TxIsolationLevel = ComPlus.ComPlusComponent.TxIsolationLevelType.any; + break; + case "1": + comPlusComponent.TxIsolationLevel = ComPlus.ComPlusComponent.TxIsolationLevelType.readUnCommitted; + break; + case "2": + comPlusComponent.TxIsolationLevel = ComPlus.ComPlusComponent.TxIsolationLevelType.readCommitted; + break; + case "3": + comPlusComponent.TxIsolationLevel = ComPlus.ComPlusComponent.TxIsolationLevelType.repeatableRead; + break; + case "4": + comPlusComponent.TxIsolationLevel = ComPlus.ComPlusComponent.TxIsolationLevelType.serializable; + break; + default: + // TODO: Warning + break; + } + break; + default: + // TODO: Warning + break; + } + } + } + + /// + /// Decompile the ComPlusRoleForComponent table. + /// + /// The table to decompile. + private void DecompileComPlusRoleForComponentTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusRoleForComponent roleForComponent = new ComPlus.ComPlusRoleForComponent(); + + roleForComponent.Id = (string)row[0]; + roleForComponent.Component = (string)row[1]; + roleForComponent.ApplicationRole = (string)row[2]; + + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[3]); + if (null != component) + { + component.AddChild(roleForComponent); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[3], "Component")); + } + } + } + + /// + /// Decompile the ComPlusInterface table. + /// + /// The table to decompile. + private void DecompileComPlusInterfaceTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusInterface comPlusInterface = new ComPlus.ComPlusInterface(); + + comPlusInterface.Id = (string)row[0]; + + try + { + Guid iid = new Guid((string)row[2]); + comPlusInterface.IID = iid.ToString().ToUpper(); + } + catch + { + // TODO: Warning + } + + ComPlus.ComPlusComponent comPlusComponent = (ComPlus.ComPlusComponent)this.Core.GetIndexedElement("ComPlusComponent", (string)row[1]); + if (null != comPlusComponent) + { + comPlusComponent.AddChild(comPlusInterface); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ComPlusComponent_", (string)row[1], "ComPlusComponent")); + } + this.Core.IndexElement(row, comPlusInterface); + } + } + + /// + /// Decompile the ComPlusInterfaceProperty table. + /// + /// The table to decompile. + private void DecompileComPlusInterfacePropertyTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusInterface comPlusInterface = (ComPlus.ComPlusInterface)this.Core.GetIndexedElement("ComPlusInterface", (string)row[0]); + if (null == comPlusInterface) + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Interface_", (string)row[0], "ComPlusInterface")); + } + + switch ((string)row[1]) + { + case "Description": + comPlusInterface.Description = (string)row[2]; + break; + case "QueuingEnabled": + switch ((string)row[2]) + { + case "1": + comPlusInterface.QueuingEnabled = ComPlus.YesNoType.yes; + break; + case "0": + comPlusInterface.QueuingEnabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + default: + // TODO: Warning + break; + } + } + } + + /// + /// Decompile the ComPlusRoleForInterface table. + /// + /// The table to decompile. + private void DecompileComPlusRoleForInterfaceTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusRoleForInterface roleForInterface = new ComPlus.ComPlusRoleForInterface(); + + roleForInterface.Id = (string)row[0]; + roleForInterface.Interface = (string)row[1]; + roleForInterface.ApplicationRole = (string)row[2]; + + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[3]); + if (null != component) + { + component.AddChild(roleForInterface); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[3], "Component")); + } + } + } + + /// + /// Decompile the ComPlusMethod table. + /// + /// The table to decompile. + private void DecompileComPlusMethodTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusMethod comPlusMethod = new ComPlus.ComPlusMethod(); + + comPlusMethod.Id = (string)row[0]; + + if (null != row[2]) + { + comPlusMethod.Index = (int)row[2]; + } + + if (null != row[3]) + { + comPlusMethod.Name = (string)row[3]; + } + + ComPlus.ComPlusInterface comPlusInterface = (ComPlus.ComPlusInterface)this.Core.GetIndexedElement("ComPlusInterface", (string)row[1]); + if (null != comPlusInterface) + { + comPlusInterface.AddChild(comPlusMethod); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Interface_", (string)row[1], "ComPlusInterface")); + } + this.Core.IndexElement(row, comPlusMethod); + } + } + + /// + /// Decompile the ComPlusMethodProperty table. + /// + /// The table to decompile. + private void DecompileComPlusMethodPropertyTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusMethod comPlusMethod = (ComPlus.ComPlusMethod)this.Core.GetIndexedElement("ComPlusMethod", (string)row[0]); + if (null == comPlusMethod) + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Method_", (string)row[0], "ComPlusMethod")); + } + + switch ((string)row[1]) + { + case "AutoComplete": + switch ((string)row[2]) + { + case "1": + comPlusMethod.AutoComplete = ComPlus.YesNoType.yes; + break; + case "0": + comPlusMethod.AutoComplete = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "Description": + comPlusMethod.Description = (string)row[2]; + break; + default: + // TODO: Warning + break; + } + } + } + + /// + /// Decompile the ComPlusRoleForMethod table. + /// + /// The table to decompile. + private void DecompileComPlusRoleForMethodTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusRoleForMethod roleForMethod = new ComPlus.ComPlusRoleForMethod(); + + roleForMethod.Id = (string)row[0]; + roleForMethod.Method = (string)row[1]; + roleForMethod.ApplicationRole = (string)row[2]; + + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[3]); + if (null != component) + { + component.AddChild(roleForMethod); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[3], "Component")); + } + } + } + + /// + /// Decompile the ComPlusSubscription table. + /// + /// The table to decompile. + private void DecompileComPlusSubscriptionTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusSubscription subscription = new ComPlus.ComPlusSubscription(); + + subscription.Id = (string)row[0]; + subscription.Component = (string)row[1]; + subscription.SubscriptionId = (string)row[3]; + subscription.Name = (string)row[4]; + subscription.EventCLSID = (string)row[5]; + subscription.PublisherID = (string)row[6]; + + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[2]); + if (null != component) + { + component.AddChild(subscription); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component")); + } + this.Core.IndexElement(row, subscription); + } + } + + /// + /// Decompile the ComPlusSubscriptionProperty table. + /// + /// The table to decompile. + private void DecompileComPlusSubscriptionPropertyTable(Table table) + { + foreach (Row row in table.Rows) + { + ComPlus.ComPlusSubscription subscription = (ComPlus.ComPlusSubscription)this.Core.GetIndexedElement("ComPlusSubscription", (string)row[0]); + if (null == subscription) + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Subscription_", (string)row[0], "ComPlusSubscription")); + } + + switch ((string)row[1]) + { + case "Description": + subscription.Description = (string)row[2]; + break; + case "Enabled": + switch ((string)row[2]) + { + case "1": + subscription.Enabled = ComPlus.YesNoType.yes; + break; + case "0": + subscription.Enabled = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "EventClassPartitionID": + subscription.EventClassPartitionID = (string)row[2]; + break; + case "FilterCriteria": + subscription.FilterCriteria = (string)row[2]; + break; + case "InterfaceID": + subscription.InterfaceID = (string)row[2]; + break; + case "MachineName": + subscription.MachineName = (string)row[2]; + break; + case "MethodName": + subscription.MethodName = (string)row[2]; + break; + case "PerUser": + switch ((string)row[2]) + { + case "1": + subscription.PerUser = ComPlus.YesNoType.yes; + break; + case "0": + subscription.PerUser = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "Queued": + switch ((string)row[2]) + { + case "1": + subscription.Queued = ComPlus.YesNoType.yes; + break; + case "0": + subscription.Queued = ComPlus.YesNoType.no; + break; + default: + // TODO: Warning + break; + } + break; + case "SubscriberMoniker": + subscription.SubscriberMoniker = (string)row[2]; + break; + case "UserName": + subscription.UserName = (string)row[2]; + break; + default: + // TODO: Warning + break; + } + } + } + } +} diff --git a/src/wixext/ComPlusExtensionData.cs b/src/wixext/ComPlusExtensionData.cs new file mode 100644 index 00000000..cedc2474 --- /dev/null +++ b/src/wixext/ComPlusExtensionData.cs @@ -0,0 +1,64 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Extensions +{ + using System; + using System.Reflection; + using WixToolset.Data; + using WixToolset.Extensibility; + + /// + /// The WiX Toolset COM+ Extension. + /// + public sealed class ComPlusExtensionData : ExtensionData + { + /// + /// Gets the default culture. + /// + /// The default culture. + public override string DefaultCulture + { + get { return "en-us"; } + } + + /// + /// Gets the optional table definitions for this extension. + /// + /// The optional table definitions for this extension. + public override TableDefinitionCollection TableDefinitions + { + get + { + return ComPlusExtensionData.GetExtensionTableDefinitions(); + } + } + + /// + /// Gets the library associated with this extension. + /// + /// The table definitions to use while loading the library. + /// The loaded library. + public override Library GetLibrary(TableDefinitionCollection tableDefinitions) + { + return ComPlusExtensionData.GetExtensionLibrary(tableDefinitions); + } + + /// + /// Internal mechanism to access the extension's table definitions. + /// + /// Extension's table definitions. + internal static TableDefinitionCollection GetExtensionTableDefinitions() + { + return ExtensionData.LoadTableDefinitionHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.tables.xml"); + } + + /// + /// Internal mechanism to access the extension's library. + /// + /// Extension's library. + internal static Library GetExtensionLibrary(TableDefinitionCollection tableDefinitions) + { + return ExtensionData.LoadLibraryHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.complus.wixlib", tableDefinitions); + } + } +} diff --git a/src/wixext/WixComPlusExtension.csproj b/src/wixext/WixComPlusExtension.csproj new file mode 100644 index 00000000..92cbacae --- /dev/null +++ b/src/wixext/WixComPlusExtension.csproj @@ -0,0 +1,50 @@ + + + + + + + {1497B777-330B-4CFE-927A-22850CD24D64} + WixComPlusExtension + Library + WixToolset.Extensions + + + + + + + + $(RootNamespace).Data.Messages.resources + + + $(RootNamespace).Data.tables.xml + + + $(RootNamespace).Xsd.complus.xsd + + + WixToolset.Data.Serialize + WixToolset.Extensions.Serialize.ComPlus + + + complus.xsd + PreserveNewest + + + Data\complus.wixlib + + + + + + + + + + + false + + + + diff --git a/src/wixext/complus.xsd b/src/wixext/complus.xsd new file mode 100644 index 00000000..f7ddacc6 --- /dev/null +++ b/src/wixext/complus.xsd @@ -0,0 +1,944 @@ + + + + + + + + The source code schema for the WiX Toolset COM+ Extension. + + + + + + + + + + + + + + + Defines a COM+ partition. If this element is a child of a + Component element, the partition will be created in association with this + component. If the element is a child of any of the Fragment, Module or Product + elements it is considered to be a locater, referencing an existing partition. + + + + + + + + + + + + + Identifier for the element. + + + + + Id for the partition. This attribute can be omitted, in + which case an id will be generated on install. If the element is a locater, + this attribute can be omitted if a value is provided for the Name attribute. + + + + + Name of the partition. This attribute can be omitted if + the element is a locater, and a value is provided for the PartitionId + attribute. + + + + + + + + + + + + + + + + + + Defines a COM+ partition role. Partition roles can not be + created; this element can only be used as a locater to reference an existing + role. + + + + + + + + + + + + Identifier for the element. + + + + + The id of a ComPlusPartition element representing the partition + the role belongs to. + + + + + Name of the partition role. + + + + + + + + + + + + This element represents a user membership in a partition + role. When the parent component of this element is installed, the user will be + added to the associated partition role. + + + + + + Identifier for the element. + + + + + The id of a ComPlusPartitionRole element representing the + partition the user should be added to. + + + + + Foreign key into the User table. + + + + + + + + + + + + This element represents a security group membership in a + partition role. When the parent component of this element is installed, the + security group will be added to the associated partition role. + + + + + + Identifier for the element. + + + + + The id of a ComPlusPartitionRole element representing the + partition the user should be added to. + + + + + Foreign key into the Group table. + + + + + + + + + + + + Represents a default partition definition for a user. When + the parent component of this element is installed, the default partition of the + user will be set to the referenced partition. + + + + + + Identifier for the element. + + + + + The id of a ComPlusPartition element representing the + partition that will be the default partition for the user. + + + + + Foreign key into the User table. + + + + + + + + + + + + + + + Defines a COM+ application. If this element is a descendent + of a Component element, the application will be created in association with + this component. If the element is a child of any of the Fragment, Module or + Product elements it is considered to be a locater, referencing an existing + application. + + If the element is a child of a ComPlusPartition element, + or have its Partition attribute set, the application will be installed under + the referenced partition. + + + + + + + + + + + + Identifier for the element. + + + + + If the element is not a child of a ComPlusPartition + element, this attribute can be provided with the id of a ComPlusPartition + element representing the partition the application belongs to. + + + + + Id for the application. This attribute can be omitted, in + which case an id will be generated on install. If the element is a locater, + this attribute can be omitted if a value is provided for the Name attribute. + + + + + Name of the application. This attribute can be omitted if + the element is a locater, and a value is provided for the PartitionId + attribute. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Defines an application role. If this element is a descendent + of a Component element, the application role will be created in association + with this component. If the element is a child of any of the Fragment, Module + or Product elements it is considered to be a locater, referencing an existing + application role. + + + + + + + + + + + + Identifier for the element. + + + + + If the element is not a child of a ComPlusApplication + element, this attribute should be provided with the id of a + ComPlusApplication element representing the application the role belongs to. + + + + + Name of the application role. + + + + + + + + + + + + + This element represents a user membership in an + application role. When the parent component of this element is installed, the + user will be added to the associated application role. This element must be a descendent + of a Component element; it can not be a child of a ComPlusApplicationRole + locater element. To reference a locater element use the ApplicationRole + attribute. + + + + + + Identifier for the element. + + + + + If the element is not a child of a ComPlusApplicationRole + element, this attribute should be provided with the id of a + ComPlusApplicationRole element representing the application role the user is + to be added to. + + + + + Foreign key into the User table. + + + + + + + + + + + + This element represents a security group membership in an + application role. When the parent component of this element is installed, the + user will be added to the associated application role. This element must be a + descendent of a Component element; it can not be a child of a + ComPlusApplicationRole locater element. To reference a locater element use the + ApplicationRole attribute. + + + + + + Identifier for the element. + + + + + If the element is not a child of a ComPlusApplicationRole + element, this attribute should be provided with the id of a + ComPlusApplicationRole element representing the application role the user is + to be added to. + + + + + Foreign key into the Group table. + + + + + + + + + Represents a DLL or assembly to be registered with COM+. If + this element is a child of a ComPlusApplication element, the assembly will be + registered in this application. Other ways the Application attribute must be + set to an application. The element must be a descendent of a Component element, + it can not be a child of a ComPlusApplication locator element. + + + + + + When installing a native assembly, all components + contained in the assembly must be represented as ComPlusComponent elements + under this element. Any component not listed will not be removed during + uninstall. + + + + The fields DllPath, TlbPath and PSDllPath are formatted + fields that should contain file paths to there respective file types. A typical + value for DllPath for example, should be something like “[#MyAssembly_dll]”, + where “MyAssembly_dll” is the key of the dll file in the File table. + + + + Warning: The assembly name provided in the AssemblyName + attribute must be a fully specified assembly name, if a partial name is + provided a random assembly matching the partial name will be selected. + + + + + + + + + + + + + + Identifier for the element. + + + + + If the element is not a child of a ComPlusApplication + element, this attribute should be provided with the id of a ComPlusApplication + element representing the application the assembly is to be registered in. + This attribute can be omitted for a .NET assembly even if the application is + not a child of a ComPlusApplication element. + + + + + The name of the assembly used to identify the assembly in + the GAC. This attribute can be provided only if DllPathFromGAC is set to + “yes”. + + + + + The path to locate the assembly DLL during registration. + This attribute should be provided if DllPathFromGAC is not set to “yes”. + + + + + An optional path to an external type lib for the assembly. + This attribute must be provided if the Type attribute is set to “.net”. + + + + + An optional path to an external proxy/stub DLL for the assembly. + + + + + + + + + + + + + + + Indicates that the assembly is to be installed as an event + class DLL. This attribute is only valid for native assemblies. The assembly + will be installed with the COM+ catalog’s InstallEventClass() function. + + + + + Indicates that the DLL path should be extracted from the + GAC instead for being provided in the DllPath attribute. If this attribute is + set to “yes”, the name of the assembly can be provided using the AssemblyName + attribute. Or, if this AssemblyName attribute is missing, the name will be + extracted from the MsiAssemblyName table using the id of the parent Component + element. + + + + + Indicates that the assembly should be installed in the + commit custom action instead of the normal deferred custom action. This is + necessary when installing .NET assemblies to the GAC in the same + installation, as the assemblies are not visible in the GAC until after the + InstallFinalize action has run. + + + + + + + + + Defines a dependency between two assemblies. This element + affects the order in which assembles are registered. Any assemblies referenced + by this element are guarantied to be registered before, and unregistered after, + the assembly referenced by the parent ComPlusAssembly element. + + + + It is only necessary to explicitly specify dependencies between + assemblies contained in the same package (MSI or MSM). Assemblies merged in to a + package from a merge module will always be installed before any assemblies + specified in the base package. Assemblies merged in from different merge + modules are sequenced using the ModuleDependency MSI table. It is not possible + to have cross dependencies between merge modules or have an assembly in a merge + module depend on an assembly in the base package. + + + + + + + Reference to the id of the assembly required by the parent + ComPlusAssembly element. + + + + + + + + Represents a COM+ component in an assembly. + + + + + + + + + + + + Identifier for the element. + + + + + CLSID of the component. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Represents a role assignment to a COM+ component. + + + + + + Identifier for the element. + + + + + If the element is not a child of a ComPlusComponent + element, this attribute should be provided with the id of a ComPlusComponent + element representing the component the role is to be added to. + + + + + Id of the ComPlusApplicationRole element representing the + role that shall be granted access to the component. + + + + + + + + Represents an interface for a COM+ component. + + + + + + + + + + + Identifier for the element. + + + + + IID of the interface. + + + + + + + + + + + + + + Represents a role assignment to an interface. + + + + + + Identifier for the element. + + + + + If the element is not a child of a ComPlusInterface + element, this attribute should be provided with the id of a ComPlusInterface + element representing the interface the role is to be added to. + + + + + Id of the ComPlusApplicationRole element representing the + role that shall be granted access to the interface. + + + + + + + + + Represents a method for an interface. + + + + + + + + + + Identifier for the element. + + + + + + + Dispatch id of the method. If this attribute is not set a + value must be provided for the Name attribute. + + + + + + + Name of the method. If this attribute is not set a value + must be provided for the Index attribute. + + + + + + + + + + + + + + + Represents a role assignment to a COM+ method. + + + + + + Identifier for the element. + + + + + If the element is not a child of a ComPlusMethod element, + this attribute should be provided with the id of a ComPlusMethod element + representing the method the role is to be added to. + + + + + Id of the ComPlusApplicationRole element representing the + role that shall be granted access to the method. + + + + + + + + + + + + Defines an event subscription for a COM+ component. + + + + + + Identifier for the element. + + + + + If the element is not a child of a ComPlusComponent + element, this attribute should be provided with the id of a ComPlusComponent + element representing the component the subscription is to be created for. + + + + + Id of the subscription. If a value is not provided for + this attribute, an id will be generated during installation. + + + + + Name of the subscription. + + + + + CLSID of the event class for the subscription. If a value + for this attribute is not provided, a value for the PublisherID attribute + must be provided. + + + + + Publisher id for the subscription. If a value for this + attribute is not provided, a value for the EventCLSID attribute must be + provided. + + + + + + + + + + + + + + + + + + + Values of this type will either be "yes" or "no". + + + + + + + + + + Values of this type will look like: "01234567-89AB-CDEF-0123-456789ABCDEF". + + + + + + + diff --git a/src/wixext/messages.xml b/src/wixext/messages.xml new file mode 100644 index 00000000..66c0a9e6 --- /dev/null +++ b/src/wixext/messages.xml @@ -0,0 +1,77 @@ + + + + + + + + + The {0}/@{1} attribute cannot be specified unless the element has a component as an ancestor. A {0} that does not have a component ancestor is not installed. + + + + + + + The {0} element cannot be specified unless the element has a component as an ancestor. A {0} that does not have a component ancestor is not installed. + + + + + + The {0}/@{1} attribute cannot coexist with the {2} attribute's value of '{3}'. + + + + + + + The {0}/@{1} attribute's value, '{2}', cannot coexist with the {3} attribute's value of '{4}'. + + + + + + + + + + The {0}/@{1} cannot be provided unless the {2} attribute is provided with a value of '{3}'. + + + + + + + + + The {0}/@{1} attribute must be provided when {0} element is nested under a component. + + + + + + + A {0} element must have either a {1} attribute or a {2} attribute, or both set. + + + + + + + + A {0} element not nested under a component must have either a {1} attribute or a {2} attribute, or both set. + + + + + + + + + The ComPlusAssembly element has a Type attribute with a value of 'native', but the element does not contain any ComPlusComponent elements. All components contained in a native assembly must be listed, or they will not be correctly removed during uninstall. + + + + + diff --git a/src/wixext/tables.xml b/src/wixext/tables.xml new file mode 100644 index 00000000..3c3d1728 --- /dev/null +++ b/src/wixext/tables.xml @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3-55-g6feb