diff options
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Msi/Interop/MsiInterop.cs')
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Msi/Interop/MsiInterop.cs | 697 |
1 files changed, 697 insertions, 0 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Msi/Interop/MsiInterop.cs b/src/WixToolset.Core.WindowsInstaller/Msi/Interop/MsiInterop.cs new file mode 100644 index 00000000..054289ee --- /dev/null +++ b/src/WixToolset.Core.WindowsInstaller/Msi/Interop/MsiInterop.cs | |||
@@ -0,0 +1,697 @@ | |||
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 | ||
3 | namespace 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 | ||