diff options
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs')
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs | 600 |
1 files changed, 565 insertions, 35 deletions
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 | } |