diff options
author | Rob Mensching <rob@firegiant.com> | 2019-05-08 14:04:05 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2019-05-08 14:08:34 -0700 |
commit | 26b1860dcd8a84b410ab5cd3df7e37104e6ee1b1 (patch) | |
tree | b8723a77f5f4dea52f74ce66ac40d14e5b0fe68d | |
parent | cffb36e86c2993b43ac5bdbded4af063c2963a4f (diff) | |
download | wix-26b1860dcd8a84b410ab5cd3df7e37104e6ee1b1.tar.gz wix-26b1860dcd8a84b410ab5cd3df7e37104e6ee1b1.tar.bz2 wix-26b1860dcd8a84b410ab5cd3df7e37104e6ee1b1.zip |
Remove MSI interop from Core.Native
-rw-r--r-- | src/WixToolset.Core.Native/CabInterop.cs | 5 | ||||
-rw-r--r-- | src/WixToolset.Core.Native/MSIFILEHASHINFO.cs | 19 | ||||
-rw-r--r-- | src/WixToolset.Core.Native/MsiInterop.cs | 851 | ||||
-rw-r--r-- | src/WixToolset.Core.Native/MsmInterop.cs | 507 | ||||
-rw-r--r-- | src/WixToolset.Core.Native/WixToolset.Core.Native.csproj | 2 | ||||
-rw-r--r-- | src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj | 4 |
6 files changed, 23 insertions, 1365 deletions
diff --git a/src/WixToolset.Core.Native/CabInterop.cs b/src/WixToolset.Core.Native/CabInterop.cs index db31a30d..4c1eb93d 100644 --- a/src/WixToolset.Core.Native/CabInterop.cs +++ b/src/WixToolset.Core.Native/CabInterop.cs | |||
@@ -4,10 +4,7 @@ namespace WixToolset.Core.Native | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Diagnostics.CodeAnalysis; | 6 | using System.Diagnostics.CodeAnalysis; |
7 | using System.Text; | ||
8 | using System.Runtime.InteropServices; | 7 | using System.Runtime.InteropServices; |
9 | // using WixToolset.Msi; | ||
10 | // using WixToolset.Msi.Interop; | ||
11 | 8 | ||
12 | /// <summary> | 9 | /// <summary> |
13 | /// The native methods. | 10 | /// The native methods. |
@@ -34,7 +31,7 @@ namespace WixToolset.Core.Native | |||
34 | /// <param name="token">Name of file in cabinet.</param> | 31 | /// <param name="token">Name of file in cabinet.</param> |
35 | /// <param name="contextHandle">Handle to open cabinet.</param> | 32 | /// <param name="contextHandle">Handle to open cabinet.</param> |
36 | [DllImport("winterop.dll", EntryPoint = "CreateCabAddFile", CharSet = CharSet.Unicode, ExactSpelling = true, PreserveSig = false)] | 33 | [DllImport("winterop.dll", EntryPoint = "CreateCabAddFile", CharSet = CharSet.Unicode, ExactSpelling = true, PreserveSig = false)] |
37 | public static extern void CreateCabAddFile(string file, string token, MsiInterop.MSIFILEHASHINFO fileHash, IntPtr contextHandle); | 34 | public static extern void CreateCabAddFile(string file, string token, MSIFILEHASHINFO fileHash, IntPtr contextHandle); |
38 | 35 | ||
39 | /// <summary> | 36 | /// <summary> |
40 | /// Closes a cabinet. | 37 | /// Closes a cabinet. |
diff --git a/src/WixToolset.Core.Native/MSIFILEHASHINFO.cs b/src/WixToolset.Core.Native/MSIFILEHASHINFO.cs new file mode 100644 index 00000000..c11b44ea --- /dev/null +++ b/src/WixToolset.Core.Native/MSIFILEHASHINFO.cs | |||
@@ -0,0 +1,19 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Core.Native | ||
4 | { | ||
5 | using System.Runtime.InteropServices; | ||
6 | |||
7 | /// <summary> | ||
8 | /// contains the file hash information returned by MsiGetFileHash and used in the MsiFileHash table. | ||
9 | /// </summary> | ||
10 | [StructLayout(LayoutKind.Explicit)] | ||
11 | public class MSIFILEHASHINFO | ||
12 | { | ||
13 | [FieldOffset(0)] public uint FileHashInfoSize; | ||
14 | [FieldOffset(4)] public int Data0; | ||
15 | [FieldOffset(8)] public int Data1; | ||
16 | [FieldOffset(12)] public int Data2; | ||
17 | [FieldOffset(16)] public int Data3; | ||
18 | } | ||
19 | } | ||
diff --git a/src/WixToolset.Core.Native/MsiInterop.cs b/src/WixToolset.Core.Native/MsiInterop.cs deleted file mode 100644 index 8e5200c7..00000000 --- a/src/WixToolset.Core.Native/MsiInterop.cs +++ /dev/null | |||
@@ -1,851 +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 | |||
3 | namespace WixToolset.Core.Native | ||
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 | public delegate int InstallUIHandler(IntPtr context, uint messageType, [MarshalAs(UnmanagedType.LPWStr)] string message); | ||
20 | |||
21 | /// <summary> | ||
22 | /// Enum of predefined persist modes used when opening a database. | ||
23 | /// </summary> | ||
24 | public enum OpenDatabase | ||
25 | { | ||
26 | /// <summary> | ||
27 | /// Open a database read-only, no persistent changes. | ||
28 | /// </summary> | ||
29 | ReadOnly = MsiInterop.MSIDBOPENREADONLY, | ||
30 | |||
31 | /// <summary> | ||
32 | /// Open a database read/write in transaction mode. | ||
33 | /// </summary> | ||
34 | Transact = MsiInterop.MSIDBOPENTRANSACT, | ||
35 | |||
36 | /// <summary> | ||
37 | /// Open a database direct read/write without transaction. | ||
38 | /// </summary> | ||
39 | Direct = MsiInterop.MSIDBOPENDIRECT, | ||
40 | |||
41 | /// <summary> | ||
42 | /// Create a new database, transact mode read/write. | ||
43 | /// </summary> | ||
44 | Create = MsiInterop.MSIDBOPENCREATE, | ||
45 | |||
46 | /// <summary> | ||
47 | /// Create a new database, direct mode read/write. | ||
48 | /// </summary> | ||
49 | CreateDirect = MsiInterop.MSIDBOPENCREATEDIRECT, | ||
50 | |||
51 | /// <summary> | ||
52 | /// Indicates a patch file is being opened. | ||
53 | /// </summary> | ||
54 | OpenPatchFile = MsiInterop.MSIDBOPENPATCHFILE | ||
55 | } | ||
56 | |||
57 | /// <summary> | ||
58 | /// The errors to suppress when applying a transform. | ||
59 | /// </summary> | ||
60 | [Flags] | ||
61 | public enum TransformErrorConditions | ||
62 | { | ||
63 | /// <summary> | ||
64 | /// None of the following conditions. | ||
65 | /// </summary> | ||
66 | None = 0x0, | ||
67 | |||
68 | /// <summary> | ||
69 | /// Suppress error when adding a row that exists. | ||
70 | /// </summary> | ||
71 | AddExistingRow = 0x1, | ||
72 | |||
73 | /// <summary> | ||
74 | /// Suppress error when deleting a row that does not exist. | ||
75 | /// </summary> | ||
76 | DeleteMissingRow = 0x2, | ||
77 | |||
78 | /// <summary> | ||
79 | /// Suppress error when adding a table that exists. | ||
80 | /// </summary> | ||
81 | AddExistingTable = 0x4, | ||
82 | |||
83 | /// <summary> | ||
84 | /// Suppress error when deleting a table that does not exist. | ||
85 | /// </summary> | ||
86 | DeleteMissingTable = 0x8, | ||
87 | |||
88 | /// <summary> | ||
89 | /// Suppress error when updating a row that does not exist. | ||
90 | /// </summary> | ||
91 | UpdateMissingRow = 0x10, | ||
92 | |||
93 | /// <summary> | ||
94 | /// Suppress error when transform and database code pages do not match, and their code pages are neutral. | ||
95 | /// </summary> | ||
96 | ChangeCodepage = 0x20, | ||
97 | |||
98 | /// <summary> | ||
99 | /// Create the temporary _TransformView table when applying a transform. | ||
100 | /// </summary> | ||
101 | ViewTransform = 0x100, | ||
102 | |||
103 | /// <summary> | ||
104 | /// Suppress all errors but the option to create the temporary _TransformView table. | ||
105 | /// </summary> | ||
106 | All = 0x3F | ||
107 | } | ||
108 | |||
109 | /// <summary> | ||
110 | /// The validation to run while applying a transform. | ||
111 | /// </summary> | ||
112 | [Flags] | ||
113 | public enum TransformValidations | ||
114 | { | ||
115 | /// <summary> | ||
116 | /// Do not validate properties. | ||
117 | /// </summary> | ||
118 | None = 0x0, | ||
119 | |||
120 | /// <summary> | ||
121 | /// Default language must match base database. | ||
122 | /// </summary> | ||
123 | Language = 0x1, | ||
124 | |||
125 | /// <summary> | ||
126 | /// Product must match base database. | ||
127 | /// </summary> | ||
128 | Product = 0x2, | ||
129 | |||
130 | /// <summary> | ||
131 | /// Check major version only. | ||
132 | /// </summary> | ||
133 | MajorVersion = 0x8, | ||
134 | |||
135 | /// <summary> | ||
136 | /// Check major and minor versions only. | ||
137 | /// </summary> | ||
138 | MinorVersion = 0x10, | ||
139 | |||
140 | /// <summary> | ||
141 | /// Check major, minor, and update versions. | ||
142 | /// </summary> | ||
143 | UpdateVersion = 0x20, | ||
144 | |||
145 | /// <summary> | ||
146 | /// Installed version < base version. | ||
147 | /// </summary> | ||
148 | NewLessBaseVersion = 0x40, | ||
149 | |||
150 | /// <summary> | ||
151 | /// Installed version <= base version. | ||
152 | /// </summary> | ||
153 | NewLessEqualBaseVersion = 0x80, | ||
154 | |||
155 | /// <summary> | ||
156 | /// Installed version = base version. | ||
157 | /// </summary> | ||
158 | NewEqualBaseVersion = 0x100, | ||
159 | |||
160 | /// <summary> | ||
161 | /// Installed version >= base version. | ||
162 | /// </summary> | ||
163 | NewGreaterEqualBaseVersion = 0x200, | ||
164 | |||
165 | /// <summary> | ||
166 | /// Installed version > base version. | ||
167 | /// </summary> | ||
168 | NewGreaterBaseVersion = 0x400, | ||
169 | |||
170 | /// <summary> | ||
171 | /// UpgradeCode must match base database. | ||
172 | /// </summary> | ||
173 | UpgradeCode = 0x800 | ||
174 | } | ||
175 | |||
176 | /// <summary> | ||
177 | /// Class exposing static functions and structs from MSI API. | ||
178 | /// </summary> | ||
179 | public sealed class MsiInterop | ||
180 | { | ||
181 | // Patching constants | ||
182 | public const int MsiMaxStreamNameLength = 62; // http://msdn2.microsoft.com/library/aa370551.aspx | ||
183 | |||
184 | // Component.Attributes | ||
185 | public const int MsidbComponentAttributesLocalOnly = 0; | ||
186 | public const int MsidbComponentAttributesSourceOnly = 1; | ||
187 | public const int MsidbComponentAttributesOptional = 2; | ||
188 | public const int MsidbComponentAttributesRegistryKeyPath = 4; | ||
189 | public const int MsidbComponentAttributesSharedDllRefCount = 8; | ||
190 | public const int MsidbComponentAttributesPermanent = 16; | ||
191 | public const int MsidbComponentAttributesODBCDataSource = 32; | ||
192 | public const int MsidbComponentAttributesTransitive = 64; | ||
193 | public const int MsidbComponentAttributesNeverOverwrite = 128; | ||
194 | public const int MsidbComponentAttributes64bit = 256; | ||
195 | public const int MsidbComponentAttributesDisableRegistryReflection = 512; | ||
196 | public const int MsidbComponentAttributesUninstallOnSupersedence = 1024; | ||
197 | public const int MsidbComponentAttributesShared = 2048; | ||
198 | |||
199 | // BBControl.Attributes & Control.Attributes | ||
200 | public const int MsidbControlAttributesVisible = 0x00000001; | ||
201 | public const int MsidbControlAttributesEnabled = 0x00000002; | ||
202 | public const int MsidbControlAttributesSunken = 0x00000004; | ||
203 | public const int MsidbControlAttributesIndirect = 0x00000008; | ||
204 | public const int MsidbControlAttributesInteger = 0x00000010; | ||
205 | public const int MsidbControlAttributesRTLRO = 0x00000020; | ||
206 | public const int MsidbControlAttributesRightAligned = 0x00000040; | ||
207 | public const int MsidbControlAttributesLeftScroll = 0x00000080; | ||
208 | public const int MsidbControlAttributesBiDi = MsidbControlAttributesRTLRO | MsidbControlAttributesRightAligned | MsidbControlAttributesLeftScroll; | ||
209 | |||
210 | // Text controls | ||
211 | public const int MsidbControlAttributesTransparent = 0x00010000; | ||
212 | public const int MsidbControlAttributesNoPrefix = 0x00020000; | ||
213 | public const int MsidbControlAttributesNoWrap = 0x00040000; | ||
214 | public const int MsidbControlAttributesFormatSize = 0x00080000; | ||
215 | public const int MsidbControlAttributesUsersLanguage = 0x00100000; | ||
216 | |||
217 | // Edit controls | ||
218 | public const int MsidbControlAttributesMultiline = 0x00010000; | ||
219 | public const int MsidbControlAttributesPasswordInput = 0x00200000; | ||
220 | |||
221 | // ProgressBar controls | ||
222 | public const int MsidbControlAttributesProgress95 = 0x00010000; | ||
223 | |||
224 | // VolumeSelectCombo and DirectoryCombo controls | ||
225 | public const int MsidbControlAttributesRemovableVolume = 0x00010000; | ||
226 | public const int MsidbControlAttributesFixedVolume = 0x00020000; | ||
227 | public const int MsidbControlAttributesRemoteVolume = 0x00040000; | ||
228 | public const int MsidbControlAttributesCDROMVolume = 0x00080000; | ||
229 | public const int MsidbControlAttributesRAMDiskVolume = 0x00100000; | ||
230 | public const int MsidbControlAttributesFloppyVolume = 0x00200000; | ||
231 | |||
232 | // VolumeCostList controls | ||
233 | public const int MsidbControlShowRollbackCost = 0x00400000; | ||
234 | |||
235 | // ListBox and ComboBox controls | ||
236 | public const int MsidbControlAttributesSorted = 0x00010000; | ||
237 | public const int MsidbControlAttributesComboList = 0x00020000; | ||
238 | |||
239 | // picture button controls | ||
240 | public const int MsidbControlAttributesImageHandle = 0x00010000; | ||
241 | public const int MsidbControlAttributesPushLike = 0x00020000; | ||
242 | public const int MsidbControlAttributesBitmap = 0x00040000; | ||
243 | public const int MsidbControlAttributesIcon = 0x00080000; | ||
244 | public const int MsidbControlAttributesFixedSize = 0x00100000; | ||
245 | public const int MsidbControlAttributesIconSize16 = 0x00200000; | ||
246 | public const int MsidbControlAttributesIconSize32 = 0x00400000; | ||
247 | public const int MsidbControlAttributesIconSize48 = 0x00600000; | ||
248 | public const int MsidbControlAttributesElevationShield = 0x00800000; | ||
249 | |||
250 | // RadioButton controls | ||
251 | public const int MsidbControlAttributesHasBorder = 0x01000000; | ||
252 | |||
253 | // CustomAction.Type | ||
254 | // executable types | ||
255 | public const int MsidbCustomActionTypeDll = 0x00000001; // Target = entry point name | ||
256 | public const int MsidbCustomActionTypeExe = 0x00000002; // Target = command line args | ||
257 | public const int MsidbCustomActionTypeTextData = 0x00000003; // Target = text string to be formatted and set into property | ||
258 | public const int MsidbCustomActionTypeJScript = 0x00000005; // Target = entry point name; null if none to call | ||
259 | public const int MsidbCustomActionTypeVBScript = 0x00000006; // Target = entry point name; null if none to call | ||
260 | public const int MsidbCustomActionTypeInstall = 0x00000007; // Target = property list for nested engine initialization | ||
261 | public const int MsidbCustomActionTypeSourceBits = 0x00000030; | ||
262 | public const int MsidbCustomActionTypeTargetBits = 0x00000007; | ||
263 | public const int MsidbCustomActionTypeReturnBits = 0x000000C0; | ||
264 | public const int MsidbCustomActionTypeExecuteBits = 0x00000700; | ||
265 | |||
266 | // source of code | ||
267 | public const int MsidbCustomActionTypeBinaryData = 0x00000000; // Source = Binary.Name; data stored in stream | ||
268 | public const int MsidbCustomActionTypeSourceFile = 0x00000010; // Source = File.File; file part of installation | ||
269 | public const int MsidbCustomActionTypeDirectory = 0x00000020; // Source = Directory.Directory; folder containing existing file | ||
270 | public const int MsidbCustomActionTypeProperty = 0x00000030; // Source = Property.Property; full path to executable | ||
271 | |||
272 | // return processing; default is syncronous execution; process return code | ||
273 | public const int MsidbCustomActionTypeContinue = 0x00000040; // ignore action return status; continue running | ||
274 | public const int MsidbCustomActionTypeAsync = 0x00000080; // run asynchronously | ||
275 | |||
276 | // execution scheduling flags; default is execute whenever sequenced | ||
277 | public const int MsidbCustomActionTypeFirstSequence = 0x00000100; // skip if UI sequence already run | ||
278 | public const int MsidbCustomActionTypeOncePerProcess = 0x00000200; // skip if UI sequence already run in same process | ||
279 | public const int MsidbCustomActionTypeClientRepeat = 0x00000300; // run on client only if UI already run on client | ||
280 | public const int MsidbCustomActionTypeInScript = 0x00000400; // queue for execution within script | ||
281 | public const int MsidbCustomActionTypeRollback = 0x00000100; // in conjunction with InScript: queue in Rollback script | ||
282 | public const int MsidbCustomActionTypeCommit = 0x00000200; // in conjunction with InScript: run Commit ops from script on success | ||
283 | |||
284 | // security context flag; default to impersonate as user; valid only if InScript | ||
285 | public const int MsidbCustomActionTypeNoImpersonate = 0x00000800; // no impersonation; run in system context | ||
286 | public const int MsidbCustomActionTypeTSAware = 0x00004000; // impersonate for per-machine installs on TS machines | ||
287 | public const int MsidbCustomActionType64BitScript = 0x00001000; // script should run in 64bit process | ||
288 | public const int MsidbCustomActionTypeHideTarget = 0x00002000; // don't record the contents of the Target field in the log file. | ||
289 | |||
290 | public const int MsidbCustomActionTypePatchUninstall = 0x00008000; // run on patch uninstall | ||
291 | |||
292 | // Dialog.Attributes | ||
293 | public const int MsidbDialogAttributesVisible = 0x00000001; | ||
294 | public const int MsidbDialogAttributesModal = 0x00000002; | ||
295 | public const int MsidbDialogAttributesMinimize = 0x00000004; | ||
296 | public const int MsidbDialogAttributesSysModal = 0x00000008; | ||
297 | public const int MsidbDialogAttributesKeepModeless = 0x00000010; | ||
298 | public const int MsidbDialogAttributesTrackDiskSpace = 0x00000020; | ||
299 | public const int MsidbDialogAttributesUseCustomPalette = 0x00000040; | ||
300 | public const int MsidbDialogAttributesRTLRO = 0x00000080; | ||
301 | public const int MsidbDialogAttributesRightAligned = 0x00000100; | ||
302 | public const int MsidbDialogAttributesLeftScroll = 0x00000200; | ||
303 | public const int MsidbDialogAttributesBiDi = MsidbDialogAttributesRTLRO | MsidbDialogAttributesRightAligned | MsidbDialogAttributesLeftScroll; | ||
304 | public const int MsidbDialogAttributesError = 0x00010000; | ||
305 | public const int CommonControlAttributesInvert = MsidbControlAttributesVisible + MsidbControlAttributesEnabled; | ||
306 | public const int DialogAttributesInvert = MsidbDialogAttributesVisible + MsidbDialogAttributesModal + MsidbDialogAttributesMinimize; | ||
307 | |||
308 | // Feature.Attributes | ||
309 | public const int MsidbFeatureAttributesFavorLocal = 0; | ||
310 | public const int MsidbFeatureAttributesFavorSource = 1; | ||
311 | public const int MsidbFeatureAttributesFollowParent = 2; | ||
312 | public const int MsidbFeatureAttributesFavorAdvertise = 4; | ||
313 | public const int MsidbFeatureAttributesDisallowAdvertise = 8; | ||
314 | public const int MsidbFeatureAttributesUIDisallowAbsent = 16; | ||
315 | public const int MsidbFeatureAttributesNoUnsupportedAdvertise = 32; | ||
316 | |||
317 | // File.Attributes | ||
318 | public const int MsidbFileAttributesReadOnly = 1; | ||
319 | public const int MsidbFileAttributesHidden = 2; | ||
320 | public const int MsidbFileAttributesSystem = 4; | ||
321 | public const int MsidbFileAttributesVital = 512; | ||
322 | public const int MsidbFileAttributesChecksum = 1024; | ||
323 | public const int MsidbFileAttributesPatchAdded = 4096; | ||
324 | public const int MsidbFileAttributesNoncompressed = 8192; | ||
325 | public const int MsidbFileAttributesCompressed = 16384; | ||
326 | |||
327 | // IniFile.Action & RemoveIniFile.Action | ||
328 | public const int MsidbIniFileActionAddLine = 0; | ||
329 | public const int MsidbIniFileActionCreateLine = 1; | ||
330 | public const int MsidbIniFileActionRemoveLine = 2; | ||
331 | public const int MsidbIniFileActionAddTag = 3; | ||
332 | public const int MsidbIniFileActionRemoveTag = 4; | ||
333 | |||
334 | // MoveFile.Options | ||
335 | public const int MsidbMoveFileOptionsMove = 1; | ||
336 | |||
337 | // ServiceInstall.Attributes | ||
338 | public const int MsidbServiceInstallOwnProcess = 0x00000010; | ||
339 | public const int MsidbServiceInstallShareProcess = 0x00000020; | ||
340 | public const int MsidbServiceInstallInteractive = 0x00000100; | ||
341 | public const int MsidbServiceInstallAutoStart = 0x00000002; | ||
342 | public const int MsidbServiceInstallDemandStart = 0x00000003; | ||
343 | public const int MsidbServiceInstallDisabled = 0x00000004; | ||
344 | public const int MsidbServiceInstallErrorIgnore = 0x00000000; | ||
345 | public const int MsidbServiceInstallErrorNormal = 0x00000001; | ||
346 | public const int MsidbServiceInstallErrorCritical = 0x00000003; | ||
347 | public const int MsidbServiceInstallErrorControlVital = 0x00008000; | ||
348 | |||
349 | // ServiceConfig.Event | ||
350 | public const int MsidbServiceConfigEventInstall = 0x00000001; | ||
351 | public const int MsidbServiceConfigEventUninstall = 0x00000002; | ||
352 | public const int MsidbServiceConfigEventReinstall = 0x00000004; | ||
353 | |||
354 | // ServiceControl.Attributes | ||
355 | public const int MsidbServiceControlEventStart = 0x00000001; | ||
356 | public const int MsidbServiceControlEventStop = 0x00000002; | ||
357 | public const int MsidbServiceControlEventDelete = 0x00000008; | ||
358 | public const int MsidbServiceControlEventUninstallStart = 0x00000010; | ||
359 | public const int MsidbServiceControlEventUninstallStop = 0x00000020; | ||
360 | public const int MsidbServiceControlEventUninstallDelete = 0x00000080; | ||
361 | |||
362 | // TextStyle.StyleBits | ||
363 | public const int MsidbTextStyleStyleBitsBold = 1; | ||
364 | public const int MsidbTextStyleStyleBitsItalic = 2; | ||
365 | public const int MsidbTextStyleStyleBitsUnderline = 4; | ||
366 | public const int MsidbTextStyleStyleBitsStrike = 8; | ||
367 | |||
368 | // Upgrade.Attributes | ||
369 | public const int MsidbUpgradeAttributesMigrateFeatures = 0x00000001; | ||
370 | public const int MsidbUpgradeAttributesOnlyDetect = 0x00000002; | ||
371 | public const int MsidbUpgradeAttributesIgnoreRemoveFailure = 0x00000004; | ||
372 | public const int MsidbUpgradeAttributesVersionMinInclusive = 0x00000100; | ||
373 | public const int MsidbUpgradeAttributesVersionMaxInclusive = 0x00000200; | ||
374 | public const int MsidbUpgradeAttributesLanguagesExclusive = 0x00000400; | ||
375 | |||
376 | // Registry Hive Roots | ||
377 | public const int MsidbRegistryRootClassesRoot = 0; | ||
378 | public const int MsidbRegistryRootCurrentUser = 1; | ||
379 | public const int MsidbRegistryRootLocalMachine = 2; | ||
380 | public const int MsidbRegistryRootUsers = 3; | ||
381 | |||
382 | // Locator Types | ||
383 | public const int MsidbLocatorTypeDirectory = 0; | ||
384 | public const int MsidbLocatorTypeFileName = 1; | ||
385 | public const int MsidbLocatorTypeRawValue = 2; | ||
386 | public const int MsidbLocatorType64bit = 16; | ||
387 | |||
388 | public const int MsidbClassAttributesRelativePath = 1; | ||
389 | |||
390 | // RemoveFile.InstallMode | ||
391 | public const int MsidbRemoveFileInstallModeOnInstall = 0x00000001; | ||
392 | public const int MsidbRemoveFileInstallModeOnRemove = 0x00000002; | ||
393 | public const int MsidbRemoveFileInstallModeOnBoth = 0x00000003; | ||
394 | |||
395 | // ODBCDataSource.Registration | ||
396 | public const int MsidbODBCDataSourceRegistrationPerMachine = 0; | ||
397 | public const int MsidbODBCDataSourceRegistrationPerUser = 1; | ||
398 | |||
399 | // ModuleConfiguration.Format | ||
400 | public const int MsidbModuleConfigurationFormatText = 0; | ||
401 | public const int MsidbModuleConfigurationFormatKey = 1; | ||
402 | public const int MsidbModuleConfigurationFormatInteger = 2; | ||
403 | public const int MsidbModuleConfigurationFormatBitfield = 3; | ||
404 | |||
405 | // ModuleConfiguration.Attributes | ||
406 | public const int MsidbMsmConfigurableOptionKeyNoOrphan = 1; | ||
407 | public const int MsidbMsmConfigurableOptionNonNullable = 2; | ||
408 | |||
409 | // ' Windows API function ShowWindow constants - used in Shortcut table | ||
410 | public const int SWSHOWNORMAL = 0x00000001; | ||
411 | public const int SWSHOWMAXIMIZED = 0x00000003; | ||
412 | public const int SWSHOWMINNOACTIVE = 0x00000007; | ||
413 | |||
414 | // NameToBit arrays | ||
415 | // UI elements | ||
416 | public static readonly string[] CommonControlAttributes = { "Hidden", "Disabled", "Sunken", "Indirect", "Integer", "RightToLeft", "RightAligned", "LeftScroll" }; | ||
417 | public static readonly string[] TextControlAttributes = { "Transparent", "NoPrefix", "NoWrap", "FormatSize", "UserLanguage" }; | ||
418 | public static readonly string[] HyperlinkControlAttributes = { "Transparent" }; | ||
419 | public static readonly string[] EditControlAttributes = { "Multiline", null, null, null, null, "Password" }; | ||
420 | public static readonly string[] ProgressControlAttributes = { "ProgressBlocks" }; | ||
421 | public static readonly string[] VolumeControlAttributes = { "Removable", "Fixed", "Remote", "CDROM", "RAMDisk", "Floppy", "ShowRollbackCost" }; | ||
422 | public static readonly string[] ListboxControlAttributes = { "Sorted", null, null, null, "UserLanguage" }; | ||
423 | public static readonly string[] ListviewControlAttributes = { "Sorted", null, null, null, "FixedSize", "Icon16", "Icon32" }; | ||
424 | public static readonly string[] ComboboxControlAttributes = { "Sorted", "ComboList", null, null, "UserLanguage" }; | ||
425 | public static readonly string[] RadioControlAttributes = { "Image", "PushLike", "Bitmap", "Icon", "FixedSize", "Icon16", "Icon32", null, "HasBorder" }; | ||
426 | public static readonly string[] ButtonControlAttributes = { "Image", null, "Bitmap", "Icon", "FixedSize", "Icon16", "Icon32", "ElevationShield" }; | ||
427 | public static readonly string[] IconControlAttributes = { "Image", null, null, null, "FixedSize", "Icon16", "Icon32" }; | ||
428 | public static readonly string[] BitmapControlAttributes = { "Image", null, null, null, "FixedSize" }; | ||
429 | public static readonly string[] CheckboxControlAttributes = { null, "PushLike", "Bitmap", "Icon", "FixedSize", "Icon16", "Icon32" }; | ||
430 | |||
431 | public const int MsidbEmbeddedUI = 0x01; | ||
432 | public const int MsidbEmbeddedHandlesBasic = 0x02; | ||
433 | |||
434 | public const int INSTALLLOGMODE_FATALEXIT = 0x00001; | ||
435 | public const int INSTALLLOGMODE_ERROR = 0x00002; | ||
436 | public const int INSTALLLOGMODE_WARNING = 0x00004; | ||
437 | public const int INSTALLLOGMODE_USER = 0x00008; | ||
438 | public const int INSTALLLOGMODE_INFO = 0x00010; | ||
439 | public const int INSTALLLOGMODE_FILESINUSE = 0x00020; | ||
440 | public const int INSTALLLOGMODE_RESOLVESOURCE = 0x00040; | ||
441 | public const int INSTALLLOGMODE_OUTOFDISKSPACE = 0x00080; | ||
442 | public const int INSTALLLOGMODE_ACTIONSTART = 0x00100; | ||
443 | public const int INSTALLLOGMODE_ACTIONDATA = 0x00200; | ||
444 | public const int INSTALLLOGMODE_PROGRESS = 0x00400; | ||
445 | public const int INSTALLLOGMODE_COMMONDATA = 0x00800; | ||
446 | public const int INSTALLLOGMODE_INITIALIZE = 0x01000; | ||
447 | public const int INSTALLLOGMODE_TERMINATE = 0x02000; | ||
448 | public const int INSTALLLOGMODE_SHOWDIALOG = 0x04000; | ||
449 | public const int INSTALLLOGMODE_RMFILESINUSE = 0x02000000; | ||
450 | public const int INSTALLLOGMODE_INSTALLSTART = 0x04000000; | ||
451 | public const int INSTALLLOGMODE_INSTALLEND = 0x08000000; | ||
452 | |||
453 | public const int MSICONDITIONFALSE = 0; // The table is temporary. | ||
454 | public const int MSICONDITIONTRUE = 1; // The table is persistent. | ||
455 | public const int MSICONDITIONNONE = 2; // The table is unknown. | ||
456 | public const int MSICONDITIONERROR = 3; // An invalid handle or invalid parameter was passed to the function. | ||
457 | |||
458 | public const int MSIDBOPENREADONLY = 0; | ||
459 | public const int MSIDBOPENTRANSACT = 1; | ||
460 | public const int MSIDBOPENDIRECT = 2; | ||
461 | public const int MSIDBOPENCREATE = 3; | ||
462 | public const int MSIDBOPENCREATEDIRECT = 4; | ||
463 | public const int MSIDBOPENPATCHFILE = 32; | ||
464 | |||
465 | 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. | ||
466 | 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. | ||
467 | 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. | ||
468 | 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. | ||
469 | 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. | ||
470 | 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. | ||
471 | 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. | ||
472 | 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. | ||
473 | 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. | ||
474 | 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. | ||
475 | 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. | ||
476 | 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. | ||
477 | 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. | ||
478 | |||
479 | public const uint VTI2 = 2; | ||
480 | public const uint VTI4 = 3; | ||
481 | public const uint VTLPWSTR = 30; | ||
482 | public const uint VTFILETIME = 64; | ||
483 | |||
484 | public const int MSICOLINFONAMES = 0; // return column names | ||
485 | public const int MSICOLINFOTYPES = 1; // return column definitions, datatype code followed by width | ||
486 | |||
487 | /// <summary> | ||
488 | /// Protect the constructor. | ||
489 | /// </summary> | ||
490 | private MsiInterop() | ||
491 | { | ||
492 | } | ||
493 | |||
494 | /// <summary> | ||
495 | /// PInvoke of MsiCloseHandle. | ||
496 | /// </summary> | ||
497 | /// <param name="database">Handle to a database.</param> | ||
498 | /// <returns>Error code.</returns> | ||
499 | [DllImport("msi.dll", EntryPoint = "MsiCloseHandle", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
500 | public static extern int MsiCloseHandle(uint database); | ||
501 | |||
502 | /// <summary> | ||
503 | /// PInvoke of MsiCreateRecord | ||
504 | /// </summary> | ||
505 | /// <param name="parameters">Count of columns in the record.</param> | ||
506 | /// <returns>Handle referencing the record.</returns> | ||
507 | [DllImport("msi.dll", EntryPoint = "MsiCreateRecord", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
508 | public static extern uint MsiCreateRecord(int parameters); | ||
509 | |||
510 | /// <summary> | ||
511 | /// Creates summary information of an existing transform to include validation and error conditions. | ||
512 | /// </summary> | ||
513 | /// <param name="database">The handle to the database that contains the new database summary information.</param> | ||
514 | /// <param name="referenceDatabase">The handle to the database that contains the original summary information.</param> | ||
515 | /// <param name="transformFile">The name of the transform to which the summary information is added.</param> | ||
516 | /// <param name="errorConditions">The error conditions that should be suppressed when the transform is applied.</param> | ||
517 | /// <param name="validations">Specifies the properties to be validated to verify that the transform can be applied to the database.</param> | ||
518 | /// <returns>Error code.</returns> | ||
519 | [DllImport("msi.dll", EntryPoint = "MsiCreateTransformSummaryInfoW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
520 | public static extern int MsiCreateTransformSummaryInfo(uint database, uint referenceDatabase, string transformFile, TransformErrorConditions errorConditions, TransformValidations validations); | ||
521 | |||
522 | /// <summary> | ||
523 | /// Applies a transform to a database. | ||
524 | /// </summary> | ||
525 | /// <param name="database">Handle to the database obtained from MsiOpenDatabase to transform.</param> | ||
526 | /// <param name="transformFile">Specifies the name of the transform file to apply.</param> | ||
527 | /// <param name="errorConditions">Error conditions that should be suppressed.</param> | ||
528 | /// <returns>Error code.</returns> | ||
529 | [DllImport("msi.dll", EntryPoint = "MsiDatabaseApplyTransformW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
530 | public static extern int MsiDatabaseApplyTransform(uint database, string transformFile, TransformErrorConditions errorConditions); | ||
531 | |||
532 | /// <summary> | ||
533 | /// PInvoke of MsiDatabaseCommit. | ||
534 | /// </summary> | ||
535 | /// <param name="database">Handle to a databse.</param> | ||
536 | /// <returns>Error code.</returns> | ||
537 | [DllImport("msi.dll", EntryPoint = "MsiDatabaseCommit", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
538 | public static extern int MsiDatabaseCommit(uint database); | ||
539 | |||
540 | /// <summary> | ||
541 | /// PInvoke of MsiDatabaseExportW. | ||
542 | /// </summary> | ||
543 | /// <param name="database">Handle to a database.</param> | ||
544 | /// <param name="tableName">Table name.</param> | ||
545 | /// <param name="folderPath">Folder path.</param> | ||
546 | /// <param name="fileName">File name.</param> | ||
547 | /// <returns>Error code.</returns> | ||
548 | [DllImport("msi.dll", EntryPoint = "MsiDatabaseExportW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
549 | public static extern int MsiDatabaseExport(uint database, string tableName, string folderPath, string fileName); | ||
550 | |||
551 | /// <summary> | ||
552 | /// Generates a transform file of differences between two databases. | ||
553 | /// </summary> | ||
554 | /// <param name="database">Handle to the database obtained from MsiOpenDatabase that includes the changes.</param> | ||
555 | /// <param name="databaseReference">Handle to the database obtained from MsiOpenDatabase that does not include the changes.</param> | ||
556 | /// <param name="transformFile">A null-terminated string that specifies the name of the transform file being generated. | ||
557 | /// This parameter can be null. If szTransformFile is null, you can use MsiDatabaseGenerateTransform to test whether two | ||
558 | /// databases are identical without creating a transform. If the databases are identical, the function returns ERROR_NO_DATA. | ||
559 | /// If the databases are different the function returns NOERROR.</param> | ||
560 | /// <param name="reserved1">This is a reserved argument and must be set to 0.</param> | ||
561 | /// <param name="reserved2">This is a reserved argument and must be set to 0.</param> | ||
562 | /// <returns>Error code.</returns> | ||
563 | [DllImport("msi.dll", EntryPoint = "MsiDatabaseGenerateTransformW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
564 | public static extern int MsiDatabaseGenerateTransform(uint database, uint databaseReference, string transformFile, int reserved1, int reserved2); | ||
565 | |||
566 | /// <summary> | ||
567 | /// PInvoke of MsiDatabaseImportW. | ||
568 | /// </summary> | ||
569 | /// <param name="database">Handle to a database.</param> | ||
570 | /// <param name="folderPath">Folder path.</param> | ||
571 | /// <param name="fileName">File name.</param> | ||
572 | /// <returns>Error code.</returns> | ||
573 | [DllImport("msi.dll", EntryPoint = "MsiDatabaseImportW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
574 | public static extern int MsiDatabaseImport(uint database, string folderPath, string fileName); | ||
575 | |||
576 | /// <summary> | ||
577 | /// PInvoke of MsiDatabaseMergeW. | ||
578 | /// </summary> | ||
579 | /// <param name="database">The handle to the database obtained from MsiOpenDatabase.</param> | ||
580 | /// <param name="databaseMerge">The handle to the database obtained from MsiOpenDatabase to merge into the base database.</param> | ||
581 | /// <param name="tableName">The name of the table to receive merge conflict information.</param> | ||
582 | /// <returns>Error code.</returns> | ||
583 | [DllImport("msi.dll", EntryPoint = "MsiDatabaseMergeW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
584 | public static extern int MsiDatabaseMerge(uint database, uint databaseMerge, string tableName); | ||
585 | |||
586 | /// <summary> | ||
587 | /// PInvoke of MsiDatabaseOpenViewW. | ||
588 | /// </summary> | ||
589 | /// <param name="database">Handle to a database.</param> | ||
590 | /// <param name="query">SQL query.</param> | ||
591 | /// <param name="view">View handle.</param> | ||
592 | /// <returns>Error code.</returns> | ||
593 | [DllImport("msi.dll", EntryPoint = "MsiDatabaseOpenViewW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
594 | public static extern int MsiDatabaseOpenView(uint database, string query, out uint view); | ||
595 | |||
596 | /// <summary> | ||
597 | /// PInvoke of MsiGetFileHashW. | ||
598 | /// </summary> | ||
599 | /// <param name="filePath">File path.</param> | ||
600 | /// <param name="options">Hash options (must be 0).</param> | ||
601 | /// <param name="hash">Buffer to recieve hash.</param> | ||
602 | /// <returns>Error code.</returns> | ||
603 | [DllImport("msi.dll", EntryPoint = "MsiGetFileHashW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
604 | public static extern int MsiGetFileHash(string filePath, uint options, MSIFILEHASHINFO hash); | ||
605 | |||
606 | /// <summary> | ||
607 | /// PInvoke of MsiGetFileVersionW. | ||
608 | /// </summary> | ||
609 | /// <param name="filePath">File path.</param> | ||
610 | /// <param name="versionBuf">Buffer to receive version info.</param> | ||
611 | /// <param name="versionBufSize">Size of version buffer.</param> | ||
612 | /// <param name="langBuf">Buffer to recieve lang info.</param> | ||
613 | /// <param name="langBufSize">Size of lang buffer.</param> | ||
614 | /// <returns>Error code.</returns> | ||
615 | [DllImport("msi.dll", EntryPoint = "MsiGetFileVersionW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
616 | public static extern int MsiGetFileVersion(string filePath, StringBuilder versionBuf, ref int versionBufSize, StringBuilder langBuf, ref int langBufSize); | ||
617 | |||
618 | /// <summary> | ||
619 | /// PInvoke of MsiGetLastErrorRecord. | ||
620 | /// </summary> | ||
621 | /// <returns>Handle to error record if one exists.</returns> | ||
622 | [DllImport("msi.dll", EntryPoint = "MsiGetLastErrorRecord", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
623 | public static extern uint MsiGetLastErrorRecord(); | ||
624 | |||
625 | /// <summary> | ||
626 | /// PInvoke of MsiDatabaseGetPrimaryKeysW. | ||
627 | /// </summary> | ||
628 | /// <param name="database">Handle to a database.</param> | ||
629 | /// <param name="tableName">Table name.</param> | ||
630 | /// <param name="record">Handle to receive resulting record.</param> | ||
631 | /// <returns>Error code.</returns> | ||
632 | [DllImport("msi.dll", EntryPoint = "MsiDatabaseGetPrimaryKeysW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
633 | public static extern int MsiDatabaseGetPrimaryKeys(uint database, string tableName, out uint record); | ||
634 | |||
635 | /// <summary> | ||
636 | /// PInvoke of MsiDoActionW. | ||
637 | /// </summary> | ||
638 | /// <param name="product">Handle to the installation provided to a DLL custom action or | ||
639 | /// obtained through MsiOpenPackage, MsiOpenPackageEx, or MsiOpenProduct.</param> | ||
640 | /// <param name="action">Specifies the action to execute.</param> | ||
641 | /// <returns>Error code.</returns> | ||
642 | [DllImport("msi.dll", EntryPoint = "MsiDoActionW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
643 | public static extern int MsiDoAction(uint product, string action); | ||
644 | |||
645 | /// <summary> | ||
646 | /// PInvoke of MsiGetSummaryInformationW. Can use either database handle or database path as input. | ||
647 | /// </summary> | ||
648 | /// <param name="database">Handle to a database.</param> | ||
649 | /// <param name="databasePath">Path to a database.</param> | ||
650 | /// <param name="updateCount">Max number of updated values.</param> | ||
651 | /// <param name="summaryInfo">Handle to summary information.</param> | ||
652 | /// <returns>Error code.</returns> | ||
653 | [DllImport("msi.dll", EntryPoint = "MsiGetSummaryInformationW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
654 | public static extern int MsiGetSummaryInformation(uint database, string databasePath, uint updateCount, ref uint summaryInfo); | ||
655 | |||
656 | /// <summary> | ||
657 | /// PInvoke of MsiDatabaseIsTablePersitentW. | ||
658 | /// </summary> | ||
659 | /// <param name="database">Handle to a database.</param> | ||
660 | /// <param name="tableName">Table name.</param> | ||
661 | /// <returns>MSICONDITION</returns> | ||
662 | [DllImport("msi.dll", EntryPoint = "MsiDatabaseIsTablePersistentW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
663 | public static extern int MsiDatabaseIsTablePersistent(uint database, string tableName); | ||
664 | |||
665 | /// <summary> | ||
666 | /// PInvoke of MsiOpenDatabaseW. | ||
667 | /// </summary> | ||
668 | /// <param name="databasePath">Path to database.</param> | ||
669 | /// <param name="persist">Persist mode.</param> | ||
670 | /// <param name="database">Handle to database.</param> | ||
671 | /// <returns>Error code.</returns> | ||
672 | [DllImport("msi.dll", EntryPoint = "MsiOpenDatabaseW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
673 | public static extern int MsiOpenDatabase(string databasePath, IntPtr persist, out uint database); | ||
674 | |||
675 | /// <summary> | ||
676 | /// PInvoke of MsiOpenPackageW. | ||
677 | /// </summary> | ||
678 | /// <param name="packagePath">The path to the package.</param> | ||
679 | /// <param name="product">A pointer to a variable that receives the product handle.</param> | ||
680 | /// <returns>Error code.</returns> | ||
681 | [DllImport("msi.dll", EntryPoint = "MsiOpenPackageW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
682 | public static extern int MsiOpenPackage(string packagePath, out uint product); | ||
683 | |||
684 | /// <summary> | ||
685 | /// PInvoke of MsiRecordIsNull. | ||
686 | /// </summary> | ||
687 | /// <param name="record">MSI Record handle.</param> | ||
688 | /// <param name="field">Index of field to check for null value.</param> | ||
689 | /// <returns>true if the field is null, false if not, and an error code for any error.</returns> | ||
690 | [DllImport("msi.dll", EntryPoint = "MsiRecordIsNull", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
691 | public static extern int MsiRecordIsNull(uint record, int field); | ||
692 | |||
693 | /// <summary> | ||
694 | /// PInvoke of MsiRecordGetInteger. | ||
695 | /// </summary> | ||
696 | /// <param name="record">MSI Record handle.</param> | ||
697 | /// <param name="field">Index of field to retrieve integer from.</param> | ||
698 | /// <returns>Integer value.</returns> | ||
699 | [DllImport("msi.dll", EntryPoint = "MsiRecordGetInteger", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
700 | public static extern int MsiRecordGetInteger(uint record, int field); | ||
701 | |||
702 | /// <summary> | ||
703 | /// PInvoke of MsiRectordSetInteger. | ||
704 | /// </summary> | ||
705 | /// <param name="record">MSI Record handle.</param> | ||
706 | /// <param name="field">Index of field to set integer value in.</param> | ||
707 | /// <param name="value">Value to set field to.</param> | ||
708 | /// <returns>Error code.</returns> | ||
709 | [DllImport("msi.dll", EntryPoint = "MsiRecordSetInteger", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
710 | public static extern int MsiRecordSetInteger(uint record, int field, int value); | ||
711 | |||
712 | /// <summary> | ||
713 | /// PInvoke of MsiRecordGetStringW. | ||
714 | /// </summary> | ||
715 | /// <param name="record">MSI Record handle.</param> | ||
716 | /// <param name="field">Index of field to get string value from.</param> | ||
717 | /// <param name="valueBuf">Buffer to recieve value.</param> | ||
718 | /// <param name="valueBufSize">Size of buffer.</param> | ||
719 | /// <returns>Error code.</returns> | ||
720 | [DllImport("msi.dll", EntryPoint = "MsiRecordGetStringW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
721 | public static extern int MsiRecordGetString(uint record, int field, StringBuilder valueBuf, ref int valueBufSize); | ||
722 | |||
723 | /// <summary> | ||
724 | /// PInvoke of MsiRecordSetStringW. | ||
725 | /// </summary> | ||
726 | /// <param name="record">MSI Record handle.</param> | ||
727 | /// <param name="field">Index of field to set string value in.</param> | ||
728 | /// <param name="value">String value.</param> | ||
729 | /// <returns>Error code.</returns> | ||
730 | [DllImport("msi.dll", EntryPoint = "MsiRecordSetStringW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
731 | public static extern int MsiRecordSetString(uint record, int field, string value); | ||
732 | |||
733 | /// <summary> | ||
734 | /// PInvoke of MsiRecordSetStreamW. | ||
735 | /// </summary> | ||
736 | /// <param name="record">MSI Record handle.</param> | ||
737 | /// <param name="field">Index of field to set stream value in.</param> | ||
738 | /// <param name="filePath">Path to file to set stream value to.</param> | ||
739 | /// <returns>Error code.</returns> | ||
740 | [DllImport("msi.dll", EntryPoint = "MsiRecordSetStreamW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
741 | public static extern int MsiRecordSetStream(uint record, int field, string filePath); | ||
742 | |||
743 | /// <summary> | ||
744 | /// PInvoke of MsiRecordReadStreamW. | ||
745 | /// </summary> | ||
746 | /// <param name="record">MSI Record handle.</param> | ||
747 | /// <param name="field">Index of field to read stream from.</param> | ||
748 | /// <param name="dataBuf">Data buffer to recieve stream value.</param> | ||
749 | /// <param name="dataBufSize">Size of data buffer.</param> | ||
750 | /// <returns>Error code.</returns> | ||
751 | [DllImport("msi.dll", EntryPoint = "MsiRecordReadStream", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
752 | public static extern int MsiRecordReadStream(uint record, int field, byte[] dataBuf, ref int dataBufSize); | ||
753 | |||
754 | /// <summary> | ||
755 | /// PInvoke of MsiRecordGetFieldCount. | ||
756 | /// </summary> | ||
757 | /// <param name="record">MSI Record handle.</param> | ||
758 | /// <returns>Count of fields in the record.</returns> | ||
759 | [DllImport("msi.dll", EntryPoint = "MsiRecordGetFieldCount", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
760 | public static extern int MsiRecordGetFieldCount(uint record); | ||
761 | |||
762 | /// <summary> | ||
763 | /// PInvoke of MsiSetExternalUIW. | ||
764 | /// </summary> | ||
765 | /// <param name="installUIHandler">Specifies a callback function that conforms to the INSTALLUI_HANDLER specification.</param> | ||
766 | /// <param name="installLogMode">Specifies which messages to handle using the external message handler. If the external | ||
767 | /// handler returns a non-zero result, then that message will not be sent to the UI, instead the message will be logged | ||
768 | /// if logging has been enabled.</param> | ||
769 | /// <param name="context">Pointer to an application context that is passed to the callback function. | ||
770 | /// This parameter can be used for error checking.</param> | ||
771 | /// <returns>The return value is the previously set external handler, or zero (0) if there was no previously set handler.</returns> | ||
772 | [DllImport("msi.dll", EntryPoint = "MsiSetExternalUIW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
773 | public static extern InstallUIHandler MsiSetExternalUI(InstallUIHandler installUIHandler, int installLogMode, IntPtr context); | ||
774 | |||
775 | /// <summary> | ||
776 | /// PInvoke of MsiSetpublicUI. | ||
777 | /// </summary> | ||
778 | /// <param name="uiLevel">Specifies the level of complexity of the user interface.</param> | ||
779 | /// <param name="hwnd">Pointer to a window. This window becomes the owner of any user interface created. | ||
780 | /// A pointer to the previous owner of the user interface is returned. | ||
781 | /// If this parameter is null, the owner of the user interface does not change.</param> | ||
782 | /// <returns>The previous user interface level is returned. If an invalid dwUILevel is passed, then INSTALLUILEVEL_NOCHANGE is returned.</returns> | ||
783 | [DllImport("msi.dll", EntryPoint = "MsiSetpublicUI", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
784 | public static extern int MsiSetInternalUI(int uiLevel, ref IntPtr hwnd); | ||
785 | |||
786 | /// <summary> | ||
787 | /// PInvoke of MsiSummaryInfoGetPropertyW. | ||
788 | /// </summary> | ||
789 | /// <param name="summaryInfo">Handle to summary info.</param> | ||
790 | /// <param name="property">Property to get value from.</param> | ||
791 | /// <param name="dataType">Data type of property.</param> | ||
792 | /// <param name="integerValue">Integer to receive integer value.</param> | ||
793 | /// <param name="fileTimeValue">File time to receive file time value.</param> | ||
794 | /// <param name="stringValueBuf">String buffer to receive string value.</param> | ||
795 | /// <param name="stringValueBufSize">Size of string buffer.</param> | ||
796 | /// <returns>Error code.</returns> | ||
797 | [DllImport("msi.dll", EntryPoint = "MsiSummaryInfoGetPropertyW", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
798 | public static extern int MsiSummaryInfoGetProperty(uint summaryInfo, int property, out uint dataType, out int integerValue, ref FILETIME fileTimeValue, StringBuilder stringValueBuf, ref int stringValueBufSize); | ||
799 | |||
800 | /// <summary> | ||
801 | /// PInvoke of MsiViewGetColumnInfo. | ||
802 | /// </summary> | ||
803 | /// <param name="view">Handle to view.</param> | ||
804 | /// <param name="columnInfo">Column info.</param> | ||
805 | /// <param name="record">Handle for returned record.</param> | ||
806 | /// <returns>Error code.</returns> | ||
807 | [DllImport("msi.dll", EntryPoint = "MsiViewGetColumnInfo", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
808 | public static extern int MsiViewGetColumnInfo(uint view, int columnInfo, out uint record); | ||
809 | |||
810 | /// <summary> | ||
811 | /// PInvoke of MsiViewExecute. | ||
812 | /// </summary> | ||
813 | /// <param name="view">Handle of view to execute.</param> | ||
814 | /// <param name="record">Handle to a record that supplies the parameters for the view.</param> | ||
815 | /// <returns>Error code.</returns> | ||
816 | [DllImport("msi.dll", EntryPoint = "MsiViewExecute", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
817 | public static extern int MsiViewExecute(uint view, uint record); | ||
818 | |||
819 | /// <summary> | ||
820 | /// PInvoke of MsiViewFetch. | ||
821 | /// </summary> | ||
822 | /// <param name="view">Handle of view to fetch a row from.</param> | ||
823 | /// <param name="record">Handle to receive record info.</param> | ||
824 | /// <returns>Error code.</returns> | ||
825 | [DllImport("msi.dll", EntryPoint = "MsiViewFetch", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
826 | public static extern int MsiViewFetch(uint view, out uint record); | ||
827 | |||
828 | /// <summary> | ||
829 | /// PInvoke of MsiViewModify. | ||
830 | /// </summary> | ||
831 | /// <param name="view">Handle of view to modify.</param> | ||
832 | /// <param name="modifyMode">Modify mode.</param> | ||
833 | /// <param name="record">Handle of record.</param> | ||
834 | /// <returns>Error code.</returns> | ||
835 | [DllImport("msi.dll", EntryPoint = "MsiViewModify", CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
836 | public static extern int MsiViewModify(uint view, int modifyMode, uint record); | ||
837 | |||
838 | /// <summary> | ||
839 | /// contains the file hash information returned by MsiGetFileHash and used in the MsiFileHash table. | ||
840 | /// </summary> | ||
841 | [StructLayout(LayoutKind.Explicit)] | ||
842 | public class MSIFILEHASHINFO | ||
843 | { | ||
844 | [FieldOffset(0)] public uint FileHashInfoSize; | ||
845 | [FieldOffset(4)] public int Data0; | ||
846 | [FieldOffset(8)] public int Data1; | ||
847 | [FieldOffset(12)]public int Data2; | ||
848 | [FieldOffset(16)]public int Data3; | ||
849 | } | ||
850 | } | ||
851 | } | ||
diff --git a/src/WixToolset.Core.Native/MsmInterop.cs b/src/WixToolset.Core.Native/MsmInterop.cs deleted file mode 100644 index e309e57d..00000000 --- a/src/WixToolset.Core.Native/MsmInterop.cs +++ /dev/null | |||
@@ -1,507 +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 | |||
3 | namespace WixToolset.MergeMod | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections; | ||
7 | using System.Runtime.CompilerServices; | ||
8 | using System.Runtime.InteropServices; | ||
9 | |||
10 | /// <summary> | ||
11 | /// Errors returned by merge operations. | ||
12 | /// </summary> | ||
13 | [Guid("0ADDA825-2C26-11D2-AD65-00A0C9AF11A6")] | ||
14 | public enum MsmErrorType | ||
15 | { | ||
16 | /// <summary> | ||
17 | /// A request was made to open a module with a language not supported by the module. | ||
18 | /// No more general language is supported by the module. | ||
19 | /// Adds msmErrorLanguageUnsupported to the Type property and the requested language | ||
20 | /// to the Language Property (Error Object). All Error object properties are empty. | ||
21 | /// The OpenModule function returns ERROR_INSTALL_LANGUAGE_UNSUPPORTED (as HRESULT). | ||
22 | /// </summary> | ||
23 | msmErrorLanguageUnsupported = 1, | ||
24 | |||
25 | /// <summary> | ||
26 | /// A request was made to open a module with a supported language but the module has | ||
27 | /// an invalid language transform. Adds msmErrorLanguageFailed to the Type property | ||
28 | /// and the applied transform's language to the Language Property of the Error object. | ||
29 | /// This may not be the requested language if a more general language was used. | ||
30 | /// All other properties of the Error object are empty. The OpenModule function | ||
31 | /// returns ERROR_INSTALL_LANGUAGE_UNSUPPORTED (as HRESULT). | ||
32 | /// </summary> | ||
33 | msmErrorLanguageFailed = 2, | ||
34 | |||
35 | /// <summary> | ||
36 | /// The module cannot be merged because it excludes, or is excluded by, another module | ||
37 | /// in the database. Adds msmErrorExclusion to the Type property of the Error object. | ||
38 | /// The ModuleKeys property or DatabaseKeys property contains the primary keys of the | ||
39 | /// excluded module's row in the ModuleExclusion table. If an existing module excludes | ||
40 | /// the module being merged, the excluded module's ModuleSignature information is added | ||
41 | /// to ModuleKeys. If the module being merged excludes an existing module, DatabaseKeys | ||
42 | /// contains the excluded module's ModuleSignature information. All other properties | ||
43 | /// are empty (or -1). | ||
44 | /// </summary> | ||
45 | msmErrorExclusion = 3, | ||
46 | |||
47 | /// <summary> | ||
48 | /// Merge conflict during merge. The value of the Type property is set to | ||
49 | /// msmErrorTableMerge. The DatabaseTable property and DatabaseKeys property contain | ||
50 | /// the table name and primary keys of the conflicting row in the database. The | ||
51 | /// ModuleTable property and ModuleKeys property contain the table name and primary keys | ||
52 | /// of the conflicting row in the module. The ModuleTable and ModuleKeys entries may be | ||
53 | /// null if the row does not exist in the database. For example, if the conflict is in a | ||
54 | /// generated FeatureComponents table entry. On Windows Installer version 2.0, when | ||
55 | /// merging a configurable merge module, configuration may cause these properties to | ||
56 | /// refer to rows that do not exist in the module. | ||
57 | /// </summary> | ||
58 | msmErrorTableMerge = 4, | ||
59 | |||
60 | /// <summary> | ||
61 | /// There was a problem resequencing a sequence table to contain the necessary merged | ||
62 | /// actions. The Type property is set to msmErrorResequenceMerge. The DatabaseTable | ||
63 | /// and DatabaseKeys properties contain the sequence table name and primary keys | ||
64 | /// (action name) of the conflicting row. The ModuleTable and ModuleKeys properties | ||
65 | /// contain the sequence table name and primary key (action name) of the conflicting row. | ||
66 | /// On Windows Installer version 2.0, when merging a configurable merge module, | ||
67 | /// configuration may cause these properties to refer to rows that do not exist in the module. | ||
68 | /// </summary> | ||
69 | msmErrorResequenceMerge = 5, | ||
70 | |||
71 | /// <summary> | ||
72 | /// Not used. | ||
73 | /// </summary> | ||
74 | msmErrorFileCreate = 6, | ||
75 | |||
76 | /// <summary> | ||
77 | /// There was a problem creating a directory to extract a file to disk. The Path property | ||
78 | /// contains the directory that could not be created. All other properties are empty or -1. | ||
79 | /// Not available with Windows Installer version 1.0. | ||
80 | /// </summary> | ||
81 | msmErrorDirCreate = 7, | ||
82 | |||
83 | /// <summary> | ||
84 | /// A feature name is required to complete the merge, but no feature name was provided. | ||
85 | /// The Type property is set to msmErrorFeatureRequired. The DatabaseTable and DatabaseKeys | ||
86 | /// contain the table name and primary keys of the conflicting row. The ModuleTable and | ||
87 | /// ModuleKeys properties contain the table name and primary keys of the row cannot be merged. | ||
88 | /// On Windows Installer version 2.0, when merging a configurable merge module, configuration | ||
89 | /// may cause these properties to refer to rows that do not exist in the module. | ||
90 | /// If the failure is in a generated FeatureComponents table, the DatabaseTable and | ||
91 | /// DatabaseKeys properties are empty and the ModuleTable and ModuleKeys properties refer to | ||
92 | /// the row in the Component table causing the failure. | ||
93 | /// </summary> | ||
94 | msmErrorFeatureRequired = 8, | ||
95 | |||
96 | /// <summary> | ||
97 | /// Available with Window Installer version 2.0. Substitution of a Null value into a | ||
98 | /// non-nullable column. This enters msmErrorBadNullSubstitution in the Type property and | ||
99 | /// enters "ModuleSubstitution" and the keys from the ModuleSubstitution table for this row | ||
100 | /// into the ModuleTable property and ModuleKeys property. All other properties of the Error | ||
101 | /// object are set to an empty string or -1. This error causes the immediate failure of the | ||
102 | /// merge and the MergeEx function to return E_FAIL. | ||
103 | /// </summary> | ||
104 | msmErrorBadNullSubstitution = 9, | ||
105 | |||
106 | /// <summary> | ||
107 | /// Available with Window Installer version 2.0. Substitution of Text Format Type or Integer | ||
108 | /// Format Type into a Binary Type data column. This type of error returns | ||
109 | /// msmErrorBadSubstitutionType in the Type property and enters "ModuleSubstitution" and the | ||
110 | /// keys from the ModuleSubstitution table for this row into the ModuleTable property. | ||
111 | /// All other properties of the Error object are set to an empty string or -1. This error | ||
112 | /// causes the immediate failure of the merge and the MergeEx function to return E_FAIL. | ||
113 | /// </summary> | ||
114 | msmErrorBadSubstitutionType = 10, | ||
115 | |||
116 | /// <summary> | ||
117 | /// Available with Window Installer Version 2.0. A row in the ModuleSubstitution table | ||
118 | /// references a configuration item not defined in the ModuleConfiguration table. | ||
119 | /// This type of error returns msmErrorMissingConfigItem in the Type property and enters | ||
120 | /// "ModuleSubstitution" and the keys from the ModuleSubstitution table for this row into | ||
121 | /// the ModuleTable property. All other properties of the Error object are set to an empty | ||
122 | /// string or -1. This error causes the immediate failure of the merge and the MergeEx | ||
123 | /// function to return E_FAIL. | ||
124 | /// </summary> | ||
125 | msmErrorMissingConfigItem = 11, | ||
126 | |||
127 | /// <summary> | ||
128 | /// Available with Window Installer version 2.0. The authoring tool has returned a Null | ||
129 | /// value for an item marked with the msmConfigItemNonNullable attribute. An error of this | ||
130 | /// type returns msmErrorBadNullResponse in the Type property and enters "ModuleSubstitution" | ||
131 | /// and the keys from the ModuleSubstitution table for for the item into the ModuleTable property. | ||
132 | /// All other properties of the Error object are set to an empty string or -1. This error | ||
133 | /// causes the immediate failure of the merge and the MergeEx function to return E_FAIL. | ||
134 | /// </summary> | ||
135 | msmErrorBadNullResponse = 12, | ||
136 | |||
137 | /// <summary> | ||
138 | /// Available with Window Installer version 2.0. The authoring tool returned a failure code | ||
139 | /// (not S_OK or S_FALSE) when asked for data. An error of this type will return | ||
140 | /// msmErrorDataRequestFailed in the Type property and enters "ModuleSubstitution" | ||
141 | /// and the keys from the ModuleSubstitution table for the item into the ModuleTable property. | ||
142 | /// All other properties of the Error object are set to an empty string or -1. This error | ||
143 | /// causes the immediate failure of the merge and the MergeEx function to return E_FAIL. | ||
144 | /// </summary> | ||
145 | msmErrorDataRequestFailed = 13, | ||
146 | |||
147 | /// <summary> | ||
148 | /// Available with Windows Installer 2.0 and later versions. Indicates that an attempt was | ||
149 | /// made to merge a 64-bit module into a package that was not a 64-bit package. An error of | ||
150 | /// this type returns msmErrorPlatformMismatch in the Type property. All other properties of | ||
151 | /// the error object are set to an empty string or -1. This error causes the immediate failure | ||
152 | /// of the merge and causes the Merge function or MergeEx function to return E_FAIL. | ||
153 | /// </summary> | ||
154 | msmErrorPlatformMismatch = 14, | ||
155 | } | ||
156 | |||
157 | /// <summary> | ||
158 | /// IMsmMerge2 interface. | ||
159 | /// </summary> | ||
160 | [ComImport, Guid("351A72AB-21CB-47ab-B7AA-C4D7B02EA305")] | ||
161 | public interface IMsmMerge2 | ||
162 | { | ||
163 | /// <summary> | ||
164 | /// The OpenDatabase method of the Merge object opens a Windows Installer installation | ||
165 | /// database, located at a specified path, that is to be merged with a module. | ||
166 | /// </summary> | ||
167 | /// <param name="path">Path to the database being opened.</param> | ||
168 | void OpenDatabase(string path); | ||
169 | |||
170 | /// <summary> | ||
171 | /// The OpenModule method of the Merge object opens a Windows Installer merge module | ||
172 | /// in read-only mode. A module must be opened before it can be merged with an installation database. | ||
173 | /// </summary> | ||
174 | /// <param name="fileName">Fully qualified file name pointing to a merge module.</param> | ||
175 | /// <param name="language">A valid language identifier (LANGID).</param> | ||
176 | void OpenModule(string fileName, short language); | ||
177 | |||
178 | /// <summary> | ||
179 | /// The CloseDatabase method of the Merge object closes the currently open Windows Installer database. | ||
180 | /// </summary> | ||
181 | /// <param name="commit">true if changes should be saved, false otherwise.</param> | ||
182 | void CloseDatabase(bool commit); | ||
183 | |||
184 | /// <summary> | ||
185 | /// The CloseModule method of the Merge object closes the currently open Windows Installer merge module. | ||
186 | /// </summary> | ||
187 | void CloseModule(); | ||
188 | |||
189 | /// <summary> | ||
190 | /// The OpenLog method of the Merge object opens a log file that receives progress and error messages. | ||
191 | /// If the log file already exists, the installer appends new messages. If the log file does not exist, | ||
192 | /// the installer creates a log file. | ||
193 | /// </summary> | ||
194 | /// <param name="fileName">Fully qualified filename pointing to a file to open or create.</param> | ||
195 | void OpenLog(string fileName); | ||
196 | |||
197 | /// <summary> | ||
198 | /// The CloseLog method of the Merge object closes the current log file. | ||
199 | /// </summary> | ||
200 | void CloseLog(); | ||
201 | |||
202 | /// <summary> | ||
203 | /// The Log method of the Merge object writes a text string to the currently open log file. | ||
204 | /// </summary> | ||
205 | /// <param name="message">The text string to display.</param> | ||
206 | void Log(string message); | ||
207 | |||
208 | /// <summary> | ||
209 | /// Gets the errors from the last merge operation. | ||
210 | /// </summary> | ||
211 | /// <value>The errors from the last merge operation.</value> | ||
212 | IMsmErrors Errors | ||
213 | { | ||
214 | get; | ||
215 | } | ||
216 | |||
217 | /// <summary> | ||
218 | /// Gets a collection of Dependency objects that enumerates a set of unsatisfied dependencies for the current database. | ||
219 | /// </summary> | ||
220 | /// <value>A collection of Dependency objects that enumerates a set of unsatisfied dependencies for the current database.</value> | ||
221 | object Dependencies | ||
222 | { | ||
223 | get; | ||
224 | } | ||
225 | |||
226 | /// <summary> | ||
227 | /// The Merge method of the Merge object executes a merge of the current database and current | ||
228 | /// module. The merge attaches the components in the module to the feature identified by Feature. | ||
229 | /// The root of the module's directory tree is redirected to the location given by RedirectDir. | ||
230 | /// </summary> | ||
231 | /// <param name="feature">The name of a feature in the database.</param> | ||
232 | /// <param name="redirectDir">The key of an entry in the Directory table of the database. | ||
233 | /// This parameter may be NULL or an empty string.</param> | ||
234 | void Merge(string feature, string redirectDir); | ||
235 | |||
236 | /// <summary> | ||
237 | /// The Connect method of the Merge object connects a module to an additional feature. | ||
238 | /// The module must have already been merged into the database or will be merged into the database. | ||
239 | /// The feature must exist before calling this function. | ||
240 | /// </summary> | ||
241 | /// <param name="feature">The name of a feature already existing in the database.</param> | ||
242 | void Connect(string feature); | ||
243 | |||
244 | /// <summary> | ||
245 | /// The ExtractCAB method of the Merge object extracts the embedded .cab file from a module and | ||
246 | /// saves it as the specified file. The installer creates this file if it does not already exist | ||
247 | /// and overwritten if it does exist. | ||
248 | /// </summary> | ||
249 | /// <param name="fileName">The fully qualified destination file.</param> | ||
250 | void ExtractCAB(string fileName); | ||
251 | |||
252 | /// <summary> | ||
253 | /// The ExtractFiles method of the Merge object extracts the embedded .cab file from a module | ||
254 | /// and then writes those files to the destination directory. | ||
255 | /// </summary> | ||
256 | /// <param name="path">The fully qualified destination directory.</param> | ||
257 | void ExtractFiles(string path); | ||
258 | |||
259 | /// <summary> | ||
260 | /// The MergeEx method of the Merge object is equivalent to the Merge function, except that it | ||
261 | /// takes an extra argument. The Merge method executes a merge of the current database and | ||
262 | /// current module. The merge attaches the components in the module to the feature identified | ||
263 | /// by Feature. The root of the module's directory tree is redirected to the location given by RedirectDir. | ||
264 | /// </summary> | ||
265 | /// <param name="feature">The name of a feature in the database.</param> | ||
266 | /// <param name="redirectDir">The key of an entry in the Directory table of the database. This parameter may | ||
267 | /// be NULL or an empty string.</param> | ||
268 | /// <param name="configuration">The pConfiguration argument is an interface implemented by the client. The argument may | ||
269 | /// be NULL. The presence of this argument indicates that the client is capable of supporting the configuration | ||
270 | /// functionality, but does not obligate the client to provide configuration data for any specific configurable item.</param> | ||
271 | void MergeEx(string feature, string redirectDir, IMsmConfigureModule configuration); | ||
272 | |||
273 | /// <summary> | ||
274 | /// The ExtractFilesEx method of the Merge object extracts the embedded .cab file from a module and | ||
275 | /// then writes those files to the destination directory. | ||
276 | /// </summary> | ||
277 | /// <param name="path">The fully qualified destination directory.</param> | ||
278 | /// <param name="longFileNames">Set to specify using long file names for path segments and final file names.</param> | ||
279 | /// <param name="filePaths">This is a list of fully-qualified paths for the files that were successfully extracted. | ||
280 | /// The list is empty if no files can be extracted. This argument may be null. No list is provided if pFilePaths is null.</param> | ||
281 | void ExtractFilesEx(string path, bool longFileNames, ref IntPtr filePaths); | ||
282 | |||
283 | /// <summary> | ||
284 | /// Gets a collection ConfigurableItem objects, each of which represents a single row from the ModuleConfiguration table. | ||
285 | /// </summary> | ||
286 | /// <value>A collection ConfigurableItem objects, each of which represents a single row from the ModuleConfiguration table.</value> | ||
287 | /// <remarks>Semantically, each interface in the enumerator represents an item that can be configured by the module consumer. | ||
288 | /// The collection is a read-only collection and implements the standard read-only collection interfaces of Item(), Count() and _NewEnum(). | ||
289 | /// The IEnumMsmConfigItems enumerator implements Next(), Skip(), Reset(), and Clone() with the standard semantics.</remarks> | ||
290 | object ConfigurableItems | ||
291 | { | ||
292 | get; | ||
293 | } | ||
294 | |||
295 | /// <summary> | ||
296 | /// The CreateSourceImage method of the Merge object allows the client to extract the files from a module to | ||
297 | /// a source image on disk after a merge, taking into account changes to the module that might have been made | ||
298 | /// during module configuration. The list of files to be extracted is taken from the file table of the module | ||
299 | /// during the merge process. The list of files consists of every file successfully copied from the file table | ||
300 | /// of the module to the target database. File table entries that were not copied due to primary key conflicts | ||
301 | /// with existing rows in the database are not a part of this list. At image creation time, the directory for | ||
302 | /// each of these files comes from the open (post-merge) database. The path specified in the Path parameter is | ||
303 | /// the root of the source image for the install. fLongFileNames determines whether or not long file names are | ||
304 | /// used for both path segments and final file names. The function fails if no database is open, no module is | ||
305 | /// open, or no merge has been performed. | ||
306 | /// </summary> | ||
307 | /// <param name="path">The path of the root of the source image for the install.</param> | ||
308 | /// <param name="longFileNames">Determines whether or not long file names are used for both path segments and final file names. </param> | ||
309 | /// <param name="filePaths">This is a list of fully-qualified paths for the files that were successfully extracted. | ||
310 | /// The list is empty if no files can be extracted. This argument may be null. No list is provided if pFilePaths is null.</param> | ||
311 | void CreateSourceImage(string path, bool longFileNames, ref IntPtr filePaths); | ||
312 | |||
313 | /// <summary> | ||
314 | /// The get_ModuleFiles function implements the ModuleFiles property of the GetFiles object. This function | ||
315 | /// returns the primary keys in the File table of the currently open module. The primary keys are returned | ||
316 | /// as a collection of strings. The module must be opened by a call to the OpenModule function before calling get_ModuleFiles. | ||
317 | /// </summary> | ||
318 | IMsmStrings ModuleFiles | ||
319 | { | ||
320 | get; | ||
321 | } | ||
322 | } | ||
323 | |||
324 | /// <summary> | ||
325 | /// Collection of merge errors. | ||
326 | /// </summary> | ||
327 | [ComImport, Guid("0ADDA82A-2C26-11D2-AD65-00A0C9AF11A6")] | ||
328 | public interface IMsmErrors | ||
329 | { | ||
330 | /// <summary> | ||
331 | /// Gets the IMsmError at the specified index. | ||
332 | /// </summary> | ||
333 | /// <param name="index">The one-based index of the IMsmError to get.</param> | ||
334 | IMsmError this[int index] | ||
335 | { | ||
336 | get; | ||
337 | } | ||
338 | |||
339 | /// <summary> | ||
340 | /// Gets the count of IMsmErrors in this collection. | ||
341 | /// </summary> | ||
342 | /// <value>The count of IMsmErrors in this collection.</value> | ||
343 | int Count | ||
344 | { | ||
345 | get; | ||
346 | } | ||
347 | } | ||
348 | |||
349 | /// <summary> | ||
350 | /// A merge error. | ||
351 | /// </summary> | ||
352 | [ComImport, Guid("0ADDA828-2C26-11D2-AD65-00A0C9AF11A6")] | ||
353 | public interface IMsmError | ||
354 | { | ||
355 | /// <summary> | ||
356 | /// Gets the type of merge error. | ||
357 | /// </summary> | ||
358 | /// <value>The type of merge error.</value> | ||
359 | MsmErrorType Type | ||
360 | { | ||
361 | get; | ||
362 | } | ||
363 | |||
364 | /// <summary> | ||
365 | /// Gets the path information from the merge error. | ||
366 | /// </summary> | ||
367 | /// <value>The path information from the merge error.</value> | ||
368 | string Path | ||
369 | { | ||
370 | get; | ||
371 | } | ||
372 | |||
373 | /// <summary> | ||
374 | /// Gets the language information from the merge error. | ||
375 | /// </summary> | ||
376 | /// <value>The language information from the merge error.</value> | ||
377 | short Language | ||
378 | { | ||
379 | get; | ||
380 | } | ||
381 | |||
382 | /// <summary> | ||
383 | /// Gets the database table from the merge error. | ||
384 | /// </summary> | ||
385 | /// <value>The database table from the merge error.</value> | ||
386 | string DatabaseTable | ||
387 | { | ||
388 | get; | ||
389 | } | ||
390 | |||
391 | /// <summary> | ||
392 | /// Gets the collection of database keys from the merge error. | ||
393 | /// </summary> | ||
394 | /// <value>The collection of database keys from the merge error.</value> | ||
395 | IMsmStrings DatabaseKeys | ||
396 | { | ||
397 | get; | ||
398 | } | ||
399 | |||
400 | /// <summary> | ||
401 | /// Gets the module table from the merge error. | ||
402 | /// </summary> | ||
403 | /// <value>The module table from the merge error.</value> | ||
404 | string ModuleTable | ||
405 | { | ||
406 | get; | ||
407 | } | ||
408 | |||
409 | /// <summary> | ||
410 | /// Gets the collection of module keys from the merge error. | ||
411 | /// </summary> | ||
412 | /// <value>The collection of module keys from the merge error.</value> | ||
413 | IMsmStrings ModuleKeys | ||
414 | { | ||
415 | get; | ||
416 | } | ||
417 | } | ||
418 | |||
419 | /// <summary> | ||
420 | /// A collection of strings. | ||
421 | /// </summary> | ||
422 | [ComImport, Guid("0ADDA827-2C26-11D2-AD65-00A0C9AF11A6")] | ||
423 | public interface IMsmStrings | ||
424 | { | ||
425 | /// <summary> | ||
426 | /// Gets the string at the specified index. | ||
427 | /// </summary> | ||
428 | /// <param name="index">The one-based index of the string to get.</param> | ||
429 | string this[int index] | ||
430 | { | ||
431 | get; | ||
432 | } | ||
433 | |||
434 | /// <summary> | ||
435 | /// Gets the count of strings in this collection. | ||
436 | /// </summary> | ||
437 | /// <value>The count of strings in this collection.</value> | ||
438 | int Count | ||
439 | { | ||
440 | get; | ||
441 | } | ||
442 | } | ||
443 | |||
444 | /// <summary> | ||
445 | /// Callback for configurable merge modules. | ||
446 | /// </summary> | ||
447 | [ComImport, Guid("AC013209-18A7-4851-8A21-2353443D70A0"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] | ||
448 | public interface IMsmConfigureModule | ||
449 | { | ||
450 | /// <summary> | ||
451 | /// Callback to retrieve text data for configurable merge modules. | ||
452 | /// </summary> | ||
453 | /// <param name="name">Name of the data to be retrieved.</param> | ||
454 | /// <param name="configData">The data corresponding to the name.</param> | ||
455 | /// <returns>The error code (HRESULT).</returns> | ||
456 | [PreserveSig] | ||
457 | int ProvideTextData([In, MarshalAs(UnmanagedType.BStr)] string name, [MarshalAs(UnmanagedType.BStr)] out string configData); | ||
458 | |||
459 | /// <summary> | ||
460 | /// Callback to retrieve integer data for configurable merge modules. | ||
461 | /// </summary> | ||
462 | /// <param name="name">Name of the data to be retrieved.</param> | ||
463 | /// <param name="configData">The data corresponding to the name.</param> | ||
464 | /// <returns>The error code (HRESULT).</returns> | ||
465 | [PreserveSig] | ||
466 | int ProvideIntegerData([In, MarshalAs(UnmanagedType.BStr)] string name, out int configData); | ||
467 | } | ||
468 | |||
469 | /// <summary> | ||
470 | /// Merge merge modules into an MSI file. | ||
471 | /// </summary> | ||
472 | [ComImport, Guid("F94985D5-29F9-4743-9805-99BC3F35B678")] | ||
473 | public class MsmMerge2 | ||
474 | { | ||
475 | } | ||
476 | |||
477 | /// <summary> | ||
478 | /// Defines the standard COM IClassFactory interface. | ||
479 | /// </summary> | ||
480 | [ComImport, Guid("00000001-0000-0000-C000-000000000046")] | ||
481 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | ||
482 | public interface IClassFactory | ||
483 | { | ||
484 | [return:MarshalAs(UnmanagedType.IUnknown)] | ||
485 | object CreateInstance(IntPtr unkOuter, [MarshalAs(UnmanagedType.LPStruct)] Guid iid); | ||
486 | } | ||
487 | |||
488 | /// <summary> | ||
489 | /// Contains native methods for merge operations. | ||
490 | /// </summary> | ||
491 | public class MsmInterop | ||
492 | { | ||
493 | [DllImport("mergemod.dll", EntryPoint="DllGetClassObject", PreserveSig=false)] | ||
494 | [return: MarshalAs(UnmanagedType.IUnknown)] | ||
495 | private static extern object MergeModGetClassObject([MarshalAs(UnmanagedType.LPStruct)] Guid clsid, [MarshalAs(UnmanagedType.LPStruct)] Guid iid); | ||
496 | |||
497 | /// <summary> | ||
498 | /// Load the merge object directly from a local mergemod.dll without going through COM registration. | ||
499 | /// </summary> | ||
500 | /// <returns>Merge interface.</returns> | ||
501 | public static IMsmMerge2 GetMsmMerge() | ||
502 | { | ||
503 | IClassFactory classFactory = (IClassFactory) MergeModGetClassObject(typeof(MsmMerge2).GUID, typeof(IClassFactory).GUID); | ||
504 | return (IMsmMerge2) classFactory.CreateInstance(IntPtr.Zero, typeof(IMsmMerge2).GUID); | ||
505 | } | ||
506 | } | ||
507 | } | ||
diff --git a/src/WixToolset.Core.Native/WixToolset.Core.Native.csproj b/src/WixToolset.Core.Native/WixToolset.Core.Native.csproj index e2431fef..c93ff5bc 100644 --- a/src/WixToolset.Core.Native/WixToolset.Core.Native.csproj +++ b/src/WixToolset.Core.Native/WixToolset.Core.Native.csproj | |||
@@ -9,7 +9,7 @@ | |||
9 | </PropertyGroup> | 9 | </PropertyGroup> |
10 | 10 | ||
11 | <ItemGroup> | 11 | <ItemGroup> |
12 | <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63102-01" PrivateAssets="All" /> | 12 | <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" /> |
13 | <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" /> | 13 | <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" /> |
14 | </ItemGroup> | 14 | </ItemGroup> |
15 | 15 | ||
diff --git a/src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj b/src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj index 4e02073e..47396ead 100644 --- a/src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj +++ b/src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | <ItemGroup> | 19 | <ItemGroup> |
20 | <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /> | 20 | <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /> |
21 | <PackageReference Include="xunit" Version="2.4.0" /> | 21 | <PackageReference Include="xunit" Version="2.4.1" /> |
22 | <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /> | 22 | <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" /> |
23 | </ItemGroup> | 23 | </ItemGroup> |
24 | </Project> | 24 | </Project> |