aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller')
-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
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs3
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs402
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Differ.cs4
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.cs5
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Msi/Database.cs4
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Msi/Installer.cs4
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Msi/Interop/MsiInterop.cs697
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Msi/MsiException.cs3
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Msi/MsiHandle.cs5
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Msi/MsiInterop.cs571
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Msi/MsmInterop.cs505
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Msi/Record.cs3
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Msi/Session.cs4
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Msi/SummaryInformation.cs3
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Msi/View.cs22
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Msi/WixInvalidIdtException.cs2
-rw-r--r--src/WixToolset.Core.WindowsInstaller/MspBackend.cs1
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Unbind/ExtractCabinetsCommand.cs2
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs4
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs5
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Unbind/UnbindTranformCommand.cs5
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Validator.cs3
-rw-r--r--src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj5
35 files changed, 1922 insertions, 1023 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.
diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs
index d44a863d..2ec39583 100644
--- a/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs
@@ -6,12 +6,11 @@ namespace WixToolset.Core.WindowsInstaller.Unbind
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using System.ComponentModel; 7 using System.ComponentModel;
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.Extensibility; 11 using WixToolset.Extensibility;
12 using WixToolset.Extensibility.Data; 12 using WixToolset.Extensibility.Data;
13 using WixToolset.Extensibility.Services; 13 using WixToolset.Extensibility.Services;
14 using WixToolset.Msi;
15 14
16 internal class DecompileMsiOrMsmCommand 15 internal class DecompileMsiOrMsmCommand
17 { 16 {
diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
index 88393d6c..b6b6b8c3 100644
--- a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
@@ -13,7 +13,6 @@ namespace WixToolset.Core.WindowsInstaller
13 using System.Text.RegularExpressions; 13 using System.Text.RegularExpressions;
14 using System.Xml.Linq; 14 using System.Xml.Linq;
15 using WixToolset.Core; 15 using WixToolset.Core;
16 using WixToolset.Core.Native;
17 using WixToolset.Core.WindowsInstaller.Rows; 16 using WixToolset.Core.WindowsInstaller.Rows;
18 using WixToolset.Data; 17 using WixToolset.Data;
19 using WixToolset.Data.Tuples; 18 using WixToolset.Data.Tuples;
@@ -30,6 +29,21 @@ namespace WixToolset.Core.WindowsInstaller
30 { 29 {
31 private static readonly Regex NullSplitter = new Regex(@"\[~]"); 30 private static readonly Regex NullSplitter = new Regex(@"\[~]");
32 31
32 // NameToBit arrays
33 private static readonly string[] TextControlAttributes = { "Transparent", "NoPrefix", "NoWrap", "FormatSize", "UserLanguage" };
34 private static readonly string[] HyperlinkControlAttributes = { "Transparent" };
35 private static readonly string[] EditControlAttributes = { "Multiline", null, null, null, null, "Password" };
36 private static readonly string[] ProgressControlAttributes = { "ProgressBlocks" };
37 private static readonly string[] VolumeControlAttributes = { "Removable", "Fixed", "Remote", "CDROM", "RAMDisk", "Floppy", "ShowRollbackCost" };
38 private static readonly string[] ListboxControlAttributes = { "Sorted", null, null, null, "UserLanguage" };
39 private static readonly string[] ListviewControlAttributes = { "Sorted", null, null, null, "FixedSize", "Icon16", "Icon32" };
40 private static readonly string[] ComboboxControlAttributes = { "Sorted", "ComboList", null, null, "UserLanguage" };
41 private static readonly string[] RadioControlAttributes = { "Image", "PushLike", "Bitmap", "Icon", "FixedSize", "Icon16", "Icon32", null, "HasBorder" };
42 private static readonly string[] ButtonControlAttributes = { "Image", null, "Bitmap", "Icon", "FixedSize", "Icon16", "Icon32", "ElevationShield" };
43 private static readonly string[] IconControlAttributes = { "Image", null, null, null, "FixedSize", "Icon16", "Icon32" };
44 private static readonly string[] BitmapControlAttributes = { "Image", null, null, null, "FixedSize" };
45 private static readonly string[] CheckboxControlAttributes = { null, "PushLike", "Bitmap", "Icon", "FixedSize", "Icon16", "Icon32" };
46
33 private bool compressed; 47 private bool compressed;
34 private bool shortNames; 48 private bool shortNames;
35 private DecompilerCore core; 49 private DecompilerCore core;
@@ -205,42 +219,42 @@ namespace WixToolset.Core.WindowsInstaller
205 /// <param name="control">The control element.</param> 219 /// <param name="control">The control element.</param>
206 private static void SetControlAttributes(int attributes, Wix.Control control) 220 private static void SetControlAttributes(int attributes, Wix.Control control)
207 { 221 {
208 if (0 == (attributes & MsiInterop.MsidbControlAttributesEnabled)) 222 if (0 == (attributes & WindowsInstallerConstants.MsidbControlAttributesEnabled))
209 { 223 {
210 control.Disabled = Wix.YesNoType.yes; 224 control.Disabled = Wix.YesNoType.yes;
211 } 225 }
212 226
213 if (MsiInterop.MsidbControlAttributesIndirect == (attributes & MsiInterop.MsidbControlAttributesIndirect)) 227 if (WindowsInstallerConstants.MsidbControlAttributesIndirect == (attributes & WindowsInstallerConstants.MsidbControlAttributesIndirect))
214 { 228 {
215 control.Indirect = Wix.YesNoType.yes; 229 control.Indirect = Wix.YesNoType.yes;
216 } 230 }
217 231
218 if (MsiInterop.MsidbControlAttributesInteger == (attributes & MsiInterop.MsidbControlAttributesInteger)) 232 if (WindowsInstallerConstants.MsidbControlAttributesInteger == (attributes & WindowsInstallerConstants.MsidbControlAttributesInteger))
219 { 233 {
220 control.Integer = Wix.YesNoType.yes; 234 control.Integer = Wix.YesNoType.yes;
221 } 235 }
222 236
223 if (MsiInterop.MsidbControlAttributesLeftScroll == (attributes & MsiInterop.MsidbControlAttributesLeftScroll)) 237 if (WindowsInstallerConstants.MsidbControlAttributesLeftScroll == (attributes & WindowsInstallerConstants.MsidbControlAttributesLeftScroll))
224 { 238 {
225 control.LeftScroll = Wix.YesNoType.yes; 239 control.LeftScroll = Wix.YesNoType.yes;
226 } 240 }
227 241
228 if (MsiInterop.MsidbControlAttributesRightAligned == (attributes & MsiInterop.MsidbControlAttributesRightAligned)) 242 if (WindowsInstallerConstants.MsidbControlAttributesRightAligned == (attributes & WindowsInstallerConstants.MsidbControlAttributesRightAligned))
229 { 243 {
230 control.RightAligned = Wix.YesNoType.yes; 244 control.RightAligned = Wix.YesNoType.yes;
231 } 245 }
232 246
233 if (MsiInterop.MsidbControlAttributesRTLRO == (attributes & MsiInterop.MsidbControlAttributesRTLRO)) 247 if (WindowsInstallerConstants.MsidbControlAttributesRTLRO == (attributes & WindowsInstallerConstants.MsidbControlAttributesRTLRO))
234 { 248 {
235 control.RightToLeft = Wix.YesNoType.yes; 249 control.RightToLeft = Wix.YesNoType.yes;
236 } 250 }
237 251
238 if (MsiInterop.MsidbControlAttributesSunken == (attributes & MsiInterop.MsidbControlAttributesSunken)) 252 if (WindowsInstallerConstants.MsidbControlAttributesSunken == (attributes & WindowsInstallerConstants.MsidbControlAttributesSunken))
239 { 253 {
240 control.Sunken = Wix.YesNoType.yes; 254 control.Sunken = Wix.YesNoType.yes;
241 } 255 }
242 256
243 if (0 == (attributes & MsiInterop.MsidbControlAttributesVisible)) 257 if (0 == (attributes & WindowsInstallerConstants.MsidbControlAttributesVisible))
244 { 258 {
245 control.Hidden = Wix.YesNoType.yes; 259 control.Hidden = Wix.YesNoType.yes;
246 } 260 }
@@ -873,7 +887,7 @@ namespace WixToolset.Core.WindowsInstaller
873 887
874 component.KeyPath = Wix.YesNoType.yes; 888 component.KeyPath = Wix.YesNoType.yes;
875 } 889 }
876 else if (MsiInterop.MsidbComponentAttributesRegistryKeyPath == (attributes & MsiInterop.MsidbComponentAttributesRegistryKeyPath)) 890 else if (WindowsInstallerConstants.MsidbComponentAttributesRegistryKeyPath == (attributes & WindowsInstallerConstants.MsidbComponentAttributesRegistryKeyPath))
877 { 891 {
878 object registryObject = this.core.GetIndexedElement("Registry", Convert.ToString(row[5])); 892 object registryObject = this.core.GetIndexedElement("Registry", Convert.ToString(row[5]));
879 893
@@ -895,7 +909,7 @@ namespace WixToolset.Core.WindowsInstaller
895 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "Component", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyPath", Convert.ToString(row[5]), "Registry")); 909 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "Component", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyPath", Convert.ToString(row[5]), "Registry"));
896 } 910 }
897 } 911 }
898 else if (MsiInterop.MsidbComponentAttributesODBCDataSource == (attributes & MsiInterop.MsidbComponentAttributesODBCDataSource)) 912 else if (WindowsInstallerConstants.MsidbComponentAttributesODBCDataSource == (attributes & WindowsInstallerConstants.MsidbComponentAttributesODBCDataSource))
899 { 913 {
900 var odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement("ODBCDataSource", Convert.ToString(row[5])); 914 var odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement("ODBCDataSource", Convert.ToString(row[5]));
901 915
@@ -1765,8 +1779,8 @@ namespace WixToolset.Core.WindowsInstaller
1765 foreach (var row in customActionTable.Rows) 1779 foreach (var row in customActionTable.Rows)
1766 { 1780 {
1767 var bits = Convert.ToInt32(row[1]); 1781 var bits = Convert.ToInt32(row[1]);
1768 if (MsiInterop.MsidbCustomActionTypeHideTarget == (bits & MsiInterop.MsidbCustomActionTypeHideTarget) && 1782 if (WindowsInstallerConstants.MsidbCustomActionTypeHideTarget == (bits & WindowsInstallerConstants.MsidbCustomActionTypeHideTarget) &&
1769 MsiInterop.MsidbCustomActionTypeInScript == (bits & MsiInterop.MsidbCustomActionTypeInScript)) 1783 WindowsInstallerConstants.MsidbCustomActionTypeInScript == (bits & WindowsInstallerConstants.MsidbCustomActionTypeInScript))
1770 { 1784 {
1771 var property = (Wix.Property)this.core.GetIndexedElement("Property", Convert.ToString(row[0])); 1785 var property = (Wix.Property)this.core.GetIndexedElement("Property", Convert.ToString(row[0]));
1772 1786
@@ -2674,17 +2688,17 @@ namespace WixToolset.Core.WindowsInstaller
2674 var attr = upgradeRow.Attributes; 2688 var attr = upgradeRow.Attributes;
2675 var removeFeatures = upgradeRow.Remove; 2689 var removeFeatures = upgradeRow.Remove;
2676 2690
2677 if (MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive == (attr & MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive)) 2691 if (WindowsInstallerConstants.MsidbUpgradeAttributesVersionMaxInclusive == (attr & WindowsInstallerConstants.MsidbUpgradeAttributesVersionMaxInclusive))
2678 { 2692 {
2679 majorUpgrade.AllowSameVersionUpgrades = Wix.YesNoType.yes; 2693 majorUpgrade.AllowSameVersionUpgrades = Wix.YesNoType.yes;
2680 } 2694 }
2681 2695
2682 if (MsiInterop.MsidbUpgradeAttributesMigrateFeatures != (attr & MsiInterop.MsidbUpgradeAttributesMigrateFeatures)) 2696 if (WindowsInstallerConstants.MsidbUpgradeAttributesMigrateFeatures != (attr & WindowsInstallerConstants.MsidbUpgradeAttributesMigrateFeatures))
2683 { 2697 {
2684 majorUpgrade.MigrateFeatures = Wix.YesNoType.no; 2698 majorUpgrade.MigrateFeatures = Wix.YesNoType.no;
2685 } 2699 }
2686 2700
2687 if (MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure == (attr & MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure)) 2701 if (WindowsInstallerConstants.MsidbUpgradeAttributesIgnoreRemoveFailure == (attr & WindowsInstallerConstants.MsidbUpgradeAttributesIgnoreRemoveFailure))
2688 { 2702 {
2689 majorUpgrade.IgnoreRemoveFailure = Wix.YesNoType.yes; 2703 majorUpgrade.IgnoreRemoveFailure = Wix.YesNoType.yes;
2690 } 2704 }
@@ -4064,52 +4078,52 @@ namespace WixToolset.Core.WindowsInstaller
4064 switch (control.Type) 4078 switch (control.Type)
4065 { 4079 {
4066 case "Bitmap": 4080 case "Bitmap":
4067 specialAttributes = MsiInterop.BitmapControlAttributes; 4081 specialAttributes = BitmapControlAttributes;
4068 break; 4082 break;
4069 case "CheckBox": 4083 case "CheckBox":
4070 specialAttributes = MsiInterop.CheckboxControlAttributes; 4084 specialAttributes = CheckboxControlAttributes;
4071 break; 4085 break;
4072 case "ComboBox": 4086 case "ComboBox":
4073 specialAttributes = MsiInterop.ComboboxControlAttributes; 4087 specialAttributes = ComboboxControlAttributes;
4074 break; 4088 break;
4075 case "DirectoryCombo": 4089 case "DirectoryCombo":
4076 specialAttributes = MsiInterop.VolumeControlAttributes; 4090 specialAttributes = VolumeControlAttributes;
4077 break; 4091 break;
4078 case "Edit": 4092 case "Edit":
4079 specialAttributes = MsiInterop.EditControlAttributes; 4093 specialAttributes = EditControlAttributes;
4080 break; 4094 break;
4081 case "Icon": 4095 case "Icon":
4082 specialAttributes = MsiInterop.IconControlAttributes; 4096 specialAttributes = IconControlAttributes;
4083 break; 4097 break;
4084 case "ListBox": 4098 case "ListBox":
4085 specialAttributes = MsiInterop.ListboxControlAttributes; 4099 specialAttributes = ListboxControlAttributes;
4086 break; 4100 break;
4087 case "ListView": 4101 case "ListView":
4088 specialAttributes = MsiInterop.ListviewControlAttributes; 4102 specialAttributes = ListviewControlAttributes;
4089 break; 4103 break;
4090 case "MaskedEdit": 4104 case "MaskedEdit":
4091 specialAttributes = MsiInterop.EditControlAttributes; 4105 specialAttributes = EditControlAttributes;
4092 break; 4106 break;
4093 case "PathEdit": 4107 case "PathEdit":
4094 specialAttributes = MsiInterop.EditControlAttributes; 4108 specialAttributes = EditControlAttributes;
4095 break; 4109 break;
4096 case "ProgressBar": 4110 case "ProgressBar":
4097 specialAttributes = MsiInterop.ProgressControlAttributes; 4111 specialAttributes = ProgressControlAttributes;
4098 break; 4112 break;
4099 case "PushButton": 4113 case "PushButton":
4100 specialAttributes = MsiInterop.ButtonControlAttributes; 4114 specialAttributes = ButtonControlAttributes;
4101 break; 4115 break;
4102 case "RadioButtonGroup": 4116 case "RadioButtonGroup":
4103 specialAttributes = MsiInterop.RadioControlAttributes; 4117 specialAttributes = RadioControlAttributes;
4104 break; 4118 break;
4105 case "Text": 4119 case "Text":
4106 specialAttributes = MsiInterop.TextControlAttributes; 4120 specialAttributes = TextControlAttributes;
4107 break; 4121 break;
4108 case "VolumeCostList": 4122 case "VolumeCostList":
4109 specialAttributes = MsiInterop.VolumeControlAttributes; 4123 specialAttributes = VolumeControlAttributes;
4110 break; 4124 break;
4111 case "VolumeSelectCombo": 4125 case "VolumeSelectCombo":
4112 specialAttributes = MsiInterop.VolumeControlAttributes; 4126 specialAttributes = VolumeControlAttributes;
4113 break; 4127 break;
4114 default: 4128 default:
4115 specialAttributes = null; 4129 specialAttributes = null;
@@ -4644,52 +4658,52 @@ namespace WixToolset.Core.WindowsInstaller
4644 4658
4645 var type = Convert.ToInt32(row[1]); 4659 var type = Convert.ToInt32(row[1]);
4646 4660
4647 if (MsiInterop.MsidbCustomActionTypeHideTarget == (type & MsiInterop.MsidbCustomActionTypeHideTarget)) 4661 if (WindowsInstallerConstants.MsidbCustomActionTypeHideTarget == (type & WindowsInstallerConstants.MsidbCustomActionTypeHideTarget))
4648 { 4662 {
4649 customAction.HideTarget = Wix.YesNoType.yes; 4663 customAction.HideTarget = Wix.YesNoType.yes;
4650 } 4664 }
4651 4665
4652 if (MsiInterop.MsidbCustomActionTypeNoImpersonate == (type & MsiInterop.MsidbCustomActionTypeNoImpersonate)) 4666 if (WindowsInstallerConstants.MsidbCustomActionTypeNoImpersonate == (type & WindowsInstallerConstants.MsidbCustomActionTypeNoImpersonate))
4653 { 4667 {
4654 customAction.Impersonate = Wix.YesNoType.no; 4668 customAction.Impersonate = Wix.YesNoType.no;
4655 } 4669 }
4656 4670
4657 if (MsiInterop.MsidbCustomActionTypeTSAware == (type & MsiInterop.MsidbCustomActionTypeTSAware)) 4671 if (WindowsInstallerConstants.MsidbCustomActionTypeTSAware == (type & WindowsInstallerConstants.MsidbCustomActionTypeTSAware))
4658 { 4672 {
4659 customAction.TerminalServerAware = Wix.YesNoType.yes; 4673 customAction.TerminalServerAware = Wix.YesNoType.yes;
4660 } 4674 }
4661 4675
4662 if (MsiInterop.MsidbCustomActionType64BitScript == (type & MsiInterop.MsidbCustomActionType64BitScript)) 4676 if (WindowsInstallerConstants.MsidbCustomActionType64BitScript == (type & WindowsInstallerConstants.MsidbCustomActionType64BitScript))
4663 { 4677 {
4664 customAction.Win64 = Wix.YesNoType.yes; 4678 customAction.Win64 = Wix.YesNoType.yes;
4665 } 4679 }
4666 else if (MsiInterop.MsidbCustomActionTypeVBScript == (type & MsiInterop.MsidbCustomActionTypeVBScript) || 4680 else if (WindowsInstallerConstants.MsidbCustomActionTypeVBScript == (type & WindowsInstallerConstants.MsidbCustomActionTypeVBScript) ||
4667 MsiInterop.MsidbCustomActionTypeJScript == (type & MsiInterop.MsidbCustomActionTypeJScript)) 4681 WindowsInstallerConstants.MsidbCustomActionTypeJScript == (type & WindowsInstallerConstants.MsidbCustomActionTypeJScript))
4668 { 4682 {
4669 customAction.Win64 = Wix.YesNoType.no; 4683 customAction.Win64 = Wix.YesNoType.no;
4670 } 4684 }
4671 4685
4672 switch (type & MsiInterop.MsidbCustomActionTypeExecuteBits) 4686 switch (type & WindowsInstallerConstants.MsidbCustomActionTypeExecuteBits)
4673 { 4687 {
4674 case 0: 4688 case 0:
4675 // this is the default value 4689 // this is the default value
4676 break; 4690 break;
4677 case MsiInterop.MsidbCustomActionTypeFirstSequence: 4691 case WindowsInstallerConstants.MsidbCustomActionTypeFirstSequence:
4678 customAction.Execute = Wix.CustomAction.ExecuteType.firstSequence; 4692 customAction.Execute = Wix.CustomAction.ExecuteType.firstSequence;
4679 break; 4693 break;
4680 case MsiInterop.MsidbCustomActionTypeOncePerProcess: 4694 case WindowsInstallerConstants.MsidbCustomActionTypeOncePerProcess:
4681 customAction.Execute = Wix.CustomAction.ExecuteType.oncePerProcess; 4695 customAction.Execute = Wix.CustomAction.ExecuteType.oncePerProcess;
4682 break; 4696 break;
4683 case MsiInterop.MsidbCustomActionTypeClientRepeat: 4697 case WindowsInstallerConstants.MsidbCustomActionTypeClientRepeat:
4684 customAction.Execute = Wix.CustomAction.ExecuteType.secondSequence; 4698 customAction.Execute = Wix.CustomAction.ExecuteType.secondSequence;
4685 break; 4699 break;
4686 case MsiInterop.MsidbCustomActionTypeInScript: 4700 case WindowsInstallerConstants.MsidbCustomActionTypeInScript:
4687 customAction.Execute = Wix.CustomAction.ExecuteType.deferred; 4701 customAction.Execute = Wix.CustomAction.ExecuteType.deferred;
4688 break; 4702 break;
4689 case MsiInterop.MsidbCustomActionTypeInScript + MsiInterop.MsidbCustomActionTypeRollback: 4703 case WindowsInstallerConstants.MsidbCustomActionTypeInScript + WindowsInstallerConstants.MsidbCustomActionTypeRollback:
4690 customAction.Execute = Wix.CustomAction.ExecuteType.rollback; 4704 customAction.Execute = Wix.CustomAction.ExecuteType.rollback;
4691 break; 4705 break;
4692 case MsiInterop.MsidbCustomActionTypeInScript + MsiInterop.MsidbCustomActionTypeCommit: 4706 case WindowsInstallerConstants.MsidbCustomActionTypeInScript + WindowsInstallerConstants.MsidbCustomActionTypeCommit:
4693 customAction.Execute = Wix.CustomAction.ExecuteType.commit; 4707 customAction.Execute = Wix.CustomAction.ExecuteType.commit;
4694 break; 4708 break;
4695 default: 4709 default:
@@ -4697,18 +4711,18 @@ namespace WixToolset.Core.WindowsInstaller
4697 break; 4711 break;
4698 } 4712 }
4699 4713
4700 switch (type & MsiInterop.MsidbCustomActionTypeReturnBits) 4714 switch (type & WindowsInstallerConstants.MsidbCustomActionTypeReturnBits)
4701 { 4715 {
4702 case 0: 4716 case 0:
4703 // this is the default value 4717 // this is the default value
4704 break; 4718 break;
4705 case MsiInterop.MsidbCustomActionTypeContinue: 4719 case WindowsInstallerConstants.MsidbCustomActionTypeContinue:
4706 customAction.Return = Wix.CustomAction.ReturnType.ignore; 4720 customAction.Return = Wix.CustomAction.ReturnType.ignore;
4707 break; 4721 break;
4708 case MsiInterop.MsidbCustomActionTypeAsync: 4722 case WindowsInstallerConstants.MsidbCustomActionTypeAsync:
4709 customAction.Return = Wix.CustomAction.ReturnType.asyncWait; 4723 customAction.Return = Wix.CustomAction.ReturnType.asyncWait;
4710 break; 4724 break;
4711 case MsiInterop.MsidbCustomActionTypeAsync + MsiInterop.MsidbCustomActionTypeContinue: 4725 case WindowsInstallerConstants.MsidbCustomActionTypeAsync + WindowsInstallerConstants.MsidbCustomActionTypeContinue:
4712 customAction.Return = Wix.CustomAction.ReturnType.asyncNoWait; 4726 customAction.Return = Wix.CustomAction.ReturnType.asyncNoWait;
4713 break; 4727 break;
4714 default: 4728 default:
@@ -4716,25 +4730,25 @@ namespace WixToolset.Core.WindowsInstaller
4716 break; 4730 break;
4717 } 4731 }
4718 4732
4719 var source = type & MsiInterop.MsidbCustomActionTypeSourceBits; 4733 var source = type & WindowsInstallerConstants.MsidbCustomActionTypeSourceBits;
4720 switch (source) 4734 switch (source)
4721 { 4735 {
4722 case MsiInterop.MsidbCustomActionTypeBinaryData: 4736 case WindowsInstallerConstants.MsidbCustomActionTypeBinaryData:
4723 customAction.BinaryKey = Convert.ToString(row[2]); 4737 customAction.BinaryKey = Convert.ToString(row[2]);
4724 break; 4738 break;
4725 case MsiInterop.MsidbCustomActionTypeSourceFile: 4739 case WindowsInstallerConstants.MsidbCustomActionTypeSourceFile:
4726 if (null != row[2]) 4740 if (null != row[2])
4727 { 4741 {
4728 customAction.FileKey = Convert.ToString(row[2]); 4742 customAction.FileKey = Convert.ToString(row[2]);
4729 } 4743 }
4730 break; 4744 break;
4731 case MsiInterop.MsidbCustomActionTypeDirectory: 4745 case WindowsInstallerConstants.MsidbCustomActionTypeDirectory:
4732 if (null != row[2]) 4746 if (null != row[2])
4733 { 4747 {
4734 customAction.Directory = Convert.ToString(row[2]); 4748 customAction.Directory = Convert.ToString(row[2]);
4735 } 4749 }
4736 break; 4750 break;
4737 case MsiInterop.MsidbCustomActionTypeProperty: 4751 case WindowsInstallerConstants.MsidbCustomActionTypeProperty:
4738 customAction.Property = Convert.ToString(row[2]); 4752 customAction.Property = Convert.ToString(row[2]);
4739 break; 4753 break;
4740 default: 4754 default:
@@ -4742,16 +4756,16 @@ namespace WixToolset.Core.WindowsInstaller
4742 break; 4756 break;
4743 } 4757 }
4744 4758
4745 switch (type & MsiInterop.MsidbCustomActionTypeTargetBits) 4759 switch (type & WindowsInstallerConstants.MsidbCustomActionTypeTargetBits)
4746 { 4760 {
4747 case MsiInterop.MsidbCustomActionTypeDll: 4761 case WindowsInstallerConstants.MsidbCustomActionTypeDll:
4748 customAction.DllEntry = Convert.ToString(row[3]); 4762 customAction.DllEntry = Convert.ToString(row[3]);
4749 break; 4763 break;
4750 case MsiInterop.MsidbCustomActionTypeExe: 4764 case WindowsInstallerConstants.MsidbCustomActionTypeExe:
4751 customAction.ExeCommand = Convert.ToString(row[3]); 4765 customAction.ExeCommand = Convert.ToString(row[3]);
4752 break; 4766 break;
4753 case MsiInterop.MsidbCustomActionTypeTextData: 4767 case WindowsInstallerConstants.MsidbCustomActionTypeTextData:
4754 if (MsiInterop.MsidbCustomActionTypeSourceFile == source) 4768 if (WindowsInstallerConstants.MsidbCustomActionTypeSourceFile == source)
4755 { 4769 {
4756 customAction.Error = Convert.ToString(row[3]); 4770 customAction.Error = Convert.ToString(row[3]);
4757 } 4771 }
@@ -4760,8 +4774,8 @@ namespace WixToolset.Core.WindowsInstaller
4760 customAction.Value = Convert.ToString(row[3]); 4774 customAction.Value = Convert.ToString(row[3]);
4761 } 4775 }
4762 break; 4776 break;
4763 case MsiInterop.MsidbCustomActionTypeJScript: 4777 case WindowsInstallerConstants.MsidbCustomActionTypeJScript:
4764 if (MsiInterop.MsidbCustomActionTypeDirectory == source) 4778 if (WindowsInstallerConstants.MsidbCustomActionTypeDirectory == source)
4765 { 4779 {
4766 customAction.Script = Wix.CustomAction.ScriptType.jscript; 4780 customAction.Script = Wix.CustomAction.ScriptType.jscript;
4767 customAction.Content = Convert.ToString(row[3]); 4781 customAction.Content = Convert.ToString(row[3]);
@@ -4771,8 +4785,8 @@ namespace WixToolset.Core.WindowsInstaller
4771 customAction.JScriptCall = Convert.ToString(row[3]); 4785 customAction.JScriptCall = Convert.ToString(row[3]);
4772 } 4786 }
4773 break; 4787 break;
4774 case MsiInterop.MsidbCustomActionTypeVBScript: 4788 case WindowsInstallerConstants.MsidbCustomActionTypeVBScript:
4775 if (MsiInterop.MsidbCustomActionTypeDirectory == source) 4789 if (WindowsInstallerConstants.MsidbCustomActionTypeDirectory == source)
4776 { 4790 {
4777 customAction.Script = Wix.CustomAction.ScriptType.vbscript; 4791 customAction.Script = Wix.CustomAction.ScriptType.vbscript;
4778 customAction.Content = Convert.ToString(row[3]); 4792 customAction.Content = Convert.ToString(row[3]);
@@ -4782,7 +4796,7 @@ namespace WixToolset.Core.WindowsInstaller
4782 customAction.VBScriptCall = Convert.ToString(row[3]); 4796 customAction.VBScriptCall = Convert.ToString(row[3]);
4783 } 4797 }
4784 break; 4798 break;
4785 case MsiInterop.MsidbCustomActionTypeInstall: 4799 case WindowsInstallerConstants.MsidbCustomActionTypeInstall:
4786 this.Messaging.Write(WarningMessages.NestedInstall(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); 4800 this.Messaging.Write(WarningMessages.NestedInstall(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1]));
4787 continue; 4801 continue;
4788 default: 4802 default:
@@ -4791,7 +4805,7 @@ namespace WixToolset.Core.WindowsInstaller
4791 } 4805 }
4792 4806
4793 var extype = 4 < row.Fields.Length && null != row[4] ? Convert.ToInt32(row[4]) : 0; 4807 var extype = 4 < row.Fields.Length && null != row[4] ? Convert.ToInt32(row[4]) : 0;
4794 if (MsiInterop.MsidbCustomActionTypePatchUninstall == (extype & MsiInterop.MsidbCustomActionTypePatchUninstall)) 4808 if (WindowsInstallerConstants.MsidbCustomActionTypePatchUninstall == (extype & WindowsInstallerConstants.MsidbCustomActionTypePatchUninstall))
4795 { 4809 {
4796 customAction.PatchUninstall = Wix.YesNoType.yes; 4810 customAction.PatchUninstall = Wix.YesNoType.yes;
4797 } 4811 }
@@ -4819,10 +4833,10 @@ namespace WixToolset.Core.WindowsInstaller
4819 { 4833 {
4820 switch (Convert.ToInt32(row[2])) 4834 switch (Convert.ToInt32(row[2]))
4821 { 4835 {
4822 case MsiInterop.MsidbLocatorTypeDirectory: 4836 case WindowsInstallerConstants.MsidbLocatorTypeDirectory:
4823 componentSearch.Type = Wix.ComponentSearch.TypeType.directory; 4837 componentSearch.Type = Wix.ComponentSearch.TypeType.directory;
4824 break; 4838 break;
4825 case MsiInterop.MsidbLocatorTypeFileName: 4839 case WindowsInstallerConstants.MsidbLocatorTypeFileName:
4826 // this is the default value 4840 // this is the default value
4827 break; 4841 break;
4828 default: 4842 default:
@@ -4875,36 +4889,36 @@ namespace WixToolset.Core.WindowsInstaller
4875 4889
4876 var attributes = Convert.ToInt32(row[3]); 4890 var attributes = Convert.ToInt32(row[3]);
4877 4891
4878 if (MsiInterop.MsidbComponentAttributesSourceOnly == (attributes & MsiInterop.MsidbComponentAttributesSourceOnly)) 4892 if (WindowsInstallerConstants.MsidbComponentAttributesSourceOnly == (attributes & WindowsInstallerConstants.MsidbComponentAttributesSourceOnly))
4879 { 4893 {
4880 component.Location = Wix.Component.LocationType.source; 4894 component.Location = Wix.Component.LocationType.source;
4881 } 4895 }
4882 else if (MsiInterop.MsidbComponentAttributesOptional == (attributes & MsiInterop.MsidbComponentAttributesOptional)) 4896 else if (WindowsInstallerConstants.MsidbComponentAttributesOptional == (attributes & WindowsInstallerConstants.MsidbComponentAttributesOptional))
4883 { 4897 {
4884 component.Location = Wix.Component.LocationType.either; 4898 component.Location = Wix.Component.LocationType.either;
4885 } 4899 }
4886 4900
4887 if (MsiInterop.MsidbComponentAttributesSharedDllRefCount == (attributes & MsiInterop.MsidbComponentAttributesSharedDllRefCount)) 4901 if (WindowsInstallerConstants.MsidbComponentAttributesSharedDllRefCount == (attributes & WindowsInstallerConstants.MsidbComponentAttributesSharedDllRefCount))
4888 { 4902 {
4889 component.SharedDllRefCount = Wix.YesNoType.yes; 4903 component.SharedDllRefCount = Wix.YesNoType.yes;
4890 } 4904 }
4891 4905
4892 if (MsiInterop.MsidbComponentAttributesPermanent == (attributes & MsiInterop.MsidbComponentAttributesPermanent)) 4906 if (WindowsInstallerConstants.MsidbComponentAttributesPermanent == (attributes & WindowsInstallerConstants.MsidbComponentAttributesPermanent))
4893 { 4907 {
4894 component.Permanent = Wix.YesNoType.yes; 4908 component.Permanent = Wix.YesNoType.yes;
4895 } 4909 }
4896 4910
4897 if (MsiInterop.MsidbComponentAttributesTransitive == (attributes & MsiInterop.MsidbComponentAttributesTransitive)) 4911 if (WindowsInstallerConstants.MsidbComponentAttributesTransitive == (attributes & WindowsInstallerConstants.MsidbComponentAttributesTransitive))
4898 { 4912 {
4899 component.Transitive = Wix.YesNoType.yes; 4913 component.Transitive = Wix.YesNoType.yes;
4900 } 4914 }
4901 4915
4902 if (MsiInterop.MsidbComponentAttributesNeverOverwrite == (attributes & MsiInterop.MsidbComponentAttributesNeverOverwrite)) 4916 if (WindowsInstallerConstants.MsidbComponentAttributesNeverOverwrite == (attributes & WindowsInstallerConstants.MsidbComponentAttributesNeverOverwrite))
4903 { 4917 {
4904 component.NeverOverwrite = Wix.YesNoType.yes; 4918 component.NeverOverwrite = Wix.YesNoType.yes;
4905 } 4919 }
4906 4920
4907 if (MsiInterop.MsidbComponentAttributes64bit == (attributes & MsiInterop.MsidbComponentAttributes64bit)) 4921 if (WindowsInstallerConstants.MsidbComponentAttributes64bit == (attributes & WindowsInstallerConstants.MsidbComponentAttributes64bit))
4908 { 4922 {
4909 component.Win64 = Wix.YesNoType.yes; 4923 component.Win64 = Wix.YesNoType.yes;
4910 } 4924 }
@@ -4913,17 +4927,17 @@ namespace WixToolset.Core.WindowsInstaller
4913 component.Win64 = Wix.YesNoType.no; 4927 component.Win64 = Wix.YesNoType.no;
4914 } 4928 }
4915 4929
4916 if (MsiInterop.MsidbComponentAttributesDisableRegistryReflection == (attributes & MsiInterop.MsidbComponentAttributesDisableRegistryReflection)) 4930 if (WindowsInstallerConstants.MsidbComponentAttributesDisableRegistryReflection == (attributes & WindowsInstallerConstants.MsidbComponentAttributesDisableRegistryReflection))
4917 { 4931 {
4918 component.DisableRegistryReflection = Wix.YesNoType.yes; 4932 component.DisableRegistryReflection = Wix.YesNoType.yes;
4919 } 4933 }
4920 4934
4921 if (MsiInterop.MsidbComponentAttributesUninstallOnSupersedence == (attributes & MsiInterop.MsidbComponentAttributesUninstallOnSupersedence)) 4935 if (WindowsInstallerConstants.MsidbComponentAttributesUninstallOnSupersedence == (attributes & WindowsInstallerConstants.MsidbComponentAttributesUninstallOnSupersedence))
4922 { 4936 {
4923 component.UninstallWhenSuperseded = Wix.YesNoType.yes; 4937 component.UninstallWhenSuperseded = Wix.YesNoType.yes;
4924 } 4938 }
4925 4939
4926 if (MsiInterop.MsidbComponentAttributesShared == (attributes & MsiInterop.MsidbComponentAttributesShared)) 4940 if (WindowsInstallerConstants.MsidbComponentAttributesShared == (attributes & WindowsInstallerConstants.MsidbComponentAttributesShared))
4927 { 4941 {
4928 component.Shared = Wix.YesNoType.yes; 4942 component.Shared = Wix.YesNoType.yes;
4929 } 4943 }
@@ -5003,57 +5017,57 @@ namespace WixToolset.Core.WindowsInstaller
5003 { 5017 {
5004 var attributes = Convert.ToInt32(row[5]); 5018 var attributes = Convert.ToInt32(row[5]);
5005 5019
5006 if (0 == (attributes & MsiInterop.MsidbDialogAttributesVisible)) 5020 if (0 == (attributes & WindowsInstallerConstants.MsidbDialogAttributesVisible))
5007 { 5021 {
5008 dialog.Hidden = Wix.YesNoType.yes; 5022 dialog.Hidden = Wix.YesNoType.yes;
5009 } 5023 }
5010 5024
5011 if (0 == (attributes & MsiInterop.MsidbDialogAttributesModal)) 5025 if (0 == (attributes & WindowsInstallerConstants.MsidbDialogAttributesModal))
5012 { 5026 {
5013 dialog.Modeless = Wix.YesNoType.yes; 5027 dialog.Modeless = Wix.YesNoType.yes;
5014 } 5028 }
5015 5029
5016 if (0 == (attributes & MsiInterop.MsidbDialogAttributesMinimize)) 5030 if (0 == (attributes & WindowsInstallerConstants.MsidbDialogAttributesMinimize))
5017 { 5031 {
5018 dialog.NoMinimize = Wix.YesNoType.yes; 5032 dialog.NoMinimize = Wix.YesNoType.yes;
5019 } 5033 }
5020 5034
5021 if (MsiInterop.MsidbDialogAttributesSysModal == (attributes & MsiInterop.MsidbDialogAttributesSysModal)) 5035 if (WindowsInstallerConstants.MsidbDialogAttributesSysModal == (attributes & WindowsInstallerConstants.MsidbDialogAttributesSysModal))
5022 { 5036 {
5023 dialog.SystemModal = Wix.YesNoType.yes; 5037 dialog.SystemModal = Wix.YesNoType.yes;
5024 } 5038 }
5025 5039
5026 if (MsiInterop.MsidbDialogAttributesKeepModeless == (attributes & MsiInterop.MsidbDialogAttributesKeepModeless)) 5040 if (WindowsInstallerConstants.MsidbDialogAttributesKeepModeless == (attributes & WindowsInstallerConstants.MsidbDialogAttributesKeepModeless))
5027 { 5041 {
5028 dialog.KeepModeless = Wix.YesNoType.yes; 5042 dialog.KeepModeless = Wix.YesNoType.yes;
5029 } 5043 }
5030 5044
5031 if (MsiInterop.MsidbDialogAttributesTrackDiskSpace == (attributes & MsiInterop.MsidbDialogAttributesTrackDiskSpace)) 5045 if (WindowsInstallerConstants.MsidbDialogAttributesTrackDiskSpace == (attributes & WindowsInstallerConstants.MsidbDialogAttributesTrackDiskSpace))
5032 { 5046 {
5033 dialog.TrackDiskSpace = Wix.YesNoType.yes; 5047 dialog.TrackDiskSpace = Wix.YesNoType.yes;
5034 } 5048 }
5035 5049
5036 if (MsiInterop.MsidbDialogAttributesUseCustomPalette == (attributes & MsiInterop.MsidbDialogAttributesUseCustomPalette)) 5050 if (WindowsInstallerConstants.MsidbDialogAttributesUseCustomPalette == (attributes & WindowsInstallerConstants.MsidbDialogAttributesUseCustomPalette))
5037 { 5051 {
5038 dialog.CustomPalette = Wix.YesNoType.yes; 5052 dialog.CustomPalette = Wix.YesNoType.yes;
5039 } 5053 }
5040 5054
5041 if (MsiInterop.MsidbDialogAttributesRTLRO == (attributes & MsiInterop.MsidbDialogAttributesRTLRO)) 5055 if (WindowsInstallerConstants.MsidbDialogAttributesRTLRO == (attributes & WindowsInstallerConstants.MsidbDialogAttributesRTLRO))
5042 { 5056 {
5043 dialog.RightToLeft = Wix.YesNoType.yes; 5057 dialog.RightToLeft = Wix.YesNoType.yes;
5044 } 5058 }
5045 5059
5046 if (MsiInterop.MsidbDialogAttributesRightAligned == (attributes & MsiInterop.MsidbDialogAttributesRightAligned)) 5060 if (WindowsInstallerConstants.MsidbDialogAttributesRightAligned == (attributes & WindowsInstallerConstants.MsidbDialogAttributesRightAligned))
5047 { 5061 {
5048 dialog.RightAligned = Wix.YesNoType.yes; 5062 dialog.RightAligned = Wix.YesNoType.yes;
5049 } 5063 }
5050 5064
5051 if (MsiInterop.MsidbDialogAttributesLeftScroll == (attributes & MsiInterop.MsidbDialogAttributesLeftScroll)) 5065 if (WindowsInstallerConstants.MsidbDialogAttributesLeftScroll == (attributes & WindowsInstallerConstants.MsidbDialogAttributesLeftScroll))
5052 { 5066 {
5053 dialog.LeftScroll = Wix.YesNoType.yes; 5067 dialog.LeftScroll = Wix.YesNoType.yes;
5054 } 5068 }
5055 5069
5056 if (MsiInterop.MsidbDialogAttributesError == (attributes & MsiInterop.MsidbDialogAttributesError)) 5070 if (WindowsInstallerConstants.MsidbDialogAttributesError == (attributes & WindowsInstallerConstants.MsidbDialogAttributesError))
5057 { 5071 {
5058 dialog.ErrorDialog = Wix.YesNoType.yes; 5072 dialog.ErrorDialog = Wix.YesNoType.yes;
5059 } 5073 }
@@ -5558,40 +5572,40 @@ namespace WixToolset.Core.WindowsInstaller
5558 5572
5559 var attributes = Convert.ToInt32(row[7]); 5573 var attributes = Convert.ToInt32(row[7]);
5560 5574
5561 if (MsiInterop.MsidbFeatureAttributesFavorSource == (attributes & MsiInterop.MsidbFeatureAttributesFavorSource) && MsiInterop.MsidbFeatureAttributesFollowParent == (attributes & MsiInterop.MsidbFeatureAttributesFollowParent)) 5575 if (WindowsInstallerConstants.MsidbFeatureAttributesFavorSource == (attributes & WindowsInstallerConstants.MsidbFeatureAttributesFavorSource) && WindowsInstallerConstants.MsidbFeatureAttributesFollowParent == (attributes & WindowsInstallerConstants.MsidbFeatureAttributesFollowParent))
5562 { 5576 {
5563 // TODO: display a warning for setting favor local and follow parent together 5577 // TODO: display a warning for setting favor local and follow parent together
5564 } 5578 }
5565 else if (MsiInterop.MsidbFeatureAttributesFavorSource == (attributes & MsiInterop.MsidbFeatureAttributesFavorSource)) 5579 else if (WindowsInstallerConstants.MsidbFeatureAttributesFavorSource == (attributes & WindowsInstallerConstants.MsidbFeatureAttributesFavorSource))
5566 { 5580 {
5567 feature.InstallDefault = Wix.Feature.InstallDefaultType.source; 5581 feature.InstallDefault = Wix.Feature.InstallDefaultType.source;
5568 } 5582 }
5569 else if (MsiInterop.MsidbFeatureAttributesFollowParent == (attributes & MsiInterop.MsidbFeatureAttributesFollowParent)) 5583 else if (WindowsInstallerConstants.MsidbFeatureAttributesFollowParent == (attributes & WindowsInstallerConstants.MsidbFeatureAttributesFollowParent))
5570 { 5584 {
5571 feature.InstallDefault = Wix.Feature.InstallDefaultType.followParent; 5585 feature.InstallDefault = Wix.Feature.InstallDefaultType.followParent;
5572 } 5586 }
5573 5587
5574 if (MsiInterop.MsidbFeatureAttributesFavorAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesFavorAdvertise)) 5588 if (WindowsInstallerConstants.MsidbFeatureAttributesFavorAdvertise == (attributes & WindowsInstallerConstants.MsidbFeatureAttributesFavorAdvertise))
5575 { 5589 {
5576 feature.TypicalDefault = Wix.Feature.TypicalDefaultType.advertise; 5590 feature.TypicalDefault = Wix.Feature.TypicalDefaultType.advertise;
5577 } 5591 }
5578 5592
5579 if (MsiInterop.MsidbFeatureAttributesDisallowAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesDisallowAdvertise) && 5593 if (WindowsInstallerConstants.MsidbFeatureAttributesDisallowAdvertise == (attributes & WindowsInstallerConstants.MsidbFeatureAttributesDisallowAdvertise) &&
5580 MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise)) 5594 WindowsInstallerConstants.MsidbFeatureAttributesNoUnsupportedAdvertise == (attributes & WindowsInstallerConstants.MsidbFeatureAttributesNoUnsupportedAdvertise))
5581 { 5595 {
5582 this.Messaging.Write(WarningMessages.InvalidAttributeCombination(row.SourceLineNumbers, "msidbFeatureAttributesDisallowAdvertise", "msidbFeatureAttributesNoUnsupportedAdvertise", "Feature.AllowAdvertiseType", "no")); 5596 this.Messaging.Write(WarningMessages.InvalidAttributeCombination(row.SourceLineNumbers, "msidbFeatureAttributesDisallowAdvertise", "msidbFeatureAttributesNoUnsupportedAdvertise", "Feature.AllowAdvertiseType", "no"));
5583 feature.AllowAdvertise = Wix.Feature.AllowAdvertiseType.no; 5597 feature.AllowAdvertise = Wix.Feature.AllowAdvertiseType.no;
5584 } 5598 }
5585 else if (MsiInterop.MsidbFeatureAttributesDisallowAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesDisallowAdvertise)) 5599 else if (WindowsInstallerConstants.MsidbFeatureAttributesDisallowAdvertise == (attributes & WindowsInstallerConstants.MsidbFeatureAttributesDisallowAdvertise))
5586 { 5600 {
5587 feature.AllowAdvertise = Wix.Feature.AllowAdvertiseType.no; 5601 feature.AllowAdvertise = Wix.Feature.AllowAdvertiseType.no;
5588 } 5602 }
5589 else if (MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise)) 5603 else if (WindowsInstallerConstants.MsidbFeatureAttributesNoUnsupportedAdvertise == (attributes & WindowsInstallerConstants.MsidbFeatureAttributesNoUnsupportedAdvertise))
5590 { 5604 {
5591 feature.AllowAdvertise = Wix.Feature.AllowAdvertiseType.system; 5605 feature.AllowAdvertise = Wix.Feature.AllowAdvertiseType.system;
5592 } 5606 }
5593 5607
5594 if (MsiInterop.MsidbFeatureAttributesUIDisallowAbsent == (attributes & MsiInterop.MsidbFeatureAttributesUIDisallowAbsent)) 5608 if (WindowsInstallerConstants.MsidbFeatureAttributesUIDisallowAbsent == (attributes & WindowsInstallerConstants.MsidbFeatureAttributesUIDisallowAbsent))
5595 { 5609 {
5596 feature.Absent = Wix.Feature.AbsentType.disallow; 5610 feature.Absent = Wix.Feature.AbsentType.disallow;
5597 } 5611 }
@@ -5687,41 +5701,41 @@ namespace WixToolset.Core.WindowsInstaller
5687 } 5701 }
5688 } 5702 }
5689 5703
5690 if (MsiInterop.MsidbFileAttributesReadOnly == (fileRow.Attributes & MsiInterop.MsidbFileAttributesReadOnly)) 5704 if (WindowsInstallerConstants.MsidbFileAttributesReadOnly == (fileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesReadOnly))
5691 { 5705 {
5692 file.ReadOnly = Wix.YesNoType.yes; 5706 file.ReadOnly = Wix.YesNoType.yes;
5693 } 5707 }
5694 5708
5695 if (MsiInterop.MsidbFileAttributesHidden == (fileRow.Attributes & MsiInterop.MsidbFileAttributesHidden)) 5709 if (WindowsInstallerConstants.MsidbFileAttributesHidden == (fileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesHidden))
5696 { 5710 {
5697 file.Hidden = Wix.YesNoType.yes; 5711 file.Hidden = Wix.YesNoType.yes;
5698 } 5712 }
5699 5713
5700 if (MsiInterop.MsidbFileAttributesSystem == (fileRow.Attributes & MsiInterop.MsidbFileAttributesSystem)) 5714 if (WindowsInstallerConstants.MsidbFileAttributesSystem == (fileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesSystem))
5701 { 5715 {
5702 file.System = Wix.YesNoType.yes; 5716 file.System = Wix.YesNoType.yes;
5703 } 5717 }
5704 5718
5705 if (MsiInterop.MsidbFileAttributesVital != (fileRow.Attributes & MsiInterop.MsidbFileAttributesVital)) 5719 if (WindowsInstallerConstants.MsidbFileAttributesVital != (fileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesVital))
5706 { 5720 {
5707 file.Vital = Wix.YesNoType.no; 5721 file.Vital = Wix.YesNoType.no;
5708 } 5722 }
5709 5723
5710 if (MsiInterop.MsidbFileAttributesChecksum == (fileRow.Attributes & MsiInterop.MsidbFileAttributesChecksum)) 5724 if (WindowsInstallerConstants.MsidbFileAttributesChecksum == (fileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesChecksum))
5711 { 5725 {
5712 file.Checksum = Wix.YesNoType.yes; 5726 file.Checksum = Wix.YesNoType.yes;
5713 } 5727 }
5714 5728
5715 if (MsiInterop.MsidbFileAttributesNoncompressed == (fileRow.Attributes & MsiInterop.MsidbFileAttributesNoncompressed) && 5729 if (WindowsInstallerConstants.MsidbFileAttributesNoncompressed == (fileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesNoncompressed) &&
5716 MsiInterop.MsidbFileAttributesCompressed == (fileRow.Attributes & MsiInterop.MsidbFileAttributesCompressed)) 5730 WindowsInstallerConstants.MsidbFileAttributesCompressed == (fileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesCompressed))
5717 { 5731 {
5718 // TODO: error 5732 // TODO: error
5719 } 5733 }
5720 else if (MsiInterop.MsidbFileAttributesNoncompressed == (fileRow.Attributes & MsiInterop.MsidbFileAttributesNoncompressed)) 5734 else if (WindowsInstallerConstants.MsidbFileAttributesNoncompressed == (fileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesNoncompressed))
5721 { 5735 {
5722 file.Compressed = Wix.YesNoDefaultType.no; 5736 file.Compressed = Wix.YesNoDefaultType.no;
5723 } 5737 }
5724 else if (MsiInterop.MsidbFileAttributesCompressed == (fileRow.Attributes & MsiInterop.MsidbFileAttributesCompressed)) 5738 else if (WindowsInstallerConstants.MsidbFileAttributesCompressed == (fileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesCompressed))
5725 { 5739 {
5726 file.Compressed = Wix.YesNoDefaultType.yes; 5740 file.Compressed = Wix.YesNoDefaultType.yes;
5727 } 5741 }
@@ -5886,13 +5900,13 @@ namespace WixToolset.Core.WindowsInstaller
5886 5900
5887 switch (Convert.ToInt32(row[6])) 5901 switch (Convert.ToInt32(row[6]))
5888 { 5902 {
5889 case MsiInterop.MsidbIniFileActionAddLine: 5903 case WindowsInstallerConstants.MsidbIniFileActionAddLine:
5890 iniFile.Action = Wix.IniFile.ActionType.addLine; 5904 iniFile.Action = Wix.IniFile.ActionType.addLine;
5891 break; 5905 break;
5892 case MsiInterop.MsidbIniFileActionCreateLine: 5906 case WindowsInstallerConstants.MsidbIniFileActionCreateLine:
5893 iniFile.Action = Wix.IniFile.ActionType.createLine; 5907 iniFile.Action = Wix.IniFile.ActionType.createLine;
5894 break; 5908 break;
5895 case MsiInterop.MsidbIniFileActionAddTag: 5909 case WindowsInstallerConstants.MsidbIniFileActionAddTag:
5896 iniFile.Action = Wix.IniFile.ActionType.addTag; 5910 iniFile.Action = Wix.IniFile.ActionType.addTag;
5897 break; 5911 break;
5898 default: 5912 default:
@@ -5953,13 +5967,13 @@ namespace WixToolset.Core.WindowsInstaller
5953 { 5967 {
5954 switch (Convert.ToInt32(row[5])) 5968 switch (Convert.ToInt32(row[5]))
5955 { 5969 {
5956 case MsiInterop.MsidbLocatorTypeDirectory: 5970 case WindowsInstallerConstants.MsidbLocatorTypeDirectory:
5957 iniFileSearch.Type = Wix.IniFileSearch.TypeType.directory; 5971 iniFileSearch.Type = Wix.IniFileSearch.TypeType.directory;
5958 break; 5972 break;
5959 case MsiInterop.MsidbLocatorTypeFileName: 5973 case WindowsInstallerConstants.MsidbLocatorTypeFileName:
5960 // this is the default value 5974 // this is the default value
5961 break; 5975 break;
5962 case MsiInterop.MsidbLocatorTypeRawValue: 5976 case WindowsInstallerConstants.MsidbLocatorTypeRawValue:
5963 iniFileSearch.Type = Wix.IniFileSearch.TypeType.raw; 5977 iniFileSearch.Type = Wix.IniFileSearch.TypeType.raw;
5964 break; 5978 break;
5965 default: 5979 default:
@@ -6371,12 +6385,12 @@ namespace WixToolset.Core.WindowsInstaller
6371 { 6385 {
6372 var attributes = Convert.ToInt32(row[5]); 6386 var attributes = Convert.ToInt32(row[5]);
6373 6387
6374 if (MsiInterop.MsidbMsmConfigurableOptionKeyNoOrphan == (attributes & MsiInterop.MsidbMsmConfigurableOptionKeyNoOrphan)) 6388 if (WindowsInstallerConstants.MsidbMsmConfigurableOptionKeyNoOrphan == (attributes & WindowsInstallerConstants.MsidbMsmConfigurableOptionKeyNoOrphan))
6375 { 6389 {
6376 configuration.KeyNoOrphan = Wix.YesNoType.yes; 6390 configuration.KeyNoOrphan = Wix.YesNoType.yes;
6377 } 6391 }
6378 6392
6379 if (MsiInterop.MsidbMsmConfigurableOptionNonNullable == (attributes & MsiInterop.MsidbMsmConfigurableOptionNonNullable)) 6393 if (WindowsInstallerConstants.MsidbMsmConfigurableOptionNonNullable == (attributes & WindowsInstallerConstants.MsidbMsmConfigurableOptionNonNullable))
6380 { 6394 {
6381 configuration.NonNullable = Wix.YesNoType.yes; 6395 configuration.NonNullable = Wix.YesNoType.yes;
6382 } 6396 }
@@ -6579,7 +6593,7 @@ namespace WixToolset.Core.WindowsInstaller
6579 { 6593 {
6580 case 0: 6594 case 0:
6581 break; 6595 break;
6582 case MsiInterop.MsidbMoveFileOptionsMove: 6596 case WindowsInstallerConstants.MsidbMoveFileOptionsMove:
6583 copyFile.Delete = Wix.YesNoType.yes; 6597 copyFile.Delete = Wix.YesNoType.yes;
6584 break; 6598 break;
6585 default: 6599 default:
@@ -6676,13 +6690,13 @@ namespace WixToolset.Core.WindowsInstaller
6676 6690
6677 switch (Convert.ToInt32(row[4])) 6691 switch (Convert.ToInt32(row[4]))
6678 { 6692 {
6679 case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeBinaryData: 6693 case WindowsInstallerConstants.MsidbCustomActionTypeExe + WindowsInstallerConstants.MsidbCustomActionTypeBinaryData:
6680 embeddedChainer.BinarySource = Convert.ToString(row[3]); 6694 embeddedChainer.BinarySource = Convert.ToString(row[3]);
6681 break; 6695 break;
6682 case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeSourceFile: 6696 case WindowsInstallerConstants.MsidbCustomActionTypeExe + WindowsInstallerConstants.MsidbCustomActionTypeSourceFile:
6683 embeddedChainer.FileSource = Convert.ToString(row[3]); 6697 embeddedChainer.FileSource = Convert.ToString(row[3]);
6684 break; 6698 break;
6685 case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeProperty: 6699 case WindowsInstallerConstants.MsidbCustomActionTypeExe + WindowsInstallerConstants.MsidbCustomActionTypeProperty:
6686 embeddedChainer.PropertySource = Convert.ToString(row[3]); 6700 embeddedChainer.PropertySource = Convert.ToString(row[3]);
6687 break; 6701 break;
6688 default: 6702 default:
@@ -6708,7 +6722,7 @@ namespace WixToolset.Core.WindowsInstaller
6708 { 6722 {
6709 var attributes = Convert.ToInt32(row[2]); 6723 var attributes = Convert.ToInt32(row[2]);
6710 6724
6711 if (MsiInterop.MsidbEmbeddedUI == (attributes & MsiInterop.MsidbEmbeddedUI)) 6725 if (WindowsInstallerConstants.MsidbEmbeddedUI == (attributes & WindowsInstallerConstants.MsidbEmbeddedUI))
6712 { 6726 {
6713 if (foundEmbeddedUI) 6727 if (foundEmbeddedUI)
6714 { 6728 {
@@ -6720,97 +6734,97 @@ namespace WixToolset.Core.WindowsInstaller
6720 embeddedUI.Name = Convert.ToString(row[1]); 6734 embeddedUI.Name = Convert.ToString(row[1]);
6721 6735
6722 var messageFilter = Convert.ToInt32(row[3]); 6736 var messageFilter = Convert.ToInt32(row[3]);
6723 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_FATALEXIT)) 6737 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_FATALEXIT))
6724 { 6738 {
6725 embeddedUI.IgnoreFatalExit = Wix.YesNoType.yes; 6739 embeddedUI.IgnoreFatalExit = Wix.YesNoType.yes;
6726 } 6740 }
6727 6741
6728 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_ERROR)) 6742 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_ERROR))
6729 { 6743 {
6730 embeddedUI.IgnoreError = Wix.YesNoType.yes; 6744 embeddedUI.IgnoreError = Wix.YesNoType.yes;
6731 } 6745 }
6732 6746
6733 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_WARNING)) 6747 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_WARNING))
6734 { 6748 {
6735 embeddedUI.IgnoreWarning = Wix.YesNoType.yes; 6749 embeddedUI.IgnoreWarning = Wix.YesNoType.yes;
6736 } 6750 }
6737 6751
6738 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_USER)) 6752 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_USER))
6739 { 6753 {
6740 embeddedUI.IgnoreUser = Wix.YesNoType.yes; 6754 embeddedUI.IgnoreUser = Wix.YesNoType.yes;
6741 } 6755 }
6742 6756
6743 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_INFO)) 6757 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_INFO))
6744 { 6758 {
6745 embeddedUI.IgnoreInfo = Wix.YesNoType.yes; 6759 embeddedUI.IgnoreInfo = Wix.YesNoType.yes;
6746 } 6760 }
6747 6761
6748 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_FILESINUSE)) 6762 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_FILESINUSE))
6749 { 6763 {
6750 embeddedUI.IgnoreFilesInUse = Wix.YesNoType.yes; 6764 embeddedUI.IgnoreFilesInUse = Wix.YesNoType.yes;
6751 } 6765 }
6752 6766
6753 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_RESOLVESOURCE)) 6767 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_RESOLVESOURCE))
6754 { 6768 {
6755 embeddedUI.IgnoreResolveSource = Wix.YesNoType.yes; 6769 embeddedUI.IgnoreResolveSource = Wix.YesNoType.yes;
6756 } 6770 }
6757 6771
6758 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_OUTOFDISKSPACE)) 6772 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_OUTOFDISKSPACE))
6759 { 6773 {
6760 embeddedUI.IgnoreOutOfDiskSpace = Wix.YesNoType.yes; 6774 embeddedUI.IgnoreOutOfDiskSpace = Wix.YesNoType.yes;
6761 } 6775 }
6762 6776
6763 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_ACTIONSTART)) 6777 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_ACTIONSTART))
6764 { 6778 {
6765 embeddedUI.IgnoreActionStart = Wix.YesNoType.yes; 6779 embeddedUI.IgnoreActionStart = Wix.YesNoType.yes;
6766 } 6780 }
6767 6781
6768 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_ACTIONDATA)) 6782 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_ACTIONDATA))
6769 { 6783 {
6770 embeddedUI.IgnoreActionData = Wix.YesNoType.yes; 6784 embeddedUI.IgnoreActionData = Wix.YesNoType.yes;
6771 } 6785 }
6772 6786
6773 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_PROGRESS)) 6787 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_PROGRESS))
6774 { 6788 {
6775 embeddedUI.IgnoreProgress = Wix.YesNoType.yes; 6789 embeddedUI.IgnoreProgress = Wix.YesNoType.yes;
6776 } 6790 }
6777 6791
6778 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_COMMONDATA)) 6792 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_COMMONDATA))
6779 { 6793 {
6780 embeddedUI.IgnoreCommonData = Wix.YesNoType.yes; 6794 embeddedUI.IgnoreCommonData = Wix.YesNoType.yes;
6781 } 6795 }
6782 6796
6783 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_INITIALIZE)) 6797 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_INITIALIZE))
6784 { 6798 {
6785 embeddedUI.IgnoreInitialize = Wix.YesNoType.yes; 6799 embeddedUI.IgnoreInitialize = Wix.YesNoType.yes;
6786 } 6800 }
6787 6801
6788 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_TERMINATE)) 6802 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_TERMINATE))
6789 { 6803 {
6790 embeddedUI.IgnoreTerminate = Wix.YesNoType.yes; 6804 embeddedUI.IgnoreTerminate = Wix.YesNoType.yes;
6791 } 6805 }
6792 6806
6793 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_SHOWDIALOG)) 6807 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_SHOWDIALOG))
6794 { 6808 {
6795 embeddedUI.IgnoreShowDialog = Wix.YesNoType.yes; 6809 embeddedUI.IgnoreShowDialog = Wix.YesNoType.yes;
6796 } 6810 }
6797 6811
6798 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_RMFILESINUSE)) 6812 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_RMFILESINUSE))
6799 { 6813 {
6800 embeddedUI.IgnoreRMFilesInUse = Wix.YesNoType.yes; 6814 embeddedUI.IgnoreRMFilesInUse = Wix.YesNoType.yes;
6801 } 6815 }
6802 6816
6803 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_INSTALLSTART)) 6817 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_INSTALLSTART))
6804 { 6818 {
6805 embeddedUI.IgnoreInstallStart = Wix.YesNoType.yes; 6819 embeddedUI.IgnoreInstallStart = Wix.YesNoType.yes;
6806 } 6820 }
6807 6821
6808 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_INSTALLEND)) 6822 if (0 == (messageFilter & WindowsInstallerConstants.INSTALLLOGMODE_INSTALLEND))
6809 { 6823 {
6810 embeddedUI.IgnoreInstallEnd = Wix.YesNoType.yes; 6824 embeddedUI.IgnoreInstallEnd = Wix.YesNoType.yes;
6811 } 6825 }
6812 6826
6813 if (MsiInterop.MsidbEmbeddedHandlesBasic == (attributes & MsiInterop.MsidbEmbeddedHandlesBasic)) 6827 if (WindowsInstallerConstants.MsidbEmbeddedHandlesBasic == (attributes & WindowsInstallerConstants.MsidbEmbeddedHandlesBasic))
6814 { 6828 {
6815 embeddedUI.SupportBasicUI = Wix.YesNoType.yes; 6829 embeddedUI.SupportBasicUI = Wix.YesNoType.yes;
6816 } 6830 }
@@ -6997,10 +7011,10 @@ namespace WixToolset.Core.WindowsInstaller
6997 7011
6998 switch (Convert.ToInt32(row[4])) 7012 switch (Convert.ToInt32(row[4]))
6999 { 7013 {
7000 case MsiInterop.MsidbODBCDataSourceRegistrationPerMachine: 7014 case WindowsInstallerConstants.MsidbODBCDataSourceRegistrationPerMachine:
7001 odbcDataSource.Registration = Wix.ODBCDataSource.RegistrationType.machine; 7015 odbcDataSource.Registration = Wix.ODBCDataSource.RegistrationType.machine;
7002 break; 7016 break;
7003 case MsiInterop.MsidbODBCDataSourceRegistrationPerUser: 7017 case WindowsInstallerConstants.MsidbODBCDataSourceRegistrationPerUser:
7004 odbcDataSource.Registration = Wix.ODBCDataSource.RegistrationType.user; 7018 odbcDataSource.Registration = Wix.ODBCDataSource.RegistrationType.user;
7005 break; 7019 break;
7006 default: 7020 default:
@@ -7782,16 +7796,16 @@ namespace WixToolset.Core.WindowsInstaller
7782 7796
7783 switch (Convert.ToInt32(row[1])) 7797 switch (Convert.ToInt32(row[1]))
7784 { 7798 {
7785 case MsiInterop.MsidbRegistryRootClassesRoot: 7799 case WindowsInstallerConstants.MsidbRegistryRootClassesRoot:
7786 registrySearch.Root = Wix.RegistrySearch.RootType.HKCR; 7800 registrySearch.Root = Wix.RegistrySearch.RootType.HKCR;
7787 break; 7801 break;
7788 case MsiInterop.MsidbRegistryRootCurrentUser: 7802 case WindowsInstallerConstants.MsidbRegistryRootCurrentUser:
7789 registrySearch.Root = Wix.RegistrySearch.RootType.HKCU; 7803 registrySearch.Root = Wix.RegistrySearch.RootType.HKCU;
7790 break; 7804 break;
7791 case MsiInterop.MsidbRegistryRootLocalMachine: 7805 case WindowsInstallerConstants.MsidbRegistryRootLocalMachine:
7792 registrySearch.Root = Wix.RegistrySearch.RootType.HKLM; 7806 registrySearch.Root = Wix.RegistrySearch.RootType.HKLM;
7793 break; 7807 break;
7794 case MsiInterop.MsidbRegistryRootUsers: 7808 case WindowsInstallerConstants.MsidbRegistryRootUsers:
7795 registrySearch.Root = Wix.RegistrySearch.RootType.HKU; 7809 registrySearch.Root = Wix.RegistrySearch.RootType.HKU;
7796 break; 7810 break;
7797 default: 7811 default:
@@ -7814,10 +7828,10 @@ namespace WixToolset.Core.WindowsInstaller
7814 { 7828 {
7815 var type = Convert.ToInt32(row[4]); 7829 var type = Convert.ToInt32(row[4]);
7816 7830
7817 if (MsiInterop.MsidbLocatorType64bit == (type & MsiInterop.MsidbLocatorType64bit)) 7831 if (WindowsInstallerConstants.MsidbLocatorType64bit == (type & WindowsInstallerConstants.MsidbLocatorType64bit))
7818 { 7832 {
7819 registrySearch.Win64 = Wix.YesNoType.yes; 7833 registrySearch.Win64 = Wix.YesNoType.yes;
7820 type &= ~MsiInterop.MsidbLocatorType64bit; 7834 type &= ~WindowsInstallerConstants.MsidbLocatorType64bit;
7821 } 7835 }
7822 else 7836 else
7823 { 7837 {
@@ -7826,13 +7840,13 @@ namespace WixToolset.Core.WindowsInstaller
7826 7840
7827 switch (type) 7841 switch (type)
7828 { 7842 {
7829 case MsiInterop.MsidbLocatorTypeDirectory: 7843 case WindowsInstallerConstants.MsidbLocatorTypeDirectory:
7830 registrySearch.Type = Wix.RegistrySearch.TypeType.directory; 7844 registrySearch.Type = Wix.RegistrySearch.TypeType.directory;
7831 break; 7845 break;
7832 case MsiInterop.MsidbLocatorTypeFileName: 7846 case WindowsInstallerConstants.MsidbLocatorTypeFileName:
7833 registrySearch.Type = Wix.RegistrySearch.TypeType.file; 7847 registrySearch.Type = Wix.RegistrySearch.TypeType.file;
7834 break; 7848 break;
7835 case MsiInterop.MsidbLocatorTypeRawValue: 7849 case WindowsInstallerConstants.MsidbLocatorTypeRawValue:
7836 registrySearch.Type = Wix.RegistrySearch.TypeType.raw; 7850 registrySearch.Type = Wix.RegistrySearch.TypeType.raw;
7837 break; 7851 break;
7838 default: 7852 default:
@@ -7863,13 +7877,13 @@ namespace WixToolset.Core.WindowsInstaller
7863 7877
7864 switch (Convert.ToInt32(row[4])) 7878 switch (Convert.ToInt32(row[4]))
7865 { 7879 {
7866 case MsiInterop.MsidbRemoveFileInstallModeOnInstall: 7880 case WindowsInstallerConstants.MsidbRemoveFileInstallModeOnInstall:
7867 removeFolder.On = Wix.InstallUninstallType.install; 7881 removeFolder.On = Wix.InstallUninstallType.install;
7868 break; 7882 break;
7869 case MsiInterop.MsidbRemoveFileInstallModeOnRemove: 7883 case WindowsInstallerConstants.MsidbRemoveFileInstallModeOnRemove:
7870 removeFolder.On = Wix.InstallUninstallType.uninstall; 7884 removeFolder.On = Wix.InstallUninstallType.uninstall;
7871 break; 7885 break;
7872 case MsiInterop.MsidbRemoveFileInstallModeOnBoth: 7886 case WindowsInstallerConstants.MsidbRemoveFileInstallModeOnBoth:
7873 removeFolder.On = Wix.InstallUninstallType.both; 7887 removeFolder.On = Wix.InstallUninstallType.both;
7874 break; 7888 break;
7875 default: 7889 default:
@@ -7909,13 +7923,13 @@ namespace WixToolset.Core.WindowsInstaller
7909 7923
7910 switch (Convert.ToInt32(row[4])) 7924 switch (Convert.ToInt32(row[4]))
7911 { 7925 {
7912 case MsiInterop.MsidbRemoveFileInstallModeOnInstall: 7926 case WindowsInstallerConstants.MsidbRemoveFileInstallModeOnInstall:
7913 removeFile.On = Wix.InstallUninstallType.install; 7927 removeFile.On = Wix.InstallUninstallType.install;
7914 break; 7928 break;
7915 case MsiInterop.MsidbRemoveFileInstallModeOnRemove: 7929 case WindowsInstallerConstants.MsidbRemoveFileInstallModeOnRemove:
7916 removeFile.On = Wix.InstallUninstallType.uninstall; 7930 removeFile.On = Wix.InstallUninstallType.uninstall;
7917 break; 7931 break;
7918 case MsiInterop.MsidbRemoveFileInstallModeOnBoth: 7932 case WindowsInstallerConstants.MsidbRemoveFileInstallModeOnBoth:
7919 removeFile.On = Wix.InstallUninstallType.both; 7933 removeFile.On = Wix.InstallUninstallType.both;
7920 break; 7934 break;
7921 default: 7935 default:
@@ -7976,10 +7990,10 @@ namespace WixToolset.Core.WindowsInstaller
7976 7990
7977 switch (Convert.ToInt32(row[6])) 7991 switch (Convert.ToInt32(row[6]))
7978 { 7992 {
7979 case MsiInterop.MsidbIniFileActionRemoveLine: 7993 case WindowsInstallerConstants.MsidbIniFileActionRemoveLine:
7980 iniFile.Action = Wix.IniFile.ActionType.removeLine; 7994 iniFile.Action = Wix.IniFile.ActionType.removeLine;
7981 break; 7995 break;
7982 case MsiInterop.MsidbIniFileActionRemoveTag: 7996 case WindowsInstallerConstants.MsidbIniFileActionRemoveTag:
7983 iniFile.Action = Wix.IniFile.ActionType.removeTag; 7997 iniFile.Action = Wix.IniFile.ActionType.removeTag;
7984 break; 7998 break;
7985 default: 7999 default:
@@ -8139,44 +8153,44 @@ namespace WixToolset.Core.WindowsInstaller
8139 serviceControl.Name = Convert.ToString(row[1]); 8153 serviceControl.Name = Convert.ToString(row[1]);
8140 8154
8141 var eventValue = Convert.ToInt32(row[2]); 8155 var eventValue = Convert.ToInt32(row[2]);
8142 if (MsiInterop.MsidbServiceControlEventStart == (eventValue & MsiInterop.MsidbServiceControlEventStart) && 8156 if (WindowsInstallerConstants.MsidbServiceControlEventStart == (eventValue & WindowsInstallerConstants.MsidbServiceControlEventStart) &&
8143 MsiInterop.MsidbServiceControlEventUninstallStart == (eventValue & MsiInterop.MsidbServiceControlEventUninstallStart)) 8157 WindowsInstallerConstants.MsidbServiceControlEventUninstallStart == (eventValue & WindowsInstallerConstants.MsidbServiceControlEventUninstallStart))
8144 { 8158 {
8145 serviceControl.Start = Wix.InstallUninstallType.both; 8159 serviceControl.Start = Wix.InstallUninstallType.both;
8146 } 8160 }
8147 else if (MsiInterop.MsidbServiceControlEventStart == (eventValue & MsiInterop.MsidbServiceControlEventStart)) 8161 else if (WindowsInstallerConstants.MsidbServiceControlEventStart == (eventValue & WindowsInstallerConstants.MsidbServiceControlEventStart))
8148 { 8162 {
8149 serviceControl.Start = Wix.InstallUninstallType.install; 8163 serviceControl.Start = Wix.InstallUninstallType.install;
8150 } 8164 }
8151 else if (MsiInterop.MsidbServiceControlEventUninstallStart == (eventValue & MsiInterop.MsidbServiceControlEventUninstallStart)) 8165 else if (WindowsInstallerConstants.MsidbServiceControlEventUninstallStart == (eventValue & WindowsInstallerConstants.MsidbServiceControlEventUninstallStart))
8152 { 8166 {
8153 serviceControl.Start = Wix.InstallUninstallType.uninstall; 8167 serviceControl.Start = Wix.InstallUninstallType.uninstall;
8154 } 8168 }
8155 8169
8156 if (MsiInterop.MsidbServiceControlEventStop == (eventValue & MsiInterop.MsidbServiceControlEventStop) && 8170 if (WindowsInstallerConstants.MsidbServiceControlEventStop == (eventValue & WindowsInstallerConstants.MsidbServiceControlEventStop) &&
8157 MsiInterop.MsidbServiceControlEventUninstallStop == (eventValue & MsiInterop.MsidbServiceControlEventUninstallStop)) 8171 WindowsInstallerConstants.MsidbServiceControlEventUninstallStop == (eventValue & WindowsInstallerConstants.MsidbServiceControlEventUninstallStop))
8158 { 8172 {
8159 serviceControl.Stop = Wix.InstallUninstallType.both; 8173 serviceControl.Stop = Wix.InstallUninstallType.both;
8160 } 8174 }
8161 else if (MsiInterop.MsidbServiceControlEventStop == (eventValue & MsiInterop.MsidbServiceControlEventStop)) 8175 else if (WindowsInstallerConstants.MsidbServiceControlEventStop == (eventValue & WindowsInstallerConstants.MsidbServiceControlEventStop))
8162 { 8176 {
8163 serviceControl.Stop = Wix.InstallUninstallType.install; 8177 serviceControl.Stop = Wix.InstallUninstallType.install;
8164 } 8178 }
8165 else if (MsiInterop.MsidbServiceControlEventUninstallStop == (eventValue & MsiInterop.MsidbServiceControlEventUninstallStop)) 8179 else if (WindowsInstallerConstants.MsidbServiceControlEventUninstallStop == (eventValue & WindowsInstallerConstants.MsidbServiceControlEventUninstallStop))
8166 { 8180 {
8167 serviceControl.Stop = Wix.InstallUninstallType.uninstall; 8181 serviceControl.Stop = Wix.InstallUninstallType.uninstall;
8168 } 8182 }
8169 8183
8170 if (MsiInterop.MsidbServiceControlEventDelete == (eventValue & MsiInterop.MsidbServiceControlEventDelete) && 8184 if (WindowsInstallerConstants.MsidbServiceControlEventDelete == (eventValue & WindowsInstallerConstants.MsidbServiceControlEventDelete) &&
8171 MsiInterop.MsidbServiceControlEventUninstallDelete == (eventValue & MsiInterop.MsidbServiceControlEventUninstallDelete)) 8185 WindowsInstallerConstants.MsidbServiceControlEventUninstallDelete == (eventValue & WindowsInstallerConstants.MsidbServiceControlEventUninstallDelete))
8172 { 8186 {
8173 serviceControl.Remove = Wix.InstallUninstallType.both; 8187 serviceControl.Remove = Wix.InstallUninstallType.both;
8174 } 8188 }
8175 else if (MsiInterop.MsidbServiceControlEventDelete == (eventValue & MsiInterop.MsidbServiceControlEventDelete)) 8189 else if (WindowsInstallerConstants.MsidbServiceControlEventDelete == (eventValue & WindowsInstallerConstants.MsidbServiceControlEventDelete))
8176 { 8190 {
8177 serviceControl.Remove = Wix.InstallUninstallType.install; 8191 serviceControl.Remove = Wix.InstallUninstallType.install;
8178 } 8192 }
8179 else if (MsiInterop.MsidbServiceControlEventUninstallDelete == (eventValue & MsiInterop.MsidbServiceControlEventUninstallDelete)) 8193 else if (WindowsInstallerConstants.MsidbServiceControlEventUninstallDelete == (eventValue & WindowsInstallerConstants.MsidbServiceControlEventUninstallDelete))
8180 { 8194 {
8181 serviceControl.Remove = Wix.InstallUninstallType.uninstall; 8195 serviceControl.Remove = Wix.InstallUninstallType.uninstall;
8182 } 8196 }
@@ -8239,35 +8253,35 @@ namespace WixToolset.Core.WindowsInstaller
8239 } 8253 }
8240 8254
8241 var serviceType = Convert.ToInt32(row[3]); 8255 var serviceType = Convert.ToInt32(row[3]);
8242 if (MsiInterop.MsidbServiceInstallInteractive == (serviceType & MsiInterop.MsidbServiceInstallInteractive)) 8256 if (WindowsInstallerConstants.MsidbServiceInstallInteractive == (serviceType & WindowsInstallerConstants.MsidbServiceInstallInteractive))
8243 { 8257 {
8244 serviceInstall.Interactive = Wix.YesNoType.yes; 8258 serviceInstall.Interactive = Wix.YesNoType.yes;
8245 } 8259 }
8246 8260
8247 if (MsiInterop.MsidbServiceInstallOwnProcess == (serviceType & MsiInterop.MsidbServiceInstallOwnProcess) && 8261 if (WindowsInstallerConstants.MsidbServiceInstallOwnProcess == (serviceType & WindowsInstallerConstants.MsidbServiceInstallOwnProcess) &&
8248 MsiInterop.MsidbServiceInstallShareProcess == (serviceType & MsiInterop.MsidbServiceInstallShareProcess)) 8262 WindowsInstallerConstants.MsidbServiceInstallShareProcess == (serviceType & WindowsInstallerConstants.MsidbServiceInstallShareProcess))
8249 { 8263 {
8250 // TODO: warn 8264 // TODO: warn
8251 } 8265 }
8252 else if (MsiInterop.MsidbServiceInstallOwnProcess == (serviceType & MsiInterop.MsidbServiceInstallOwnProcess)) 8266 else if (WindowsInstallerConstants.MsidbServiceInstallOwnProcess == (serviceType & WindowsInstallerConstants.MsidbServiceInstallOwnProcess))
8253 { 8267 {
8254 serviceInstall.Type = Wix.ServiceInstall.TypeType.ownProcess; 8268 serviceInstall.Type = Wix.ServiceInstall.TypeType.ownProcess;
8255 } 8269 }
8256 else if (MsiInterop.MsidbServiceInstallShareProcess == (serviceType & MsiInterop.MsidbServiceInstallShareProcess)) 8270 else if (WindowsInstallerConstants.MsidbServiceInstallShareProcess == (serviceType & WindowsInstallerConstants.MsidbServiceInstallShareProcess))
8257 { 8271 {
8258 serviceInstall.Type = Wix.ServiceInstall.TypeType.shareProcess; 8272 serviceInstall.Type = Wix.ServiceInstall.TypeType.shareProcess;
8259 } 8273 }
8260 8274
8261 var startType = Convert.ToInt32(row[4]); 8275 var startType = Convert.ToInt32(row[4]);
8262 if (MsiInterop.MsidbServiceInstallDisabled == startType) 8276 if (WindowsInstallerConstants.MsidbServiceInstallDisabled == startType)
8263 { 8277 {
8264 serviceInstall.Start = Wix.ServiceInstall.StartType.disabled; 8278 serviceInstall.Start = Wix.ServiceInstall.StartType.disabled;
8265 } 8279 }
8266 else if (MsiInterop.MsidbServiceInstallDemandStart == startType) 8280 else if (WindowsInstallerConstants.MsidbServiceInstallDemandStart == startType)
8267 { 8281 {
8268 serviceInstall.Start = Wix.ServiceInstall.StartType.demand; 8282 serviceInstall.Start = Wix.ServiceInstall.StartType.demand;
8269 } 8283 }
8270 else if (MsiInterop.MsidbServiceInstallAutoStart == startType) 8284 else if (WindowsInstallerConstants.MsidbServiceInstallAutoStart == startType)
8271 { 8285 {
8272 serviceInstall.Start = Wix.ServiceInstall.StartType.auto; 8286 serviceInstall.Start = Wix.ServiceInstall.StartType.auto;
8273 } 8287 }
@@ -8277,11 +8291,11 @@ namespace WixToolset.Core.WindowsInstaller
8277 } 8291 }
8278 8292
8279 var errorControl = Convert.ToInt32(row[5]); 8293 var errorControl = Convert.ToInt32(row[5]);
8280 if (MsiInterop.MsidbServiceInstallErrorCritical == (errorControl & MsiInterop.MsidbServiceInstallErrorCritical)) 8294 if (WindowsInstallerConstants.MsidbServiceInstallErrorCritical == (errorControl & WindowsInstallerConstants.MsidbServiceInstallErrorCritical))
8281 { 8295 {
8282 serviceInstall.ErrorControl = Wix.ServiceInstall.ErrorControlType.critical; 8296 serviceInstall.ErrorControl = Wix.ServiceInstall.ErrorControlType.critical;
8283 } 8297 }
8284 else if (MsiInterop.MsidbServiceInstallErrorNormal == (errorControl & MsiInterop.MsidbServiceInstallErrorNormal)) 8298 else if (WindowsInstallerConstants.MsidbServiceInstallErrorNormal == (errorControl & WindowsInstallerConstants.MsidbServiceInstallErrorNormal))
8285 { 8299 {
8286 serviceInstall.ErrorControl = Wix.ServiceInstall.ErrorControlType.normal; 8300 serviceInstall.ErrorControl = Wix.ServiceInstall.ErrorControlType.normal;
8287 } 8301 }
@@ -8290,7 +8304,7 @@ namespace WixToolset.Core.WindowsInstaller
8290 serviceInstall.ErrorControl = Wix.ServiceInstall.ErrorControlType.ignore; 8304 serviceInstall.ErrorControl = Wix.ServiceInstall.ErrorControlType.ignore;
8291 } 8305 }
8292 8306
8293 if (MsiInterop.MsidbServiceInstallErrorControlVital == (errorControl & MsiInterop.MsidbServiceInstallErrorControlVital)) 8307 if (WindowsInstallerConstants.MsidbServiceInstallErrorControlVital == (errorControl & WindowsInstallerConstants.MsidbServiceInstallErrorControlVital))
8294 { 8308 {
8295 serviceInstall.Vital = Wix.YesNoType.yes; 8309 serviceInstall.Vital = Wix.YesNoType.yes;
8296 } 8310 }
@@ -8768,22 +8782,22 @@ namespace WixToolset.Core.WindowsInstaller
8768 { 8782 {
8769 var styleBits = Convert.ToInt32(row[4]); 8783 var styleBits = Convert.ToInt32(row[4]);
8770 8784
8771 if (MsiInterop.MsidbTextStyleStyleBitsBold == (styleBits & MsiInterop.MsidbTextStyleStyleBitsBold)) 8785 if (WindowsInstallerConstants.MsidbTextStyleStyleBitsBold == (styleBits & WindowsInstallerConstants.MsidbTextStyleStyleBitsBold))
8772 { 8786 {
8773 textStyle.Bold = Wix.YesNoType.yes; 8787 textStyle.Bold = Wix.YesNoType.yes;
8774 } 8788 }
8775 8789
8776 if (MsiInterop.MsidbTextStyleStyleBitsItalic == (styleBits & MsiInterop.MsidbTextStyleStyleBitsItalic)) 8790 if (WindowsInstallerConstants.MsidbTextStyleStyleBitsItalic == (styleBits & WindowsInstallerConstants.MsidbTextStyleStyleBitsItalic))
8777 { 8791 {
8778 textStyle.Italic = Wix.YesNoType.yes; 8792 textStyle.Italic = Wix.YesNoType.yes;
8779 } 8793 }
8780 8794
8781 if (MsiInterop.MsidbTextStyleStyleBitsUnderline == (styleBits & MsiInterop.MsidbTextStyleStyleBitsUnderline)) 8795 if (WindowsInstallerConstants.MsidbTextStyleStyleBitsUnderline == (styleBits & WindowsInstallerConstants.MsidbTextStyleStyleBitsUnderline))
8782 { 8796 {
8783 textStyle.Underline = Wix.YesNoType.yes; 8797 textStyle.Underline = Wix.YesNoType.yes;
8784 } 8798 }
8785 8799
8786 if (MsiInterop.MsidbTextStyleStyleBitsStrike == (styleBits & MsiInterop.MsidbTextStyleStyleBitsStrike)) 8800 if (WindowsInstallerConstants.MsidbTextStyleStyleBitsStrike == (styleBits & WindowsInstallerConstants.MsidbTextStyleStyleBitsStrike))
8787 { 8801 {
8788 textStyle.Strike = Wix.YesNoType.yes; 8802 textStyle.Strike = Wix.YesNoType.yes;
8789 } 8803 }
@@ -8887,32 +8901,32 @@ namespace WixToolset.Core.WindowsInstaller
8887 upgradeVersion.Language = upgradeRow.Language; 8901 upgradeVersion.Language = upgradeRow.Language;
8888 } 8902 }
8889 8903
8890 if (MsiInterop.MsidbUpgradeAttributesMigrateFeatures == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesMigrateFeatures)) 8904 if (WindowsInstallerConstants.MsidbUpgradeAttributesMigrateFeatures == (upgradeRow.Attributes & WindowsInstallerConstants.MsidbUpgradeAttributesMigrateFeatures))
8891 { 8905 {
8892 upgradeVersion.MigrateFeatures = Wix.YesNoType.yes; 8906 upgradeVersion.MigrateFeatures = Wix.YesNoType.yes;
8893 } 8907 }
8894 8908
8895 if (MsiInterop.MsidbUpgradeAttributesOnlyDetect == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesOnlyDetect)) 8909 if (WindowsInstallerConstants.MsidbUpgradeAttributesOnlyDetect == (upgradeRow.Attributes & WindowsInstallerConstants.MsidbUpgradeAttributesOnlyDetect))
8896 { 8910 {
8897 upgradeVersion.OnlyDetect = Wix.YesNoType.yes; 8911 upgradeVersion.OnlyDetect = Wix.YesNoType.yes;
8898 } 8912 }
8899 8913
8900 if (MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure)) 8914 if (WindowsInstallerConstants.MsidbUpgradeAttributesIgnoreRemoveFailure == (upgradeRow.Attributes & WindowsInstallerConstants.MsidbUpgradeAttributesIgnoreRemoveFailure))
8901 { 8915 {
8902 upgradeVersion.IgnoreRemoveFailure = Wix.YesNoType.yes; 8916 upgradeVersion.IgnoreRemoveFailure = Wix.YesNoType.yes;
8903 } 8917 }
8904 8918
8905 if (MsiInterop.MsidbUpgradeAttributesVersionMinInclusive == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesVersionMinInclusive)) 8919 if (WindowsInstallerConstants.MsidbUpgradeAttributesVersionMinInclusive == (upgradeRow.Attributes & WindowsInstallerConstants.MsidbUpgradeAttributesVersionMinInclusive))
8906 { 8920 {
8907 upgradeVersion.IncludeMinimum = Wix.YesNoType.yes; 8921 upgradeVersion.IncludeMinimum = Wix.YesNoType.yes;
8908 } 8922 }
8909 8923
8910 if (MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive)) 8924 if (WindowsInstallerConstants.MsidbUpgradeAttributesVersionMaxInclusive == (upgradeRow.Attributes & WindowsInstallerConstants.MsidbUpgradeAttributesVersionMaxInclusive))
8911 { 8925 {
8912 upgradeVersion.IncludeMaximum = Wix.YesNoType.yes; 8926 upgradeVersion.IncludeMaximum = Wix.YesNoType.yes;
8913 } 8927 }
8914 8928
8915 if (MsiInterop.MsidbUpgradeAttributesLanguagesExclusive == (upgradeRow.Attributes & MsiInterop.MsidbUpgradeAttributesLanguagesExclusive)) 8929 if (WindowsInstallerConstants.MsidbUpgradeAttributesLanguagesExclusive == (upgradeRow.Attributes & WindowsInstallerConstants.MsidbUpgradeAttributesLanguagesExclusive))
8916 { 8930 {
8917 upgradeVersion.ExcludeLanguages = Wix.YesNoType.yes; 8931 upgradeVersion.ExcludeLanguages = Wix.YesNoType.yes;
8918 } 8932 }
@@ -9121,16 +9135,16 @@ namespace WixToolset.Core.WindowsInstaller
9121 case (-1): 9135 case (-1):
9122 registryRootType = Wix.RegistryRootType.HKMU; 9136 registryRootType = Wix.RegistryRootType.HKMU;
9123 return true; 9137 return true;
9124 case MsiInterop.MsidbRegistryRootClassesRoot: 9138 case WindowsInstallerConstants.MsidbRegistryRootClassesRoot:
9125 registryRootType = Wix.RegistryRootType.HKCR; 9139 registryRootType = Wix.RegistryRootType.HKCR;
9126 return true; 9140 return true;
9127 case MsiInterop.MsidbRegistryRootCurrentUser: 9141 case WindowsInstallerConstants.MsidbRegistryRootCurrentUser:
9128 registryRootType = Wix.RegistryRootType.HKCU; 9142 registryRootType = Wix.RegistryRootType.HKCU;
9129 return true; 9143 return true;
9130 case MsiInterop.MsidbRegistryRootLocalMachine: 9144 case WindowsInstallerConstants.MsidbRegistryRootLocalMachine:
9131 registryRootType = Wix.RegistryRootType.HKLM; 9145 registryRootType = Wix.RegistryRootType.HKLM;
9132 return true; 9146 return true;
9133 case MsiInterop.MsidbRegistryRootUsers: 9147 case WindowsInstallerConstants.MsidbRegistryRootUsers:
9134 registryRootType = Wix.RegistryRootType.HKU; 9148 registryRootType = Wix.RegistryRootType.HKU;
9135 return true; 9149 return true;
9136 default: 9150 default:
diff --git a/src/WixToolset.Core.WindowsInstaller/Differ.cs b/src/WixToolset.Core.WindowsInstaller/Differ.cs
index 7cc204f9..c7fe8960 100644
--- a/src/WixToolset.Core.WindowsInstaller/Differ.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Differ.cs
@@ -6,12 +6,12 @@ namespace WixToolset.Core.WindowsInstaller
6 using System.Collections; 6 using System.Collections;
7 using System.Collections.Generic; 7 using System.Collections.Generic;
8 using System.Globalization; 8 using System.Globalization;
9 using WixToolset.Core.WindowsInstaller.Msi;
9 using WixToolset.Data; 10 using WixToolset.Data;
10 using WixToolset.Data.WindowsInstaller; 11 using WixToolset.Data.WindowsInstaller;
11 using WixToolset.Data.WindowsInstaller.Rows; 12 using WixToolset.Data.WindowsInstaller.Rows;
12 using WixToolset.Extensibility; 13 using WixToolset.Extensibility;
13 using WixToolset.Extensibility.Services; 14 using WixToolset.Extensibility.Services;
14 using WixToolset.Msi;
15 15
16 /// <summary> 16 /// <summary>
17 /// Creates a transform by diffing two outputs. 17 /// Creates a transform by diffing two outputs.
@@ -82,7 +82,7 @@ namespace WixToolset.Core.WindowsInstaller
82 /// <returns>The transform.</returns> 82 /// <returns>The transform.</returns>
83 public Output Diff(Output targetOutput, Output updatedOutput) 83 public Output Diff(Output targetOutput, Output updatedOutput)
84 { 84 {
85 return Diff(targetOutput, updatedOutput, 0); 85 return this.Diff(targetOutput, updatedOutput, 0);
86 } 86 }
87 87
88 /// <summary> 88 /// <summary>
diff --git a/src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.cs b/src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.cs
index f3028fbe..b91eeeef 100644
--- a/src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.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.Inscribe 3namespace WixToolset.Core.WindowsInstaller.Inscribe
4{ 4{
@@ -8,13 +8,12 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe
8 using System.IO; 8 using System.IO;
9 using System.Runtime.InteropServices; 9 using System.Runtime.InteropServices;
10 using System.Security.Cryptography.X509Certificates; 10 using System.Security.Cryptography.X509Certificates;
11 using WixToolset.Core.Native;
12 using WixToolset.Core.WindowsInstaller.Bind; 11 using WixToolset.Core.WindowsInstaller.Bind;
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.Extensibility.Data; 15 using WixToolset.Extensibility.Data;
16 using WixToolset.Extensibility.Services; 16 using WixToolset.Extensibility.Services;
17 using WixToolset.Msi;
18 17
19 internal class InscribeMsiPackageCommand 18 internal class InscribeMsiPackageCommand
20 { 19 {
diff --git a/src/WixToolset.Core.WindowsInstaller/Msi/Database.cs b/src/WixToolset.Core.WindowsInstaller/Msi/Database.cs
index ccb0e6cf..9f08a217 100644
--- a/src/WixToolset.Core.WindowsInstaller/Msi/Database.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Msi/Database.cs
@@ -1,13 +1,11 @@
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.Msi 3namespace WixToolset.Core.WindowsInstaller.Msi
4{ 4{
5 using System; 5 using System;
6 using System.Globalization; 6 using System.Globalization;
7 using System.IO; 7 using System.IO;
8 using System.Threading; 8 using System.Threading;
9 using WixToolset.Core.Native;
10 using WixToolset.Data;
11 9
12 /// <summary> 10 /// <summary>
13 /// Wrapper class for managing MSI API database handles. 11 /// Wrapper class for managing MSI API database handles.
diff --git a/src/WixToolset.Core.WindowsInstaller/Msi/Installer.cs b/src/WixToolset.Core.WindowsInstaller/Msi/Installer.cs
index f8bce602..0edcd633 100644
--- a/src/WixToolset.Core.WindowsInstaller/Msi/Installer.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Msi/Installer.cs
@@ -1,6 +1,6 @@
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.Msi 3namespace WixToolset.Core.WindowsInstaller.Msi
4{ 4{
5 using System; 5 using System;
6 using System.Diagnostics; 6 using System.Diagnostics;
@@ -281,7 +281,7 @@ namespace WixToolset.Msi
281 /// <param name="hash">Int array that receives the returned file hash information.</param> 281 /// <param name="hash">Int array that receives the returned file hash information.</param>
282 internal static void GetFileHash(string filePath, int options, out int[] hash) 282 internal static void GetFileHash(string filePath, int options, out int[] hash)
283 { 283 {
284 MsiInterop.MSIFILEHASHINFO hashInterop = new MsiInterop.MSIFILEHASHINFO(); 284 MSIFILEHASHINFO hashInterop = new MSIFILEHASHINFO();
285 hashInterop.FileHashInfoSize = 20; 285 hashInterop.FileHashInfoSize = 20;
286 286
287 int error = MsiInterop.MsiGetFileHash(filePath, Convert.ToUInt32(options), hashInterop); 287 int error = MsiInterop.MsiGetFileHash(filePath, Convert.ToUInt32(options), hashInterop);
diff --git a/src/WixToolset.Core.WindowsInstaller/Msi/Interop/MsiInterop.cs b/src/WixToolset.Core.WindowsInstaller/Msi/Interop/MsiInterop.cs
deleted file mode 100644
index 054289ee..00000000
--- a/src/WixToolset.Core.WindowsInstaller/Msi/Interop/MsiInterop.cs
+++ /dev/null
@@ -1,697 +0,0 @@
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#if false
3namespace WixToolset.Msi.Interop
4{
5 using System;
6 using System.Text;
7 using System.Runtime.InteropServices;
8 using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME;
9
10 /// <summary>
11 /// A callback function that the installer calls for progress notification and error messages.
12 /// </summary>
13 /// <param name="context">Pointer to an application context.
14 /// This parameter can be used for error checking.</param>
15 /// <param name="messageType">Specifies a combination of one message box style,
16 /// one message box icon type, one default button, and one installation message type.</param>
17 /// <param name="message">Specifies the message text.</param>
18 /// <returns>-1 for an error, 0 if no action was taken, 1 if OK, 3 to abort.</returns>
19 internal delegate int InstallUIHandler(IntPtr context, uint messageType, [MarshalAs(UnmanagedType.LPWStr)] string message);
20
21 /// <summary>
22 /// Class exposing static functions and structs from MSI API.
23 /// </summary>
24 internal sealed class MsiInterop
25 {
26 // Patching constants
27 internal const int MsiMaxStreamNameLength = 62; // http://msdn2.microsoft.com/library/aa370551.aspx
28
29 // Component.Attributes
30 internal const int MsidbComponentAttributesLocalOnly = 0;
31 internal const int MsidbComponentAttributesSourceOnly = 1;
32 internal const int MsidbComponentAttributesOptional = 2;
33 internal const int MsidbComponentAttributesRegistryKeyPath = 4;
34 internal const int MsidbComponentAttributesSharedDllRefCount = 8;
35 internal const int MsidbComponentAttributesPermanent = 16;
36 internal const int MsidbComponentAttributesODBCDataSource = 32;
37 internal const int MsidbComponentAttributesTransitive = 64;
38 internal const int MsidbComponentAttributesNeverOverwrite = 128;
39 internal const int MsidbComponentAttributes64bit = 256;
40 internal const int MsidbComponentAttributesDisableRegistryReflection = 512;
41 internal const int MsidbComponentAttributesUninstallOnSupersedence = 1024;
42 internal const int MsidbComponentAttributesShared = 2048;
43
44 // BBControl.Attributes & Control.Attributes
45 internal const int MsidbControlAttributesVisible = 0x00000001;
46 internal const int MsidbControlAttributesEnabled = 0x00000002;
47 internal const int MsidbControlAttributesSunken = 0x00000004;
48 internal const int MsidbControlAttributesIndirect = 0x00000008;
49 internal const int MsidbControlAttributesInteger = 0x00000010;
50 internal const int MsidbControlAttributesRTLRO = 0x00000020;
51 internal const int MsidbControlAttributesRightAligned = 0x00000040;
52 internal const int MsidbControlAttributesLeftScroll = 0x00000080;
53 internal const int MsidbControlAttributesBiDi = MsidbControlAttributesRTLRO | MsidbControlAttributesRightAligned | MsidbControlAttributesLeftScroll;
54
55 // Text controls
56 internal const int MsidbControlAttributesTransparent = 0x00010000;
57 internal const int MsidbControlAttributesNoPrefix = 0x00020000;
58 internal const int MsidbControlAttributesNoWrap = 0x00040000;
59 internal const int MsidbControlAttributesFormatSize = 0x00080000;
60 internal const int MsidbControlAttributesUsersLanguage = 0x00100000;
61
62 // Edit controls
63 internal const int MsidbControlAttributesMultiline = 0x00010000;
64 internal const int MsidbControlAttributesPasswordInput = 0x00200000;
65
66 // ProgressBar controls
67 internal const int MsidbControlAttributesProgress95 = 0x00010000;
68
69 // VolumeSelectCombo and DirectoryCombo controls
70 internal const int MsidbControlAttributesRemovableVolume = 0x00010000;
71 internal const int MsidbControlAttributesFixedVolume = 0x00020000;
72 internal const int MsidbControlAttributesRemoteVolume = 0x00040000;
73 internal const int MsidbControlAttributesCDROMVolume = 0x00080000;
74 internal const int MsidbControlAttributesRAMDiskVolume = 0x00100000;
75 internal const int MsidbControlAttributesFloppyVolume = 0x00200000;
76
77 // VolumeCostList controls
78 internal const int MsidbControlShowRollbackCost = 0x00400000;
79
80 // ListBox and ComboBox controls
81 internal const int MsidbControlAttributesSorted = 0x00010000;
82 internal const int MsidbControlAttributesComboList = 0x00020000;
83
84 // picture button controls
85 internal const int MsidbControlAttributesImageHandle = 0x00010000;
86 internal const int MsidbControlAttributesPushLike = 0x00020000;
87 internal const int MsidbControlAttributesBitmap = 0x00040000;
88 internal const int MsidbControlAttributesIcon = 0x00080000;
89 internal const int MsidbControlAttributesFixedSize = 0x00100000;
90 internal const int MsidbControlAttributesIconSize16 = 0x00200000;
91 internal const int MsidbControlAttributesIconSize32 = 0x00400000;
92 internal const int MsidbControlAttributesIconSize48 = 0x00600000;
93 internal const int MsidbControlAttributesElevationShield = 0x00800000;
94
95 // RadioButton controls
96 internal const int MsidbControlAttributesHasBorder = 0x01000000;
97
98 // CustomAction.Type
99 // executable types
100 internal const int MsidbCustomActionTypeDll = 0x00000001; // Target = entry point name
101 internal const int MsidbCustomActionTypeExe = 0x00000002; // Target = command line args
102 internal const int MsidbCustomActionTypeTextData = 0x00000003; // Target = text string to be formatted and set into property
103 internal const int MsidbCustomActionTypeJScript = 0x00000005; // Target = entry point name; null if none to call
104 internal const int MsidbCustomActionTypeVBScript = 0x00000006; // Target = entry point name; null if none to call
105 internal const int MsidbCustomActionTypeInstall = 0x00000007; // Target = property list for nested engine initialization
106 internal const int MsidbCustomActionTypeSourceBits = 0x00000030;
107 internal const int MsidbCustomActionTypeTargetBits = 0x00000007;
108 internal const int MsidbCustomActionTypeReturnBits = 0x000000C0;
109 internal const int MsidbCustomActionTypeExecuteBits = 0x00000700;
110
111 // source of code
112 internal const int MsidbCustomActionTypeBinaryData = 0x00000000; // Source = Binary.Name; data stored in stream
113 internal const int MsidbCustomActionTypeSourceFile = 0x00000010; // Source = File.File; file part of installation
114 internal const int MsidbCustomActionTypeDirectory = 0x00000020; // Source = Directory.Directory; folder containing existing file
115 internal const int MsidbCustomActionTypeProperty = 0x00000030; // Source = Property.Property; full path to executable
116
117 // return processing; default is syncronous execution; process return code
118 internal const int MsidbCustomActionTypeContinue = 0x00000040; // ignore action return status; continue running
119 internal const int MsidbCustomActionTypeAsync = 0x00000080; // run asynchronously
120
121 // execution scheduling flags; default is execute whenever sequenced
122 internal const int MsidbCustomActionTypeFirstSequence = 0x00000100; // skip if UI sequence already run
123 internal const int MsidbCustomActionTypeOncePerProcess = 0x00000200; // skip if UI sequence already run in same process
124 internal const int MsidbCustomActionTypeClientRepeat = 0x00000300; // run on client only if UI already run on client
125 internal const int MsidbCustomActionTypeInScript = 0x00000400; // queue for execution within script
126 internal const int MsidbCustomActionTypeRollback = 0x00000100; // in conjunction with InScript: queue in Rollback script
127 internal const int MsidbCustomActionTypeCommit = 0x00000200; // in conjunction with InScript: run Commit ops from script on success
128
129 // security context flag; default to impersonate as user; valid only if InScript
130 internal const int MsidbCustomActionTypeNoImpersonate = 0x00000800; // no impersonation; run in system context
131 internal const int MsidbCustomActionTypeTSAware = 0x00004000; // impersonate for per-machine installs on TS machines
132 internal const int MsidbCustomActionType64BitScript = 0x00001000; // script should run in 64bit process
133 internal const int MsidbCustomActionTypeHideTarget = 0x00002000; // don't record the contents of the Target field in the log file.
134
135 internal const int MsidbCustomActionTypePatchUninstall = 0x00008000; // run on patch uninstall
136
137 // Dialog.Attributes
138 internal const int MsidbDialogAttributesVisible = 0x00000001;
139 internal const int MsidbDialogAttributesModal = 0x00000002;
140 internal const int MsidbDialogAttributesMinimize = 0x00000004;
141 internal const int MsidbDialogAttributesSysModal = 0x00000008;
142 internal const int MsidbDialogAttributesKeepModeless = 0x00000010;
143 internal const int MsidbDialogAttributesTrackDiskSpace = 0x00000020;
144 internal const int MsidbDialogAttributesUseCustomPalette = 0x00000040;
145 internal const int MsidbDialogAttributesRTLRO = 0x00000080;
146 internal const int MsidbDialogAttributesRightAligned = 0x00000100;
147 internal const int MsidbDialogAttributesLeftScroll = 0x00000200;
148 internal const int MsidbDialogAttributesBiDi = MsidbDialogAttributesRTLRO | MsidbDialogAttributesRightAligned | MsidbDialogAttributesLeftScroll;
149 internal const int MsidbDialogAttributesError = 0x00010000;
150 internal const int CommonControlAttributesInvert = MsidbControlAttributesVisible + MsidbControlAttributesEnabled;
151 internal const int DialogAttributesInvert = MsidbDialogAttributesVisible + MsidbDialogAttributesModal + MsidbDialogAttributesMinimize;
152
153 // Feature.Attributes
154 internal const int MsidbFeatureAttributesFavorLocal = 0;
155 internal const int MsidbFeatureAttributesFavorSource = 1;
156 internal const int MsidbFeatureAttributesFollowParent = 2;
157 internal const int MsidbFeatureAttributesFavorAdvertise = 4;
158 internal const int MsidbFeatureAttributesDisallowAdvertise = 8;
159 internal const int MsidbFeatureAttributesUIDisallowAbsent = 16;
160 internal const int MsidbFeatureAttributesNoUnsupportedAdvertise = 32;
161
162 // File.Attributes
163 internal const int MsidbFileAttributesReadOnly = 1;
164 internal const int MsidbFileAttributesHidden = 2;
165 internal const int MsidbFileAttributesSystem = 4;
166 internal const int MsidbFileAttributesVital = 512;
167 internal const int MsidbFileAttributesChecksum = 1024;
168 internal const int MsidbFileAttributesPatchAdded = 4096;
169 internal const int MsidbFileAttributesNoncompressed = 8192;
170 internal const int MsidbFileAttributesCompressed = 16384;
171
172 // IniFile.Action & RemoveIniFile.Action
173 internal const int MsidbIniFileActionAddLine = 0;
174 internal const int MsidbIniFileActionCreateLine = 1;
175 internal const int MsidbIniFileActionRemoveLine = 2;
176 internal const int MsidbIniFileActionAddTag = 3;
177 internal const int MsidbIniFileActionRemoveTag = 4;
178
179 // MoveFile.Options
180 internal const int MsidbMoveFileOptionsMove = 1;
181
182 // ServiceInstall.Attributes
183 internal const int MsidbServiceInstallOwnProcess = 0x00000010;
184 internal const int MsidbServiceInstallShareProcess = 0x00000020;
185 internal const int MsidbServiceInstallInteractive = 0x00000100;
186 internal const int MsidbServiceInstallAutoStart = 0x00000002;
187 internal const int MsidbServiceInstallDemandStart = 0x00000003;
188 internal const int MsidbServiceInstallDisabled = 0x00000004;
189 internal const int MsidbServiceInstallErrorIgnore = 0x00000000;
190 internal const int MsidbServiceInstallErrorNormal = 0x00000001;
191 internal const int MsidbServiceInstallErrorCritical = 0x00000003;
192 internal const int MsidbServiceInstallErrorControlVital = 0x00008000;
193
194 // ServiceConfig.Event
195 internal const int MsidbServiceConfigEventInstall = 0x00000001;
196 internal const int MsidbServiceConfigEventUninstall = 0x00000002;
197 internal const int MsidbServiceConfigEventReinstall = 0x00000004;
198
199 // ServiceControl.Attributes
200 internal const int MsidbServiceControlEventStart = 0x00000001;
201 internal const int MsidbServiceControlEventStop = 0x00000002;
202 internal const int MsidbServiceControlEventDelete = 0x00000008;
203 internal const int MsidbServiceControlEventUninstallStart = 0x00000010;
204 internal const int MsidbServiceControlEventUninstallStop = 0x00000020;
205 internal const int MsidbServiceControlEventUninstallDelete = 0x00000080;
206
207 // TextStyle.StyleBits
208 internal const int MsidbTextStyleStyleBitsBold = 1;
209 internal const int MsidbTextStyleStyleBitsItalic = 2;
210 internal const int MsidbTextStyleStyleBitsUnderline = 4;
211 internal const int MsidbTextStyleStyleBitsStrike = 8;
212
213 // Upgrade.Attributes
214 internal const int MsidbUpgradeAttributesMigrateFeatures = 0x00000001;
215 internal const int MsidbUpgradeAttributesOnlyDetect = 0x00000002;
216 internal const int MsidbUpgradeAttributesIgnoreRemoveFailure = 0x00000004;
217 internal const int MsidbUpgradeAttributesVersionMinInclusive = 0x00000100;
218 internal const int MsidbUpgradeAttributesVersionMaxInclusive = 0x00000200;
219 internal const int MsidbUpgradeAttributesLanguagesExclusive = 0x00000400;
220
221 // Registry Hive Roots
222 internal const int MsidbRegistryRootClassesRoot = 0;
223 internal const int MsidbRegistryRootCurrentUser = 1;
224 internal const int MsidbRegistryRootLocalMachine = 2;
225 internal const int MsidbRegistryRootUsers = 3;
226
227 // Locator Types
228 internal const int MsidbLocatorTypeDirectory = 0;
229 internal const int MsidbLocatorTypeFileName = 1;
230 internal const int MsidbLocatorTypeRawValue = 2;
231 internal const int MsidbLocatorType64bit = 16;
232
233 internal const int MsidbClassAttributesRelativePath = 1;
234
235 // RemoveFile.InstallMode
236 internal const int MsidbRemoveFileInstallModeOnInstall = 0x00000001;
237 internal const int MsidbRemoveFileInstallModeOnRemove = 0x00000002;
238 internal const int MsidbRemoveFileInstallModeOnBoth = 0x00000003;
239
240 // ODBCDataSource.Registration
241 internal const int MsidbODBCDataSourceRegistrationPerMachine = 0;
242 internal const int MsidbODBCDataSourceRegistrationPerUser = 1;
243
244 // ModuleConfiguration.Format
245 internal const int MsidbModuleConfigurationFormatText = 0;
246 internal const int MsidbModuleConfigurationFormatKey = 1;
247 internal const int MsidbModuleConfigurationFormatInteger = 2;
248 internal const int MsidbModuleConfigurationFormatBitfield = 3;
249
250 // ModuleConfiguration.Attributes
251 internal const int MsidbMsmConfigurableOptionKeyNoOrphan = 1;
252 internal const int MsidbMsmConfigurableOptionNonNullable = 2;
253
254 // ' Windows API function ShowWindow constants - used in Shortcut table
255 internal const int SWSHOWNORMAL = 0x00000001;
256 internal const int SWSHOWMAXIMIZED = 0x00000003;
257 internal const int SWSHOWMINNOACTIVE = 0x00000007;
258
259 // NameToBit arrays
260 // UI elements
261 internal static readonly string[] CommonControlAttributes = { "Hidden", "Disabled", "Sunken", "Indirect", "Integer", "RightToLeft", "RightAligned", "LeftScroll" };
262 internal static readonly string[] TextControlAttributes = { "Transparent", "NoPrefix", "NoWrap", "FormatSize", "UserLanguage" };
263 internal static readonly string[] HyperlinkControlAttributes = { "Transparent" };
264 internal static readonly string[] EditControlAttributes = { "Multiline", null, null, null, null, "Password" };
265 internal static readonly string[] ProgressControlAttributes = { "ProgressBlocks" };
266 internal static readonly string[] VolumeControlAttributes = { "Removable", "Fixed", "Remote", "CDROM", "RAMDisk", "Floppy", "ShowRollbackCost" };
267 internal static readonly string[] ListboxControlAttributes = { "Sorted", null, null, null, "UserLanguage" };
268 internal static readonly string[] ListviewControlAttributes = { "Sorted", null, null, null, "FixedSize", "Icon16", "Icon32" };
269 internal static readonly string[] ComboboxControlAttributes = { "Sorted", "ComboList", null, null, "UserLanguage" };
270 internal static readonly string[] RadioControlAttributes = { "Image", "PushLike", "Bitmap", "Icon", "FixedSize", "Icon16", "Icon32", null, "HasBorder" };
271 internal static readonly string[] ButtonControlAttributes = { "Image", null, "Bitmap", "Icon", "FixedSize", "Icon16", "Icon32", "ElevationShield" };
272 internal static readonly string[] IconControlAttributes = { "Image", null, null, null, "FixedSize", "Icon16", "Icon32" };
273 internal static readonly string[] BitmapControlAttributes = { "Image", null, null, null, "FixedSize" };
274 internal static readonly string[] CheckboxControlAttributes = { null, "PushLike", "Bitmap", "Icon", "FixedSize", "Icon16", "Icon32" };
275
276 internal const int MsidbEmbeddedUI = 0x01;
277 internal const int MsidbEmbeddedHandlesBasic = 0x02;
278
279 internal const int INSTALLLOGMODE_FATALEXIT = 0x00001;
280 internal const int INSTALLLOGMODE_ERROR = 0x00002;
281 internal const int INSTALLLOGMODE_WARNING = 0x00004;
282 internal const int INSTALLLOGMODE_USER = 0x00008;
283 internal const int INSTALLLOGMODE_INFO = 0x00010;
284 internal const int INSTALLLOGMODE_FILESINUSE = 0x00020;
285 internal const int INSTALLLOGMODE_RESOLVESOURCE = 0x00040;
286 internal const int INSTALLLOGMODE_OUTOFDISKSPACE = 0x00080;
287 internal const int INSTALLLOGMODE_ACTIONSTART = 0x00100;
288 internal const int INSTALLLOGMODE_ACTIONDATA = 0x00200;
289 internal const int INSTALLLOGMODE_PROGRESS = 0x00400;
290 internal const int INSTALLLOGMODE_COMMONDATA = 0x00800;
291 internal const int INSTALLLOGMODE_INITIALIZE = 0x01000;
292 internal const int INSTALLLOGMODE_TERMINATE = 0x02000;
293 internal const int INSTALLLOGMODE_SHOWDIALOG = 0x04000;
294 internal const int INSTALLLOGMODE_RMFILESINUSE = 0x02000000;
295 internal const int INSTALLLOGMODE_INSTALLSTART = 0x04000000;
296 internal const int INSTALLLOGMODE_INSTALLEND = 0x08000000;
297
298 internal const int MSICONDITIONFALSE = 0; // The table is temporary.
299 internal const int MSICONDITIONTRUE = 1; // The table is persistent.
300 internal const int MSICONDITIONNONE = 2; // The table is unknown.
301 internal const int MSICONDITIONERROR = 3; // An invalid handle or invalid parameter was passed to the function.
302
303 internal const int MSIDBOPENREADONLY = 0;
304 internal const int MSIDBOPENTRANSACT = 1;
305 internal const int MSIDBOPENDIRECT = 2;
306 internal const int MSIDBOPENCREATE = 3;
307 internal const int MSIDBOPENCREATEDIRECT = 4;
308 internal const int MSIDBOPENPATCHFILE = 32;
309
310 internal const int MSIMODIFYSEEK = -1; // Refreshes the information in the supplied record without changing the position in the result set and without affecting subsequent fetch operations. The record may then be used for subsequent Update, Delete, and Refresh. All primary key columns of the table must be in the query and the record must have at least as many fields as the query. Seek cannot be used with multi-table queries. This mode cannot be used with a view containing joins. See also the remarks.
311 internal const int MSIMODIFYREFRESH = 0; // Refreshes the information in the record. Must first call MsiViewFetch with the same record. Fails for a deleted row. Works with read-write and read-only records.
312 internal const int MSIMODIFYINSERT = 1; // Inserts a record. Fails if a row with the same primary keys exists. Fails with a read-only database. This mode cannot be used with a view containing joins.
313 internal const int MSIMODIFYUPDATE = 2; // Updates an existing record. Nonprimary keys only. Must first call MsiViewFetch. Fails with a deleted record. Works only with read-write records.
314 internal const int MSIMODIFYASSIGN = 3; // Writes current data in the cursor to a table row. Updates record if the primary keys match an existing row and inserts if they do not match. Fails with a read-only database. This mode cannot be used with a view containing joins.
315 internal const int MSIMODIFYREPLACE = 4; // Updates or deletes and inserts a record into a table. Must first call MsiViewFetch with the same record. Updates record if the primary keys are unchanged. Deletes old row and inserts new if primary keys have changed. Fails with a read-only database. This mode cannot be used with a view containing joins.
316 internal const int MSIMODIFYMERGE = 5; // Inserts or validates a record in a table. Inserts if primary keys do not match any row and validates if there is a match. Fails if the record does not match the data in the table. Fails if there is a record with a duplicate key that is not identical. Works only with read-write records. This mode cannot be used with a view containing joins.
317 internal const int MSIMODIFYDELETE = 6; // Remove a row from the table. You must first call the MsiViewFetch function with the same record. Fails if the row has been deleted. Works only with read-write records. This mode cannot be used with a view containing joins.
318 internal const int MSIMODIFYINSERTTEMPORARY = 7; // Inserts a temporary record. The information is not persistent. Fails if a row with the same primary key exists. Works only with read-write records. This mode cannot be used with a view containing joins.
319 internal const int MSIMODIFYVALIDATE = 8; // Validates a record. Does not validate across joins. You must first call the MsiViewFetch function with the same record. Obtain validation errors with MsiViewGetError. Works with read-write and read-only records. This mode cannot be used with a view containing joins.
320 internal const int MSIMODIFYVALIDATENEW = 9; // Validate a new record. Does not validate across joins. Checks for duplicate keys. Obtain validation errors by calling MsiViewGetError. Works with read-write and read-only records. This mode cannot be used with a view containing joins.
321 internal const int MSIMODIFYVALIDATEFIELD = 10; // Validates fields of a fetched or new record. Can validate one or more fields of an incomplete record. Obtain validation errors by calling MsiViewGetError. Works with read-write and read-only records. This mode cannot be used with a view containing joins.
322 internal const int MSIMODIFYVALIDATEDELETE = 11; // Validates a record that will be deleted later. You must first call MsiViewFetch. Fails if another row refers to the primary keys of this row. Validation does not check for the existence of the primary keys of this row in properties or strings. Does not check if a column is a foreign key to multiple tables. Obtain validation errors by calling MsiViewGetError. Works with read-write and read-only records. This mode cannot be used with a view containing joins.
323
324 internal const uint VTI2 = 2;
325 internal const uint VTI4 = 3;
326 internal const uint VTLPWSTR = 30;
327 internal const uint VTFILETIME = 64;
328
329 internal const int MSICOLINFONAMES = 0; // return column names
330 internal const int MSICOLINFOTYPES = 1; // return column definitions, datatype code followed by width
331
332 /// <summary>
333 /// Protect the constructor.
334 /// </summary>
335 private MsiInterop()
336 {
337 }
338
339 /// <summary>
340 /// PInvoke of MsiCloseHandle.
341 /// </summary>
342 /// <param name="database">Handle to a database.</param>
343 /// <returns>Error code.</returns>
344 [DllImport("msi.dll", EntryPoint = "MsiCloseHandle", CharSet = CharSet.Unicode, ExactSpelling = true)]
345 internal static extern int MsiCloseHandle(uint database);
346
347 /// <summary>
348 /// PInvoke of MsiCreateRecord
349 /// </summary>
350 /// <param name="parameters">Count of columns in the record.</param>
351 /// <returns>Handle referencing the record.</returns>
352 [DllImport("msi.dll", EntryPoint = "MsiCreateRecord", CharSet = CharSet.Unicode, ExactSpelling = true)]
353 internal static extern uint MsiCreateRecord(int parameters);
354
355 /// <summary>
356 /// Creates summary information of an existing transform to include validation and error conditions.
357 /// </summary>
358 /// <param name="database">The handle to the database that contains the new database summary information.</param>
359 /// <param name="referenceDatabase">The handle to the database that contains the original summary information.</param>
360 /// <param name="transformFile">The name of the transform to which the summary information is added.</param>
361 /// <param name="errorConditions">The error conditions that should be suppressed when the transform is applied.</param>
362 /// <param name="validations">Specifies the properties to be validated to verify that the transform can be applied to the database.</param>
363 /// <returns>Error code.</returns>
364 [DllImport("msi.dll", EntryPoint = "MsiCreateTransformSummaryInfoW", CharSet = CharSet.Unicode, ExactSpelling = true)]
365 internal static extern int MsiCreateTransformSummaryInfo(uint database, uint referenceDatabase, string transformFile, TransformErrorConditions errorConditions, TransformValidations validations);
366
367 /// <summary>
368 /// Applies a transform to a database.
369 /// </summary>
370 /// <param name="database">Handle to the database obtained from MsiOpenDatabase to transform.</param>
371 /// <param name="transformFile">Specifies the name of the transform file to apply.</param>
372 /// <param name="errorConditions">Error conditions that should be suppressed.</param>
373 /// <returns>Error code.</returns>
374 [DllImport("msi.dll", EntryPoint = "MsiDatabaseApplyTransformW", CharSet = CharSet.Unicode, ExactSpelling = true)]
375 internal static extern int MsiDatabaseApplyTransform(uint database, string transformFile, TransformErrorConditions errorConditions);
376
377 /// <summary>
378 /// PInvoke of MsiDatabaseCommit.
379 /// </summary>
380 /// <param name="database">Handle to a databse.</param>
381 /// <returns>Error code.</returns>
382 [DllImport("msi.dll", EntryPoint = "MsiDatabaseCommit", CharSet = CharSet.Unicode, ExactSpelling = true)]
383 internal static extern int MsiDatabaseCommit(uint database);
384
385 /// <summary>
386 /// PInvoke of MsiDatabaseExportW.
387 /// </summary>
388 /// <param name="database">Handle to a database.</param>
389 /// <param name="tableName">Table name.</param>
390 /// <param name="folderPath">Folder path.</param>
391 /// <param name="fileName">File name.</param>
392 /// <returns>Error code.</returns>
393 [DllImport("msi.dll", EntryPoint = "MsiDatabaseExportW", CharSet = CharSet.Unicode, ExactSpelling = true)]
394 internal static extern int MsiDatabaseExport(uint database, string tableName, string folderPath, string fileName);
395
396 /// <summary>
397 /// Generates a transform file of differences between two databases.
398 /// </summary>
399 /// <param name="database">Handle to the database obtained from MsiOpenDatabase that includes the changes.</param>
400 /// <param name="databaseReference">Handle to the database obtained from MsiOpenDatabase that does not include the changes.</param>
401 /// <param name="transformFile">A null-terminated string that specifies the name of the transform file being generated.
402 /// This parameter can be null. If szTransformFile is null, you can use MsiDatabaseGenerateTransform to test whether two
403 /// databases are identical without creating a transform. If the databases are identical, the function returns ERROR_NO_DATA.
404 /// If the databases are different the function returns NOERROR.</param>
405 /// <param name="reserved1">This is a reserved argument and must be set to 0.</param>
406 /// <param name="reserved2">This is a reserved argument and must be set to 0.</param>
407 /// <returns>Error code.</returns>
408 [DllImport("msi.dll", EntryPoint = "MsiDatabaseGenerateTransformW", CharSet = CharSet.Unicode, ExactSpelling = true)]
409 internal static extern int MsiDatabaseGenerateTransform(uint database, uint databaseReference, string transformFile, int reserved1, int reserved2);
410
411 /// <summary>
412 /// PInvoke of MsiDatabaseImportW.
413 /// </summary>
414 /// <param name="database">Handle to a database.</param>
415 /// <param name="folderPath">Folder path.</param>
416 /// <param name="fileName">File name.</param>
417 /// <returns>Error code.</returns>
418 [DllImport("msi.dll", EntryPoint = "MsiDatabaseImportW", CharSet = CharSet.Unicode, ExactSpelling = true)]
419 internal static extern int MsiDatabaseImport(uint database, string folderPath, string fileName);
420
421 /// <summary>
422 /// PInvoke of MsiDatabaseMergeW.
423 /// </summary>
424 /// <param name="database">The handle to the database obtained from MsiOpenDatabase.</param>
425 /// <param name="databaseMerge">The handle to the database obtained from MsiOpenDatabase to merge into the base database.</param>
426 /// <param name="tableName">The name of the table to receive merge conflict information.</param>
427 /// <returns>Error code.</returns>
428 [DllImport("msi.dll", EntryPoint = "MsiDatabaseMergeW", CharSet = CharSet.Unicode, ExactSpelling = true)]
429 internal static extern int MsiDatabaseMerge(uint database, uint databaseMerge, string tableName);
430
431 /// <summary>
432 /// PInvoke of MsiDatabaseOpenViewW.
433 /// </summary>
434 /// <param name="database">Handle to a database.</param>
435 /// <param name="query">SQL query.</param>
436 /// <param name="view">View handle.</param>
437 /// <returns>Error code.</returns>
438 [DllImport("msi.dll", EntryPoint = "MsiDatabaseOpenViewW", CharSet = CharSet.Unicode, ExactSpelling = true)]
439 internal static extern int MsiDatabaseOpenView(uint database, string query, out uint view);
440
441 /// <summary>
442 /// PInvoke of MsiGetFileHashW.
443 /// </summary>
444 /// <param name="filePath">File path.</param>
445 /// <param name="options">Hash options (must be 0).</param>
446 /// <param name="hash">Buffer to recieve hash.</param>
447 /// <returns>Error code.</returns>
448 [DllImport("msi.dll", EntryPoint = "MsiGetFileHashW", CharSet = CharSet.Unicode, ExactSpelling = true)]
449 internal static extern int MsiGetFileHash(string filePath, uint options, MSIFILEHASHINFO hash);
450
451 /// <summary>
452 /// PInvoke of MsiGetFileVersionW.
453 /// </summary>
454 /// <param name="filePath">File path.</param>
455 /// <param name="versionBuf">Buffer to receive version info.</param>
456 /// <param name="versionBufSize">Size of version buffer.</param>
457 /// <param name="langBuf">Buffer to recieve lang info.</param>
458 /// <param name="langBufSize">Size of lang buffer.</param>
459 /// <returns>Error code.</returns>
460 [DllImport("msi.dll", EntryPoint = "MsiGetFileVersionW", CharSet = CharSet.Unicode, ExactSpelling = true)]
461 internal static extern int MsiGetFileVersion(string filePath, StringBuilder versionBuf, ref int versionBufSize, StringBuilder langBuf, ref int langBufSize);
462
463 /// <summary>
464 /// PInvoke of MsiGetLastErrorRecord.
465 /// </summary>
466 /// <returns>Handle to error record if one exists.</returns>
467 [DllImport("msi.dll", EntryPoint = "MsiGetLastErrorRecord", CharSet = CharSet.Unicode, ExactSpelling = true)]
468 internal static extern uint MsiGetLastErrorRecord();
469
470 /// <summary>
471 /// PInvoke of MsiDatabaseGetPrimaryKeysW.
472 /// </summary>
473 /// <param name="database">Handle to a database.</param>
474 /// <param name="tableName">Table name.</param>
475 /// <param name="record">Handle to receive resulting record.</param>
476 /// <returns>Error code.</returns>
477 [DllImport("msi.dll", EntryPoint = "MsiDatabaseGetPrimaryKeysW", CharSet = CharSet.Unicode, ExactSpelling = true)]
478 internal static extern int MsiDatabaseGetPrimaryKeys(uint database, string tableName, out uint record);
479
480 /// <summary>
481 /// PInvoke of MsiDoActionW.
482 /// </summary>
483 /// <param name="product">Handle to the installation provided to a DLL custom action or
484 /// obtained through MsiOpenPackage, MsiOpenPackageEx, or MsiOpenProduct.</param>
485 /// <param name="action">Specifies the action to execute.</param>
486 /// <returns>Error code.</returns>
487 [DllImport("msi.dll", EntryPoint = "MsiDoActionW", CharSet = CharSet.Unicode, ExactSpelling = true)]
488 internal static extern int MsiDoAction(uint product, string action);
489
490 /// <summary>
491 /// PInvoke of MsiGetSummaryInformationW. Can use either database handle or database path as input.
492 /// </summary>
493 /// <param name="database">Handle to a database.</param>
494 /// <param name="databasePath">Path to a database.</param>
495 /// <param name="updateCount">Max number of updated values.</param>
496 /// <param name="summaryInfo">Handle to summary information.</param>
497 /// <returns>Error code.</returns>
498 [DllImport("msi.dll", EntryPoint = "MsiGetSummaryInformationW", CharSet = CharSet.Unicode, ExactSpelling = true)]
499 internal static extern int MsiGetSummaryInformation(uint database, string databasePath, uint updateCount, ref uint summaryInfo);
500
501 /// <summary>
502 /// PInvoke of MsiDatabaseIsTablePersitentW.
503 /// </summary>
504 /// <param name="database">Handle to a database.</param>
505 /// <param name="tableName">Table name.</param>
506 /// <returns>MSICONDITION</returns>
507 [DllImport("msi.dll", EntryPoint = "MsiDatabaseIsTablePersistentW", CharSet = CharSet.Unicode, ExactSpelling = true)]
508 internal static extern int MsiDatabaseIsTablePersistent(uint database, string tableName);
509
510 /// <summary>
511 /// PInvoke of MsiOpenDatabaseW.
512 /// </summary>
513 /// <param name="databasePath">Path to database.</param>
514 /// <param name="persist">Persist mode.</param>
515 /// <param name="database">Handle to database.</param>
516 /// <returns>Error code.</returns>
517 [DllImport("msi.dll", EntryPoint = "MsiOpenDatabaseW", CharSet = CharSet.Unicode, ExactSpelling = true)]
518 internal static extern int MsiOpenDatabase(string databasePath, IntPtr persist, out uint database);
519
520 /// <summary>
521 /// PInvoke of MsiOpenPackageW.
522 /// </summary>
523 /// <param name="packagePath">The path to the package.</param>
524 /// <param name="product">A pointer to a variable that receives the product handle.</param>
525 /// <returns>Error code.</returns>
526 [DllImport("msi.dll", EntryPoint = "MsiOpenPackageW", CharSet = CharSet.Unicode, ExactSpelling = true)]
527 internal static extern int MsiOpenPackage(string packagePath, out uint product);
528
529 /// <summary>
530 /// PInvoke of MsiRecordIsNull.
531 /// </summary>
532 /// <param name="record">MSI Record handle.</param>
533 /// <param name="field">Index of field to check for null value.</param>
534 /// <returns>true if the field is null, false if not, and an error code for any error.</returns>
535 [DllImport("msi.dll", EntryPoint = "MsiRecordIsNull", CharSet = CharSet.Unicode, ExactSpelling = true)]
536 internal static extern int MsiRecordIsNull(uint record, int field);
537
538 /// <summary>
539 /// PInvoke of MsiRecordGetInteger.
540 /// </summary>
541 /// <param name="record">MSI Record handle.</param>
542 /// <param name="field">Index of field to retrieve integer from.</param>
543 /// <returns>Integer value.</returns>
544 [DllImport("msi.dll", EntryPoint = "MsiRecordGetInteger", CharSet = CharSet.Unicode, ExactSpelling = true)]
545 internal static extern int MsiRecordGetInteger(uint record, int field);
546
547 /// <summary>
548 /// PInvoke of MsiRectordSetInteger.
549 /// </summary>
550 /// <param name="record">MSI Record handle.</param>
551 /// <param name="field">Index of field to set integer value in.</param>
552 /// <param name="value">Value to set field to.</param>
553 /// <returns>Error code.</returns>
554 [DllImport("msi.dll", EntryPoint = "MsiRecordSetInteger", CharSet = CharSet.Unicode, ExactSpelling = true)]
555 internal static extern int MsiRecordSetInteger(uint record, int field, int value);
556
557 /// <summary>
558 /// PInvoke of MsiRecordGetStringW.
559 /// </summary>
560 /// <param name="record">MSI Record handle.</param>
561 /// <param name="field">Index of field to get string value from.</param>
562 /// <param name="valueBuf">Buffer to recieve value.</param>
563 /// <param name="valueBufSize">Size of buffer.</param>
564 /// <returns>Error code.</returns>
565 [DllImport("msi.dll", EntryPoint = "MsiRecordGetStringW", CharSet = CharSet.Unicode, ExactSpelling = true)]
566 internal static extern int MsiRecordGetString(uint record, int field, StringBuilder valueBuf, ref int valueBufSize);
567
568 /// <summary>
569 /// PInvoke of MsiRecordSetStringW.
570 /// </summary>
571 /// <param name="record">MSI Record handle.</param>
572 /// <param name="field">Index of field to set string value in.</param>
573 /// <param name="value">String value.</param>
574 /// <returns>Error code.</returns>
575 [DllImport("msi.dll", EntryPoint = "MsiRecordSetStringW", CharSet = CharSet.Unicode, ExactSpelling = true)]
576 internal static extern int MsiRecordSetString(uint record, int field, string value);
577
578 /// <summary>
579 /// PInvoke of MsiRecordSetStreamW.
580 /// </summary>
581 /// <param name="record">MSI Record handle.</param>
582 /// <param name="field">Index of field to set stream value in.</param>
583 /// <param name="filePath">Path to file to set stream value to.</param>
584 /// <returns>Error code.</returns>
585 [DllImport("msi.dll", EntryPoint = "MsiRecordSetStreamW", CharSet = CharSet.Unicode, ExactSpelling = true)]
586 internal static extern int MsiRecordSetStream(uint record, int field, string filePath);
587
588 /// <summary>
589 /// PInvoke of MsiRecordReadStreamW.
590 /// </summary>
591 /// <param name="record">MSI Record handle.</param>
592 /// <param name="field">Index of field to read stream from.</param>
593 /// <param name="dataBuf">Data buffer to recieve stream value.</param>
594 /// <param name="dataBufSize">Size of data buffer.</param>
595 /// <returns>Error code.</returns>
596 [DllImport("msi.dll", EntryPoint = "MsiRecordReadStream", CharSet = CharSet.Unicode, ExactSpelling = true)]
597 internal static extern int MsiRecordReadStream(uint record, int field, byte[] dataBuf, ref int dataBufSize);
598
599 /// <summary>
600 /// PInvoke of MsiRecordGetFieldCount.
601 /// </summary>
602 /// <param name="record">MSI Record handle.</param>
603 /// <returns>Count of fields in the record.</returns>
604 [DllImport("msi.dll", EntryPoint = "MsiRecordGetFieldCount", CharSet = CharSet.Unicode, ExactSpelling = true)]
605 internal static extern int MsiRecordGetFieldCount(uint record);
606
607 /// <summary>
608 /// PInvoke of MsiSetExternalUIW.
609 /// </summary>
610 /// <param name="installUIHandler">Specifies a callback function that conforms to the INSTALLUI_HANDLER specification.</param>
611 /// <param name="installLogMode">Specifies which messages to handle using the external message handler. If the external
612 /// handler returns a non-zero result, then that message will not be sent to the UI, instead the message will be logged
613 /// if logging has been enabled.</param>
614 /// <param name="context">Pointer to an application context that is passed to the callback function.
615 /// This parameter can be used for error checking.</param>
616 /// <returns>The return value is the previously set external handler, or zero (0) if there was no previously set handler.</returns>
617 [DllImport("msi.dll", EntryPoint = "MsiSetExternalUIW", CharSet = CharSet.Unicode, ExactSpelling = true)]
618 internal static extern InstallUIHandler MsiSetExternalUI(InstallUIHandler installUIHandler, int installLogMode, IntPtr context);
619
620 /// <summary>
621 /// PInvoke of MsiSetInternalUI.
622 /// </summary>
623 /// <param name="uiLevel">Specifies the level of complexity of the user interface.</param>
624 /// <param name="hwnd">Pointer to a window. This window becomes the owner of any user interface created.
625 /// A pointer to the previous owner of the user interface is returned.
626 /// If this parameter is null, the owner of the user interface does not change.</param>
627 /// <returns>The previous user interface level is returned. If an invalid dwUILevel is passed, then INSTALLUILEVEL_NOCHANGE is returned.</returns>
628 [DllImport("msi.dll", EntryPoint = "MsiSetInternalUI", CharSet = CharSet.Unicode, ExactSpelling = true)]
629 internal static extern int MsiSetInternalUI(int uiLevel, ref IntPtr hwnd);
630
631 /// <summary>
632 /// PInvoke of MsiSummaryInfoGetPropertyW.
633 /// </summary>
634 /// <param name="summaryInfo">Handle to summary info.</param>
635 /// <param name="property">Property to get value from.</param>
636 /// <param name="dataType">Data type of property.</param>
637 /// <param name="integerValue">Integer to receive integer value.</param>
638 /// <param name="fileTimeValue">File time to receive file time value.</param>
639 /// <param name="stringValueBuf">String buffer to receive string value.</param>
640 /// <param name="stringValueBufSize">Size of string buffer.</param>
641 /// <returns>Error code.</returns>
642 [DllImport("msi.dll", EntryPoint = "MsiSummaryInfoGetPropertyW", CharSet = CharSet.Unicode, ExactSpelling = true)]
643 internal static extern int MsiSummaryInfoGetProperty(uint summaryInfo, int property, out uint dataType, out int integerValue, ref FILETIME fileTimeValue, StringBuilder stringValueBuf, ref int stringValueBufSize);
644
645 /// <summary>
646 /// PInvoke of MsiViewGetColumnInfo.
647 /// </summary>
648 /// <param name="view">Handle to view.</param>
649 /// <param name="columnInfo">Column info.</param>
650 /// <param name="record">Handle for returned record.</param>
651 /// <returns>Error code.</returns>
652 [DllImport("msi.dll", EntryPoint = "MsiViewGetColumnInfo", CharSet = CharSet.Unicode, ExactSpelling = true)]
653 internal static extern int MsiViewGetColumnInfo(uint view, int columnInfo, out uint record);
654
655 /// <summary>
656 /// PInvoke of MsiViewExecute.
657 /// </summary>
658 /// <param name="view">Handle of view to execute.</param>
659 /// <param name="record">Handle to a record that supplies the parameters for the view.</param>
660 /// <returns>Error code.</returns>
661 [DllImport("msi.dll", EntryPoint = "MsiViewExecute", CharSet = CharSet.Unicode, ExactSpelling = true)]
662 internal static extern int MsiViewExecute(uint view, uint record);
663
664 /// <summary>
665 /// PInvoke of MsiViewFetch.
666 /// </summary>
667 /// <param name="view">Handle of view to fetch a row from.</param>
668 /// <param name="record">Handle to receive record info.</param>
669 /// <returns>Error code.</returns>
670 [DllImport("msi.dll", EntryPoint = "MsiViewFetch", CharSet = CharSet.Unicode, ExactSpelling = true)]
671 internal static extern int MsiViewFetch(uint view, out uint record);
672
673 /// <summary>
674 /// PInvoke of MsiViewModify.
675 /// </summary>
676 /// <param name="view">Handle of view to modify.</param>
677 /// <param name="modifyMode">Modify mode.</param>
678 /// <param name="record">Handle of record.</param>
679 /// <returns>Error code.</returns>
680 [DllImport("msi.dll", EntryPoint = "MsiViewModify", CharSet = CharSet.Unicode, ExactSpelling = true)]
681 internal static extern int MsiViewModify(uint view, int modifyMode, uint record);
682
683 /// <summary>
684 /// contains the file hash information returned by MsiGetFileHash and used in the MsiFileHash table.
685 /// </summary>
686 [StructLayout(LayoutKind.Explicit)]
687 internal class MSIFILEHASHINFO
688 {
689 [FieldOffset(0)] internal uint FileHashInfoSize;
690 [FieldOffset(4)] internal int Data0;
691 [FieldOffset(8)] internal int Data1;
692 [FieldOffset(12)]internal int Data2;
693 [FieldOffset(16)]internal int Data3;
694 }
695 }
696}
697#endif \ No newline at end of file
diff --git a/src/WixToolset.Core.WindowsInstaller/Msi/MsiException.cs b/src/WixToolset.Core.WindowsInstaller/Msi/MsiException.cs
index b33bf27a..4e324a60 100644
--- a/src/WixToolset.Core.WindowsInstaller/Msi/MsiException.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Msi/MsiException.cs
@@ -1,10 +1,9 @@
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.Msi 3namespace WixToolset.Core.WindowsInstaller.Msi
4{ 4{
5 using System; 5 using System;
6 using System.ComponentModel; 6 using System.ComponentModel;
7 using WixToolset.Core.Native;
8 7
9 /// <summary> 8 /// <summary>
10 /// Exception that wraps MsiGetLastError(). 9 /// Exception that wraps MsiGetLastError().
diff --git a/src/WixToolset.Core.WindowsInstaller/Msi/MsiHandle.cs b/src/WixToolset.Core.WindowsInstaller/Msi/MsiHandle.cs
index 6d2dc984..9006180b 100644
--- a/src/WixToolset.Core.WindowsInstaller/Msi/MsiHandle.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Msi/MsiHandle.cs
@@ -1,12 +1,13 @@
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.Msi 3namespace WixToolset.Core.WindowsInstaller.Msi
4{ 4{
5 using System; 5 using System;
6 using System.ComponentModel; 6 using System.ComponentModel;
7#if !DEBUG
7 using System.Diagnostics; 8 using System.Diagnostics;
9#endif
8 using System.Threading; 10 using System.Threading;
9 using WixToolset.Core.Native;
10 11
11 /// <summary> 12 /// <summary>
12 /// Wrapper class for MSI handle. 13 /// Wrapper class for MSI handle.
diff --git a/src/WixToolset.Core.WindowsInstaller/Msi/MsiInterop.cs b/src/WixToolset.Core.WindowsInstaller/Msi/MsiInterop.cs
new file mode 100644
index 00000000..8d195033
--- /dev/null
+++ b/src/WixToolset.Core.WindowsInstaller/Msi/MsiInterop.cs
@@ -0,0 +1,571 @@
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
3namespace WixToolset.Core.WindowsInstaller.Msi
4{
5 using System;
6 using System.Text;
7 using System.Runtime.InteropServices;
8 using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME;
9 using WixToolset.Core.Native;
10
11 /// <summary>
12 /// A callback function that the installer calls for progress notification and error messages.
13 /// </summary>
14 /// <param name="context">Pointer to an application context.
15 /// This parameter can be used for error checking.</param>
16 /// <param name="messageType">Specifies a combination of one message box style,
17 /// one message box icon type, one default button, and one installation message type.</param>
18 /// <param name="message">Specifies the message text.</param>
19 /// <returns>-1 for an error, 0 if no action was taken, 1 if OK, 3 to abort.</returns>
20 public delegate int InstallUIHandler(IntPtr context, uint messageType, [MarshalAs(UnmanagedType.LPWStr)] string message);
21
22 /// <summary>
23 /// Enum of predefined persist modes used when opening a database.
24 /// </summary>
25 public enum OpenDatabase
26 {
27 /// <summary>
28 /// Open a database read-only, no persistent changes.
29 /// </summary>
30 ReadOnly = 0,
31
32 /// <summary>
33 /// Open a database read/write in transaction mode.
34 /// </summary>
35 Transact = 1,
36
37 /// <summary>
38 /// Open a database direct read/write without transaction.
39 /// </summary>
40 Direct = 2,
41
42 /// <summary>
43 /// Create a new database, transact mode read/write.
44 /// </summary>
45 Create = 3,
46
47 /// <summary>
48 /// Create a new database, direct mode read/write.
49 /// </summary>
50 CreateDirect = 4,
51
52 /// <summary>
53 /// Indicates a patch file is being opened.
54 /// </summary>
55 OpenPatchFile = 32
56 }
57
58 /// <summary>
59 /// The errors to suppress when applying a transform.
60 /// </summary>
61 [Flags]
62 public enum TransformErrorConditions
63 {
64 /// <summary>
65 /// None of the following conditions.
66 /// </summary>
67 None = 0x0,
68
69 /// <summary>
70 /// Suppress error when adding a row that exists.
71 /// </summary>
72 AddExistingRow = 0x1,
73
74 /// <summary>
75 /// Suppress error when deleting a row that does not exist.
76 /// </summary>
77 DeleteMissingRow = 0x2,
78
79 /// <summary>
80 /// Suppress error when adding a table that exists.
81 /// </summary>
82 AddExistingTable = 0x4,
83
84 /// <summary>
85 /// Suppress error when deleting a table that does not exist.
86 /// </summary>
87 DeleteMissingTable = 0x8,
88
89 /// <summary>
90 /// Suppress error when updating a row that does not exist.
91 /// </summary>
92 UpdateMissingRow = 0x10,
93
94 /// <summary>
95 /// Suppress error when transform and database code pages do not match, and their code pages are neutral.
96 /// </summary>
97 ChangeCodepage = 0x20,
98
99 /// <summary>
100 /// Create the temporary _TransformView table when applying a transform.
101 /// </summary>
102 ViewTransform = 0x100,
103
104 /// <summary>
105 /// Suppress all errors but the option to create the temporary _TransformView table.
106 /// </summary>
107 All = 0x3F
108 }
109
110 /// <summary>
111 /// The validation to run while applying a transform.
112 /// </summary>
113 [Flags]
114 public enum TransformValidations
115 {
116 /// <summary>
117 /// Do not validate properties.
118 /// </summary>
119 None = 0x0,
120
121 /// <summary>
122 /// Default language must match base database.
123 /// </summary>
124 Language = 0x1,
125
126 /// <summary>
127 /// Product must match base database.
128 /// </summary>
129 Product = 0x2,
130
131 /// <summary>
132 /// Check major version only.
133 /// </summary>
134 MajorVersion = 0x8,
135
136 /// <summary>
137 /// Check major and minor versions only.
138 /// </summary>
139 MinorVersion = 0x10,
140
141 /// <summary>
142 /// Check major, minor, and update versions.
143 /// </summary>
144 UpdateVersion = 0x20,
145
146 /// <summary>
147 /// Installed version &lt; base version.
148 /// </summary>
149 NewLessBaseVersion = 0x40,
150
151 /// <summary>
152 /// Installed version &lt;= base version.
153 /// </summary>
154 NewLessEqualBaseVersion = 0x80,
155
156 /// <summary>
157 /// Installed version = base version.
158 /// </summary>
159 NewEqualBaseVersion = 0x100,
160
161 /// <summary>
162 /// Installed version &gt;= base version.
163 /// </summary>
164 NewGreaterEqualBaseVersion = 0x200,
165
166 /// <summary>
167 /// Installed version &gt; base version.
168 /// </summary>
169 NewGreaterBaseVersion = 0x400,
170
171 /// <summary>
172 /// UpgradeCode must match base database.
173 /// </summary>
174 UpgradeCode = 0x800
175 }
176
177 /// <summary>
178 /// Class exposing static functions and structs from MSI API.
179 /// </summary>
180 public sealed class MsiInterop
181 {
182 // Patching constants
183 public const int MsiMaxStreamNameLength = 62; // http://msdn2.microsoft.com/library/aa370551.aspx
184
185 public const int MSICONDITIONFALSE = 0; // The table is temporary.
186 public const int MSICONDITIONTRUE = 1; // The table is persistent.
187 public const int MSICONDITIONNONE = 2; // The table is unknown.
188 public const int MSICONDITIONERROR = 3; // An invalid handle or invalid parameter was passed to the function.
189 /*
190 public const int MSIDBOPENREADONLY = 0;
191 public const int MSIDBOPENTRANSACT = 1;
192 public const int MSIDBOPENDIRECT = 2;
193 public const int MSIDBOPENCREATE = 3;
194 public const int MSIDBOPENCREATEDIRECT = 4;
195 public const int MSIDBOPENPATCHFILE = 32;
196
197 public const int MSIMODIFYSEEK = -1; // Refreshes the information in the supplied record without changing the position in the result set and without affecting subsequent fetch operations. The record may then be used for subsequent Update, Delete, and Refresh. All primary key columns of the table must be in the query and the record must have at least as many fields as the query. Seek cannot be used with multi-table queries. This mode cannot be used with a view containing joins. See also the remarks.
198 public const int MSIMODIFYREFRESH = 0; // Refreshes the information in the record. Must first call MsiViewFetch with the same record. Fails for a deleted row. Works with read-write and read-only records.
199 public const int MSIMODIFYINSERT = 1; // Inserts a record. Fails if a row with the same primary keys exists. Fails with a read-only database. This mode cannot be used with a view containing joins.
200 public const int MSIMODIFYUPDATE = 2; // Updates an existing record. Nonprimary keys only. Must first call MsiViewFetch. Fails with a deleted record. Works only with read-write records.
201 public const int MSIMODIFYASSIGN = 3; // Writes current data in the cursor to a table row. Updates record if the primary keys match an existing row and inserts if they do not match. Fails with a read-only database. This mode cannot be used with a view containing joins.
202 public const int MSIMODIFYREPLACE = 4; // Updates or deletes and inserts a record into a table. Must first call MsiViewFetch with the same record. Updates record if the primary keys are unchanged. Deletes old row and inserts new if primary keys have changed. Fails with a read-only database. This mode cannot be used with a view containing joins.
203 public const int MSIMODIFYMERGE = 5; // Inserts or validates a record in a table. Inserts if primary keys do not match any row and validates if there is a match. Fails if the record does not match the data in the table. Fails if there is a record with a duplicate key that is not identical. Works only with read-write records. This mode cannot be used with a view containing joins.
204 public const int MSIMODIFYDELETE = 6; // Remove a row from the table. You must first call the MsiViewFetch function with the same record. Fails if the row has been deleted. Works only with read-write records. This mode cannot be used with a view containing joins.
205 public const int MSIMODIFYINSERTTEMPORARY = 7; // Inserts a temporary record. The information is not persistent. Fails if a row with the same primary key exists. Works only with read-write records. This mode cannot be used with a view containing joins.
206 public const int MSIMODIFYVALIDATE = 8; // Validates a record. Does not validate across joins. You must first call the MsiViewFetch function with the same record. Obtain validation errors with MsiViewGetError. Works with read-write and read-only records. This mode cannot be used with a view containing joins.
207 public const int MSIMODIFYVALIDATENEW = 9; // Validate a new record. Does not validate across joins. Checks for duplicate keys. Obtain validation errors by calling MsiViewGetError. Works with read-write and read-only records. This mode cannot be used with a view containing joins.
208 public const int MSIMODIFYVALIDATEFIELD = 10; // Validates fields of a fetched or new record. Can validate one or more fields of an incomplete record. Obtain validation errors by calling MsiViewGetError. Works with read-write and read-only records. This mode cannot be used with a view containing joins.
209 public const int MSIMODIFYVALIDATEDELETE = 11; // Validates a record that will be deleted later. You must first call MsiViewFetch. Fails if another row refers to the primary keys of this row. Validation does not check for the existence of the primary keys of this row in properties or strings. Does not check if a column is a foreign key to multiple tables. Obtain validation errors by calling MsiViewGetError. Works with read-write and read-only records. This mode cannot be used with a view containing joins.
210
211 public const uint VTI2 = 2;
212 public const uint VTI4 = 3;
213 public const uint VTLPWSTR = 30;
214 public const uint VTFILETIME = 64;
215 */
216
217 public const int MSICOLINFONAMES = 0; // return column names
218 public const int MSICOLINFOTYPES = 1; // return column definitions, datatype code followed by width
219
220 /// <summary>
221 /// Protect the constructor.
222 /// </summary>
223 private MsiInterop()
224 {
225 }
226
227 /// <summary>
228 /// PInvoke of MsiCloseHandle.
229 /// </summary>
230 /// <param name="database">Handle to a database.</param>
231 /// <returns>Error code.</returns>
232 [DllImport("msi.dll", EntryPoint = "MsiCloseHandle", CharSet = CharSet.Unicode, ExactSpelling = true)]
233 public static extern int MsiCloseHandle(uint database);
234
235 /// <summary>
236 /// PInvoke of MsiCreateRecord
237 /// </summary>
238 /// <param name="parameters">Count of columns in the record.</param>
239 /// <returns>Handle referencing the record.</returns>
240 [DllImport("msi.dll", EntryPoint = "MsiCreateRecord", CharSet = CharSet.Unicode, ExactSpelling = true)]
241 public static extern uint MsiCreateRecord(int parameters);
242
243 /// <summary>
244 /// Creates summary information of an existing transform to include validation and error conditions.
245 /// </summary>
246 /// <param name="database">The handle to the database that contains the new database summary information.</param>
247 /// <param name="referenceDatabase">The handle to the database that contains the original summary information.</param>
248 /// <param name="transformFile">The name of the transform to which the summary information is added.</param>
249 /// <param name="errorConditions">The error conditions that should be suppressed when the transform is applied.</param>
250 /// <param name="validations">Specifies the properties to be validated to verify that the transform can be applied to the database.</param>
251 /// <returns>Error code.</returns>
252 [DllImport("msi.dll", EntryPoint = "MsiCreateTransformSummaryInfoW", CharSet = CharSet.Unicode, ExactSpelling = true)]
253 public static extern int MsiCreateTransformSummaryInfo(uint database, uint referenceDatabase, string transformFile, TransformErrorConditions errorConditions, TransformValidations validations);
254
255 /// <summary>
256 /// Applies a transform to a database.
257 /// </summary>
258 /// <param name="database">Handle to the database obtained from MsiOpenDatabase to transform.</param>
259 /// <param name="transformFile">Specifies the name of the transform file to apply.</param>
260 /// <param name="errorConditions">Error conditions that should be suppressed.</param>
261 /// <returns>Error code.</returns>
262 [DllImport("msi.dll", EntryPoint = "MsiDatabaseApplyTransformW", CharSet = CharSet.Unicode, ExactSpelling = true)]
263 public static extern int MsiDatabaseApplyTransform(uint database, string transformFile, TransformErrorConditions errorConditions);
264
265 /// <summary>
266 /// PInvoke of MsiDatabaseCommit.
267 /// </summary>
268 /// <param name="database">Handle to a databse.</param>
269 /// <returns>Error code.</returns>
270 [DllImport("msi.dll", EntryPoint = "MsiDatabaseCommit", CharSet = CharSet.Unicode, ExactSpelling = true)]
271 public static extern int MsiDatabaseCommit(uint database);
272
273 /// <summary>
274 /// PInvoke of MsiDatabaseExportW.
275 /// </summary>
276 /// <param name="database">Handle to a database.</param>
277 /// <param name="tableName">Table name.</param>
278 /// <param name="folderPath">Folder path.</param>
279 /// <param name="fileName">File name.</param>
280 /// <returns>Error code.</returns>
281 [DllImport("msi.dll", EntryPoint = "MsiDatabaseExportW", CharSet = CharSet.Unicode, ExactSpelling = true)]
282 public static extern int MsiDatabaseExport(uint database, string tableName, string folderPath, string fileName);
283
284 /// <summary>
285 /// Generates a transform file of differences between two databases.
286 /// </summary>
287 /// <param name="database">Handle to the database obtained from MsiOpenDatabase that includes the changes.</param>
288 /// <param name="databaseReference">Handle to the database obtained from MsiOpenDatabase that does not include the changes.</param>
289 /// <param name="transformFile">A null-terminated string that specifies the name of the transform file being generated.
290 /// This parameter can be null. If szTransformFile is null, you can use MsiDatabaseGenerateTransform to test whether two
291 /// databases are identical without creating a transform. If the databases are identical, the function returns ERROR_NO_DATA.
292 /// If the databases are different the function returns NOERROR.</param>
293 /// <param name="reserved1">This is a reserved argument and must be set to 0.</param>
294 /// <param name="reserved2">This is a reserved argument and must be set to 0.</param>
295 /// <returns>Error code.</returns>
296 [DllImport("msi.dll", EntryPoint = "MsiDatabaseGenerateTransformW", CharSet = CharSet.Unicode, ExactSpelling = true)]
297 public static extern int MsiDatabaseGenerateTransform(uint database, uint databaseReference, string transformFile, int reserved1, int reserved2);
298
299 /// <summary>
300 /// PInvoke of MsiDatabaseImportW.
301 /// </summary>
302 /// <param name="database">Handle to a database.</param>
303 /// <param name="folderPath">Folder path.</param>
304 /// <param name="fileName">File name.</param>
305 /// <returns>Error code.</returns>
306 [DllImport("msi.dll", EntryPoint = "MsiDatabaseImportW", CharSet = CharSet.Unicode, ExactSpelling = true)]
307 public static extern int MsiDatabaseImport(uint database, string folderPath, string fileName);
308
309 /// <summary>
310 /// PInvoke of MsiDatabaseMergeW.
311 /// </summary>
312 /// <param name="database">The handle to the database obtained from MsiOpenDatabase.</param>
313 /// <param name="databaseMerge">The handle to the database obtained from MsiOpenDatabase to merge into the base database.</param>
314 /// <param name="tableName">The name of the table to receive merge conflict information.</param>
315 /// <returns>Error code.</returns>
316 [DllImport("msi.dll", EntryPoint = "MsiDatabaseMergeW", CharSet = CharSet.Unicode, ExactSpelling = true)]
317 public static extern int MsiDatabaseMerge(uint database, uint databaseMerge, string tableName);
318
319 /// <summary>
320 /// PInvoke of MsiDatabaseOpenViewW.
321 /// </summary>
322 /// <param name="database">Handle to a database.</param>
323 /// <param name="query">SQL query.</param>
324 /// <param name="view">View handle.</param>
325 /// <returns>Error code.</returns>
326 [DllImport("msi.dll", EntryPoint = "MsiDatabaseOpenViewW", CharSet = CharSet.Unicode, ExactSpelling = true)]
327 public static extern int MsiDatabaseOpenView(uint database, string query, out uint view);
328
329 /// <summary>
330 /// PInvoke of MsiGetFileHashW.
331 /// </summary>
332 /// <param name="filePath">File path.</param>
333 /// <param name="options">Hash options (must be 0).</param>
334 /// <param name="hash">Buffer to recieve hash.</param>
335 /// <returns>Error code.</returns>
336 [DllImport("msi.dll", EntryPoint = "MsiGetFileHashW", CharSet = CharSet.Unicode, ExactSpelling = true)]
337 public static extern int MsiGetFileHash(string filePath, uint options, MSIFILEHASHINFO hash);
338
339 /// <summary>
340 /// PInvoke of MsiGetFileVersionW.
341 /// </summary>
342 /// <param name="filePath">File path.</param>
343 /// <param name="versionBuf">Buffer to receive version info.</param>
344 /// <param name="versionBufSize">Size of version buffer.</param>
345 /// <param name="langBuf">Buffer to recieve lang info.</param>
346 /// <param name="langBufSize">Size of lang buffer.</param>
347 /// <returns>Error code.</returns>
348 [DllImport("msi.dll", EntryPoint = "MsiGetFileVersionW", CharSet = CharSet.Unicode, ExactSpelling = true)]
349 public static extern int MsiGetFileVersion(string filePath, StringBuilder versionBuf, ref int versionBufSize, StringBuilder langBuf, ref int langBufSize);
350
351 /// <summary>
352 /// PInvoke of MsiGetLastErrorRecord.
353 /// </summary>
354 /// <returns>Handle to error record if one exists.</returns>
355 [DllImport("msi.dll", EntryPoint = "MsiGetLastErrorRecord", CharSet = CharSet.Unicode, ExactSpelling = true)]
356 public static extern uint MsiGetLastErrorRecord();
357
358 /// <summary>
359 /// PInvoke of MsiDatabaseGetPrimaryKeysW.
360 /// </summary>
361 /// <param name="database">Handle to a database.</param>
362 /// <param name="tableName">Table name.</param>
363 /// <param name="record">Handle to receive resulting record.</param>
364 /// <returns>Error code.</returns>
365 [DllImport("msi.dll", EntryPoint = "MsiDatabaseGetPrimaryKeysW", CharSet = CharSet.Unicode, ExactSpelling = true)]
366 public static extern int MsiDatabaseGetPrimaryKeys(uint database, string tableName, out uint record);
367
368 /// <summary>
369 /// PInvoke of MsiDoActionW.
370 /// </summary>
371 /// <param name="product">Handle to the installation provided to a DLL custom action or
372 /// obtained through MsiOpenPackage, MsiOpenPackageEx, or MsiOpenProduct.</param>
373 /// <param name="action">Specifies the action to execute.</param>
374 /// <returns>Error code.</returns>
375 [DllImport("msi.dll", EntryPoint = "MsiDoActionW", CharSet = CharSet.Unicode, ExactSpelling = true)]
376 public static extern int MsiDoAction(uint product, string action);
377
378 /// <summary>
379 /// PInvoke of MsiGetSummaryInformationW. Can use either database handle or database path as input.
380 /// </summary>
381 /// <param name="database">Handle to a database.</param>
382 /// <param name="databasePath">Path to a database.</param>
383 /// <param name="updateCount">Max number of updated values.</param>
384 /// <param name="summaryInfo">Handle to summary information.</param>
385 /// <returns>Error code.</returns>
386 [DllImport("msi.dll", EntryPoint = "MsiGetSummaryInformationW", CharSet = CharSet.Unicode, ExactSpelling = true)]
387 public static extern int MsiGetSummaryInformation(uint database, string databasePath, uint updateCount, ref uint summaryInfo);
388
389 /// <summary>
390 /// PInvoke of MsiDatabaseIsTablePersitentW.
391 /// </summary>
392 /// <param name="database">Handle to a database.</param>
393 /// <param name="tableName">Table name.</param>
394 /// <returns>MSICONDITION</returns>
395 [DllImport("msi.dll", EntryPoint = "MsiDatabaseIsTablePersistentW", CharSet = CharSet.Unicode, ExactSpelling = true)]
396 public static extern int MsiDatabaseIsTablePersistent(uint database, string tableName);
397
398 /// <summary>
399 /// PInvoke of MsiOpenDatabaseW.
400 /// </summary>
401 /// <param name="databasePath">Path to database.</param>
402 /// <param name="persist">Persist mode.</param>
403 /// <param name="database">Handle to database.</param>
404 /// <returns>Error code.</returns>
405 [DllImport("msi.dll", EntryPoint = "MsiOpenDatabaseW", CharSet = CharSet.Unicode, ExactSpelling = true)]
406 public static extern int MsiOpenDatabase(string databasePath, IntPtr persist, out uint database);
407
408 /// <summary>
409 /// PInvoke of MsiOpenPackageW.
410 /// </summary>
411 /// <param name="packagePath">The path to the package.</param>
412 /// <param name="product">A pointer to a variable that receives the product handle.</param>
413 /// <returns>Error code.</returns>
414 [DllImport("msi.dll", EntryPoint = "MsiOpenPackageW", CharSet = CharSet.Unicode, ExactSpelling = true)]
415 public static extern int MsiOpenPackage(string packagePath, out uint product);
416
417 /// <summary>
418 /// PInvoke of MsiRecordIsNull.
419 /// </summary>
420 /// <param name="record">MSI Record handle.</param>
421 /// <param name="field">Index of field to check for null value.</param>
422 /// <returns>true if the field is null, false if not, and an error code for any error.</returns>
423 [DllImport("msi.dll", EntryPoint = "MsiRecordIsNull", CharSet = CharSet.Unicode, ExactSpelling = true)]
424 public static extern int MsiRecordIsNull(uint record, int field);
425
426 /// <summary>
427 /// PInvoke of MsiRecordGetInteger.
428 /// </summary>
429 /// <param name="record">MSI Record handle.</param>
430 /// <param name="field">Index of field to retrieve integer from.</param>
431 /// <returns>Integer value.</returns>
432 [DllImport("msi.dll", EntryPoint = "MsiRecordGetInteger", CharSet = CharSet.Unicode, ExactSpelling = true)]
433 public static extern int MsiRecordGetInteger(uint record, int field);
434
435 /// <summary>
436 /// PInvoke of MsiRectordSetInteger.
437 /// </summary>
438 /// <param name="record">MSI Record handle.</param>
439 /// <param name="field">Index of field to set integer value in.</param>
440 /// <param name="value">Value to set field to.</param>
441 /// <returns>Error code.</returns>
442 [DllImport("msi.dll", EntryPoint = "MsiRecordSetInteger", CharSet = CharSet.Unicode, ExactSpelling = true)]
443 public static extern int MsiRecordSetInteger(uint record, int field, int value);
444
445 /// <summary>
446 /// PInvoke of MsiRecordGetStringW.
447 /// </summary>
448 /// <param name="record">MSI Record handle.</param>
449 /// <param name="field">Index of field to get string value from.</param>
450 /// <param name="valueBuf">Buffer to recieve value.</param>
451 /// <param name="valueBufSize">Size of buffer.</param>
452 /// <returns>Error code.</returns>
453 [DllImport("msi.dll", EntryPoint = "MsiRecordGetStringW", CharSet = CharSet.Unicode, ExactSpelling = true)]
454 public static extern int MsiRecordGetString(uint record, int field, StringBuilder valueBuf, ref int valueBufSize);
455
456 /// <summary>
457 /// PInvoke of MsiRecordSetStringW.
458 /// </summary>
459 /// <param name="record">MSI Record handle.</param>
460 /// <param name="field">Index of field to set string value in.</param>
461 /// <param name="value">String value.</param>
462 /// <returns>Error code.</returns>
463 [DllImport("msi.dll", EntryPoint = "MsiRecordSetStringW", CharSet = CharSet.Unicode, ExactSpelling = true)]
464 public static extern int MsiRecordSetString(uint record, int field, string value);
465
466 /// <summary>
467 /// PInvoke of MsiRecordSetStreamW.
468 /// </summary>
469 /// <param name="record">MSI Record handle.</param>
470 /// <param name="field">Index of field to set stream value in.</param>
471 /// <param name="filePath">Path to file to set stream value to.</param>
472 /// <returns>Error code.</returns>
473 [DllImport("msi.dll", EntryPoint = "MsiRecordSetStreamW", CharSet = CharSet.Unicode, ExactSpelling = true)]
474 public static extern int MsiRecordSetStream(uint record, int field, string filePath);
475
476 /// <summary>
477 /// PInvoke of MsiRecordReadStreamW.
478 /// </summary>
479 /// <param name="record">MSI Record handle.</param>
480 /// <param name="field">Index of field to read stream from.</param>
481 /// <param name="dataBuf">Data buffer to recieve stream value.</param>
482 /// <param name="dataBufSize">Size of data buffer.</param>
483 /// <returns>Error code.</returns>
484 [DllImport("msi.dll", EntryPoint = "MsiRecordReadStream", CharSet = CharSet.Unicode, ExactSpelling = true)]
485 public static extern int MsiRecordReadStream(uint record, int field, byte[] dataBuf, ref int dataBufSize);
486
487 /// <summary>
488 /// PInvoke of MsiRecordGetFieldCount.
489 /// </summary>
490 /// <param name="record">MSI Record handle.</param>
491 /// <returns>Count of fields in the record.</returns>
492 [DllImport("msi.dll", EntryPoint = "MsiRecordGetFieldCount", CharSet = CharSet.Unicode, ExactSpelling = true)]
493 public static extern int MsiRecordGetFieldCount(uint record);
494
495 /// <summary>
496 /// PInvoke of MsiSetExternalUIW.
497 /// </summary>
498 /// <param name="installUIHandler">Specifies a callback function that conforms to the INSTALLUI_HANDLER specification.</param>
499 /// <param name="installLogMode">Specifies which messages to handle using the external message handler. If the external
500 /// handler returns a non-zero result, then that message will not be sent to the UI, instead the message will be logged
501 /// if logging has been enabled.</param>
502 /// <param name="context">Pointer to an application context that is passed to the callback function.
503 /// This parameter can be used for error checking.</param>
504 /// <returns>The return value is the previously set external handler, or zero (0) if there was no previously set handler.</returns>
505 [DllImport("msi.dll", EntryPoint = "MsiSetExternalUIW", CharSet = CharSet.Unicode, ExactSpelling = true)]
506 public static extern InstallUIHandler MsiSetExternalUI(InstallUIHandler installUIHandler, int installLogMode, IntPtr context);
507
508 /// <summary>
509 /// PInvoke of MsiSetpublicUI.
510 /// </summary>
511 /// <param name="uiLevel">Specifies the level of complexity of the user interface.</param>
512 /// <param name="hwnd">Pointer to a window. This window becomes the owner of any user interface created.
513 /// A pointer to the previous owner of the user interface is returned.
514 /// If this parameter is null, the owner of the user interface does not change.</param>
515 /// <returns>The previous user interface level is returned. If an invalid dwUILevel is passed, then INSTALLUILEVEL_NOCHANGE is returned.</returns>
516 [DllImport("msi.dll", EntryPoint = "MsiSetpublicUI", CharSet = CharSet.Unicode, ExactSpelling = true)]
517 public static extern int MsiSetInternalUI(int uiLevel, ref IntPtr hwnd);
518
519 /// <summary>
520 /// PInvoke of MsiSummaryInfoGetPropertyW.
521 /// </summary>
522 /// <param name="summaryInfo">Handle to summary info.</param>
523 /// <param name="property">Property to get value from.</param>
524 /// <param name="dataType">Data type of property.</param>
525 /// <param name="integerValue">Integer to receive integer value.</param>
526 /// <param name="fileTimeValue">File time to receive file time value.</param>
527 /// <param name="stringValueBuf">String buffer to receive string value.</param>
528 /// <param name="stringValueBufSize">Size of string buffer.</param>
529 /// <returns>Error code.</returns>
530 [DllImport("msi.dll", EntryPoint = "MsiSummaryInfoGetPropertyW", CharSet = CharSet.Unicode, ExactSpelling = true)]
531 public static extern int MsiSummaryInfoGetProperty(uint summaryInfo, int property, out uint dataType, out int integerValue, ref FILETIME fileTimeValue, StringBuilder stringValueBuf, ref int stringValueBufSize);
532
533 /// <summary>
534 /// PInvoke of MsiViewGetColumnInfo.
535 /// </summary>
536 /// <param name="view">Handle to view.</param>
537 /// <param name="columnInfo">Column info.</param>
538 /// <param name="record">Handle for returned record.</param>
539 /// <returns>Error code.</returns>
540 [DllImport("msi.dll", EntryPoint = "MsiViewGetColumnInfo", CharSet = CharSet.Unicode, ExactSpelling = true)]
541 public static extern int MsiViewGetColumnInfo(uint view, int columnInfo, out uint record);
542
543 /// <summary>
544 /// PInvoke of MsiViewExecute.
545 /// </summary>
546 /// <param name="view">Handle of view to execute.</param>
547 /// <param name="record">Handle to a record that supplies the parameters for the view.</param>
548 /// <returns>Error code.</returns>
549 [DllImport("msi.dll", EntryPoint = "MsiViewExecute", CharSet = CharSet.Unicode, ExactSpelling = true)]
550 public static extern int MsiViewExecute(uint view, uint record);
551
552 /// <summary>
553 /// PInvoke of MsiViewFetch.
554 /// </summary>
555 /// <param name="view">Handle of view to fetch a row from.</param>
556 /// <param name="record">Handle to receive record info.</param>
557 /// <returns>Error code.</returns>
558 [DllImport("msi.dll", EntryPoint = "MsiViewFetch", CharSet = CharSet.Unicode, ExactSpelling = true)]
559 public static extern int MsiViewFetch(uint view, out uint record);
560
561 /// <summary>
562 /// PInvoke of MsiViewModify.
563 /// </summary>
564 /// <param name="view">Handle of view to modify.</param>
565 /// <param name="modifyMode">Modify mode.</param>
566 /// <param name="record">Handle of record.</param>
567 /// <returns>Error code.</returns>
568 [DllImport("msi.dll", EntryPoint = "MsiViewModify", CharSet = CharSet.Unicode, ExactSpelling = true)]
569 public static extern int MsiViewModify(uint view, int modifyMode, uint record);
570 }
571}
diff --git a/src/WixToolset.Core.WindowsInstaller/Msi/MsmInterop.cs b/src/WixToolset.Core.WindowsInstaller/Msi/MsmInterop.cs
new file mode 100644
index 00000000..970d5aaa
--- /dev/null
+++ b/src/WixToolset.Core.WindowsInstaller/Msi/MsmInterop.cs
@@ -0,0 +1,505 @@
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
3namespace WixToolset.Core.WindowsInstaller.Msi
4{
5 using System;
6 using System.Runtime.InteropServices;
7
8 /// <summary>
9 /// Errors returned by merge operations.
10 /// </summary>
11 [Guid("0ADDA825-2C26-11D2-AD65-00A0C9AF11A6")]
12 public enum MsmErrorType
13 {
14 /// <summary>
15 /// A request was made to open a module with a language not supported by the module.
16 /// No more general language is supported by the module.
17 /// Adds msmErrorLanguageUnsupported to the Type property and the requested language
18 /// to the Language Property (Error Object). All Error object properties are empty.
19 /// The OpenModule function returns ERROR_INSTALL_LANGUAGE_UNSUPPORTED (as HRESULT).
20 /// </summary>
21 msmErrorLanguageUnsupported = 1,
22
23 /// <summary>
24 /// A request was made to open a module with a supported language but the module has
25 /// an invalid language transform. Adds msmErrorLanguageFailed to the Type property
26 /// and the applied transform's language to the Language Property of the Error object.
27 /// This may not be the requested language if a more general language was used.
28 /// All other properties of the Error object are empty. The OpenModule function
29 /// returns ERROR_INSTALL_LANGUAGE_UNSUPPORTED (as HRESULT).
30 /// </summary>
31 msmErrorLanguageFailed = 2,
32
33 /// <summary>
34 /// The module cannot be merged because it excludes, or is excluded by, another module
35 /// in the database. Adds msmErrorExclusion to the Type property of the Error object.
36 /// The ModuleKeys property or DatabaseKeys property contains the primary keys of the
37 /// excluded module's row in the ModuleExclusion table. If an existing module excludes
38 /// the module being merged, the excluded module's ModuleSignature information is added
39 /// to ModuleKeys. If the module being merged excludes an existing module, DatabaseKeys
40 /// contains the excluded module's ModuleSignature information. All other properties
41 /// are empty (or -1).
42 /// </summary>
43 msmErrorExclusion = 3,
44
45 /// <summary>
46 /// Merge conflict during merge. The value of the Type property is set to
47 /// msmErrorTableMerge. The DatabaseTable property and DatabaseKeys property contain
48 /// the table name and primary keys of the conflicting row in the database. The
49 /// ModuleTable property and ModuleKeys property contain the table name and primary keys
50 /// of the conflicting row in the module. The ModuleTable and ModuleKeys entries may be
51 /// null if the row does not exist in the database. For example, if the conflict is in a
52 /// generated FeatureComponents table entry. On Windows Installer version 2.0, when
53 /// merging a configurable merge module, configuration may cause these properties to
54 /// refer to rows that do not exist in the module.
55 /// </summary>
56 msmErrorTableMerge = 4,
57
58 /// <summary>
59 /// There was a problem resequencing a sequence table to contain the necessary merged
60 /// actions. The Type property is set to msmErrorResequenceMerge. The DatabaseTable
61 /// and DatabaseKeys properties contain the sequence table name and primary keys
62 /// (action name) of the conflicting row. The ModuleTable and ModuleKeys properties
63 /// contain the sequence table name and primary key (action name) of the conflicting row.
64 /// On Windows Installer version 2.0, when merging a configurable merge module,
65 /// configuration may cause these properties to refer to rows that do not exist in the module.
66 /// </summary>
67 msmErrorResequenceMerge = 5,
68
69 /// <summary>
70 /// Not used.
71 /// </summary>
72 msmErrorFileCreate = 6,
73
74 /// <summary>
75 /// There was a problem creating a directory to extract a file to disk. The Path property
76 /// contains the directory that could not be created. All other properties are empty or -1.
77 /// Not available with Windows Installer version 1.0.
78 /// </summary>
79 msmErrorDirCreate = 7,
80
81 /// <summary>
82 /// A feature name is required to complete the merge, but no feature name was provided.
83 /// The Type property is set to msmErrorFeatureRequired. The DatabaseTable and DatabaseKeys
84 /// contain the table name and primary keys of the conflicting row. The ModuleTable and
85 /// ModuleKeys properties contain the table name and primary keys of the row cannot be merged.
86 /// On Windows Installer version 2.0, when merging a configurable merge module, configuration
87 /// may cause these properties to refer to rows that do not exist in the module.
88 /// If the failure is in a generated FeatureComponents table, the DatabaseTable and
89 /// DatabaseKeys properties are empty and the ModuleTable and ModuleKeys properties refer to
90 /// the row in the Component table causing the failure.
91 /// </summary>
92 msmErrorFeatureRequired = 8,
93
94 /// <summary>
95 /// Available with Window Installer version 2.0. Substitution of a Null value into a
96 /// non-nullable column. This enters msmErrorBadNullSubstitution in the Type property and
97 /// enters "ModuleSubstitution" and the keys from the ModuleSubstitution table for this row
98 /// into the ModuleTable property and ModuleKeys property. All other properties of the Error
99 /// object are set to an empty string or -1. This error causes the immediate failure of the
100 /// merge and the MergeEx function to return E_FAIL.
101 /// </summary>
102 msmErrorBadNullSubstitution = 9,
103
104 /// <summary>
105 /// Available with Window Installer version 2.0. Substitution of Text Format Type or Integer
106 /// Format Type into a Binary Type data column. This type of error returns
107 /// msmErrorBadSubstitutionType in the Type property and enters "ModuleSubstitution" and the
108 /// keys from the ModuleSubstitution table for this row into the ModuleTable property.
109 /// All other properties of the Error object are set to an empty string or -1. This error
110 /// causes the immediate failure of the merge and the MergeEx function to return E_FAIL.
111 /// </summary>
112 msmErrorBadSubstitutionType = 10,
113
114 /// <summary>
115 /// Available with Window Installer Version 2.0. A row in the ModuleSubstitution table
116 /// references a configuration item not defined in the ModuleConfiguration table.
117 /// This type of error returns msmErrorMissingConfigItem in the Type property and enters
118 /// "ModuleSubstitution" and the keys from the ModuleSubstitution table for this row into
119 /// the ModuleTable property. All other properties of the Error object are set to an empty
120 /// string or -1. This error causes the immediate failure of the merge and the MergeEx
121 /// function to return E_FAIL.
122 /// </summary>
123 msmErrorMissingConfigItem = 11,
124
125 /// <summary>
126 /// Available with Window Installer version 2.0. The authoring tool has returned a Null
127 /// value for an item marked with the msmConfigItemNonNullable attribute. An error of this
128 /// type returns msmErrorBadNullResponse in the Type property and enters "ModuleSubstitution"
129 /// and the keys from the ModuleSubstitution table for for the item into the ModuleTable property.
130 /// All other properties of the Error object are set to an empty string or -1. This error
131 /// causes the immediate failure of the merge and the MergeEx function to return E_FAIL.
132 /// </summary>
133 msmErrorBadNullResponse = 12,
134
135 /// <summary>
136 /// Available with Window Installer version 2.0. The authoring tool returned a failure code
137 /// (not S_OK or S_FALSE) when asked for data. An error of this type will return
138 /// msmErrorDataRequestFailed in the Type property and enters "ModuleSubstitution"
139 /// and the keys from the ModuleSubstitution table for the item into the ModuleTable property.
140 /// All other properties of the Error object are set to an empty string or -1. This error
141 /// causes the immediate failure of the merge and the MergeEx function to return E_FAIL.
142 /// </summary>
143 msmErrorDataRequestFailed = 13,
144
145 /// <summary>
146 /// Available with Windows Installer 2.0 and later versions. Indicates that an attempt was
147 /// made to merge a 64-bit module into a package that was not a 64-bit package. An error of
148 /// this type returns msmErrorPlatformMismatch in the Type property. All other properties of
149 /// the error object are set to an empty string or -1. This error causes the immediate failure
150 /// of the merge and causes the Merge function or MergeEx function to return E_FAIL.
151 /// </summary>
152 msmErrorPlatformMismatch = 14,
153 }
154
155 /// <summary>
156 /// IMsmMerge2 interface.
157 /// </summary>
158 [ComImport, Guid("351A72AB-21CB-47ab-B7AA-C4D7B02EA305")]
159 public interface IMsmMerge2
160 {
161 /// <summary>
162 /// The OpenDatabase method of the Merge object opens a Windows Installer installation
163 /// database, located at a specified path, that is to be merged with a module.
164 /// </summary>
165 /// <param name="path">Path to the database being opened.</param>
166 void OpenDatabase(string path);
167
168 /// <summary>
169 /// The OpenModule method of the Merge object opens a Windows Installer merge module
170 /// in read-only mode. A module must be opened before it can be merged with an installation database.
171 /// </summary>
172 /// <param name="fileName">Fully qualified file name pointing to a merge module.</param>
173 /// <param name="language">A valid language identifier (LANGID).</param>
174 void OpenModule(string fileName, short language);
175
176 /// <summary>
177 /// The CloseDatabase method of the Merge object closes the currently open Windows Installer database.
178 /// </summary>
179 /// <param name="commit">true if changes should be saved, false otherwise.</param>
180 void CloseDatabase(bool commit);
181
182 /// <summary>
183 /// The CloseModule method of the Merge object closes the currently open Windows Installer merge module.
184 /// </summary>
185 void CloseModule();
186
187 /// <summary>
188 /// The OpenLog method of the Merge object opens a log file that receives progress and error messages.
189 /// If the log file already exists, the installer appends new messages. If the log file does not exist,
190 /// the installer creates a log file.
191 /// </summary>
192 /// <param name="fileName">Fully qualified filename pointing to a file to open or create.</param>
193 void OpenLog(string fileName);
194
195 /// <summary>
196 /// The CloseLog method of the Merge object closes the current log file.
197 /// </summary>
198 void CloseLog();
199
200 /// <summary>
201 /// The Log method of the Merge object writes a text string to the currently open log file.
202 /// </summary>
203 /// <param name="message">The text string to display.</param>
204 void Log(string message);
205
206 /// <summary>
207 /// Gets the errors from the last merge operation.
208 /// </summary>
209 /// <value>The errors from the last merge operation.</value>
210 IMsmErrors Errors
211 {
212 get;
213 }
214
215 /// <summary>
216 /// Gets a collection of Dependency objects that enumerates a set of unsatisfied dependencies for the current database.
217 /// </summary>
218 /// <value>A collection of Dependency objects that enumerates a set of unsatisfied dependencies for the current database.</value>
219 object Dependencies
220 {
221 get;
222 }
223
224 /// <summary>
225 /// The Merge method of the Merge object executes a merge of the current database and current
226 /// module. The merge attaches the components in the module to the feature identified by Feature.
227 /// The root of the module's directory tree is redirected to the location given by RedirectDir.
228 /// </summary>
229 /// <param name="feature">The name of a feature in the database.</param>
230 /// <param name="redirectDir">The key of an entry in the Directory table of the database.
231 /// This parameter may be NULL or an empty string.</param>
232 void Merge(string feature, string redirectDir);
233
234 /// <summary>
235 /// The Connect method of the Merge object connects a module to an additional feature.
236 /// The module must have already been merged into the database or will be merged into the database.
237 /// The feature must exist before calling this function.
238 /// </summary>
239 /// <param name="feature">The name of a feature already existing in the database.</param>
240 void Connect(string feature);
241
242 /// <summary>
243 /// The ExtractCAB method of the Merge object extracts the embedded .cab file from a module and
244 /// saves it as the specified file. The installer creates this file if it does not already exist
245 /// and overwritten if it does exist.
246 /// </summary>
247 /// <param name="fileName">The fully qualified destination file.</param>
248 void ExtractCAB(string fileName);
249
250 /// <summary>
251 /// The ExtractFiles method of the Merge object extracts the embedded .cab file from a module
252 /// and then writes those files to the destination directory.
253 /// </summary>
254 /// <param name="path">The fully qualified destination directory.</param>
255 void ExtractFiles(string path);
256
257 /// <summary>
258 /// The MergeEx method of the Merge object is equivalent to the Merge function, except that it
259 /// takes an extra argument. The Merge method executes a merge of the current database and
260 /// current module. The merge attaches the components in the module to the feature identified
261 /// by Feature. The root of the module's directory tree is redirected to the location given by RedirectDir.
262 /// </summary>
263 /// <param name="feature">The name of a feature in the database.</param>
264 /// <param name="redirectDir">The key of an entry in the Directory table of the database. This parameter may
265 /// be NULL or an empty string.</param>
266 /// <param name="configuration">The pConfiguration argument is an interface implemented by the client. The argument may
267 /// be NULL. The presence of this argument indicates that the client is capable of supporting the configuration
268 /// functionality, but does not obligate the client to provide configuration data for any specific configurable item.</param>
269 void MergeEx(string feature, string redirectDir, IMsmConfigureModule configuration);
270
271 /// <summary>
272 /// The ExtractFilesEx method of the Merge object extracts the embedded .cab file from a module and
273 /// then writes those files to the destination directory.
274 /// </summary>
275 /// <param name="path">The fully qualified destination directory.</param>
276 /// <param name="longFileNames">Set to specify using long file names for path segments and final file names.</param>
277 /// <param name="filePaths">This is a list of fully-qualified paths for the files that were successfully extracted.
278 /// The list is empty if no files can be extracted. This argument may be null. No list is provided if pFilePaths is null.</param>
279 void ExtractFilesEx(string path, bool longFileNames, ref IntPtr filePaths);
280
281 /// <summary>
282 /// Gets a collection ConfigurableItem objects, each of which represents a single row from the ModuleConfiguration table.
283 /// </summary>
284 /// <value>A collection ConfigurableItem objects, each of which represents a single row from the ModuleConfiguration table.</value>
285 /// <remarks>Semantically, each interface in the enumerator represents an item that can be configured by the module consumer.
286 /// The collection is a read-only collection and implements the standard read-only collection interfaces of Item(), Count() and _NewEnum().
287 /// The IEnumMsmConfigItems enumerator implements Next(), Skip(), Reset(), and Clone() with the standard semantics.</remarks>
288 object ConfigurableItems
289 {
290 get;
291 }
292
293 /// <summary>
294 /// The CreateSourceImage method of the Merge object allows the client to extract the files from a module to
295 /// a source image on disk after a merge, taking into account changes to the module that might have been made
296 /// during module configuration. The list of files to be extracted is taken from the file table of the module
297 /// during the merge process. The list of files consists of every file successfully copied from the file table
298 /// of the module to the target database. File table entries that were not copied due to primary key conflicts
299 /// with existing rows in the database are not a part of this list. At image creation time, the directory for
300 /// each of these files comes from the open (post-merge) database. The path specified in the Path parameter is
301 /// the root of the source image for the install. fLongFileNames determines whether or not long file names are
302 /// used for both path segments and final file names. The function fails if no database is open, no module is
303 /// open, or no merge has been performed.
304 /// </summary>
305 /// <param name="path">The path of the root of the source image for the install.</param>
306 /// <param name="longFileNames">Determines whether or not long file names are used for both path segments and final file names. </param>
307 /// <param name="filePaths">This is a list of fully-qualified paths for the files that were successfully extracted.
308 /// The list is empty if no files can be extracted. This argument may be null. No list is provided if pFilePaths is null.</param>
309 void CreateSourceImage(string path, bool longFileNames, ref IntPtr filePaths);
310
311 /// <summary>
312 /// The get_ModuleFiles function implements the ModuleFiles property of the GetFiles object. This function
313 /// returns the primary keys in the File table of the currently open module. The primary keys are returned
314 /// as a collection of strings. The module must be opened by a call to the OpenModule function before calling get_ModuleFiles.
315 /// </summary>
316 IMsmStrings ModuleFiles
317 {
318 get;
319 }
320 }
321
322 /// <summary>
323 /// Collection of merge errors.
324 /// </summary>
325 [ComImport, Guid("0ADDA82A-2C26-11D2-AD65-00A0C9AF11A6")]
326 public interface IMsmErrors
327 {
328 /// <summary>
329 /// Gets the IMsmError at the specified index.
330 /// </summary>
331 /// <param name="index">The one-based index of the IMsmError to get.</param>
332 IMsmError this[int index]
333 {
334 get;
335 }
336
337 /// <summary>
338 /// Gets the count of IMsmErrors in this collection.
339 /// </summary>
340 /// <value>The count of IMsmErrors in this collection.</value>
341 int Count
342 {
343 get;
344 }
345 }
346
347 /// <summary>
348 /// A merge error.
349 /// </summary>
350 [ComImport, Guid("0ADDA828-2C26-11D2-AD65-00A0C9AF11A6")]
351 public interface IMsmError
352 {
353 /// <summary>
354 /// Gets the type of merge error.
355 /// </summary>
356 /// <value>The type of merge error.</value>
357 MsmErrorType Type
358 {
359 get;
360 }
361
362 /// <summary>
363 /// Gets the path information from the merge error.
364 /// </summary>
365 /// <value>The path information from the merge error.</value>
366 string Path
367 {
368 get;
369 }
370
371 /// <summary>
372 /// Gets the language information from the merge error.
373 /// </summary>
374 /// <value>The language information from the merge error.</value>
375 short Language
376 {
377 get;
378 }
379
380 /// <summary>
381 /// Gets the database table from the merge error.
382 /// </summary>
383 /// <value>The database table from the merge error.</value>
384 string DatabaseTable
385 {
386 get;
387 }
388
389 /// <summary>
390 /// Gets the collection of database keys from the merge error.
391 /// </summary>
392 /// <value>The collection of database keys from the merge error.</value>
393 IMsmStrings DatabaseKeys
394 {
395 get;
396 }
397
398 /// <summary>
399 /// Gets the module table from the merge error.
400 /// </summary>
401 /// <value>The module table from the merge error.</value>
402 string ModuleTable
403 {
404 get;
405 }
406
407 /// <summary>
408 /// Gets the collection of module keys from the merge error.
409 /// </summary>
410 /// <value>The collection of module keys from the merge error.</value>
411 IMsmStrings ModuleKeys
412 {
413 get;
414 }
415 }
416
417 /// <summary>
418 /// A collection of strings.
419 /// </summary>
420 [ComImport, Guid("0ADDA827-2C26-11D2-AD65-00A0C9AF11A6")]
421 public interface IMsmStrings
422 {
423 /// <summary>
424 /// Gets the string at the specified index.
425 /// </summary>
426 /// <param name="index">The one-based index of the string to get.</param>
427 string this[int index]
428 {
429 get;
430 }
431
432 /// <summary>
433 /// Gets the count of strings in this collection.
434 /// </summary>
435 /// <value>The count of strings in this collection.</value>
436 int Count
437 {
438 get;
439 }
440 }
441
442 /// <summary>
443 /// Callback for configurable merge modules.
444 /// </summary>
445 [ComImport, Guid("AC013209-18A7-4851-8A21-2353443D70A0"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
446 public interface IMsmConfigureModule
447 {
448 /// <summary>
449 /// Callback to retrieve text data for configurable merge modules.
450 /// </summary>
451 /// <param name="name">Name of the data to be retrieved.</param>
452 /// <param name="configData">The data corresponding to the name.</param>
453 /// <returns>The error code (HRESULT).</returns>
454 [PreserveSig]
455 int ProvideTextData([In, MarshalAs(UnmanagedType.BStr)] string name, [MarshalAs(UnmanagedType.BStr)] out string configData);
456
457 /// <summary>
458 /// Callback to retrieve integer data for configurable merge modules.
459 /// </summary>
460 /// <param name="name">Name of the data to be retrieved.</param>
461 /// <param name="configData">The data corresponding to the name.</param>
462 /// <returns>The error code (HRESULT).</returns>
463 [PreserveSig]
464 int ProvideIntegerData([In, MarshalAs(UnmanagedType.BStr)] string name, out int configData);
465 }
466
467 /// <summary>
468 /// Merge merge modules into an MSI file.
469 /// </summary>
470 [ComImport, Guid("F94985D5-29F9-4743-9805-99BC3F35B678")]
471 public class MsmMerge2
472 {
473 }
474
475 /// <summary>
476 /// Defines the standard COM IClassFactory interface.
477 /// </summary>
478 [ComImport, Guid("00000001-0000-0000-C000-000000000046")]
479 [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
480 public interface IClassFactory
481 {
482 [return:MarshalAs(UnmanagedType.IUnknown)]
483 object CreateInstance(IntPtr unkOuter, [MarshalAs(UnmanagedType.LPStruct)] Guid iid);
484 }
485
486 /// <summary>
487 /// Contains native methods for merge operations.
488 /// </summary>
489 public class MsmInterop
490 {
491 [DllImport("mergemod.dll", EntryPoint="DllGetClassObject", PreserveSig=false)]
492 [return: MarshalAs(UnmanagedType.IUnknown)]
493 private static extern object MergeModGetClassObject([MarshalAs(UnmanagedType.LPStruct)] Guid clsid, [MarshalAs(UnmanagedType.LPStruct)] Guid iid);
494
495 /// <summary>
496 /// Load the merge object directly from a local mergemod.dll without going through COM registration.
497 /// </summary>
498 /// <returns>Merge interface.</returns>
499 public static IMsmMerge2 GetMsmMerge()
500 {
501 IClassFactory classFactory = (IClassFactory) MergeModGetClassObject(typeof(MsmMerge2).GUID, typeof(IClassFactory).GUID);
502 return (IMsmMerge2) classFactory.CreateInstance(IntPtr.Zero, typeof(IMsmMerge2).GUID);
503 }
504 }
505}
diff --git a/src/WixToolset.Core.WindowsInstaller/Msi/Record.cs b/src/WixToolset.Core.WindowsInstaller/Msi/Record.cs
index 438aa3b0..7342659b 100644
--- a/src/WixToolset.Core.WindowsInstaller/Msi/Record.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Msi/Record.cs
@@ -1,11 +1,10 @@
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.Msi 3namespace WixToolset.Core.WindowsInstaller.Msi
4{ 4{
5 using System; 5 using System;
6 using System.ComponentModel; 6 using System.ComponentModel;
7 using System.Text; 7 using System.Text;
8 using WixToolset.Core.Native;
9 8
10 /// <summary> 9 /// <summary>
11 /// Wrapper class around msi.dll interop for a record. 10 /// Wrapper class around msi.dll interop for a record.
diff --git a/src/WixToolset.Core.WindowsInstaller/Msi/Session.cs b/src/WixToolset.Core.WindowsInstaller/Msi/Session.cs
index d3a19711..bb07a501 100644
--- a/src/WixToolset.Core.WindowsInstaller/Msi/Session.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Msi/Session.cs
@@ -1,11 +1,9 @@
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.Msi 3namespace WixToolset.Core.WindowsInstaller.Msi
4{ 4{
5 using System; 5 using System;
6 using System.ComponentModel;
7 using System.Globalization; 6 using System.Globalization;
8 using WixToolset.Core.Native;
9 7
10 /// <summary> 8 /// <summary>
11 /// Controls the installation process. 9 /// Controls the installation process.
diff --git a/src/WixToolset.Core.WindowsInstaller/Msi/SummaryInformation.cs b/src/WixToolset.Core.WindowsInstaller/Msi/SummaryInformation.cs
index 26831731..5450671f 100644
--- a/src/WixToolset.Core.WindowsInstaller/Msi/SummaryInformation.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Msi/SummaryInformation.cs
@@ -1,12 +1,11 @@
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.Msi 3namespace WixToolset.Core.WindowsInstaller.Msi
4{ 4{
5 using System; 5 using System;
6 using System.Globalization; 6 using System.Globalization;
7 using System.Text; 7 using System.Text;
8 using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME; 8 using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME;
9 using WixToolset.Core.Native;
10 9
11 /// <summary> 10 /// <summary>
12 /// Summary information for the MSI files. 11 /// Summary information for the MSI files.
diff --git a/src/WixToolset.Core.WindowsInstaller/Msi/View.cs b/src/WixToolset.Core.WindowsInstaller/Msi/View.cs
index d6542824..1beb72da 100644
--- a/src/WixToolset.Core.WindowsInstaller/Msi/View.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Msi/View.cs
@@ -1,11 +1,9 @@
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.Msi 3namespace WixToolset.Core.WindowsInstaller.Msi
4{ 4{
5 using System; 5 using System;
6 using System.ComponentModel;
7 using System.Globalization; 6 using System.Globalization;
8 using WixToolset.Core.Native;
9 7
10 /// <summary> 8 /// <summary>
11 /// Enumeration of different modify modes. 9 /// Enumeration of different modify modes.
@@ -17,27 +15,27 @@ namespace WixToolset.Msi
17 /// keys match an existing row and inserts if they do not match. Fails with a read-only 15 /// keys match an existing row and inserts if they do not match. Fails with a read-only
18 /// database. This mode cannot be used with a view containing joins. 16 /// database. This mode cannot be used with a view containing joins.
19 /// </summary> 17 /// </summary>
20 Assign = MsiInterop.MSIMODIFYASSIGN, 18 Assign = 3, // Writes current data in the cursor to a table row. Updates record if the primary keys match an existing row and inserts if they do not match. Fails with a read-only database. This mode cannot be used with a view containing joins.
21 19
22 /// <summary> 20 /// <summary>
23 /// Remove a row from the table. You must first call the Fetch function with the same 21 /// Remove a row from the table. You must first call the Fetch function with the same
24 /// record. Fails if the row has been deleted. Works only with read-write records. This 22 /// record. Fails if the row has been deleted. Works only with read-write records. This
25 /// mode cannot be used with a view containing joins. 23 /// mode cannot be used with a view containing joins.
26 /// </summary> 24 /// </summary>
27 Delete = MsiInterop.MSIMODIFYDELETE, 25 Delete = 6, // Remove a row from the table. You must first call the MsiViewFetch function with the same record. Fails if the row has been deleted. Works only with read-write records. This mode cannot be used with a view containing joins.
28 26
29 /// <summary> 27 /// <summary>
30 /// Inserts a record. Fails if a row with the same primary keys exists. Fails with a read-only 28 /// Inserts a record. Fails if a row with the same primary keys exists. Fails with a read-only
31 /// database. This mode cannot be used with a view containing joins. 29 /// database. This mode cannot be used with a view containing joins.
32 /// </summary> 30 /// </summary>
33 Insert = MsiInterop.MSIMODIFYINSERT, 31 Insert = 1, // Inserts a record. Fails if a row with the same primary keys exists. Fails with a read-only database. This mode cannot be used with a view containing joins.
34 32
35 /// <summary> 33 /// <summary>
36 /// Inserts a temporary record. The information is not persistent. Fails if a row with the 34 /// Inserts a temporary record. The information is not persistent. Fails if a row with the
37 /// same primary key exists. Works only with read-write records. This mode cannot be 35 /// same primary key exists. Works only with read-write records. This mode cannot be
38 /// used with a view containing joins. 36 /// used with a view containing joins.
39 /// </summary> 37 /// </summary>
40 InsertTemporary = MsiInterop.MSIMODIFYINSERTTEMPORARY, 38 InsertTemporary = 7, // Inserts a temporary record. The information is not persistent. Fails if a row with the same primary key exists. Works only with read-write records. This mode cannot be used with a view containing joins.
41 39
42 /// <summary> 40 /// <summary>
43 /// Inserts or validates a record in a table. Inserts if primary keys do not match any row 41 /// Inserts or validates a record in a table. Inserts if primary keys do not match any row
@@ -45,13 +43,13 @@ namespace WixToolset.Msi
45 /// the table. Fails if there is a record with a duplicate key that is not identical. 43 /// the table. Fails if there is a record with a duplicate key that is not identical.
46 /// Works only with read-write records. This mode cannot be used with a view containing joins. 44 /// Works only with read-write records. This mode cannot be used with a view containing joins.
47 /// </summary> 45 /// </summary>
48 Merge = MsiInterop.MSIMODIFYMERGE, 46 Merge = 5, // Inserts or validates a record in a table. Inserts if primary keys do not match any row and validates if there is a match. Fails if the record does not match the data in the table. Fails if there is a record with a duplicate key that is not identical. Works only with read-write records. This mode cannot be used with a view containing joins.
49 47
50 /// <summary> 48 /// <summary>
51 /// Refreshes the information in the record. Must first call Fetch with the 49 /// Refreshes the information in the record. Must first call Fetch with the
52 /// same record. Fails for a deleted row. Works with read-write and read-only records. 50 /// same record. Fails for a deleted row. Works with read-write and read-only records.
53 /// </summary> 51 /// </summary>
54 Refresh = MsiInterop.MSIMODIFYREFRESH, 52 Refresh = 0, // Refreshes the information in the record. Must first call MsiViewFetch with the same record. Fails for a deleted row. Works with read-write and read-only records.
55 53
56 /// <summary> 54 /// <summary>
57 /// Updates or deletes and inserts a record into a table. Must first call Fetch with 55 /// Updates or deletes and inserts a record into a table. Must first call Fetch with
@@ -59,7 +57,7 @@ namespace WixToolset.Msi
59 /// inserts new if primary keys have changed. Fails with a read-only database. This mode cannot 57 /// inserts new if primary keys have changed. Fails with a read-only database. This mode cannot
60 /// be used with a view containing joins. 58 /// be used with a view containing joins.
61 /// </summary> 59 /// </summary>
62 Replace = MsiInterop.MSIMODIFYREPLACE, 60 Replace = 4, // Updates or deletes and inserts a record into a table. Must first call MsiViewFetch with the same record. Updates record if the primary keys are unchanged. Deletes old row and inserts new if primary keys have changed. Fails with a read-only database. This mode cannot be used with a view containing joins.
63 61
64 /// <summary> 62 /// <summary>
65 /// Refreshes the information in the supplied record without changing the position in the 63 /// Refreshes the information in the supplied record without changing the position in the
@@ -69,13 +67,13 @@ namespace WixToolset.Msi
69 /// query. Seek cannot be used with multi-table queries. This mode cannot be used with 67 /// query. Seek cannot be used with multi-table queries. This mode cannot be used with
70 /// a view containing joins. See also the remarks. 68 /// a view containing joins. See also the remarks.
71 /// </summary> 69 /// </summary>
72 Seek = MsiInterop.MSIMODIFYSEEK, 70 Seek = -1, // Refreshes the information in the supplied record without changing the position in the result set and without affecting subsequent fetch operations. The record may then be used for subsequent Update, Delete, and Refresh. All primary key columns of the table must be in the query and the record must have at least as many fields as the query. Seek cannot be used with multi-table queries. This mode cannot be used with a view containing joins. See also the remarks.
73 71
74 /// <summary> 72 /// <summary>
75 /// Updates an existing record. Non-primary keys only. Must first call Fetch. Fails with a 73 /// Updates an existing record. Non-primary keys only. Must first call Fetch. Fails with a
76 /// deleted record. Works only with read-write records. 74 /// deleted record. Works only with read-write records.
77 /// </summary> 75 /// </summary>
78 Update = MsiInterop.MSIMODIFYUPDATE 76 Update = 2, // Updates an existing record. Nonprimary keys only. Must first call MsiViewFetch. Fails with a deleted record. Works only with read-write records.
79 } 77 }
80 78
81 /// <summary> 79 /// <summary>
diff --git a/src/WixToolset.Core.WindowsInstaller/Msi/WixInvalidIdtException.cs b/src/WixToolset.Core.WindowsInstaller/Msi/WixInvalidIdtException.cs
index 589da648..a4750723 100644
--- a/src/WixToolset.Core.WindowsInstaller/Msi/WixInvalidIdtException.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Msi/WixInvalidIdtException.cs
@@ -1,6 +1,6 @@
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.Msi 3namespace WixToolset.Core.WindowsInstaller.Msi
4{ 4{
5 using System; 5 using System;
6 using WixToolset.Data; 6 using WixToolset.Data;
diff --git a/src/WixToolset.Core.WindowsInstaller/MspBackend.cs b/src/WixToolset.Core.WindowsInstaller/MspBackend.cs
index 90e67336..b6e72e11 100644
--- a/src/WixToolset.Core.WindowsInstaller/MspBackend.cs
+++ b/src/WixToolset.Core.WindowsInstaller/MspBackend.cs
@@ -11,7 +11,6 @@ namespace WixToolset.Core.WindowsInstaller
11 using WixToolset.Data.Bind; 11 using WixToolset.Data.Bind;
12 using WixToolset.Extensibility; 12 using WixToolset.Extensibility;
13 using WixToolset.Extensibility.Data; 13 using WixToolset.Extensibility.Data;
14 using WixToolset.Msi;
15 using WixToolset.Ole32; 14 using WixToolset.Ole32;
16 15
17 internal class MspBackend : IBackend 16 internal class MspBackend : IBackend
diff --git a/src/WixToolset.Core.WindowsInstaller/Unbind/ExtractCabinetsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Unbind/ExtractCabinetsCommand.cs
index 21ea1541..57547d4f 100644
--- a/src/WixToolset.Core.WindowsInstaller/Unbind/ExtractCabinetsCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Unbind/ExtractCabinetsCommand.cs
@@ -8,10 +8,10 @@ namespace WixToolset.Core.WindowsInstaller.Unbind
8 using System.Globalization; 8 using System.Globalization;
9 using System.IO; 9 using System.IO;
10 using WixToolset.Core.Native; 10 using WixToolset.Core.Native;
11 using WixToolset.Core.WindowsInstaller.Msi;
11 using WixToolset.Data; 12 using WixToolset.Data;
12 using WixToolset.Data.WindowsInstaller; 13 using WixToolset.Data.WindowsInstaller;
13 using WixToolset.Data.WindowsInstaller.Rows; 14 using WixToolset.Data.WindowsInstaller.Rows;
14 using WixToolset.Msi;
15 15
16 internal class ExtractCabinetsCommand 16 internal class ExtractCabinetsCommand
17 { 17 {
diff --git a/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs
index 86ecea38..4c24ff7e 100644
--- a/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs
@@ -7,14 +7,12 @@ namespace WixToolset.Core.WindowsInstaller.Unbind
7 using System.Collections.Generic; 7 using System.Collections.Generic;
8 using System.Globalization; 8 using System.Globalization;
9 using System.IO; 9 using System.IO;
10 using System.Linq;
11 using System.Text.RegularExpressions; 10 using System.Text.RegularExpressions;
12 using WixToolset.Core.Native; 11 using WixToolset.Core.WindowsInstaller.Msi;
13 using WixToolset.Data; 12 using WixToolset.Data;
14 using WixToolset.Data.WindowsInstaller; 13 using WixToolset.Data.WindowsInstaller;
15 using WixToolset.Data.WindowsInstaller.Rows; 14 using WixToolset.Data.WindowsInstaller.Rows;
16 using WixToolset.Extensibility.Services; 15 using WixToolset.Extensibility.Services;
17 using WixToolset.Msi;
18 16
19 internal class UnbindDatabaseCommand 17 internal class UnbindDatabaseCommand
20 { 18 {
diff --git a/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs b/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs
index 2cea9cfb..eca51caf 100644
--- a/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs
@@ -1,13 +1,12 @@
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.Unbind 3namespace WixToolset.Core.WindowsInstaller.Unbind
4{ 4{
5 using System; 5 using System;
6 using System.ComponentModel; 6 using System.ComponentModel;
7 using WixToolset.Core.Native;
8 using WixToolset.Data; 7 using WixToolset.Data;
9 using WixToolset.Extensibility.Data; 8 using WixToolset.Extensibility.Data;
10 using WixToolset.Msi; 9 using WixToolset.Core.WindowsInstaller.Msi;
11 10
12 internal class UnbindMsiOrMsmCommand 11 internal class UnbindMsiOrMsmCommand
13 { 12 {
diff --git a/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindTranformCommand.cs b/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindTranformCommand.cs
index 3c32719e..bf282e99 100644
--- a/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindTranformCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindTranformCommand.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.Unbind 3namespace WixToolset.Core.WindowsInstaller.Unbind
4{ 4{
@@ -8,13 +8,12 @@ namespace WixToolset.Core.WindowsInstaller.Unbind
8 using System.Globalization; 8 using System.Globalization;
9 using System.IO; 9 using System.IO;
10 using System.Linq; 10 using System.Linq;
11 using WixToolset.Core.Native;
12 using WixToolset.Core.WindowsInstaller.Bind; 11 using WixToolset.Core.WindowsInstaller.Bind;
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.Extensibility; 15 using WixToolset.Extensibility;
16 using WixToolset.Extensibility.Services; 16 using WixToolset.Extensibility.Services;
17 using WixToolset.Msi;
18 17
19 internal class UnbindTransformCommand 18 internal class UnbindTransformCommand
20 { 19 {
diff --git a/src/WixToolset.Core.WindowsInstaller/Validator.cs b/src/WixToolset.Core.WindowsInstaller/Validator.cs
index cbe489be..e19feb22 100644
--- a/src/WixToolset.Core.WindowsInstaller/Validator.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Validator.cs
@@ -12,13 +12,12 @@ namespace WixToolset.Core.WindowsInstaller
12 using System.Linq; 12 using System.Linq;
13 using System.Reflection; 13 using System.Reflection;
14 using System.Threading; 14 using System.Threading;
15 using WixToolset.Core.Native; 15 using WixToolset.Core.WindowsInstaller.Msi;
16 using WixToolset.Data; 16 using WixToolset.Data;
17 using WixToolset.Data.WindowsInstaller; 17 using WixToolset.Data.WindowsInstaller;
18 using WixToolset.Extensibility; 18 using WixToolset.Extensibility;
19 using WixToolset.Extensibility.Data; 19 using WixToolset.Extensibility.Data;
20 using WixToolset.Extensibility.Services; 20 using WixToolset.Extensibility.Services;
21 using WixToolset.Msi;
22 21
23 /// <summary> 22 /// <summary>
24 /// Runs internal consistency evaluators (ICEs) from cub files against a database. 23 /// Runs internal consistency evaluators (ICEs) from cub files against a database.
diff --git a/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj b/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj
index c251b8dd..b940e39b 100644
--- a/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj
+++ b/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj
@@ -20,15 +20,16 @@
20 </ItemGroup> 20 </ItemGroup>
21 21
22 <ItemGroup> 22 <ItemGroup>
23 <PackageReference Include="WixToolset.Core.Native" Version="4.0.*" />
23 <PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.*" NoWarn="NU1701" /> 24 <PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.*" NoWarn="NU1701" />
24 </ItemGroup> 25 </ItemGroup>
25 26
26 <ItemGroup> 27 <ItemGroup>
27 <PackageReference Include="System.Reflection.Metadata" Version="1.6.0" /> 28 <PackageReference Include="System.Reflection.Metadata" Version="1.6.0" />
28 </ItemGroup> 29 </ItemGroup>
29 30
30 <ItemGroup> 31 <ItemGroup>
31 <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63102-01" PrivateAssets="All" /> 32 <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
32 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" /> 33 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" />
33 </ItemGroup> 34 </ItemGroup>
34</Project> 35</Project>