diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2019-01-20 09:19:12 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2019-01-20 09:19:12 -0600 |
commit | 4d30ab70573f9734d7fd3cd4d54c02173fa281db (patch) | |
tree | 01cc70c5a0ce7962240dcb8e7fcc23db0c656a31 /src/wixext | |
parent | 81e205ed6eecb97da9694df58b9057a2f9f6b54d (diff) | |
download | wix-4d30ab70573f9734d7fd3cd4d54c02173fa281db.tar.gz wix-4d30ab70573f9734d7fd3cd4d54c02173fa281db.tar.bz2 wix-4d30ab70573f9734d7fd3cd4d54c02173fa281db.zip |
Import code from old v4 repo
Diffstat (limited to 'src/wixext')
-rw-r--r-- | src/wixext/HttpCompiler.cs | 280 | ||||
-rw-r--r-- | src/wixext/HttpConstants.cs | 19 | ||||
-rw-r--r-- | src/wixext/HttpDecompiler.cs | 135 | ||||
-rw-r--r-- | src/wixext/HttpExtensionData.cs | 64 | ||||
-rw-r--r-- | src/wixext/WixHttpExtension.csproj | 48 | ||||
-rw-r--r-- | src/wixext/http.xsd | 148 | ||||
-rw-r--r-- | src/wixext/messages.xml | 13 | ||||
-rw-r--r-- | src/wixext/tables.xml | 28 |
8 files changed, 735 insertions, 0 deletions
diff --git a/src/wixext/HttpCompiler.cs b/src/wixext/HttpCompiler.cs new file mode 100644 index 00000000..c694ccde --- /dev/null +++ b/src/wixext/HttpCompiler.cs | |||
@@ -0,0 +1,280 @@ | |||
1 | // 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. | ||
2 | |||
3 | namespace WixToolset.Extensions | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections.Generic; | ||
7 | using System.Globalization; | ||
8 | using System.Xml.Linq; | ||
9 | using WixToolset.Data; | ||
10 | using WixToolset.Extensibility; | ||
11 | |||
12 | /// <summary> | ||
13 | /// The compiler for the WiX Toolset Http Extension. | ||
14 | /// </summary> | ||
15 | public sealed class HttpCompiler : CompilerExtension | ||
16 | { | ||
17 | /// <summary> | ||
18 | /// Instantiate a new HttpCompiler. | ||
19 | /// </summary> | ||
20 | public HttpCompiler() | ||
21 | { | ||
22 | this.Namespace = "http://wixtoolset.org/schemas/v4/wxs/http"; | ||
23 | } | ||
24 | |||
25 | /// <summary> | ||
26 | /// Processes an element for the Compiler. | ||
27 | /// </summary> | ||
28 | /// <param name="sourceLineNumbers">Source line number for the parent element.</param> | ||
29 | /// <param name="parentElement">Parent element of element to process.</param> | ||
30 | /// <param name="element">Element to process.</param> | ||
31 | /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param> | ||
32 | public override void ParseElement(XElement parentElement, XElement element, IDictionary<string, string> context) | ||
33 | { | ||
34 | switch (parentElement.Name.LocalName) | ||
35 | { | ||
36 | case "ServiceInstall": | ||
37 | string serviceInstallName = context["ServiceInstallName"]; | ||
38 | string serviceUser = String.IsNullOrEmpty(serviceInstallName) ? null : String.Concat("NT SERVICE\\", serviceInstallName); | ||
39 | string serviceComponentId = context["ServiceInstallComponentId"]; | ||
40 | |||
41 | switch (element.Name.LocalName) | ||
42 | { | ||
43 | case "UrlReservation": | ||
44 | this.ParseUrlReservationElement(element, serviceComponentId, serviceUser); | ||
45 | break; | ||
46 | default: | ||
47 | this.Core.UnexpectedElement(parentElement, element); | ||
48 | break; | ||
49 | } | ||
50 | break; | ||
51 | case "Component": | ||
52 | string componentId = context["ComponentId"]; | ||
53 | |||
54 | switch (element.Name.LocalName) | ||
55 | { | ||
56 | case "UrlReservation": | ||
57 | this.ParseUrlReservationElement(element, componentId, null); | ||
58 | break; | ||
59 | default: | ||
60 | this.Core.UnexpectedElement(parentElement, element); | ||
61 | break; | ||
62 | } | ||
63 | break; | ||
64 | default: | ||
65 | this.Core.UnexpectedElement(parentElement, element); | ||
66 | break; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | /// <summary> | ||
71 | /// Parses a UrlReservation element. | ||
72 | /// </summary> | ||
73 | /// <param name="node">The element to parse.</param> | ||
74 | /// <param name="componentId">Identifier of the component that owns this URL reservation.</param> | ||
75 | /// <param name="securityPrincipal">The security principal of the parent element (null if nested under Component).</param> | ||
76 | private void ParseUrlReservationElement(XElement node, string componentId, string securityPrincipal) | ||
77 | { | ||
78 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | ||
79 | Identifier id = null; | ||
80 | int handleExisting = HttpConstants.heReplace; | ||
81 | string handleExistingValue = null; | ||
82 | string sddl = null; | ||
83 | string url = null; | ||
84 | bool foundACE = false; | ||
85 | |||
86 | foreach (XAttribute attrib in node.Attributes()) | ||
87 | { | ||
88 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | ||
89 | { | ||
90 | switch (attrib.Name.LocalName) | ||
91 | { | ||
92 | case "Id": | ||
93 | id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); | ||
94 | break; | ||
95 | case "HandleExisting": | ||
96 | handleExistingValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
97 | switch (handleExistingValue) | ||
98 | { | ||
99 | case "replace": | ||
100 | handleExisting = HttpConstants.heReplace; | ||
101 | break; | ||
102 | case "ignore": | ||
103 | handleExisting = HttpConstants.heIgnore; | ||
104 | break; | ||
105 | case "fail": | ||
106 | handleExisting = HttpConstants.heFail; | ||
107 | break; | ||
108 | default: | ||
109 | this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "HandleExisting", handleExistingValue, "replace", "ignore", "fail")); | ||
110 | break; | ||
111 | } | ||
112 | break; | ||
113 | case "Sddl": | ||
114 | sddl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
115 | break; | ||
116 | case "Url": | ||
117 | url = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
118 | break; | ||
119 | default: | ||
120 | this.Core.UnexpectedAttribute(node, attrib); | ||
121 | break; | ||
122 | } | ||
123 | } | ||
124 | else | ||
125 | { | ||
126 | this.Core.ParseExtensionAttribute(node, attrib); | ||
127 | } | ||
128 | } | ||
129 | |||
130 | // Need the element ID for child element processing, so generate now if not authored. | ||
131 | if (null == id) | ||
132 | { | ||
133 | id = this.Core.CreateIdentifier("url", componentId, securityPrincipal, url); | ||
134 | } | ||
135 | |||
136 | // Parse UrlAce children. | ||
137 | foreach (XElement child in node.Elements()) | ||
138 | { | ||
139 | if (this.Namespace == child.Name.Namespace) | ||
140 | { | ||
141 | switch (child.Name.LocalName) | ||
142 | { | ||
143 | case "UrlAce": | ||
144 | if (null != sddl) | ||
145 | { | ||
146 | this.Core.OnMessage(WixErrors.IllegalParentAttributeWhenNested(sourceLineNumbers, "UrlReservation", "Sddl", "UrlAce")); | ||
147 | } | ||
148 | else | ||
149 | { | ||
150 | foundACE = true; | ||
151 | this.ParseUrlAceElement(child, id.Id, securityPrincipal); | ||
152 | } | ||
153 | break; | ||
154 | default: | ||
155 | this.Core.UnexpectedElement(node, child); | ||
156 | break; | ||
157 | } | ||
158 | } | ||
159 | else | ||
160 | { | ||
161 | this.Core.ParseExtensionElement(node, child); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | // Url is required. | ||
166 | if (null == url) | ||
167 | { | ||
168 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Url")); | ||
169 | } | ||
170 | |||
171 | // Security is required. | ||
172 | if (null == sddl && !foundACE) | ||
173 | { | ||
174 | this.Core.OnMessage(HttpErrors.NoSecuritySpecified(sourceLineNumbers)); | ||
175 | } | ||
176 | |||
177 | if (!this.Core.EncounteredError) | ||
178 | { | ||
179 | Row row = this.Core.CreateRow(sourceLineNumbers, "WixHttpUrlReservation"); | ||
180 | row[0] = id.Id; | ||
181 | row[1] = handleExisting; | ||
182 | row[2] = sddl; | ||
183 | row[3] = url; | ||
184 | row[4] = componentId; | ||
185 | |||
186 | if (this.Core.CurrentPlatform == Platform.ARM) | ||
187 | { | ||
188 | // Ensure ARM version of the CA is referenced. | ||
189 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixSchedHttpUrlReservationsInstall_ARM"); | ||
190 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixSchedHttpUrlReservationsUninstall_ARM"); | ||
191 | } | ||
192 | else | ||
193 | { | ||
194 | // All other supported platforms use x86. | ||
195 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixSchedHttpUrlReservationsInstall"); | ||
196 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixSchedHttpUrlReservationsUninstall"); | ||
197 | } | ||
198 | } | ||
199 | } | ||
200 | |||
201 | /// <summary> | ||
202 | /// Parses a UrlAce element. | ||
203 | /// </summary> | ||
204 | /// <param name="node">The element to parse.</param> | ||
205 | /// <param name="urlReservationId">The URL reservation ID.</param> | ||
206 | /// <param name="defaultSecurityPrincipal">The default security principal.</param> | ||
207 | private void ParseUrlAceElement(XElement node, string urlReservationId, string defaultSecurityPrincipal) | ||
208 | { | ||
209 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | ||
210 | Identifier id = null; | ||
211 | string securityPrincipal = defaultSecurityPrincipal; | ||
212 | int rights = HttpConstants.GENERIC_ALL; | ||
213 | string rightsValue = null; | ||
214 | |||
215 | foreach (XAttribute attrib in node.Attributes()) | ||
216 | { | ||
217 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | ||
218 | { | ||
219 | switch (attrib.Name.LocalName) | ||
220 | { | ||
221 | case "Id": | ||
222 | id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); | ||
223 | break; | ||
224 | case "SecurityPrincipal": | ||
225 | securityPrincipal = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
226 | break; | ||
227 | case "Rights": | ||
228 | rightsValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
229 | switch (rightsValue) | ||
230 | { | ||
231 | case "all": | ||
232 | rights = HttpConstants.GENERIC_ALL; | ||
233 | break; | ||
234 | case "delegate": | ||
235 | rights = HttpConstants.GENERIC_WRITE; | ||
236 | break; | ||
237 | case "register": | ||
238 | rights = HttpConstants.GENERIC_EXECUTE; | ||
239 | break; | ||
240 | default: | ||
241 | this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Rights", rightsValue, "all", "delegate", "register")); | ||
242 | break; | ||
243 | } | ||
244 | break; | ||
245 | default: | ||
246 | this.Core.UnexpectedAttribute(node, attrib); | ||
247 | break; | ||
248 | } | ||
249 | } | ||
250 | else | ||
251 | { | ||
252 | this.Core.ParseExtensionAttribute(node, attrib); | ||
253 | } | ||
254 | } | ||
255 | |||
256 | // Generate Id now if not authored. | ||
257 | if (null == id) | ||
258 | { | ||
259 | id = this.Core.CreateIdentifier("ace", urlReservationId, securityPrincipal, rightsValue); | ||
260 | } | ||
261 | |||
262 | this.Core.ParseForExtensionElements(node); | ||
263 | |||
264 | // SecurityPrincipal is required. | ||
265 | if (null == securityPrincipal) | ||
266 | { | ||
267 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SecurityPrincipal")); | ||
268 | } | ||
269 | |||
270 | if (!this.Core.EncounteredError) | ||
271 | { | ||
272 | Row row = this.Core.CreateRow(sourceLineNumbers, "WixHttpUrlAce"); | ||
273 | row[0] = id.Id; | ||
274 | row[1] = urlReservationId; | ||
275 | row[2] = securityPrincipal; | ||
276 | row[3] = rights; | ||
277 | } | ||
278 | } | ||
279 | } | ||
280 | } | ||
diff --git a/src/wixext/HttpConstants.cs b/src/wixext/HttpConstants.cs new file mode 100644 index 00000000..7760d03f --- /dev/null +++ b/src/wixext/HttpConstants.cs | |||
@@ -0,0 +1,19 @@ | |||
1 | // 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. | ||
2 | |||
3 | namespace WixToolset.Extensions | ||
4 | { | ||
5 | using System; | ||
6 | |||
7 | internal static class HttpConstants | ||
8 | { | ||
9 | // from winnt.h | ||
10 | public const int GENERIC_ALL = 0x10000000; | ||
11 | public const int GENERIC_EXECUTE = 0x20000000; | ||
12 | public const int GENERIC_WRITE = 0x40000000; | ||
13 | |||
14 | // from wixhttpca.cpp | ||
15 | public const int heReplace = 0; | ||
16 | public const int heIgnore = 1; | ||
17 | public const int heFail = 2; | ||
18 | } | ||
19 | } | ||
diff --git a/src/wixext/HttpDecompiler.cs b/src/wixext/HttpDecompiler.cs new file mode 100644 index 00000000..043ee1e1 --- /dev/null +++ b/src/wixext/HttpDecompiler.cs | |||
@@ -0,0 +1,135 @@ | |||
1 | // 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. | ||
2 | |||
3 | namespace WixToolset.Extensions | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections; | ||
7 | using System.Diagnostics; | ||
8 | using System.Globalization; | ||
9 | using WixToolset.Data; | ||
10 | using WixToolset.Extensibility; | ||
11 | using Http = WixToolset.Extensions.Serialize.Http; | ||
12 | using Wix = WixToolset.Data.Serialize; | ||
13 | |||
14 | /// <summary> | ||
15 | /// The decompiler for the WiX Toolset Http Extension. | ||
16 | /// </summary> | ||
17 | public sealed class HttpDecompiler : DecompilerExtension | ||
18 | { | ||
19 | /// <summary> | ||
20 | /// Creates a decompiler for Http Extension. | ||
21 | /// </summary> | ||
22 | public HttpDecompiler() | ||
23 | { | ||
24 | this.TableDefinitions = HttpExtensionData.GetExtensionTableDefinitions(); | ||
25 | } | ||
26 | |||
27 | /// <summary> | ||
28 | /// Get the extensions library to be removed. | ||
29 | /// </summary> | ||
30 | /// <param name="tableDefinitions">Table definitions for library.</param> | ||
31 | /// <returns>Library to remove from decompiled output.</returns> | ||
32 | public override Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions) | ||
33 | { | ||
34 | return HttpExtensionData.GetExtensionLibrary(tableDefinitions); | ||
35 | } | ||
36 | |||
37 | /// <summary> | ||
38 | /// Decompiles an extension table. | ||
39 | /// </summary> | ||
40 | /// <param name="table">The table to decompile.</param> | ||
41 | public override void DecompileTable(Table table) | ||
42 | { | ||
43 | switch (table.Name) | ||
44 | { | ||
45 | case "WixHttpUrlReservation": | ||
46 | this.DecompileWixHttpUrlReservationTable(table); | ||
47 | break; | ||
48 | case "WixHttpUrlAce": | ||
49 | this.DecompileWixHttpUrlAceTable(table); | ||
50 | break; | ||
51 | default: | ||
52 | base.DecompileTable(table); | ||
53 | break; | ||
54 | } | ||
55 | } | ||
56 | |||
57 | /// <summary> | ||
58 | /// Decompile the WixHttpUrlReservation table. | ||
59 | /// </summary> | ||
60 | /// <param name="table">The table to decompile.</param> | ||
61 | private void DecompileWixHttpUrlReservationTable(Table table) | ||
62 | { | ||
63 | foreach (Row row in table.Rows) | ||
64 | { | ||
65 | Http.UrlReservation urlReservation = new Http.UrlReservation(); | ||
66 | urlReservation.Id = (string)row[0]; | ||
67 | switch((int)row[1]) | ||
68 | { | ||
69 | case HttpConstants.heReplace: | ||
70 | default: | ||
71 | urlReservation.HandleExisting = Http.UrlReservation.HandleExistingType.replace; | ||
72 | break; | ||
73 | case HttpConstants.heIgnore: | ||
74 | urlReservation.HandleExisting = Http.UrlReservation.HandleExistingType.ignore; | ||
75 | break; | ||
76 | case HttpConstants.heFail: | ||
77 | urlReservation.HandleExisting = Http.UrlReservation.HandleExistingType.fail; | ||
78 | break; | ||
79 | } | ||
80 | urlReservation.Sddl = (string)row[2]; | ||
81 | urlReservation.Url = (string)row[3]; | ||
82 | |||
83 | Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[4]); | ||
84 | if (null != component) | ||
85 | { | ||
86 | component.AddChild(urlReservation); | ||
87 | } | ||
88 | else | ||
89 | { | ||
90 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[2], "Component")); | ||
91 | } | ||
92 | this.Core.IndexElement(row, urlReservation); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | |||
97 | /// <summary> | ||
98 | /// Decompile the WixHttpUrlAce table. | ||
99 | /// </summary> | ||
100 | /// <param name="table">The table to decompile.</param> | ||
101 | private void DecompileWixHttpUrlAceTable(Table table) | ||
102 | { | ||
103 | foreach (Row row in table.Rows) | ||
104 | { | ||
105 | Http.UrlAce urlace = new Http.UrlAce(); | ||
106 | urlace.Id = (string)row[0]; | ||
107 | urlace.SecurityPrincipal = (string)row[2]; | ||
108 | switch (Convert.ToInt32(row[3])) | ||
109 | { | ||
110 | case HttpConstants.GENERIC_ALL: | ||
111 | default: | ||
112 | urlace.Rights = Http.UrlAce.RightsType.all; | ||
113 | break; | ||
114 | case HttpConstants.GENERIC_EXECUTE: | ||
115 | urlace.Rights = Http.UrlAce.RightsType.register; | ||
116 | break; | ||
117 | case HttpConstants.GENERIC_WRITE: | ||
118 | urlace.Rights = Http.UrlAce.RightsType.@delegate; | ||
119 | break; | ||
120 | } | ||
121 | |||
122 | string reservationId = (string)row[1]; | ||
123 | Http.UrlReservation urlReservation = (Http.UrlReservation)this.Core.GetIndexedElement("WixHttpUrlReservation", reservationId); | ||
124 | if (null != urlReservation) | ||
125 | { | ||
126 | urlReservation.AddChild(urlace); | ||
127 | } | ||
128 | else | ||
129 | { | ||
130 | this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, urlace.Id, "WixHttpUrlReservation_", reservationId, "WixHttpUrlReservation")); | ||
131 | } | ||
132 | } | ||
133 | } | ||
134 | } | ||
135 | } | ||
diff --git a/src/wixext/HttpExtensionData.cs b/src/wixext/HttpExtensionData.cs new file mode 100644 index 00000000..db79a6c1 --- /dev/null +++ b/src/wixext/HttpExtensionData.cs | |||
@@ -0,0 +1,64 @@ | |||
1 | // 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. | ||
2 | |||
3 | namespace WixToolset.Extensions | ||
4 | { | ||
5 | using System; | ||
6 | using System.Reflection; | ||
7 | using WixToolset.Data; | ||
8 | using WixToolset.Extensibility; | ||
9 | |||
10 | /// <summary> | ||
11 | /// The WiX Toolset Http Extension. | ||
12 | /// </summary> | ||
13 | public sealed class HttpExtensionData : ExtensionData | ||
14 | { | ||
15 | /// <summary> | ||
16 | /// Gets the default culture. | ||
17 | /// </summary> | ||
18 | /// <value>The default culture.</value> | ||
19 | public override string DefaultCulture | ||
20 | { | ||
21 | get { return "en-us"; } | ||
22 | } | ||
23 | |||
24 | /// <summary> | ||
25 | /// Gets the optional table definitions for this extension. | ||
26 | /// </summary> | ||
27 | /// <value>The optional table definitions for this extension.</value> | ||
28 | public override TableDefinitionCollection TableDefinitions | ||
29 | { | ||
30 | get | ||
31 | { | ||
32 | return HttpExtensionData.GetExtensionTableDefinitions(); | ||
33 | } | ||
34 | } | ||
35 | |||
36 | /// <summary> | ||
37 | /// Gets the library associated with this extension. | ||
38 | /// </summary> | ||
39 | /// <param name="tableDefinitions">The table definitions to use while loading the library.</param> | ||
40 | /// <returns>The loaded library.</returns> | ||
41 | public override Library GetLibrary(TableDefinitionCollection tableDefinitions) | ||
42 | { | ||
43 | return HttpExtensionData.GetExtensionLibrary(tableDefinitions); | ||
44 | } | ||
45 | |||
46 | /// <summary> | ||
47 | /// Internal mechanism to access the extension's table definitions. | ||
48 | /// </summary> | ||
49 | /// <returns>Extension's table definitions.</returns> | ||
50 | internal static TableDefinitionCollection GetExtensionTableDefinitions() | ||
51 | { | ||
52 | return ExtensionData.LoadTableDefinitionHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.tables.xml"); | ||
53 | } | ||
54 | |||
55 | /// <summary> | ||
56 | /// Internal mechanism to access the extension's library. | ||
57 | /// </summary> | ||
58 | /// <returns>Extension's library.</returns> | ||
59 | internal static Library GetExtensionLibrary(TableDefinitionCollection tableDefinitions) | ||
60 | { | ||
61 | return ExtensionData.LoadLibraryHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.http.wixlib", tableDefinitions); | ||
62 | } | ||
63 | } | ||
64 | } | ||
diff --git a/src/wixext/WixHttpExtension.csproj b/src/wixext/WixHttpExtension.csproj new file mode 100644 index 00000000..74af503f --- /dev/null +++ b/src/wixext/WixHttpExtension.csproj | |||
@@ -0,0 +1,48 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | |||
5 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | ||
6 | <PropertyGroup> | ||
7 | <ProjectGuid>{AAFC3C7F-D818-4B1D-AF3F-A331EA917F3F}</ProjectGuid> | ||
8 | <AssemblyName>WixHttpExtension</AssemblyName> | ||
9 | <OutputType>Library</OutputType> | ||
10 | <RootNamespace>WixToolset.Extensions</RootNamespace> | ||
11 | </PropertyGroup> | ||
12 | <ItemGroup> | ||
13 | <Compile Include="AssemblyInfo.cs" /> | ||
14 | <Compile Include="HttpCompiler.cs" /> | ||
15 | <Compile Include="HttpConstants.cs" /> | ||
16 | <Compile Include="HttpDecompiler.cs" /> | ||
17 | <Compile Include="HttpExtensionData.cs" /> | ||
18 | <MsgGenSource Include="Data\messages.xml"> | ||
19 | <ResourcesLogicalName>$(RootNamespace).Data.Messages.resources</ResourcesLogicalName> | ||
20 | </MsgGenSource> | ||
21 | <EmbeddedFlattenedResource Include="Data\tables.xml"> | ||
22 | <LogicalName>$(RootNamespace).Data.tables.xml</LogicalName> | ||
23 | </EmbeddedFlattenedResource> | ||
24 | <EmbeddedFlattenedResource Include="Xsd\http.xsd"> | ||
25 | <LogicalName>$(RootNamespace).Xsd.http.xsd</LogicalName> | ||
26 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
27 | </EmbeddedFlattenedResource> | ||
28 | <XsdGenSource Include="Xsd\http.xsd"> | ||
29 | <CommonNamespace>WixToolset.Data.Serialize</CommonNamespace> | ||
30 | <Namespace>WixToolset.Extensions.Serialize.Http</Namespace> | ||
31 | </XsdGenSource> | ||
32 | <EmbeddedResource Include="$(OutputPath)\http.wixlib"> | ||
33 | <Link>Data\http.wixlib</Link> | ||
34 | </EmbeddedResource> | ||
35 | </ItemGroup> | ||
36 | <ItemGroup> | ||
37 | <Reference Include="System" /> | ||
38 | <Reference Include="System.Xml" /> | ||
39 | <Reference Include="System.Xml.Linq" /> | ||
40 | <ProjectReference Include="..\..\..\libs\WixToolset.Data\WixToolset.Data.csproj" /> | ||
41 | <ProjectReference Include="..\..\..\libs\WixToolset.Extensibility\WixToolset.Extensibility.csproj" /> | ||
42 | <ProjectReference Include="..\..\..\tools\wix\Wix.csproj" /> | ||
43 | <ProjectReference Include="..\wixlib\HttpExtension.wixproj"> | ||
44 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
45 | </ProjectReference> | ||
46 | </ItemGroup> | ||
47 | <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), wix.proj))\tools\WixBuild.targets" /> | ||
48 | </Project> | ||
diff --git a/src/wixext/http.xsd b/src/wixext/http.xsd new file mode 100644 index 00000000..b96a6ded --- /dev/null +++ b/src/wixext/http.xsd | |||
@@ -0,0 +1,148 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | |||
5 | <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
6 | xmlns:xse="http://wixtoolset.org/schemas/XmlSchemaExtension" | ||
7 | xmlns:html="http://www.w3.org/1999/xhtml" | ||
8 | targetNamespace="http://wixtoolset.org/schemas/v4/wxs/http" | ||
9 | xmlns="http://wixtoolset.org/schemas/v4/wxs/http"> | ||
10 | <xs:annotation> | ||
11 | <xs:documentation> | ||
12 | The source code schema for the Windows Installer XML Toolset Http Extension. | ||
13 | </xs:documentation> | ||
14 | </xs:annotation> | ||
15 | |||
16 | <xs:import namespace="http://wixtoolset.org/schemas/v4/wxs" /> | ||
17 | |||
18 | <xs:element name="UrlReservation"> | ||
19 | <xs:annotation> | ||
20 | <xs:documentation> | ||
21 | Makes a reservation record for the HTTP Server API configuration store on Windows XP SP2, | ||
22 | Windows Server 2003, and later. For more information about the HTTP Server API, see | ||
23 | <html:a href="http://msdn.microsoft.com/library/windows/desktop/aa364510.aspx"> | ||
24 | HTTP Server API | ||
25 | </html:a>. | ||
26 | </xs:documentation> | ||
27 | <xs:appinfo> | ||
28 | <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Component" /> | ||
29 | <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="ServiceInstall" /> | ||
30 | </xs:appinfo> | ||
31 | </xs:annotation> | ||
32 | |||
33 | <xs:complexType> | ||
34 | <xs:choice minOccurs="0" maxOccurs="unbounded"> | ||
35 | <xs:annotation> | ||
36 | <xs:documentation> | ||
37 | The access control entries for the access control list. | ||
38 | </xs:documentation> | ||
39 | </xs:annotation> | ||
40 | <xs:element ref="UrlAce" /> | ||
41 | </xs:choice> | ||
42 | |||
43 | <xs:attribute name="HandleExisting"> | ||
44 | <xs:annotation> | ||
45 | <xs:documentation> | ||
46 | Specifies the behavior when trying to install a URL reservation and it already exists. | ||
47 | </xs:documentation> | ||
48 | </xs:annotation> | ||
49 | <xs:simpleType> | ||
50 | <xs:restriction base="xs:NMTOKEN"> | ||
51 | <xs:enumeration value="replace"> | ||
52 | <xs:annotation> | ||
53 | <xs:documentation> | ||
54 | Replaces the existing URL reservation (the default). | ||
55 | </xs:documentation> | ||
56 | </xs:annotation> | ||
57 | </xs:enumeration> | ||
58 | <xs:enumeration value="ignore"> | ||
59 | <xs:annotation> | ||
60 | <xs:documentation> | ||
61 | Keeps the existing URL reservation. | ||
62 | </xs:documentation> | ||
63 | </xs:annotation> | ||
64 | </xs:enumeration> | ||
65 | <xs:enumeration value="fail"> | ||
66 | <xs:annotation> | ||
67 | <xs:documentation> | ||
68 | The installation fails. | ||
69 | </xs:documentation> | ||
70 | </xs:annotation> | ||
71 | </xs:enumeration> | ||
72 | </xs:restriction> | ||
73 | </xs:simpleType> | ||
74 | </xs:attribute> | ||
75 | |||
76 | <xs:attribute name="Id" type="xs:string"> | ||
77 | <xs:annotation> | ||
78 | <xs:documentation> | ||
79 | Unique ID of this URL reservation. | ||
80 | If this attribute is not specified, an identifier will be generated automatically. | ||
81 | </xs:documentation> | ||
82 | </xs:annotation> | ||
83 | </xs:attribute> | ||
84 | |||
85 | <xs:attribute name="Sddl" type="xs:string"> | ||
86 | <xs:annotation> | ||
87 | <xs:documentation> | ||
88 | Security descriptor to apply to the URL reservation. | ||
89 | Can't be specified when using children UrlAce elements. | ||
90 | </xs:documentation> | ||
91 | </xs:annotation> | ||
92 | </xs:attribute> | ||
93 | |||
94 | <xs:attribute name="Url" type="xs:string" use="required"> | ||
95 | <xs:annotation> | ||
96 | <xs:documentation> | ||
97 | The <html:a href="http://msdn.microsoft.com/library/windows/desktop/aa364698.aspx">UrlPrefix</html:a> | ||
98 | string that defines the portion of the URL namespace to which this reservation pertains. | ||
99 | </xs:documentation> | ||
100 | </xs:annotation> | ||
101 | </xs:attribute> | ||
102 | </xs:complexType> | ||
103 | </xs:element> | ||
104 | |||
105 | <xs:element name="UrlAce"> | ||
106 | <xs:annotation> | ||
107 | <xs:documentation> | ||
108 | The security principal and which rights to assign to them for the URL reservation. | ||
109 | </xs:documentation> | ||
110 | </xs:annotation> | ||
111 | <xs:complexType> | ||
112 | <xs:attribute name="Id" type="xs:string"> | ||
113 | <xs:annotation> | ||
114 | <xs:documentation> | ||
115 | Unique ID of this URL ACE. | ||
116 | If this attribute is not specified, an identifier will be generated automatically. | ||
117 | </xs:documentation> | ||
118 | </xs:annotation> | ||
119 | </xs:attribute> | ||
120 | |||
121 | <xs:attribute name="SecurityPrincipal" type="xs:string"> | ||
122 | <xs:annotation> | ||
123 | <xs:documentation> | ||
124 | The security principal for this ACE. When the UrlReservation is under a ServiceInstall element, this defaults to | ||
125 | "NT SERVICE\ServiceInstallName". This may be either a SID or an account name in a format that | ||
126 | <html:a href="http://msdn.microsoft.com/library/windows/desktop/aa379159.aspx">LookupAccountName</html:a> | ||
127 | supports. When using a SID, an asterisk must be prepended. For example, "*S-1-5-18". | ||
128 | </xs:documentation> | ||
129 | </xs:annotation> | ||
130 | </xs:attribute> | ||
131 | |||
132 | <xs:attribute name="Rights"> | ||
133 | <xs:annotation> | ||
134 | <xs:documentation> | ||
135 | Rights for this ACE. Default is "all". | ||
136 | </xs:documentation> | ||
137 | </xs:annotation> | ||
138 | <xs:simpleType> | ||
139 | <xs:restriction base="xs:NMTOKEN"> | ||
140 | <xs:enumeration value="register" /> | ||
141 | <xs:enumeration value="delegate" /> | ||
142 | <xs:enumeration value="all" /> | ||
143 | </xs:restriction> | ||
144 | </xs:simpleType> | ||
145 | </xs:attribute> | ||
146 | </xs:complexType> | ||
147 | </xs:element> | ||
148 | </xs:schema> | ||
diff --git a/src/wixext/messages.xml b/src/wixext/messages.xml new file mode 100644 index 00000000..6dcdc366 --- /dev/null +++ b/src/wixext/messages.xml | |||
@@ -0,0 +1,13 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | |||
5 | <Messages Namespace="WixToolset.Extensions" Resources="Data.Messages" xmlns="http://schemas.microsoft.com/genmsgs/2004/07/messages"> | ||
6 | <Class Name="HttpErrors" ContainerName="HttpErrorEventArgs" BaseContainerName="MessageEventArgs" Level="Error"> | ||
7 | <Message Id="NoSecuritySpecified" Number="6701"> | ||
8 | <Instance> | ||
9 | The UrlReservation element doesn't identify the security for the reservation. You must either specify the Sddl attribute, or provide child UrlAce elements. | ||
10 | </Instance> | ||
11 | </Message> | ||
12 | </Class> | ||
13 | </Messages> | ||
diff --git a/src/wixext/tables.xml b/src/wixext/tables.xml new file mode 100644 index 00000000..576fc2a7 --- /dev/null +++ b/src/wixext/tables.xml | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | |||
5 | <tableDefinitions xmlns="http://wixtoolset.org/schemas/v4/wi/tables"> | ||
6 | <tableDefinition name="WixHttpUrlReservation"> | ||
7 | <columnDefinition name="WixHttpUrlReservation" type="string" length="72" primaryKey="yes" modularize="column" | ||
8 | category="identifier" description="The non-localized primary key for the table." /> | ||
9 | <columnDefinition name="HandleExisting" type="number" length="4" nullable="no" | ||
10 | minValue="0" maxValue="2" description="The behavior when trying to install a URL reservation and it already exists." /> | ||
11 | <columnDefinition name="Sddl" type="string" length="0" modularize="property" nullable="yes" | ||
12 | category="formatted" description="Security descriptor for the URL reservation." /> | ||
13 | <columnDefinition name="Url" type="string" length="0" modularize="property" nullable="no" | ||
14 | category="formatted" description="URL to be reserved." /> | ||
15 | <columnDefinition name="Component_" type="string" length="72" modularize="column" | ||
16 | keyTable="Component" keyColumn="1" category="identifier" description="Foreign key into the Component table referencing the component that controls the URL reservation." /> | ||
17 | </tableDefinition> | ||
18 | <tableDefinition name="WixHttpUrlAce"> | ||
19 | <columnDefinition name="WixHttpUrlAce" type="string" length="72" primaryKey="yes" modularize="column" | ||
20 | category="identifier" description="The non-localized primary key for the table." /> | ||
21 | <columnDefinition name="WixHttpUrlReservation_" type="string" length="72" keyTable="WixHttpUrlReservation" keyColumn="1" modularize="column" | ||
22 | category="identifier" description="Foreign key into the WixHttpUrlReservation table." /> | ||
23 | <columnDefinition name="SecurityPrincipal" type="string" length="0" modularize="property" | ||
24 | category="formatted" description="The security principal for this ACE." /> | ||
25 | <columnDefinition name="Rights" type="number" length="4" nullable="no" | ||
26 | minValue="0" maxValue="1073741824" description="The rights for this ACE." /> | ||
27 | </tableDefinition> | ||
28 | </tableDefinitions> | ||