diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-10-18 22:37:12 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-10-24 20:17:06 -0500 |
| commit | c9d14eb51e4b8458fd5e2738fcc7d1c1129ad22e (patch) | |
| tree | 4d0d29316adce60e5a568806b478fc3e4d88d134 /src/WixToolset.Mba.Core | |
| parent | dcf13e60f0b165a8942e7e7d98f5f0702f7d1e84 (diff) | |
| download | wix-c9d14eb51e4b8458fd5e2738fcc7d1c1129ad22e.tar.gz wix-c9d14eb51e4b8458fd5e2738fcc7d1c1129ad22e.tar.bz2 wix-c9d14eb51e4b8458fd5e2738fcc7d1c1129ad22e.zip | |
WIXFEAT:6210 Change data type of versions to strings.
Diffstat (limited to 'src/WixToolset.Mba.Core')
| -rw-r--r-- | src/WixToolset.Mba.Core/BootstrapperApplication.cs | 24 | ||||
| -rw-r--r-- | src/WixToolset.Mba.Core/Engine.cs | 86 | ||||
| -rw-r--r-- | src/WixToolset.Mba.Core/EventArgs.cs | 36 | ||||
| -rw-r--r-- | src/WixToolset.Mba.Core/IBootstrapperApplication.cs | 12 | ||||
| -rw-r--r-- | src/WixToolset.Mba.Core/IBootstrapperEngine.cs | 5 | ||||
| -rw-r--r-- | src/WixToolset.Mba.Core/IEngine.cs | 19 | ||||
| -rw-r--r-- | src/WixToolset.Mba.Core/PackageInfo.cs | 4 |
7 files changed, 121 insertions, 65 deletions
diff --git a/src/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/WixToolset.Mba.Core/BootstrapperApplication.cs index 9ee909dc..472c553a 100644 --- a/src/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/BootstrapperApplication.cs | |||
| @@ -1130,9 +1130,9 @@ namespace WixToolset.Mba.Core | |||
| 1130 | return args.HResult; | 1130 | return args.HResult; |
| 1131 | } | 1131 | } |
| 1132 | 1132 | ||
| 1133 | int IBootstrapperApplication.OnDetectForwardCompatibleBundle(string wzBundleId, RelationType relationType, string wzBundleTag, bool fPerMachine, long version, ref bool fCancel, ref bool fIgnoreBundle) | 1133 | int IBootstrapperApplication.OnDetectForwardCompatibleBundle(string wzBundleId, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, ref bool fCancel, ref bool fIgnoreBundle) |
| 1134 | { | 1134 | { |
| 1135 | DetectForwardCompatibleBundleEventArgs args = new DetectForwardCompatibleBundleEventArgs(wzBundleId, relationType, wzBundleTag, fPerMachine, version, fCancel, fIgnoreBundle); | 1135 | DetectForwardCompatibleBundleEventArgs args = new DetectForwardCompatibleBundleEventArgs(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fCancel, fIgnoreBundle); |
| 1136 | this.OnDetectForwardCompatibleBundle(args); | 1136 | this.OnDetectForwardCompatibleBundle(args); |
| 1137 | 1137 | ||
| 1138 | fCancel = args.Cancel; | 1138 | fCancel = args.Cancel; |
| @@ -1150,9 +1150,9 @@ namespace WixToolset.Mba.Core | |||
| 1150 | return args.HResult; | 1150 | return args.HResult; |
| 1151 | } | 1151 | } |
| 1152 | 1152 | ||
| 1153 | int IBootstrapperApplication.OnDetectUpdate(string wzUpdateLocation, long dw64Size, long dw64Version, string wzTitle, string wzSummary, string wzContentType, string wzContent, ref bool fCancel, ref bool fStopProcessingUpdates) | 1153 | int IBootstrapperApplication.OnDetectUpdate(string wzUpdateLocation, long dw64Size, string wzVersion, string wzTitle, string wzSummary, string wzContentType, string wzContent, ref bool fCancel, ref bool fStopProcessingUpdates) |
| 1154 | { | 1154 | { |
| 1155 | DetectUpdateEventArgs args = new DetectUpdateEventArgs(wzUpdateLocation, dw64Size, dw64Version, wzTitle, wzSummary, wzContentType, wzContent, fCancel, fStopProcessingUpdates); | 1155 | DetectUpdateEventArgs args = new DetectUpdateEventArgs(wzUpdateLocation, dw64Size, wzVersion, wzTitle, wzSummary, wzContentType, wzContent, fCancel, fStopProcessingUpdates); |
| 1156 | this.OnDetectUpdate(args); | 1156 | this.OnDetectUpdate(args); |
| 1157 | 1157 | ||
| 1158 | fCancel = args.Cancel; | 1158 | fCancel = args.Cancel; |
| @@ -1169,9 +1169,9 @@ namespace WixToolset.Mba.Core | |||
| 1169 | return args.HResult; | 1169 | return args.HResult; |
| 1170 | } | 1170 | } |
| 1171 | 1171 | ||
| 1172 | int IBootstrapperApplication.OnDetectRelatedBundle(string wzProductCode, RelationType relationType, string wzBundleTag, bool fPerMachine, long version, RelatedOperation operation, ref bool fCancel) | 1172 | int IBootstrapperApplication.OnDetectRelatedBundle(string wzProductCode, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, RelatedOperation operation, ref bool fCancel) |
| 1173 | { | 1173 | { |
| 1174 | DetectRelatedBundleEventArgs args = new DetectRelatedBundleEventArgs(wzProductCode, relationType, wzBundleTag, fPerMachine, version, operation, fCancel); | 1174 | DetectRelatedBundleEventArgs args = new DetectRelatedBundleEventArgs(wzProductCode, relationType, wzBundleTag, fPerMachine, wzVersion, operation, fCancel); |
| 1175 | this.OnDetectRelatedBundle(args); | 1175 | this.OnDetectRelatedBundle(args); |
| 1176 | 1176 | ||
| 1177 | fCancel = args.Cancel; | 1177 | fCancel = args.Cancel; |
| @@ -1187,18 +1187,18 @@ namespace WixToolset.Mba.Core | |||
| 1187 | return args.HResult; | 1187 | return args.HResult; |
| 1188 | } | 1188 | } |
| 1189 | 1189 | ||
| 1190 | int IBootstrapperApplication.OnDetectCompatibleMsiPackage(string wzPackageId, string wzCompatiblePackageId, long dw64CompatiblePackageVersion, ref bool fCancel) | 1190 | int IBootstrapperApplication.OnDetectCompatibleMsiPackage(string wzPackageId, string wzCompatiblePackageId, string wzCompatiblePackageVersion, ref bool fCancel) |
| 1191 | { | 1191 | { |
| 1192 | DetectCompatibleMsiPackageEventArgs args = new DetectCompatibleMsiPackageEventArgs(wzPackageId, wzCompatiblePackageId, dw64CompatiblePackageVersion, fCancel); | 1192 | DetectCompatibleMsiPackageEventArgs args = new DetectCompatibleMsiPackageEventArgs(wzPackageId, wzCompatiblePackageId, wzCompatiblePackageVersion, fCancel); |
| 1193 | this.OnDetectCompatibleMsiPackage(args); | 1193 | this.OnDetectCompatibleMsiPackage(args); |
| 1194 | 1194 | ||
| 1195 | fCancel = args.Cancel; | 1195 | fCancel = args.Cancel; |
| 1196 | return args.HResult; | 1196 | return args.HResult; |
| 1197 | } | 1197 | } |
| 1198 | 1198 | ||
| 1199 | int IBootstrapperApplication.OnDetectRelatedMsiPackage(string wzPackageId, string wzUpgradeCode, string wzProductCode, bool fPerMachine, long version, RelatedOperation operation, ref bool fCancel) | 1199 | int IBootstrapperApplication.OnDetectRelatedMsiPackage(string wzPackageId, string wzUpgradeCode, string wzProductCode, bool fPerMachine, string wzVersion, RelatedOperation operation, ref bool fCancel) |
| 1200 | { | 1200 | { |
| 1201 | DetectRelatedMsiPackageEventArgs args = new DetectRelatedMsiPackageEventArgs(wzPackageId, wzUpgradeCode, wzProductCode, fPerMachine, version, operation, fCancel); | 1201 | DetectRelatedMsiPackageEventArgs args = new DetectRelatedMsiPackageEventArgs(wzPackageId, wzUpgradeCode, wzProductCode, fPerMachine, wzVersion, operation, fCancel); |
| 1202 | this.OnDetectRelatedMsiPackage(args); | 1202 | this.OnDetectRelatedMsiPackage(args); |
| 1203 | 1203 | ||
| 1204 | fCancel = args.Cancel; | 1204 | fCancel = args.Cancel; |
| @@ -1268,9 +1268,9 @@ namespace WixToolset.Mba.Core | |||
| 1268 | return args.HResult; | 1268 | return args.HResult; |
| 1269 | } | 1269 | } |
| 1270 | 1270 | ||
| 1271 | int IBootstrapperApplication.OnPlanCompatibleMsiPackageBegin(string wzPackageId, string wzCompatiblePackageId, long dw64CompatiblePackageVersion, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel) | 1271 | int IBootstrapperApplication.OnPlanCompatibleMsiPackageBegin(string wzPackageId, string wzCompatiblePackageId, string wzCompatiblePackageVersion, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel) |
| 1272 | { | 1272 | { |
| 1273 | PlanCompatibleMsiPackageBeginEventArgs args = new PlanCompatibleMsiPackageBeginEventArgs(wzPackageId, wzCompatiblePackageId, dw64CompatiblePackageVersion, recommendedState, pRequestedState, fCancel); | 1273 | PlanCompatibleMsiPackageBeginEventArgs args = new PlanCompatibleMsiPackageBeginEventArgs(wzPackageId, wzCompatiblePackageId, wzCompatiblePackageVersion, recommendedState, pRequestedState, fCancel); |
| 1274 | this.OnPlanCompatibleMsiPackageBegin(args); | 1274 | this.OnPlanCompatibleMsiPackageBegin(args); |
| 1275 | 1275 | ||
| 1276 | pRequestedState = args.State; | 1276 | pRequestedState = args.State; |
diff --git a/src/WixToolset.Mba.Core/Engine.cs b/src/WixToolset.Mba.Core/Engine.cs index 98427cfa..e3ad097a 100644 --- a/src/WixToolset.Mba.Core/Engine.cs +++ b/src/WixToolset.Mba.Core/Engine.cs | |||
| @@ -178,15 +178,21 @@ namespace WixToolset.Mba.Core | |||
| 178 | } | 178 | } |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | public Version GetVariableVersion(string name) | 181 | public string GetVariableVersion(string name) |
| 182 | { | 182 | { |
| 183 | int ret = this.engine.GetVariableVersion(name, out long value); | 183 | int length; |
| 184 | if (NativeMethods.S_OK != ret) | 184 | IntPtr pUniString = this.getVersionVariable(name, out length); |
| 185 | try | ||
| 185 | { | 186 | { |
| 186 | throw new Win32Exception(ret); | 187 | return Marshal.PtrToStringUni(pUniString, length); |
| 188 | } | ||
| 189 | finally | ||
| 190 | { | ||
| 191 | if (IntPtr.Zero != pUniString) | ||
| 192 | { | ||
| 193 | Marshal.FreeCoTaskMem(pUniString); | ||
| 194 | } | ||
| 187 | } | 195 | } |
| 188 | |||
| 189 | return LongToVersion(value); | ||
| 190 | } | 196 | } |
| 191 | 197 | ||
| 192 | public void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments) | 198 | public void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments) |
| @@ -224,12 +230,12 @@ namespace WixToolset.Mba.Core | |||
| 224 | this.engine.SetDownloadSource(packageOrContainerId, payloadId, url, user, password); | 230 | this.engine.SetDownloadSource(packageOrContainerId, payloadId, url, user, password); |
| 225 | } | 231 | } |
| 226 | 232 | ||
| 227 | public void SetVariable(string name, long value) | 233 | public void SetVariableNumeric(string name, long value) |
| 228 | { | 234 | { |
| 229 | this.engine.SetVariableNumeric(name, value); | 235 | this.engine.SetVariableNumeric(name, value); |
| 230 | } | 236 | } |
| 231 | 237 | ||
| 232 | public void SetVariable(string name, SecureString value, bool formatted) | 238 | public void SetVariableString(string name, SecureString value, bool formatted) |
| 233 | { | 239 | { |
| 234 | IntPtr pValue = Marshal.SecureStringToCoTaskMemUnicode(value); | 240 | IntPtr pValue = Marshal.SecureStringToCoTaskMemUnicode(value); |
| 235 | try | 241 | try |
| @@ -242,7 +248,7 @@ namespace WixToolset.Mba.Core | |||
| 242 | } | 248 | } |
| 243 | } | 249 | } |
| 244 | 250 | ||
| 245 | public void SetVariable(string name, string value, bool formatted) | 251 | public void SetVariableString(string name, string value, bool formatted) |
| 246 | { | 252 | { |
| 247 | IntPtr pValue = Marshal.StringToCoTaskMemUni(value); | 253 | IntPtr pValue = Marshal.StringToCoTaskMemUni(value); |
| 248 | try | 254 | try |
| @@ -255,10 +261,17 @@ namespace WixToolset.Mba.Core | |||
| 255 | } | 261 | } |
| 256 | } | 262 | } |
| 257 | 263 | ||
| 258 | public void SetVariable(string name, Version value) | 264 | public void SetVariableVersion(string name, string value) |
| 259 | { | 265 | { |
| 260 | long version = VersionToLong(value); | 266 | IntPtr pValue = Marshal.StringToCoTaskMemUni(value); |
| 261 | this.engine.SetVariableVersion(name, version); | 267 | try |
| 268 | { | ||
| 269 | this.engine.SetVariableVersion(name, pValue); | ||
| 270 | } | ||
| 271 | finally | ||
| 272 | { | ||
| 273 | Marshal.FreeCoTaskMem(pValue); | ||
| 274 | } | ||
| 262 | } | 275 | } |
| 263 | 276 | ||
| 264 | public int SendEmbeddedError(int errorCode, string message, int uiHint) | 277 | public int SendEmbeddedError(int errorCode, string message, int uiHint) |
| @@ -330,6 +343,55 @@ namespace WixToolset.Mba.Core | |||
| 330 | } | 343 | } |
| 331 | 344 | ||
| 332 | /// <summary> | 345 | /// <summary> |
| 346 | /// Gets the variable given by <paramref name="name"/> as a version string. | ||
| 347 | /// </summary> | ||
| 348 | /// <param name="name">The name of the variable to get.</param> | ||
| 349 | /// <param name="length">The length of the Unicode string.</param> | ||
| 350 | /// <returns>The value by a pointer to a Unicode string. Must be freed by Marshal.FreeCoTaskMem.</returns> | ||
| 351 | /// <exception cref="Exception">An error occurred getting the variable.</exception> | ||
| 352 | internal IntPtr getVersionVariable(string name, out int length) | ||
| 353 | { | ||
| 354 | int capacity = InitialBufferSize; | ||
| 355 | bool success = false; | ||
| 356 | IntPtr pValue = Marshal.AllocCoTaskMem(capacity * UnicodeEncoding.CharSize); | ||
| 357 | try | ||
| 358 | { | ||
| 359 | // Get the size of the buffer. | ||
| 360 | int ret = this.engine.GetVariableVersion(name, pValue, ref capacity); | ||
| 361 | if (NativeMethods.E_INSUFFICIENT_BUFFER == ret || NativeMethods.E_MOREDATA == ret) | ||
| 362 | { | ||
| 363 | // Don't need to add 1 for the null terminator, the engine already includes that. | ||
| 364 | pValue = Marshal.ReAllocCoTaskMem(pValue, capacity * UnicodeEncoding.CharSize); | ||
| 365 | ret = this.engine.GetVariableVersion(name, pValue, ref capacity); | ||
| 366 | } | ||
| 367 | |||
| 368 | if (NativeMethods.S_OK != ret) | ||
| 369 | { | ||
| 370 | throw Marshal.GetExceptionForHR(ret); | ||
| 371 | } | ||
| 372 | |||
| 373 | // The engine only returns the exact length of the string if the buffer was too small, so calculate it ourselves. | ||
| 374 | for (length = 0; length < capacity; ++length) | ||
| 375 | { | ||
| 376 | if (0 == Marshal.ReadInt16(pValue, length * UnicodeEncoding.CharSize)) | ||
| 377 | { | ||
| 378 | break; | ||
| 379 | } | ||
| 380 | } | ||
| 381 | |||
| 382 | success = true; | ||
| 383 | return pValue; | ||
| 384 | } | ||
| 385 | finally | ||
| 386 | { | ||
| 387 | if (!success && IntPtr.Zero != pValue) | ||
| 388 | { | ||
| 389 | Marshal.FreeCoTaskMem(pValue); | ||
| 390 | } | ||
| 391 | } | ||
| 392 | } | ||
| 393 | |||
| 394 | /// <summary> | ||
| 333 | /// Initialize a SecureString with the given Unicode string. | 395 | /// Initialize a SecureString with the given Unicode string. |
| 334 | /// </summary> | 396 | /// </summary> |
| 335 | /// <param name="pUniString">Pointer to Unicode string.</param> | 397 | /// <param name="pUniString">Pointer to Unicode string.</param> |
diff --git a/src/WixToolset.Mba.Core/EventArgs.cs b/src/WixToolset.Mba.Core/EventArgs.cs index e739a853..71bd15e1 100644 --- a/src/WixToolset.Mba.Core/EventArgs.cs +++ b/src/WixToolset.Mba.Core/EventArgs.cs | |||
| @@ -241,14 +241,14 @@ namespace WixToolset.Mba.Core | |||
| 241 | /// <param name="version">The version of the forward compatible bundle detected.</param> | 241 | /// <param name="version">The version of the forward compatible bundle detected.</param> |
| 242 | /// <param name="cancelRecommendation">The cancel recommendation from the engine.</param> | 242 | /// <param name="cancelRecommendation">The cancel recommendation from the engine.</param> |
| 243 | /// <param name="ignoreBundleRecommendation">The ignore recommendation from the engine.</param> | 243 | /// <param name="ignoreBundleRecommendation">The ignore recommendation from the engine.</param> |
| 244 | public DetectForwardCompatibleBundleEventArgs(string bundleId, RelationType relationType, string bundleTag, bool perMachine, long version, bool cancelRecommendation, bool ignoreBundleRecommendation) | 244 | public DetectForwardCompatibleBundleEventArgs(string bundleId, RelationType relationType, string bundleTag, bool perMachine, string version, bool cancelRecommendation, bool ignoreBundleRecommendation) |
| 245 | : base(cancelRecommendation) | 245 | : base(cancelRecommendation) |
| 246 | { | 246 | { |
| 247 | this.BundleId = bundleId; | 247 | this.BundleId = bundleId; |
| 248 | this.RelationType = relationType; | 248 | this.RelationType = relationType; |
| 249 | this.BundleTag = bundleTag; | 249 | this.BundleTag = bundleTag; |
| 250 | this.PerMachine = perMachine; | 250 | this.PerMachine = perMachine; |
| 251 | this.Version = Engine.LongToVersion(version); | 251 | this.Version = version; |
| 252 | this.IgnoreBundle = ignoreBundleRecommendation; | 252 | this.IgnoreBundle = ignoreBundleRecommendation; |
| 253 | } | 253 | } |
| 254 | 254 | ||
| @@ -275,7 +275,7 @@ namespace WixToolset.Mba.Core | |||
| 275 | /// <summary> | 275 | /// <summary> |
| 276 | /// Gets the version of the forward compatible bundle detected. | 276 | /// Gets the version of the forward compatible bundle detected. |
| 277 | /// </summary> | 277 | /// </summary> |
| 278 | public Version Version { get; private set; } | 278 | public string Version { get; private set; } |
| 279 | 279 | ||
| 280 | /// <summary> | 280 | /// <summary> |
| 281 | /// Instructs the engine whether to use the forward compatible bundle. | 281 | /// Instructs the engine whether to use the forward compatible bundle. |
| @@ -330,12 +330,12 @@ namespace WixToolset.Mba.Core | |||
| 330 | /// <param name="content">The content of the updated bundle.</param> | 330 | /// <param name="content">The content of the updated bundle.</param> |
| 331 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> | 331 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> |
| 332 | /// <param name="stopRecommendation">The recommendation from the engine.</param> | 332 | /// <param name="stopRecommendation">The recommendation from the engine.</param> |
| 333 | public DetectUpdateEventArgs(string updateLocation, long size, long version, string title, string summary, string contentType, string content, bool cancelRecommendation, bool stopRecommendation) | 333 | public DetectUpdateEventArgs(string updateLocation, long size, string version, string title, string summary, string contentType, string content, bool cancelRecommendation, bool stopRecommendation) |
| 334 | : base(cancelRecommendation) | 334 | : base(cancelRecommendation) |
| 335 | { | 335 | { |
| 336 | this.UpdateLocation = updateLocation; | 336 | this.UpdateLocation = updateLocation; |
| 337 | this.Size = size; | 337 | this.Size = size; |
| 338 | this.Version = Engine.LongToVersion(version); | 338 | this.Version = version; |
| 339 | this.Title = title; | 339 | this.Title = title; |
| 340 | this.Summary = summary; | 340 | this.Summary = summary; |
| 341 | this.ContentType = contentType; | 341 | this.ContentType = contentType; |
| @@ -356,7 +356,7 @@ namespace WixToolset.Mba.Core | |||
| 356 | /// <summary> | 356 | /// <summary> |
| 357 | /// Gets the version of the updated bundle. | 357 | /// Gets the version of the updated bundle. |
| 358 | /// </summary> | 358 | /// </summary> |
| 359 | public Version Version { get; private set; } | 359 | public string Version { get; private set; } |
| 360 | 360 | ||
| 361 | /// <summary> | 361 | /// <summary> |
| 362 | /// Gets the title of the the updated bundle. | 362 | /// Gets the title of the the updated bundle. |
| @@ -423,14 +423,14 @@ namespace WixToolset.Mba.Core | |||
| 423 | /// <param name="version">The version of the related bundle detected.</param> | 423 | /// <param name="version">The version of the related bundle detected.</param> |
| 424 | /// <param name="operation">The operation that will be taken on the detected bundle.</param> | 424 | /// <param name="operation">The operation that will be taken on the detected bundle.</param> |
| 425 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> | 425 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> |
| 426 | public DetectRelatedBundleEventArgs(string productCode, RelationType relationType, string bundleTag, bool perMachine, long version, RelatedOperation operation, bool cancelRecommendation) | 426 | public DetectRelatedBundleEventArgs(string productCode, RelationType relationType, string bundleTag, bool perMachine, string version, RelatedOperation operation, bool cancelRecommendation) |
| 427 | : base(cancelRecommendation) | 427 | : base(cancelRecommendation) |
| 428 | { | 428 | { |
| 429 | this.ProductCode = productCode; | 429 | this.ProductCode = productCode; |
| 430 | this.RelationType = relationType; | 430 | this.RelationType = relationType; |
| 431 | this.BundleTag = bundleTag; | 431 | this.BundleTag = bundleTag; |
| 432 | this.PerMachine = perMachine; | 432 | this.PerMachine = perMachine; |
| 433 | this.Version = Engine.LongToVersion(version); | 433 | this.Version = version; |
| 434 | this.Operation = operation; | 434 | this.Operation = operation; |
| 435 | } | 435 | } |
| 436 | 436 | ||
| @@ -457,7 +457,7 @@ namespace WixToolset.Mba.Core | |||
| 457 | /// <summary> | 457 | /// <summary> |
| 458 | /// Gets the version of the related bundle detected. | 458 | /// Gets the version of the related bundle detected. |
| 459 | /// </summary> | 459 | /// </summary> |
| 460 | public Version Version { get; private set; } | 460 | public string Version { get; private set; } |
| 461 | 461 | ||
| 462 | /// <summary> | 462 | /// <summary> |
| 463 | /// Gets the operation that will be taken on the detected bundle. | 463 | /// Gets the operation that will be taken on the detected bundle. |
| @@ -501,12 +501,12 @@ namespace WixToolset.Mba.Core | |||
| 501 | /// <param name="compatiblePackageId">The identity of the compatible package that was detected.</param> | 501 | /// <param name="compatiblePackageId">The identity of the compatible package that was detected.</param> |
| 502 | /// <param name="compatiblePackageVersion">The version of the compatible package that was detected.</param> | 502 | /// <param name="compatiblePackageVersion">The version of the compatible package that was detected.</param> |
| 503 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> | 503 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> |
| 504 | public DetectCompatibleMsiPackageEventArgs(string packageId, string compatiblePackageId, long compatiblePackageVersion, bool cancelRecommendation) | 504 | public DetectCompatibleMsiPackageEventArgs(string packageId, string compatiblePackageId, string compatiblePackageVersion, bool cancelRecommendation) |
| 505 | : base(cancelRecommendation) | 505 | : base(cancelRecommendation) |
| 506 | { | 506 | { |
| 507 | this.PackageId = packageId; | 507 | this.PackageId = packageId; |
| 508 | this.CompatiblePackageId = compatiblePackageId; | 508 | this.CompatiblePackageId = compatiblePackageId; |
| 509 | this.CompatiblePackageVersion = Engine.LongToVersion(compatiblePackageVersion); | 509 | this.CompatiblePackageVersion = compatiblePackageVersion; |
| 510 | } | 510 | } |
| 511 | 511 | ||
| 512 | /// <summary> | 512 | /// <summary> |
| @@ -522,7 +522,7 @@ namespace WixToolset.Mba.Core | |||
| 522 | /// <summary> | 522 | /// <summary> |
| 523 | /// Gets the version of the compatible package that was detected. | 523 | /// Gets the version of the compatible package that was detected. |
| 524 | /// </summary> | 524 | /// </summary> |
| 525 | public Version CompatiblePackageVersion { get; private set; } | 525 | public string CompatiblePackageVersion { get; private set; } |
| 526 | } | 526 | } |
| 527 | 527 | ||
| 528 | /// <summary> | 528 | /// <summary> |
| @@ -541,14 +541,14 @@ namespace WixToolset.Mba.Core | |||
| 541 | /// <param name="version">The version of the related package detected.</param> | 541 | /// <param name="version">The version of the related package detected.</param> |
| 542 | /// <param name="operation">The operation that will be taken on the detected package.</param> | 542 | /// <param name="operation">The operation that will be taken on the detected package.</param> |
| 543 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> | 543 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> |
| 544 | public DetectRelatedMsiPackageEventArgs(string packageId, string upgradeCode, string productCode, bool perMachine, long version, RelatedOperation operation, bool cancelRecommendation) | 544 | public DetectRelatedMsiPackageEventArgs(string packageId, string upgradeCode, string productCode, bool perMachine, string version, RelatedOperation operation, bool cancelRecommendation) |
| 545 | : base(cancelRecommendation) | 545 | : base(cancelRecommendation) |
| 546 | { | 546 | { |
| 547 | this.PackageId = packageId; | 547 | this.PackageId = packageId; |
| 548 | this.UpgradeCode = upgradeCode; | 548 | this.UpgradeCode = upgradeCode; |
| 549 | this.ProductCode = productCode; | 549 | this.ProductCode = productCode; |
| 550 | this.PerMachine = perMachine; | 550 | this.PerMachine = perMachine; |
| 551 | this.Version = Engine.LongToVersion(version); | 551 | this.Version = version; |
| 552 | this.Operation = operation; | 552 | this.Operation = operation; |
| 553 | } | 553 | } |
| 554 | 554 | ||
| @@ -575,7 +575,7 @@ namespace WixToolset.Mba.Core | |||
| 575 | /// <summary> | 575 | /// <summary> |
| 576 | /// Gets the version of the related package detected. | 576 | /// Gets the version of the related package detected. |
| 577 | /// </summary> | 577 | /// </summary> |
| 578 | public Version Version { get; private set; } | 578 | public string Version { get; private set; } |
| 579 | 579 | ||
| 580 | /// <summary> | 580 | /// <summary> |
| 581 | /// Gets the operation that will be taken on the detected package. | 581 | /// Gets the operation that will be taken on the detected package. |
| @@ -813,12 +813,12 @@ namespace WixToolset.Mba.Core | |||
| 813 | /// <param name="recommendedState">The recommended request state for the compatible package.</param> | 813 | /// <param name="recommendedState">The recommended request state for the compatible package.</param> |
| 814 | /// <param name="state">The requested state for the compatible package.</param> | 814 | /// <param name="state">The requested state for the compatible package.</param> |
| 815 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> | 815 | /// <param name="cancelRecommendation">The recommendation from the engine.</param> |
| 816 | public PlanCompatibleMsiPackageBeginEventArgs(string packageId, string compatiblePackageId, long compatiblePackageVersion, RequestState recommendedState, RequestState state, bool cancelRecommendation) | 816 | public PlanCompatibleMsiPackageBeginEventArgs(string packageId, string compatiblePackageId, string compatiblePackageVersion, RequestState recommendedState, RequestState state, bool cancelRecommendation) |
| 817 | : base(cancelRecommendation) | 817 | : base(cancelRecommendation) |
| 818 | { | 818 | { |
| 819 | this.PackageId = packageId; | 819 | this.PackageId = packageId; |
| 820 | this.CompatiblePackageId = compatiblePackageId; | 820 | this.CompatiblePackageId = compatiblePackageId; |
| 821 | this.CompatiblePackageVersion = Engine.LongToVersion(compatiblePackageVersion); | 821 | this.CompatiblePackageVersion = compatiblePackageVersion; |
| 822 | this.RecommendedState = recommendedState; | 822 | this.RecommendedState = recommendedState; |
| 823 | this.State = state; | 823 | this.State = state; |
| 824 | } | 824 | } |
| @@ -836,7 +836,7 @@ namespace WixToolset.Mba.Core | |||
| 836 | /// <summary> | 836 | /// <summary> |
| 837 | /// Gets the version of the compatible package detected. | 837 | /// Gets the version of the compatible package detected. |
| 838 | /// </summary> | 838 | /// </summary> |
| 839 | public Version CompatiblePackageVersion { get; private set; } | 839 | public string CompatiblePackageVersion { get; private set; } |
| 840 | 840 | ||
| 841 | /// <summary> | 841 | /// <summary> |
| 842 | /// Gets the recommended state to use for the compatible package for planning. | 842 | /// Gets the recommended state to use for the compatible package for planning. |
diff --git a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs index fa655282..0d79122d 100644 --- a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs | |||
| @@ -45,7 +45,7 @@ namespace WixToolset.Mba.Core | |||
| 45 | [MarshalAs(UnmanagedType.U4)] RelationType relationType, | 45 | [MarshalAs(UnmanagedType.U4)] RelationType relationType, |
| 46 | [MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag, | 46 | [MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag, |
| 47 | [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, | 47 | [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, |
| 48 | [MarshalAs(UnmanagedType.U8)] long dw64Version, | 48 | [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, |
| 49 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, | 49 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, |
| 50 | [MarshalAs(UnmanagedType.Bool)] ref bool fIgnoreBundle | 50 | [MarshalAs(UnmanagedType.Bool)] ref bool fIgnoreBundle |
| 51 | ); | 51 | ); |
| @@ -63,7 +63,7 @@ namespace WixToolset.Mba.Core | |||
| 63 | int OnDetectUpdate( | 63 | int OnDetectUpdate( |
| 64 | [MarshalAs(UnmanagedType.LPWStr)] string wzUpdateLocation, | 64 | [MarshalAs(UnmanagedType.LPWStr)] string wzUpdateLocation, |
| 65 | [MarshalAs(UnmanagedType.U8)] long dw64Size, | 65 | [MarshalAs(UnmanagedType.U8)] long dw64Size, |
| 66 | [MarshalAs(UnmanagedType.U8)] long dw64Version, | 66 | [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, |
| 67 | [MarshalAs(UnmanagedType.LPWStr)] string wzTitle, | 67 | [MarshalAs(UnmanagedType.LPWStr)] string wzTitle, |
| 68 | [MarshalAs(UnmanagedType.LPWStr)] string wzSummary, | 68 | [MarshalAs(UnmanagedType.LPWStr)] string wzSummary, |
| 69 | [MarshalAs(UnmanagedType.LPWStr)] string wzContentType, | 69 | [MarshalAs(UnmanagedType.LPWStr)] string wzContentType, |
| @@ -86,7 +86,7 @@ namespace WixToolset.Mba.Core | |||
| 86 | [MarshalAs(UnmanagedType.U4)] RelationType relationType, | 86 | [MarshalAs(UnmanagedType.U4)] RelationType relationType, |
| 87 | [MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag, | 87 | [MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag, |
| 88 | [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, | 88 | [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, |
| 89 | [MarshalAs(UnmanagedType.U8)] long dw64Version, | 89 | [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, |
| 90 | [MarshalAs(UnmanagedType.U4)] RelatedOperation operation, | 90 | [MarshalAs(UnmanagedType.U4)] RelatedOperation operation, |
| 91 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | 91 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel |
| 92 | ); | 92 | ); |
| @@ -103,7 +103,7 @@ namespace WixToolset.Mba.Core | |||
| 103 | int OnDetectCompatibleMsiPackage( | 103 | int OnDetectCompatibleMsiPackage( |
| 104 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | 104 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, |
| 105 | [MarshalAs(UnmanagedType.LPWStr)] string wzCompatiblePackageId, | 105 | [MarshalAs(UnmanagedType.LPWStr)] string wzCompatiblePackageId, |
| 106 | [MarshalAs(UnmanagedType.U8)] long dw64CompatiblePackageVersion, | 106 | [MarshalAs(UnmanagedType.LPWStr)] string wzCompatiblePackageVersion, |
| 107 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | 107 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel |
| 108 | ); | 108 | ); |
| 109 | 109 | ||
| @@ -114,7 +114,7 @@ namespace WixToolset.Mba.Core | |||
| 114 | [MarshalAs(UnmanagedType.LPWStr)] string wzUpgradeCode, | 114 | [MarshalAs(UnmanagedType.LPWStr)] string wzUpgradeCode, |
| 115 | [MarshalAs(UnmanagedType.LPWStr)] string wzProductCode, | 115 | [MarshalAs(UnmanagedType.LPWStr)] string wzProductCode, |
| 116 | [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, | 116 | [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, |
| 117 | [MarshalAs(UnmanagedType.U8)] long dw64Version, | 117 | [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, |
| 118 | [MarshalAs(UnmanagedType.U4)] RelatedOperation operation, | 118 | [MarshalAs(UnmanagedType.U4)] RelatedOperation operation, |
| 119 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | 119 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel |
| 120 | ); | 120 | ); |
| @@ -181,7 +181,7 @@ namespace WixToolset.Mba.Core | |||
| 181 | int OnPlanCompatibleMsiPackageBegin( | 181 | int OnPlanCompatibleMsiPackageBegin( |
| 182 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | 182 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, |
| 183 | [MarshalAs(UnmanagedType.LPWStr)] string wzCompatiblePackageId, | 183 | [MarshalAs(UnmanagedType.LPWStr)] string wzCompatiblePackageId, |
| 184 | [MarshalAs(UnmanagedType.U8)] long dw64CompatiblePackageVersion, | 184 | [MarshalAs(UnmanagedType.LPWStr)] string wzCompatiblePackageVersion, |
| 185 | [MarshalAs(UnmanagedType.U4)] RequestState recommendedState, | 185 | [MarshalAs(UnmanagedType.U4)] RequestState recommendedState, |
| 186 | [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState, | 186 | [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState, |
| 187 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | 187 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel |
diff --git a/src/WixToolset.Mba.Core/IBootstrapperEngine.cs b/src/WixToolset.Mba.Core/IBootstrapperEngine.cs index 85ca8693..584e0f6d 100644 --- a/src/WixToolset.Mba.Core/IBootstrapperEngine.cs +++ b/src/WixToolset.Mba.Core/IBootstrapperEngine.cs | |||
| @@ -36,7 +36,8 @@ namespace WixToolset.Mba.Core | |||
| 36 | [PreserveSig] | 36 | [PreserveSig] |
| 37 | int GetVariableVersion( | 37 | int GetVariableVersion( |
| 38 | [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, | 38 | [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, |
| 39 | [MarshalAs(UnmanagedType.U8)] out long pqwValue | 39 | IntPtr wzValue, |
| 40 | [MarshalAs(UnmanagedType.U4)] ref int pcchValue | ||
| 40 | ); | 41 | ); |
| 41 | 42 | ||
| 42 | [PreserveSig] | 43 | [PreserveSig] |
| @@ -112,7 +113,7 @@ namespace WixToolset.Mba.Core | |||
| 112 | 113 | ||
| 113 | void SetVariableVersion( | 114 | void SetVariableVersion( |
| 114 | [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, | 115 | [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, |
| 115 | [MarshalAs(UnmanagedType.U8)] long qwValue | 116 | IntPtr wzValue |
| 116 | ); | 117 | ); |
| 117 | 118 | ||
| 118 | void CloseSplashScreen(); | 119 | void CloseSplashScreen(); |
diff --git a/src/WixToolset.Mba.Core/IEngine.cs b/src/WixToolset.Mba.Core/IEngine.cs index 84d93bb0..b486e51d 100644 --- a/src/WixToolset.Mba.Core/IEngine.cs +++ b/src/WixToolset.Mba.Core/IEngine.cs | |||
| @@ -96,7 +96,7 @@ namespace WixToolset.Mba.Core | |||
| 96 | /// Gets <see cref="Version"/> variables for the engine. | 96 | /// Gets <see cref="Version"/> variables for the engine. |
| 97 | /// </summary> | 97 | /// </summary> |
| 98 | /// <param name="name">The name of the variable.</param> | 98 | /// <param name="name">The name of the variable.</param> |
| 99 | Version GetVariableVersion(string name); | 99 | string GetVariableVersion(string name); |
| 100 | 100 | ||
| 101 | /// <summary> | 101 | /// <summary> |
| 102 | /// Launches a preapproved executable elevated. As long as the engine already elevated, there will be no UAC prompt. | 102 | /// Launches a preapproved executable elevated. As long as the engine already elevated, there will be no UAC prompt. |
| @@ -161,7 +161,7 @@ namespace WixToolset.Mba.Core | |||
| 161 | /// </summary> | 161 | /// </summary> |
| 162 | /// <param name="name">The name of the variable.</param> | 162 | /// <param name="name">The name of the variable.</param> |
| 163 | /// <param name="value">The value to set.</param> | 163 | /// <param name="value">The value to set.</param> |
| 164 | void SetVariable(string name, long value); | 164 | void SetVariableNumeric(string name, long value); |
| 165 | 165 | ||
| 166 | /// <summary> | 166 | /// <summary> |
| 167 | /// Sets string variables for the engine using SecureStrings. | 167 | /// Sets string variables for the engine using SecureStrings. |
| @@ -169,7 +169,7 @@ namespace WixToolset.Mba.Core | |||
| 169 | /// <param name="name">The name of the variable.</param> | 169 | /// <param name="name">The name of the variable.</param> |
| 170 | /// <param name="value">The value to set.</param> | 170 | /// <param name="value">The value to set.</param> |
| 171 | /// <param name="formatted">False if the value is a literal string.</param> | 171 | /// <param name="formatted">False if the value is a literal string.</param> |
| 172 | void SetVariable(string name, SecureString value, bool formatted); | 172 | void SetVariableString(string name, SecureString value, bool formatted); |
| 173 | 173 | ||
| 174 | /// <summary> | 174 | /// <summary> |
| 175 | /// Sets string variables for the engine. | 175 | /// Sets string variables for the engine. |
| @@ -177,21 +177,14 @@ namespace WixToolset.Mba.Core | |||
| 177 | /// <param name="name">The name of the variable.</param> | 177 | /// <param name="name">The name of the variable.</param> |
| 178 | /// <param name="value">The value to set.</param> | 178 | /// <param name="value">The value to set.</param> |
| 179 | /// <param name="formatted">False if the value is a literal string.</param> | 179 | /// <param name="formatted">False if the value is a literal string.</param> |
| 180 | void SetVariable(string name, string value, bool formatted); | 180 | void SetVariableString(string name, string value, bool formatted); |
| 181 | 181 | ||
| 182 | /// <summary> | 182 | /// <summary> |
| 183 | /// Sets <see cref="Version"/> variables for the engine. | 183 | /// Sets version variables for the engine. |
| 184 | /// | ||
| 185 | /// The <see cref="Version"/> class can keep track of when the build and revision fields are undefined, but the engine can't. | ||
| 186 | /// Therefore, the build and revision fields must be defined when setting a <see cref="Version"/> variable. | ||
| 187 | /// Use the NormalizeVersion method to make sure the engine can accept the Version. | ||
| 188 | /// | ||
| 189 | /// To keep track of versions without build or revision fields, use StringVariables instead. | ||
| 190 | /// </summary> | 184 | /// </summary> |
| 191 | /// <param name="name">The name of the variable.</param> | 185 | /// <param name="name">The name of the variable.</param> |
| 192 | /// <param name="value">The value to set.</param> | 186 | /// <param name="value">The value to set.</param> |
| 193 | /// <exception cref="OverflowException">The given <see cref="Version"/> was invalid.</exception> | 187 | void SetVariableVersion(string name, string value); |
| 194 | void SetVariable(string name, Version value); | ||
| 195 | 188 | ||
| 196 | /// <summary> | 189 | /// <summary> |
| 197 | /// Sends error message when embedded. | 190 | /// Sends error message when embedded. |
diff --git a/src/WixToolset.Mba.Core/PackageInfo.cs b/src/WixToolset.Mba.Core/PackageInfo.cs index d3199c08..d54438f5 100644 --- a/src/WixToolset.Mba.Core/PackageInfo.cs +++ b/src/WixToolset.Mba.Core/PackageInfo.cs | |||
| @@ -159,11 +159,11 @@ namespace WixToolset.Mba.Core | |||
| 159 | } | 159 | } |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | public static IPackageInfo GetRelatedBundleAsPackage(string id, RelationType relationType, bool perMachine, Version version) | 162 | public static IPackageInfo GetRelatedBundleAsPackage(string id, RelationType relationType, bool perMachine, string version) |
| 163 | { | 163 | { |
| 164 | PackageInfo package = new PackageInfo(); | 164 | PackageInfo package = new PackageInfo(); |
| 165 | package.Id = id; | 165 | package.Id = id; |
| 166 | package.Version = version.ToString(); | 166 | package.Version = version; |
| 167 | 167 | ||
| 168 | switch (relationType) | 168 | switch (relationType) |
| 169 | { | 169 | { |
