From 11fe2c881d182f9caff28bd9ff08c2e4fe513989 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Mon, 19 Apr 2021 17:35:44 -0500 Subject: Add new caching BA events. #3640 --- src/WixToolset.Mba.Core/BootstrapperApplication.cs | 195 +++++++- src/WixToolset.Mba.Core/EventArgs.cs | 536 ++++++++++----------- .../IBootstrapperApplication.cs | 160 ++++-- .../IDefaultBootstrapperApplication.cs | 45 +- src/balutil/inc/BAFunctions.h | 7 + src/balutil/inc/BalBaseBAFunctions.h | 101 +++- src/balutil/inc/BalBaseBootstrapperApplication.h | 106 +++- .../inc/BalBaseBootstrapperApplicationProc.h | 84 ++++ src/balutil/inc/IBootstrapperApplication.h | 87 +++- 9 files changed, 943 insertions(+), 378 deletions(-) (limited to 'src') diff --git a/src/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/WixToolset.Mba.Core/BootstrapperApplication.cs index 79cbfa86..0a8f3af8 100644 --- a/src/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/BootstrapperApplication.cs @@ -154,6 +154,9 @@ namespace WixToolset.Mba.Core /// public event EventHandler CacheVerifyBegin; + /// + public event EventHandler CacheVerifyProgress; + /// public event EventHandler CacheVerifyComplete; @@ -229,6 +232,24 @@ namespace WixToolset.Mba.Core /// public event EventHandler PlanForwardCompatibleBundle; + /// + public event EventHandler CacheContainerOrPayloadVerifyBegin; + + /// + public event EventHandler CacheContainerOrPayloadVerifyProgress; + + /// + public event EventHandler CacheContainerOrPayloadVerifyComplete; + + /// + public event EventHandler CachePayloadExtractBegin; + + /// + public event EventHandler CachePayloadExtractProgress; + + /// + public event EventHandler CachePayloadExtractComplete; + /// /// Entry point that is called when the bootstrapper application is ready to run. /// @@ -774,6 +795,19 @@ namespace WixToolset.Mba.Core } } + /// + /// Called by the engine, raises the event. + /// + /// + protected virtual void OnCacheVerifyProgress(CacheVerifyProgressEventArgs args) + { + EventHandler handler = this.CacheVerifyProgress; + if (null != handler) + { + handler(this, args); + } + } + /// /// Called by the engine, raises the event. /// @@ -1098,8 +1132,99 @@ namespace WixToolset.Mba.Core } } + /// + /// Called by the engine, raises the event. + /// + /// + protected virtual void OnCacheContainerOrPayloadVerifyBegin(CacheContainerOrPayloadVerifyBeginEventArgs args) + { + EventHandler handler = this.CacheContainerOrPayloadVerifyBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// + protected virtual void OnCacheContainerOrPayloadVerifyProgress(CacheContainerOrPayloadVerifyProgressEventArgs args) + { + EventHandler handler = this.CacheContainerOrPayloadVerifyProgress; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// + protected virtual void OnCacheContainerOrPayloadVerifyComplete(CacheContainerOrPayloadVerifyCompleteEventArgs args) + { + EventHandler handler = this.CacheContainerOrPayloadVerifyComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// + protected virtual void OnCachePayloadExtractBegin(CachePayloadExtractBeginEventArgs args) + { + EventHandler handler = this.CachePayloadExtractBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// + protected virtual void OnCachePayloadExtractProgress(CachePayloadExtractProgressEventArgs args) + { + EventHandler handler = this.CachePayloadExtractProgress; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// + protected virtual void OnCachePayloadExtractComplete(CachePayloadExtractCompleteEventArgs args) + { + EventHandler handler = this.CachePayloadExtractComplete; + if (null != handler) + { + handler(this, args); + } + } + #region IBootstrapperApplication Members + int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults, IntPtr pvContext) + { + switch (message) + { + default: + return NativeMethods.E_NOTIMPL; + } + } + + void IBootstrapperApplication.BAProcFallback(int message, IntPtr pvArgs, IntPtr pvResults, ref int phr, IntPtr pvContext) + { + } + int IBootstrapperApplication.OnStartup() { StartupEventArgs args = new StartupEventArgs(); @@ -1439,18 +1564,27 @@ namespace WixToolset.Mba.Core return args.HResult; } - int IBootstrapperApplication.OnCacheVerifyBegin(string wzPackageId, string wzPayloadId, ref bool fCancel) + int IBootstrapperApplication.OnCacheVerifyBegin(string wzPackageOrContainerId, string wzPayloadId, ref bool fCancel) { - CacheVerifyBeginEventArgs args = new CacheVerifyBeginEventArgs(wzPackageId, wzPayloadId, fCancel); + CacheVerifyBeginEventArgs args = new CacheVerifyBeginEventArgs(wzPackageOrContainerId, wzPayloadId, fCancel); this.OnCacheVerifyBegin(args); fCancel = args.Cancel; return args.HResult; } - int IBootstrapperApplication.OnCacheVerifyComplete(string wzPackageId, string wzPayloadId, int hrStatus, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action) + int IBootstrapperApplication.OnCacheVerifyProgress(string wzPackageOrContainerId, string wzPayloadId, long dw64Progress, long dw64Total, int dwOverallPercentage, CacheVerifyStep verifyStep, ref bool fCancel) + { + CacheVerifyProgressEventArgs args = new CacheVerifyProgressEventArgs(wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage, verifyStep, fCancel); + this.OnCacheVerifyProgress(args); + + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnCacheVerifyComplete(string wzPackageOrContainerId, string wzPayloadId, int hrStatus, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action) { - CacheVerifyCompleteEventArgs args = new CacheVerifyCompleteEventArgs(wzPackageId, wzPayloadId, hrStatus, recommendation, action); + CacheVerifyCompleteEventArgs args = new CacheVerifyCompleteEventArgs(wzPackageOrContainerId, wzPayloadId, hrStatus, recommendation, action); this.OnCacheVerifyComplete(args); action = args.Action; @@ -1682,17 +1816,56 @@ namespace WixToolset.Mba.Core return args.HResult; } - int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults, IntPtr pvContext) + int IBootstrapperApplication.OnCacheContainerOrPayloadVerifyBegin(string wzPackageOrContainerId, string wzPayloadId, ref bool fCancel) { - switch (message) - { - default: - return NativeMethods.E_NOTIMPL; - } + CacheContainerOrPayloadVerifyBeginEventArgs args = new CacheContainerOrPayloadVerifyBeginEventArgs(wzPackageOrContainerId, wzPayloadId, fCancel); + this.OnCacheContainerOrPayloadVerifyBegin(args); + + fCancel = args.Cancel; + return args.HResult; } - void IBootstrapperApplication.BAProcFallback(int message, IntPtr pvArgs, IntPtr pvResults, ref int phr, IntPtr pvContext) + int IBootstrapperApplication.OnCacheContainerOrPayloadVerifyProgress(string wzPackageOrContainerId, string wzPayloadId, long dw64Progress, long dw64Total, int dwOverallPercentage, ref bool fCancel) + { + CacheContainerOrPayloadVerifyProgressEventArgs args = new CacheContainerOrPayloadVerifyProgressEventArgs(wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage, fCancel); + this.OnCacheContainerOrPayloadVerifyProgress(args); + + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnCacheContainerOrPayloadVerifyComplete(string wzPackageOrContainerId, string wzPayloadId, int hrStatus) + { + CacheContainerOrPayloadVerifyCompleteEventArgs args = new CacheContainerOrPayloadVerifyCompleteEventArgs(wzPackageOrContainerId, wzPayloadId, hrStatus); + this.OnCacheContainerOrPayloadVerifyComplete(args); + + return args.HResult; + } + + int IBootstrapperApplication.OnCachePayloadExtractBegin(string wzContainerId, string wzPayloadId, ref bool fCancel) + { + CachePayloadExtractBeginEventArgs args = new CachePayloadExtractBeginEventArgs(wzContainerId, wzPayloadId, fCancel); + this.OnCachePayloadExtractBegin(args); + + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnCachePayloadExtractProgress(string wzContainerId, string wzPayloadId, long dw64Progress, long dw64Total, int dwOverallPercentage, ref bool fCancel) { + CachePayloadExtractProgressEventArgs args = new CachePayloadExtractProgressEventArgs(wzContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage, fCancel); + this.OnCachePayloadExtractProgress(args); + + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnCachePayloadExtractComplete(string wzContainerId, string wzPayloadId, int hrStatus) + { + CachePayloadExtractCompleteEventArgs args = new CachePayloadExtractCompleteEventArgs(wzContainerId, wzPayloadId, hrStatus); + this.OnCachePayloadExtractComplete(args); + + return args.HResult; } #endregion diff --git a/src/WixToolset.Mba.Core/EventArgs.cs b/src/WixToolset.Mba.Core/EventArgs.cs index ee89b583..e64f6d2c 100644 --- a/src/WixToolset.Mba.Core/EventArgs.cs +++ b/src/WixToolset.Mba.Core/EventArgs.cs @@ -51,11 +51,7 @@ namespace WixToolset.Mba.Core [Serializable] public abstract class ResultEventArgs : HResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// Recommended result from engine. - /// The result to return to the engine. + /// public ResultEventArgs(Result recommendation, Result result) { this.Recommendation = recommendation; @@ -99,11 +95,7 @@ namespace WixToolset.Mba.Core /// public abstract class ActionEventArgs : StatusEventArgs { - /// - /// - /// The return code of the operation. - /// Recommended action from engine. - /// The action to perform. + /// public ActionEventArgs(int hrStatus, T recommendation, T action) : base(hrStatus) { @@ -147,6 +139,49 @@ namespace WixToolset.Mba.Core public T Action { get; set; } } + /// + /// Base class for cache progress events. + /// + [Serializable] + public abstract class CacheProgressBaseEventArgs : CancellableHResultEventArgs + { + /// + public CacheProgressBaseEventArgs(string packageOrContainerId, string payloadId, long progress, long total, int overallPercentage, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageOrContainerId = packageOrContainerId; + this.PayloadId = payloadId; + this.Progress = progress; + this.Total = total; + this.OverallPercentage = overallPercentage; + } + + /// + /// Gets the identifier of the container or package. + /// + public string PackageOrContainerId { get; private set; } + + /// + /// Gets the identifier of the payload. + /// + public string PayloadId { get; private set; } + + /// + /// Gets the number of bytes cached thus far. + /// + public long Progress { get; private set; } + + /// + /// Gets the total bytes to cache. + /// + public long Total { get; private set; } + + /// + /// Gets the overall percentage of progress of caching. + /// + public int OverallPercentage { get; private set; } + } + /// /// Additional arguments used when startup has begun. /// @@ -182,25 +217,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the system is shutting down or the user is logging off. + /// Event arguments for /// - /// - /// To prevent shutting down or logging off, set to - /// true; otherwise, set it to false. - /// By default setup will prevent shutting down or logging off between - /// and . - /// If contains - /// the bootstrapper cannot prevent the shutdown and only has a few seconds to save state or perform any other - /// critical operations before being closed by the operating system. - /// [Serializable] public class SystemShutdownEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The reason the application is requested to close or being closed. - /// The recommendation from the engine. + /// public SystemShutdownEventArgs(EndSessionReasons reasons, bool cancelRecommendation) : base(cancelRecommendation) { @@ -301,17 +323,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the detection for an update has begun. + /// Event arguments for /// [Serializable] public class DetectUpdateBeginEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The location to check for an updated bundle. - /// The cancel recommendation from the engine. - /// The skip recommendation from the engine. + /// public DetectUpdateBeginEventArgs(string updateLocation, bool cancelRecommendation, bool skipRecommendation) : base(cancelRecommendation) { @@ -331,23 +348,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the detection for an update has begun. + /// Event arguments for /// [Serializable] public class DetectUpdateEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The location to check for an updated bundle. - /// The expected size of the updated bundle. - /// The expected version of the updated bundle. - /// The title of the updated bundle. - /// The summary of the updated bundle. - /// The content type of the content of the updated bundle. - /// The content of the updated bundle. - /// The recommendation from the engine. - /// The recommendation from the engine. + /// public DetectUpdateEventArgs(string updateLocation, long size, string version, string title, string summary, string contentType, string content, bool cancelRecommendation, bool stopRecommendation) : base(cancelRecommendation) { @@ -403,16 +409,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the detection for an update has completed. + /// Event arguments for /// [Serializable] public class DetectUpdateCompleteEventArgs : StatusEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The return code of the operation. - /// The recommendation from the engine. + /// public DetectUpdateCompleteEventArgs(int hrStatus, bool ignoreRecommendation) : base(hrStatus) { @@ -481,16 +483,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the detection for a specific package has begun. + /// Event arguments for /// [Serializable] public class DetectPackageBeginEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The identity of the package to detect. - /// The recommendation from the engine. + /// public DetectPackageBeginEventArgs(string packageId, bool cancelRecommendation) : base(cancelRecommendation) { @@ -504,21 +502,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when a related MSI package has been detected for a package. + /// Event arguments for /// [Serializable] public class DetectRelatedMsiPackageEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The identity of the package detecting. - /// The upgrade code of the related package detected. - /// The identity of the related package detected. - /// Whether the detected package is per machine. - /// The version of the related package detected. - /// The operation that will be taken on the detected package. - /// The recommendation from the engine. + /// public DetectRelatedMsiPackageEventArgs(string packageId, string upgradeCode, string productCode, bool perMachine, string version, RelatedOperation operation, bool cancelRecommendation) : base(cancelRecommendation) { @@ -598,17 +587,11 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when a feature in an MSI package has been detected. + /// Event arguments for /// public class DetectMsiFeatureEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// Detected package identifier. - /// Detected feature identifier. - /// Feature state detected. - /// The recommendation from the engine. + /// public DetectMsiFeatureEventArgs(string packageId, string featureId, FeatureState state, bool cancelRecommendation) : base(cancelRecommendation) { @@ -687,16 +670,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine has begun planning the installation. + /// Event arguments for /// [Serializable] public class PlanBeginEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The number of packages to plan for. - /// The recommendation from the engine. + /// public PlanBeginEventArgs(int packageCount, bool cancelRecommendation) : base(cancelRecommendation) { @@ -710,18 +689,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine has begun planning for a related bundle. + /// Event arguments for /// [Serializable] public class PlanRelatedBundleEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The identity of the bundle to plan for. - /// The recommended requested state for the bundle. - /// The requested state for the bundle. - /// The recommendation from the engine. + /// public PlanRelatedBundleEventArgs(string bundleId, RequestState recommendedState, RequestState state, bool cancelRecommendation) : base(cancelRecommendation) { @@ -842,19 +815,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when engine is about to plan a feature in an MSI package. + /// Event arguments for /// [Serializable] public class PlanMsiFeatureEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// Package identifier being planned. - /// Feature identifier being planned. - /// Recommended feature state being planned. - /// Feature state being planned. - /// The recommendation from the engine. + /// public PlanMsiFeatureEventArgs(string packageId, string featureId, FeatureState recommendedState, FeatureState state, bool cancelRecommendation) : base(cancelRecommendation) { @@ -886,21 +852,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine is planning an MSI or MSP package. + /// Event arguments for /// [Serializable] public class PlanMsiPackageEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The identity of the package planned for. - /// Whether the package is planned to execute or roll back. - /// The action planned for the package. - /// The recommendation from the engine. - /// The requested MSI property to add. - /// The requested internal UI level. - /// Whether Burn is requested to set up an external UI handler. + /// public PlanMsiPackageEventArgs(string packageId, bool shouldExecute, ActionState action, bool cancelRecommendation, BURN_MSI_PROPERTY actionMsiProperty, INSTALLUILEVEL uiLevel, bool disableExternalUiHandler) : base(cancelRecommendation) { @@ -1080,16 +1037,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine has begun installing the bundle. + /// Event arguments for /// [Serializable] public class ApplyBeginEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The number of phases during apply. - /// The recommendation from the engine. + /// public ApplyBeginEventArgs(int phaseCount, bool cancelRecommendation) : base(cancelRecommendation) { @@ -1104,15 +1057,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine is about to start the elevated process. + /// Event arguments for /// [Serializable] public class ElevateBeginEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The recommendation from the engine. + /// public ElevateBeginEventArgs(bool cancelRecommendation) : base(cancelRecommendation) { @@ -1136,17 +1086,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine has changed progress for the bundle installation. + /// Event arguments for /// [Serializable] public class ProgressEventArgs : CancellableHResultEventArgs { - /// - /// Creates an new instance of the class. - /// - /// The percentage from 0 to 100 completed for a package. - /// The percentage from 0 to 100 completed for the bundle. - /// The recommendation from the engine. + /// public ProgressEventArgs(int progressPercentage, int overallPercentage, bool cancelRecommendation) : base(cancelRecommendation) { @@ -1166,22 +1111,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine has encountered an error. + /// Event arguments for /// [Serializable] public class ErrorEventArgs : ResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The error type. - /// The identity of the package that yielded the error. - /// The error code. - /// The error message. - /// Recommended display flags for an error dialog. - /// The exteded data for the error. - /// Recommended result from engine. - /// The result to return to the engine. + /// public ErrorEventArgs(ErrorType errorType, string packageId, int errorCode, string errorMessage, int dwUIHint, string[] data, Result recommendation, Result result) : base(recommendation, result) { @@ -1225,15 +1160,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine has begun registering the location and visibility of the bundle. + /// Event arguments for /// [Serializable] public class RegisterBeginEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The recommendation from the engine. + /// public RegisterBeginEventArgs(bool cancelRecommendation) : base(cancelRecommendation) { @@ -1301,15 +1233,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine has begun caching the installation sources. + /// Event arguments for /// [Serializable] public class CacheBeginEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The recommendation from the engine. + /// public CacheBeginEventArgs(bool cancelRecommendation) : base(cancelRecommendation) { @@ -1363,43 +1292,13 @@ namespace WixToolset.Mba.Core /// EventArgs for . /// [Serializable] - public class CacheAcquireProgressEventArgs : CancellableHResultEventArgs + public class CacheAcquireProgressEventArgs : CacheProgressBaseEventArgs { /// public CacheAcquireProgressEventArgs(string packageOrContainerId, string payloadId, long progress, long total, int overallPercentage, bool cancelRecommendation) - : base(cancelRecommendation) + : base(packageOrContainerId, payloadId, progress, total, overallPercentage, cancelRecommendation) { - this.PackageOrContainerId = packageOrContainerId; - this.PayloadId = payloadId; - this.Progress = progress; - this.Total = total; - this.OverallPercentage = overallPercentage; } - - /// - /// Gets the identifier of the container or package. - /// - public string PackageOrContainerId { get; private set; } - - /// - /// Gets the identifier of the payload (if acquiring a payload). - /// - public string PayloadId { get; private set; } - - /// - /// Gets the number of bytes cached thus far. - /// - public long Progress { get; private set; } - - /// - /// Gets the total bytes to cache. - /// - public long Total { get; private set; } - - /// - /// Gets the overall percentage of progress of caching. - /// - public int OverallPercentage { get; private set; } } /// @@ -1428,25 +1327,23 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine starts the verification of a payload. + /// EventArgs for . /// [Serializable] public class CacheVerifyBeginEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - public CacheVerifyBeginEventArgs(string packageId, string payloadId, bool cancelRecommendation) + /// + public CacheVerifyBeginEventArgs(string packageOrContainerId, string payloadId, bool cancelRecommendation) : base(cancelRecommendation) { - this.PackageId = packageId; + this.PackageOrContainerId = packageOrContainerId; this.PayloadId = payloadId; } /// - /// Gets the identifier of the package. + /// Gets the identifier of the container or package. /// - public string PackageId { get; private set; } + public string PackageOrContainerId { get; private set; } /// /// Gets the identifier of the payload. @@ -1455,25 +1352,42 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine completes the verification of a payload. + /// EventArgs for . /// [Serializable] - public class CacheVerifyCompleteEventArgs : ActionEventArgs + public class CacheVerifyProgressEventArgs : CacheProgressBaseEventArgs { + /// + public CacheVerifyProgressEventArgs(string packageOrContainerId, string payloadId, long progress, long total, int overallPercentage, CacheVerifyStep verifyStep, bool cancelRecommendation) + : base(packageOrContainerId, payloadId, progress, total, overallPercentage, cancelRecommendation) + { + this.Step = verifyStep; + } + /// - /// Creates a new instance of the class. + /// Gets the current verification step. /// - public CacheVerifyCompleteEventArgs(string packageId, string payloadId, int hrStatus, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action) + public CacheVerifyStep Step { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class CacheVerifyCompleteEventArgs : ActionEventArgs + { + /// + public CacheVerifyCompleteEventArgs(string packageOrContainerId, string payloadId, int hrStatus, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action) : base(hrStatus, recommendation, action) { - this.PackageId = packageId; + this.PackageOrContainerId = packageOrContainerId; this.PayloadId = payloadId; } /// - /// Gets the identifier of the package. + /// Gets the identifier of the container or package. /// - public string PackageId { get; private set; } + public string PackageOrContainerId { get; private set; } /// /// Gets the identifier of the payload. @@ -1498,16 +1412,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine has begun installing packages. + /// Event arguments for /// [Serializable] public class ExecuteBeginEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The number of packages to act on. - /// The recommendation from the engine. + /// public ExecuteBeginEventArgs(int packageCount, bool cancelRecommendation) : base(cancelRecommendation) { @@ -1521,20 +1431,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine has begun installing a specific package. + /// Event arguments for /// [Serializable] public class ExecutePackageBeginEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The identity of the package to act on. - /// Whether the package is being executed or rolled back. - /// The action about to be executed. - /// The internal UI level (if this is an MSI or MSP package). - /// Whether Burn will set up an external UI handler (if this is an MSI or MSP package). - /// The recommendation from the engine. + /// public ExecutePackageBeginEventArgs(string packageId, bool shouldExecute, ActionState action, INSTALLUILEVEL uiLevel, bool disableExternalUiHandler, bool cancelRecommendation) : base(cancelRecommendation) { @@ -1572,17 +1474,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine executes one or more patches targeting a product. + /// Event arguments for /// [Serializable] public class ExecutePatchTargetEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The identity of the package to act on. - /// The product code of the target of the patch. - /// The recommendation from the engine. + /// public ExecutePatchTargetEventArgs(string packageId, string targetProductCode, bool cancelRecommendation) : base(cancelRecommendation) { @@ -1602,21 +1499,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when Windows Installer sends an installation message. + /// Event arguments for /// [Serializable] public class ExecuteMsiMessageEventArgs : ResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The identity of the package that yielded this message. - /// The type of this message. - /// Recommended display flags for this message. - /// The message. - /// The extended data for the message. - /// Recommended result from engine. - /// The result to return to the engine. + /// public ExecuteMsiMessageEventArgs(string packageId, InstallMessage messageType, int dwUIHint, string message, string[] data, Result recommendation, Result result) : base(recommendation, result) { @@ -1654,18 +1542,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arugments used for file in use installation messages. + /// Event arguments for /// [Serializable] public class ExecuteFilesInUseEventArgs : ResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The identity of the package that yielded the files in use message. - /// The list of files in use. - /// Recommended result from engine. - /// The result to return to the engine. + /// public ExecuteFilesInUseEventArgs(string packageId, string[] files, Result recommendation, Result result) : base(recommendation, result) { @@ -1685,19 +1567,13 @@ namespace WixToolset.Mba.Core } /// + /// Event arguments for /// Additional arguments used when the engine has completed installing a specific package. /// [Serializable] public class ExecutePackageCompleteEventArgs : ActionEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The identity of the package that was acted on. - /// The return code of the operation. - /// Whether a restart is required. - /// Recommended action from engine. - /// The action to perform. + /// public ExecutePackageCompleteEventArgs(string packageId, int hrStatus, ApplyRestart restart, BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION recommendation, BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION action) : base(hrStatus, recommendation, action) { @@ -1733,18 +1609,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine has completed installing the bundle. + /// Event arguments for /// [Serializable] public class ApplyCompleteEventArgs : ActionEventArgs { - /// - /// Creates a new instance of the clas. - /// - /// The return code of the operation. - /// Whether a restart is required. - /// Recommended action from engine. - /// The action to perform. + /// public ApplyCompleteEventArgs(int hrStatus, ApplyRestart restart, BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation, BOOTSTRAPPER_APPLYCOMPLETE_ACTION action) : base(hrStatus, recommendation, action) { @@ -1819,18 +1689,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used by the engine when it has begun caching a specific package. + /// Event arguments for /// [Serializable] public class CachePackageBeginEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The identity of the package that is being cached. - /// Number of payloads to be cached. - /// The size on disk required by the specific package. - /// The recommendation from the engine. + /// public CachePackageBeginEventArgs(string packageId, int cachePayloads, long packageCacheSize, bool cancelRecommendation) : base(cancelRecommendation) { @@ -1856,18 +1720,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments passed by the engine when it has completed caching a specific package. + /// Event arguments for /// [Serializable] public class CachePackageCompleteEventArgs : ActionEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The identity of the package that was cached. - /// The return code of the operation. - /// Recommended action from engine. - /// The action to perform. + /// public CachePackageCompleteEventArgs(string packageId, int hrStatus, BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION recommendation, BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION action) : base(hrStatus, recommendation, action) { @@ -1881,18 +1739,12 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments passed by the engine while executing on payload. + /// Event arguments for /// [Serializable] public class ExecuteProgressEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The identifier of the package being executed. - /// The percentage from 0 to 100 of the execution progress for a single payload. - /// The percentage from 0 to 100 of the execution progress for all payload. - /// The recommendation from the engine. + /// public ExecuteProgressEventArgs(string packageId, int progressPercentage, int overallPercentage, bool cancelRecommendation) : base(cancelRecommendation) { @@ -2187,4 +2039,130 @@ namespace WixToolset.Mba.Core { } } + + /// + /// EventArgs for . + /// + [Serializable] + public class CacheContainerOrPayloadVerifyBeginEventArgs : CancellableHResultEventArgs + { + /// + public CacheContainerOrPayloadVerifyBeginEventArgs(string packageOrContainerId, string payloadId, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageOrContainerId = packageOrContainerId; + this.PayloadId = payloadId; + } + + /// + /// Gets the identifier of the container or package. + /// + public string PackageOrContainerId { get; private set; } + + /// + /// Gets the identifier of the payload. + /// + public string PayloadId { get; private set; } + } + + /// + /// EventArgs for . + /// + [Serializable] + public class CacheContainerOrPayloadVerifyProgressEventArgs : CacheProgressBaseEventArgs + { + /// + public CacheContainerOrPayloadVerifyProgressEventArgs(string packageOrContainerId, string payloadId, long progress, long total, int overallPercentage, bool cancelRecommendation) + : base(packageOrContainerId, payloadId, progress, total, overallPercentage, cancelRecommendation) + { + } + } + + /// + /// Event arguments for + /// + [Serializable] + public class CacheContainerOrPayloadVerifyCompleteEventArgs : StatusEventArgs + { + /// + public CacheContainerOrPayloadVerifyCompleteEventArgs(string packageOrContainerId, string payloadId, int hrStatus) + : base(hrStatus) + { + this.PackageOrContainerId = packageOrContainerId; + this.PayloadId = payloadId; + } + + /// + /// Gets the identifier of the container or package. + /// + public string PackageOrContainerId { get; private set; } + + /// + /// Gets the identifier of the payload. + /// + public string PayloadId { get; private set; } + } + + /// + /// EventArgs for . + /// + [Serializable] + public class CachePayloadExtractBeginEventArgs : CancellableHResultEventArgs + { + /// + public CachePayloadExtractBeginEventArgs(string containerId, string payloadId, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.ContainerId = containerId; + this.PayloadId = payloadId; + } + + /// + /// Gets the identifier of the container. + /// + public string ContainerId { get; private set; } + + /// + /// Gets the identifier of the payload. + /// + public string PayloadId { get; private set; } + } + + /// + /// EventArgs for . + /// + [Serializable] + public class CachePayloadExtractProgressEventArgs : CacheProgressBaseEventArgs + { + /// + public CachePayloadExtractProgressEventArgs(string containerId, string payloadId, long progress, long total, int overallPercentage, bool cancelRecommendation) + : base(containerId, payloadId, progress, total, overallPercentage, cancelRecommendation) + { + } + } + + /// + /// Event arguments for + /// + [Serializable] + public class CachePayloadExtractCompleteEventArgs : StatusEventArgs + { + /// + public CachePayloadExtractCompleteEventArgs(string containerId, string payloadId, int hrStatus) + : base(hrStatus) + { + this.ContainerId = containerId; + this.PayloadId = payloadId; + } + + /// + /// Gets the identifier of the container. + /// + public string ContainerId { get; private set; } + + /// + /// Gets the identifier of the payload. + /// + public string PayloadId { get; private set; } + } } diff --git a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs index 88c65674..2195fd4b 100644 --- a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs @@ -3,7 +3,6 @@ namespace WixToolset.Mba.Core { using System; - using System.CodeDom.Compiler; using System.Runtime.InteropServices; /// @@ -14,6 +13,29 @@ namespace WixToolset.Mba.Core [Guid("53C31D56-49C0-426B-AB06-099D717C67FE")] public interface IBootstrapperApplication { + /// + /// Low level method that is called directly from the engine. + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int BAProc( + int message, + IntPtr pvArgs, + IntPtr pvResults, + IntPtr pvContext + ); + + /// + /// Low level method that is called directly from the engine. + /// + void BAProcFallback( + int message, + IntPtr pvArgs, + IntPtr pvResults, + ref int phr, + IntPtr pvContext + ); + /// /// See . /// @@ -600,31 +622,36 @@ namespace WixToolset.Mba.Core /// /// See . /// - /// - /// - /// - /// [PreserveSig] [return: MarshalAs(UnmanagedType.I4)] int OnCacheVerifyBegin( - [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, [MarshalAs(UnmanagedType.Bool)] ref bool fCancel ); + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCacheVerifyProgress( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, + [MarshalAs(UnmanagedType.U8)] long dw64Progress, + [MarshalAs(UnmanagedType.U8)] long dw64Total, + [MarshalAs(UnmanagedType.U4)] int dwOverallPercentage, + [MarshalAs(UnmanagedType.I4)] CacheVerifyStep verifyStep, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + /// /// See . /// - /// - /// - /// - /// - /// - /// [PreserveSig] [return: MarshalAs(UnmanagedType.I4)] int OnCacheVerifyComplete( - [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, int hrStatus, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation, @@ -1006,36 +1033,75 @@ namespace WixToolset.Mba.Core ); /// - /// Low level method that is called directly from the engine. + /// See . /// - /// - /// - /// - /// - /// [PreserveSig] [return: MarshalAs(UnmanagedType.I4)] - int BAProc( - int message, - IntPtr pvArgs, - IntPtr pvResults, - IntPtr pvContext + int OnCacheContainerOrPayloadVerifyBegin( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel ); /// - /// Low level method that is called directly from the engine. + /// See . /// - /// - /// - /// - /// - /// - void BAProcFallback( - int message, - IntPtr pvArgs, - IntPtr pvResults, - ref int phr, - IntPtr pvContext + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCacheContainerOrPayloadVerifyProgress( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, + [MarshalAs(UnmanagedType.U8)] long dw64Progress, + [MarshalAs(UnmanagedType.U8)] long dw64Total, + [MarshalAs(UnmanagedType.U4)] int dwOverallPercentage, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCacheContainerOrPayloadVerifyComplete( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, + int hrStatus + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCachePayloadExtractBegin( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCachePayloadExtractProgress( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, + [MarshalAs(UnmanagedType.U8)] long dw64Progress, + [MarshalAs(UnmanagedType.U8)] long dw64Total, + [MarshalAs(UnmanagedType.U4)] int dwOverallPercentage, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCachePayloadExtractComplete( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, + int hrStatus ); } @@ -1448,6 +1514,26 @@ namespace WixToolset.Mba.Core Retry, } + /// + /// The current step when verifying a container or payload. + /// + public enum CacheVerifyStep + { + /// + /// Copying or moving the file from the working path to the unverified path. + /// Not used during Layout. + /// + Stage, + /// + /// Hashing the file. + /// + Hash, + /// + /// Copying or moving the file to the final location. + /// + Finalize, + } + /// /// The restart state after a package or all packages were applied. /// @@ -1566,7 +1652,7 @@ namespace WixToolset.Mba.Core None, /// - /// Instructs the engine to try the acquisition of the package again. + /// Instructs the engine to try the acquisition of the payload again. /// Ignored if hrStatus is a success. /// Retry, diff --git a/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs b/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs index 03f94d37..a295f6c0 100644 --- a/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs @@ -44,7 +44,7 @@ namespace WixToolset.Mba.Core event EventHandler CacheAcquireComplete; /// - /// Fired when the engine has progress acquiring the installation sources. + /// Fired when the engine has progress acquiring the payload or container. /// event EventHandler CacheAcquireProgress; @@ -63,6 +63,21 @@ namespace WixToolset.Mba.Core /// event EventHandler CacheComplete; + /// + /// Fired when the engine begins the verification of the payload or container that was already in the package cache. + /// + event EventHandler CacheContainerOrPayloadVerifyBegin; + + /// + /// Fired when the engine has completed the verification of the payload or container that was already in the package cache. + /// + event EventHandler CacheContainerOrPayloadVerifyComplete; + + /// + /// Fired when the engine has progress verifying the payload or container that was already in the package cache. + /// + event EventHandler CacheContainerOrPayloadVerifyProgress; + /// /// Fired when the engine has begun caching a specific package. /// @@ -74,15 +89,35 @@ namespace WixToolset.Mba.Core event EventHandler CachePackageComplete; /// - /// Fired when the engine begins the verification of the acquired installation sources. + /// Fired when the engine begins the extraction of the payload from the container. + /// + event EventHandler CachePayloadExtractBegin; + + /// + /// Fired when the engine has completed the extraction of the payload from the container. + /// + event EventHandler CachePayloadExtractComplete; + + /// + /// Fired when the engine has progress extracting the payload from the container. + /// + event EventHandler CachePayloadExtractProgress; + + /// + /// Fired when the engine begins the verification of the acquired payload or container. /// event EventHandler CacheVerifyBegin; /// - /// Fired when the engine complete the verification of the acquired installation sources. + /// Fired when the engine has completed the verification of the acquired payload or container. /// event EventHandler CacheVerifyComplete; + /// + /// Fired when the engine has progress verifying the payload or container. + /// + event EventHandler CacheVerifyProgress; + /// /// Fired when the engine is about to commit an MSI transaction. /// @@ -179,7 +214,7 @@ namespace WixToolset.Mba.Core event EventHandler ExecuteComplete; /// - /// Fired when Windows Installer sends a files in use installation message. + /// Fired when a package sends a files in use installation message. /// event EventHandler ExecuteFilesInUse; @@ -204,7 +239,7 @@ namespace WixToolset.Mba.Core event EventHandler ExecutePatchTarget; /// - /// Fired by the engine while executing on payload. + /// Fired by the engine while executing a package. /// event EventHandler ExecuteProgress; diff --git a/src/balutil/inc/BAFunctions.h b/src/balutil/inc/BAFunctions.h index 07f7a750..2970478f 100644 --- a/src/balutil/inc/BAFunctions.h +++ b/src/balutil/inc/BAFunctions.h @@ -74,6 +74,13 @@ enum BA_FUNCTIONS_MESSAGE BA_FUNCTIONS_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE, BA_FUNCTIONS_MESSAGE_ONPLANNEDPACKAGE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDPACKAGE, BA_FUNCTIONS_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE, + BA_FUNCTIONS_MESSAGE_ONCACHEVERIFYPROGRESS = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYPROGRESS, + BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN, + BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE, + BA_FUNCTIONS_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS, + BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN, + BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE, + BA_FUNCTIONS_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS = BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS, BA_FUNCTIONS_MESSAGE_ONTHEMELOADED = 1024, BA_FUNCTIONS_MESSAGE_WNDPROC, diff --git a/src/balutil/inc/BalBaseBAFunctions.h b/src/balutil/inc/BalBaseBAFunctions.h index ca727f49..054bfb26 100644 --- a/src/balutil/inc/BalBaseBAFunctions.h +++ b/src/balutil/inc/BalBaseBAFunctions.h @@ -69,6 +69,26 @@ public: // IUnknown } public: // IBootstrapperApplication + virtual STDMETHODIMP_(HRESULT) BAProc( + __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, + __in const LPVOID /*pvArgs*/, + __inout LPVOID /*pvResults*/, + __in_opt LPVOID /*pvContext*/ + ) + { + return E_NOTIMPL; + } + + virtual STDMETHODIMP_(void) BAProcFallback( + __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, + __in const LPVOID /*pvArgs*/, + __inout LPVOID /*pvResults*/, + __inout HRESULT* /*phr*/, + __in_opt LPVOID /*pvContext*/ + ) + { + } + virtual STDMETHODIMP OnStartup() { return S_OK; @@ -439,7 +459,7 @@ public: // IBootstrapperApplication } virtual STDMETHODIMP OnCacheVerifyBegin( - __in_z LPCWSTR /*wzPackageId*/, + __in_z LPCWSTR /*wzPackageOrContainerId*/, __in_z LPCWSTR /*wzPayloadId*/, __inout BOOL* /*pfCancel*/ ) @@ -447,8 +467,21 @@ public: // IBootstrapperApplication return S_OK; } + virtual STDMETHODIMP OnCacheVerifyProgress( + __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, + __in_z_opt LPCWSTR /*wzPayloadId*/, + __in DWORD64 /*dw64Progress*/, + __in DWORD64 /*dw64Total*/, + __in DWORD /*dwOverallPercentage*/, + __in BOOTSTRAPPER_CACHE_VERIFY_STEP /*verifyStep*/, + __inout BOOL* /*pfCancel*/ + ) + { + return S_OK; + } + virtual STDMETHODIMP OnCacheVerifyComplete( - __in_z LPCWSTR /*wzPackageId*/, + __in_z LPCWSTR /*wzPackageOrContainerId*/, __in_z LPCWSTR /*wzPayloadId*/, __in HRESULT /*hrStatus*/, __in BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION /*recommendation*/, @@ -684,24 +717,64 @@ public: // IBootstrapperApplication return S_OK; } - virtual STDMETHODIMP_(HRESULT) BAProc( - __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, - __in const LPVOID /*pvArgs*/, - __inout LPVOID /*pvResults*/, - __in_opt LPVOID /*pvContext*/ + virtual STDMETHODIMP OnCacheContainerOrPayloadVerifyBegin( + __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, + __in_z_opt LPCWSTR /*wzPayloadId*/, + __inout BOOL* /*pfCancel*/ ) { - return E_NOTIMPL; + return S_OK; } - virtual STDMETHODIMP_(void) BAProcFallback( - __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, - __in const LPVOID /*pvArgs*/, - __inout LPVOID /*pvResults*/, - __inout HRESULT* /*phr*/, - __in_opt LPVOID /*pvContext*/ + virtual STDMETHODIMP OnCacheContainerOrPayloadVerifyProgress( + __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, + __in_z_opt LPCWSTR /*wzPayloadId*/, + __in DWORD64 /*dw64Progress*/, + __in DWORD64 /*dw64Total*/, + __in DWORD /*dwOverallPercentage*/, + __inout BOOL* /*pfCancel*/ + ) + { + return S_OK; + } + + virtual STDMETHODIMP OnCacheContainerOrPayloadVerifyComplete( + __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, + __in_z_opt LPCWSTR /*wzPayloadId*/, + __in HRESULT /*hrStatus*/ + ) + { + return S_OK; + } + + virtual STDMETHODIMP OnCachePayloadExtractBegin( + __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, + __in_z_opt LPCWSTR /*wzPayloadId*/, + __inout BOOL* /*pfCancel*/ ) { + return S_OK; + } + + virtual STDMETHODIMP OnCachePayloadExtractProgress( + __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, + __in_z_opt LPCWSTR /*wzPayloadId*/, + __in DWORD64 /*dw64Progress*/, + __in DWORD64 /*dw64Total*/, + __in DWORD /*dwOverallPercentage*/, + __inout BOOL* /*pfCancel*/ + ) + { + return S_OK; + } + + virtual STDMETHODIMP OnCachePayloadExtractComplete( + __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, + __in_z_opt LPCWSTR /*wzPayloadId*/, + __in HRESULT /*hrStatus*/ + ) + { + return S_OK; } public: // IBAFunctions diff --git a/src/balutil/inc/BalBaseBootstrapperApplication.h b/src/balutil/inc/BalBaseBootstrapperApplication.h index 3d3e4ffa..812025eb 100644 --- a/src/balutil/inc/BalBaseBootstrapperApplication.h +++ b/src/balutil/inc/BalBaseBootstrapperApplication.h @@ -61,6 +61,26 @@ public: // IUnknown } public: // IBootstrapperApplication + virtual STDMETHODIMP_(HRESULT) BAProc( + __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, + __in const LPVOID /*pvArgs*/, + __inout LPVOID /*pvResults*/, + __in_opt LPVOID /*pvContext*/ + ) + { + return E_NOTIMPL; + } + + virtual STDMETHODIMP_(void) BAProcFallback( + __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, + __in const LPVOID /*pvArgs*/, + __inout LPVOID /*pvResults*/, + __inout HRESULT* /*phr*/, + __in_opt LPVOID /*pvContext*/ + ) + { + } + virtual STDMETHODIMP OnStartup() { return S_OK; @@ -540,7 +560,7 @@ public: // IBootstrapperApplication } virtual STDMETHODIMP OnCacheVerifyBegin( - __in_z LPCWSTR /*wzPackageId*/, + __in_z LPCWSTR /*wzPackageOrContainerId*/, __in_z LPCWSTR /*wzPayloadId*/, __inout BOOL* pfCancel ) @@ -549,8 +569,22 @@ public: // IBootstrapperApplication return S_OK; } + virtual STDMETHODIMP OnCacheVerifyProgress( + __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, + __in_z_opt LPCWSTR /*wzPayloadId*/, + __in DWORD64 /*dw64Progress*/, + __in DWORD64 /*dw64Total*/, + __in DWORD /*dwOverallPercentage*/, + __in BOOTSTRAPPER_CACHE_VERIFY_STEP /*verifyStep*/, + __inout BOOL* pfCancel + ) + { + *pfCancel |= CheckCanceled(); + return S_OK; + } + virtual STDMETHODIMP OnCacheVerifyComplete( - __in_z LPCWSTR /*wzPackageId*/, + __in_z LPCWSTR /*wzPackageOrContainerId*/, __in_z LPCWSTR /*wzPayloadId*/, __in HRESULT /*hrStatus*/, __in BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION /*recommendation*/, @@ -870,24 +904,68 @@ public: // IBootstrapperApplication return S_OK; } - virtual STDMETHODIMP_(HRESULT) BAProc( - __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, - __in const LPVOID /*pvArgs*/, - __inout LPVOID /*pvResults*/, - __in_opt LPVOID /*pvContext*/ + virtual STDMETHODIMP OnCacheContainerOrPayloadVerifyBegin( + __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, + __in_z_opt LPCWSTR /*wzPayloadId*/, + __inout BOOL* pfCancel ) { - return E_NOTIMPL; + *pfCancel |= CheckCanceled(); + return S_OK; } - virtual STDMETHODIMP_(void) BAProcFallback( - __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, - __in const LPVOID /*pvArgs*/, - __inout LPVOID /*pvResults*/, - __inout HRESULT* /*phr*/, - __in_opt LPVOID /*pvContext*/ + virtual STDMETHODIMP OnCacheContainerOrPayloadVerifyProgress( + __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, + __in_z_opt LPCWSTR /*wzPayloadId*/, + __in DWORD64 /*dw64Progress*/, + __in DWORD64 /*dw64Total*/, + __in DWORD /*dwOverallPercentage*/, + __inout BOOL* pfCancel ) { + *pfCancel |= CheckCanceled(); + return S_OK; + } + + virtual STDMETHODIMP OnCacheContainerOrPayloadVerifyComplete( + __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, + __in_z_opt LPCWSTR /*wzPayloadId*/, + __in HRESULT /*hrStatus*/ + ) + { + return S_OK; + } + + virtual STDMETHODIMP OnCachePayloadExtractBegin( + __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, + __in_z_opt LPCWSTR /*wzPayloadId*/, + __inout BOOL* pfCancel + ) + { + *pfCancel |= CheckCanceled(); + return S_OK; + } + + virtual STDMETHODIMP OnCachePayloadExtractProgress( + __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, + __in_z_opt LPCWSTR /*wzPayloadId*/, + __in DWORD64 /*dw64Progress*/, + __in DWORD64 /*dw64Total*/, + __in DWORD /*dwOverallPercentage*/, + __inout BOOL* pfCancel + ) + { + *pfCancel |= CheckCanceled(); + return S_OK; + } + + virtual STDMETHODIMP OnCachePayloadExtractComplete( + __in_z_opt LPCWSTR /*wzPackageOrContainerId*/, + __in_z_opt LPCWSTR /*wzPayloadId*/, + __in HRESULT /*hrStatus*/ + ) + { + return S_OK; } protected: diff --git a/src/balutil/inc/BalBaseBootstrapperApplicationProc.h b/src/balutil/inc/BalBaseBootstrapperApplicationProc.h index 42ffeb79..10769529 100644 --- a/src/balutil/inc/BalBaseBootstrapperApplicationProc.h +++ b/src/balutil/inc/BalBaseBootstrapperApplicationProc.h @@ -342,6 +342,15 @@ static HRESULT BalBaseBAProcOnCacheVerifyBegin( return pBA->OnCacheVerifyBegin(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, &pResults->fCancel); } +static HRESULT BalBaseBAProcOnCacheVerifyProgress( + __in IBootstrapperApplication* pBA, + __in BA_ONCACHEVERIFYPROGRESS_ARGS* pArgs, + __inout BA_ONCACHEVERIFYPROGRESS_RESULTS* pResults + ) +{ + return pBA->OnCacheVerifyProgress(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, pArgs->verifyStep, &pResults->fCancel); +} + static HRESULT BalBaseBAProcOnCacheVerifyComplete( __in IBootstrapperApplication* pBA, __in BA_ONCACHEVERIFYCOMPLETE_ARGS* pArgs, @@ -594,6 +603,60 @@ static HRESULT BalBaseBAProcOnPlanForwardCompatibleBundle( return pBA->OnPlanForwardCompatibleBundle(pArgs->wzBundleId, pArgs->relationType, pArgs->wzBundleTag, pArgs->fPerMachine, pArgs->wzVersion, pArgs->fRecommendedIgnoreBundle, &pResults->fCancel, &pResults->fIgnoreBundle); } +static HRESULT BalBaseBAProcOnCacheContainerOrPayloadVerifyBegin( + __in IBootstrapperApplication* pBA, + __in BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_ARGS* pArgs, + __inout BA_ONCACHECONTAINERORPAYLOADVERIFYBEGIN_RESULTS* pResults + ) +{ + return pBA->OnCacheContainerOrPayloadVerifyBegin(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, &pResults->fCancel); +} + +static HRESULT BalBaseBAProcOnCacheContainerOrPayloadVerifyProgress( + __in IBootstrapperApplication* pBA, + __in BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_ARGS* pArgs, + __inout BA_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS_RESULTS* pResults + ) +{ + return pBA->OnCacheContainerOrPayloadVerifyProgress(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, &pResults->fCancel); +} + +static HRESULT BalBaseBAProcOnCacheContainerOrPayloadVerifyComplete( + __in IBootstrapperApplication* pBA, + __in BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_ARGS* pArgs, + __inout BA_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE_RESULTS* /*pResults*/ + ) +{ + return pBA->OnCacheContainerOrPayloadVerifyComplete(pArgs->wzPackageOrContainerId, pArgs->wzPayloadId, pArgs->hrStatus); +} + +static HRESULT BalBaseBAProcOnCachePayloadExtractBegin( + __in IBootstrapperApplication* pBA, + __in BA_ONCACHEPAYLOADEXTRACTBEGIN_ARGS* pArgs, + __inout BA_ONCACHEPAYLOADEXTRACTBEGIN_RESULTS* pResults + ) +{ + return pBA->OnCachePayloadExtractBegin(pArgs->wzContainerId, pArgs->wzPayloadId, &pResults->fCancel); +} + +static HRESULT BalBaseBAProcOnCachePayloadExtractProgress( + __in IBootstrapperApplication* pBA, + __in BA_ONCACHEPAYLOADEXTRACTPROGRESS_ARGS* pArgs, + __inout BA_ONCACHEPAYLOADEXTRACTPROGRESS_RESULTS* pResults + ) +{ + return pBA->OnCachePayloadExtractProgress(pArgs->wzContainerId, pArgs->wzPayloadId, pArgs->dw64Progress, pArgs->dw64Total, pArgs->dwOverallPercentage, &pResults->fCancel); +} + +static HRESULT BalBaseBAProcOnCachePayloadExtractComplete( + __in IBootstrapperApplication* pBA, + __in BA_ONCACHEPAYLOADEXTRACTCOMPLETE_ARGS* pArgs, + __inout BA_ONCACHEPAYLOADEXTRACTCOMPLETE_RESULTS* /*pResults*/ + ) +{ + return pBA->OnCachePayloadExtractComplete(pArgs->wzContainerId, pArgs->wzPayloadId, pArgs->hrStatus); +} + /******************************************************************* BalBaseBootstrapperApplicationProc - requires pvContext to be of type IBootstrapperApplication. Provides a default mapping between the new message based BA interface and @@ -722,6 +785,9 @@ static HRESULT WINAPI BalBaseBootstrapperApplicationProc( case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN: hr = BalBaseBAProcOnCacheVerifyBegin(pBA, reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYPROGRESS: + hr = BalBaseBAProcOnCacheVerifyProgress(pBA, reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE: hr = BalBaseBAProcOnCacheVerifyComplete(pBA, reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); break; @@ -808,6 +874,24 @@ static HRESULT WINAPI BalBaseBootstrapperApplicationProc( case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE: hr = BalBaseBAProcOnPlanForwardCompatibleBundle(pBA, reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYBEGIN: + hr = BalBaseBAProcOnCacheContainerOrPayloadVerifyBegin(pBA, reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYPROGRESS: + hr = BalBaseBAProcOnCacheContainerOrPayloadVerifyProgress(pBA, reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECONTAINERORPAYLOADVERIFYCOMPLETE: + hr = BalBaseBAProcOnCacheContainerOrPayloadVerifyComplete(pBA, reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTBEGIN: + hr = BalBaseBAProcOnCachePayloadExtractBegin(pBA, reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTPROGRESS: + hr = BalBaseBAProcOnCachePayloadExtractProgress(pBA, reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPAYLOADEXTRACTCOMPLETE: + hr = BalBaseBAProcOnCachePayloadExtractComplete(pBA, reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; } } diff --git a/src/balutil/inc/IBootstrapperApplication.h b/src/balutil/inc/IBootstrapperApplication.h index 8fcdd318..7d6a7164 100644 --- a/src/balutil/inc/IBootstrapperApplication.h +++ b/src/balutil/inc/IBootstrapperApplication.h @@ -4,6 +4,26 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-AB06-099D717C67FE") { + // BAProc - The PFN_BOOTSTRAPPER_APPLICATION_PROC can call this method to give the BA raw access to the callback from the engine. + // This might be used to help the BA support more than one version of the engine. + STDMETHOD(BAProc)( + __in BOOTSTRAPPER_APPLICATION_MESSAGE message, + __in const LPVOID pvArgs, + __inout LPVOID pvResults, + __in_opt LPVOID pvContext + ) = 0; + + // BAProcFallback - The PFN_BOOTSTRAPPER_APPLICATION_PROC can call this method + // to give the BA the ability to use default behavior + // and then forward the message to extensions. + STDMETHOD_(void, BAProcFallback)( + __in BOOTSTRAPPER_APPLICATION_MESSAGE message, + __in const LPVOID pvArgs, + __inout LPVOID pvResults, + __inout HRESULT* phr, + __in_opt LPVOID pvContext + ) = 0; + // OnStartup - called when the engine is ready for the bootstrapper application to start. // STDMETHOD(OnStartup)() = 0; @@ -297,8 +317,7 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A __inout BOOL* pfCancel ) = 0; - // OnCacheAcquireProgress - called when the engine makes progresss copying - // or downloading a payload to the working folder. + // OnCacheAcquireProgress - called when the engine makes progress acquiring the payload or container. // STDMETHOD(OnCacheAcquireProgress)( __in_z_opt LPCWSTR wzPackageOrContainerId, @@ -359,6 +378,16 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A __inout BOOL* pfCancel ) = 0; + STDMETHOD(OnCacheVerifyProgress)( + __in_z_opt LPCWSTR wzPackageOrContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __in DWORD64 dw64Progress, + __in DWORD64 dw64Total, + __in DWORD dwOverallPercentage, + __in BOOTSTRAPPER_CACHE_VERIFY_STEP verifyStep, + __inout BOOL* pfCancel + ) = 0; + // OnCacheVerifyComplete - called after the engine verifies and copies // a payload or container to the package cache folder. // @@ -570,23 +599,45 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A __inout BOOL* pfIgnoreBundle ) = 0; - // BAProc - The PFN_BOOTSTRAPPER_APPLICATION_PROC can call this method to give the BA raw access to the callback from the engine. - // This might be used to help the BA support more than one version of the engine. - STDMETHOD(BAProc)( - __in BOOTSTRAPPER_APPLICATION_MESSAGE message, - __in const LPVOID pvArgs, - __inout LPVOID pvResults, - __in_opt LPVOID pvContext + STDMETHOD(OnCacheContainerOrPayloadVerifyBegin)( + __in_z_opt LPCWSTR wzPackageOrContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __inout BOOL* pfCancel ) = 0; - // BAProcFallback - The PFN_BOOTSTRAPPER_APPLICATION_PROC can call this method - // to give the BA the ability to use default behavior - // and then forward the message to extensions. - STDMETHOD_(void, BAProcFallback)( - __in BOOTSTRAPPER_APPLICATION_MESSAGE message, - __in const LPVOID pvArgs, - __inout LPVOID pvResults, - __inout HRESULT* phr, - __in_opt LPVOID pvContext + STDMETHOD(OnCacheContainerOrPayloadVerifyProgress)( + __in_z_opt LPCWSTR wzPackageOrContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __in DWORD64 dw64Progress, + __in DWORD64 dw64Total, + __in DWORD dwOverallPercentage, + __inout BOOL* pfCancel + ) = 0; + + STDMETHOD(OnCacheContainerOrPayloadVerifyComplete)( + __in_z_opt LPCWSTR wzPackageOrContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __in HRESULT hrStatus + ) = 0; + + STDMETHOD(OnCachePayloadExtractBegin)( + __in_z_opt LPCWSTR wzContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __inout BOOL* pfCancel + ) = 0; + + STDMETHOD(OnCachePayloadExtractProgress)( + __in_z_opt LPCWSTR wzContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __in DWORD64 dw64Progress, + __in DWORD64 dw64Total, + __in DWORD dwOverallPercentage, + __inout BOOL* pfCancel + ) = 0; + + STDMETHOD(OnCachePayloadExtractComplete)( + __in_z_opt LPCWSTR wzContainerId, + __in_z_opt LPCWSTR wzPayloadId, + __in HRESULT hrStatus ) = 0; }; -- cgit v1.2.3-55-g6feb