// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
namespace WixToolset.Mba.Core
{
using System;
using System.Runtime.InteropServices;
using System.Threading;
///
/// The default bootstrapper application.
///
[ClassInterface(ClassInterfaceType.None)]
public abstract class BootstrapperApplication : MarshalByRefObject, IDefaultBootstrapperApplication
{
///
/// Specifies whether this bootstrapper should run asynchronously. The default is true.
///
protected readonly bool asyncExecution;
///
/// Gets the for interaction with the engine.
///
protected readonly IEngine engine;
private bool applying;
///
/// Creates a new instance of the class.
///
protected BootstrapperApplication(IEngine engine)
{
this.engine = engine;
this.applying = false;
this.asyncExecution = true;
}
///
/// Fired when the engine is starting up the bootstrapper application.
///
public event EventHandler Startup;
///
/// Fired when the engine is shutting down the bootstrapper application.
///
public event EventHandler Shutdown;
///
/// Fired when the system is shutting down or user is logging off.
///
///
/// 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 .
/// Derivatives can change this behavior by overriding
/// or handling .
/// 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.
/// This event may be fired on a different thread.
///
public event EventHandler SystemShutdown;
///
/// Fired when the overall detection phase has begun.
///
public event EventHandler DetectBegin;
///
/// Fired when a forward compatible bundle is detected.
///
public event EventHandler DetectForwardCompatibleBundle;
///
/// Fired when the update detection phase has begun.
///
public event EventHandler DetectUpdateBegin;
///
/// Fired when the update detection has found a potential update candidate.
///
public event EventHandler DetectUpdate;
///
/// Fired when the update detection phase has completed.
///
public event EventHandler DetectUpdateComplete;
///
/// Fired when a related bundle has been detected for a bundle.
///
public event EventHandler DetectRelatedBundle;
///
/// Fired when the detection for a specific package has begun.
///
public event EventHandler DetectPackageBegin;
///
/// Fired when a package was not detected but a package using the same provider key was.
///
public event EventHandler DetectCompatibleMsiPackage;
///
/// Fired when a related MSI package has been detected for a package.
///
public event EventHandler DetectRelatedMsiPackage;
///
/// Fired when an MSP package detects a target MSI has been detected.
///
public event EventHandler DetectTargetMsiPackage;
///
/// Fired when a feature in an MSI package has been detected.
///
public event EventHandler DetectMsiFeature;
///
/// Fired when the detection for a specific package has completed.
///
public event EventHandler DetectPackageComplete;
///
/// Fired when the detection phase has completed.
///
public event EventHandler DetectComplete;
///
/// Fired when the engine has begun planning the installation.
///
public event EventHandler PlanBegin;
///
/// Fired when the engine has begun planning for a related bundle.
///
public event EventHandler PlanRelatedBundle;
///
/// Fired when the engine has begun planning the installation of a specific package.
///
public event EventHandler PlanPackageBegin;
///
/// Fired when the engine plans a new, compatible package using the same provider key.
///
public event EventHandler PlanCompatibleMsiPackageBegin;
///
/// Fired when the engine has completed planning the installation of a specific package.
///
public event EventHandler PlanCompatibleMsiPackageComplete;
///
/// Fired when the engine is about to plan the target MSI of a MSP package.
///
public event EventHandler PlanTargetMsiPackage;
///
/// Fired when the engine is about to plan a feature in an MSI package.
///
public event EventHandler PlanMsiFeature;
///
/// Fired when the engine has completed planning the installation of a specific package.
///
public event EventHandler PlanPackageComplete;
///
/// Fired when the engine has completed planning the installation.
///
public event EventHandler PlanComplete;
///
/// Fired when the engine has begun installing the bundle.
///
public event EventHandler ApplyBegin;
///
/// Fired when the engine is about to start the elevated process.
///
public event EventHandler ElevateBegin;
///
/// Fired when the engine has completed starting the elevated process.
///
public event EventHandler ElevateComplete;
///
/// Fired when the engine has changed progress for the bundle installation.
///
public event EventHandler Progress;
///
/// Fired when the engine has encountered an error.
///
public event EventHandler Error;
///
/// Fired when the engine has begun registering the location and visibility of the bundle.
///
public event EventHandler RegisterBegin;
///
/// Fired when the engine has completed registering the location and visibility of the bundle.
///
public event EventHandler RegisterComplete;
///
/// Fired when the engine has begun removing the registration for the location and visibility of the bundle.
///
public event EventHandler UnregisterBegin;
///
/// Fired when the engine has completed removing the registration for the location and visibility of the bundle.
///
public event EventHandler UnregisterComplete;
///
/// Fired when the engine has begun caching the installation sources.
///
public event EventHandler CacheBegin;
///
/// Fired when the engine has begun caching a specific package.
///
public event EventHandler CachePackageBegin;
///
/// Fired when the engine has begun acquiring the installation sources.
///
public event EventHandler CacheAcquireBegin;
///
/// Fired when the engine has progress acquiring the installation sources.
///
public event EventHandler CacheAcquireProgress;
///
/// Fired by the engine to allow the BA to change the source
/// using or .
///
public event EventHandler ResolveSource;
///
/// Fired when the engine has completed the acquisition of the installation sources.
///
public event EventHandler CacheAcquireComplete;
///
/// Fired when the engine begins the verification of the acquired installation sources.
///
public event EventHandler CacheVerifyBegin;
///
/// Fired when the engine complete the verification of the acquired installation sources.
///
public event EventHandler CacheVerifyComplete;
///
/// Fired when the engine has completed caching a specific package.
///
public event EventHandler CachePackageComplete;
///
/// Fired after the engine has cached the installation sources.
///
public event EventHandler CacheComplete;
///
/// Fired when the engine has begun installing packages.
///
public event EventHandler ExecuteBegin;
///
/// Fired when the engine has begun installing a specific package.
///
public event EventHandler ExecutePackageBegin;
///
/// Fired when the engine executes one or more patches targeting a product.
///
public event EventHandler ExecutePatchTarget;
///
/// Fired when Windows Installer sends an installation message.
///
public event EventHandler ExecuteMsiMessage;
///
/// Fired when Windows Installer sends a files in use installation message.
///
public event EventHandler ExecuteFilesInUse;
///
/// Fired when the engine has completed installing a specific package.
///
public event EventHandler ExecutePackageComplete;
///
/// Fired when the engine has completed installing packages.
///
public event EventHandler ExecuteComplete;
///
/// Fired when the engine has completed installing the bundle.
///
public event EventHandler ApplyComplete;
///
/// Fired by the engine while executing on payload.
///
public event EventHandler ExecuteProgress;
///
/// Fired when the engine is about to launch the preapproved executable.
///
public event EventHandler LaunchApprovedExeBegin;
///
/// Fired when the engine has completed launching the preapproved executable.
///
public event EventHandler LaunchApprovedExeComplete;
///
/// Entry point that is called when the bootstrapper application is ready to run.
///
protected abstract void Run();
///
/// Called by the engine on startup of the bootstrapper application.
///
/// Additional arguments for this event.
protected virtual void OnStartup(StartupEventArgs args)
{
EventHandler handler = this.Startup;
if (null != handler)
{
handler(this, args);
}
if (this.asyncExecution)
{
this.engine.Log(LogLevel.Verbose, "Creating BA thread to run asynchronously.");
Thread uiThread = new Thread(this.Run);
uiThread.Name = "UIThread";
uiThread.SetApartmentState(ApartmentState.STA);
uiThread.Start();
}
else
{
this.engine.Log(LogLevel.Verbose, "Creating BA thread to run synchronously.");
this.Run();
}
}
///
/// Called by the engine to uninitialize the BA.
///
/// Additional arguments for this event.
protected virtual void OnShutdown(ShutdownEventArgs args)
{
EventHandler handler = this.Shutdown;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the system is shutting down or the user is logging off.
///
/// Additional arguments for this event.
///
/// 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 .
/// Derivatives can change this behavior by overriding
/// or handling .
/// 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.
/// This method may be called on a different thread.
///
protected virtual void OnSystemShutdown(SystemShutdownEventArgs args)
{
EventHandler handler = this.SystemShutdown;
if (null != handler)
{
handler(this, args);
}
else if (null != args)
{
// Allow requests to shut down when critical or not applying.
bool critical = EndSessionReasons.Critical == (EndSessionReasons.Critical & args.Reasons);
args.Cancel = !critical && this.applying;
}
}
///
/// Called when the overall detection phase has begun.
///
/// Additional arguments for this event.
protected virtual void OnDetectBegin(DetectBeginEventArgs args)
{
EventHandler handler = this.DetectBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the update detection phase has begun.
///
/// Additional arguments for this event.
protected virtual void OnDetectForwardCompatibleBundle(DetectForwardCompatibleBundleEventArgs args)
{
EventHandler handler = this.DetectForwardCompatibleBundle;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the update detection phase has begun.
///
/// Additional arguments for this event.
protected virtual void OnDetectUpdateBegin(DetectUpdateBeginEventArgs args)
{
EventHandler handler = this.DetectUpdateBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Fired when the update detection has found a potential update candidate.
///
/// Additional arguments for this event.
protected virtual void OnDetectUpdate(DetectUpdateEventArgs args)
{
EventHandler handler = this.DetectUpdate;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the update detection phase has completed.
///
/// Additional arguments for this event.
protected virtual void OnDetectUpdateComplete(DetectUpdateCompleteEventArgs args)
{
EventHandler handler = this.DetectUpdateComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when a related bundle has been detected for a bundle.
///
/// Additional arguments for this event.
protected virtual void OnDetectRelatedBundle(DetectRelatedBundleEventArgs args)
{
EventHandler handler = this.DetectRelatedBundle;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the detection for a specific package has begun.
///
/// Additional arguments for this event.
protected virtual void OnDetectPackageBegin(DetectPackageBeginEventArgs args)
{
EventHandler handler = this.DetectPackageBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when a package was not detected but a package using the same provider key was.
///
/// Additional arguments for this event.
protected virtual void OnDetectCompatibleMsiPackage(DetectCompatibleMsiPackageEventArgs args)
{
EventHandler handler = this.DetectCompatibleMsiPackage;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when a related MSI package has been detected for a package.
///
/// Additional arguments for this event.
protected virtual void OnDetectRelatedMsiPackage(DetectRelatedMsiPackageEventArgs args)
{
EventHandler handler = this.DetectRelatedMsiPackage;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when an MSP package detects a target MSI has been detected.
///
/// Additional arguments for this event.
protected virtual void OnDetectTargetMsiPackage(DetectTargetMsiPackageEventArgs args)
{
EventHandler handler = this.DetectTargetMsiPackage;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when an MSI feature has been detected for a package.
///
/// Additional arguments for this event.
protected virtual void OnDetectMsiFeature(DetectMsiFeatureEventArgs args)
{
EventHandler handler = this.DetectMsiFeature;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the detection for a specific package has completed.
///
/// Additional arguments for this event.
protected virtual void OnDetectPackageComplete(DetectPackageCompleteEventArgs args)
{
EventHandler handler = this.DetectPackageComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the detection phase has completed.
///
/// Additional arguments for this event.
protected virtual void OnDetectComplete(DetectCompleteEventArgs args)
{
EventHandler handler = this.DetectComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has begun planning the installation.
///
/// Additional arguments for this event.
protected virtual void OnPlanBegin(PlanBeginEventArgs args)
{
EventHandler handler = this.PlanBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has begun planning for a prior bundle.
///
/// Additional arguments for this event.
protected virtual void OnPlanRelatedBundle(PlanRelatedBundleEventArgs args)
{
EventHandler handler = this.PlanRelatedBundle;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has begun planning the installation of a specific package.
///
/// Additional arguments for this event.
protected virtual void OnPlanPackageBegin(PlanPackageBeginEventArgs args)
{
EventHandler handler = this.PlanPackageBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine plans a new, compatible package using the same provider key.
///
/// Additional arguments for this event.
protected virtual void OnPlanCompatibleMsiPackageBegin(PlanCompatibleMsiPackageBeginEventArgs args)
{
EventHandler handler = this.PlanCompatibleMsiPackageBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has completed planning the installation of a specific package.
///
/// Additional arguments for this event.
protected virtual void OnPlanCompatibleMsiPackageComplete(PlanCompatibleMsiPackageCompleteEventArgs args)
{
EventHandler handler = this.PlanCompatibleMsiPackageComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine is about to plan the target MSI of a MSP package.
///
/// Additional arguments for this event.
protected virtual void OnPlanTargetMsiPackage(PlanTargetMsiPackageEventArgs args)
{
EventHandler handler = this.PlanTargetMsiPackage;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine is about to plan an MSI feature of a specific package.
///
/// Additional arguments for this event.
protected virtual void OnPlanMsiFeature(PlanMsiFeatureEventArgs args)
{
EventHandler handler = this.PlanMsiFeature;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when then engine has completed planning the installation of a specific package.
///
/// Additional arguments for this event.
protected virtual void OnPlanPackageComplete(PlanPackageCompleteEventArgs args)
{
EventHandler handler = this.PlanPackageComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has completed planning the installation.
///
/// Additional arguments for this event.
protected virtual void OnPlanComplete(PlanCompleteEventArgs args)
{
EventHandler handler = this.PlanComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has begun installing the bundle.
///
/// Additional arguments for this event.
protected virtual void OnApplyBegin(ApplyBeginEventArgs args)
{
EventHandler handler = this.ApplyBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine is about to start the elevated process.
///
/// Additional arguments for this event.
protected virtual void OnElevateBegin(ElevateBeginEventArgs args)
{
EventHandler handler = this.ElevateBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has completed starting the elevated process.
///
/// Additional arguments for this event.
protected virtual void OnElevateComplete(ElevateCompleteEventArgs args)
{
EventHandler handler = this.ElevateComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has changed progress for the bundle installation.
///
/// Additional arguments for this event.
protected virtual void OnProgress(ProgressEventArgs args)
{
EventHandler handler = this.Progress;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has encountered an error.
///
/// Additional arguments for this event.
protected virtual void OnError(ErrorEventArgs args)
{
EventHandler handler = this.Error;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has begun registering the location and visibility of the bundle.
///
/// Additional arguments for this event.
protected virtual void OnRegisterBegin(RegisterBeginEventArgs args)
{
EventHandler handler = this.RegisterBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has completed registering the location and visilibity of the bundle.
///
/// Additional arguments for this event.
protected virtual void OnRegisterComplete(RegisterCompleteEventArgs args)
{
EventHandler handler = this.RegisterComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has begun removing the registration for the location and visibility of the bundle.
///
/// Additional arguments for this event.
protected virtual void OnUnregisterBegin(UnregisterBeginEventArgs args)
{
EventHandler handler = this.UnregisterBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has completed removing the registration for the location and visibility of the bundle.
///
/// Additional arguments for this event.
protected virtual void OnUnregisterComplete(UnregisterCompleteEventArgs args)
{
EventHandler handler = this.UnregisterComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine begins to cache the installation sources.
///
///
protected virtual void OnCacheBegin(CacheBeginEventArgs args)
{
EventHandler handler = this.CacheBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called by the engine when it begins to cache a specific package.
///
///
protected virtual void OnCachePackageBegin(CachePackageBeginEventArgs args)
{
EventHandler handler = this.CachePackageBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine begins to cache the container or payload.
///
///
protected virtual void OnCacheAcquireBegin(CacheAcquireBeginEventArgs args)
{
EventHandler handler = this.CacheAcquireBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has progressed on caching the container or payload.
///
///
protected virtual void OnCacheAcquireProgress(CacheAcquireProgressEventArgs args)
{
EventHandler handler = this.CacheAcquireProgress;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called by the engine to allow the BA to change the source
/// using or .
///
/// Additional arguments for this event.
protected virtual void OnResolveSource(ResolveSourceEventArgs args)
{
EventHandler handler = this.ResolveSource;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine completes caching of the container or payload.
///
///
protected virtual void OnCacheAcquireComplete(CacheAcquireCompleteEventArgs args)
{
EventHandler handler = this.CacheAcquireComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has started verify the payload.
///
///
protected virtual void OnCacheVerifyBegin(CacheVerifyBeginEventArgs args)
{
EventHandler handler = this.CacheVerifyBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine completes verification of the payload.
///
///
protected virtual void OnCacheVerifyComplete(CacheVerifyCompleteEventArgs args)
{
EventHandler handler = this.CacheVerifyComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine completes caching a specific package.
///
///
protected virtual void OnCachePackageComplete(CachePackageCompleteEventArgs args)
{
EventHandler handler = this.CachePackageComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called after the engine has cached the installation sources.
///
/// Additional arguments for this event.
protected virtual void OnCacheComplete(CacheCompleteEventArgs args)
{
EventHandler handler = this.CacheComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has begun installing packages.
///
/// Additional arguments for this event.
protected virtual void OnExecuteBegin(ExecuteBeginEventArgs args)
{
EventHandler handler = this.ExecuteBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has begun installing a specific package.
///
/// Additional arguments for this event.
protected virtual void OnExecutePackageBegin(ExecutePackageBeginEventArgs args)
{
EventHandler handler = this.ExecutePackageBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine executes one or more patches targeting a product.
///
/// Additional arguments for this event.
protected virtual void OnExecutePatchTarget(ExecutePatchTargetEventArgs args)
{
EventHandler handler = this.ExecutePatchTarget;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when Windows Installer sends an installation message.
///
/// Additional arguments for this event.
protected virtual void OnExecuteMsiMessage(ExecuteMsiMessageEventArgs args)
{
EventHandler handler = this.ExecuteMsiMessage;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when Windows Installer sends a file in use installation message.
///
/// Additional arguments for this event.
protected virtual void OnExecuteFilesInUse(ExecuteFilesInUseEventArgs args)
{
EventHandler handler = this.ExecuteFilesInUse;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has completed installing a specific package.
///
/// Additional arguments for this event.
protected virtual void OnExecutePackageComplete(ExecutePackageCompleteEventArgs args)
{
EventHandler handler = this.ExecutePackageComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has completed installing packages.
///
/// Additional arguments for this event.
protected virtual void OnExecuteComplete(ExecuteCompleteEventArgs args)
{
EventHandler handler = this.ExecuteComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called when the engine has completed installing the bundle.
///
/// Additional arguments for this event.
protected virtual void OnApplyComplete(ApplyCompleteEventArgs args)
{
EventHandler handler = this.ApplyComplete;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called by the engine while executing on payload.
///
/// Additional arguments for this event.
protected virtual void OnExecuteProgress(ExecuteProgressEventArgs args)
{
EventHandler handler = this.ExecuteProgress;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called by the engine before trying to launch the preapproved executable.
///
/// Additional arguments for this event.
protected virtual void OnLaunchApprovedExeBegin(LaunchApprovedExeBeginArgs args)
{
EventHandler handler = this.LaunchApprovedExeBegin;
if (null != handler)
{
handler(this, args);
}
}
///
/// Called by the engine after trying to launch the preapproved executable.
///
/// Additional arguments for this event.
protected virtual void OnLaunchApprovedExeComplete(LaunchApprovedExeCompleteArgs args)
{
EventHandler handler = this.LaunchApprovedExeComplete;
if (null != handler)
{
handler(this, args);
}
}
#region IBootstrapperApplication Members
int IBootstrapperApplication.OnStartup()
{
StartupEventArgs args = new StartupEventArgs();
this.OnStartup(args);
return args.HResult;
}
int IBootstrapperApplication.OnShutdown(ref BOOTSTRAPPER_SHUTDOWN_ACTION action)
{
ShutdownEventArgs args = new ShutdownEventArgs(action);
this.OnShutdown(args);
action = args.Action;
return args.HResult;
}
int IBootstrapperApplication.OnSystemShutdown(EndSessionReasons dwEndSession, ref bool fCancel)
{
SystemShutdownEventArgs args = new SystemShutdownEventArgs(dwEndSession, fCancel);
this.OnSystemShutdown(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnDetectBegin(bool fInstalled, int cPackages, ref bool fCancel)
{
DetectBeginEventArgs args = new DetectBeginEventArgs(fInstalled, cPackages, fCancel);
this.OnDetectBegin(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnDetectForwardCompatibleBundle(string wzBundleId, RelationType relationType, string wzBundleTag, bool fPerMachine, long version, ref bool fCancel, ref bool fIgnoreBundle)
{
DetectForwardCompatibleBundleEventArgs args = new DetectForwardCompatibleBundleEventArgs(wzBundleId, relationType, wzBundleTag, fPerMachine, version, fCancel, fIgnoreBundle);
this.OnDetectForwardCompatibleBundle(args);
fCancel = args.Cancel;
fIgnoreBundle = args.IgnoreBundle;
return args.HResult;
}
int IBootstrapperApplication.OnDetectUpdateBegin(string wzUpdateLocation, ref bool fCancel, ref bool fSkip)
{
DetectUpdateBeginEventArgs args = new DetectUpdateBeginEventArgs(wzUpdateLocation, fCancel, fSkip);
this.OnDetectUpdateBegin(args);
fCancel = args.Cancel;
fSkip = args.Skip;
return args.HResult;
}
int IBootstrapperApplication.OnDetectUpdate(string wzUpdateLocation, long dw64Size, long dw64Version, string wzTitle, string wzSummary, string wzContentType, string wzContent, ref bool fCancel, ref bool fStopProcessingUpdates)
{
DetectUpdateEventArgs args = new DetectUpdateEventArgs(wzUpdateLocation, dw64Size, dw64Version, wzTitle, wzSummary, wzContentType, wzContent, fCancel, fStopProcessingUpdates);
this.OnDetectUpdate(args);
fCancel = args.Cancel;
fStopProcessingUpdates = args.StopProcessingUpdates;
return args.HResult;
}
int IBootstrapperApplication.OnDetectUpdateComplete(int hrStatus, ref bool fIgnoreError)
{
DetectUpdateCompleteEventArgs args = new DetectUpdateCompleteEventArgs(hrStatus, fIgnoreError);
this.OnDetectUpdateComplete(args);
fIgnoreError = args.IgnoreError;
return args.HResult;
}
int IBootstrapperApplication.OnDetectRelatedBundle(string wzProductCode, RelationType relationType, string wzBundleTag, bool fPerMachine, long version, RelatedOperation operation, ref bool fCancel)
{
DetectRelatedBundleEventArgs args = new DetectRelatedBundleEventArgs(wzProductCode, relationType, wzBundleTag, fPerMachine, version, operation, fCancel);
this.OnDetectRelatedBundle(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnDetectPackageBegin(string wzPackageId, ref bool fCancel)
{
DetectPackageBeginEventArgs args = new DetectPackageBeginEventArgs(wzPackageId, fCancel);
this.OnDetectPackageBegin(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnDetectCompatibleMsiPackage(string wzPackageId, string wzCompatiblePackageId, long dw64CompatiblePackageVersion, ref bool fCancel)
{
DetectCompatibleMsiPackageEventArgs args = new DetectCompatibleMsiPackageEventArgs(wzPackageId, wzCompatiblePackageId, dw64CompatiblePackageVersion, fCancel);
this.OnDetectCompatibleMsiPackage(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnDetectRelatedMsiPackage(string wzPackageId, string wzUpgradeCode, string wzProductCode, bool fPerMachine, long version, RelatedOperation operation, ref bool fCancel)
{
DetectRelatedMsiPackageEventArgs args = new DetectRelatedMsiPackageEventArgs(wzPackageId, wzUpgradeCode, wzProductCode, fPerMachine, version, operation, fCancel);
this.OnDetectRelatedMsiPackage(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnDetectTargetMsiPackage(string wzPackageId, string wzProductCode, PackageState patchState, ref bool fCancel)
{
DetectTargetMsiPackageEventArgs args = new DetectTargetMsiPackageEventArgs(wzPackageId, wzProductCode, patchState, fCancel);
this.OnDetectTargetMsiPackage(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnDetectMsiFeature(string wzPackageId, string wzFeatureId, FeatureState state, ref bool fCancel)
{
DetectMsiFeatureEventArgs args = new DetectMsiFeatureEventArgs(wzPackageId, wzFeatureId, state, fCancel);
this.OnDetectMsiFeature(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnDetectPackageComplete(string wzPackageId, int hrStatus, PackageState state)
{
DetectPackageCompleteEventArgs args = new DetectPackageCompleteEventArgs(wzPackageId, hrStatus, state);
this.OnDetectPackageComplete(args);
return args.HResult;
}
int IBootstrapperApplication.OnDetectComplete(int hrStatus)
{
DetectCompleteEventArgs args = new DetectCompleteEventArgs(hrStatus);
this.OnDetectComplete(args);
return args.HResult;
}
int IBootstrapperApplication.OnPlanBegin(int cPackages, ref bool fCancel)
{
PlanBeginEventArgs args = new PlanBeginEventArgs(cPackages, fCancel);
this.OnPlanBegin(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnPlanRelatedBundle(string wzBundleId, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel)
{
PlanRelatedBundleEventArgs args = new PlanRelatedBundleEventArgs(wzBundleId, recommendedState, pRequestedState, fCancel);
this.OnPlanRelatedBundle(args);
pRequestedState = args.State;
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnPlanPackageBegin(string wzPackageId, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel)
{
PlanPackageBeginEventArgs args = new PlanPackageBeginEventArgs(wzPackageId, recommendedState, pRequestedState, fCancel);
this.OnPlanPackageBegin(args);
pRequestedState = args.State;
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnPlanCompatibleMsiPackageBegin(string wzPackageId, string wzCompatiblePackageId, long dw64CompatiblePackageVersion, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel)
{
PlanCompatibleMsiPackageBeginEventArgs args = new PlanCompatibleMsiPackageBeginEventArgs(wzPackageId, wzCompatiblePackageId, dw64CompatiblePackageVersion, recommendedState, pRequestedState, fCancel);
this.OnPlanCompatibleMsiPackageBegin(args);
pRequestedState = args.State;
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnPlanCompatibleMsiPackageComplete(string wzPackageId, string wzCompatiblePackageId, int hrStatus, PackageState state, RequestState requested, ActionState execute, ActionState rollback)
{
PlanCompatibleMsiPackageCompleteEventArgs args = new PlanCompatibleMsiPackageCompleteEventArgs(wzPackageId, wzCompatiblePackageId, hrStatus, state, requested, execute, rollback);
this.OnPlanCompatibleMsiPackageComplete(args);
return args.HResult;
}
int IBootstrapperApplication.OnPlanTargetMsiPackage(string wzPackageId, string wzProductCode, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel)
{
PlanTargetMsiPackageEventArgs args = new PlanTargetMsiPackageEventArgs(wzPackageId, wzProductCode, recommendedState, pRequestedState, fCancel);
this.OnPlanTargetMsiPackage(args);
pRequestedState = args.State;
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnPlanMsiFeature(string wzPackageId, string wzFeatureId, FeatureState recommendedState, ref FeatureState pRequestedState, ref bool fCancel)
{
PlanMsiFeatureEventArgs args = new PlanMsiFeatureEventArgs(wzPackageId, wzFeatureId, recommendedState, pRequestedState, fCancel);
this.OnPlanMsiFeature(args);
pRequestedState = args.State;
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnPlanPackageComplete(string wzPackageId, int hrStatus, PackageState state, RequestState requested, ActionState execute, ActionState rollback)
{
var args = new PlanPackageCompleteEventArgs(wzPackageId, hrStatus, state, requested, execute, rollback);
this.OnPlanPackageComplete(args);
return args.HResult;
}
int IBootstrapperApplication.OnPlanComplete(int hrStatus)
{
PlanCompleteEventArgs args = new PlanCompleteEventArgs(hrStatus);
this.OnPlanComplete(args);
return args.HResult;
}
int IBootstrapperApplication.OnApplyBegin(int dwPhaseCount, ref bool fCancel)
{
this.applying = true;
ApplyBeginEventArgs args = new ApplyBeginEventArgs(dwPhaseCount, fCancel);
this.OnApplyBegin(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnElevateBegin(ref bool fCancel)
{
ElevateBeginEventArgs args = new ElevateBeginEventArgs(fCancel);
this.OnElevateBegin(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnElevateComplete(int hrStatus)
{
ElevateCompleteEventArgs args = new ElevateCompleteEventArgs(hrStatus);
this.OnElevateComplete(args);
return args.HResult;
}
int IBootstrapperApplication.OnProgress(int dwProgressPercentage, int dwOverallPercentage, ref bool fCancel)
{
ProgressEventArgs args = new ProgressEventArgs(dwProgressPercentage, dwOverallPercentage, fCancel);
this.OnProgress(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnError(ErrorType errorType, string wzPackageId, int dwCode, string wzError, int dwUIHint, int cData, string[] rgwzData, Result nRecommendation, ref Result pResult)
{
ErrorEventArgs args = new ErrorEventArgs(errorType, wzPackageId, dwCode, wzError, dwUIHint, rgwzData, nRecommendation, pResult);
this.OnError(args);
pResult = args.Result;
return args.HResult;
}
int IBootstrapperApplication.OnRegisterBegin(ref bool fCancel)
{
RegisterBeginEventArgs args = new RegisterBeginEventArgs(fCancel);
this.OnRegisterBegin(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnRegisterComplete(int hrStatus)
{
RegisterCompleteEventArgs args = new RegisterCompleteEventArgs(hrStatus);
this.OnRegisterComplete(args);
return args.HResult;
}
int IBootstrapperApplication.OnCacheBegin(ref bool fCancel)
{
CacheBeginEventArgs args = new CacheBeginEventArgs(fCancel);
this.OnCacheBegin(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnCachePackageBegin(string wzPackageId, int cCachePayloads, long dw64PackageCacheSize, ref bool fCancel)
{
CachePackageBeginEventArgs args = new CachePackageBeginEventArgs(wzPackageId, cCachePayloads, dw64PackageCacheSize, fCancel);
this.OnCachePackageBegin(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnCacheAcquireBegin(string wzPackageOrContainerId, string wzPayloadId, CacheOperation operation, string wzSource, ref bool fCancel)
{
CacheAcquireBeginEventArgs args = new CacheAcquireBeginEventArgs(wzPackageOrContainerId, wzPayloadId, operation, wzSource, fCancel);
this.OnCacheAcquireBegin(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnCacheAcquireProgress(string wzPackageOrContainerId, string wzPayloadId, long dw64Progress, long dw64Total, int dwOverallPercentage, ref bool fCancel)
{
CacheAcquireProgressEventArgs args = new CacheAcquireProgressEventArgs(wzPackageOrContainerId, wzPayloadId, dw64Progress, dw64Total, dwOverallPercentage, fCancel);
this.OnCacheAcquireProgress(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnResolveSource(string wzPackageOrContainerId, string wzPayloadId, string wzLocalSource, string wzDownloadSource, BOOTSTRAPPER_RESOLVESOURCE_ACTION recommendation, ref BOOTSTRAPPER_RESOLVESOURCE_ACTION action, ref bool fCancel)
{
ResolveSourceEventArgs args = new ResolveSourceEventArgs(wzPackageOrContainerId, wzPayloadId, wzLocalSource, wzDownloadSource, action, recommendation, fCancel);
this.OnResolveSource(args);
action = args.Action;
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnCacheAcquireComplete(string wzPackageOrContainerId, string wzPayloadId, int hrStatus, BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION action)
{
CacheAcquireCompleteEventArgs args = new CacheAcquireCompleteEventArgs(wzPackageOrContainerId, wzPayloadId, hrStatus, recommendation, action);
this.OnCacheAcquireComplete(args);
action = args.Action;
return args.HResult;
}
int IBootstrapperApplication.OnCacheVerifyBegin(string wzPackageId, string wzPayloadId, ref bool fCancel)
{
CacheVerifyBeginEventArgs args = new CacheVerifyBeginEventArgs(wzPackageId, 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)
{
CacheVerifyCompleteEventArgs args = new CacheVerifyCompleteEventArgs(wzPackageId, wzPayloadId, hrStatus, recommendation, action);
this.OnCacheVerifyComplete(args);
action = args.Action;
return args.HResult;
}
int IBootstrapperApplication.OnCachePackageComplete(string wzPackageId, int hrStatus, BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION action)
{
CachePackageCompleteEventArgs args = new CachePackageCompleteEventArgs(wzPackageId, hrStatus, recommendation, action);
this.OnCachePackageComplete(args);
action = args.Action;
return args.HResult;
}
int IBootstrapperApplication.OnCacheComplete(int hrStatus)
{
CacheCompleteEventArgs args = new CacheCompleteEventArgs(hrStatus);
this.OnCacheComplete(args);
return args.HResult;
}
int IBootstrapperApplication.OnExecuteBegin(int cExecutingPackages, ref bool fCancel)
{
ExecuteBeginEventArgs args = new ExecuteBeginEventArgs(cExecutingPackages, fCancel);
this.OnExecuteBegin(args);
args.Cancel = fCancel;
return args.HResult;
}
int IBootstrapperApplication.OnExecutePackageBegin(string wzPackageId, bool fExecute, ref bool fCancel)
{
ExecutePackageBeginEventArgs args = new ExecutePackageBeginEventArgs(wzPackageId, fExecute, fCancel);
this.OnExecutePackageBegin(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnExecutePatchTarget(string wzPackageId, string wzTargetProductCode, ref bool fCancel)
{
ExecutePatchTargetEventArgs args = new ExecutePatchTargetEventArgs(wzPackageId, wzTargetProductCode, fCancel);
this.OnExecutePatchTarget(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnExecuteProgress(string wzPackageId, int dwProgressPercentage, int dwOverallPercentage, ref bool fCancel)
{
ExecuteProgressEventArgs args = new ExecuteProgressEventArgs(wzPackageId, dwProgressPercentage, dwOverallPercentage, fCancel);
this.OnExecuteProgress(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnExecuteMsiMessage(string wzPackageId, InstallMessage messageType, int dwUIHint, string wzMessage, int cData, string[] rgwzData, Result nRecommendation, ref Result pResult)
{
ExecuteMsiMessageEventArgs args = new ExecuteMsiMessageEventArgs(wzPackageId, messageType, dwUIHint, wzMessage, rgwzData, nRecommendation, pResult);
this.OnExecuteMsiMessage(args);
pResult = args.Result;
return args.HResult;
}
int IBootstrapperApplication.OnExecuteFilesInUse(string wzPackageId, int cFiles, string[] rgwzFiles, Result nRecommendation, ref Result pResult)
{
ExecuteFilesInUseEventArgs args = new ExecuteFilesInUseEventArgs(wzPackageId, rgwzFiles, nRecommendation, pResult);
this.OnExecuteFilesInUse(args);
pResult = args.Result;
return args.HResult;
}
int IBootstrapperApplication.OnExecutePackageComplete(string wzPackageId, int hrStatus, ApplyRestart restart, BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION pAction)
{
ExecutePackageCompleteEventArgs args = new ExecutePackageCompleteEventArgs(wzPackageId, hrStatus, restart, recommendation, pAction);
this.OnExecutePackageComplete(args);
pAction = args.Action;
return args.HResult;
}
int IBootstrapperApplication.OnExecuteComplete(int hrStatus)
{
ExecuteCompleteEventArgs args = new ExecuteCompleteEventArgs(hrStatus);
this.OnExecuteComplete(args);
return args.HResult;
}
int IBootstrapperApplication.OnUnregisterBegin(ref bool fCancel)
{
UnregisterBeginEventArgs args = new UnregisterBeginEventArgs(fCancel);
this.OnUnregisterBegin(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnUnregisterComplete(int hrStatus)
{
UnregisterCompleteEventArgs args = new UnregisterCompleteEventArgs(hrStatus);
this.OnUnregisterComplete(args);
return args.HResult;
}
int IBootstrapperApplication.OnApplyComplete(int hrStatus, ApplyRestart restart, BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_APPLYCOMPLETE_ACTION pAction)
{
ApplyCompleteEventArgs args = new ApplyCompleteEventArgs(hrStatus, restart, recommendation, pAction);
this.OnApplyComplete(args);
this.applying = false;
pAction = args.Action;
return args.HResult;
}
int IBootstrapperApplication.OnLaunchApprovedExeBegin(ref bool fCancel)
{
LaunchApprovedExeBeginArgs args = new LaunchApprovedExeBeginArgs(fCancel);
this.OnLaunchApprovedExeBegin(args);
fCancel = args.Cancel;
return args.HResult;
}
int IBootstrapperApplication.OnLaunchApprovedExeComplete(int hrStatus, int processId)
{
LaunchApprovedExeCompleteArgs args = new LaunchApprovedExeCompleteArgs(hrStatus, processId);
this.OnLaunchApprovedExeComplete(args);
return args.HResult;
}
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)
{
}
#endregion
}
}