From 3d2d46f62fc01e2653d0251ad9703090574e7c41 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 6 Mar 2024 14:48:10 -0800 Subject: Better .nupkg names --- .../BalUtil.cs | 53 + .../BaseBootstrapperApplicationFactory.cs | 53 + .../BootstrapperApplication.cs | 2164 +++++++++++++++ .../BootstrapperApplicationData.cs | 101 + .../BootstrapperApplicationFactoryAttribute.cs | 31 + .../BootstrapperCommand.cs | 239 ++ .../BundleInfo.cs | 99 + .../Engine.cs | 349 +++ .../EventArgs.cs | 2757 ++++++++++++++++++++ .../IBootstrapperApplication.cs | 2013 ++++++++++++++ .../IBootstrapperApplicationData.cs | 22 + .../IBootstrapperApplicationFactory.cs | 22 + .../IBootstrapperCommand.cs | 79 + .../IBootstrapperEngine.cs | 501 ++++ .../IBundleInfo.cs | 54 + .../IDefaultBootstrapperApplication.cs | 436 ++++ .../IEngine.cs | 230 ++ .../IMbaCommand.cs | 35 + .../IOverridableVariableInfo.cs | 15 + .../IOverridableVariables.cs | 37 + .../IPackageInfo.cs | 100 + .../ManagedBootstrapperApplication.cs | 19 + .../MbaCommand.cs | 38 + .../MbaNative.cs | 18 + .../NativeMethods.cs | 49 + .../OverridableVariableInfo.cs | 15 + .../OverridableVariables.cs | 87 + .../PackageInfo.cs | 391 +++ .../StrUtil.cs | 54 + .../VerUtil.cs | 146 ++ .../VerUtilVersion.cs | 129 + .../VerUtilVersionReleaseLabel.cs | 36 + .../WixToolset.BootstrapperApplicationApi.csproj | 27 + .../WixToolset.BootstrapperApplicationApi.nuspec | 46 + .../WixToolset.BootstrapperApplicationApi.props | 18 + .../build/_._ | 0 36 files changed, 10463 insertions(+) create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/BalUtil.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/BaseBootstrapperApplicationFactory.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperApplication.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperApplicationData.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperApplicationFactoryAttribute.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperCommand.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/BundleInfo.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/EventArgs.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperApplication.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperApplicationData.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperApplicationFactory.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperCommand.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/IBundleInfo.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/IDefaultBootstrapperApplication.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/IMbaCommand.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/IOverridableVariableInfo.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/IOverridableVariables.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/IPackageInfo.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/ManagedBootstrapperApplication.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/MbaCommand.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/MbaNative.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/NativeMethods.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/OverridableVariableInfo.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/OverridableVariables.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/PackageInfo.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/StrUtil.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/VerUtil.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/VerUtilVersion.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/VerUtilVersionReleaseLabel.cs create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/WixToolset.BootstrapperApplicationApi.csproj create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/WixToolset.BootstrapperApplicationApi.nuspec create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/build/WixToolset.BootstrapperApplicationApi.props create mode 100644 src/api/burn/WixToolset.BootstrapperApplicationApi/build/_._ (limited to 'src/api/burn/WixToolset.BootstrapperApplicationApi') diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/BalUtil.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/BalUtil.cs new file mode 100644 index 00000000..25257554 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/BalUtil.cs @@ -0,0 +1,53 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Runtime.InteropServices; + + internal static class BalUtil + { + [DllImport("mbanative.dll", ExactSpelling = true)] + internal static extern int BalEscapeStringFromEngine( + [MarshalAs(UnmanagedType.Interface)] IBootstrapperEngine pEngine, + [MarshalAs(UnmanagedType.LPWStr)] string wzIn, + ref StrUtil.StrHandle psczOut + ); + + [DllImport("mbanative.dll", ExactSpelling = true)] + internal static extern int BalFormatStringFromEngine( + [MarshalAs(UnmanagedType.Interface)] IBootstrapperEngine pEngine, + [MarshalAs(UnmanagedType.LPWStr)] string wzFormat, + ref StrUtil.StrHandle psczOut + ); + + [DllImport("mbanative.dll", ExactSpelling = true)] + internal static extern int BalGetStringVariableFromEngine( + [MarshalAs(UnmanagedType.Interface)] IBootstrapperEngine pEngine, + [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, + ref StrUtil.StrHandle psczOut + ); + + [DllImport("mbanative.dll", ExactSpelling = true)] + internal static extern int BalGetVersionVariableFromEngine( + [MarshalAs(UnmanagedType.Interface)] IBootstrapperEngine pEngine, + [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, + ref StrUtil.StrHandle psczOut + ); + + [DllImport("mbanative.dll", ExactSpelling = true)] + internal static extern int BalGetRelatedBundleVariableFromEngine( + [MarshalAs(UnmanagedType.Interface)] IBootstrapperEngine pEngine, + [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, + [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, + ref StrUtil.StrHandle psczOut + ); + + [DllImport("mbanative.dll", ExactSpelling = true)] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool BalVariableExistsFromEngine( + [MarshalAs(UnmanagedType.Interface)] IBootstrapperEngine pEngine, + [MarshalAs(UnmanagedType.LPWStr)] string wzVariable + ); + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/BaseBootstrapperApplicationFactory.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/BaseBootstrapperApplicationFactory.cs new file mode 100644 index 00000000..88b136a6 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/BaseBootstrapperApplicationFactory.cs @@ -0,0 +1,53 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Runtime.InteropServices; + + /// + /// This is no longer used. + /// + [Obsolete("Bootstrapper applications now run out of proc and do not use a BootstrapperApplicationFactory. Remove your BootstrapperApplicationFactory class. See https://wixtoolset.org/docs/fiveforfour/ for more details.")] + public abstract class BaseBootstrapperApplicationFactory : IBootstrapperApplicationFactory + { + /// + /// This is no longer used. + /// + /// This is no longer used. + /// This is no longer used. + public void Create(IntPtr pArgs, IntPtr pResults) + { + throw new NotImplementedException(); + } + + /// + /// This is no longer used. + /// + /// This is no longer used. + /// This is no longer used. + /// This is no longer used. + protected abstract IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand); + + /// + /// This is no longer used. + /// + /// This is no longer used. + /// This is no longer used. + /// This is no longer used. + public static void InitializeFromCreateArgs(IntPtr pArgs, out IEngine engine, out IBootstrapperCommand bootstrapperCommand) + { + throw new NotImplementedException(); + } + + /// + /// This is no longer used. + /// + /// This is no longer used. + /// This is no longer used. + public static void StoreBAInCreateResults(IntPtr pResults, IBootstrapperApplication ba) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperApplication.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperApplication.cs new file mode 100644 index 00000000..f9fca748 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperApplication.cs @@ -0,0 +1,2164 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Runtime.InteropServices; + using System.Threading; + + /// + /// The default bootstrapper application. + /// + [ClassInterface(ClassInterfaceType.None)] + public abstract class BootstrapperApplication : MarshalByRefObject, IDefaultBootstrapperApplication + { + /// + /// Gets the for interaction with the engine. + /// + protected IEngine engine; + + /// + public event EventHandler Create; + + /// + public event EventHandler Destroy; + + /// + public event EventHandler Startup; + + /// + public event EventHandler Shutdown; + + /// + public event EventHandler DetectBegin; + + /// + public event EventHandler DetectForwardCompatibleBundle; + + /// + public event EventHandler DetectUpdateBegin; + + /// + public event EventHandler DetectUpdate; + + /// + public event EventHandler DetectUpdateComplete; + + /// + public event EventHandler DetectRelatedBundle; + + /// + public event EventHandler DetectPackageBegin; + + /// + public event EventHandler DetectCompatibleMsiPackage; + + /// + public event EventHandler DetectRelatedMsiPackage; + + /// + public event EventHandler DetectPatchTarget; + + /// + public event EventHandler DetectMsiFeature; + + /// + public event EventHandler DetectPackageComplete; + + /// + public event EventHandler DetectComplete; + + /// + public event EventHandler PlanBegin; + + /// + public event EventHandler PlanRelatedBundle; + + /// + public event EventHandler PlanRelatedBundleType; + + /// + public event EventHandler PlanRollbackBoundary; + + /// + public event EventHandler PlanPackageBegin; + + /// + public event EventHandler PlanCompatibleMsiPackageBegin; + + /// + public event EventHandler PlanCompatibleMsiPackageComplete; + + /// + public event EventHandler PlanPatchTarget; + + /// + public event EventHandler PlanMsiFeature; + + /// + public event EventHandler PlanMsiPackage; + + /// + public event EventHandler PlanPackageComplete; + + /// + public event EventHandler PlannedCompatiblePackage; + + /// + public event EventHandler PlannedPackage; + + /// + public event EventHandler PlanComplete; + + /// + public event EventHandler ApplyBegin; + + /// + public event EventHandler ElevateBegin; + + /// + public event EventHandler ElevateComplete; + + /// + public event EventHandler Progress; + + /// + public event EventHandler Error; + + /// + public event EventHandler RegisterBegin; + + /// + public event EventHandler RegisterComplete; + + /// + public event EventHandler UnregisterBegin; + + /// + public event EventHandler UnregisterComplete; + + /// + public event EventHandler CacheBegin; + + /// + public event EventHandler CachePackageBegin; + + /// + public event EventHandler CacheAcquireBegin; + + /// + public event EventHandler CacheAcquireProgress; + + /// + public event EventHandler CacheAcquireResolving; + + /// + public event EventHandler CacheAcquireComplete; + + /// + public event EventHandler CacheVerifyBegin; + + /// + public event EventHandler CacheVerifyProgress; + + /// + public event EventHandler CacheVerifyComplete; + + /// + public event EventHandler CachePackageComplete; + + /// + public event EventHandler CacheComplete; + + /// + public event EventHandler ExecuteBegin; + + /// + public event EventHandler ExecutePackageBegin; + + /// + public event EventHandler ExecutePatchTarget; + + /// + public event EventHandler ExecuteMsiMessage; + + /// + public event EventHandler ExecuteFilesInUse; + + /// + public event EventHandler ExecutePackageComplete; + + /// + public event EventHandler ExecuteComplete; + + /// + public event EventHandler ApplyComplete; + + /// + public event EventHandler ApplyDowngrade; + + /// + public event EventHandler ExecuteProgress; + + /// + public event EventHandler LaunchApprovedExeBegin; + + /// + public event EventHandler LaunchApprovedExeComplete; + + /// + public event EventHandler BeginMsiTransactionBegin; + + /// + public event EventHandler BeginMsiTransactionComplete; + + /// + public event EventHandler CommitMsiTransactionBegin; + + /// + public event EventHandler CommitMsiTransactionComplete; + + /// + public event EventHandler RollbackMsiTransactionBegin; + + /// + public event EventHandler RollbackMsiTransactionComplete; + + /// + public event EventHandler PauseAutomaticUpdatesBegin; + + /// + public event EventHandler PauseAutomaticUpdatesComplete; + + /// + public event EventHandler SystemRestorePointBegin; + + /// + public event EventHandler SystemRestorePointComplete; + + /// + 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; + + /// + public event EventHandler PlanRestoreRelatedBundle; + + /// + public event EventHandler ExecuteProcessCancel; + + /// + public event EventHandler DetectRelatedBundlePackage; + + /// + public event EventHandler CachePackageNonVitalValidationFailure; + + /// + /// The default constructor. + /// + /// + /// The engine object will be valid after handling the OnCreate() event. + /// + protected BootstrapperApplication() + { + } + + /// + /// This constructor is no longer used. + /// + [Obsolete("This constructor is no longer used. Use the default constructor. The engine object will be valid after handling the OnCreate() event.")] + protected BootstrapperApplication(IEngine engine) + { + throw new NotImplementedException("This constructor is no longer used. Use the default constructor. The engine object will be valid after handling the OnCreate() event."); + } + + /// + /// Entry point that is called when the bootstrapper application is ready to run. + /// + protected abstract void Run(); + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCreate(CreateEventArgs args) + { + this.engine = args.Engine; + + EventHandler handler = this.Create; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDestroy(DestroyEventArgs args) + { + EventHandler handler = this.Destroy; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnStartup(StartupEventArgs args) + { + EventHandler handler = this.Startup; + if (null != handler) + { + handler(this, args); + } + + Thread uiThread = new Thread(this.Run); + uiThread.Name = "UIThread"; + uiThread.SetApartmentState(ApartmentState.STA); + uiThread.Start(); + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnShutdown(ShutdownEventArgs args) + { + EventHandler handler = this.Shutdown; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDetectBegin(DetectBeginEventArgs args) + { + EventHandler handler = this.DetectBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDetectForwardCompatibleBundle(DetectForwardCompatibleBundleEventArgs args) + { + EventHandler handler = this.DetectForwardCompatibleBundle; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDetectUpdateBegin(DetectUpdateBeginEventArgs args) + { + EventHandler handler = this.DetectUpdateBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDetectUpdate(DetectUpdateEventArgs args) + { + EventHandler handler = this.DetectUpdate; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDetectUpdateComplete(DetectUpdateCompleteEventArgs args) + { + EventHandler handler = this.DetectUpdateComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDetectRelatedBundle(DetectRelatedBundleEventArgs args) + { + EventHandler handler = this.DetectRelatedBundle; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDetectPackageBegin(DetectPackageBeginEventArgs args) + { + EventHandler handler = this.DetectPackageBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDetectCompatibleMsiPackage(DetectCompatibleMsiPackageEventArgs args) + { + EventHandler handler = this.DetectCompatibleMsiPackage; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDetectRelatedMsiPackage(DetectRelatedMsiPackageEventArgs args) + { + EventHandler handler = this.DetectRelatedMsiPackage; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDetectPatchTarget(DetectPatchTargetEventArgs args) + { + EventHandler handler = this.DetectPatchTarget; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDetectMsiFeature(DetectMsiFeatureEventArgs args) + { + EventHandler handler = this.DetectMsiFeature; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDetectPackageComplete(DetectPackageCompleteEventArgs args) + { + EventHandler handler = this.DetectPackageComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDetectComplete(DetectCompleteEventArgs args) + { + EventHandler handler = this.DetectComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlanBegin(PlanBeginEventArgs args) + { + EventHandler handler = this.PlanBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlanRelatedBundle(PlanRelatedBundleEventArgs args) + { + EventHandler handler = this.PlanRelatedBundle; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlanRelatedBundleType(PlanRelatedBundleTypeEventArgs args) + { + EventHandler handler = this.PlanRelatedBundleType; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + protected virtual void OnPlanRollbackBoundary(PlanRollbackBoundaryEventArgs args) + { + EventHandler handler = this.PlanRollbackBoundary; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlanPackageBegin(PlanPackageBeginEventArgs args) + { + EventHandler handler = this.PlanPackageBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlanCompatibleMsiPackageBegin(PlanCompatibleMsiPackageBeginEventArgs args) + { + EventHandler handler = this.PlanCompatibleMsiPackageBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlanCompatibleMsiPackageComplete(PlanCompatibleMsiPackageCompleteEventArgs args) + { + EventHandler handler = this.PlanCompatibleMsiPackageComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlanPatchTarget(PlanPatchTargetEventArgs args) + { + EventHandler handler = this.PlanPatchTarget; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlanMsiFeature(PlanMsiFeatureEventArgs args) + { + EventHandler handler = this.PlanMsiFeature; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlanMsiPackage(PlanMsiPackageEventArgs args) + { + EventHandler handler = this.PlanMsiPackage; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlanPackageComplete(PlanPackageCompleteEventArgs args) + { + EventHandler handler = this.PlanPackageComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlannedCompatiblePackage(PlannedCompatiblePackageEventArgs args) + { + EventHandler handler = this.PlannedCompatiblePackage; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlannedPackage(PlannedPackageEventArgs args) + { + EventHandler handler = this.PlannedPackage; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlanComplete(PlanCompleteEventArgs args) + { + EventHandler handler = this.PlanComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnApplyBegin(ApplyBeginEventArgs args) + { + EventHandler handler = this.ApplyBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnElevateBegin(ElevateBeginEventArgs args) + { + EventHandler handler = this.ElevateBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnElevateComplete(ElevateCompleteEventArgs args) + { + EventHandler handler = this.ElevateComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnProgress(ProgressEventArgs args) + { + EventHandler handler = this.Progress; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnError(ErrorEventArgs args) + { + EventHandler handler = this.Error; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnRegisterBegin(RegisterBeginEventArgs args) + { + EventHandler handler = this.RegisterBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnRegisterComplete(RegisterCompleteEventArgs args) + { + EventHandler handler = this.RegisterComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnUnregisterBegin(UnregisterBeginEventArgs args) + { + EventHandler handler = this.UnregisterBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnUnregisterComplete(UnregisterCompleteEventArgs args) + { + EventHandler handler = this.UnregisterComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCacheBegin(CacheBeginEventArgs args) + { + EventHandler handler = this.CacheBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCachePackageBegin(CachePackageBeginEventArgs args) + { + EventHandler handler = this.CachePackageBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCacheAcquireBegin(CacheAcquireBeginEventArgs args) + { + EventHandler handler = this.CacheAcquireBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCacheAcquireProgress(CacheAcquireProgressEventArgs args) + { + EventHandler handler = this.CacheAcquireProgress; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCacheAcquireResolving(CacheAcquireResolvingEventArgs args) + { + EventHandler handler = this.CacheAcquireResolving; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCacheAcquireComplete(CacheAcquireCompleteEventArgs args) + { + EventHandler handler = this.CacheAcquireComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCacheVerifyBegin(CacheVerifyBeginEventArgs args) + { + EventHandler handler = this.CacheVerifyBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCacheVerifyProgress(CacheVerifyProgressEventArgs args) + { + EventHandler handler = this.CacheVerifyProgress; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCacheVerifyComplete(CacheVerifyCompleteEventArgs args) + { + EventHandler handler = this.CacheVerifyComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCachePackageComplete(CachePackageCompleteEventArgs args) + { + EventHandler handler = this.CachePackageComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCacheComplete(CacheCompleteEventArgs args) + { + EventHandler handler = this.CacheComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnExecuteBegin(ExecuteBeginEventArgs args) + { + EventHandler handler = this.ExecuteBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnExecutePackageBegin(ExecutePackageBeginEventArgs args) + { + EventHandler handler = this.ExecutePackageBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnExecutePatchTarget(ExecutePatchTargetEventArgs args) + { + EventHandler handler = this.ExecutePatchTarget; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnExecuteMsiMessage(ExecuteMsiMessageEventArgs args) + { + EventHandler handler = this.ExecuteMsiMessage; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnExecuteFilesInUse(ExecuteFilesInUseEventArgs args) + { + EventHandler handler = this.ExecuteFilesInUse; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnExecutePackageComplete(ExecutePackageCompleteEventArgs args) + { + EventHandler handler = this.ExecutePackageComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnExecuteComplete(ExecuteCompleteEventArgs args) + { + EventHandler handler = this.ExecuteComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// 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, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnApplyDowngrade(ApplyDowngradeEventArgs args) + { + EventHandler handler = this.ApplyDowngrade; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// 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, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnLaunchApprovedExeBegin(LaunchApprovedExeBeginEventArgs args) + { + EventHandler handler = this.LaunchApprovedExeBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnLaunchApprovedExeComplete(LaunchApprovedExeCompleteEventArgs args) + { + EventHandler handler = this.LaunchApprovedExeComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnBeginMsiTransactionBegin(BeginMsiTransactionBeginEventArgs args) + { + EventHandler handler = this.BeginMsiTransactionBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnBeginMsiTransactionComplete(BeginMsiTransactionCompleteEventArgs args) + { + EventHandler handler = this.BeginMsiTransactionComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCommitMsiTransactionBegin(CommitMsiTransactionBeginEventArgs args) + { + EventHandler handler = this.CommitMsiTransactionBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCommitMsiTransactionComplete(CommitMsiTransactionCompleteEventArgs args) + { + EventHandler handler = this.CommitMsiTransactionComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnRollbackMsiTransactionBegin(RollbackMsiTransactionBeginEventArgs args) + { + EventHandler handler = this.RollbackMsiTransactionBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnRollbackMsiTransactionComplete(RollbackMsiTransactionCompleteEventArgs args) + { + EventHandler handler = this.RollbackMsiTransactionComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPauseAutomaticUpdatesBegin(PauseAutomaticUpdatesBeginEventArgs args) + { + EventHandler handler = this.PauseAutomaticUpdatesBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPauseAutomaticUpdatesComplete(PauseAutomaticUpdatesCompleteEventArgs args) + { + EventHandler handler = this.PauseAutomaticUpdatesComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnSystemRestorePointBegin(SystemRestorePointBeginEventArgs args) + { + EventHandler handler = this.SystemRestorePointBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnSystemRestorePointComplete(SystemRestorePointCompleteEventArgs args) + { + EventHandler handler = this.SystemRestorePointComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlanForwardCompatibleBundle(PlanForwardCompatibleBundleEventArgs args) + { + EventHandler handler = this.PlanForwardCompatibleBundle; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCacheContainerOrPayloadVerifyBegin(CacheContainerOrPayloadVerifyBeginEventArgs args) + { + EventHandler handler = this.CacheContainerOrPayloadVerifyBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCacheContainerOrPayloadVerifyProgress(CacheContainerOrPayloadVerifyProgressEventArgs args) + { + EventHandler handler = this.CacheContainerOrPayloadVerifyProgress; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCacheContainerOrPayloadVerifyComplete(CacheContainerOrPayloadVerifyCompleteEventArgs args) + { + EventHandler handler = this.CacheContainerOrPayloadVerifyComplete; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCachePayloadExtractBegin(CachePayloadExtractBeginEventArgs args) + { + EventHandler handler = this.CachePayloadExtractBegin; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCachePayloadExtractProgress(CachePayloadExtractProgressEventArgs args) + { + EventHandler handler = this.CachePayloadExtractProgress; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCachePayloadExtractComplete(CachePayloadExtractCompleteEventArgs args) + { + EventHandler handler = this.CachePayloadExtractComplete; + if (null != handler) + { + handler(this, args); + } + } + + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlanRestoreRelatedBundle(PlanRestoreRelatedBundleEventArgs args) + { + EventHandler handler = this.PlanRestoreRelatedBundle; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnExecuteProcessCancel(ExecuteProcessCancelEventArgs args) + { + EventHandler handler = this.ExecuteProcessCancel; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnDetectRelatedBundlePackage(DetectRelatedBundlePackageEventArgs args) + { + EventHandler handler = this.DetectRelatedBundlePackage; + if (null != handler) + { + handler(this, args); + } + } + + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnCachePackageNonVitalValidationFailure(CachePackageNonVitalValidationFailureEventArgs args) + { + EventHandler handler = this.CachePackageNonVitalValidationFailure; + if (null != handler) + { + handler(this, args); + } + } + + #region IBootstrapperApplication Members + + int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults) + { + switch (message) + { + default: + return NativeMethods.E_NOTIMPL; + } + } + + void IBootstrapperApplication.BAProcFallback(int message, IntPtr pvArgs, IntPtr pvResults, ref int phr) + { + } + + int IBootstrapperApplication.OnCreate(IBootstrapperEngine engine, ref Command command) + { + CreateEventArgs args = new CreateEventArgs(new Engine(engine), command.GetBootstrapperCommand()); + this.OnCreate(args); + + return args.HResult; + } + + int IBootstrapperApplication.OnDestroy(bool reload) + { + DestroyEventArgs args = new DestroyEventArgs(reload); + this.OnDestroy(args); + + return args.HResult; + } + + 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.OnDetectBegin(bool fCached, RegistrationType registrationType, int cPackages, ref bool fCancel) + { + DetectBeginEventArgs args = new DetectBeginEventArgs(fCached, registrationType, cPackages, fCancel); + this.OnDetectBegin(args); + + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnDetectForwardCompatibleBundle(string wzBundleId, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, bool fMissingFromCache, ref bool fCancel) + { + DetectForwardCompatibleBundleEventArgs args = new DetectForwardCompatibleBundleEventArgs(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, fCancel); + this.OnDetectForwardCompatibleBundle(args); + + fCancel = args.Cancel; + 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, string wzHash, UpdateHashType hashAlgorithm, string wzVersion, string wzTitle, string wzSummary, string wzContentType, string wzContent, ref bool fCancel, ref bool fStopProcessingUpdates) + { + DetectUpdateEventArgs args = new DetectUpdateEventArgs(wzUpdateLocation, dw64Size, wzHash, hashAlgorithm, wzVersion, 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, string wzVersion, bool fMissingFromCache, ref bool fCancel) + { + DetectRelatedBundleEventArgs args = new DetectRelatedBundleEventArgs(wzProductCode, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, 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, string wzCompatiblePackageVersion, ref bool fCancel) + { + DetectCompatibleMsiPackageEventArgs args = new DetectCompatibleMsiPackageEventArgs(wzPackageId, wzCompatiblePackageId, wzCompatiblePackageVersion, fCancel); + this.OnDetectCompatibleMsiPackage(args); + + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnDetectRelatedMsiPackage(string wzPackageId, string wzUpgradeCode, string wzProductCode, bool fPerMachine, string wzVersion, RelatedOperation operation, ref bool fCancel) + { + DetectRelatedMsiPackageEventArgs args = new DetectRelatedMsiPackageEventArgs(wzPackageId, wzUpgradeCode, wzProductCode, fPerMachine, wzVersion, operation, fCancel); + this.OnDetectRelatedMsiPackage(args); + + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnDetectPatchTarget(string wzPackageId, string wzProductCode, PackageState patchState, ref bool fCancel) + { + DetectPatchTargetEventArgs args = new DetectPatchTargetEventArgs(wzPackageId, wzProductCode, patchState, fCancel); + this.OnDetectPatchTarget(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, bool fCached) + { + DetectPackageCompleteEventArgs args = new DetectPackageCompleteEventArgs(wzPackageId, hrStatus, state, fCached); + this.OnDetectPackageComplete(args); + + return args.HResult; + } + + int IBootstrapperApplication.OnDetectComplete(int hrStatus, bool fEligibleForCleanup) + { + DetectCompleteEventArgs args = new DetectCompleteEventArgs(hrStatus, fEligibleForCleanup); + 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.OnPlanRelatedBundleType(string wzBundleId, RelatedBundlePlanType recommendedType, ref RelatedBundlePlanType pRequestedType, ref bool fCancel) + { + PlanRelatedBundleTypeEventArgs args = new PlanRelatedBundleTypeEventArgs(wzBundleId, recommendedType, pRequestedType, fCancel); + this.OnPlanRelatedBundleType(args); + + pRequestedType = args.Type; + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnPlanRollbackBoundary(string wzRollbackBoundaryId, bool fRecommendedTransaction, ref bool fTransaction, ref bool fCancel) + { + PlanRollbackBoundaryEventArgs args = new PlanRollbackBoundaryEventArgs(wzRollbackBoundaryId, fRecommendedTransaction, fTransaction, fCancel); + this.OnPlanRollbackBoundary(args); + + fTransaction = args.Transaction; + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnPlanPackageBegin(string wzPackageId, PackageState state, bool fCached, BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, RequestState recommendedState, BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, ref RequestState pRequestedState, ref BOOTSTRAPPER_CACHE_TYPE pRequestedCacheType, ref bool fCancel) + { + PlanPackageBeginEventArgs args = new PlanPackageBeginEventArgs(wzPackageId, state, fCached, installCondition, repairCondition, recommendedState, recommendedCacheType, pRequestedState, pRequestedCacheType, fCancel); + this.OnPlanPackageBegin(args); + + pRequestedState = args.State; + pRequestedCacheType = args.CacheType; + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnPlanCompatibleMsiPackageBegin(string wzPackageId, string wzCompatiblePackageId, string wzCompatiblePackageVersion, bool recommendedRemove, ref bool pRequestedRemove, ref bool fCancel) + { + PlanCompatibleMsiPackageBeginEventArgs args = new PlanCompatibleMsiPackageBeginEventArgs(wzPackageId, wzCompatiblePackageId, wzCompatiblePackageVersion, recommendedRemove, pRequestedRemove, fCancel); + this.OnPlanCompatibleMsiPackageBegin(args); + + pRequestedRemove = args.RequestRemove; + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnPlanCompatibleMsiPackageComplete(string wzPackageId, string wzCompatiblePackageId, int hrStatus, bool requestedRemove) + { + PlanCompatibleMsiPackageCompleteEventArgs args = new PlanCompatibleMsiPackageCompleteEventArgs(wzPackageId, wzCompatiblePackageId, hrStatus, requestedRemove); + this.OnPlanCompatibleMsiPackageComplete(args); + + return args.HResult; + } + + int IBootstrapperApplication.OnPlanPatchTarget(string wzPackageId, string wzProductCode, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel) + { + PlanPatchTargetEventArgs args = new PlanPatchTargetEventArgs(wzPackageId, wzProductCode, recommendedState, pRequestedState, fCancel); + this.OnPlanPatchTarget(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.OnPlanMsiPackage(string wzPackageId, bool fExecute, ActionState action, BOOTSTRAPPER_MSI_FILE_VERSIONING recommendedFileVersioning, ref bool fCancel, ref BURN_MSI_PROPERTY actionMsiProperty, ref INSTALLUILEVEL uiLevel, ref bool fDisableExternalUiHandler, ref BOOTSTRAPPER_MSI_FILE_VERSIONING fileVersioning) + { + PlanMsiPackageEventArgs args = new PlanMsiPackageEventArgs(wzPackageId, fExecute, action, recommendedFileVersioning, fCancel, actionMsiProperty, uiLevel, fDisableExternalUiHandler, fileVersioning); + this.OnPlanMsiPackage(args); + + fCancel = args.Cancel; + actionMsiProperty = args.ActionMsiProperty; + uiLevel = args.UiLevel; + fDisableExternalUiHandler = args.DisableExternalUiHandler; + fileVersioning = args.FileVersioning; + return args.HResult; + } + + int IBootstrapperApplication.OnPlanPackageComplete(string wzPackageId, int hrStatus, RequestState requested) + { + var args = new PlanPackageCompleteEventArgs(wzPackageId, hrStatus, requested); + this.OnPlanPackageComplete(args); + + return args.HResult; + } + + int IBootstrapperApplication.OnPlannedCompatiblePackage(string wzPackageId, string wzCompatiblePackageId, bool remove) + { + var args = new PlannedCompatiblePackageEventArgs(wzPackageId, wzCompatiblePackageId, remove); + this.OnPlannedCompatiblePackage(args); + + return args.HResult; + } + + int IBootstrapperApplication.OnPlannedPackage(string wzPackageId, ActionState execute, ActionState rollback, bool fPlannedCache, bool fPlannedUncache) + { + var args = new PlannedPackageEventArgs(wzPackageId, execute, rollback, fPlannedCache, fPlannedUncache); + this.OnPlannedPackage(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) + { + 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(RegistrationType recommendedRegistrationType, ref bool fCancel, ref RegistrationType registrationType) + { + RegisterBeginEventArgs args = new RegisterBeginEventArgs(recommendedRegistrationType, fCancel, registrationType); + this.OnRegisterBegin(args); + + fCancel = args.Cancel; + registrationType = args.RegistrationType; + 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, bool fVital, ref bool fCancel) + { + CachePackageBeginEventArgs args = new CachePackageBeginEventArgs(wzPackageId, cCachePayloads, dw64PackageCacheSize, fVital, fCancel); + this.OnCachePackageBegin(args); + + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnCacheAcquireBegin(string wzPackageOrContainerId, string wzPayloadId, string wzSource, string wzDownloadUrl, string wzPayloadContainerId, CacheOperation recommendation, ref CacheOperation action, ref bool fCancel) + { + CacheAcquireBeginEventArgs args = new CacheAcquireBeginEventArgs(wzPackageOrContainerId, wzPayloadId, wzSource, wzDownloadUrl, wzPayloadContainerId, recommendation, action, fCancel); + this.OnCacheAcquireBegin(args); + + action = args.Action; + 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.OnCacheAcquireResolving(string wzPackageOrContainerId, string wzPayloadId, string[] searchPaths, int cSearchPaths, bool fFoundLocal, int dwRecommendedSearchPath, string wzDownloadUrl, string wzPayloadContainerId, CacheResolveOperation recommendation, ref int dwChosenSearchPath, ref CacheResolveOperation action, ref bool fCancel) + { + CacheAcquireResolvingEventArgs args = new CacheAcquireResolvingEventArgs(wzPackageOrContainerId, wzPayloadId, searchPaths, fFoundLocal, dwRecommendedSearchPath, wzDownloadUrl, wzPayloadContainerId, recommendation, dwChosenSearchPath, action, fCancel); + this.OnCacheAcquireResolving(args); + + dwChosenSearchPath = args.ChosenSearchPath; + 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 wzPackageOrContainerId, string wzPayloadId, ref bool fCancel) + { + CacheVerifyBeginEventArgs args = new CacheVerifyBeginEventArgs(wzPackageOrContainerId, wzPayloadId, fCancel); + this.OnCacheVerifyBegin(args); + + fCancel = args.Cancel; + return args.HResult; + } + + 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(wzPackageOrContainerId, 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, ActionState action, INSTALLUILEVEL uiLevel, bool fDisableExternalUiHandler, ref bool fCancel) + { + ExecutePackageBeginEventArgs args = new ExecutePackageBeginEventArgs(wzPackageId, fExecute, action, uiLevel, fDisableExternalUiHandler, 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, FilesInUseType source, ref Result pResult) + { + ExecuteFilesInUseEventArgs args = new ExecuteFilesInUseEventArgs(wzPackageId, rgwzFiles, nRecommendation, source, 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(RegistrationType recommendedRegistrationType, ref RegistrationType registrationType) + { + UnregisterBeginEventArgs args = new UnregisterBeginEventArgs(recommendedRegistrationType, registrationType); + this.OnUnregisterBegin(args); + + registrationType = args.RegistrationType; + 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); + + pAction = args.Action; + return args.HResult; + } + + int IBootstrapperApplication.OnApplyDowngrade(int hrRecommendation, ref int hrStatus) + { + ApplyDowngradeEventArgs args = new ApplyDowngradeEventArgs(hrRecommendation, hrStatus); + this.OnApplyDowngrade(args); + + hrStatus = args.Status; + return args.HResult; + } + + int IBootstrapperApplication.OnLaunchApprovedExeBegin(ref bool fCancel) + { + LaunchApprovedExeBeginEventArgs args = new LaunchApprovedExeBeginEventArgs(fCancel); + this.OnLaunchApprovedExeBegin(args); + + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnLaunchApprovedExeComplete(int hrStatus, int processId) + { + LaunchApprovedExeCompleteEventArgs args = new LaunchApprovedExeCompleteEventArgs(hrStatus, processId); + this.OnLaunchApprovedExeComplete(args); + + return args.HResult; + } + + int IBootstrapperApplication.OnBeginMsiTransactionBegin(string transactionId, ref bool fCancel) + { + BeginMsiTransactionBeginEventArgs args = new BeginMsiTransactionBeginEventArgs(transactionId, fCancel); + this.OnBeginMsiTransactionBegin(args); + + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnBeginMsiTransactionComplete(string transactionId, int hrStatus) + { + BeginMsiTransactionCompleteEventArgs args = new BeginMsiTransactionCompleteEventArgs(transactionId, hrStatus); + this.OnBeginMsiTransactionComplete(args); + + return args.HResult; + } + + int IBootstrapperApplication.OnCommitMsiTransactionBegin(string transactionId, ref bool fCancel) + { + CommitMsiTransactionBeginEventArgs args = new CommitMsiTransactionBeginEventArgs(transactionId, fCancel); + this.OnCommitMsiTransactionBegin(args); + + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnCommitMsiTransactionComplete(string transactionId, int hrStatus, ApplyRestart restart, BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION pAction) + { + CommitMsiTransactionCompleteEventArgs args = new CommitMsiTransactionCompleteEventArgs(transactionId, hrStatus, restart, recommendation, pAction); + this.OnCommitMsiTransactionComplete(args); + + pAction = args.Action; + return args.HResult; + } + + int IBootstrapperApplication.OnRollbackMsiTransactionBegin(string transactionId) + { + RollbackMsiTransactionBeginEventArgs args = new RollbackMsiTransactionBeginEventArgs(transactionId); + this.OnRollbackMsiTransactionBegin(args); + + return args.HResult; + } + + int IBootstrapperApplication.OnRollbackMsiTransactionComplete(string transactionId, int hrStatus, ApplyRestart restart, BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION recommendation, ref BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION pAction) + { + RollbackMsiTransactionCompleteEventArgs args = new RollbackMsiTransactionCompleteEventArgs(transactionId, hrStatus, restart, recommendation, pAction); + this.OnRollbackMsiTransactionComplete(args); + + pAction = args.Action; + return args.HResult; + } + + int IBootstrapperApplication.OnPauseAutomaticUpdatesBegin() + { + PauseAutomaticUpdatesBeginEventArgs args = new PauseAutomaticUpdatesBeginEventArgs(); + this.OnPauseAutomaticUpdatesBegin(args); + + return args.HResult; + } + + int IBootstrapperApplication.OnPauseAutomaticUpdatesComplete(int hrStatus) + { + PauseAutomaticUpdatesCompleteEventArgs args = new PauseAutomaticUpdatesCompleteEventArgs(hrStatus); + this.OnPauseAutomaticUpdatesComplete(args); + + return args.HResult; + } + + int IBootstrapperApplication.OnSystemRestorePointBegin() + { + SystemRestorePointBeginEventArgs args = new SystemRestorePointBeginEventArgs(); + this.OnSystemRestorePointBegin(args); + + return args.HResult; + } + + int IBootstrapperApplication.OnSystemRestorePointComplete(int hrStatus) + { + SystemRestorePointCompleteEventArgs args = new SystemRestorePointCompleteEventArgs(hrStatus); + this.OnSystemRestorePointComplete(args); + + return args.HResult; + } + + int IBootstrapperApplication.OnPlanForwardCompatibleBundle(string wzBundleId, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, bool fRecommendedIgnoreBundle, ref bool fCancel, ref bool fIgnoreBundle) + { + PlanForwardCompatibleBundleEventArgs args = new PlanForwardCompatibleBundleEventArgs(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fRecommendedIgnoreBundle, fCancel, fIgnoreBundle); + this.OnPlanForwardCompatibleBundle(args); + + fCancel = args.Cancel; + fIgnoreBundle = args.IgnoreBundle; + return args.HResult; + } + + int IBootstrapperApplication.OnCacheContainerOrPayloadVerifyBegin(string wzPackageOrContainerId, string wzPayloadId, ref bool fCancel) + { + CacheContainerOrPayloadVerifyBeginEventArgs args = new CacheContainerOrPayloadVerifyBeginEventArgs(wzPackageOrContainerId, wzPayloadId, fCancel); + this.OnCacheContainerOrPayloadVerifyBegin(args); + + fCancel = args.Cancel; + return args.HResult; + } + + 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; + } + + int IBootstrapperApplication.OnPlanRestoreRelatedBundle(string wzBundleId, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel) + { + PlanRestoreRelatedBundleEventArgs args = new PlanRestoreRelatedBundleEventArgs(wzBundleId, recommendedState, pRequestedState, fCancel); + this.OnPlanRestoreRelatedBundle(args); + + pRequestedState = args.State; + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnExecuteProcessCancel(string wzPackageId, int processId, BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION recommendation, ref BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION pAction) + { + ExecuteProcessCancelEventArgs args = new ExecuteProcessCancelEventArgs(wzPackageId, processId, recommendation, pAction); + this.OnExecuteProcessCancel(args); + + pAction = args.Action; + return args.HResult; + } + + int IBootstrapperApplication.OnDetectRelatedBundlePackage(string wzPackageId, string wzProductCode, RelationType relationType, bool fPerMachine, string wzVersion, ref bool fCancel) + { + DetectRelatedBundlePackageEventArgs args = new DetectRelatedBundlePackageEventArgs(wzPackageId, wzProductCode, relationType, fPerMachine, wzVersion, fCancel); + this.OnDetectRelatedBundlePackage(args); + + fCancel = args.Cancel; + return args.HResult; + } + + int IBootstrapperApplication.OnCachePackageNonVitalValidationFailure(string wzPackageId, int hrStatus, BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION recommendation, ref BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION action) + { + CachePackageNonVitalValidationFailureEventArgs args = new CachePackageNonVitalValidationFailureEventArgs(wzPackageId, hrStatus, recommendation, action); + this.OnCachePackageNonVitalValidationFailure(args); + + action = args.Action; + return args.HResult; + } + + #endregion + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperApplicationData.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperApplicationData.cs new file mode 100644 index 00000000..10cb863f --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperApplicationData.cs @@ -0,0 +1,101 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.IO; + using System.Xml.XPath; + + /// + /// Utility class for reading BootstrapperApplicationData.xml. + /// + public class BootstrapperApplicationData : IBootstrapperApplicationData + { + /// + /// The default file name for BootstrapperApplicationData. + /// + public const string DefaultFileName = "BootstrapperApplicationData.xml"; + + /// + /// The XML namespace for BootstrapperApplicationData. + /// + public const string XMLNamespace = "http://wixtoolset.org/schemas/v4/BootstrapperApplicationData"; + + /// + /// The default path of where the BA was extracted to. + /// + public static readonly DirectoryInfo DefaultFolder; + + /// + /// The default path to BootstrapperApplicationData.xml. + /// + public static readonly FileInfo DefaultFile; + + static BootstrapperApplicationData() + { + DefaultFolder = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory); + DefaultFile = new FileInfo(Path.Combine(DefaultFolder.FullName, DefaultFileName)); + } + + /// + public FileInfo BADataFile { get; private set; } + + /// + public IBundleInfo Bundle { get; private set; } + + /// + /// Uses the default location for BootstrapperApplicationData.xml. + /// + public BootstrapperApplicationData() : this(DefaultFile) { } + + /// + /// Uses the given file for BootstrapperApplicationData.xml. + /// + /// + public BootstrapperApplicationData(FileInfo baDataFile) + { + this.BADataFile = baDataFile; + + using (FileStream fs = this.BADataFile.OpenRead()) + { + this.Bundle = BundleInfo.ParseBundleFromStream(fs); + } + } + + /// + /// Utility method for parsing BootstrapperApplicationData.xml. + /// + /// + /// + /// + public static string GetAttribute(XPathNavigator node, string attributeName) + { + XPathNavigator attribute = node.SelectSingleNode("@" + attributeName); + + if (attribute == null) + { + return null; + } + + return attribute.Value; + } + + /// + /// Utility method for parsing BootstrapperApplicationData.xml. + /// + /// + /// + /// + public static bool? GetYesNoAttribute(XPathNavigator node, string attributeName) + { + string attributeValue = GetAttribute(node, attributeName); + + if (attributeValue == null) + { + return null; + } + + return attributeValue.Equals("yes", StringComparison.InvariantCulture); + } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperApplicationFactoryAttribute.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperApplicationFactoryAttribute.cs new file mode 100644 index 00000000..9b64e838 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperApplicationFactoryAttribute.cs @@ -0,0 +1,31 @@ +// 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.BootstrapperApplicationApi +{ + using System; + + /// + /// This is no longer used. + /// + [Obsolete("Bootstrapper applications now run out of proc and do not use a BootstrapperApplicationFactory. Remove your BootstrapperApplicationFactory class. See https://wixtoolset.org/docs/fiveforfour/ for more details.")] + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] + public sealed class BootstrapperApplicationFactoryAttribute : Attribute + { + /// + /// This is no longer used. + /// + /// This is no longer used + public BootstrapperApplicationFactoryAttribute(Type bootstrapperApplicationFactoryType) + { + throw new NotImplementedException(); + } + + /// + /// This is no longer used. + /// + public Type BootstrapperApplicationFactoryType + { + get { throw new NotImplementedException(); } + } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperCommand.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperCommand.cs new file mode 100644 index 00000000..612e8ce9 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperCommand.cs @@ -0,0 +1,239 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.CodeDom.Compiler; + using System.Collections.Generic; + using System.ComponentModel; + using System.Runtime.InteropServices; + + /// + /// Command-line provided to the bootstrapper application. + /// + [Serializable] + [StructLayout(LayoutKind.Sequential)] + [GeneratedCodeAttribute("WixToolset.Bootstrapper.InteropCodeGenerator", "1.0.0.0")] + public struct Command + { + // Strings must be declared as pointers so that Marshaling doesn't free them. + [MarshalAs(UnmanagedType.I4)] internal int cbSize; + [MarshalAs(UnmanagedType.U4)] private readonly LaunchAction action; + [MarshalAs(UnmanagedType.U4)] private readonly Display display; + private readonly IntPtr wzCommandLine; + [MarshalAs(UnmanagedType.I4)] private readonly int nCmdShow; + [MarshalAs(UnmanagedType.U4)] private readonly ResumeType resume; + private readonly IntPtr hwndSplashScreen; + [MarshalAs(UnmanagedType.I4)] private readonly RelationType relation; + [MarshalAs(UnmanagedType.Bool)] private readonly bool passthrough; + private readonly IntPtr wzLayoutDirectory; + private readonly IntPtr wzBootstrapperWorkingFolder; + private readonly IntPtr wzBootstrapperApplicationDataPath; + + /// + /// Gets the IBootstrapperCommand for this Command. + /// + /// IBootstrapperCommand + public IBootstrapperCommand GetBootstrapperCommand() + { + return new BootstrapperCommand( + this.action, + this.display, + Marshal.PtrToStringUni(this.wzCommandLine), + this.nCmdShow, + this.resume, + this.hwndSplashScreen, + this.relation, + this.passthrough, + Marshal.PtrToStringUni(this.wzLayoutDirectory), + Marshal.PtrToStringUni(this.wzBootstrapperWorkingFolder), + Marshal.PtrToStringUni(this.wzBootstrapperApplicationDataPath)); + } + } + + /// + /// Default implementation of . + /// + public sealed class BootstrapperCommand : IBootstrapperCommand + { + /// + /// See . + /// + public BootstrapperCommand( + LaunchAction action, + Display display, + string commandLine, + int cmdShow, + ResumeType resume, + IntPtr splashScreen, + RelationType relation, + bool passthrough, + string layoutDirectory, + string bootstrapperWorkingFolder, + string bootstrapperApplicationDataPath) + { + this.Action = action; + this.Display = display; + this.CommandLine = commandLine; + this.CmdShow = cmdShow; + this.Resume = resume; + this.SplashScreen = splashScreen; + this.Relation = relation; + this.Passthrough = passthrough; + this.LayoutDirectory = layoutDirectory; + this.BootstrapperWorkingFolder = bootstrapperWorkingFolder; + this.BootstrapperApplicationDataPath = bootstrapperApplicationDataPath; + } + + /// + public LaunchAction Action { get; } + + /// + public Display Display { get; } + + /// + public string CommandLine { get; } + + /// + public int CmdShow { get; } + + /// + public ResumeType Resume { get; } + + /// + public IntPtr SplashScreen { get; } + + /// + public RelationType Relation { get; } + + /// + public bool Passthrough { get; } + + /// + public string LayoutDirectory { get; } + + /// + public string BootstrapperWorkingFolder { get; } + + /// + public string BootstrapperApplicationDataPath { get; } + + /// + public IMbaCommand ParseCommandLine() + { + var args = ParseCommandLineToArgs(this.CommandLine); + var unknownArgs = new List(); + var variables = new List>(); + var restart = Restart.Unknown; + + foreach (var arg in args) + { + var unknownArg = false; + + if (arg[0] == '-' || arg[0] == '/') + { + var parameter = arg.Substring(1).ToLowerInvariant(); + switch (parameter) + { + case "norestart": + if (restart == Restart.Unknown) + { + restart = Restart.Never; + } + break; + case "forcerestart": + if (restart == Restart.Unknown) + { + restart = Restart.Always; + } + break; + default: + unknownArg = true; + break; + } + } + else + { + var index = arg.IndexOf('='); + if (index == -1) + { + unknownArg = true; + } + else + { + var name = arg.Substring(0, index); + var value = arg.Substring(index + 1); + variables.Add(new KeyValuePair(name, value)); + } + } + + if (unknownArg) + { + unknownArgs.Add(arg); + } + } + + if (restart == Restart.Unknown) + { + restart = this.Display < Display.Full ? Restart.Automatic : Restart.Prompt; + } + + return new MbaCommand + { + Restart = restart, + UnknownCommandLineArgs = unknownArgs.ToArray(), + Variables = variables.ToArray(), + }; + } + + /// + /// Gets the command line arguments as a string array. + /// + /// + /// Array of command line arguments. + /// + /// The command line could not be parsed into an array. + /// + /// This method uses the same parsing as the operating system which handles quotes and spaces correctly. + /// + public static string[] ParseCommandLineToArgs(string commandLine) + { + if (null == commandLine) + { + return new string[0]; + } + + // Parse the filtered command line arguments into a native array. + int argc = 0; + + // CommandLineToArgvW tries to treat the first argument as the path to the process, + // which fails pretty miserably if your first argument is something like + // FOO="C:\Program Files\My Company". So give it something harmless to play with. + IntPtr argv = NativeMethods.CommandLineToArgvW("ignored " + commandLine, out argc); + + if (IntPtr.Zero == argv) + { + // Throw an exception with the last error. + throw new Win32Exception(); + } + + // Marshal each native array pointer to a managed string. + try + { + // Skip "ignored" argument/hack. + string[] args = new string[argc - 1]; + for (int i = 1; i < argc; ++i) + { + IntPtr argvi = Marshal.ReadIntPtr(argv, i * IntPtr.Size); + args[i - 1] = Marshal.PtrToStringUni(argvi); + } + + return args; + } + finally + { + NativeMethods.LocalFree(argv); + } + } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/BundleInfo.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/BundleInfo.cs new file mode 100644 index 00000000..14cac881 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/BundleInfo.cs @@ -0,0 +1,99 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Xml; + using System.Xml.XPath; + + /// + /// Default implementation of . + /// + public class BundleInfo : IBundleInfo + { + /// + public bool PerMachine { get; internal set; } + + /// + public string Name { get; internal set; } + + /// + public string LogVariable { get; internal set; } + + /// + public IOverridableVariables OverridableVariables { get; internal set; } + + /// + public IDictionary Packages { get; internal set; } + + internal BundleInfo() + { + this.Packages = new Dictionary(); + } + + /// + public IPackageInfo AddRelatedBundleAsPackage(string productCode, RelationType relationType, bool perMachine, string version) + { + var package = PackageInfo.GetRelatedBundleAsPackage(productCode, relationType, perMachine, version); + this.Packages.Add(package.Id, package); + return package; + } + + /// + public IPackageInfo AddUpdateBundleAsPackage(string packageId) + { + var package = PackageInfo.GetUpdateBundleAsPackage(packageId); + this.Packages.Add(package.Id, package); + return package; + } + + /// + /// Parses BA manifest from the given stream. + /// + /// + /// + public static IBundleInfo ParseBundleFromStream(Stream stream) + { + XPathDocument manifest = new XPathDocument(stream); + XPathNavigator root = manifest.CreateNavigator(); + return ParseBundleFromXml(root); + } + + /// + /// Parses BA manifest from the given . + /// + /// The root of the BA manifest. + /// + public static IBundleInfo ParseBundleFromXml(XPathNavigator root) + { + BundleInfo bundle = new BundleInfo(); + + XmlNamespaceManager namespaceManager = new XmlNamespaceManager(root.NameTable); + namespaceManager.AddNamespace("p", BootstrapperApplicationData.XMLNamespace); + XPathNavigator bundleNode = root.SelectSingleNode("/p:BootstrapperApplicationData/p:WixBundleProperties", namespaceManager); + + if (bundleNode == null) + { + throw new Exception("Failed to select bundle information."); + } + + bool? perMachine = BootstrapperApplicationData.GetYesNoAttribute(bundleNode, "PerMachine"); + if (perMachine.HasValue) + { + bundle.PerMachine = perMachine.Value; + } + + bundle.Name = BootstrapperApplicationData.GetAttribute(bundleNode, "DisplayName"); + + bundle.LogVariable = BootstrapperApplicationData.GetAttribute(bundleNode, "LogPathVariable"); + + bundle.OverridableVariables = OverridableVariablesInfo.ParseFromXml(root); + + bundle.Packages = PackageInfo.ParsePackagesFromXml(root); + + return bundle; + } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs new file mode 100644 index 00000000..487858e0 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs @@ -0,0 +1,349 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.ComponentModel; + using System.Runtime.InteropServices; + using System.Security; + + /// + /// Default implementation of . + /// + public sealed class Engine : IEngine + { + private IBootstrapperEngine engine; + + internal Engine(IBootstrapperEngine engine) + { + this.engine = engine; + } + + /// + public int PackageCount + { + get + { + int count; + this.engine.GetPackageCount(out count); + + return count; + } + } + + /// + public void Apply(IntPtr hwndParent) + { + this.engine.Apply(hwndParent); + } + + /// + public void CloseSplashScreen() + { + this.engine.CloseSplashScreen(); + } + + /// + public int CompareVersions(string version1, string version2) + { + this.engine.CompareVersions(version1, version2, out var result); + return result; + } + + /// + public bool ContainsVariable(string name) + { + return BalUtil.BalVariableExistsFromEngine(this.engine, name); + } + + /// + public void Detect() + { + this.Detect(IntPtr.Zero); + } + + /// + public void Detect(IntPtr hwndParent) + { + this.engine.Detect(hwndParent); + } + + /// + public bool Elevate(IntPtr hwndParent) + { + int ret = this.engine.Elevate(hwndParent); + + if (NativeMethods.S_OK == ret || NativeMethods.E_ALREADYINITIALIZED == ret) + { + return true; + } + else if (NativeMethods.E_CANCELLED == ret) + { + return false; + } + else + { + throw new Win32Exception(ret); + } + } + + /// + public string EscapeString(string input) + { + StrUtil.StrHandle handle = new StrUtil.StrHandle(); + try + { + int ret = BalUtil.BalEscapeStringFromEngine(this.engine, input, ref handle); + if (ret != NativeMethods.S_OK) + { + throw new Win32Exception(ret); + } + + return handle.ToUniString(); + } + finally + { + handle.Dispose(); + } + } + + /// + public bool EvaluateCondition(string condition) + { + bool value; + this.engine.EvaluateCondition(condition, out value); + + return value; + } + + /// + public string FormatString(string format) + { + StrUtil.StrHandle handle = new StrUtil.StrHandle(); + try + { + int ret = BalUtil.BalFormatStringFromEngine(this.engine, format, ref handle); + if (ret != NativeMethods.S_OK) + { + throw new Win32Exception(ret); + } + + return handle.ToUniString(); + } + finally + { + handle.Dispose(); + } + } + + /// + public long GetVariableNumeric(string name) + { + int ret = this.engine.GetVariableNumeric(name, out long value); + if (NativeMethods.S_OK != ret) + { + throw new Win32Exception(ret); + } + + return value; + } + + /// + public SecureString GetVariableSecureString(string name) + { + StrUtil.StrHandle handle = new StrUtil.StrHandle(); + try + { + int ret = BalUtil.BalGetStringVariableFromEngine(this.engine, name, ref handle); + if (ret != NativeMethods.S_OK) + { + throw new Win32Exception(ret); + } + + return handle.ToSecureString(); + } + finally + { + handle.Dispose(); + } + } + + /// + public string GetVariableString(string name) + { + StrUtil.StrHandle handle = new StrUtil.StrHandle(); + try + { + int ret = BalUtil.BalGetStringVariableFromEngine(this.engine, name, ref handle); + if (ret != NativeMethods.S_OK) + { + throw new Win32Exception(ret); + } + + return handle.ToUniString(); + } + finally + { + handle.Dispose(); + } + } + + /// + public string GetVariableVersion(string name) + { + StrUtil.StrHandle handle = new StrUtil.StrHandle(); + try + { + int ret = BalUtil.BalGetVersionVariableFromEngine(this.engine, name, ref handle); + if (ret != NativeMethods.S_OK) + { + throw new Win32Exception(ret); + } + + return handle.ToUniString(); + } + finally + { + handle.Dispose(); + } + } + + /// + public string GetRelatedBundleVariable(string bundleId, string name) + { + StrUtil.StrHandle handle = new StrUtil.StrHandle(); + try + { + int ret = BalUtil.BalGetRelatedBundleVariableFromEngine(this.engine, bundleId, name, ref handle); + if (ret != NativeMethods.S_OK) + { + throw new Win32Exception(ret); + } + + return handle.ToUniString(); + } + finally + { + handle.Dispose(); + } + } + + /// + public void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments) + { + this.LaunchApprovedExe(hwndParent, approvedExeForElevationId, arguments, 0); + } + + /// + public void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments, int waitForInputIdleTimeout) + { + this.engine.LaunchApprovedExe(hwndParent, approvedExeForElevationId, arguments, waitForInputIdleTimeout); + } + /// + + public void Log(LogLevel level, string message) + { + this.engine.Log(level, message); + } + + /// + public void Plan(LaunchAction action) + { + this.engine.Plan(action); + } + + /// + public void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, string hash, string updatePackageId) + { + this.engine.SetUpdate(localSource, downloadSource, size, hashType, hash, updatePackageId); + } + + /// + public void SetUpdateSource(string url) + { + this.engine.SetUpdateSource(url); + } + + /// + public void SetLocalSource(string packageOrContainerId, string payloadId, string path) + { + this.engine.SetLocalSource(packageOrContainerId, payloadId, path); + } + + /// + public void SetDownloadSource(string packageOrContainerId, string payloadId, string url, string user, string password) + { + this.engine.SetDownloadSource(packageOrContainerId, payloadId, url, user, password); + } + + /// + public void SetVariableNumeric(string name, long value) + { + this.engine.SetVariableNumeric(name, value); + } + + /// + public void SetVariableString(string name, SecureString value, bool formatted) + { + IntPtr pValue = Marshal.SecureStringToCoTaskMemUnicode(value); + try + { + this.engine.SetVariableString(name, pValue, formatted); + } + finally + { + Marshal.FreeCoTaskMem(pValue); + } + } + + /// + public void SetVariableString(string name, string value, bool formatted) + { + IntPtr pValue = Marshal.StringToCoTaskMemUni(value); + try + { + this.engine.SetVariableString(name, pValue, formatted); + } + finally + { + Marshal.FreeCoTaskMem(pValue); + } + } + + /// + public void SetVariableVersion(string name, string value) + { + IntPtr pValue = Marshal.StringToCoTaskMemUni(value); + try + { + this.engine.SetVariableVersion(name, pValue); + } + finally + { + Marshal.FreeCoTaskMem(pValue); + } + } + + /// + public int SendEmbeddedError(int errorCode, string message, int uiHint) + { + int result = 0; + this.engine.SendEmbeddedError(errorCode, message, uiHint, out result); + return result; + } + + /// + public int SendEmbeddedProgress(int progressPercentage, int overallPercentage) + { + int result = 0; + this.engine.SendEmbeddedProgress(progressPercentage, overallPercentage, out result); + return result; + } + + /// + public void Quit(int exitCode) + { + this.engine.Quit(exitCode); + } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/EventArgs.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/EventArgs.cs new file mode 100644 index 00000000..e1649d43 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/EventArgs.cs @@ -0,0 +1,2757 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Runtime.InteropServices; + + /// + /// Base class for BA classes. + /// + [Serializable] + public abstract class HResultEventArgs : EventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public HResultEventArgs() + { + } + + /// + /// Gets or sets the of the operation. This is passed back to the engine. + /// + public int HResult { get; set; } + } + + /// + /// Base class for cancellable BA classes. + /// + [Serializable] + public abstract class CancellableHResultEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CancellableHResultEventArgs(bool cancelRecommendation) + { + this.Cancel = cancelRecommendation; + } + + /// + /// Gets or sets whether to cancel the operation. This is passed back to the engine. + /// + public bool Cancel { get; set; } + } + + /// + /// Base class for classes that must return a . + /// + [Serializable] + public abstract class ResultEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ResultEventArgs(Result recommendation, Result result) + { + this.Recommendation = recommendation; + this.Result = result; + } + + /// + /// Gets the recommended of the operation. + /// + public Result Recommendation { get; private set; } + + /// + /// Gets or sets the of the operation. This is passed back to the engine. + /// + public Result Result { get; set; } + } + + /// + /// Base class for classes that receive status from the engine. + /// + [Serializable] + public abstract class StatusEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public StatusEventArgs(int hrStatus) + { + this.Status = hrStatus; + } + + /// + /// Gets the return code of the operation. + /// + public int Status { get; private set; } + } + + /// + /// Base class for classes that receive status from the engine and return an action. + /// + public abstract class ActionEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ActionEventArgs(int hrStatus, T recommendation, T action) + : base(hrStatus) + { + this.Recommendation = recommendation; + this.Action = action; + } + + /// + /// Gets the recommended action from the engine. + /// + public T Recommendation { get; private set; } + + /// + /// Gets or sets the action to be performed. This is passed back to the engine. + /// + public T Action { get; set; } + } + + /// + /// Base class for cancellable action BA classes. + /// + [Serializable] + public abstract class CancellableActionEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CancellableActionEventArgs(bool cancelRecommendation, T recommendation, T action) + : base(cancelRecommendation) + { + this.Recommendation = recommendation; + this.Action = action; + } + + /// + /// Gets the recommended action from the engine. + /// + public T Recommendation { get; private set; } + + /// + /// Gets or sets the action to be performed. This is passed back to the engine. + /// + public T Action { get; set; } + } + + /// + /// Base class for cache progress events. + /// + [Serializable] + public abstract class CacheProgressBaseEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + 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; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class CreateEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CreateEventArgs(IEngine engine, IBootstrapperCommand command) + { + this.Engine = engine; + this.Command = command; + } + + /// + /// Engine running the application. + /// + public IEngine Engine { get; } + + /// + /// Command line arguments. + /// + public IBootstrapperCommand Command { get; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class DestroyEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DestroyEventArgs(bool reload) + { + this.Reload = reload; + } + + /// + /// Bootstrapper application is being reloaded. + /// + public bool Reload { get; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class StartupEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public StartupEventArgs() + { + } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class ShutdownEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ShutdownEventArgs(BOOTSTRAPPER_SHUTDOWN_ACTION action) + { + this.Action = action; + } + + /// + /// The action for OnShutdown. + /// + public BOOTSTRAPPER_SHUTDOWN_ACTION Action { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class DetectBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DetectBeginEventArgs(bool cached, RegistrationType registrationType, int packageCount, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.Cached = cached; + this.RegistrationType = registrationType; + this.PackageCount = packageCount; + } + + /// + /// Gets whether the bundle is cached. + /// + public bool Cached { get; private set; } + + /// + /// Gets the bundle's registration state. + /// + public RegistrationType RegistrationType { get; private set; } + + /// + /// Gets the number of packages to detect. + /// + public int PackageCount { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class DetectForwardCompatibleBundleEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DetectForwardCompatibleBundleEventArgs(string bundleId, RelationType relationType, string bundleTag, bool perMachine, string version, bool missingFromCache, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.BundleId = bundleId; + this.RelationType = relationType; + this.BundleTag = bundleTag; + this.PerMachine = perMachine; + this.Version = version; + this.MissingFromCache = missingFromCache; + } + + /// + /// Gets the identity of the forward compatible bundle detected. + /// + public string BundleId { get; private set; } + + /// + /// Gets the relationship type of the forward compatible bundle. + /// + public RelationType RelationType { get; private set; } + + /// + /// Gets the tag of the forward compatible bundle. + /// + public string BundleTag { get; private set; } + + /// + /// Gets whether the detected forward compatible bundle is per machine. + /// + public bool PerMachine { get; private set; } + + /// + /// Gets the version of the forward compatible bundle detected. + /// + public string Version { get; private set; } + + /// + /// Whether the forward compatible bundle is missing from the package cache. + /// + public bool MissingFromCache { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class DetectUpdateBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DetectUpdateBeginEventArgs(string updateLocation, bool cancelRecommendation, bool skipRecommendation) + : base(cancelRecommendation) + { + this.UpdateLocation = updateLocation; + this.Skip = skipRecommendation; + } + + /// + /// Gets the identity of the bundle to detect. + /// + public string UpdateLocation { get; private set; } + + /// + /// Whether to skip checking for bundle updates. + /// + public bool Skip { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class DetectUpdateEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DetectUpdateEventArgs(string updateLocation, long size, string hash, UpdateHashType hashAlgorithm, string version, string title, string summary, string contentType, string content, bool cancelRecommendation, bool stopRecommendation) + : base(cancelRecommendation) + { + this.UpdateLocation = updateLocation; + this.Size = size; + this.Hash = hash; + this.HashAlgorithm = hashAlgorithm; + this.Version = version; + this.Title = title; + this.Summary = summary; + this.ContentType = contentType; + this.Content = content; + this.StopProcessingUpdates = stopRecommendation; + } + + /// + /// Gets the identity of the bundle to detect. + /// + public string UpdateLocation { get; private set; } + + /// + /// Gets the size of the updated bundle. + /// + public long Size { get; private set; } + + /// + /// File hash of the updated bundle. + /// + public string Hash { get; } + + /// + /// The algorithm of the updated bundle's hash. + /// + public UpdateHashType HashAlgorithm { get; } + + /// + /// Gets the version of the updated bundle. + /// + public string Version { get; private set; } + + /// + /// Gets the title of the the updated bundle. + /// + public string Title { get; private set; } + + /// + /// Gets the summary of the updated bundle. + /// + public string Summary { get; private set; } + + /// + /// Gets the content type of the content of the updated bundle. + /// + public string ContentType { get; private set; } + + /// + /// Gets the content of the updated bundle. + /// + public string Content { get; private set; } + + /// + /// Tells the engine to stop giving the rest of the updates found in the feed. + /// + public bool StopProcessingUpdates { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class DetectUpdateCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DetectUpdateCompleteEventArgs(int hrStatus, bool ignoreRecommendation) + : base(hrStatus) + { + this.IgnoreError = ignoreRecommendation; + } + + /// + /// If Status is an error, then set this to true to ignore it and continue detecting. + /// + public bool IgnoreError { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class DetectRelatedBundleEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DetectRelatedBundleEventArgs(string productCode, RelationType relationType, string bundleTag, bool perMachine, string version, bool missingFromCache, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.ProductCode = productCode; + this.RelationType = relationType; + this.BundleTag = bundleTag; + this.PerMachine = perMachine; + this.Version = version; + this.MissingFromCache = missingFromCache; + } + + /// + /// Gets the identity of the related bundle detected. + /// + public string ProductCode { get; private set; } + + /// + /// Gets the relationship type of the related bundle. + /// + public RelationType RelationType { get; private set; } + + /// + /// Gets the tag of the related package bundle. + /// + public string BundleTag { get; private set; } + + /// + /// Gets whether the detected bundle is per machine. + /// + public bool PerMachine { get; private set; } + + /// + /// Gets the version of the related bundle detected. + /// + public string Version { get; private set; } + + /// + /// Whether the related bundle is missing from the package cache. + /// + public bool MissingFromCache { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class DetectPackageBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DetectPackageBeginEventArgs(string packageId, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageId = packageId; + } + + /// + /// Gets the identity of the package to detect. + /// + public string PackageId { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class DetectCompatibleMsiPackageEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DetectCompatibleMsiPackageEventArgs(string packageId, string compatiblePackageId, string compatiblePackageVersion, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageId = packageId; + this.CompatiblePackageId = compatiblePackageId; + this.CompatiblePackageVersion = compatiblePackageVersion; + } + + /// + /// Gets the identity of the package that was not detected. + /// + public string PackageId { get; private set; } + + /// + /// Gets the identity of the compatible package that was detected. + /// + public string CompatiblePackageId { get; private set; } + + /// + /// Gets the version of the compatible package that was detected. + /// + public string CompatiblePackageVersion { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class DetectRelatedMsiPackageEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DetectRelatedMsiPackageEventArgs(string packageId, string upgradeCode, string productCode, bool perMachine, string version, RelatedOperation operation, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageId = packageId; + this.UpgradeCode = upgradeCode; + this.ProductCode = productCode; + this.PerMachine = perMachine; + this.Version = version; + this.Operation = operation; + } + + /// + /// Gets the identity of the product's package detected. + /// + public string PackageId { get; private set; } + + /// + /// Gets the upgrade code of the related package detected. + /// + public string UpgradeCode { get; private set; } + + /// + /// Gets the identity of the related package detected. + /// + public string ProductCode { get; private set; } + + /// + /// Gets whether the detected package is per machine. + /// + public bool PerMachine { get; private set; } + + /// + /// Gets the version of the related package detected. + /// + public string Version { get; private set; } + + /// + /// Gets the operation that will be taken on the detected package. + /// + public RelatedOperation Operation { get; private set; } + } + + /// + /// Event arguments for + /// + public class DetectPatchTargetEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DetectPatchTargetEventArgs(string packageId, string productCode, PackageState state, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageId = packageId; + this.ProductCode = productCode; + this.State = state; + } + + /// + /// Gets the identity of the patch's package. + /// + public string PackageId { get; private set; } + + /// + /// Gets the product code of the target. + /// + public string ProductCode { get; private set; } + + /// + /// Gets the detected patch state for the target. + /// + public PackageState State { get; private set; } + } + + /// + /// Event arguments for + /// + public class DetectMsiFeatureEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DetectMsiFeatureEventArgs(string packageId, string featureId, FeatureState state, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageId = packageId; + this.FeatureId = featureId; + this.State = state; + } + + /// + /// Gets the identity of the feature's package detected. + /// + public string PackageId { get; private set; } + + /// + /// Gets the identity of the feature detected. + /// + public string FeatureId { get; private set; } + + /// + /// Gets the detected feature state. + /// + public FeatureState State { get; private set; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class DetectPackageCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DetectPackageCompleteEventArgs(string packageId, int hrStatus, PackageState state, bool cached) + : base(hrStatus) + { + this.PackageId = packageId; + this.State = state; + this.Cached = cached; + } + + /// + /// Gets the identity of the package detected. + /// + public string PackageId { get; private set; } + + /// + /// Gets the state of the specified package. + /// + public PackageState State { get; private set; } + + /// + /// Gets whether any part of the package is cached. + /// + public bool Cached { get; private set; } + } + + /// + /// Event arguments used when the detection phase has completed. + /// + [Serializable] + public class DetectCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DetectCompleteEventArgs(int hrStatus, bool eligibleForCleanup) + : base(hrStatus) + { + this.EligibleForCleanup = eligibleForCleanup; + } + + /// + /// Indicates whether the engine will uninstall the bundle if shutdown without running Apply. + /// + public bool EligibleForCleanup { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlanBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlanBeginEventArgs(int packageCount, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageCount = packageCount; + } + + /// + /// Gets the number of packages to plan for. + /// + public int PackageCount { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlanRelatedBundleEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlanRelatedBundleEventArgs(string bundleId, RequestState recommendedState, RequestState state, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.BundleId = bundleId; + this.RecommendedState = recommendedState; + this.State = state; + } + + /// + /// Gets the identity of the bundle to plan for. + /// + public string BundleId { get; private set; } + + /// + /// Gets the recommended requested state for the bundle. + /// + public RequestState RecommendedState { get; private set; } + + /// + /// Gets or sets the requested state for the bundle. + /// + public RequestState State { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlanRelatedBundleTypeEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlanRelatedBundleTypeEventArgs(string bundleId, RelatedBundlePlanType recommendedType, RelatedBundlePlanType type, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.BundleId = bundleId; + this.RecommendedType = recommendedType; + this.Type = type; + } + + /// + /// Gets the identity of the bundle to plan for. + /// + public string BundleId { get; private set; } + + /// + /// Gets the recommended plan type for the bundle. + /// + public RelatedBundlePlanType RecommendedType { get; private set; } + + /// + /// Gets or sets the plan type for the bundle. + /// + public RelatedBundlePlanType Type { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlanPackageBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlanPackageBeginEventArgs(string packageId, PackageState currentState, bool cached, BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, RequestState recommendedState, BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, RequestState state, BOOTSTRAPPER_CACHE_TYPE cacheType, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageId = packageId; + this.CurrentState = currentState; + this.Cached = cached; + this.InstallCondition = installCondition; + this.RepairCondition = repairCondition; + this.RecommendedState = recommendedState; + this.RecommendedCacheType = recommendedCacheType; + this.State = state; + this.CacheType = cacheType; + } + + /// + /// Gets the identity of the package to plan for. + /// + public string PackageId { get; private set; } + + /// + /// Gets the current state of the package. + /// + public PackageState CurrentState { get; private set; } + + /// + /// Gets whether any part of the package is cached. + /// + public bool Cached { get; private set; } + + /// + /// Gets the evaluated result of the package's install condition. + /// + public BOOTSTRAPPER_PACKAGE_CONDITION_RESULT InstallCondition { get; private set; } + + /// + /// Gets the evaluated result of the package's repair condition. + /// + public BOOTSTRAPPER_PACKAGE_CONDITION_RESULT RepairCondition { get; private set; } + + /// + /// Gets the recommended requested state for the package. + /// + public RequestState RecommendedState { get; private set; } + + /// + /// The authored cache type of the package. + /// + public BOOTSTRAPPER_CACHE_TYPE RecommendedCacheType { get; private set; } + + /// + /// Gets or sets the requested state for the package. + /// + public RequestState State { get; set; } + + /// + /// Gets or sets the requested cache type for the package. + /// + public BOOTSTRAPPER_CACHE_TYPE CacheType { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlanCompatibleMsiPackageBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlanCompatibleMsiPackageBeginEventArgs(string packageId, string compatiblePackageId, string compatiblePackageVersion, bool recommendedRemove, bool requestRemove, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageId = packageId; + this.CompatiblePackageId = compatiblePackageId; + this.CompatiblePackageVersion = compatiblePackageVersion; + this.RecommendedRemove = recommendedRemove; + this.RequestRemove = requestRemove; + } + + /// + /// Gets the identity of the package that was not detected. + /// + public string PackageId { get; private set; } + + /// + /// Gets the identity of the compatible package detected. + /// + public string CompatiblePackageId { get; private set; } + + /// + /// Gets the version of the compatible package detected. + /// + public string CompatiblePackageVersion { get; private set; } + + /// + /// Gets the recommended state to use for the compatible package for planning. + /// + public bool RecommendedRemove { get; private set; } + + /// + /// Gets or sets whether to uninstall the compatible package. + /// + public bool RequestRemove { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlanCompatibleMsiPackageCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlanCompatibleMsiPackageCompleteEventArgs(string packageId, string compatiblePackageId, int hrStatus, bool requestedRemove) + : base(hrStatus) + { + this.PackageId = packageId; + this.CompatiblePackageId = compatiblePackageId; + this.RequestedRemove = requestedRemove; + } + + /// + /// Gets the identity of the package planned for. + /// + public string PackageId { get; private set; } + + /// + /// Gets the identity of the compatible package detected. + /// + public string CompatiblePackageId { get; private set; } + + /// + /// Gets the requested state of the package. + /// + public bool RequestedRemove { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlanRollbackBoundaryEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlanRollbackBoundaryEventArgs(string rollbackBoundaryId, bool recommendedTransaction, bool transaction, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.RollbackBoundaryId = rollbackBoundaryId; + this.RecommendedTransaction = recommendedTransaction; + this.Transaction = transaction; + } + + /// + /// Gets the identity of the rollback boundary to plan for. + /// + public string RollbackBoundaryId { get; private set; } + + /// + /// Whether or not the rollback boundary was authored to use an MSI transaction. + /// + public bool RecommendedTransaction { get; private set; } + + /// + /// Whether or not an MSI transaction will be used in the rollback boundary. + /// If is false, setting the value to true has no effect. + /// If is true, setting the value to false will cause the packages inside this rollback boundary to be executed without a wrapping MSI transaction. + /// + public bool Transaction { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlanPatchTargetEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlanPatchTargetEventArgs(string packageId, string productCode, RequestState recommendedState, RequestState state, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageId = packageId; + this.ProductCode = productCode; + this.RecommendedState = recommendedState; + this.State = state; + } + + /// + /// Gets the identity of the patch's package. + /// + public string PackageId { get; private set; } + + /// + /// Gets the product code of the target. + /// + public string ProductCode { get; private set; } + + /// + /// Gets the recommended state of the patch to use by planning for the target. + /// + public RequestState RecommendedState { get; private set; } + + /// + /// Gets or sets the state of the patch to use by planning for the target. + /// + public RequestState State { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlanMsiFeatureEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlanMsiFeatureEventArgs(string packageId, string featureId, FeatureState recommendedState, FeatureState state, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageId = packageId; + this.FeatureId = featureId; + this.RecommendedState = recommendedState; + this.State = state; + } + + /// + /// Gets the identity of the feature's package to plan. + /// + public string PackageId { get; private set; } + + /// + /// Gets the identity of the feature to plan. + /// + public string FeatureId { get; private set; } + + /// + /// Gets the recommended feature state to use by planning. + /// + public FeatureState RecommendedState { get; private set; } + + /// + /// Gets or sets the feature state to use by planning. + /// + public FeatureState State { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlanMsiPackageEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlanMsiPackageEventArgs(string packageId, bool shouldExecute, ActionState action, BOOTSTRAPPER_MSI_FILE_VERSIONING recommendedFileVersioning, bool cancelRecommendation, BURN_MSI_PROPERTY actionMsiProperty, INSTALLUILEVEL uiLevel, bool disableExternalUiHandler, BOOTSTRAPPER_MSI_FILE_VERSIONING fileVersioning) + : base(cancelRecommendation) + { + this.PackageId = packageId; + this.ShouldExecute = shouldExecute; + this.Action = action; + this.RecommendedFileVersioning = recommendedFileVersioning; + this.ActionMsiProperty = actionMsiProperty; + this.UiLevel = uiLevel; + this.DisableExternalUiHandler = disableExternalUiHandler; + this.FileVersioning = fileVersioning; + } + + /// + /// Gets identity of the package planned for. + /// + public string PackageId { get; private set; } + + /// + /// Gets whether the package is planned to execute or roll back. + /// + public bool ShouldExecute { get; private set; } + + /// + /// Gets the action planned for the package. + /// + public ActionState Action { get; private set; } + + /// + /// Gets the recommended file versioning for the package. + /// + public BOOTSTRAPPER_MSI_FILE_VERSIONING RecommendedFileVersioning { get; private set; } + + /// + /// Gets or sets the requested MSI property to add. + /// + public BURN_MSI_PROPERTY ActionMsiProperty { get; set; } + + /// + /// Gets or sets the requested internal UI level. + /// + public INSTALLUILEVEL UiLevel { get; set; } + + /// + /// Gets or sets whether Burn is requested to set up an external UI handler. + /// + public bool DisableExternalUiHandler { get; set; } + + /// + /// Gets or sets the requested file versioning. + /// + public BOOTSTRAPPER_MSI_FILE_VERSIONING FileVersioning { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlanPackageCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlanPackageCompleteEventArgs(string packageId, int hrStatus, RequestState requested) + : base(hrStatus) + { + this.PackageId = packageId; + this.Requested = requested; + } + + /// + /// Gets the identity of the package planned for. + /// + public string PackageId { get; private set; } + + /// + /// Gets the requested state for the package. + /// + public RequestState Requested { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlannedCompatiblePackageEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlannedCompatiblePackageEventArgs(string packageId, string compatiblePackageId, bool remove) + { + this.PackageId = packageId; + this.CompatiblePackageId = compatiblePackageId; + this.Remove = remove; + } + + /// + /// Gets the identity of the package planned for. + /// + public string PackageId { get; private set; } + + /// + /// Gets the identity of the compatible package detected. + /// + public string CompatiblePackageId { get; private set; } + + /// + /// Gets the planned state of the package. + /// + public bool Remove { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlannedPackageEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlannedPackageEventArgs(string packageId, ActionState execute, ActionState rollback, bool cache, bool uncache) + { + this.PackageId = packageId; + this.Execute = execute; + this.Rollback = rollback; + this.Cache = cache; + this.Uncache = uncache; + } + + /// + /// Gets the identity of the package planned for. + /// + public string PackageId { get; private set; } + + /// + /// Gets the planned execution action. + /// + public ActionState Execute { get; private set; } + + /// + /// Gets the planned rollback action. + /// + public ActionState Rollback { get; private set; } + + /// + /// Gets whether the package will be cached. + /// + public bool Cache { get; private set; } + + /// + /// Gets whether the package will be removed from the package cache. + /// + public bool Uncache { get; private set; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class PlanCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlanCompleteEventArgs(int hrStatus) + : base(hrStatus) + { + } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlanForwardCompatibleBundleEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlanForwardCompatibleBundleEventArgs(string bundleId, RelationType relationType, string bundleTag, bool perMachine, string version, bool recommendedIgnoreBundle, bool cancelRecommendation, bool ignoreBundle) + : base(cancelRecommendation) + { + this.BundleId = bundleId; + this.RelationType = relationType; + this.BundleTag = bundleTag; + this.PerMachine = perMachine; + this.Version = version; + this.RecommendedIgnoreBundle = recommendedIgnoreBundle; + this.IgnoreBundle = ignoreBundle; + } + + /// + /// Gets the identity of the forward compatible bundle detected. + /// + public string BundleId { get; private set; } + + /// + /// Gets the relationship type of the forward compatible bundle. + /// + public RelationType RelationType { get; private set; } + + /// + /// Gets the tag of the forward compatible bundle. + /// + public string BundleTag { get; private set; } + + /// + /// Gets whether the forward compatible bundle is per machine. + /// + public bool PerMachine { get; private set; } + + /// + /// Gets the version of the forward compatible bundle. + /// + public string Version { get; private set; } + + /// + /// Gets the recommendation of whether the engine should use the forward compatible bundle. + /// + public bool RecommendedIgnoreBundle { get; set; } + + /// + /// Gets or sets whether the engine will use the forward compatible bundle. + /// + public bool IgnoreBundle { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class ApplyBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ApplyBeginEventArgs(int phaseCount, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PhaseCount = phaseCount; + } + + /// + /// Gets the number of phases that the engine will go through in apply. + /// There are currently two possible phases: cache and execute. + /// + public int PhaseCount { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class ElevateBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ElevateBeginEventArgs(bool cancelRecommendation) + : base(cancelRecommendation) + { + } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class ElevateCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ElevateCompleteEventArgs(int hrStatus) + : base(hrStatus) + { + } + } + + /// + /// Event arguments for + /// + [Serializable] + public class ProgressEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ProgressEventArgs(int progressPercentage, int overallPercentage, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.ProgressPercentage = progressPercentage; + this.OverallPercentage = overallPercentage; + } + + /// + /// Gets the percentage from 0 to 100 completed for a package. + /// + public int ProgressPercentage { get; private set; } + + /// + /// Gets the percentage from 0 to 100 completed for the bundle. + /// + public int OverallPercentage { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class ErrorEventArgs : ResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ErrorEventArgs(ErrorType errorType, string packageId, int errorCode, string errorMessage, int dwUIHint, string[] data, Result recommendation, Result result) + : base(recommendation, result) + { + this.ErrorType = errorType; + this.PackageId = packageId; + this.ErrorCode = errorCode; + this.ErrorMessage = errorMessage; + this.UIHint = dwUIHint; + this.Data = new ReadOnlyCollection(data ?? new string[] { }); + } + + /// + /// Gets the type of error that occurred. + /// + public ErrorType ErrorType { get; private set; } + + /// + /// Gets the identity of the package that yielded the error. + /// + public string PackageId { get; private set; } + + /// + /// Gets the error code. + /// + public int ErrorCode { get; private set; } + + /// + /// Gets the error message. + /// + public string ErrorMessage { get; private set; } + + /// + /// Gets the recommended display flags for an error dialog. + /// + public int UIHint { get; private set; } + + /// + /// Gets the extended data for the error. + /// + public IList Data { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class RegisterBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public RegisterBeginEventArgs(RegistrationType recommendedRegistrationType, bool cancelRecommendation, RegistrationType registrationType) + : base(cancelRecommendation) + { + this.RecommendedRegistrationType = recommendedRegistrationType; + this.RegistrationType = registrationType; + } + + /// + /// Gets the recommended registration type. + /// + public RegistrationType RecommendedRegistrationType { get; private set; } + + /// + /// Gets or sets the registration type. + /// + public RegistrationType RegistrationType { get; set; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class RegisterCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public RegisterCompleteEventArgs(int hrStatus) + : base(hrStatus) + { + } + } + + /// + /// Event arguments for + /// + [Serializable] + public class UnregisterBeginEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public UnregisterBeginEventArgs(RegistrationType recommendedRegistrationType, RegistrationType registrationType) + { + this.RecommendedRegistrationType = recommendedRegistrationType; + this.RegistrationType = registrationType; + } + + /// + /// Gets the recommended registration type. + /// + public RegistrationType RecommendedRegistrationType { get; private set; } + + /// + /// Gets or sets the registration type. + /// + public RegistrationType RegistrationType { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class UnregisterCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public UnregisterCompleteEventArgs(int hrStatus) + : base(hrStatus) + { + } + } + + /// + /// Event arguments for + /// + [Serializable] + public class CacheBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CacheBeginEventArgs(bool cancelRecommendation) + : base(cancelRecommendation) + { + } + } + + /// + /// EventArgs for . + /// + [Serializable] + public class CacheAcquireBeginEventArgs : CancellableActionEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CacheAcquireBeginEventArgs(string packageOrContainerId, string payloadId, string source, string downloadUrl, string payloadContainerId, CacheOperation recommendation, CacheOperation action, bool cancelRecommendation) + : base(cancelRecommendation, recommendation, action) + { + this.PackageOrContainerId = packageOrContainerId; + this.PayloadId = payloadId; + this.Source = source; + this.DownloadUrl = downloadUrl; + this.PayloadContainerId = payloadContainerId; + } + + /// + /// 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 source of the container or payload. + /// + public string Source { get; private set; } + + /// + /// Gets the optional URL to download container or payload. + /// + public string DownloadUrl { get; private set; } + + /// + /// Gets the optional identity of the container that contains the payload being acquired. + /// + public string PayloadContainerId { get; private set; } + } + + /// + /// EventArgs for . + /// + [Serializable] + public class CacheAcquireProgressEventArgs : CacheProgressBaseEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CacheAcquireProgressEventArgs(string packageOrContainerId, string payloadId, long progress, long total, int overallPercentage, bool cancelRecommendation) + : base(packageOrContainerId, payloadId, progress, total, overallPercentage, cancelRecommendation) + { + } + } + + /// + /// EventArgs for . + /// + [Serializable] + public class CacheAcquireCompleteEventArgs : ActionEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CacheAcquireCompleteEventArgs(string packageOrContainerId, string payloadId, int hrStatus, BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION recommendation, BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION action) + : base(hrStatus, recommendation, action) + { + 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 (if acquiring a payload). + /// + public string PayloadId { get; private set; } + } + + /// + /// EventArgs for . + /// + [Serializable] + public class CacheVerifyBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CacheVerifyBeginEventArgs(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 CacheVerifyProgressEventArgs : CacheProgressBaseEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + 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; + } + + /// + /// Gets the current verification step. + /// + public CacheVerifyStep Step { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class CacheVerifyCompleteEventArgs : ActionEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CacheVerifyCompleteEventArgs(string packageOrContainerId, string payloadId, int hrStatus, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action) + : base(hrStatus, recommendation, action) + { + 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; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class CacheCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CacheCompleteEventArgs(int hrStatus) + : base(hrStatus) + { + } + } + + /// + /// Event arguments for + /// + [Serializable] + public class ExecuteBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ExecuteBeginEventArgs(int packageCount, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageCount = packageCount; + } + + /// + /// Gets the number of packages to act on. + /// + public int PackageCount { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class ExecutePackageBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ExecutePackageBeginEventArgs(string packageId, bool shouldExecute, ActionState action, INSTALLUILEVEL uiLevel, bool disableExternalUiHandler, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageId = packageId; + this.ShouldExecute = shouldExecute; + this.Action = action; + this.UiLevel = uiLevel; + this.DisableExternalUiHandler = disableExternalUiHandler; + } + + /// + /// Gets the identity of the package to act on. + /// + public string PackageId { get; private set; } + + /// + /// Gets whether the package is being executed or rolled back. + /// + public bool ShouldExecute { get; private set; } + + /// + /// Gets the action about to be executed. + /// + public ActionState Action { get; private set; } + + /// + /// Gets the internal UI level (if this is an MSI or MSP package). + /// + public INSTALLUILEVEL UiLevel { get; private set; } + + /// + /// Gets whether Burn will set up an external UI handler (if this is an MSI or MSP package). + /// + public bool DisableExternalUiHandler { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class ExecutePatchTargetEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ExecutePatchTargetEventArgs(string packageId, string targetProductCode, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageId = packageId; + this.TargetProductCode = targetProductCode; + } + + /// + /// Gets the identity of the package to act on. + /// + public string PackageId { get; private set; } + + /// + /// Gets the product code being targeted. + /// + public string TargetProductCode { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class ExecuteMsiMessageEventArgs : ResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ExecuteMsiMessageEventArgs(string packageId, InstallMessage messageType, int dwUIHint, string message, string[] data, Result recommendation, Result result) + : base(recommendation, result) + { + this.PackageId = packageId; + this.MessageType = messageType; + this.UIHint = dwUIHint; + this.Message = message; + this.Data = new ReadOnlyCollection(data ?? new string[] { }); + } + + /// + /// Gets the identity of the package that yielded this message. + /// + public string PackageId { get; private set; } + + /// + /// Gets the type of this message. + /// + public InstallMessage MessageType { get; private set; } + + /// + /// Gets the recommended display flags for this message. + /// + public int UIHint { get; private set; } + + /// + /// Gets the message. + /// + public string Message { get; private set; } + + /// + /// Gets the extended data for the message. + /// + public IList Data { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class ExecuteFilesInUseEventArgs : ResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ExecuteFilesInUseEventArgs(string packageId, string[] files, Result recommendation, FilesInUseType source, Result result) + : base(recommendation, result) + { + this.PackageId = packageId; + this.Files = new ReadOnlyCollection(files ?? new string[] { }); + this.Source = source; + } + + /// + /// Gets the identity of the package that yielded the files in use message. + /// + public string PackageId { get; private set; } + + /// + /// Gets the list of files in use. + /// + public IList Files { get; private set; } + + /// + /// Gets the source of the message. + /// + public FilesInUseType Source { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class ExecutePackageCompleteEventArgs : ActionEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ExecutePackageCompleteEventArgs(string packageId, int hrStatus, ApplyRestart restart, BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION recommendation, BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION action) + : base(hrStatus, recommendation, action) + { + this.PackageId = packageId; + this.Restart = restart; + } + + /// + /// Gets the identity of the package that was acted on. + /// + public string PackageId { get; private set; } + + /// + /// Gets the package restart state after being applied. + /// + public ApplyRestart Restart { get; private set; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class ExecuteCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ExecuteCompleteEventArgs(int hrStatus) + : base(hrStatus) + { + } + } + + /// + /// Event arguments for + /// + [Serializable] + public class ApplyCompleteEventArgs : ActionEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ApplyCompleteEventArgs(int hrStatus, ApplyRestart restart, BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation, BOOTSTRAPPER_APPLYCOMPLETE_ACTION action) + : base(hrStatus, recommendation, action) + { + this.Restart = restart; + } + + /// + /// Gets the apply restart state when complete. + /// + public ApplyRestart Restart { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class ApplyDowngradeEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ApplyDowngradeEventArgs(int hrRecommendation, int hrStatus) + { + this.Recommendation = hrRecommendation; + this.Status = hrStatus; + } + + /// + /// Gets the recommended HRESULT. + /// + public int Recommendation { get; private set; } + + /// + /// Gets or sets the HRESULT for Apply. + /// + public int Status { get; set; } + } + + /// + /// EventArgs for . + /// + [Serializable] + public class CacheAcquireResolvingEventArgs : CancellableActionEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CacheAcquireResolvingEventArgs(string packageOrContainerId, string payloadId, string[] searchPaths, bool foundLocal, int recommendedSearchPath, string downloadUrl, string payloadContainerId, CacheResolveOperation recommendation, int chosenSearchPath, CacheResolveOperation action, bool cancel) + : base(cancel, recommendation, action) + { + this.PackageOrContainerId = packageOrContainerId; + this.PayloadId = payloadId; + this.SearchPaths = searchPaths; + this.FoundLocal = foundLocal; + this.RecommendedSearchPath = recommendedSearchPath; + this.DownloadUrl = downloadUrl; + this.PayloadContainerId = payloadContainerId; + this.ChosenSearchPath = chosenSearchPath; + } + + /// + /// Gets the identity of the package or container that is being acquired. + /// + public string PackageOrContainerId { get; private set; } + + /// + /// Gets the identity of the payload that is being acquired. + /// + public string PayloadId { get; private set; } + + /// + /// Gets the search paths used for source resolution. + /// + public string[] SearchPaths { get; private set; } + + /// + /// Gets whether indicates that a file was found at that search path. + /// + public bool FoundLocal { get; private set; } + + /// + /// When is true, the index to for the recommended local file. + /// + public int RecommendedSearchPath { get; private set; } + + /// + /// Gets the optional URL to download container or payload. + /// + public string DownloadUrl { get; private set; } + + /// + /// Gets the optional identity of the container that contains the payload being acquired. + /// + public string PayloadContainerId { get; private set; } + + /// + /// Gets or sets the index to to use when is set to . + /// + public int ChosenSearchPath { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class CachePackageBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CachePackageBeginEventArgs(string packageId, int cachePayloads, long packageCacheSize, bool vital, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageId = packageId; + this.CachePayloads = cachePayloads; + this.PackageCacheSize = packageCacheSize; + this.Vital = vital; + } + + /// + /// Gets the identity of the package that is being cached. + /// + public string PackageId { get; private set; } + + /// + /// Gets number of payloads to be cached. + /// + public long CachePayloads { get; private set; } + + /// + /// Gets the size on disk required by the specific package. + /// + public long PackageCacheSize { get; private set; } + + /// + /// If caching a package is not vital, then acquisition will be skipped unless the BA opts in through . + /// + public bool Vital { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class CachePackageCompleteEventArgs : ActionEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CachePackageCompleteEventArgs(string packageId, int hrStatus, BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION recommendation, BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION action) + : base(hrStatus, recommendation, action) + { + this.PackageId = packageId; + } + + /// + /// Gets the identity of the package that was cached. + /// + public string PackageId { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class ExecuteProgressEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ExecuteProgressEventArgs(string packageId, int progressPercentage, int overallPercentage, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageId = packageId; + this.ProgressPercentage = progressPercentage; + this.OverallPercentage = overallPercentage; + } + + /// + /// Gets the identity of the package that was executed. + /// + public string PackageId { get; private set; } + + /// + /// Gets the percentage from 0 to 100 of the execution progress for a single payload. + /// + public int ProgressPercentage { get; private set; } + + /// + /// Gets the percentage from 0 to 100 of the execution progress for all payloads. + /// + public int OverallPercentage { get; private set; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class LaunchApprovedExeBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public LaunchApprovedExeBeginEventArgs(bool cancelRecommendation) + : base(cancelRecommendation) + { + } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class LaunchApprovedExeCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public LaunchApprovedExeCompleteEventArgs(int hrStatus, int processId) + : base(hrStatus) + { + this.ProcessId = processId; + } + + /// + /// Gets the ProcessId of the process that was launched. + /// This is only valid if the status reports success. + /// + public int ProcessId { get; private set; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class BeginMsiTransactionBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public BeginMsiTransactionBeginEventArgs(string transactionId, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.TransactionId = transactionId; + } + + /// + /// Gets the MSI transaction Id. + /// + public string TransactionId { get; private set; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class BeginMsiTransactionCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public BeginMsiTransactionCompleteEventArgs(string transactionId, int hrStatus) + : base(hrStatus) + { + this.TransactionId = transactionId; + } + + /// + /// Gets the MSI transaction Id. + /// + public string TransactionId { get; private set; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class CommitMsiTransactionBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CommitMsiTransactionBeginEventArgs(string transactionId, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.TransactionId = transactionId; + } + + /// + /// Gets the MSI transaction Id. + /// + public string TransactionId { get; private set; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class CommitMsiTransactionCompleteEventArgs : ActionEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CommitMsiTransactionCompleteEventArgs(string transactionId, int hrStatus, ApplyRestart restart, BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION recommendation, BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION action) + : base(hrStatus, recommendation, action) + { + this.TransactionId = transactionId; + this.Restart = restart; + } + + /// + /// Gets the MSI transaction Id. + /// + public string TransactionId { get; private set; } + + /// + /// Gets the package restart state after being applied. + /// + public ApplyRestart Restart { get; private set; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class RollbackMsiTransactionBeginEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public RollbackMsiTransactionBeginEventArgs(string transactionId) + { + this.TransactionId = transactionId; + } + + /// + /// Gets the MSI transaction Id. + /// + public string TransactionId { get; private set; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class RollbackMsiTransactionCompleteEventArgs : ActionEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public RollbackMsiTransactionCompleteEventArgs(string transactionId, int hrStatus, ApplyRestart restart, BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION recommendation, BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION action) + : base(hrStatus, recommendation, action) + { + this.TransactionId = transactionId; + this.Restart = restart; + } + + /// + /// Gets the MSI transaction Id. + /// + public string TransactionId { get; private set; } + + /// + /// Gets the package restart state after being applied. + /// + public ApplyRestart Restart { get; private set; } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class PauseAutomaticUpdatesBeginEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PauseAutomaticUpdatesBeginEventArgs() + { + } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class PauseAutomaticUpdatesCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PauseAutomaticUpdatesCompleteEventArgs(int hrStatus) + : base(hrStatus) + { + } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class SystemRestorePointBeginEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public SystemRestorePointBeginEventArgs() + { + } + } + + /// + /// Event arguments for . + /// + [Serializable] + public class SystemRestorePointCompleteEventArgs : StatusEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public SystemRestorePointCompleteEventArgs(int hrStatus) + : base(hrStatus) + { + } + } + + /// + /// EventArgs for . + /// + [Serializable] + public class CacheContainerOrPayloadVerifyBeginEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + 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 + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + 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 + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + 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 + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + 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 + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + 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 + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + 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; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class PlanRestoreRelatedBundleEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public PlanRestoreRelatedBundleEventArgs(string bundleId, RequestState recommendedState, RequestState state, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.BundleId = bundleId; + this.RecommendedState = recommendedState; + this.State = state; + } + + /// + /// Gets the identity of the bundle to plan for. + /// + public string BundleId { get; private set; } + + /// + /// Gets the recommended requested state for the bundle. + /// + public RequestState RecommendedState { get; private set; } + + /// + /// Gets or sets the requested state for the bundle. + /// + public RequestState State { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class ExecuteProcessCancelEventArgs : HResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public ExecuteProcessCancelEventArgs(string packageId, int processId, BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION recommendation, BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION action) + { + this.PackageId = packageId; + this.ProcessId = processId; + this.Recommendation = recommendation; + this.Action = action; + } + + /// + /// Gets the identity of the package. + /// + public string PackageId { get; private set; } + + /// + /// Gets the process id. + /// + public int ProcessId { get; private set; } + + /// + /// Gets the recommended action from the engine. + /// + public BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION Recommendation { get; private set; } + + /// + /// Gets or sets the action to be performed. This is passed back to the engine. + /// + public BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION Action { get; set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class DetectRelatedBundlePackageEventArgs : CancellableHResultEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public DetectRelatedBundlePackageEventArgs(string packageId, string productCode, RelationType relationType, bool perMachine, string version, bool cancelRecommendation) + : base(cancelRecommendation) + { + this.PackageId = packageId; + this.ProductCode = productCode; + this.RelationType = relationType; + this.PerMachine = perMachine; + this.Version = version; + } + + /// + /// Gets the identity of the product's package detected. + /// + public string PackageId { get; private set; } + + /// + /// Gets the identity of the related bundle detected. + /// + public string ProductCode { get; private set; } + + /// + /// Gets the relationship type of the related bundle. + /// + public RelationType RelationType { get; private set; } + + /// + /// Gets whether the detected bundle is per machine. + /// + public bool PerMachine { get; private set; } + + /// + /// Gets the version of the related bundle detected. + /// + public string Version { get; private set; } + } + + /// + /// Event arguments for + /// + [Serializable] + public class CachePackageNonVitalValidationFailureEventArgs : ActionEventArgs + { + /// + /// This class is for events raised by the engine. + /// It is not intended to be instantiated by user code. + /// + public CachePackageNonVitalValidationFailureEventArgs(string packageId, int hrStatus, BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION recommendation, BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION action) + : base(hrStatus, recommendation, action) + { + this.PackageId = packageId; + } + + /// + /// Gets the identity of the package that was being validated. + /// + public string PackageId { get; private set; } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperApplication.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperApplication.cs new file mode 100644 index 00000000..ad7f8dd7 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperApplication.cs @@ -0,0 +1,2013 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Runtime.InteropServices; + + /// + /// Allows customization of the bootstrapper application. + /// + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [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 + ); + + /// + /// Low level method that is called directly from the engine. + /// + void BAProcFallback( + int message, + IntPtr pvArgs, + IntPtr pvResults, + ref int phr + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCreate(IBootstrapperEngine engine, ref Command command); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDestroy(bool reload); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnStartup(); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnShutdown(ref BOOTSTRAPPER_SHUTDOWN_ACTION action); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDetectBegin( + [MarshalAs(UnmanagedType.Bool)] bool fCached, + [MarshalAs(UnmanagedType.U4)] RegistrationType registrationType, + [MarshalAs(UnmanagedType.U4)] int cPackages, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDetectForwardCompatibleBundle( + [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, + [MarshalAs(UnmanagedType.U4)] RelationType relationType, + [MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag, + [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, + [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, + [MarshalAs(UnmanagedType.Bool)] bool fMissingFromCache, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDetectUpdateBegin( + [MarshalAs(UnmanagedType.LPWStr)] string wzUpdateLocation, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, + [MarshalAs(UnmanagedType.Bool)] ref bool fSkip + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDetectUpdate( + [MarshalAs(UnmanagedType.LPWStr)] string wzUpdateLocation, + [MarshalAs(UnmanagedType.U8)] long dw64Size, + [MarshalAs(UnmanagedType.LPWStr)] string wzHash, + [MarshalAs(UnmanagedType.U4)] UpdateHashType hashAlgorithm, + [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, + [MarshalAs(UnmanagedType.LPWStr)] string wzTitle, + [MarshalAs(UnmanagedType.LPWStr)] string wzSummary, + [MarshalAs(UnmanagedType.LPWStr)] string wzContentType, + [MarshalAs(UnmanagedType.LPWStr)] string wzContent, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, + [MarshalAs(UnmanagedType.Bool)] ref bool fStopProcessingUpdates + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDetectUpdateComplete( + int hrStatus, + [MarshalAs(UnmanagedType.Bool)] ref bool fIgnoreError + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDetectRelatedBundle( + [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, + [MarshalAs(UnmanagedType.U4)] RelationType relationType, + [MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag, + [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, + [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, + [MarshalAs(UnmanagedType.Bool)] bool fMissingFromCache, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDetectPackageBegin( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDetectCompatibleMsiPackage( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzCompatiblePackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzCompatiblePackageVersion, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDetectRelatedMsiPackage( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzUpgradeCode, + [MarshalAs(UnmanagedType.LPWStr)] string wzProductCode, + [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, + [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, + [MarshalAs(UnmanagedType.U4)] RelatedOperation operation, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDetectPatchTarget( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzProductCode, + [MarshalAs(UnmanagedType.U4)] PackageState patchState, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDetectMsiFeature( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzFeatureId, + [MarshalAs(UnmanagedType.U4)] FeatureState state, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDetectPackageComplete( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + int hrStatus, + [MarshalAs(UnmanagedType.U4)] PackageState state, + [MarshalAs(UnmanagedType.Bool)] bool fCached + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDetectComplete( + int hrStatus, + [MarshalAs(UnmanagedType.Bool)] bool fEligibleForCleanup + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanBegin( + [MarshalAs(UnmanagedType.U4)] int cPackages, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanRelatedBundle( + [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, + [MarshalAs(UnmanagedType.U4)] RequestState recommendedState, + [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanRollbackBoundary( + [MarshalAs(UnmanagedType.LPWStr)] string wzRollbackBoundaryId, + [MarshalAs(UnmanagedType.Bool)] bool fRecommendedTransaction, + [MarshalAs(UnmanagedType.Bool)] ref bool fTransaction, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanPackageBegin( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.U4)] PackageState state, + [MarshalAs(UnmanagedType.Bool)] bool fCached, + [MarshalAs(UnmanagedType.U4)] BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, + [MarshalAs(UnmanagedType.U4)] BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, + [MarshalAs(UnmanagedType.U4)] RequestState recommendedState, + [MarshalAs(UnmanagedType.U4)] BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, + [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState, + [MarshalAs(UnmanagedType.U4)] ref BOOTSTRAPPER_CACHE_TYPE pRequestedCacheType, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanCompatibleMsiPackageBegin( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzCompatiblePackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzCompatiblePackageVersion, + [MarshalAs(UnmanagedType.Bool)] bool fRecommendedRemove, + [MarshalAs(UnmanagedType.Bool)] ref bool fRequestRemove, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanCompatibleMsiPackageComplete( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzCompatiblePackageId, + int hrStatus, + [MarshalAs(UnmanagedType.Bool)] bool fRequestedRemove + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanPatchTarget( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzProductCode, + [MarshalAs(UnmanagedType.U4)] RequestState recommendedState, + [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanMsiFeature( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzFeatureId, + [MarshalAs(UnmanagedType.U4)] FeatureState recommendedState, + [MarshalAs(UnmanagedType.U4)] ref FeatureState pRequestedState, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanMsiPackage( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.Bool)] bool fExecute, + [MarshalAs(UnmanagedType.U4)] ActionState action, + [MarshalAs(UnmanagedType.U4)] BOOTSTRAPPER_MSI_FILE_VERSIONING recommendedFileVersioning, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, + [MarshalAs(UnmanagedType.U4)] ref BURN_MSI_PROPERTY actionMsiProperty, + [MarshalAs(UnmanagedType.U4)] ref INSTALLUILEVEL uiLevel, + [MarshalAs(UnmanagedType.Bool)] ref bool fDisableExternalUiHandler, + [MarshalAs(UnmanagedType.U4)] ref BOOTSTRAPPER_MSI_FILE_VERSIONING fileVersioning + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanPackageComplete( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + int hrStatus, + [MarshalAs(UnmanagedType.U4)] RequestState requested + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlannedCompatiblePackage( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzCompatiblePackageId, + [MarshalAs(UnmanagedType.Bool)] bool fRemove + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlannedPackage( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.U4)] ActionState execute, + [MarshalAs(UnmanagedType.U4)] ActionState rollback, + [MarshalAs(UnmanagedType.Bool)] bool fPlannedCache, + [MarshalAs(UnmanagedType.Bool)] bool fPlannedUncache + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanComplete( + int hrStatus + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnApplyBegin( + [MarshalAs(UnmanagedType.U4)] int dwPhaseCount, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnElevateBegin( + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnElevateComplete( + int hrStatus + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnProgress( + [MarshalAs(UnmanagedType.U4)] int dwProgressPercentage, + [MarshalAs(UnmanagedType.U4)] int dwOverallPercentage, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnError( + [MarshalAs(UnmanagedType.U4)] ErrorType errorType, + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.U4)] int dwCode, + [MarshalAs(UnmanagedType.LPWStr)] string wzError, + [MarshalAs(UnmanagedType.I4)] int dwUIHint, + [MarshalAs(UnmanagedType.U4)] int cData, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5, ArraySubType = UnmanagedType.LPWStr), In] string[] rgwzData, + [MarshalAs(UnmanagedType.I4)] Result nRecommendation, + [MarshalAs(UnmanagedType.I4)] ref Result pResult + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnRegisterBegin( + [MarshalAs(UnmanagedType.I4)] RegistrationType recommendedRegistrationType, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, + [MarshalAs(UnmanagedType.I4)] ref RegistrationType pRegistrationType + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnRegisterComplete( + int hrStatus + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCacheBegin( + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCachePackageBegin( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.U4)] int cCachePayloads, + [MarshalAs(UnmanagedType.U8)] long dw64PackageCacheSize, + [MarshalAs(UnmanagedType.Bool)] bool fVital, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCacheAcquireBegin( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, + [MarshalAs(UnmanagedType.LPWStr)] string wzSource, + [MarshalAs(UnmanagedType.LPWStr)] string wzDownloadUrl, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadContainerId, + [MarshalAs(UnmanagedType.U4)] CacheOperation recommendation, + [MarshalAs(UnmanagedType.I4)] ref CacheOperation action, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCacheAcquireProgress( + [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 OnCacheAcquireResolving( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3, ArraySubType = UnmanagedType.LPWStr), In] string[] searchPaths, + [MarshalAs(UnmanagedType.U4)] int cSearchPaths, + [MarshalAs(UnmanagedType.Bool)] bool fFoundLocal, + [MarshalAs(UnmanagedType.U4)] int dwRecommendedSearchPath, + [MarshalAs(UnmanagedType.LPWStr)] string wzDownloadUrl, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadContainerId, + [MarshalAs(UnmanagedType.I4)] CacheResolveOperation recommendation, + [MarshalAs(UnmanagedType.U4)] ref int dwChosenSearchPath, + [MarshalAs(UnmanagedType.I4)] ref CacheResolveOperation action, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCacheAcquireComplete( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, + int hrStatus, + BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION recommendation, + ref BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION pAction + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCacheVerifyBegin( + [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 wzPackageOrContainerId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, + int hrStatus, + BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation, + ref BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCachePackageComplete( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + int hrStatus, + BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION recommendation, + ref BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION action + ); + + /// + /// See . + /// + /// + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCacheComplete( + int hrStatus + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnExecuteBegin( + [MarshalAs(UnmanagedType.U4)] int cExecutingPackages, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnExecutePackageBegin( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.Bool)] bool fExecute, + [MarshalAs(UnmanagedType.U4)] ActionState action, + [MarshalAs(UnmanagedType.U4)] INSTALLUILEVEL uiLevel, + [MarshalAs(UnmanagedType.Bool)] bool fDisableExternalUiHandler, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnExecutePatchTarget( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzTargetProductCode, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnExecuteProgress( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.U4)] int dwProgressPercentage, + [MarshalAs(UnmanagedType.U4)] int dwOverallPercentage, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnExecuteMsiMessage( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.U4)] InstallMessage messageType, + [MarshalAs(UnmanagedType.I4)] int dwUIHint, + [MarshalAs(UnmanagedType.LPWStr)] string wzMessage, + [MarshalAs(UnmanagedType.U4)] int cData, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4, ArraySubType = UnmanagedType.LPWStr), In] string[] rgwzData, + [MarshalAs(UnmanagedType.I4)] Result nRecommendation, + [MarshalAs(UnmanagedType.I4)] ref Result pResult + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnExecuteFilesInUse( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.U4)] int cFiles, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1, ArraySubType = UnmanagedType.LPWStr), In] string[] rgwzFiles, + [MarshalAs(UnmanagedType.I4)] Result nRecommendation, + [MarshalAs(UnmanagedType.I4)] FilesInUseType source, + [MarshalAs(UnmanagedType.I4)] ref Result pResult + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnExecutePackageComplete( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + int hrStatus, + [MarshalAs(UnmanagedType.U4)] ApplyRestart restart, + [MarshalAs(UnmanagedType.I4)] BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION recommendation, + [MarshalAs(UnmanagedType.I4)] ref BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION pAction + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnExecuteComplete( + int hrStatus + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnUnregisterBegin( + [MarshalAs(UnmanagedType.I4)] RegistrationType recommendedRegistrationType, + [MarshalAs(UnmanagedType.I4)] ref RegistrationType pRegistrationType + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnUnregisterComplete( + int hrStatus + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnApplyComplete( + int hrStatus, + [MarshalAs(UnmanagedType.U4)] ApplyRestart restart, + [MarshalAs(UnmanagedType.I4)] BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation, + [MarshalAs(UnmanagedType.I4)] ref BOOTSTRAPPER_APPLYCOMPLETE_ACTION pAction + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnLaunchApprovedExeBegin( + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnLaunchApprovedExeComplete( + int hrStatus, + int processId + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnBeginMsiTransactionBegin( + [MarshalAs(UnmanagedType.LPWStr)] string wzTransactionId, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnBeginMsiTransactionComplete( + [MarshalAs(UnmanagedType.LPWStr)] string wzTransactionId, + int hrStatus + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCommitMsiTransactionBegin( + [MarshalAs(UnmanagedType.LPWStr)] string wzTransactionId, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCommitMsiTransactionComplete( + [MarshalAs(UnmanagedType.LPWStr)] string wzTransactionId, + int hrStatus, + [MarshalAs(UnmanagedType.U4)] ApplyRestart restart, + [MarshalAs(UnmanagedType.I4)] BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION recommendation, + [MarshalAs(UnmanagedType.I4)] ref BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION pAction + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnRollbackMsiTransactionBegin( + [MarshalAs(UnmanagedType.LPWStr)] string wzTransactionId + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnRollbackMsiTransactionComplete( + [MarshalAs(UnmanagedType.LPWStr)] string wzTransactionId, + int hrStatus, + [MarshalAs(UnmanagedType.U4)] ApplyRestart restart, + [MarshalAs(UnmanagedType.I4)] BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION recommendation, + [MarshalAs(UnmanagedType.I4)] ref BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION pAction + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPauseAutomaticUpdatesBegin( + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPauseAutomaticUpdatesComplete( + int hrStatus + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnSystemRestorePointBegin( + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnSystemRestorePointComplete( + int hrStatus + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanForwardCompatibleBundle( + [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, + [MarshalAs(UnmanagedType.U4)] RelationType relationType, + [MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag, + [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, + [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, + [MarshalAs(UnmanagedType.Bool)] bool fRecommendedIgnoreBundle, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, + [MarshalAs(UnmanagedType.Bool)] ref bool fIgnoreBundle + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCacheContainerOrPayloadVerifyBegin( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [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 + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanRestoreRelatedBundle( + [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, + [MarshalAs(UnmanagedType.U4)] RequestState recommendedState, + [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanRelatedBundleType( + [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, + [MarshalAs(UnmanagedType.U4)] RelatedBundlePlanType recommendedType, + [MarshalAs(UnmanagedType.U4)] ref RelatedBundlePlanType pRequestedType, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnApplyDowngrade( + [MarshalAs(UnmanagedType.I4)] int hrRecommended, + [MarshalAs(UnmanagedType.I4)] ref int hrStatus + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnExecuteProcessCancel( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + int processId, + [MarshalAs(UnmanagedType.I4)] BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION recommendation, + [MarshalAs(UnmanagedType.I4)] ref BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION pAction + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnDetectRelatedBundlePackage( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, + [MarshalAs(UnmanagedType.U4)] RelationType relationType, + [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, + [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + ); + + /// + /// See . + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnCachePackageNonVitalValidationFailure( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + int hrStatus, + BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION recommendation, + ref BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION action + ); + } + + /// + /// The display level for the BA. + /// + public enum Display + { + /// + /// Invalid value. + /// + Unknown, + + /// + /// The bundle is being run through the Burn protocol by an external application. + /// + Embedded, + + /// + /// No UI should be shown. + /// + None, + + /// + /// The UI should not require any interaction from the user. + /// + Passive, + + /// + /// The UI should be fully interactive. + /// + Full, + } + + /// + /// Messages from Windows Installer (msi.h). + /// + public enum InstallMessage + { + /// + /// premature termination, possibly fatal OOM + /// + FatalExit, + + /// + /// formatted error message + /// + Error = 0x01000000, + + /// + /// formatted warning message + /// + Warning = 0x02000000, + + /// + /// user request message + /// + User = 0x03000000, + + /// + /// informative message for log + /// + Info = 0x04000000, + + /// + /// list of files in use that need to be replaced + /// + FilesInUse = 0x05000000, + + /// + /// request to determine a valid source location + /// + ResolveSource = 0x06000000, + + /// + /// insufficient disk space message + /// + OutOfDiskSpace = 0x07000000, + + /// + /// start of action: action name & description + /// + ActionStart = 0x08000000, + + /// + /// formatted data associated with individual action item + /// + ActionData = 0x09000000, + + /// + /// progress gauge info: units so far, total + /// + Progress = 0x0a000000, + + /// + /// product info for dialog: language Id, dialog caption + /// + CommonData = 0x0b000000, + + /// + /// sent prior to UI initialization, no string data + /// + Initialize = 0x0c000000, + + /// + /// sent after UI termination, no string data + /// + Terminate = 0x0d000000, + + /// + /// sent prior to display or authored dialog or wizard + /// + ShowDialog = 0x0e000000, + + /// + /// log only, to log performance number like action time + /// + Performance = 0x0f000000, + + /// + /// the list of apps that the user can request Restart Manager to shut down and restart + /// + RMFilesInUse = 0x19000000, + + /// + /// sent prior to server-side install of a product + /// + InstallStart = 0x1a000000, + + /// + /// sent after server-side install + /// + InstallEnd = 0x1B000000, + } + + /// + /// The action to perform when a reboot is necessary. + /// + public enum Restart + { + /// + /// Invalid value. + /// + Unknown, + + /// + /// The bundle should never initiate a restart. + /// + Never, + + /// + /// The bundle should prompt the user whether to restart. + /// + Prompt, + + /// + /// The bundle should restart if necessary. + /// + Automatic, + + /// + /// The bundle should always restart when given the option. + /// + Always, + } + + /// + /// The display name to use when registering in Add/Remove Programs. + /// + public enum RegistrationType + { + /// + /// No registration. + /// The engine will ignore None if it recommended InProgress or Full. + /// + None, + + /// + /// The in-progress display name. + /// + InProgress, + + /// + /// The default display name. + /// + Full, + } + + /// + /// Result codes (based on Dialog Box Command IDs from WinUser.h). + /// + public enum Result + { + /// + /// An error occurred. + /// + Error = -1, + + /// + /// Invalid value. + /// + None, + + /// + /// IDOK + /// + Ok, + + /// + /// IDCANCEL + /// + Cancel, + + /// + /// IDABORT + /// + Abort, + + /// + /// IDRETRY + /// + Retry, + + /// + /// IDIGNORE + /// + Ignore, + + /// + /// IDYES + /// + Yes, + + /// + /// IDNO + /// + No, + + /// + /// IDCLOSE + /// + Close, + + /// + /// IDHELP + /// + Help, + + /// + /// IDTRYAGAIN + /// + TryAgain, + + /// + /// IDCONTINUE + /// + Continue, + } + + /// + /// Describes why a bundle or packaged is being resumed. + /// + public enum ResumeType + { + /// + /// No resume information. + /// + None, + + /// + /// Resume information exists but is invalid. + /// + Invalid, + + /// + /// The bundle was re-launched after an unexpected interruption. + /// + Interrupted, + + /// + /// The bundle was re-launched after a reboot. + /// + Reboot, + + /// + /// The bundle was re-launched after being suspended. + /// + Suspend, + + /// + /// The bundle was launched from Add/Remove Programs. + /// + Arp, + } + + /// + /// Indicates what caused the error. + /// + public enum ErrorType + { + /// + /// The error occurred trying to elevate. + /// + Elevate, + + /// + /// The error came from the Windows Installer. + /// + WindowsInstaller, + + /// + /// The error came from an EXE Package. + /// + ExePackage, + + /// + /// The error came while trying to authenticate with an HTTP server. + /// + HttpServerAuthentication, + + /// + /// The error came while trying to authenticate with an HTTP proxy. + /// + HttpProxyAuthentication, + + /// + /// The error occurred during apply. + /// + Apply, + }; + + /// + /// Indicates the source of the FilesInUse message. + /// + public enum FilesInUseType + { + /// + /// Generated from INSTALLMESSAGE_FILESINUSE. + /// + Msi, + /// + /// Generated from INSTALLMESSAGE_RMFILESINUSE. + /// + MsiRm, + /// + /// Generated from MMIO_CLOSE_APPS. + /// + Netfx, + } + + /// + /// The calculated operation for the related MSI package. + /// + public enum RelatedOperation + { + /// + /// No relation. + /// + None, + + /// + /// The related bundle or package will be downgraded. + /// + Downgrade, + + /// + /// The related package will be upgraded as a minor revision. + /// + MinorUpdate, + + /// + /// The related bundle or package will be upgraded as a major revision. + /// + MajorUpgrade, + + /// + /// The related bundle will be removed. + /// + Remove, + + /// + /// The related bundle will be installed. + /// + Install, + + /// + /// The related bundle will be repaired. + /// + Repair, + }; + + /// + /// The cache operation used to acquire a container or payload. + /// + public enum CacheOperation + { + /// + /// There is no source available. + /// + None, + + /// + /// Copy the payload or container from the chosen local source. + /// + Copy, + + /// + /// Download the payload or container using the download URL. + /// + Download, + + /// + /// Extract the payload from the container. + /// + Extract, + } + + /// + /// The source to be used to acquire a container or payload. + /// + public enum CacheResolveOperation + { + /// + /// There is no source available. + /// + None, + + /// + /// Copy the payload or container from the chosen local source. + /// + Local, + + /// + /// Download the payload or container from the download URL. + /// + Download, + + /// + /// Extract the payload from the container. + /// + Container, + + /// + /// Look again for the payload or container locally. + /// + 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. + /// + public enum ApplyRestart + { + /// + /// Package or chain does not require a restart. + /// + None, + + /// + /// Package or chain requires a restart but it has not been initiated yet. + /// + RestartRequired, + + /// + /// Package or chain has already initiated the restart. + /// + RestartInitiated + } + + /// + /// The relation type for related bundles. + /// + public enum RelationType + { + /// + /// No relation. + /// + None, + + /// + /// The related bundle is detected by the running bundle. + /// This relationship is reversed for + /// + Detect, + + /// + /// The related bundle shares an upgrade code with the running bundle. + /// This relationship is reversed for + /// + Upgrade, + + /// + /// The related bundle is an add-on for the running bundle. + /// This relationship is reversed for + /// + Addon, + + /// + /// The related bundle is a patch for the running bundle. + /// This relationship is reversed for + /// + Patch, + + /// + /// The running bundle is an add-on for the related bundle. + /// This relationship is reversed for + /// + DependentAddon, + + /// + /// The running bundle is a patch for the related bundle. + /// This relationship is reversed for + /// + DependentPatch, + + /// + /// The related bundle is a newer version of the running bundle. + /// This relationship is reversed for + /// + Update, + + /// + /// The related bundle is in the running bundle's chain. + /// This relationship is reversed for + /// + ChainPackage, + } + + /// + /// The planned relation type for related bundles. + /// + public enum RelatedBundlePlanType + { + /// + /// Don't execute the related bundle. + /// + None, + + /// + /// The running bundle is a downgrade for the related bundle. + /// + Downgrade, + + /// + /// The running bundle is an upgrade for the related bundle. + /// + Upgrade, + + /// + /// The related bundle is an add-on of the running bundle. + /// + Addon, + + /// + /// The related bundle is a patch for the running bundle. + /// + Patch, + + /// + /// The running bundle is an add-on for the related bundle. + /// + DependentAddon, + + /// + /// The running bundle is a patch for the related bundle. + /// + DependentPatch, + } + + /// + /// One or more reasons why the application is requested to be closed or is being closed. + /// + [Flags] + public enum EndSessionReasons + { + /// + /// The system is shutting down or restarting (it is not possible to determine which event is occurring). + /// + Unknown, + + /// + /// The application is using a file that must be replaced, the system is being serviced, or system resources are exhausted. + /// + CloseApplication, + + /// + /// The application is forced to shut down. + /// + Critical = 0x40000000, + + /// + /// The user is logging off. + /// + Logoff = unchecked((int)0x80000000) + } + + /// + /// The available actions for . + /// + public enum BOOTSTRAPPER_APPLYCOMPLETE_ACTION + { + /// + /// Instructs the engine to not take any special action. + /// + None, + + /// + /// Instructs the engine to restart. + /// The engine will not launch again after the machine is rebooted. + /// Ignored if reboot was already initiated by . + /// + Restart, + } + + /// + /// The cache strategy to be used for the package. + /// + public enum BOOTSTRAPPER_CACHE_TYPE + { + /// + /// The package will be cached in order to securely run the package, but will always be cleaned from the cache at the end. + /// + Remove, + + /// + /// The package will be cached in order to run the package, and then kept in the cache until the package is uninstalled. + /// + Keep, + + /// + /// The package will always be cached and stay in the cache, unless the package and bundle are both being uninstalled. + /// + Force, + } + + /// + /// The available actions for . + /// + public enum BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION + { + /// + /// Instructs the engine to not take any special action. + /// + None, + + /// + /// Instructs the engine to try the acquisition of the payload again. + /// Ignored if hrStatus is a success. + /// + Retry, + } + + /// + /// The available actions for . + /// + public enum BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION + { + /// + /// Instructs the engine to not take any special action. + /// + None, + + /// + /// Instructs the engine to ignore non-vital package failures and continue with the caching. + /// Ignored if hrStatus is a success or the package is vital. + /// + Ignore, + + /// + /// Instructs the engine to try the acquisition and verification of the package again. + /// Ignored if hrStatus is a success. + /// + Retry, + } + + /// + /// The available actions for + /// + public enum BOOTSTRAPPER_CACHEPACKAGENONVITALVALIDATIONFAILURE_ACTION + { + /// + /// Instructs the engine to not take any special action. + /// + None, + + /// + /// Instructs the engine to try to acquire the package so execution can use it. + /// Most of the time this is used for installing the package during rollback. + /// + Acquire, + } + + /// + /// The available actions for . + /// + public enum BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION + { + /// + /// Instructs the engine to not take any special action. + /// + None, + + /// + /// Ignored if hrStatus is a success. + /// + RetryVerification, + + /// + /// Ignored if hrStatus is a success. + /// + RetryAcquisition, + } + + /// + /// The available actions for . + /// + public enum BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION + { + /// + /// Instructs the engine to not take any special action. + /// + None, + + /// + /// Instructs the engine to ignore non-vital package failures and continue with the install. + /// Ignored if hrStatus is a success or the package is vital. + /// + Ignore, + + /// + /// Instructs the engine to try the execution of the package again. + /// Ignored if hrStatus is a success. + /// + Retry, + + /// + /// Instructs the engine to stop processing the chain and restart. + /// The engine will launch again after the machine is restarted. + /// + Restart, + + /// + /// Instructs the engine to stop processing the chain and suspend the current state. + /// + Suspend, + } + + /// + /// The available actions for and . + /// + public enum BOOTSTRAPPER_EXECUTEMSITRANSACTIONCOMPLETE_ACTION + { + /// + /// Instructs the engine to not take any special action. + /// + None, + + /// + /// Instructs the engine to stop processing the chain and restart. + /// The engine will launch again after the machine is restarted. + /// + Restart, + }; + + /// + /// The available actions for . + /// + public enum BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION + { + /// + /// Instructs the engine to stop waiting for the process to exit. + /// The package is immediately considered to have failed with ERROR_INSTALL_USEREXIT. + /// The engine will never rollback the package. + /// + Abandon, + + /// + /// Instructs the engine to wait for the process to exit. + /// Once the process has exited, the package is considered to have failed with ERROR_INSTALL_USEREXIT. + /// This allows the engine to rollback the package if necessary. + /// + Wait, + } + + /// + /// The result of evaluating a condition from a package. + /// + public enum BOOTSTRAPPER_PACKAGE_CONDITION_RESULT + { + /// + /// No condition was authored. + /// + Default, + + /// + /// Evaluated to false. + /// + False, + + /// + /// Evaluated to true. + /// + True, + } + + /// + /// The available actions for . + /// + public enum BOOTSTRAPPER_RESOLVESOURCE_ACTION + { + /// + /// Instructs the engine that the source can't be found. + /// + None, + + /// + /// Instructs the engine to try the local source again. + /// + Retry, + + /// + /// Instructs the engine to try the download source. + /// + Download, + } + + /// + /// The available actions for . + /// + public enum BOOTSTRAPPER_SHUTDOWN_ACTION + { + /// + /// Instructs the engine to not take any special action. + /// + None, + + /// + /// Instructs the engine to restart. + /// The engine will not launch again after the machine is rebooted. + /// Ignored if reboot was already initiated by . + /// + Restart, + + /// + /// Instructs the engine to unload the bootstrapper application and + /// restart the engine which will load the bootstrapper application again. + /// Typically used to switch from a native bootstrapper application to a managed one. + /// + ReloadBootstrapper, + + /// + /// Opts out of the engine behavior of trying to uninstall itself when no non-permanent packages are installed. + /// + SkipCleanup, + } + + /// + /// The file versioning options for REINSTALLMODE, see https://docs.microsoft.com/en-us/windows/win32/msi/reinstallmode. + /// + public enum BOOTSTRAPPER_MSI_FILE_VERSIONING + { + /// + /// o + /// + Older, + /// + /// e + /// + Equal, + /// + /// a + /// + All, + } + + /// + /// The property Burn will add so the MSI can know the planned action for the package. + /// + public enum BURN_MSI_PROPERTY + { + /// + /// No property will be added. + /// + None, + + /// + /// Add BURNMSIINSTALL=1 + /// + Install, + + /// + /// Add BURNMSIMODFIY=1 + /// + Modify, + + /// + /// Add BURNMSIREPAIR=1 + /// + Repair, + + /// + /// Add BURNMSIUNINSTALL=1 + /// + Uninstall, + } + + /// + /// From msi.h + /// https://docs.microsoft.com/en-us/windows/win32/api/msi/nf-msi-msisetinternalui + /// + [Flags] + public enum INSTALLUILEVEL + { + /// + /// UI level is unchanged + /// + NoChange = 0, + + /// + /// default UI is used + /// + Default = 1, + + /// + /// completely silent installation + /// + None = 2, + + /// + /// simple progress and error handling + /// + Basic = 3, + + /// + /// authored UI, wizard dialogs suppressed + /// + Reduced = 4, + + /// + /// authored UI with wizards, progress, errors + /// + Full = 5, + + /// + /// display success/failure dialog at end of install + /// + EndDialog = 0x80, + + /// + /// display only progress dialog + /// + ProgressOnly = 0x40, + + /// + /// do not display the cancel button in basic UI + /// + HideCancel = 0x20, + + /// + /// force display of source resolution even if quiet + /// + SourceResOnly = 0x100, + + /// + /// show UAC prompt even if quiet + /// Can only be used if on Windows Installer 5.0 or later + /// + UacOnly = 0x200, + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperApplicationData.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperApplicationData.cs new file mode 100644 index 00000000..d26d89c1 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperApplicationData.cs @@ -0,0 +1,22 @@ +// 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.BootstrapperApplicationApi +{ + using System.IO; + + /// + /// Interface for BootstrapperApplicationData.xml. + /// + public interface IBootstrapperApplicationData + { + /// + /// The BootstrapperApplicationData.xml file. + /// + FileInfo BADataFile { get; } + + /// + /// The BA manifest. + /// + IBundleInfo Bundle { get; } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperApplicationFactory.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperApplicationFactory.cs new file mode 100644 index 00000000..ac90c0b7 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperApplicationFactory.cs @@ -0,0 +1,22 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.CodeDom.Compiler; + using System.Runtime.InteropServices; + + /// + /// This is no longer used. + /// + [Obsolete("Bootstrapper applications now run out of proc and do not use a BootstrapperApplicationFactory. Remove your BootstrapperApplicationFactory class. See https://wixtoolset.org/docs/fiveforfour/ for more details.")] + public interface IBootstrapperApplicationFactory + { + /// + /// This is no longer used. + /// + /// This is no longer used. + /// This is no longer used. + void Create(IntPtr pArgs, IntPtr pResults); + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperCommand.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperCommand.cs new file mode 100644 index 00000000..a1f8bfe0 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperCommand.cs @@ -0,0 +1,79 @@ +// 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.BootstrapperApplicationApi +{ + using System; + + /// + /// Command information passed from the engine for the BA to perform. + /// + public interface IBootstrapperCommand + { + /// + /// Gets the action for the BA to perform. + /// + LaunchAction Action { get; } + + /// + /// Gets the display level for the BA. + /// + Display Display { get; } + + /// + /// Gets the command line arguments. + /// + /// + /// Command line arguments not handled by the engine. + /// + string CommandLine { get; } + + /// + /// Hint for the initial visibility of the window. + /// + int CmdShow { get; } + + /// + /// Gets the method of how the engine was resumed from a previous installation step. + /// + ResumeType Resume { get; } + + /// + /// Gets the handle to the splash screen window. If no splash screen was displayed this value will be IntPtr.Zero. + /// + IntPtr SplashScreen { get; } + + /// + /// If this was run from a related bundle, specifies the relation type. + /// + RelationType Relation { get; } + + /// + /// If this was run from a backward compatible bundle. + /// + bool Passthrough { get; } + + /// + /// Gets layout directory. + /// + string LayoutDirectory { get; } + + /// + /// Gets bootstrapper working folder. + /// + string BootstrapperWorkingFolder { get; } + + /// + /// Gets path to BootstrapperApplicationData.xml. + /// + string BootstrapperApplicationDataPath { get; } + + /// + /// Parses the command line arguments into an . + /// + /// + /// The parsed information. + /// + /// The command line could not be parsed. + IMbaCommand ParseCommandLine(); + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs new file mode 100644 index 00000000..1e91cd31 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs @@ -0,0 +1,501 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.CodeDom.Compiler; + using System.Runtime.InteropServices; + using System.Text; + + /// + /// Allows calls into the bootstrapper engine. + /// + [ComImport] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [Guid("6480D616-27A0-44D7-905B-81512C29C2FB")] + [GeneratedCodeAttribute("WixToolset.Bootstrapper.InteropCodeGenerator", "1.0.0.0")] + public interface IBootstrapperEngine + { + /// + /// See . + /// + void GetPackageCount( + [MarshalAs(UnmanagedType.U4)] out int pcPackages + ); + + /// + /// See . + /// + [PreserveSig] + int GetVariableNumeric( + [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, + out long pllValue + ); + + /// + /// See . + /// + [PreserveSig] + int GetVariableString( + [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, + IntPtr wzValue, + ref IntPtr pcchValue + ); + + /// + /// See . + /// + [PreserveSig] + int GetVariableVersion( + [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, + IntPtr wzValue, + ref IntPtr pcchValue + ); + + /// + /// See . + /// + [PreserveSig] + int FormatString( + [MarshalAs(UnmanagedType.LPWStr)] string wzIn, + [MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder wzOut, + ref IntPtr pcchOut + ); + + /// + /// See . + /// + [PreserveSig] + int EscapeString( + [MarshalAs(UnmanagedType.LPWStr)] string wzIn, + [MarshalAs(UnmanagedType.LPWStr), Out] StringBuilder wzOut, + ref IntPtr pcchOut + ); + + /// + /// See . + /// + void EvaluateCondition( + [MarshalAs(UnmanagedType.LPWStr)] string wzCondition, + [MarshalAs(UnmanagedType.Bool)] out bool pf + ); + + /// + /// See . + /// + void Log( + [MarshalAs(UnmanagedType.U4)] LogLevel level, + [MarshalAs(UnmanagedType.LPWStr)] string wzMessage + ); + + /// + /// See . + /// + void SendEmbeddedError( + [MarshalAs(UnmanagedType.U4)] int dwErrorCode, + [MarshalAs(UnmanagedType.LPWStr)] string wzMessage, + [MarshalAs(UnmanagedType.U4)] int dwUIHint, + [MarshalAs(UnmanagedType.I4)] out int pnResult + ); + + /// + /// See . + /// + void SendEmbeddedProgress( + [MarshalAs(UnmanagedType.U4)] int dwProgressPercentage, + [MarshalAs(UnmanagedType.U4)] int dwOverallProgressPercentage, + [MarshalAs(UnmanagedType.I4)] out int pnResult + ); + + /// + /// See . + /// + void SetUpdate( + [MarshalAs(UnmanagedType.LPWStr)] string wzLocalSource, + [MarshalAs(UnmanagedType.LPWStr)] string wzDownloadSource, + [MarshalAs(UnmanagedType.U8)] long qwValue, + [MarshalAs(UnmanagedType.U4)] UpdateHashType hashType, + [MarshalAs(UnmanagedType.LPWStr)] string wzHash, + [MarshalAs(UnmanagedType.LPWStr)] string wzUpdatePackageId + ); + + /// + /// See . + /// + void SetLocalSource( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPath + ); + + /// + /// See . + /// + void SetDownloadSource( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageOrContainerId, + [MarshalAs(UnmanagedType.LPWStr)] string wzPayloadId, + [MarshalAs(UnmanagedType.LPWStr)] string wzUrl, + [MarshalAs(UnmanagedType.LPWStr)] string wzUser, + [MarshalAs(UnmanagedType.LPWStr)] string wzPassword + ); + + /// + /// See . + /// + void SetVariableNumeric( + [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, + long llValue + ); + + /// + /// See . + /// + void SetVariableString( + [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, + IntPtr wzValue, + [MarshalAs(UnmanagedType.Bool)] bool fFormatted + ); + + /// + /// See . + /// + void SetVariableVersion( + [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, + IntPtr wzValue + ); + + /// + /// See . + /// + void CloseSplashScreen(); + + /// + /// See . + /// + void Detect( + IntPtr hwndParent + ); + + /// + /// See . + /// + void Plan( + [MarshalAs(UnmanagedType.U4)] LaunchAction action + ); + + /// + /// See . + /// + [PreserveSig] + int Elevate( + IntPtr hwndParent + ); + + /// + /// See . + /// + void Apply( + IntPtr hwndParent + ); + + /// + /// See . + /// + void Quit( + [MarshalAs(UnmanagedType.U4)] int dwExitCode + ); + + /// + /// See . + /// + void LaunchApprovedExe( + IntPtr hwndParent, + [MarshalAs(UnmanagedType.LPWStr)] string wzApprovedExeForElevationId, + [MarshalAs(UnmanagedType.LPWStr)] string wzArguments, + [MarshalAs(UnmanagedType.U4)] int dwWaitForInputIdleTimeout + ); + + /// + /// Sets the URL to the update feed. + /// + void SetUpdateSource( + [MarshalAs(UnmanagedType.LPWStr)] string url + ); + + /// + /// See . + /// + void CompareVersions( + [MarshalAs(UnmanagedType.LPWStr)] string wzVersion1, + [MarshalAs(UnmanagedType.LPWStr)] string wzVersion2, + [MarshalAs(UnmanagedType.I4)] out int pnResult + ); + + /// + /// See . + /// + [PreserveSig] + int GetRelatedBundleVariable( + [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, + [MarshalAs(UnmanagedType.LPWStr)] string wzVariable, + IntPtr wzValue, + ref IntPtr pcchValue + ); + } + + /// + /// The installation action for the bundle or current package. + /// + public enum ActionState + { + /// + /// No action. + /// + None, + + /// + /// Uninstall action. + /// + Uninstall, + + /// + /// Install action. + /// + Install, + + /// + /// Modify action. + /// + Modify, + + /// + /// Repair action. + /// + Repair, + + /// + /// Minor upgrade action. + /// + MinorUpgrade, + } + + /// + /// The action for the bundle to perform. + /// + public enum LaunchAction + { + /// + /// Invalid action. + /// + Unknown, + + /// + /// Provide help information. + /// + Help, + + /// + /// Layout the bundle on disk, normally to prepare for offline installation. + /// + Layout, + + /// + /// Same as Uninstall, except it will always remove itself from the package cache and Add/Remove Programs. + /// This should only be used to remove corrupt bundles since it might not properly clean up its packages. + /// + UnsafeUninstall, + + /// + /// Uninstall the bundle. + /// + Uninstall, + + /// + /// Cache the bundle and its packages. + /// + Cache, + + /// + /// Install the bundle. + /// + Install, + + /// + /// Modify the bundle. + /// + Modify, + + /// + /// Repair the bundle + /// + Repair, + + /// + /// Launch the update registered with and then exit without waiting for it to complete. + /// + UpdateReplace, + + /// + /// Launch the update registered with as an embedded bundle. + /// + UpdateReplaceEmbedded, + } + + /// + /// The message log level. + /// + public enum LogLevel + { + /// + /// No logging level (generic). + /// + None, + + /// + /// User messages. + /// + Standard, + + /// + /// Verbose messages. + /// + Verbose, + + /// + /// Messages for debugging. + /// + Debug, + + /// + /// Error messages. + /// + Error, + } + + /// + /// Type of hash used for update bundle. + /// + public enum UpdateHashType + { + /// + /// No hash provided. + /// + None, + + /// + /// SHA-512 based hash provided. + /// + Sha512, + } + + /// + /// Describes the state of an installation package. + /// + public enum PackageState + { + /// + /// Invalid state. + /// + Unknown, + + /// + /// The package is not on the machine (except possibly MspPackage) and should not be installed. + /// + Obsolete, + + /// + /// The package is not installed. + /// + Absent, + + /// + /// The package is installed. + /// + Present, + + /// + /// The package is on the machine but not active, so only uninstall operations are allowed. + /// + Superseded, + + /// + /// This value is no longer used. See the DetectPackageCompleteEventArgs.Cached value instead. + /// + [Obsolete("Use DetectPackageCompleteEventArgs.Cached instead.")] + Cached = Present, + } + + /// + /// Indicates the state desired for an installation package. + /// + public enum RequestState + { + /// + /// No change requested. + /// + None, + + /// + /// As long as there are no dependents, the package will be uninstalled. + /// There are some packages that can't be uninstalled, such as an ExePackage without an UninstallCommand. + /// + ForceAbsent, + + /// + /// Request the package to not be installed on the machine. + /// + Absent, + + /// + /// Request the package to be cached and not be installed on the machine. + /// + Cache, + + /// + /// Request the package to be installed on the machine. + /// + Present, + + /// + /// Force the bundle to install the package. + /// + ForcePresent, + + /// + /// Request the package to be repaired. + /// + Repair, + } + + /// + /// Indicates the state of a feature. + /// See https://learn.microsoft.com/en-us/windows/win32/api/msi/nf-msi-msiqueryfeaturestatew. + /// + public enum FeatureState + { + /// + /// Invalid state. + /// + Unknown, + + /// + /// INSTALLSTATE_ABSENT + /// + Absent, + + /// + /// INSTALLSTATE_ADVERTISED + /// + Advertised, + + /// + /// INSTALLSTATE_LOCAL + /// + Local, + + /// + /// INSTALLSTATE_SOURCE + /// + Source, + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IBundleInfo.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBundleInfo.cs new file mode 100644 index 00000000..a4d07597 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBundleInfo.cs @@ -0,0 +1,54 @@ +// 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.BootstrapperApplicationApi +{ + using System.Collections.Generic; + + /// + /// BA manifest data. + /// + public interface IBundleInfo + { + /// + /// The name of the variable that contains the path to the bundle's log. + /// + string LogVariable { get; } + + /// + /// Bundle/@Name + /// + string Name { get; } + + /// + /// Variables that were marked with bal:Overridable="yes". + /// + IOverridableVariables OverridableVariables { get; } + + /// + /// The packages in the bundle's chain. + /// + IDictionary Packages { get; } + + /// + /// Whether the bundle is per-machine or per-user. + /// + bool PerMachine { get; } + + /// + /// Adds a related bundle as a package. + /// + /// + /// + /// + /// + /// The created . + IPackageInfo AddRelatedBundleAsPackage(string productCode, RelationType relationType, bool perMachine, string version); + + /// + /// Adds an update bundle as a package. + /// + /// Package id added as update bundle. + /// The created . + IPackageInfo AddUpdateBundleAsPackage(string packageId); + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IDefaultBootstrapperApplication.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IDefaultBootstrapperApplication.cs new file mode 100644 index 00000000..ad51b2be --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IDefaultBootstrapperApplication.cs @@ -0,0 +1,436 @@ +// 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.BootstrapperApplicationApi +{ + using System; + + /// + /// Interface for built-in implementation of . + /// + public interface IDefaultBootstrapperApplication : IBootstrapperApplication + { + /// + /// Fired when the engine has begun installing the bundle. + /// + event EventHandler ApplyBegin; + + /// + /// Fired when the engine has completed installing the bundle. + /// + event EventHandler ApplyComplete; + + /// + /// Fired when the plan determined that nothing should happen to prevent downgrading. + /// + event EventHandler ApplyDowngrade; + + /// + /// Fired when the engine is about to begin an MSI transaction. + /// + event EventHandler BeginMsiTransactionBegin; + + /// + /// Fired when the engine has completed beginning an MSI transaction. + /// + event EventHandler BeginMsiTransactionComplete; + + /// + /// Fired when the engine has begun acquiring the payload or container. + /// The BA can change the source using + /// or . + /// + event EventHandler CacheAcquireBegin; + + /// + /// Fired when the engine has completed the acquisition of the payload or container. + /// The BA can change the source using + /// or . + /// + event EventHandler CacheAcquireComplete; + + /// + /// Fired when the engine has progress acquiring the payload or container. + /// + event EventHandler CacheAcquireProgress; + + /// + /// Fired by the engine to allow the BA to override the acquisition action. + /// + event EventHandler CacheAcquireResolving; + + /// + /// Fired when the engine has begun caching the installation sources. + /// + event EventHandler CacheBegin; + + /// + /// Fired after the engine has cached the installation sources. + /// + 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. + /// + event EventHandler CachePackageBegin; + + /// + /// Fired when the engine has completed caching a specific package. + /// + event EventHandler CachePackageComplete; + + /// + /// Fired when the engine failed validating a package in the package cache that is non-vital to execution. + /// + event EventHandler CachePackageNonVitalValidationFailure; + + /// + /// 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 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. + /// + event EventHandler CommitMsiTransactionBegin; + + /// + /// Fired when the engine has completed comitting an MSI transaction. + /// + event EventHandler CommitMsiTransactionComplete; + + /// + /// Fired when the application is being created. + /// + event EventHandler Create; + + /// + /// Fired when the application is being destroyed. + /// + event EventHandler Destroy; + + /// + /// Fired when the overall detection phase has begun. + /// + event EventHandler DetectBegin; + + /// + /// Fired when a package was not detected but a package using the same provider key was. + /// + event EventHandler DetectCompatibleMsiPackage; + + /// + /// Fired when the detection phase has completed. + /// + event EventHandler DetectComplete; + + /// + /// Fired when a forward compatible bundle is detected. + /// + event EventHandler DetectForwardCompatibleBundle; + + /// + /// Fired when a feature in an MSI package has been detected. + /// + event EventHandler DetectMsiFeature; + + /// + /// Fired when the detection for a specific package has begun. + /// + event EventHandler DetectPackageBegin; + + /// + /// Fired when the detection for a specific package has completed. + /// + event EventHandler DetectPackageComplete; + + /// + /// Fired when the engine detects a target product for an MSP package. + /// + event EventHandler DetectPatchTarget; + + /// + /// Fired when a related bundle has been detected for a bundle. + /// + event EventHandler DetectRelatedBundle; + + /// + /// Fired when a related bundle has been detected for a bundle package. + /// + event EventHandler DetectRelatedBundlePackage; + + /// + /// Fired when a related MSI package has been detected for a package. + /// + event EventHandler DetectRelatedMsiPackage; + + /// + /// Fired when the update detection has found a potential update candidate. + /// + event EventHandler DetectUpdate; + + /// + /// Fired when the update detection phase has begun. + /// + event EventHandler DetectUpdateBegin; + + /// + /// Fired when the update detection phase has completed. + /// + event EventHandler DetectUpdateComplete; + + /// + /// Fired when the engine is about to start the elevated process. + /// + event EventHandler ElevateBegin; + + /// + /// Fired when the engine has completed starting the elevated process. + /// + event EventHandler ElevateComplete; + + /// + /// Fired when the engine has encountered an error. + /// + event EventHandler Error; + + /// + /// Fired when the engine has begun installing packages. + /// + event EventHandler ExecuteBegin; + + /// + /// Fired when the engine has completed installing packages. + /// + event EventHandler ExecuteComplete; + + /// + /// Fired when a package sends a files in use installation message. + /// + event EventHandler ExecuteFilesInUse; + + /// + /// Fired when Windows Installer sends an installation message. + /// + event EventHandler ExecuteMsiMessage; + + /// + /// Fired when the engine has begun installing a specific package. + /// + event EventHandler ExecutePackageBegin; + + /// + /// Fired when the engine has completed installing a specific package. + /// + event EventHandler ExecutePackageComplete; + + /// + /// Fired when a package that spawned a process is cancelled. + /// + event EventHandler ExecuteProcessCancel; + + /// + /// Fired when the engine executes one or more patches targeting a product. + /// + event EventHandler ExecutePatchTarget; + + /// + /// Fired by the engine while executing a package. + /// + event EventHandler ExecuteProgress; + + /// + /// Fired when the engine is about to launch the preapproved executable. + /// + event EventHandler LaunchApprovedExeBegin; + + /// + /// Fired when the engine has completed launching the preapproved executable. + /// + event EventHandler LaunchApprovedExeComplete; + + /// + /// Fired when the engine is about to pause Windows automatic updates. + /// + event EventHandler PauseAutomaticUpdatesBegin; + + /// + /// Fired when the engine has completed pausing Windows automatic updates. + /// + event EventHandler PauseAutomaticUpdatesComplete; + + /// + /// Fired when the engine has begun planning the installation. + /// + event EventHandler PlanBegin; + + /// + /// Fired when the engine plans a new, compatible package using the same provider key. + /// + event EventHandler PlanCompatibleMsiPackageBegin; + + /// + /// Fired when the engine has completed planning the installation of a specific package. + /// + event EventHandler PlanCompatibleMsiPackageComplete; + + /// + /// Fired when the engine has completed planning the installation. + /// + event EventHandler PlanComplete; + + /// + /// Fired when the engine is about to plan a forward compatible bundle. + /// + event EventHandler PlanForwardCompatibleBundle; + + /// + /// Fired when the engine has completed planning a compatible package. + /// + event EventHandler PlannedCompatiblePackage; + + /// + /// Fired when the engine has completed planning a package. + /// + event EventHandler PlannedPackage; + + /// + /// Fired when the engine is about to plan a feature in an MSI package. + /// + event EventHandler PlanMsiFeature; + + /// + /// Fired when the engine is planning an MSI or MSP package. + /// + event EventHandler PlanMsiPackage; + + /// + /// Fired when the engine has begun getting the BA's input for planning a package. + /// + event EventHandler PlanPackageBegin; + + /// + /// Fired when the engine has completed getting the BA's input for planning a package. + /// + event EventHandler PlanPackageComplete; + + /// + /// Fired when the engine is about to plan a target of an MSP package. + /// + event EventHandler PlanPatchTarget; + + /// + /// Fired when the engine has begun planning for a related bundle. + /// + event EventHandler PlanRelatedBundle; + + /// + /// Fired when the engine has begun planning the related bundle relation type. + /// + event EventHandler PlanRelatedBundleType; + + /// + /// Fired when the engine has begun planning an upgrade related bundle for restoring in case of failure. + /// + event EventHandler PlanRestoreRelatedBundle; + + /// + /// Fired when the engine is planning a rollback boundary. + /// + event EventHandler PlanRollbackBoundary; + + /// + /// Fired when the engine has changed progress for the bundle installation. + /// + event EventHandler Progress; + + /// + /// Fired when the engine has begun registering the location and visibility of the bundle. + /// + event EventHandler RegisterBegin; + + /// + /// Fired when the engine has completed registering the location and visibility of the bundle. + /// + event EventHandler RegisterComplete; + + /// + /// Fired when the engine is about to rollback an MSI transaction. + /// + event EventHandler RollbackMsiTransactionBegin; + + /// + /// Fired when the engine has completed rolling back an MSI transaction. + /// + event EventHandler RollbackMsiTransactionComplete; + + /// + /// Fired when the engine is shutting down the bootstrapper application. + /// + event EventHandler Shutdown; + + /// + /// Fired when the engine is starting up the bootstrapper application. + /// + event EventHandler Startup; + + /// + /// Fired when the engine is about to take a system restore point. + /// + event EventHandler SystemRestorePointBegin; + + /// + /// Fired when the engine has completed taking a system restore point. + /// + event EventHandler SystemRestorePointComplete; + + /// + /// Fired when the engine unregisters the bundle. + /// + event EventHandler UnregisterBegin; + + /// + /// Fired when the engine unregistration is complete. + /// + event EventHandler UnregisterComplete; + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs new file mode 100644 index 00000000..8e6a293b --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs @@ -0,0 +1,230 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.ComponentModel; + using System.Security; + + /// + /// High level abstraction over the interface. + /// + public interface IEngine + { + /// + /// Gets the number of packages in the bundle. + /// + int PackageCount { get; } + + /// + /// Install the packages. + /// + /// The parent window for the installation user interface. + void Apply(IntPtr hwndParent); + + /// + /// Close the splash screen if it is still open. Does nothing if the splash screen is not or + /// never was opened. + /// + void CloseSplashScreen(); + + /// 0 if equal, 1 if version1 > version2, -1 if version1 < version2 + int CompareVersions(string version1, string version2); + + /// + /// Checks if a variable exists in the engine. + /// + /// The name of the variable. + /// Whether the variable exists. + bool ContainsVariable(string name); + + /// + /// Determine if all installation conditions are fulfilled. + /// + void Detect(); + + /// + /// Determine if all installation conditions are fulfilled. + /// + /// The parent window for the installation user interface. + void Detect(IntPtr hwndParent); + + /// + /// Elevate the install. + /// + /// The parent window of the elevation dialog. + /// true if elevation succeeded; otherwise, false if the user cancelled. + /// A Win32 error occurred. + bool Elevate(IntPtr hwndParent); + + /// + /// Escapes the input string. + /// + /// The string to escape. + /// The escaped string. + /// A Win32 error occurred. + string EscapeString(string input); + + /// + /// Evaluates the string. + /// + /// The string representing the condition to evaluate. + /// Whether the condition evaluated to true or false. + bool EvaluateCondition(string condition); + + /// + /// Formats the input string. + /// + /// The string to format. + /// The formatted string. + /// A Win32 error occurred. + string FormatString(string format); + + /// + /// Gets numeric variables for the engine. + /// + /// The name of the variable. + long GetVariableNumeric(string name); + + /// + /// Gets string variables for the engine using SecureStrings. + /// + /// The name of the variable. + SecureString GetVariableSecureString(string name); + + /// + /// Gets string variables for the engine. + /// + /// The name of the variable. + string GetVariableString(string name); + + /// + /// Gets variables for the engine. + /// + /// The name of the variable. + string GetVariableVersion(string name); + + /// + /// Gets persisted variables from a related bundle. + /// + /// The BundleId of the related bundle. + /// The name of the variable. + string GetRelatedBundleVariable(string bundleId, string name); + + /// + /// Launches a preapproved executable elevated. As long as the engine already elevated, there will be no UAC prompt. + /// + /// The parent window of the elevation dialog (if the engine hasn't elevated yet). + /// Id of the ApprovedExeForElevation element specified when the bundle was authored. + /// Optional arguments. + void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments); + + /// + /// Launches a preapproved executable elevated. As long as the engine already elevated, there will be no UAC prompt. + /// + /// The parent window of the elevation dialog (if the engine hasn't elevated yet). + /// Id of the ApprovedExeForElevation element specified when the bundle was authored. + /// Optional arguments. + /// Timeout in milliseconds. When set to something other than zero, the engine will call WaitForInputIdle for the new process with this timeout before calling OnLaunchApprovedExeComplete. + void LaunchApprovedExe(IntPtr hwndParent, string approvedExeForElevationId, string arguments, int waitForInputIdleTimeout); + + /// + /// Logs the . + /// + /// The logging level. + /// The message to log. + void Log(LogLevel level, string message); + + /// + /// Determine the installation sequencing and costing. + /// + /// The action to perform when planning. + void Plan(LaunchAction action); + + /// + /// Set the update information for a bundle. + /// + /// Optional local source path for the update. Default is "update\[OriginalNameOfBundle].exe". + /// Optional download source for the update. + /// Size of the expected update. + /// Type of the hash expected on the update. + /// Optional hash expected for the update. + /// Optional package id for the update. + void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, string hash, string updatePackageId); + + /// + /// Sets the URL to the update feed. + /// + /// URL of the update feed. + void SetUpdateSource(string url); + + /// + /// Set the local source for a package or container. + /// + /// The id that uniquely identifies the package or container. + /// The id that uniquely identifies the payload. + /// The new source path. + void SetLocalSource(string packageOrContainerId, string payloadId, string path); + + /// + /// Set the new download URL for a package or container. + /// + /// The id that uniquely identifies the package or container. + /// The id that uniquely identifies the payload. + /// The new url. + /// The user name for proxy authentication. + /// The password for proxy authentication. + void SetDownloadSource(string packageOrContainerId, string payloadId, string url, string user, string password); + + /// + /// Sets numeric variables for the engine. + /// + /// The name of the variable. + /// The value to set. + void SetVariableNumeric(string name, long value); + + /// + /// Sets string variables for the engine using SecureStrings. + /// + /// The name of the variable. + /// The value to set. + /// False if the value is a literal string. + void SetVariableString(string name, SecureString value, bool formatted); + + /// + /// Sets string variables for the engine. + /// + /// The name of the variable. + /// The value to set. + /// False if the value is a literal string. + void SetVariableString(string name, string value, bool formatted); + + /// + /// Sets version variables for the engine. + /// + /// The name of the variable. + /// The value to set. + void SetVariableVersion(string name, string value); + + /// + /// Sends error message when embedded. + /// + /// Error code. + /// Error message. + /// UI buttons to show on error dialog. + int SendEmbeddedError(int errorCode, string message, int uiHint); + + /// + /// Sends progress percentages when embedded. + /// + /// Percentage completed thus far. + /// Overall percentage completed. + int SendEmbeddedProgress(int progressPercentage, int overallPercentage); + + /// + /// Shuts down the engine. + /// + /// Exit code indicating reason for shut down. + void Quit(int exitCode); + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IMbaCommand.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IMbaCommand.cs new file mode 100644 index 00000000..37640a87 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IMbaCommand.cs @@ -0,0 +1,35 @@ +// 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.BootstrapperApplicationApi +{ + using System.Collections.Generic; + + /// + /// Command information parsed from the command line. + /// + public interface IMbaCommand + { + /// + /// Gets the action to perform if a reboot is required. + /// + Restart Restart { get; } + + /// + /// The command line arguments not parsed into or . + /// + string[] UnknownCommandLineArgs { get; } + + /// + /// The variables that were parsed from the command line. + /// Key = variable name, Value = variable value. + /// + KeyValuePair[] Variables { get; } + + /// + /// Sets overridable variables from the command line. + /// + /// The overridable variable information from . + /// The engine. + void SetOverridableVariables(IOverridableVariables overridableVariables, IEngine engine); + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IOverridableVariableInfo.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IOverridableVariableInfo.cs new file mode 100644 index 00000000..173963a8 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IOverridableVariableInfo.cs @@ -0,0 +1,15 @@ +// 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.BootstrapperApplicationApi +{ + /// + /// Overridable variable from the BA manifest. + /// + public interface IOverridableVariableInfo + { + /// + /// The Variable name. + /// + string Name { get; } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IOverridableVariables.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IOverridableVariables.cs new file mode 100644 index 00000000..2cf7b8d9 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IOverridableVariables.cs @@ -0,0 +1,37 @@ +// 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.BootstrapperApplicationApi +{ + using System.Collections.Generic; + + /// + /// The case sensitivity of variables from the command line. + /// + public enum VariableCommandLineType + { + /// + /// All variable names specified on the command line must match the case specified when building the bundle. + /// + CaseSensitive, + /// + /// Variable names specified on the command line do not have to match the case specified when building the bundle. + /// + CaseInsensitive, + } + + /// + /// Overridable variable information from the BA manifest. + /// + public interface IOverridableVariables + { + /// + /// The of the bundle. + /// + VariableCommandLineType CommandLineType { get; } + + /// + /// Variable Dictionary of variable name to . + /// + IDictionary Variables { get; } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IPackageInfo.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IPackageInfo.cs new file mode 100644 index 00000000..e2512584 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IPackageInfo.cs @@ -0,0 +1,100 @@ +// 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.BootstrapperApplicationApi +{ + /// + /// Package information from the BA manifest. + /// + public interface IPackageInfo + { + /// + /// The authored cache strategy for this package. + /// + BOOTSTRAPPER_CACHE_TYPE CacheType { get; } + + /// + /// Place for the BA to store it's own custom data for this package. + /// + object CustomData { get; set; } + + /// + /// The package's description. + /// + string Description { get; } + + /// + /// The authored bal:DisplayInternalUICondition. + /// + string DisplayInternalUICondition { get; } + + /// + /// The package's display name. + /// + string DisplayName { get; } + + /// + /// The package's Id. + /// + string Id { get; } + + /// + /// The authored InstallCondition. + /// + string InstallCondition { get; } + + /// + /// The authored RepairCondition. + /// + string RepairCondition { get; } + + /// + /// Whether the bundle should ever recommend the package to be uninstalled. + /// + bool Permanent { get; } + + /// + /// Whether the package should be installed by the prereq BA for managed bootstrapper applications. + /// + bool PrereqPackage { get; } + + /// + /// The file name of the license file to be shown by the prereq BA. + /// + string PrereqLicenseFile { get; } + + /// + /// The URL of the license to be shown by the prereq BA. + /// + string PrereqLicenseUrl { get; } + + /// + /// See + /// + PrimaryPackageType PrimaryPackageType { get; } + + /// + /// The package's ProductCode. + /// + string ProductCode { get; } + + /// + /// The type of the package. + /// + PackageType Type { get; } + + /// + /// The package's UpgradeCode. + /// + string UpgradeCode { get; } + + /// + /// The package's version. + /// + string Version { get; } + + /// + /// Whether the package's failure can be ignored while executing the chain. + /// + bool Vital { get; } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/ManagedBootstrapperApplication.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/ManagedBootstrapperApplication.cs new file mode 100644 index 00000000..77c5eaca --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/ManagedBootstrapperApplication.cs @@ -0,0 +1,19 @@ +// 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.BootstrapperApplicationApi +{ + /// + /// Managed bootstrapper application entry point. + /// + public static class ManagedBootstrapperApplication + { + /// + /// Run the managed bootstrapper application. + /// + /// Bootstrapper applciation to run. + public static void Run(IBootstrapperApplication application) + { + MbaNative.BootstrapperApplicationRun(application); + } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/MbaCommand.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/MbaCommand.cs new file mode 100644 index 00000000..c46b5844 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/MbaCommand.cs @@ -0,0 +1,38 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Collections.Generic; + + /// + /// Default implementation of . + /// + internal sealed class MbaCommand : IMbaCommand + { + public Restart Restart { get; internal set; } + + public string[] UnknownCommandLineArgs { get; internal set; } + + public KeyValuePair[] Variables { get; internal set; } + + internal MbaCommand() { } + + public void SetOverridableVariables(IOverridableVariables overridableVariables, IEngine engine) + { + foreach (var kvp in this.Variables) + { + var key = kvp.Key; + + if (!overridableVariables.Variables.TryGetValue(key, out var overridableVariable)) + { + engine.Log(LogLevel.Error, String.Format("Ignoring attempt to set non-overridable variable: '{0}'.", key)); + } + else + { + engine.SetVariableString(overridableVariable.Name, kvp.Value, false); + } + } + } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/MbaNative.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/MbaNative.cs new file mode 100644 index 00000000..6e135fc3 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/MbaNative.cs @@ -0,0 +1,18 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Runtime.InteropServices; + + internal static class MbaNative + { + [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] + internal static extern void BalDebuggerCheck(); + + [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] + internal static extern void BootstrapperApplicationRun( + [MarshalAs(UnmanagedType.Interface)] IBootstrapperApplication pBA + ); + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/NativeMethods.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/NativeMethods.cs new file mode 100644 index 00000000..4ef9f35e --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/NativeMethods.cs @@ -0,0 +1,49 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Runtime.InteropServices; + + /// + /// Contains native constants, functions, and structures for this assembly. + /// + internal static class NativeMethods + { + #region Error Constants + internal const int S_OK = 0; + internal const int E_MOREDATA = unchecked((int)0x800700ea); + internal const int E_INSUFFICIENT_BUFFER = unchecked((int)0x8007007a); + internal const int E_CANCELLED = unchecked((int)0x800704c7); + internal const int E_ALREADYINITIALIZED = unchecked((int)0x800704df); + internal const int E_NOTFOUND = unchecked((int)0x80070490); + internal const int E_NOTIMPL = unchecked((int)0x80004001); + internal const int E_UNEXPECTED = unchecked((int)0x8000ffff); + #endregion + + #region Functions + [DllImport("shell32.dll", ExactSpelling = true, SetLastError = true)] + internal static extern IntPtr CommandLineToArgvW( + [MarshalAs(UnmanagedType.LPWStr)] string lpCmdLine, + out int pNumArgs + ); + + [DllImport("kernel32.dll", ExactSpelling = true, SetLastError = true)] + internal static extern IntPtr LocalFree( + IntPtr hMem + ); + #endregion + } + + #region SafeHandles + internal abstract class SafeHandleZeroIsDefaultAndInvalid : SafeHandle + { + public SafeHandleZeroIsDefaultAndInvalid() : base(IntPtr.Zero, true) { } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + } + #endregion +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/OverridableVariableInfo.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/OverridableVariableInfo.cs new file mode 100644 index 00000000..8b90c588 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/OverridableVariableInfo.cs @@ -0,0 +1,15 @@ +// 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.BootstrapperApplicationApi +{ + /// + /// Default implementation of . + /// + internal class OverridableVariableInfo : IOverridableVariableInfo + { + /// + public string Name { get; internal set; } + + internal OverridableVariableInfo() { } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/OverridableVariables.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/OverridableVariables.cs new file mode 100644 index 00000000..98f8ec81 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/OverridableVariables.cs @@ -0,0 +1,87 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Collections.Generic; + using System.Xml; + using System.Xml.XPath; + + /// + /// Default implementation of . + /// + public class OverridableVariablesInfo : IOverridableVariables + { + /// + public VariableCommandLineType CommandLineType { get; internal set; } + + /// + public IDictionary Variables { get; internal set; } + + internal OverridableVariablesInfo() { } + + /// + /// Parses the overridable variable info from the BA manifest. + /// + /// XML root + /// The parsed information. + public static IOverridableVariables ParseFromXml(XPathNavigator root) + { + XmlNamespaceManager namespaceManager = new XmlNamespaceManager(root.NameTable); + namespaceManager.AddNamespace("p", BootstrapperApplicationData.XMLNamespace); + XPathNavigator commandLineNode = root.SelectSingleNode("/p:BootstrapperApplicationData/p:WixStdbaCommandLine", namespaceManager); + XPathNodeIterator nodes = root.Select("/p:BootstrapperApplicationData/p:WixStdbaOverridableVariable", namespaceManager); + + var overridableVariables = new OverridableVariablesInfo(); + IEqualityComparer variableNameComparer; + + if (commandLineNode == null) + { + overridableVariables.CommandLineType = VariableCommandLineType.CaseSensitive; + variableNameComparer = StringComparer.InvariantCulture; + } + else + { + string variablesValue = BootstrapperApplicationData.GetAttribute(commandLineNode, "Variables"); + + if (variablesValue == null) + { + throw new Exception("Failed to get command line variable type."); + } + + if (variablesValue.Equals("caseInsensitive", StringComparison.InvariantCulture)) + { + overridableVariables.CommandLineType = VariableCommandLineType.CaseInsensitive; + variableNameComparer = StringComparer.InvariantCultureIgnoreCase; + } + else if (variablesValue.Equals("caseSensitive", StringComparison.InvariantCulture)) + { + overridableVariables.CommandLineType = VariableCommandLineType.CaseSensitive; + variableNameComparer = StringComparer.InvariantCulture; + } + else + { + throw new Exception(String.Format("Unknown command line variable type: '{0}'", variablesValue)); + } + } + + overridableVariables.Variables = new Dictionary(variableNameComparer); + + foreach (XPathNavigator node in nodes) + { + var variable = new OverridableVariableInfo(); + + string name = BootstrapperApplicationData.GetAttribute(node, "Name"); + if (name == null) + { + throw new Exception("Failed to get name for overridable variable."); + } + variable.Name = name; + + overridableVariables.Variables.Add(variable.Name, variable); + } + + return overridableVariables; + } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/PackageInfo.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/PackageInfo.cs new file mode 100644 index 00000000..e835f9ea --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/PackageInfo.cs @@ -0,0 +1,391 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Collections.Generic; + using System.Xml; + using System.Xml.XPath; + + /// + /// The type of package. + /// + public enum PackageType + { + /// + /// Invalid type. + /// + Unknown, + + /// + /// ExePackage + /// + Exe, + + /// + /// MsiPackage + /// + Msi, + + /// + /// MspPackage + /// + Msp, + + /// + /// MsuPackage + /// + Msu, + + /// + /// Related bundle of type Upgrade + /// + UpgradeBundle, + + /// + /// Related bundle of type Addon + /// + AddonBundle, + + /// + /// Related bundle of type Patch + /// + PatchBundle, + + /// + /// Related bundle of type Update + /// + UpdateBundle, + + /// + /// BundlePackage + /// + ChainBundle, + } + + /// + /// Metadata for BAs like WixInternalUIBootstrapperApplication that only support one main package. + /// + public enum PrimaryPackageType + { + /// + /// Not a primary package. + /// + None, + + /// + /// The default package if no architecture specific package is available for the current architecture. + /// + Default, + + /// + /// The package to use on x86 machines. + /// + X86, + + /// + /// The package to use on x64 machines. + /// + X64, + + /// + /// The package to use on ARM64 machines. + /// + ARM64, + } + + /// + /// Default implementation of . + /// + public class PackageInfo : IPackageInfo + { + /// + public string Id { get; internal set; } + + /// + public string DisplayName { get; internal set; } + + /// + public string Description { get; internal set; } + + /// + public PackageType Type { get; internal set; } + + /// + public bool Permanent { get; internal set; } + + /// + public bool Vital { get; internal set; } + + /// + public string DisplayInternalUICondition { get; internal set; } + + /// + public string ProductCode { get; internal set; } + + /// + public string UpgradeCode { get; internal set; } + + /// + public string Version { get; internal set; } + + /// + public string InstallCondition { get; internal set; } + + /// + public string RepairCondition { get; internal set; } + + /// + public BOOTSTRAPPER_CACHE_TYPE CacheType { get; internal set; } + + /// + public bool PrereqPackage { get; internal set; } + + /// + public string PrereqLicenseFile { get; internal set; } + + /// + public string PrereqLicenseUrl { get; internal set; } + + /// + public PrimaryPackageType PrimaryPackageType { get; internal set; } + + /// + public object CustomData { get; set; } + + internal PackageInfo() { } + + /// + /// Parse packages from BootstrapperApplicationData.xml. + /// + /// The root node. + /// A dictionary of the packages by Id. + public static IDictionary ParsePackagesFromXml(XPathNavigator root) + { + var packagesById = new Dictionary(); + XmlNamespaceManager namespaceManager = new XmlNamespaceManager(root.NameTable); + namespaceManager.AddNamespace("p", BootstrapperApplicationData.XMLNamespace); + XPathNodeIterator nodes = root.Select("/p:BootstrapperApplicationData/p:WixPackageProperties", namespaceManager); + + foreach (XPathNavigator node in nodes) + { + var package = new PackageInfo(); + + string id = BootstrapperApplicationData.GetAttribute(node, "Package"); + if (id == null) + { + throw new Exception("Failed to get package identifier for package."); + } + package.Id = id; + + package.DisplayName = BootstrapperApplicationData.GetAttribute(node, "DisplayName"); + + package.Description = BootstrapperApplicationData.GetAttribute(node, "Description"); + + PackageType? packageType = GetPackageTypeAttribute(node, "PackageType"); + if (!packageType.HasValue) + { + throw new Exception("Failed to get package type for package."); + } + package.Type = packageType.Value; + + bool? permanent = BootstrapperApplicationData.GetYesNoAttribute(node, "Permanent"); + if (!permanent.HasValue) + { + throw new Exception("Failed to get permanent settings for package."); + } + package.Permanent = permanent.Value; + + bool? vital = BootstrapperApplicationData.GetYesNoAttribute(node, "Vital"); + if (!vital.HasValue) + { + throw new Exception("Failed to get vital setting for package."); + } + package.Vital = vital.Value; + + package.ProductCode = BootstrapperApplicationData.GetAttribute(node, "ProductCode"); + + package.UpgradeCode = BootstrapperApplicationData.GetAttribute(node, "UpgradeCode"); + + package.Version = BootstrapperApplicationData.GetAttribute(node, "Version"); + + package.InstallCondition = BootstrapperApplicationData.GetAttribute(node, "InstallCondition"); + + package.RepairCondition = BootstrapperApplicationData.GetAttribute(node, "RepairCondition"); + + BOOTSTRAPPER_CACHE_TYPE? cacheType = GetCacheTypeAttribute(node, "Cache"); + if (!cacheType.HasValue) + { + throw new Exception("Failed to get cache type for package."); + } + package.CacheType = cacheType.Value; + + packagesById.Add(package.Id, package); + } + + ParseBalPackageInfoFromXml(root, namespaceManager, packagesById); + return packagesById; + } + + /// + /// Parse the cache type attribute. + /// + /// Package node + /// Attribute name + /// The cache type + public static BOOTSTRAPPER_CACHE_TYPE? GetCacheTypeAttribute(XPathNavigator node, string attributeName) + { + string attributeValue = BootstrapperApplicationData.GetAttribute(node, attributeName); + + if (attributeValue == null) + { + return null; + } + + if (attributeValue.Equals("keep", StringComparison.InvariantCulture)) + { + return BOOTSTRAPPER_CACHE_TYPE.Keep; + } + else if (attributeValue.Equals("force", StringComparison.InvariantCulture)) + { + return BOOTSTRAPPER_CACHE_TYPE.Force; + } + else + { + return BOOTSTRAPPER_CACHE_TYPE.Remove; + } + } + + /// + /// Parse the package type attribute + /// + /// Package node + /// Attribute name + /// The package type + public static PackageType? GetPackageTypeAttribute(XPathNavigator node, string attributeName) + { + string attributeValue = BootstrapperApplicationData.GetAttribute(node, attributeName); + + if (attributeValue == null) + { + return null; + } + + if (attributeValue.Equals("Bundle", StringComparison.InvariantCulture)) + { + return PackageType.ChainBundle; + } + else if (attributeValue.Equals("Exe", StringComparison.InvariantCulture)) + { + return PackageType.Exe; + } + else if (attributeValue.Equals("Msi", StringComparison.InvariantCulture)) + { + return PackageType.Msi; + } + else if (attributeValue.Equals("Msp", StringComparison.InvariantCulture)) + { + return PackageType.Msp; + } + else if (attributeValue.Equals("Msu", StringComparison.InvariantCulture)) + { + return PackageType.Msu; + } + else + { + return PackageType.Unknown; + } + } + + /// + /// Create from a related bundle. + /// + /// Package id + /// Relation type + /// Whether the related bundle is per-machine + /// The related bundle's version + /// The package info + public static IPackageInfo GetRelatedBundleAsPackage(string id, RelationType relationType, bool perMachine, string version) + { + PackageInfo package = new PackageInfo(); + package.Id = id; + package.Version = version; + + switch (relationType) + { + case RelationType.Addon: + package.Type = PackageType.AddonBundle; + break; + case RelationType.Patch: + package.Type = PackageType.PatchBundle; + break; + case RelationType.Upgrade: + package.Type = PackageType.UpgradeBundle; + break; + default: + throw new Exception(String.Format("Unknown related bundle type: {0}", relationType)); + } + + return package; + } + + /// + /// Create from an update bundle. + /// + /// Package id + /// The package info + public static IPackageInfo GetUpdateBundleAsPackage(string id) + { + PackageInfo package = new PackageInfo(); + package.Id = id; + package.Type = PackageType.UpdateBundle; + + return package; + } + + internal static void ParseBalPackageInfoFromXml(XPathNavigator root, XmlNamespaceManager namespaceManager, Dictionary packagesById) + { + XPathNodeIterator nodes = root.Select("/p:BootstrapperApplicationData/p:WixBalPackageInfo", namespaceManager); + + foreach (XPathNavigator node in nodes) + { + string id = BootstrapperApplicationData.GetAttribute(node, "PackageId"); + if (id == null) + { + throw new Exception("Failed to get package identifier for WixBalPackageInfo."); + } + + if (!packagesById.TryGetValue(id, out var ipackage)) + { + throw new Exception(String.Format("Failed to find package specified in WixBalPackageInfo: {0}", id)); + } + + var package = (PackageInfo)ipackage; + + package.DisplayInternalUICondition = BootstrapperApplicationData.GetAttribute(node, "DisplayInternalUICondition"); + } + + nodes = root.Select("/p:BootstrapperApplicationData/p:WixPrereqInformation", namespaceManager); + + foreach (XPathNavigator node in nodes) + { + string id = BootstrapperApplicationData.GetAttribute(node, "PackageId"); + if (id == null) + { + throw new Exception("Failed to get package identifier for WixPrereqInformation."); + } + + if (!packagesById.TryGetValue(id, out var ipackage)) + { + throw new Exception(String.Format("Failed to find package specified in WixPrereqInformation: {0}", id)); + } + + var package = (PackageInfo)ipackage; + + package.PrereqPackage = true; + package.PrereqLicenseFile = BootstrapperApplicationData.GetAttribute(node, "LicenseFile"); + package.PrereqLicenseUrl = BootstrapperApplicationData.GetAttribute(node, "LicenseUrl"); + } + } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/StrUtil.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/StrUtil.cs new file mode 100644 index 00000000..aeeaac47 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/StrUtil.cs @@ -0,0 +1,54 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Runtime.InteropServices; + using System.Security; + using System.Text; + + internal static class StrUtil + { + [DllImport("mbanative.dll", ExactSpelling = true)] + internal static extern void StrFree( + IntPtr scz + ); + + internal sealed class StrHandle : SafeHandleZeroIsDefaultAndInvalid + { + protected override bool ReleaseHandle() + { + StrFree(this.handle); + return true; + } + + public string ToUniString() + { + return Marshal.PtrToStringUni(this.handle); + } + + public SecureString ToSecureString() + { + if (this.handle == IntPtr.Zero) + { + return null; + } + + SecureString value = new SecureString(); + char c; + for (int charIndex = 0; ; charIndex++) + { + c = (char)Marshal.ReadInt16(this.handle, charIndex * UnicodeEncoding.CharSize); + if (c == '\0') + { + break; + } + + value.AppendChar(c); + } + + return value; + } + } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/VerUtil.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/VerUtil.cs new file mode 100644 index 00000000..082ee06c --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/VerUtil.cs @@ -0,0 +1,146 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Runtime.InteropServices; + using System.Text; + + /// + /// Managed wrapper for verutil. + /// + public static class VerUtil + { + [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] + internal static extern int VerCompareParsedVersions( + VersionHandle pVersion1, + VersionHandle pVersion2 + ); + + [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] + internal static extern int VerCompareStringVersions( + [MarshalAs(UnmanagedType.LPWStr)] string wzVersion1, + [MarshalAs(UnmanagedType.LPWStr)] string wzVersion2, + [MarshalAs(UnmanagedType.Bool)] bool fStrict + ); + + [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] + internal static extern VersionHandle VerCopyVersion( + VersionHandle pSource + ); + + [DllImport("mbanative.dll", ExactSpelling = true)] + internal static extern void VerFreeVersion( + IntPtr pVersion + ); + + [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] + internal static extern VersionHandle VerParseVersion( + [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, + [MarshalAs(UnmanagedType.U4)] uint cchValue, + [MarshalAs(UnmanagedType.Bool)] bool fStrict + ); + + [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] + internal static extern VersionHandle VerVersionFromQword( + [MarshalAs(UnmanagedType.I8)] long qwVersion + ); + + [StructLayout(LayoutKind.Sequential)] + internal struct VersionReleaseLabelStruct + { + public bool fNumeric; + public uint dwValue; + public IntPtr cchLabelOffset; + public int cchLabel; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct VersionStruct + { + public IntPtr sczVersion; + public char chPrefix; + public uint dwMajor; + public uint dwMinor; + public uint dwPatch; + public uint dwRevision; + public int cReleaseLabels; + public IntPtr rgReleaseLabels; + public IntPtr cchMetadataOffset; + public bool fInvalid; + public bool fHasMajor; + public bool fHasMinor; + public bool fHasPatch; + public bool fHasRevision; + } + + internal static string VersionStringFromOffset(IntPtr wzVersion, IntPtr cchOffset, int? cchLength = null) + { + var offset = cchOffset.ToInt64() * UnicodeEncoding.CharSize; + var wz = new IntPtr(wzVersion.ToInt64() + offset); + if (cchLength.HasValue) + { + return Marshal.PtrToStringUni(wz, (int)cchLength); + } + else + { + return Marshal.PtrToStringUni(wz); + } + } + + internal sealed class VersionHandle : SafeHandleZeroIsDefaultAndInvalid + { + protected override bool ReleaseHandle() + { + VerFreeVersion(this.handle); + return true; + } + } + + /// 0 if equal, 1 if version1 > version2, -1 if version1 < version2 + public static int CompareParsedVersions(VerUtilVersion version1, VerUtilVersion version2) + { + return VerCompareParsedVersions(version1.GetHandle(), version2.GetHandle()); + } + + /// 0 if equal, 1 if version1 > version2, -1 if version1 < version2 + public static int CompareStringVersions(string version1, string version2, bool strict) + { + return VerCompareStringVersions(version1, version2, strict); + } + + /// + /// Clone the version. + /// + /// Source version + /// Cloned version + public static VerUtilVersion CopyVersion(VerUtilVersion version) + { + var handle = VerCopyVersion(version.GetHandle()); + return new VerUtilVersion(handle); + } + + /// + /// Parse a version. + /// + /// Source version + /// Whether to throw exception on invalid version. + /// Parsed version + public static VerUtilVersion ParseVersion(string version, bool strict) + { + var handle = VerParseVersion(version, 0, strict); + return new VerUtilVersion(handle); + } + + /// + /// Parse version from qword. + /// + /// Source version + /// Parsed version + public static VerUtilVersion VersionFromQword(long version) + { + var handle = VerVersionFromQword(version); + return new VerUtilVersion(handle); + } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/VerUtilVersion.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/VerUtilVersion.cs new file mode 100644 index 00000000..65b195a4 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/VerUtilVersion.cs @@ -0,0 +1,129 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Runtime.InteropServices; + + /// + /// An enhanced implementation of SemVer 2.0. + /// + public sealed class VerUtilVersion : IDisposable + { + internal VerUtilVersion(VerUtil.VersionHandle handle) + { + this.Handle = handle; + + var pVersion = handle.DangerousGetHandle(); + var version = (VerUtil.VersionStruct)Marshal.PtrToStructure(pVersion, typeof(VerUtil.VersionStruct)); + this.Version = Marshal.PtrToStringUni(version.sczVersion); + this.Prefix = version.chPrefix; + this.Major = version.dwMajor; + this.Minor = version.dwMinor; + this.Patch = version.dwPatch; + this.Revision = version.dwRevision; + this.ReleaseLabels = new VerUtilVersionReleaseLabel[version.cReleaseLabels]; + this.Metadata = VerUtil.VersionStringFromOffset(version.sczVersion, version.cchMetadataOffset); + this.IsInvalid = version.fInvalid; + this.HasMajor = version.fHasMajor; + this.HasMinor = version.fHasMinor; + this.HasPatch = version.fHasPatch; + this.HasRevision = version.fHasRevision; + + for (var i = 0; i < version.cReleaseLabels; ++i) + { + var offset = i * Marshal.SizeOf(typeof(VerUtil.VersionReleaseLabelStruct)); + var pReleaseLabel = new IntPtr(version.rgReleaseLabels.ToInt64() + offset); + this.ReleaseLabels[i] = new VerUtilVersionReleaseLabel(pReleaseLabel, version.sczVersion); + } + } + + /// + /// String version, which would have stripped the leading 'v'. + /// + public string Version { get; private set; } + + /// + /// Prefix character that was stripped from Version, or the null character if there was no prefix. + /// + public char Prefix { get; private set; } + + /// + /// For version A.B.C.D, Major is A. It is 0 if not specified. + /// + public uint Major { get; private set; } + + /// + /// For version A.B.C.D, Minor is B. It is 0 if not specified. + /// + public uint Minor { get; private set; } + + /// + /// For version A.B.C.D, Patch is C. It is 0 if not specified. + /// + public uint Patch { get; private set; } + + /// + /// For version A.B.C.D, Revision is D. It is 0 if not specified. + /// + public uint Revision { get; private set; } + + /// + /// For version X.Y.Z-releaselabels+metadata, ReleaseLabels is the parsed information for releaselabels. + /// + public VerUtilVersionReleaseLabel[] ReleaseLabels { get; private set; } + + /// + /// For version X.Y.Z-releaselabels+metadata, Metadata is the rest of the string after +. + /// For invalid versions, it is all of the string after the point where it was an invalid string. + /// + public string Metadata { get; private set; } + + /// + /// Whether the version conformed to the spec. + /// + public bool IsInvalid { get; private set; } + + /// + /// Whether the Major part was specified. + /// + public bool HasMajor { get; private set; } + + /// + /// Whether the Minor part was specified. + /// + public bool HasMinor { get; private set; } + + /// + /// Whether the Patch part was specified. + /// + public bool HasPatch { get; private set; } + + /// + /// Whether the Revision part was specified. + /// + public bool HasRevision { get; private set; } + + /// + public void Dispose() + { + if (this.Handle != null) + { + this.Handle.Dispose(); + this.Handle = null; + } + } + + private VerUtil.VersionHandle Handle { get; set; } + + internal VerUtil.VersionHandle GetHandle() + { + if (this.Handle == null) + { + throw new ObjectDisposedException(this.Version); + } + + return this.Handle; + } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/VerUtilVersionReleaseLabel.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/VerUtilVersionReleaseLabel.cs new file mode 100644 index 00000000..03603714 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/VerUtilVersionReleaseLabel.cs @@ -0,0 +1,36 @@ +// 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.BootstrapperApplicationApi +{ + using System; + using System.Runtime.InteropServices; + + /// + /// A release label from a . + /// + public sealed class VerUtilVersionReleaseLabel + { + internal VerUtilVersionReleaseLabel(IntPtr pReleaseLabel, IntPtr wzVersion) + { + var releaseLabel = (VerUtil.VersionReleaseLabelStruct)Marshal.PtrToStructure(pReleaseLabel, typeof(VerUtil.VersionReleaseLabelStruct)); + this.IsNumeric = releaseLabel.fNumeric; + this.Value = releaseLabel.dwValue; + this.Label = VerUtil.VersionStringFromOffset(wzVersion, releaseLabel.cchLabelOffset, releaseLabel.cchLabel); + } + + /// + /// Whether the label was parsed as a number. + /// + public bool IsNumeric { get; private set; } + + /// + /// If then the value that was parsed. + /// + public uint Value { get; private set; } + + /// + /// The string version of the label. + /// + public string Label { get; private set; } + } +} diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/WixToolset.BootstrapperApplicationApi.csproj b/src/api/burn/WixToolset.BootstrapperApplicationApi/WixToolset.BootstrapperApplicationApi.csproj new file mode 100644 index 00000000..2fe6d5bb --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/WixToolset.BootstrapperApplicationApi.csproj @@ -0,0 +1,27 @@ + + + + + + netstandard2.0;net462 + WixToolset.BootstrapperApplicationApi + WixToolset.BootstrapperApplicationApi + embedded + Managed Bootstrapper Application API + $(MSBuildThisFileName).nuspec + true + + + + + + + + + + + + + + + diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/WixToolset.BootstrapperApplicationApi.nuspec b/src/api/burn/WixToolset.BootstrapperApplicationApi/WixToolset.BootstrapperApplicationApi.nuspec new file mode 100644 index 00000000..22099635 --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/WixToolset.BootstrapperApplicationApi.nuspec @@ -0,0 +1,46 @@ + + + + $id$ + $version$ + $title$ + $description$ + $authors$ + wix.png + MS-RL + false + $copyright$ + $projectUrl$ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/build/WixToolset.BootstrapperApplicationApi.props b/src/api/burn/WixToolset.BootstrapperApplicationApi/build/WixToolset.BootstrapperApplicationApi.props new file mode 100644 index 00000000..b276574d --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/build/WixToolset.BootstrapperApplicationApi.props @@ -0,0 +1,18 @@ + + + + + + + $(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories) + + + $(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories) + + + + + $(MSBuildThisFileDirectory)native\v14\$(PlatformTarget)\balutil.lib;%(AdditionalDependencies) + + + diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/build/_._ b/src/api/burn/WixToolset.BootstrapperApplicationApi/build/_._ new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3-55-g6feb