aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Mba.Core
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-04-27 22:26:16 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-04-29 14:40:09 -0500
commit8deeffb615244c62a0c94ea99d01ece88b1caf09 (patch)
treef28b80cc68fbcbd1a987d101bfdd305cec2a7fea /src/WixToolset.Mba.Core
parent11fe2c881d182f9caff28bd9ff08c2e4fe513989 (diff)
downloadwix-8deeffb615244c62a0c94ea99d01ece88b1caf09.tar.gz
wix-8deeffb615244c62a0c94ea99d01ece88b1caf09.tar.bz2
wix-8deeffb615244c62a0c94ea99d01ece88b1caf09.zip
Integrate size_t and OnPlanPackageBegin changes in Burn headers.
Diffstat (limited to 'src/WixToolset.Mba.Core')
-rw-r--r--src/WixToolset.Mba.Core/BootstrapperApplication.cs12
-rw-r--r--src/WixToolset.Mba.Core/Engine.cs36
-rw-r--r--src/WixToolset.Mba.Core/EventArgs.cs70
-rw-r--r--src/WixToolset.Mba.Core/IBootstrapperApplication.cs69
-rw-r--r--src/WixToolset.Mba.Core/IBootstrapperEngine.cs24
-rw-r--r--src/WixToolset.Mba.Core/IPackageInfo.cs2
-rw-r--r--src/WixToolset.Mba.Core/PackageInfo.cs35
7 files changed, 133 insertions, 115 deletions
diff --git a/src/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/WixToolset.Mba.Core/BootstrapperApplication.cs
index 0a8f3af8..072d3ef0 100644
--- a/src/WixToolset.Mba.Core/BootstrapperApplication.cs
+++ b/src/WixToolset.Mba.Core/BootstrapperApplication.cs
@@ -1343,9 +1343,9 @@ namespace WixToolset.Mba.Core
1343 return args.HResult; 1343 return args.HResult;
1344 } 1344 }
1345 1345
1346 int IBootstrapperApplication.OnDetectPackageComplete(string wzPackageId, int hrStatus, PackageState state) 1346 int IBootstrapperApplication.OnDetectPackageComplete(string wzPackageId, int hrStatus, PackageState state, bool fCached)
1347 { 1347 {
1348 DetectPackageCompleteEventArgs args = new DetectPackageCompleteEventArgs(wzPackageId, hrStatus, state); 1348 DetectPackageCompleteEventArgs args = new DetectPackageCompleteEventArgs(wzPackageId, hrStatus, state, fCached);
1349 this.OnDetectPackageComplete(args); 1349 this.OnDetectPackageComplete(args);
1350 1350
1351 return args.HResult; 1351 return args.HResult;
@@ -1378,9 +1378,9 @@ namespace WixToolset.Mba.Core
1378 return args.HResult; 1378 return args.HResult;
1379 } 1379 }
1380 1380
1381 int IBootstrapperApplication.OnPlanPackageBegin(string wzPackageId, PackageState state, bool fInstallCondition, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel) 1381 int IBootstrapperApplication.OnPlanPackageBegin(string wzPackageId, PackageState state, bool fCached, BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, RequestState recommendedState, BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, ref RequestState pRequestedState, ref BOOTSTRAPPER_CACHE_TYPE pRequestedCacheType, ref bool fCancel)
1382 { 1382 {
1383 PlanPackageBeginEventArgs args = new PlanPackageBeginEventArgs(wzPackageId, state, fInstallCondition, recommendedState, pRequestedState, fCancel); 1383 PlanPackageBeginEventArgs args = new PlanPackageBeginEventArgs(wzPackageId, state, fCached, installCondition, recommendedState, recommendedCacheType, pRequestedState, pRequestedCacheType, fCancel);
1384 this.OnPlanPackageBegin(args); 1384 this.OnPlanPackageBegin(args);
1385 1385
1386 pRequestedState = args.State; 1386 pRequestedState = args.State;
@@ -1428,9 +1428,9 @@ namespace WixToolset.Mba.Core
1428 return args.HResult; 1428 return args.HResult;
1429 } 1429 }
1430 1430
1431 int IBootstrapperApplication.OnPlannedPackage(string wzPackageId, ActionState execute, ActionState rollback) 1431 int IBootstrapperApplication.OnPlannedPackage(string wzPackageId, ActionState execute, ActionState rollback, bool fPlannedCache, bool fPlannedUncache)
1432 { 1432 {
1433 var args = new PlannedPackageEventArgs(wzPackageId, execute, rollback); 1433 var args = new PlannedPackageEventArgs(wzPackageId, execute, rollback, fPlannedCache, fPlannedUncache);
1434 this.OnPlannedPackage(args); 1434 this.OnPlannedPackage(args);
1435 1435
1436 return args.HResult; 1436 return args.HResult;
diff --git a/src/WixToolset.Mba.Core/Engine.cs b/src/WixToolset.Mba.Core/Engine.cs
index e07ecd8b..aed420d5 100644
--- a/src/WixToolset.Mba.Core/Engine.cs
+++ b/src/WixToolset.Mba.Core/Engine.cs
@@ -62,7 +62,7 @@ namespace WixToolset.Mba.Core
62 /// <inheritdoc/> 62 /// <inheritdoc/>
63 public bool ContainsVariable(string name) 63 public bool ContainsVariable(string name)
64 { 64 {
65 int capacity = 0; 65 IntPtr capacity = new IntPtr(0);
66 int ret = this.engine.GetVariableString(name, IntPtr.Zero, ref capacity); 66 int ret = this.engine.GetVariableString(name, IntPtr.Zero, ref capacity);
67 return NativeMethods.E_NOTFOUND != ret; 67 return NativeMethods.E_NOTFOUND != ret;
68 } 68 }
@@ -101,14 +101,15 @@ namespace WixToolset.Mba.Core
101 /// <inheritdoc/> 101 /// <inheritdoc/>
102 public string EscapeString(string input) 102 public string EscapeString(string input)
103 { 103 {
104 int capacity = InitialBufferSize; 104 IntPtr capacity = new IntPtr(InitialBufferSize);
105 StringBuilder sb = new StringBuilder(capacity); 105 StringBuilder sb = new StringBuilder(capacity.ToInt32());
106 106
107 // Get the size of the buffer. 107 // Get the size of the buffer.
108 int ret = this.engine.EscapeString(input, sb, ref capacity); 108 int ret = this.engine.EscapeString(input, sb, ref capacity);
109 if (NativeMethods.E_INSUFFICIENT_BUFFER == ret || NativeMethods.E_MOREDATA == ret) 109 if (NativeMethods.E_INSUFFICIENT_BUFFER == ret || NativeMethods.E_MOREDATA == ret)
110 { 110 {
111 sb.Capacity = ++capacity; // Add one for the null terminator. 111 capacity = new IntPtr(capacity.ToInt32() + 1); // Add one for the null terminator.
112 sb.Capacity = capacity.ToInt32();
112 ret = this.engine.EscapeString(input, sb, ref capacity); 113 ret = this.engine.EscapeString(input, sb, ref capacity);
113 } 114 }
114 115
@@ -132,14 +133,15 @@ namespace WixToolset.Mba.Core
132 /// <inheritdoc/> 133 /// <inheritdoc/>
133 public string FormatString(string format) 134 public string FormatString(string format)
134 { 135 {
135 int capacity = InitialBufferSize; 136 IntPtr capacity = new IntPtr(InitialBufferSize);
136 StringBuilder sb = new StringBuilder(capacity); 137 StringBuilder sb = new StringBuilder(capacity.ToInt32());
137 138
138 // Get the size of the buffer. 139 // Get the size of the buffer.
139 int ret = this.engine.FormatString(format, sb, ref capacity); 140 int ret = this.engine.FormatString(format, sb, ref capacity);
140 if (NativeMethods.E_INSUFFICIENT_BUFFER == ret || NativeMethods.E_MOREDATA == ret) 141 if (NativeMethods.E_INSUFFICIENT_BUFFER == ret || NativeMethods.E_MOREDATA == ret)
141 { 142 {
142 sb.Capacity = ++capacity; // Add one for the null terminator. 143 capacity = new IntPtr(capacity.ToInt32() + 1); // Add one for the null terminator.
144 sb.Capacity = capacity.ToInt32();
143 ret = this.engine.FormatString(format, sb, ref capacity); 145 ret = this.engine.FormatString(format, sb, ref capacity);
144 } 146 }
145 147
@@ -343,9 +345,9 @@ namespace WixToolset.Mba.Core
343 /// <exception cref="Exception">An error occurred getting the variable.</exception> 345 /// <exception cref="Exception">An error occurred getting the variable.</exception>
344 internal IntPtr getStringVariable(string name, out int length) 346 internal IntPtr getStringVariable(string name, out int length)
345 { 347 {
346 int capacity = InitialBufferSize; 348 IntPtr capacity = new IntPtr(InitialBufferSize);
347 bool success = false; 349 bool success = false;
348 IntPtr pValue = Marshal.AllocCoTaskMem(capacity * UnicodeEncoding.CharSize); 350 IntPtr pValue = Marshal.AllocCoTaskMem(capacity.ToInt32() * UnicodeEncoding.CharSize);
349 try 351 try
350 { 352 {
351 // Get the size of the buffer. 353 // Get the size of the buffer.
@@ -353,7 +355,7 @@ namespace WixToolset.Mba.Core
353 if (NativeMethods.E_INSUFFICIENT_BUFFER == ret || NativeMethods.E_MOREDATA == ret) 355 if (NativeMethods.E_INSUFFICIENT_BUFFER == ret || NativeMethods.E_MOREDATA == ret)
354 { 356 {
355 // Don't need to add 1 for the null terminator, the engine already includes that. 357 // Don't need to add 1 for the null terminator, the engine already includes that.
356 pValue = Marshal.ReAllocCoTaskMem(pValue, capacity * UnicodeEncoding.CharSize); 358 pValue = Marshal.ReAllocCoTaskMem(pValue, capacity.ToInt32() * UnicodeEncoding.CharSize);
357 ret = this.engine.GetVariableString(name, pValue, ref capacity); 359 ret = this.engine.GetVariableString(name, pValue, ref capacity);
358 } 360 }
359 361
@@ -363,9 +365,10 @@ namespace WixToolset.Mba.Core
363 } 365 }
364 366
365 // The engine only returns the exact length of the string if the buffer was too small, so calculate it ourselves. 367 // The engine only returns the exact length of the string if the buffer was too small, so calculate it ourselves.
366 for (length = 0; length < capacity; ++length) 368 int maxLength = capacity.ToInt32();
369 for (length = 0; length < maxLength; ++length)
367 { 370 {
368 if(0 == Marshal.ReadInt16(pValue, length * UnicodeEncoding.CharSize)) 371 if (0 == Marshal.ReadInt16(pValue, length * UnicodeEncoding.CharSize))
369 { 372 {
370 break; 373 break;
371 } 374 }
@@ -392,9 +395,9 @@ namespace WixToolset.Mba.Core
392 /// <exception cref="Exception">An error occurred getting the variable.</exception> 395 /// <exception cref="Exception">An error occurred getting the variable.</exception>
393 internal IntPtr getVersionVariable(string name, out int length) 396 internal IntPtr getVersionVariable(string name, out int length)
394 { 397 {
395 int capacity = InitialBufferSize; 398 IntPtr capacity = new IntPtr(InitialBufferSize);
396 bool success = false; 399 bool success = false;
397 IntPtr pValue = Marshal.AllocCoTaskMem(capacity * UnicodeEncoding.CharSize); 400 IntPtr pValue = Marshal.AllocCoTaskMem(capacity.ToInt32() * UnicodeEncoding.CharSize);
398 try 401 try
399 { 402 {
400 // Get the size of the buffer. 403 // Get the size of the buffer.
@@ -402,7 +405,7 @@ namespace WixToolset.Mba.Core
402 if (NativeMethods.E_INSUFFICIENT_BUFFER == ret || NativeMethods.E_MOREDATA == ret) 405 if (NativeMethods.E_INSUFFICIENT_BUFFER == ret || NativeMethods.E_MOREDATA == ret)
403 { 406 {
404 // Don't need to add 1 for the null terminator, the engine already includes that. 407 // Don't need to add 1 for the null terminator, the engine already includes that.
405 pValue = Marshal.ReAllocCoTaskMem(pValue, capacity * UnicodeEncoding.CharSize); 408 pValue = Marshal.ReAllocCoTaskMem(pValue, capacity.ToInt32() * UnicodeEncoding.CharSize);
406 ret = this.engine.GetVariableVersion(name, pValue, ref capacity); 409 ret = this.engine.GetVariableVersion(name, pValue, ref capacity);
407 } 410 }
408 411
@@ -412,7 +415,8 @@ namespace WixToolset.Mba.Core
412 } 415 }
413 416
414 // The engine only returns the exact length of the string if the buffer was too small, so calculate it ourselves. 417 // The engine only returns the exact length of the string if the buffer was too small, so calculate it ourselves.
415 for (length = 0; length < capacity; ++length) 418 int maxLength = capacity.ToInt32();
419 for (length = 0; length < maxLength; ++length)
416 { 420 {
417 if (0 == Marshal.ReadInt16(pValue, length * UnicodeEncoding.CharSize)) 421 if (0 == Marshal.ReadInt16(pValue, length * UnicodeEncoding.CharSize))
418 { 422 {
diff --git a/src/WixToolset.Mba.Core/EventArgs.cs b/src/WixToolset.Mba.Core/EventArgs.cs
index e64f6d2c..8ef8af14 100644
--- a/src/WixToolset.Mba.Core/EventArgs.cs
+++ b/src/WixToolset.Mba.Core/EventArgs.cs
@@ -617,22 +617,18 @@ namespace WixToolset.Mba.Core
617 } 617 }
618 618
619 /// <summary> 619 /// <summary>
620 /// Additional arguments used when the detection for a specific package has completed. 620 /// Additional arguments for <see cref="IDefaultBootstrapperApplication.DetectPackageComplete"/>.
621 /// </summary> 621 /// </summary>
622 [Serializable] 622 [Serializable]
623 public class DetectPackageCompleteEventArgs : StatusEventArgs 623 public class DetectPackageCompleteEventArgs : StatusEventArgs
624 { 624 {
625 /// <summary> 625 /// <summary />
626 /// Creates a new instance of the <see cref="DetectPackageCompleteEventArgs"/> class. 626 public DetectPackageCompleteEventArgs(string packageId, int hrStatus, PackageState state, bool cached)
627 /// </summary>
628 /// <param name="packageId">The identity of the package detected.</param>
629 /// <param name="hrStatus">The return code of the operation.</param>
630 /// <param name="state">The state of the specified package.</param>
631 public DetectPackageCompleteEventArgs(string packageId, int hrStatus, PackageState state)
632 : base(hrStatus) 627 : base(hrStatus)
633 { 628 {
634 this.PackageId = packageId; 629 this.PackageId = packageId;
635 this.State = state; 630 this.State = state;
631 this.Cached = cached;
636 } 632 }
637 633
638 /// <summary> 634 /// <summary>
@@ -644,6 +640,11 @@ namespace WixToolset.Mba.Core
644 /// Gets the state of the specified package. 640 /// Gets the state of the specified package.
645 /// </summary> 641 /// </summary>
646 public PackageState State { get; private set; } 642 public PackageState State { get; private set; }
643
644 /// <summary>
645 /// Gets whether any part of the package is cached.
646 /// </summary>
647 public bool Cached { get; private set; }
647 } 648 }
648 649
649 /// <summary> 650 /// <summary>
@@ -725,23 +726,18 @@ namespace WixToolset.Mba.Core
725 [Serializable] 726 [Serializable]
726 public class PlanPackageBeginEventArgs : CancellableHResultEventArgs 727 public class PlanPackageBeginEventArgs : CancellableHResultEventArgs
727 { 728 {
728 /// <summary> 729 /// <summary />
729 /// 730 public PlanPackageBeginEventArgs(string packageId, PackageState currentState, bool cached, BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, RequestState recommendedState, BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, RequestState state, BOOTSTRAPPER_CACHE_TYPE cacheType, bool cancelRecommendation)
730 /// </summary>
731 /// <param name="packageId"></param>
732 /// <param name="currentState"></param>
733 /// <param name="installCondition"></param>
734 /// <param name="recommendedState"></param>
735 /// <param name="state"></param>
736 /// <param name="cancelRecommendation"></param>
737 public PlanPackageBeginEventArgs(string packageId, PackageState currentState, bool installCondition, RequestState recommendedState, RequestState state, bool cancelRecommendation)
738 : base(cancelRecommendation) 731 : base(cancelRecommendation)
739 { 732 {
740 this.PackageId = packageId; 733 this.PackageId = packageId;
741 this.CurrentState = currentState; 734 this.CurrentState = currentState;
735 this.Cached = cached;
742 this.InstallCondition = installCondition; 736 this.InstallCondition = installCondition;
743 this.RecommendedState = recommendedState; 737 this.RecommendedState = recommendedState;
738 this.RecommendedCacheType = recommendedCacheType;
744 this.State = state; 739 this.State = state;
740 this.CacheType = cacheType;
745 } 741 }
746 742
747 /// <summary> 743 /// <summary>
@@ -755,9 +751,14 @@ namespace WixToolset.Mba.Core
755 public PackageState CurrentState { get; private set; } 751 public PackageState CurrentState { get; private set; }
756 752
757 /// <summary> 753 /// <summary>
754 /// Gets whether any part of the package is cached.
755 /// </summary>
756 public bool Cached { get; private set; }
757
758 /// <summary>
758 /// Gets the evaluated result of the package's install condition. 759 /// Gets the evaluated result of the package's install condition.
759 /// </summary> 760 /// </summary>
760 public bool InstallCondition { get; private set; } 761 public BOOTSTRAPPER_PACKAGE_CONDITION_RESULT InstallCondition { get; private set; }
761 762
762 /// <summary> 763 /// <summary>
763 /// Gets the recommended requested state for the package. 764 /// Gets the recommended requested state for the package.
@@ -765,9 +766,19 @@ namespace WixToolset.Mba.Core
765 public RequestState RecommendedState { get; private set; } 766 public RequestState RecommendedState { get; private set; }
766 767
767 /// <summary> 768 /// <summary>
769 /// The authored cache type of the package.
770 /// </summary>
771 public BOOTSTRAPPER_CACHE_TYPE RecommendedCacheType { get; private set; }
772
773 /// <summary>
768 /// Gets or sets the requested state for the package. 774 /// Gets or sets the requested state for the package.
769 /// </summary> 775 /// </summary>
770 public RequestState State { get; set; } 776 public RequestState State { get; set; }
777
778 /// <summary>
779 /// Gets or sets the requested cache type for the package.
780 /// </summary>
781 public BOOTSTRAPPER_CACHE_TYPE CacheType { get; set; }
771 } 782 }
772 783
773 /// <summary> 784 /// <summary>
@@ -936,17 +947,14 @@ namespace WixToolset.Mba.Core
936 [Serializable] 947 [Serializable]
937 public class PlannedPackageEventArgs : HResultEventArgs 948 public class PlannedPackageEventArgs : HResultEventArgs
938 { 949 {
939 /// <summary> 950 /// <summary />
940 /// 951 public PlannedPackageEventArgs(string packageId, ActionState execute, ActionState rollback, bool cache, bool uncache)
941 /// </summary>
942 /// <param name="packageId"></param>
943 /// <param name="execute"></param>
944 /// <param name="rollback"></param>
945 public PlannedPackageEventArgs(string packageId, ActionState execute, ActionState rollback)
946 { 952 {
947 this.PackageId = packageId; 953 this.PackageId = packageId;
948 this.Execute = execute; 954 this.Execute = execute;
949 this.Rollback = rollback; 955 this.Rollback = rollback;
956 this.Cache = cache;
957 this.Uncache = uncache;
950 } 958 }
951 959
952 /// <summary> 960 /// <summary>
@@ -963,6 +971,16 @@ namespace WixToolset.Mba.Core
963 /// Gets the planned rollback action. 971 /// Gets the planned rollback action.
964 /// </summary> 972 /// </summary>
965 public ActionState Rollback { get; private set; } 973 public ActionState Rollback { get; private set; }
974
975 /// <summary>
976 /// Gets whether the package will be cached.
977 /// </summary>
978 public bool Cache { get; private set; }
979
980 /// <summary>
981 /// Gets whether the package will be removed from the package cache.
982 /// </summary>
983 public bool Uncache { get; private set; }
966 } 984 }
967 985
968 /// <summary> 986 /// <summary>
diff --git a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs
index 2195fd4b..530fb1a9 100644
--- a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs
+++ b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs
@@ -251,16 +251,13 @@ namespace WixToolset.Mba.Core
251 /// <summary> 251 /// <summary>
252 /// See <see cref="IDefaultBootstrapperApplication.DetectPackageComplete"/>. 252 /// See <see cref="IDefaultBootstrapperApplication.DetectPackageComplete"/>.
253 /// </summary> 253 /// </summary>
254 /// <param name="wzPackageId"></param>
255 /// <param name="hrStatus"></param>
256 /// <param name="state"></param>
257 /// <returns></returns>
258 [PreserveSig] 254 [PreserveSig]
259 [return: MarshalAs(UnmanagedType.I4)] 255 [return: MarshalAs(UnmanagedType.I4)]
260 int OnDetectPackageComplete( 256 int OnDetectPackageComplete(
261 [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, 257 [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId,
262 int hrStatus, 258 int hrStatus,
263 [MarshalAs(UnmanagedType.U4)] PackageState state 259 [MarshalAs(UnmanagedType.U4)] PackageState state,
260 [MarshalAs(UnmanagedType.Bool)] bool fCached
264 ); 261 );
265 262
266 /// <summary> 263 /// <summary>
@@ -309,21 +306,17 @@ namespace WixToolset.Mba.Core
309 /// <summary> 306 /// <summary>
310 /// See <see cref="IDefaultBootstrapperApplication.PlanPackageBegin"/>. 307 /// See <see cref="IDefaultBootstrapperApplication.PlanPackageBegin"/>.
311 /// </summary> 308 /// </summary>
312 /// <param name="wzPackageId"></param>
313 /// <param name="state"></param>
314 /// <param name="fInstallCondition"></param>
315 /// <param name="recommendedState"></param>
316 /// <param name="pRequestedState"></param>
317 /// <param name="fCancel"></param>
318 /// <returns></returns>
319 [PreserveSig] 309 [PreserveSig]
320 [return: MarshalAs(UnmanagedType.I4)] 310 [return: MarshalAs(UnmanagedType.I4)]
321 int OnPlanPackageBegin( 311 int OnPlanPackageBegin(
322 [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, 312 [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId,
323 [MarshalAs(UnmanagedType.U4)] PackageState state, 313 [MarshalAs(UnmanagedType.U4)] PackageState state,
324 [MarshalAs(UnmanagedType.Bool)] bool fInstallCondition, 314 [MarshalAs(UnmanagedType.Bool)] bool fCached,
315 [MarshalAs(UnmanagedType.U4)] BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition,
325 [MarshalAs(UnmanagedType.U4)] RequestState recommendedState, 316 [MarshalAs(UnmanagedType.U4)] RequestState recommendedState,
317 [MarshalAs(UnmanagedType.U4)] BOOTSTRAPPER_CACHE_TYPE recommendedCacheType,
326 [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState, 318 [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState,
319 [MarshalAs(UnmanagedType.U4)] ref BOOTSTRAPPER_CACHE_TYPE pRequestedCacheType,
327 [MarshalAs(UnmanagedType.Bool)] ref bool fCancel 320 [MarshalAs(UnmanagedType.Bool)] ref bool fCancel
328 ); 321 );
329 322
@@ -406,16 +399,14 @@ namespace WixToolset.Mba.Core
406 /// <summary> 399 /// <summary>
407 /// See <see cref="IDefaultBootstrapperApplication.PlannedPackage"/>. 400 /// See <see cref="IDefaultBootstrapperApplication.PlannedPackage"/>.
408 /// </summary> 401 /// </summary>
409 /// <param name="wzPackageId"></param>
410 /// <param name="execute"></param>
411 /// <param name="rollback"></param>
412 /// <returns></returns>
413 [PreserveSig] 402 [PreserveSig]
414 [return: MarshalAs(UnmanagedType.I4)] 403 [return: MarshalAs(UnmanagedType.I4)]
415 int OnPlannedPackage( 404 int OnPlannedPackage(
416 [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, 405 [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId,
417 [MarshalAs(UnmanagedType.U4)] ActionState execute, 406 [MarshalAs(UnmanagedType.U4)] ActionState execute,
418 [MarshalAs(UnmanagedType.U4)] ActionState rollback 407 [MarshalAs(UnmanagedType.U4)] ActionState rollback,
408 [MarshalAs(UnmanagedType.Bool)] bool fPlannedCache,
409 [MarshalAs(UnmanagedType.Bool)] bool fPlannedUncache
419 ); 410 );
420 411
421 /// <summary> 412 /// <summary>
@@ -1642,6 +1633,27 @@ namespace WixToolset.Mba.Core
1642 } 1633 }
1643 1634
1644 /// <summary> 1635 /// <summary>
1636 /// The cache strategy to be used for the package.
1637 /// </summary>
1638 public enum BOOTSTRAPPER_CACHE_TYPE
1639 {
1640 /// <summary>
1641 /// The package will be cached in order to securely run the package, but will always be cleaned from the cache at the end.
1642 /// </summary>
1643 Remove,
1644
1645 /// <summary>
1646 /// The package will be cached in order to run the package, and then kept in the cache until the package is uninstalled.
1647 /// </summary>
1648 Keep,
1649
1650 /// <summary>
1651 /// The package will always be cached and stay in the cache, unless the package and bundle are both being uninstalled.
1652 /// </summary>
1653 Force,
1654 }
1655
1656 /// <summary>
1645 /// The available actions for <see cref="IDefaultBootstrapperApplication.CacheAcquireComplete"/>. 1657 /// The available actions for <see cref="IDefaultBootstrapperApplication.CacheAcquireComplete"/>.
1646 /// </summary> 1658 /// </summary>
1647 public enum BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION 1659 public enum BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION
@@ -1737,6 +1749,27 @@ namespace WixToolset.Mba.Core
1737 } 1749 }
1738 1750
1739 /// <summary> 1751 /// <summary>
1752 /// The result of evaluating a condition from a package.
1753 /// </summary>
1754 public enum BOOTSTRAPPER_PACKAGE_CONDITION_RESULT
1755 {
1756 /// <summary>
1757 /// No condition was authored.
1758 /// </summary>
1759 Default,
1760
1761 /// <summary>
1762 /// Evaluated to false.
1763 /// </summary>
1764 False,
1765
1766 /// <summary>
1767 /// Evaluated to true.
1768 /// </summary>
1769 True,
1770 }
1771
1772 /// <summary>
1740 /// The available actions for <see cref="IDefaultBootstrapperApplication.CacheAcquireResolving"/>. 1773 /// The available actions for <see cref="IDefaultBootstrapperApplication.CacheAcquireResolving"/>.
1741 /// </summary> 1774 /// </summary>
1742 public enum BOOTSTRAPPER_RESOLVESOURCE_ACTION 1775 public enum BOOTSTRAPPER_RESOLVESOURCE_ACTION
diff --git a/src/WixToolset.Mba.Core/IBootstrapperEngine.cs b/src/WixToolset.Mba.Core/IBootstrapperEngine.cs
index 78753a42..4e19bf0f 100644
--- a/src/WixToolset.Mba.Core/IBootstrapperEngine.cs
+++ b/src/WixToolset.Mba.Core/IBootstrapperEngine.cs
@@ -39,57 +39,41 @@ namespace WixToolset.Mba.Core
39 /// <summary> 39 /// <summary>
40 /// See <see cref="IEngine.GetVariableString(string)"/>. 40 /// See <see cref="IEngine.GetVariableString(string)"/>.
41 /// </summary> 41 /// </summary>
42 /// <param name="wzVariable"></param>
43 /// <param name="wzValue"></param>
44 /// <param name="pcchValue"></param>
45 /// <returns></returns>
46 [PreserveSig] 42 [PreserveSig]
47 int GetVariableString( 43 int GetVariableString(
48 [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, 44 [MarshalAs(UnmanagedType.LPWStr)] string wzVariable,
49 IntPtr wzValue, 45 IntPtr wzValue,
50 [MarshalAs(UnmanagedType.U4)] ref int pcchValue 46 ref IntPtr pcchValue
51 ); 47 );
52 48
53 /// <summary> 49 /// <summary>
54 /// See <see cref="IEngine.GetVariableVersion(string)"/>. 50 /// See <see cref="IEngine.GetVariableVersion(string)"/>.
55 /// </summary> 51 /// </summary>
56 /// <param name="wzVariable"></param>
57 /// <param name="wzValue"></param>
58 /// <param name="pcchValue"></param>
59 /// <returns></returns>
60 [PreserveSig] 52 [PreserveSig]
61 int GetVariableVersion( 53 int GetVariableVersion(
62 [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, 54 [MarshalAs(UnmanagedType.LPWStr)] string wzVariable,
63 IntPtr wzValue, 55 IntPtr wzValue,
64 [MarshalAs(UnmanagedType.U4)] ref int pcchValue 56 ref IntPtr pcchValue
65 ); 57 );
66 58
67 /// <summary> 59 /// <summary>
68 /// See <see cref="IEngine.FormatString(string)"/>. 60 /// See <see cref="IEngine.FormatString(string)"/>.
69 /// </summary> 61 /// </summary>
70 /// <param name="wzIn"></param>
71 /// <param name="wzOut"></param>
72 /// <param name="pcchOut"></param>
73 /// <returns></returns>
74 [PreserveSig] 62 [PreserveSig]
75 int FormatString( 63 int FormatString(
76 [MarshalAs(UnmanagedType.LPWStr)] string wzIn, 64 [MarshalAs(UnmanagedType.LPWStr)] string wzIn,
77 [MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder wzOut, 65 [MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder wzOut,
78 [MarshalAs(UnmanagedType.U4)] ref int pcchOut 66 ref IntPtr pcchOut
79 ); 67 );
80 68
81 /// <summary> 69 /// <summary>
82 /// See <see cref="IEngine.EscapeString(string)"/>. 70 /// See <see cref="IEngine.EscapeString(string)"/>.
83 /// </summary> 71 /// </summary>
84 /// <param name="wzIn"></param>
85 /// <param name="wzOut"></param>
86 /// <param name="pcchOut"></param>
87 /// <returns></returns>
88 [PreserveSig] 72 [PreserveSig]
89 int EscapeString( 73 int EscapeString(
90 [MarshalAs(UnmanagedType.LPWStr)] string wzIn, 74 [MarshalAs(UnmanagedType.LPWStr)] string wzIn,
91 [MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder wzOut, 75 [MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder wzOut,
92 [MarshalAs(UnmanagedType.U4)] ref int pcchOut 76 ref IntPtr pcchOut
93 ); 77 );
94 78
95 /// <summary> 79 /// <summary>
diff --git a/src/WixToolset.Mba.Core/IPackageInfo.cs b/src/WixToolset.Mba.Core/IPackageInfo.cs
index 0d7e549e..a1d99b10 100644
--- a/src/WixToolset.Mba.Core/IPackageInfo.cs
+++ b/src/WixToolset.Mba.Core/IPackageInfo.cs
@@ -10,7 +10,7 @@ namespace WixToolset.Mba.Core
10 /// <summary> 10 /// <summary>
11 /// 11 ///
12 /// </summary> 12 /// </summary>
13 CacheType CacheType { get; } 13 BOOTSTRAPPER_CACHE_TYPE CacheType { get; }
14 14
15 /// <summary> 15 /// <summary>
16 /// Place for the BA to store it's own custom data for this package. 16 /// Place for the BA to store it's own custom data for this package.
diff --git a/src/WixToolset.Mba.Core/PackageInfo.cs b/src/WixToolset.Mba.Core/PackageInfo.cs
index 75a0fd53..567a7cdd 100644
--- a/src/WixToolset.Mba.Core/PackageInfo.cs
+++ b/src/WixToolset.Mba.Core/PackageInfo.cs
@@ -10,27 +10,6 @@ namespace WixToolset.Mba.Core
10 /// <summary> 10 /// <summary>
11 /// 11 ///
12 /// </summary> 12 /// </summary>
13 public enum CacheType
14 {
15 /// <summary>
16 ///
17 /// </summary>
18 No,
19
20 /// <summary>
21 ///
22 /// </summary>
23 Yes,
24
25 /// <summary>
26 ///
27 /// </summary>
28 Always,
29 }
30
31 /// <summary>
32 ///
33 /// </summary>
34 public enum PackageType 13 public enum PackageType
35 { 14 {
36 /// <summary> 15 /// <summary>
@@ -113,7 +92,7 @@ namespace WixToolset.Mba.Core
113 public string InstallCondition { get; internal set; } 92 public string InstallCondition { get; internal set; }
114 93
115 /// <inheritdoc/> 94 /// <inheritdoc/>
116 public CacheType CacheType { get; internal set; } 95 public BOOTSTRAPPER_CACHE_TYPE CacheType { get; internal set; }
117 96
118 /// <inheritdoc/> 97 /// <inheritdoc/>
119 public bool PrereqPackage { get; internal set; } 98 public bool PrereqPackage { get; internal set; }
@@ -198,7 +177,7 @@ namespace WixToolset.Mba.Core
198 /// <param name="node"></param> 177 /// <param name="node"></param>
199 /// <param name="attributeName"></param> 178 /// <param name="attributeName"></param>
200 /// <returns></returns> 179 /// <returns></returns>
201 public static CacheType? GetCacheTypeAttribute(XPathNavigator node, string attributeName) 180 public static BOOTSTRAPPER_CACHE_TYPE? GetCacheTypeAttribute(XPathNavigator node, string attributeName)
202 { 181 {
203 string attributeValue = BootstrapperApplicationData.GetAttribute(node, attributeName); 182 string attributeValue = BootstrapperApplicationData.GetAttribute(node, attributeName);
204 183
@@ -207,17 +186,17 @@ namespace WixToolset.Mba.Core
207 return null; 186 return null;
208 } 187 }
209 188
210 if (attributeValue.Equals("yes", StringComparison.InvariantCulture)) 189 if (attributeValue.Equals("keep", StringComparison.InvariantCulture))
211 { 190 {
212 return CacheType.Yes; 191 return BOOTSTRAPPER_CACHE_TYPE.Keep;
213 } 192 }
214 else if (attributeValue.Equals("always", StringComparison.InvariantCulture)) 193 else if (attributeValue.Equals("force", StringComparison.InvariantCulture))
215 { 194 {
216 return CacheType.Always; 195 return BOOTSTRAPPER_CACHE_TYPE.Force;
217 } 196 }
218 else 197 else
219 { 198 {
220 return CacheType.No; 199 return BOOTSTRAPPER_CACHE_TYPE.Remove;
221 } 200 }
222 } 201 }
223 202