aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller/Bind
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs3
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs39
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/ConfigurationCallback.cs2
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/CopyTransformDataCommand.cs2
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs600
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs3
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs3
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs16
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/PathResolver.cs5
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs3
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs5
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs2
12 files changed, 602 insertions, 81 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs
index 3f5b9f05..0c0f3705 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs
@@ -6,12 +6,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using System.Globalization; 7 using System.Globalization;
8 using System.IO; 8 using System.IO;
9 using WixToolset.Core.Native; 9 using WixToolset.Core.WindowsInstaller.Msi;
10 using WixToolset.Data; 10 using WixToolset.Data;
11 using WixToolset.Data.WindowsInstaller; 11 using WixToolset.Data.WindowsInstaller;
12 using WixToolset.Extensibility; 12 using WixToolset.Extensibility;
13 using WixToolset.Extensibility.Services; 13 using WixToolset.Extensibility.Services;
14 using WixToolset.Msi;
15 14
16 internal class BindTransformCommand 15 internal class BindTransformCommand
17 { 16 {
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs
index b8f1b2f3..a773519a 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/CalculateComponentGuids.cs
@@ -1,4 +1,4 @@
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. 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 2
3namespace WixToolset.Core.WindowsInstaller.Bind 3namespace WixToolset.Core.WindowsInstaller.Bind
4{ 4{
@@ -37,37 +37,32 @@ namespace WixToolset.Core.WindowsInstaller.Bind
37 Dictionary<string, List<FileTuple>> filesByComponentId = null; 37 Dictionary<string, List<FileTuple>> filesByComponentId = null;
38 38
39 // Find components with generatable guids. 39 // Find components with generatable guids.
40 foreach (var componentRow in this.Section.Tuples.OfType<ComponentTuple>()) 40 foreach (var componentTuple in this.Section.Tuples.OfType<ComponentTuple>())
41 { 41 {
42 // Skip components that do not specify generate guid. 42 // Skip components that do not specify generate guid.
43 if (componentRow.ComponentId != "*") 43 if (componentTuple.ComponentId != "*")
44 { 44 {
45 continue; 45 continue;
46 } 46 }
47 47
48 var odbcDataSourceKeyPath = (componentRow.Attributes & MsiInterop.MsidbComponentAttributesODBCDataSource) != 0; 48 if (String.IsNullOrEmpty(componentTuple.KeyPath) || ComponentKeyPathType.OdbcDataSource == componentTuple.KeyPathType)
49
50 if (String.IsNullOrEmpty(componentRow.KeyPath) || odbcDataSourceKeyPath)
51 { 49 {
52 this.Messaging.Write(ErrorMessages.IllegalComponentWithAutoGeneratedGuid(componentRow.SourceLineNumbers)); 50 this.Messaging.Write(ErrorMessages.IllegalComponentWithAutoGeneratedGuid(componentTuple.SourceLineNumbers));
53 continue; 51 continue;
54 } 52 }
55 53
56 var registryKeyPath = (componentRow.Attributes & MsiInterop.MsidbComponentAttributesRegistryKeyPath) != 0; 54 if (ComponentKeyPathType.Registry == componentTuple.KeyPathType)
57
58 if (registryKeyPath)
59 { 55 {
60 if (registryKeyRows is null) 56 if (registryKeyRows is null)
61 { 57 {
62 registryKeyRows = this.Section.Tuples.OfType<RegistryTuple>().ToDictionary(t => t.Registry); 58 registryKeyRows = this.Section.Tuples.OfType<RegistryTuple>().ToDictionary(t => t.Id.Id);
63 } 59 }
64 60
65 if (registryKeyRows.TryGetValue(componentRow.KeyPath, out var foundRow)) 61 if (registryKeyRows.TryGetValue(componentTuple.KeyPath, out var foundRow))
66 { 62 {
67 var is64Bit = (componentRow.Attributes & MsiInterop.MsidbComponentAttributes64bit) != 0; 63 var bitness = componentTuple.Win64 ? "64" : String.Empty;
68 var bitness = is64Bit ? "64" : String.Empty;
69 var regkey = String.Concat(bitness, foundRow.AsString(1), "\\", foundRow.AsString(2), "\\", foundRow.AsString(3)); 64 var regkey = String.Concat(bitness, foundRow.AsString(1), "\\", foundRow.AsString(2), "\\", foundRow.AsString(3));
70 componentRow.ComponentId = this.BackendHelper.CreateGuid(BindDatabaseCommand.WixComponentGuidNamespace, regkey.ToLowerInvariant()); 65 componentTuple.ComponentId = this.BackendHelper.CreateGuid(BindDatabaseCommand.WixComponentGuidNamespace, regkey.ToLowerInvariant());
71 } 66 }
72 } 67 }
73 else // must be a File KeyPath. 68 else // must be a File KeyPath.
@@ -128,16 +123,16 @@ namespace WixToolset.Core.WindowsInstaller.Bind
128 } 123 }
129 124
130 // validate component meets all the conditions to have a generated guid 125 // validate component meets all the conditions to have a generated guid
131 var currentComponentFiles = filesByComponentId[componentRow.Component]; 126 var currentComponentFiles = filesByComponentId[componentTuple.Component];
132 var numFilesInComponent = currentComponentFiles.Count; 127 var numFilesInComponent = currentComponentFiles.Count;
133 string path = null; 128 string path = null;
134 129
135 foreach (var fileRow in currentComponentFiles) 130 foreach (var fileRow in currentComponentFiles)
136 { 131 {
137 if (fileRow.File == componentRow.KeyPath) 132 if (fileRow.File == componentTuple.KeyPath)
138 { 133 {
139 // calculate the key file's canonical target path 134 // calculate the key file's canonical target path
140 string directoryPath = PathResolver.GetDirectoryPath(targetPathsByDirectoryId, componentIdGenSeeds, componentRow.Directory_, true); 135 string directoryPath = PathResolver.GetDirectoryPath(targetPathsByDirectoryId, componentIdGenSeeds, componentTuple.Directory_, true);
141 string fileName = Common.GetName(fileRow.LongFileName, false, true).ToLowerInvariant(); 136 string fileName = Common.GetName(fileRow.LongFileName, false, true).ToLowerInvariant();
142 path = Path.Combine(directoryPath, fileName); 137 path = Path.Combine(directoryPath, fileName);
143 138
@@ -149,13 +144,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind
149 path.StartsWith(@"StartMenuFolder\programs", StringComparison.Ordinal) || 144 path.StartsWith(@"StartMenuFolder\programs", StringComparison.Ordinal) ||
150 path.StartsWith(@"WindowsFolder\fonts", StringComparison.Ordinal)) 145 path.StartsWith(@"WindowsFolder\fonts", StringComparison.Ordinal))
151 { 146 {
152 this.Messaging.Write(ErrorMessages.IllegalPathForGeneratedComponentGuid(componentRow.SourceLineNumbers, fileRow.Component_, path)); 147 this.Messaging.Write(ErrorMessages.IllegalPathForGeneratedComponentGuid(componentTuple.SourceLineNumbers, fileRow.Component_, path));
153 } 148 }
154 149
155 // if component has more than one file, the key path must be versioned 150 // if component has more than one file, the key path must be versioned
156 if (1 < numFilesInComponent && String.IsNullOrEmpty(fileRow.Version)) 151 if (1 < numFilesInComponent && String.IsNullOrEmpty(fileRow.Version))
157 { 152 {
158 this.Messaging.Write(ErrorMessages.IllegalGeneratedGuidComponentUnversionedKeypath(componentRow.SourceLineNumbers)); 153 this.Messaging.Write(ErrorMessages.IllegalGeneratedGuidComponentUnversionedKeypath(componentTuple.SourceLineNumbers));
159 } 154 }
160 } 155 }
161 else 156 else
@@ -163,7 +158,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
163 // not a key path, so it must be an unversioned file if component has more than one file 158 // not a key path, so it must be an unversioned file if component has more than one file
164 if (1 < numFilesInComponent && !String.IsNullOrEmpty(fileRow.Version)) 159 if (1 < numFilesInComponent && !String.IsNullOrEmpty(fileRow.Version))
165 { 160 {
166 this.Messaging.Write(ErrorMessages.IllegalGeneratedGuidComponentVersionedNonkeypath(componentRow.SourceLineNumbers)); 161 this.Messaging.Write(ErrorMessages.IllegalGeneratedGuidComponentVersionedNonkeypath(componentTuple.SourceLineNumbers));
167 } 162 }
168 } 163 }
169 } 164 }
@@ -171,7 +166,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
171 // if the rules were followed, reward with a generated guid 166 // if the rules were followed, reward with a generated guid
172 if (!this.Messaging.EncounteredError) 167 if (!this.Messaging.EncounteredError)
173 { 168 {
174 componentRow.ComponentId = this.BackendHelper.CreateGuid(BindDatabaseCommand.WixComponentGuidNamespace, path); 169 componentTuple.ComponentId = this.BackendHelper.CreateGuid(BindDatabaseCommand.WixComponentGuidNamespace, path);
175 } 170 }
176 } 171 }
177 } 172 }
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ConfigurationCallback.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ConfigurationCallback.cs
index 9a8e2bba..0cc5996a 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/ConfigurationCallback.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/ConfigurationCallback.cs
@@ -5,7 +5,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
5 using System; 5 using System;
6 using System.Collections; 6 using System.Collections;
7 using System.Globalization; 7 using System.Globalization;
8 using WixToolset.MergeMod; 8 using WixToolset.Core.WindowsInstaller.Msi;
9 9
10 /// <summary> 10 /// <summary>
11 /// Callback object for configurable merge modules. 11 /// Callback object for configurable merge modules.
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CopyTransformDataCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CopyTransformDataCommand.cs
index 6ff03941..a2cf2076 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/CopyTransformDataCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/CopyTransformDataCommand.cs
@@ -541,7 +541,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
541 foreach (Row row in componentTable.Rows) 541 foreach (Row row in componentTable.Rows)
542 { 542 {
543 if (null != row.Fields[5].Data && 543 if (null != row.Fields[5].Data &&
544 0 != ((int)row.Fields[3].Data & MsiInterop.MsidbComponentAttributesRegistryKeyPath)) 544 0 != ((int)row.Fields[3].Data & WindowsInstallerConstants.MsidbComponentAttributesRegistryKeyPath))
545 { 545 {
546 componentKeyPath.Add(row.Fields[0].Data.ToString(), row.Fields[5].Data.ToString()); 546 componentKeyPath.Add(row.Fields[0].Data.ToString(), row.Fields[5].Data.ToString());
547 } 547 }
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs
index 4d5d278b..1b29fc9c 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs
@@ -4,8 +4,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind
4{ 4{
5 using System; 5 using System;
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using System.Globalization;
7 using System.Linq; 8 using System.Linq;
8 using WixToolset.Core.Native;
9 using WixToolset.Data; 9 using WixToolset.Data;
10 using WixToolset.Data.Tuples; 10 using WixToolset.Data.Tuples;
11 using WixToolset.Data.WindowsInstaller; 11 using WixToolset.Data.WindowsInstaller;
@@ -46,41 +46,325 @@ namespace WixToolset.Core.WindowsInstaller.Bind
46 { 46 {
47 switch (tuple.Definition.Type) 47 switch (tuple.Definition.Type)
48 { 48 {
49 case TupleDefinitionType.File: 49 case TupleDefinitionType.BBControl:
50 this.AddFileTuple((FileTuple)tuple, output); 50 this.AddBBControlTuple((BBControlTuple)tuple, output);
51 break; 51 break;
52
53 case TupleDefinitionType.Control:
54 this.AddControlTuple((ControlTuple)tuple, output);
55 break;
56
57 case TupleDefinitionType.Component:
58 this.AddComponentTuple((ComponentTuple)tuple, output);
59 break;
60
61 case TupleDefinitionType.CustomAction:
62 this.AddCustomActionTuple((CustomActionTuple)tuple, output);
63 break;
64
65 case TupleDefinitionType.Dialog:
66 this.AddDialogTuple((DialogTuple)tuple, output);
67 break;
68
69 case TupleDefinitionType.Environment:
70 this.AddEnvironmentTuple((EnvironmentTuple)tuple, output);
71 break;
72
73 case TupleDefinitionType.Feature:
74 this.AddFeatureTuple((FeatureTuple)tuple, output);
75 break;
76
77 case TupleDefinitionType.File:
78 this.AddFileTuple((FileTuple)tuple, output);
79 break;
80
81 case TupleDefinitionType.IniFile:
82 this.AddIniFileTuple((IniFileTuple)tuple, output);
83 break;
84
85 case TupleDefinitionType.Media:
86 this.AddMediaTuple((MediaTuple)tuple, output);
87 break;
88
89 case TupleDefinitionType.ModuleConfiguration:
90 this.AddModuleConfigurationTuple((ModuleConfigurationTuple)tuple, output);
91 break;
92
93 case TupleDefinitionType.MsiEmbeddedUI:
94 this.AddMsiEmbeddedUITuple((MsiEmbeddedUITuple)tuple, output);
95 break;
96
97 case TupleDefinitionType.MsiServiceConfig:
98 this.AddMsiServiceConfigTuple((MsiServiceConfigTuple)tuple, output);
99 break;
100
101 case TupleDefinitionType.MsiServiceConfigFailureActions:
102 this.AddMsiServiceConfigFailureActionsTuple((MsiServiceConfigFailureActionsTuple)tuple, output);
103 break;
104
105 case TupleDefinitionType.Property:
106 this.AddPropertyTuple((PropertyTuple)tuple, output);
107 break;
108
109 case TupleDefinitionType.Registry:
110 this.AddRegistryTuple((RegistryTuple)tuple, output);
111 break;
112
113 case TupleDefinitionType.RemoveRegistry:
114 this.AddRemoveRegistryTuple((RemoveRegistryTuple)tuple, output);
115 break;
116
117 case TupleDefinitionType.ServiceControl:
118 this.AddServiceControlTuple((ServiceControlTuple)tuple, output);
119 break;
52 120
53 case TupleDefinitionType.Media: 121 case TupleDefinitionType.ServiceInstall:
54 this.AddMediaTuple((MediaTuple)tuple, output); 122 this.AddServiceInstallTuple((ServiceInstallTuple)tuple, output);
55 break; 123 break;
124
125 case TupleDefinitionType.Shortcut:
126 this.AddTupleDefaultly(tuple, output, true);
127 break;
128
129 case TupleDefinitionType.TextStyle:
130 this.AddTextStyleTuple((TextStyleTuple)tuple, output);
131 break;
56 132
57 case TupleDefinitionType.Property: 133 case TupleDefinitionType.Upgrade:
58 this.AddPropertyTuple((PropertyTuple)tuple, output); 134 this.AddUpgradeTuple((UpgradeTuple)tuple, output);
59 break; 135 break;
60 136
61 case TupleDefinitionType.WixAction: 137 case TupleDefinitionType.WixAction:
62 this.AddWixActionTuple((WixActionTuple)tuple, output); 138 this.AddWixActionTuple((WixActionTuple)tuple, output);
63 break; 139 break;
64 140
65 case TupleDefinitionType.WixMedia: 141 case TupleDefinitionType.WixMedia:
66 // Ignored. 142 // Ignored.
67 break; 143 break;
68 144
69 case TupleDefinitionType.WixMediaTemplate: 145 case TupleDefinitionType.WixMediaTemplate:
70 this.AddWixMediaTemplateTuple((WixMediaTemplateTuple)tuple, output); 146 this.AddWixMediaTemplateTuple((WixMediaTemplateTuple)tuple, output);
71 break; 147 break;
72 148
73 case TupleDefinitionType.MustBeFromAnExtension: 149 case TupleDefinitionType.MustBeFromAnExtension:
74 this.AddTupleFromExtension(tuple, output); 150 this.AddTupleFromExtension(tuple, output);
75 break; 151 break;
76 152
77 default: 153 default:
78 this.AddTupleDefaultly(tuple, output); 154 this.AddTupleDefaultly(tuple, output);
79 break; 155 break;
80 } 156 }
81 } 157 }
82 } 158 }
83 159
160 private void AddBBControlTuple(BBControlTuple tuple, Output output)
161 {
162 var attributes = tuple.Attributes;
163 attributes |= tuple.Enabled ? WindowsInstallerConstants.MsidbControlAttributesEnabled : 0;
164 attributes |= tuple.Indirect ? WindowsInstallerConstants.MsidbControlAttributesIndirect : 0;
165 attributes |= tuple.Integer ? WindowsInstallerConstants.MsidbControlAttributesInteger : 0;
166 attributes |= tuple.LeftScroll ? WindowsInstallerConstants.MsidbControlAttributesLeftScroll : 0;
167 attributes |= tuple.RightAligned ? WindowsInstallerConstants.MsidbControlAttributesRightAligned : 0;
168 attributes |= tuple.RightToLeft ? WindowsInstallerConstants.MsidbControlAttributesRTLRO : 0;
169 attributes |= tuple.Sunken ? WindowsInstallerConstants.MsidbControlAttributesSunken : 0;
170 attributes |= tuple.Visible ? WindowsInstallerConstants.MsidbControlAttributesVisible : 0;
171
172 var table = output.EnsureTable(this.TableDefinitions["BBControl"]);
173 var row = table.CreateRow(tuple.SourceLineNumbers);
174 row[0] = tuple.Billboard_;
175 row[1] = tuple.BBControl;
176 row[2] = tuple.Type;
177 row[3] = tuple.X;
178 row[4] = tuple.Y;
179 row[5] = tuple.Width;
180 row[6] = tuple.Height;
181 row[7] = attributes;
182 row[8] = tuple.Text;
183 }
184
185 private void AddControlTuple(ControlTuple tuple, Output output)
186 {
187 var text = tuple.Text;
188 var attributes = tuple.Attributes;
189 attributes |= tuple.Enabled ? WindowsInstallerConstants.MsidbControlAttributesEnabled : 0;
190 attributes |= tuple.Indirect ? WindowsInstallerConstants.MsidbControlAttributesIndirect : 0;
191 attributes |= tuple.Integer ? WindowsInstallerConstants.MsidbControlAttributesInteger : 0;
192 attributes |= tuple.LeftScroll ? WindowsInstallerConstants.MsidbControlAttributesLeftScroll : 0;
193 attributes |= tuple.RightAligned ? WindowsInstallerConstants.MsidbControlAttributesRightAligned : 0;
194 attributes |= tuple.RightToLeft ? WindowsInstallerConstants.MsidbControlAttributesRTLRO : 0;
195 attributes |= tuple.Sunken ? WindowsInstallerConstants.MsidbControlAttributesSunken : 0;
196 attributes |= tuple.Visible ? WindowsInstallerConstants.MsidbControlAttributesVisible : 0;
197
198 // If we're tracking disk space, and this is a non-FormatSize Text control,
199 // and the text attribute starts with '[' and ends with ']', add a space.
200 // It is not necessary for the whole string to be a property, just those
201 // two characters matter.
202 if (tuple.TrackDiskSpace &&
203 "Text" == tuple.Type &&
204 WindowsInstallerConstants.MsidbControlAttributesFormatSize != (attributes & WindowsInstallerConstants.MsidbControlAttributesFormatSize) &&
205 null != text && text.StartsWith("[", StringComparison.Ordinal) && text.EndsWith("]", StringComparison.Ordinal))
206 {
207 text = String.Concat(text, " ");
208 }
209
210 var table = output.EnsureTable(this.TableDefinitions["Control"]);
211 var row = table.CreateRow(tuple.SourceLineNumbers);
212 row[0] = tuple.Dialog_;
213 row[1] = tuple.Control;
214 row[2] = tuple.Type;
215 row[3] = tuple.X;
216 row[4] = tuple.Y;
217 row[5] = tuple.Width;
218 row[6] = tuple.Height;
219 row[7] = attributes;
220 row[8] = text;
221 row[9] = tuple.Control_Next;
222 row[10] = tuple.Help;
223 }
224
225 private void AddComponentTuple(ComponentTuple tuple, Output output)
226 {
227 var attributes = ComponentLocation.Either == tuple.Location ? WindowsInstallerConstants.MsidbComponentAttributesOptional : 0;
228 attributes |= ComponentLocation.SourceOnly == tuple.Location ? WindowsInstallerConstants.MsidbComponentAttributesSourceOnly : 0;
229 attributes |= ComponentKeyPathType.Registry == tuple.KeyPathType ? WindowsInstallerConstants.MsidbComponentAttributesRegistryKeyPath : 0;
230 attributes |= ComponentKeyPathType.OdbcDataSource == tuple.KeyPathType ? WindowsInstallerConstants.MsidbComponentAttributesODBCDataSource : 0;
231 attributes |= tuple.DisableRegistryReflection ? WindowsInstallerConstants.MsidbComponentAttributesDisableRegistryReflection : 0;
232 attributes |= tuple.NeverOverwrite ? WindowsInstallerConstants.MsidbComponentAttributesNeverOverwrite : 0;
233 attributes |= tuple.Permanent ? WindowsInstallerConstants.MsidbComponentAttributesPermanent : 0;
234 attributes |= tuple.SharedDllRefCount ? WindowsInstallerConstants.MsidbComponentAttributesSharedDllRefCount : 0;
235 attributes |= tuple.Transitive ? WindowsInstallerConstants.MsidbComponentAttributesTransitive : 0;
236 attributes |= tuple.UninstallWhenSuperseded ? WindowsInstallerConstants.MsidbComponentAttributes64bit : 0;
237
238 attributes |= tuple.Win64 ? WindowsInstallerConstants.MsidbComponentAttributes64bit : 0;
239
240 var table = output.EnsureTable(this.TableDefinitions["Component"]);
241 var row = table.CreateRow(tuple.SourceLineNumbers);
242 row[0] = tuple.Id.Id;
243 row[1] = tuple.ComponentId;
244 row[2] = tuple.Directory_;
245 row[3] = attributes;
246 row[4] = tuple.Condition;
247 row[5] = tuple.KeyPath;
248 }
249
250 private void AddCustomActionTuple(CustomActionTuple tuple, Output output)
251 {
252 var type = tuple.Win64 ? WindowsInstallerConstants.MsidbCustomActionType64BitScript : 0;
253 type |= tuple.TSAware ? WindowsInstallerConstants.MsidbCustomActionTypeTSAware : 0;
254 type |= tuple.Impersonate ? 0 : WindowsInstallerConstants.MsidbCustomActionTypeNoImpersonate;
255 type |= tuple.IgnoreResult ? WindowsInstallerConstants.MsidbCustomActionTypeContinue : 0;
256 type |= tuple.Hidden ? 0 : WindowsInstallerConstants.MsidbCustomActionTypeHideTarget;
257 type |= tuple.Async ? WindowsInstallerConstants.MsidbCustomActionTypeAsync : 0;
258 type |= CustomActionExecutionType.FirstSequence == tuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeFirstSequence : 0;
259 type |= CustomActionExecutionType.OncePerProcess == tuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeOncePerProcess : 0;
260 type |= CustomActionExecutionType.ClientRepeat == tuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeClientRepeat : 0;
261 type |= CustomActionExecutionType.Deferred == tuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeInScript : 0;
262 type |= CustomActionExecutionType.Rollback == tuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeInScript | WindowsInstallerConstants.MsidbCustomActionTypeRollback : 0;
263 type |= CustomActionExecutionType.Commit == tuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeInScript | WindowsInstallerConstants.MsidbCustomActionTypeCommit : 0;
264 type |= CustomActionSourceType.File == tuple.SourceType ? WindowsInstallerConstants.MsidbCustomActionTypeSourceFile : 0;
265 type |= CustomActionSourceType.Directory == tuple.SourceType ? WindowsInstallerConstants.MsidbCustomActionTypeDirectory : 0;
266 type |= CustomActionSourceType.Property == tuple.SourceType ? WindowsInstallerConstants.MsidbCustomActionTypeProperty : 0;
267 type |= CustomActionTargetType.Dll == tuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeDll : 0;
268 type |= CustomActionTargetType.Exe == tuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeExe : 0;
269 type |= CustomActionTargetType.TextData == tuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeTextData : 0;
270 type |= CustomActionTargetType.JScript == tuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeJScript : 0;
271 type |= CustomActionTargetType.VBScript == tuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeVBScript : 0;
272
273 var table = output.EnsureTable(this.TableDefinitions["CustomAction"]);
274 var row = table.CreateRow(tuple.SourceLineNumbers);
275 row[0] = tuple.Id.Id;
276 row[1] = type;
277 row[2] = tuple.Source;
278 row[3] = tuple.Target;
279 row[4] = tuple.PatchUninstall ? WindowsInstallerConstants.MsidbCustomActionTypePatchUninstall : 0;
280 }
281
282 private void AddDialogTuple(DialogTuple tuple, Output output)
283 {
284 var attributes = tuple.Visible ? WindowsInstallerConstants.MsidbDialogAttributesVisible : 0;
285 attributes|= tuple.Modal ? WindowsInstallerConstants.MsidbDialogAttributesModal : 0;
286 attributes|= tuple.Minimize ? WindowsInstallerConstants.MsidbDialogAttributesMinimize : 0;
287 attributes|= tuple.CustomPalette ? WindowsInstallerConstants.MsidbDialogAttributesUseCustomPalette: 0;
288 attributes|= tuple.ErrorDialog ? WindowsInstallerConstants.MsidbDialogAttributesError : 0;
289 attributes|= tuple.LeftScroll ? WindowsInstallerConstants.MsidbDialogAttributesLeftScroll : 0;
290 attributes|= tuple.KeepModeless ? WindowsInstallerConstants.MsidbDialogAttributesKeepModeless : 0;
291 attributes|= tuple.RightAligned ? WindowsInstallerConstants.MsidbDialogAttributesRightAligned : 0;
292 attributes|= tuple.RightToLeft ? WindowsInstallerConstants.MsidbDialogAttributesRTLRO : 0;
293 attributes|= tuple.SystemModal ? WindowsInstallerConstants.MsidbDialogAttributesSysModal : 0;
294 attributes|= tuple.TrackDiskSpace ? WindowsInstallerConstants.MsidbDialogAttributesTrackDiskSpace : 0;
295
296 var table = output.EnsureTable(this.TableDefinitions["Dialog"]);
297 var row = table.CreateRow(tuple.SourceLineNumbers);
298 row[0] = tuple.Id.Id;
299 row[1] = tuple.HCentering;
300 row[2] = tuple.VCentering;
301 row[3] = tuple.Width;
302 row[4] = tuple.Height;
303 row[5] = attributes;
304 row[6] = tuple.Title;
305 row[7] = tuple.Control_First;
306 row[8] = tuple.Control_Default;
307 row[9] = tuple.Control_Cancel;
308 }
309
310 private void AddEnvironmentTuple(EnvironmentTuple tuple, Output output)
311 {
312 var action = String.Empty;
313 var system = tuple.System ? "*" : String.Empty;
314 var uninstall = tuple.Permanent ? String.Empty : "-";
315 var value = tuple.Value;
316
317 switch (tuple.Action)
318 {
319 case EnvironmentActionType.Create:
320 action = "+";
321 break;
322 case EnvironmentActionType.Set:
323 action = "=";
324 break;
325 case EnvironmentActionType.Remove:
326 action = "!";
327 break;
328 }
329
330 switch (tuple.Part)
331 {
332 case EnvironmentPartType.First:
333 value = String.Concat(value, tuple.Separator, "[~]");
334 break;
335 case EnvironmentPartType.Last:
336 value = String.Concat("[~]", tuple.Separator, value);
337 break;
338 }
339
340 var table = output.EnsureTable(this.TableDefinitions["Environment"]);
341 var row = table.CreateRow(tuple.SourceLineNumbers);
342 row[0] = tuple.Id.Id;
343 row[1] = String.Concat(action, uninstall, system, tuple.Name);
344 row[2] = value;
345 row[3] = tuple.Component_;
346 }
347
348 private void AddFeatureTuple(FeatureTuple tuple, Output output)
349 {
350 var attributes = tuple.DisallowAbsent ? WindowsInstallerConstants.MsidbFeatureAttributesUIDisallowAbsent : 0;
351 attributes |= tuple.DisallowAdvertise ? WindowsInstallerConstants.MsidbFeatureAttributesDisallowAdvertise : 0;
352 attributes |= FeatureInstallDefault.FollowParent == tuple.InstallDefault ? WindowsInstallerConstants.MsidbFeatureAttributesFollowParent : 0;
353 attributes |= FeatureInstallDefault.Source == tuple.InstallDefault ? WindowsInstallerConstants.MsidbFeatureAttributesFavorSource : 0;
354 attributes |= FeatureTypicalDefault.Advertise == tuple.TypicalDefault ? WindowsInstallerConstants.MsidbFeatureAttributesFavorAdvertise : 0;
355
356 var table = output.EnsureTable(this.TableDefinitions["Feature"]);
357 var row = table.CreateRow(tuple.SourceLineNumbers);
358 row[0] = tuple.Id.Id;
359 row[1] = tuple.Feature_Parent;
360 row[2] = tuple.Title;
361 row[3] = tuple.Description;
362 row[4] = tuple.Display;
363 row[5] = tuple.Level;
364 row[6] = tuple.Directory_;
365 row[7] = attributes;
366 }
367
84 private void AddFileTuple(FileTuple tuple, Output output) 368 private void AddFileTuple(FileTuple tuple, Output output)
85 { 369 {
86 var table = output.EnsureTable(this.TableDefinitions["File"]); 370 var table = output.EnsureTable(this.TableDefinitions["File"]);
@@ -92,16 +376,32 @@ namespace WixToolset.Core.WindowsInstaller.Bind
92 row.Version = tuple.Version; 376 row.Version = tuple.Version;
93 row.Language = tuple.Language; 377 row.Language = tuple.Language;
94 378
95 var attributes = tuple.Checksum ? MsiInterop.MsidbFileAttributesChecksum : 0; 379 var attributes = tuple.Checksum ? WindowsInstallerConstants.MsidbFileAttributesChecksum : 0;
96 attributes |= (tuple.Compressed.HasValue && tuple.Compressed.Value) ? MsiInterop.MsidbFileAttributesCompressed : 0; 380 attributes |= (tuple.Compressed.HasValue && tuple.Compressed.Value) ? WindowsInstallerConstants.MsidbFileAttributesCompressed : 0;
97 attributes |= (tuple.Compressed.HasValue && !tuple.Compressed.Value) ? MsiInterop.MsidbFileAttributesNoncompressed : 0; 381 attributes |= (tuple.Compressed.HasValue && !tuple.Compressed.Value) ? WindowsInstallerConstants.MsidbFileAttributesNoncompressed : 0;
98 attributes |= tuple.Hidden ? MsiInterop.MsidbFileAttributesHidden : 0; 382 attributes |= tuple.Hidden ? WindowsInstallerConstants.MsidbFileAttributesHidden : 0;
99 attributes |= tuple.ReadOnly ? MsiInterop.MsidbFileAttributesReadOnly : 0; 383 attributes |= tuple.ReadOnly ? WindowsInstallerConstants.MsidbFileAttributesReadOnly : 0;
100 attributes |= tuple.System ? MsiInterop.MsidbFileAttributesSystem : 0; 384 attributes |= tuple.System ? WindowsInstallerConstants.MsidbFileAttributesSystem : 0;
101 attributes |= tuple.Vital ? MsiInterop.MsidbFileAttributesVital : 0; 385 attributes |= tuple.Vital ? WindowsInstallerConstants.MsidbFileAttributesVital : 0;
102 row.Attributes = attributes; 386 row.Attributes = attributes;
103 } 387 }
104 388
389 private void AddIniFileTuple(IniFileTuple tuple, Output output)
390 {
391 string tableName = (InifFileActionType.AddLine == tuple.Action || InifFileActionType.AddTag == tuple.Action || InifFileActionType.CreateLine == tuple.Action) ? "IniFile" : "RemoveIniFile";
392
393 var table = output.EnsureTable(this.TableDefinitions[tableName]);
394 var row = table.CreateRow(tuple.SourceLineNumbers);
395 row[0] = tuple.Id.Id;
396 row[1] = tuple.FileName;
397 row[2] = tuple.DirProperty;
398 row[3] = tuple.Section;
399 row[4] = tuple.Key;
400 row[5] = tuple.Value;
401 row[6] = tuple.Action;
402 row[7] = tuple.Component_;
403 }
404
105 private void AddMediaTuple(MediaTuple tuple, Output output) 405 private void AddMediaTuple(MediaTuple tuple, Output output)
106 { 406 {
107 if (this.Section.Type != SectionType.Module) 407 if (this.Section.Type != SectionType.Module)
@@ -117,6 +417,72 @@ namespace WixToolset.Core.WindowsInstaller.Bind
117 } 417 }
118 } 418 }
119 419
420 private void AddModuleConfigurationTuple(ModuleConfigurationTuple tuple, Output output)
421 {
422 var table = output.EnsureTable(this.TableDefinitions["ModuleConfiguration"]);
423 var row = table.CreateRow(tuple.SourceLineNumbers);
424 row[0] = tuple.Id.Id;
425 row[1] = tuple.Format;
426 row[2] = tuple.Type;
427 row[3] = tuple.ContextData;
428 row[4] = tuple.DefaultValue;
429 row[5] = (tuple.KeyNoOrphan ? WindowsInstallerConstants.MsidbMsmConfigurableOptionKeyNoOrphan : 0) |
430 (tuple.NonNullable ? WindowsInstallerConstants.MsidbMsmConfigurableOptionNonNullable : 0);
431 row[6] = tuple.DisplayName;
432 row[7] = tuple.Description;
433 row[8] = tuple.HelpLocation;
434 row[9] = tuple.HelpKeyword;
435 }
436
437 private void AddMsiEmbeddedUITuple(MsiEmbeddedUITuple tuple, Output output)
438 {
439 var attributes = tuple.EntryPoint ? WindowsInstallerConstants.MsidbEmbeddedUI : 0;
440 attributes |= tuple.SupportsBasicUI ? WindowsInstallerConstants.MsidbEmbeddedHandlesBasic : 0;
441
442 var table = output.EnsureTable(this.TableDefinitions["MsiEmbeddedUI"]);
443 var row = table.CreateRow(tuple.SourceLineNumbers);
444 row[0] = tuple.Id.Id;
445 row[1] = tuple.FileName;
446 row[2] = attributes;
447 row[3] = tuple.MessageFilter;
448 row[4] = tuple.Source;
449 }
450
451 private void AddMsiServiceConfigTuple(MsiServiceConfigTuple tuple, Output output)
452 {
453 var events = tuple.OnInstall ? WindowsInstallerConstants.MsidbServiceConfigEventInstall : 0;
454 events |= tuple.OnReinstall ? WindowsInstallerConstants.MsidbServiceConfigEventReinstall : 0;
455 events |= tuple.OnUninstall ? WindowsInstallerConstants.MsidbServiceConfigEventUninstall : 0;
456
457 var table = output.EnsureTable(this.TableDefinitions["MsiServiceConfigFailureActions"]);
458 var row = table.CreateRow(tuple.SourceLineNumbers);
459 row[0] = tuple.Id.Id;
460 row[1] = tuple.Name;
461 row[2] = events;
462 row[3] = tuple.ConfigType;
463 row[4] = tuple.Argument;
464 row[5] = tuple.Component_;
465 }
466
467 private void AddMsiServiceConfigFailureActionsTuple(MsiServiceConfigFailureActionsTuple tuple, Output output)
468 {
469 var events = tuple.OnInstall ? WindowsInstallerConstants.MsidbServiceConfigEventInstall : 0;
470 events |= tuple.OnReinstall ? WindowsInstallerConstants.MsidbServiceConfigEventReinstall : 0;
471 events |= tuple.OnUninstall ? WindowsInstallerConstants.MsidbServiceConfigEventUninstall : 0;
472
473 var table = output.EnsureTable(this.TableDefinitions["MsiServiceConfig"]);
474 var row = table.CreateRow(tuple.SourceLineNumbers);
475 row[0] = tuple.Id.Id;
476 row[1] = tuple.Name;
477 row[2] = events;
478 row[3] = tuple.ResetPeriod.HasValue ? tuple.ResetPeriod : null;
479 row[4] = tuple.RebootMessage ?? "[~]";
480 row[5] = tuple.Command ?? "[~]";
481 row[6] = tuple.Actions;
482 row[7] = tuple.DelayActions;
483 row[8] = tuple.Component_;
484 }
485
120 private void AddPropertyTuple(PropertyTuple tuple, Output output) 486 private void AddPropertyTuple(PropertyTuple tuple, Output output)
121 { 487 {
122 if (String.IsNullOrEmpty(tuple.Value)) 488 if (String.IsNullOrEmpty(tuple.Value))
@@ -130,6 +496,162 @@ namespace WixToolset.Core.WindowsInstaller.Bind
130 row.Value = tuple.Value; 496 row.Value = tuple.Value;
131 } 497 }
132 498
499 private void AddRegistryTuple(RegistryTuple tuple, Output output)
500 {
501 var value = tuple.Value;
502
503 switch (tuple.ValueType)
504 {
505 case RegistryValueType.Binary:
506 value = String.Concat("#x", value);
507 break;
508 case RegistryValueType.Expandable:
509 value = String.Concat("#%", value);
510 break;
511 case RegistryValueType.Integer:
512 value = String.Concat("#", value);
513 break;
514 case RegistryValueType.MultiString:
515 switch (tuple.ValueAction)
516 {
517 case RegistryValueActionType.Append:
518 value = String.Concat("[~]", value);
519 break;
520 case RegistryValueActionType.Prepend:
521 value = String.Concat(value, "[~]");
522 break;
523 case RegistryValueActionType.Write:
524 default:
525 if (null != value && -1 == value.IndexOf("[~]", StringComparison.Ordinal))
526 {
527 value = String.Format(CultureInfo.InvariantCulture, "[~]{0}[~]", value);
528 }
529 break;
530 }
531 break;
532 case RegistryValueType.String:
533 // escape the leading '#' character for string registry keys
534 if (null != value && value.StartsWith("#", StringComparison.Ordinal))
535 {
536 value = String.Concat("#", value);
537 }
538 break;
539 }
540
541 var table = output.EnsureTable(this.TableDefinitions["Registry"]);
542 var row = table.CreateRow(tuple.SourceLineNumbers);
543 row[0] = tuple.Id.Id;
544 row[1] = tuple.Root;
545 row[2] = tuple.Key;
546 row[3] = tuple.Name;
547 row[4] = value;
548 row[5] = tuple.Component_;
549 }
550
551 private void AddRemoveRegistryTuple(RemoveRegistryTuple tuple, Output output)
552 {
553 if (tuple.Action == RemoveRegistryActionType.RemoveOnInstall)
554 {
555 var table = output.EnsureTable(this.TableDefinitions["RemoveRegistry"]);
556 var row = table.CreateRow(tuple.SourceLineNumbers);
557 row[0] = tuple.Id.Id;
558 row[1] = tuple.Root;
559 row[2] = tuple.Key;
560 row[3] = tuple.Name;
561 row[4] = tuple.Component_;
562 }
563 else // Registry table is used to remove registry keys on uninstall.
564 {
565 var table = output.EnsureTable(this.TableDefinitions["Registry"]);
566 var row = table.CreateRow(tuple.SourceLineNumbers);
567 row[0] = tuple.Id.Id;
568 row[1] = tuple.Root;
569 row[2] = tuple.Key;
570 row[3] = tuple.Name;
571 row[5] = tuple.Component_;
572 }
573 }
574
575 private void AddServiceControlTuple(ServiceControlTuple tuple, Output output)
576 {
577 var events = tuple.InstallRemove ? WindowsInstallerConstants.MsidbServiceControlEventDelete : 0;
578 events |= tuple.UninstallRemove ? WindowsInstallerConstants.MsidbServiceControlEventUninstallDelete : 0;
579 events |= tuple.InstallStart ? WindowsInstallerConstants.MsidbServiceControlEventStart : 0;
580 events |= tuple.UninstallStart ? WindowsInstallerConstants.MsidbServiceControlEventUninstallStart : 0;
581 events |= tuple.InstallStop ? WindowsInstallerConstants.MsidbServiceControlEventStop : 0;
582 events |= tuple.UninstallStop ? WindowsInstallerConstants.MsidbServiceControlEventUninstallStop : 0;
583
584 var table = output.EnsureTable(this.TableDefinitions["ServiceControl"]);
585 var row = table.CreateRow(tuple.SourceLineNumbers);
586 row[0] = tuple.Id.Id;
587 row[1] = tuple.Name;
588 row[2] = events;
589 row[3] = tuple.Arguments;
590 row[4] = tuple.Wait;
591 row[5] = tuple.Component_;
592 }
593
594 private void AddServiceInstallTuple(ServiceInstallTuple tuple, Output output)
595 {
596 var errorControl = (int)tuple.ErrorControl;
597 errorControl |= tuple.Vital ? WindowsInstallerConstants.MsidbServiceInstallErrorControlVital : 0;
598
599 var serviceType = (int)tuple.ServiceType;
600 serviceType |= tuple.Interactive ? WindowsInstallerConstants.MsidbServiceInstallInteractive : 0;
601
602 var table = output.EnsureTable(this.TableDefinitions["ServiceInstall"]);
603 var row = table.CreateRow(tuple.SourceLineNumbers);
604 row[0] = tuple.Id.Id;
605 row[1] = tuple.Name;
606 row[2] = tuple.DisplayName;
607 row[3] = serviceType;
608 row[4] = (int)tuple.StartType;
609 row[5] = errorControl;
610 row[6] = tuple.LoadOrderGroup;
611 row[7] = tuple.Dependencies;
612 row[8] = tuple.StartName;
613 row[9] = tuple.Password;
614 row[10] = tuple.Arguments;
615 row[11] = tuple.Component_;
616 row[12] = tuple.Description;
617 }
618
619 private void AddTextStyleTuple(TextStyleTuple tuple, Output output)
620 {
621 var styleBits = tuple.Bold ? WindowsInstallerConstants.MsidbTextStyleStyleBitsBold : 0;
622 styleBits |= tuple.Italic ? WindowsInstallerConstants.MsidbTextStyleStyleBitsItalic : 0;
623 styleBits |= tuple.Strike ? WindowsInstallerConstants.MsidbTextStyleStyleBitsStrike : 0;
624 styleBits |= tuple.Underline ? WindowsInstallerConstants.MsidbTextStyleStyleBitsUnderline : 0;
625
626 var table = output.EnsureTable(this.TableDefinitions["TextStyle"]);
627 var row = table.CreateRow(tuple.SourceLineNumbers);
628 row[0] = tuple.Id.Id;
629 row[1] = tuple.FaceName;
630 row[2] = tuple.Size;
631 row[3] = tuple.Color;
632 row[4] = styleBits;
633 }
634
635 private void AddUpgradeTuple(UpgradeTuple tuple, Output output)
636 {
637 var table = output.EnsureTable(this.TableDefinitions["Upgrade"]);
638 var row = (UpgradeRow)table.CreateRow(tuple.SourceLineNumbers);
639 row.UpgradeCode = tuple.UpgradeCode;
640 row.VersionMin = tuple.VersionMin;
641 row.VersionMax = tuple.VersionMax;
642 row.Language = tuple.Language;
643 row.Remove = tuple.Remove;
644 row.ActionProperty = tuple.ActionProperty;
645
646 var attributes = tuple.MigrateFeatures ? WindowsInstallerConstants.MsidbUpgradeAttributesMigrateFeatures : 0;
647 attributes |= tuple.OnlyDetect ? WindowsInstallerConstants.MsidbUpgradeAttributesOnlyDetect : 0;
648 attributes |= tuple.IgnoreRemoveFailures ? WindowsInstallerConstants.MsidbUpgradeAttributesIgnoreRemoveFailure : 0;
649 attributes |= tuple.VersionMinInclusive ? WindowsInstallerConstants.MsidbUpgradeAttributesVersionMinInclusive : 0;
650 attributes |= tuple.VersionMaxInclusive ? WindowsInstallerConstants.MsidbUpgradeAttributesVersionMaxInclusive : 0;
651 attributes |= tuple.ExcludeLanguages ? WindowsInstallerConstants.MsidbUpgradeAttributesLanguagesExclusive : 0;
652 row.Attributes = attributes;
653 }
654
133 private void AddWixActionTuple(WixActionTuple tuple, Output output) 655 private void AddWixActionTuple(WixActionTuple tuple, Output output)
134 { 656 {
135 // Get the table definition for the action (and ensure the proper table exists for a module). 657 // Get the table definition for the action (and ensure the proper table exists for a module).
@@ -243,7 +765,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
243 } 765 }
244 } 766 }
245 767
246 private void AddTupleDefaultly(IntermediateTuple tuple, Output output) 768 private void AddTupleDefaultly(IntermediateTuple tuple, Output output, bool idIsPrimaryKey = false)
247 { 769 {
248 if (!this.TableDefinitions.TryGet(tuple.Definition.Name, out var tableDefinition)) 770 if (!this.TableDefinitions.TryGet(tuple.Definition.Name, out var tableDefinition))
249 { 771 {
@@ -252,6 +774,14 @@ namespace WixToolset.Core.WindowsInstaller.Bind
252 774
253 var table = output.EnsureTable(tableDefinition); 775 var table = output.EnsureTable(tableDefinition);
254 var row = table.CreateRow(tuple.SourceLineNumbers); 776 var row = table.CreateRow(tuple.SourceLineNumbers);
777 var rowOffset = 0;
778
779 if (idIsPrimaryKey)
780 {
781 row[0] = tuple.Id.Id;
782 rowOffset = 1;
783 }
784
255 for (var i = 0; i < tuple.Fields.Length; ++i) 785 for (var i = 0; i < tuple.Fields.Length; ++i)
256 { 786 {
257 if (i < tableDefinition.Columns.Length) 787 if (i < tableDefinition.Columns.Length)
@@ -261,11 +791,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind
261 switch (column.Type) 791 switch (column.Type)
262 { 792 {
263 case ColumnType.Number: 793 case ColumnType.Number:
264 row[i] = tuple.AsNumber(i); 794 row[i + rowOffset] = tuple.AsNumber(i);
265 break; 795 break;
266 796
267 default: 797 default:
268 row[i] = tuple.AsString(i); 798 row[i + rowOffset] = tuple.AsString(i);
269 break; 799 break;
270 } 800 }
271 } 801 }
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs
index e1777246..48b208f2 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs
@@ -10,12 +10,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind
10 using System.Linq; 10 using System.Linq;
11 using System.Runtime.InteropServices; 11 using System.Runtime.InteropServices;
12 using WixToolset.Data; 12 using WixToolset.Data;
13 using WixToolset.MergeMod;
14 using WixToolset.Msi;
15 using WixToolset.Core.Native; 13 using WixToolset.Core.Native;
16 using WixToolset.Core.Bind; 14 using WixToolset.Core.Bind;
17 using WixToolset.Data.Tuples; 15 using WixToolset.Data.Tuples;
18 using WixToolset.Extensibility.Services; 16 using WixToolset.Extensibility.Services;
17 using WixToolset.Core.WindowsInstaller.Msi;
19 18
20 /// <summary> 19 /// <summary>
21 /// Retrieve files information and extract them from merge modules. 20 /// Retrieve files information and extract them from merge modules.
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs
index 4e062696..84c2dcfd 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs
@@ -10,11 +10,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind
10 using System.Text; 10 using System.Text;
11 using WixToolset.Data; 11 using WixToolset.Data;
12 using WixToolset.Extensibility; 12 using WixToolset.Extensibility;
13 using WixToolset.Msi;
14 using WixToolset.Core.Native;
15 using WixToolset.Data.WindowsInstaller; 13 using WixToolset.Data.WindowsInstaller;
16 using WixToolset.Extensibility.Services; 14 using WixToolset.Extensibility.Services;
17 using WixToolset.Extensibility.Data; 15 using WixToolset.Extensibility.Data;
16 using WixToolset.Core.WindowsInstaller.Msi;
18 17
19 internal class GenerateDatabaseCommand 18 internal class GenerateDatabaseCommand
20 { 19 {
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs
index 385ed33f..4000c923 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/MergeModulesCommand.cs
@@ -9,13 +9,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind
9 using System.Runtime.InteropServices; 9 using System.Runtime.InteropServices;
10 using System.Text; 10 using System.Text;
11 using WixToolset.Core.Bind; 11 using WixToolset.Core.Bind;
12 using WixToolset.Core.Native; 12 using WixToolset.Core.WindowsInstaller.Msi;
13 using WixToolset.Data; 13 using WixToolset.Data;
14 using WixToolset.Data.WindowsInstaller; 14 using WixToolset.Data.WindowsInstaller;
15 using WixToolset.Data.WindowsInstaller.Rows; 15 using WixToolset.Data.WindowsInstaller.Rows;
16 using WixToolset.Extensibility.Services; 16 using WixToolset.Extensibility.Services;
17 using WixToolset.MergeMod;
18 using WixToolset.Msi;
19 17
20 /// <summary> 18 /// <summary>
21 /// Update file information. 19 /// Update file information.
@@ -315,18 +313,18 @@ namespace WixToolset.Core.WindowsInstaller.Bind
315 if (!file.File.Compressed.HasValue) 313 if (!file.File.Compressed.HasValue)
316 { 314 {
317 // Clear all compression bits. 315 // Clear all compression bits.
318 attributes &= ~MsiInterop.MsidbFileAttributesCompressed; 316 attributes &= ~WindowsInstallerConstants.MsidbFileAttributesCompressed;
319 attributes &= ~MsiInterop.MsidbFileAttributesNoncompressed; 317 attributes &= ~WindowsInstallerConstants.MsidbFileAttributesNoncompressed;
320 } 318 }
321 else if (file.File.Compressed.Value) 319 else if (file.File.Compressed.Value)
322 { 320 {
323 attributes |= MsiInterop.MsidbFileAttributesCompressed; 321 attributes |= WindowsInstallerConstants.MsidbFileAttributesCompressed;
324 attributes &= ~MsiInterop.MsidbFileAttributesNoncompressed; 322 attributes &= ~WindowsInstallerConstants.MsidbFileAttributesNoncompressed;
325 } 323 }
326 else if (!file.File.Compressed.Value) 324 else if (!file.File.Compressed.Value)
327 { 325 {
328 attributes |= MsiInterop.MsidbFileAttributesNoncompressed; 326 attributes |= WindowsInstallerConstants.MsidbFileAttributesNoncompressed;
329 attributes &= ~MsiInterop.MsidbFileAttributesCompressed; 327 attributes &= ~WindowsInstallerConstants.MsidbFileAttributesCompressed;
330 } 328 }
331 329
332 recordUpdate.SetInteger(2, attributes); 330 recordUpdate.SetInteger(2, attributes);
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/PathResolver.cs b/src/WixToolset.Core.WindowsInstaller/Bind/PathResolver.cs
index 492c9137..6dc18271 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/PathResolver.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/PathResolver.cs
@@ -1,4 +1,4 @@
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. 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 2
3namespace WixToolset.Core.WindowsInstaller.Bind 3namespace WixToolset.Core.WindowsInstaller.Bind
4{ 4{
@@ -6,6 +6,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using System.IO; 7 using System.IO;
8 using WixToolset.Data; 8 using WixToolset.Data;
9 using WixToolset.Data.WindowsInstaller;
9 10
10 internal static class PathResolver 11 internal static class PathResolver
11 { 12 {
@@ -28,7 +29,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
28 { 29 {
29 if (null != componentIdGenSeeds && componentIdGenSeeds.ContainsKey(directory)) 30 if (null != componentIdGenSeeds && componentIdGenSeeds.ContainsKey(directory))
30 { 31 {
31 resolvedDirectory.Path = (string)componentIdGenSeeds[directory]; 32 resolvedDirectory.Path = componentIdGenSeeds[directory];
32 } 33 }
33 else if (canonicalize && WindowsInstallerStandard.IsStandardDirectory(directory)) 34 else if (canonicalize && WindowsInstallerStandard.IsStandardDirectory(directory))
34 { 35 {
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs
index 3ad74fd1..f5561b42 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs
@@ -7,12 +7,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind
7 using System.IO; 7 using System.IO;
8 using System.Linq; 8 using System.Linq;
9 using WixToolset.Core.Bind; 9 using WixToolset.Core.Bind;
10 using WixToolset.Core.Native; 10 using WixToolset.Core.WindowsInstaller.Msi;
11 using WixToolset.Data; 11 using WixToolset.Data;
12 using WixToolset.Data.Tuples; 12 using WixToolset.Data.Tuples;
13 using WixToolset.Extensibility.Data; 13 using WixToolset.Extensibility.Data;
14 using WixToolset.Extensibility.Services; 14 using WixToolset.Extensibility.Services;
15 using WixToolset.Msi;
16 15
17 /// <summary> 16 /// <summary>
18 /// Defines the file transfers necessary to layout the uncompressed files. 17 /// Defines the file transfers necessary to layout the uncompressed files.
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs
index 20df1fe8..f1a47f70 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs
@@ -9,6 +9,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
9 using WixToolset.Core.Native; 9 using WixToolset.Core.Native;
10 using WixToolset.Data; 10 using WixToolset.Data;
11 using WixToolset.Data.Tuples; 11 using WixToolset.Data.Tuples;
12 using WixToolset.Data.WindowsInstaller;
12 using WixToolset.Extensibility.Services; 13 using WixToolset.Extensibility.Services;
13 14
14 internal class SequenceActionsCommand 15 internal class SequenceActionsCommand
@@ -184,7 +185,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
184 } 185 }
185 else 186 else
186 { 187 {
187 scheduledActionRows = ScheduleActions(requiredActionRows); 188 scheduledActionRows = this.ScheduleActions(requiredActionRows);
188 } 189 }
189 190
190 // Remove all existing WixActionTuples from the section then add the 191 // Remove all existing WixActionTuples from the section then add the
@@ -537,7 +538,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
537 538
538 // Only add the MigrateFeatureStates action if MigrateFeature attribute is set on 539 // Only add the MigrateFeatureStates action if MigrateFeature attribute is set on
539 // at least one UpgradeVersion element. 540 // at least one UpgradeVersion element.
540 if (this.Section.Tuples.OfType<UpgradeTuple>().Any(t => (t.Attributes & MsiInterop.MsidbUpgradeAttributesMigrateFeatures) == MsiInterop.MsidbUpgradeAttributesMigrateFeatures)) 541 if (this.Section.Tuples.OfType<UpgradeTuple>().Any(t => t.MigrateFeatures))
541 { 542 {
542 set.Add("InstallExecuteSequence/MigrateFeatureStates"); 543 set.Add("InstallExecuteSequence/MigrateFeatureStates");
543 set.Add("InstallUISequence/MigrateFeatureStates"); 544 set.Add("InstallUISequence/MigrateFeatureStates");
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs
index 81300322..0df5329a 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs
@@ -9,11 +9,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind
9 using System.IO; 9 using System.IO;
10 using System.Linq; 10 using System.Linq;
11 using WixToolset.Core.Bind; 11 using WixToolset.Core.Bind;
12 using WixToolset.Core.WindowsInstaller.Msi;
12 using WixToolset.Data; 13 using WixToolset.Data;
13 using WixToolset.Data.Tuples; 14 using WixToolset.Data.Tuples;
14 using WixToolset.Data.WindowsInstaller; 15 using WixToolset.Data.WindowsInstaller;
15 using WixToolset.Extensibility.Services; 16 using WixToolset.Extensibility.Services;
16 using WixToolset.Msi;
17 17
18 /// <summary> 18 /// <summary>
19 /// Update file information. 19 /// Update file information.