diff options
author | Rob Mensching <rob@firegiant.com> | 2024-01-11 18:26:20 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2024-03-06 18:03:38 -0800 |
commit | 0d3d54992104288e9ee0c834d0b96e8502fd2d42 (patch) | |
tree | 9efa49c4983cd2ba1becab64bd1f2faccac88acf /src/api/burn/WixToolset.Mba.Core | |
parent | 2824298d9dd817a47527c920363556b54ead5d5d (diff) | |
download | wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.gz wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.bz2 wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.zip |
Move the BootstrapperApplication out of proc
Diffstat (limited to 'src/api/burn/WixToolset.Mba.Core')
16 files changed, 269 insertions, 263 deletions
diff --git a/src/api/burn/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs b/src/api/burn/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs index 339bfd8f..25995e27 100644 --- a/src/api/burn/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs +++ b/src/api/burn/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs | |||
@@ -6,58 +6,48 @@ namespace WixToolset.Mba.Core | |||
6 | using System.Runtime.InteropServices; | 6 | using System.Runtime.InteropServices; |
7 | 7 | ||
8 | /// <summary> | 8 | /// <summary> |
9 | /// Default implementation of <see cref="IBootstrapperApplicationFactory"/>. | 9 | /// This is no longer used. |
10 | /// </summary> | 10 | /// </summary> |
11 | [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.")] | ||
11 | public abstract class BaseBootstrapperApplicationFactory : IBootstrapperApplicationFactory | 12 | public abstract class BaseBootstrapperApplicationFactory : IBootstrapperApplicationFactory |
12 | { | 13 | { |
13 | /// <summary> | 14 | /// <summary> |
14 | /// Default implementation of <see cref="IBootstrapperApplicationFactory.Create(IntPtr, IntPtr)"/> | 15 | /// This is no longer used. |
15 | /// </summary> | 16 | /// </summary> |
16 | /// <param name="pArgs">The args struct given by the engine when initially creating the BA.</param> | 17 | /// <param name="pArgs">This is no longer used.</param> |
17 | /// <param name="pResults">The results struct given by the engine when initially creating the BA</param> | 18 | /// <param name="pResults">This is no longer used.</param> |
18 | public void Create(IntPtr pArgs, IntPtr pResults) | 19 | public void Create(IntPtr pArgs, IntPtr pResults) |
19 | { | 20 | { |
20 | InitializeFromCreateArgs(pArgs, out var engine, out var bootstrapperCommand); | 21 | throw new NotImplementedException(); |
21 | |||
22 | var ba = this.Create(engine, bootstrapperCommand); | ||
23 | StoreBAInCreateResults(pResults, ba); | ||
24 | } | 22 | } |
25 | 23 | ||
26 | /// <summary> | 24 | /// <summary> |
27 | /// Called by <see cref="BaseBootstrapperApplicationFactory.Create(IntPtr, IntPtr)"/> to get the <see cref="IBootstrapperApplication"/>. | 25 | /// This is no longer used. |
28 | /// </summary> | 26 | /// </summary> |
29 | /// <param name="engine">The bundle engine.</param> | 27 | /// <param name="engine">This is no longer used.</param> |
30 | /// <param name="bootstrapperCommand">Command information passed from the engine for the BA to perform.</param> | 28 | /// <param name="bootstrapperCommand">This is no longer used.</param> |
31 | /// <returns>The <see cref="IBootstrapperApplication"/> for the bundle.</returns> | 29 | /// <returns>This is no longer used.</returns> |
32 | protected abstract IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand); | 30 | protected abstract IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand); |
33 | 31 | ||
34 | /// <summary> | 32 | /// <summary> |
35 | /// Initializes the native part of <see cref="WixToolset.Mba.Core"/>. | 33 | /// This is no longer used. |
36 | /// Most users should inherit from <see cref="BaseBootstrapperApplicationFactory"/> instead of calling this method. | ||
37 | /// </summary> | 34 | /// </summary> |
38 | /// <param name="pArgs">The args struct given by the engine when initially creating the BA.</param> | 35 | /// <param name="pArgs">This is no longer used.</param> |
39 | /// <param name="engine">The bundle engine interface.</param> | 36 | /// <param name="engine">This is no longer used.</param> |
40 | /// <param name="bootstrapperCommand">The context of the current run of the bundle.</param> | 37 | /// <param name="bootstrapperCommand">This is no longer used.</param> |
41 | public static void InitializeFromCreateArgs(IntPtr pArgs, out IEngine engine, out IBootstrapperCommand bootstrapperCommand) | 38 | public static void InitializeFromCreateArgs(IntPtr pArgs, out IEngine engine, out IBootstrapperCommand bootstrapperCommand) |
42 | { | 39 | { |
43 | Command pCommand = new Command | 40 | throw new NotImplementedException(); |
44 | { | ||
45 | cbSize = Marshal.SizeOf(typeof(Command)) | ||
46 | }; | ||
47 | var pEngine = MbaNative.InitializeFromCreateArgs(pArgs, ref pCommand); | ||
48 | engine = new Engine(pEngine); | ||
49 | bootstrapperCommand = pCommand.GetBootstrapperCommand(); | ||
50 | } | 41 | } |
51 | 42 | ||
52 | /// <summary> | 43 | /// <summary> |
53 | /// Registers the BA with the engine using the default mapping between the message based interface and the COM interface. | 44 | /// This is no longer used. |
54 | /// Most users should inherit from <see cref="BaseBootstrapperApplicationFactory"/> instead of calling this method. | ||
55 | /// </summary> | 45 | /// </summary> |
56 | /// <param name="pResults">The results struct given by the engine when initially creating the BA</param> | 46 | /// <param name="pResults">This is no longer used.</param> |
57 | /// <param name="ba">The <see cref="IBootstrapperApplication"/>.</param> | 47 | /// <param name="ba">This is no longer used.</param> |
58 | public static void StoreBAInCreateResults(IntPtr pResults, IBootstrapperApplication ba) | 48 | public static void StoreBAInCreateResults(IntPtr pResults, IBootstrapperApplication ba) |
59 | { | 49 | { |
60 | MbaNative.StoreBAInCreateResults(pResults, ba); | 50 | throw new NotImplementedException(); |
61 | } | 51 | } |
62 | } | 52 | } |
63 | } | 53 | } |
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs index a0ec6ab9..98b34217 100644 --- a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs | |||
@@ -13,23 +13,15 @@ namespace WixToolset.Mba.Core | |||
13 | public abstract class BootstrapperApplication : MarshalByRefObject, IDefaultBootstrapperApplication | 13 | public abstract class BootstrapperApplication : MarshalByRefObject, IDefaultBootstrapperApplication |
14 | { | 14 | { |
15 | /// <summary> | 15 | /// <summary> |
16 | /// Specifies whether this bootstrapper should run asynchronously. The default is true. | ||
17 | /// </summary> | ||
18 | protected readonly bool asyncExecution; | ||
19 | |||
20 | /// <summary> | ||
21 | /// Gets the <see cref="IEngine"/> for interaction with the engine. | 16 | /// Gets the <see cref="IEngine"/> for interaction with the engine. |
22 | /// </summary> | 17 | /// </summary> |
23 | protected readonly IEngine engine; | 18 | protected IEngine engine; |
24 | 19 | ||
25 | /// <summary> | 20 | /// <inheritdoc/> |
26 | /// Creates a new instance of the <see cref="BootstrapperApplication"/> class. | 21 | public event EventHandler<CreateEventArgs> Create; |
27 | /// </summary> | 22 | |
28 | protected BootstrapperApplication(IEngine engine) | 23 | /// <inheritdoc/> |
29 | { | 24 | public event EventHandler<DestroyEventArgs> Destroy; |
30 | this.engine = engine; | ||
31 | this.asyncExecution = true; | ||
32 | } | ||
33 | 25 | ||
34 | /// <inheritdoc/> | 26 | /// <inheritdoc/> |
35 | public event EventHandler<StartupEventArgs> Startup; | 27 | public event EventHandler<StartupEventArgs> Startup; |
@@ -266,12 +258,6 @@ namespace WixToolset.Mba.Core | |||
266 | public event EventHandler<CachePayloadExtractCompleteEventArgs> CachePayloadExtractComplete; | 258 | public event EventHandler<CachePayloadExtractCompleteEventArgs> CachePayloadExtractComplete; |
267 | 259 | ||
268 | /// <inheritdoc/> | 260 | /// <inheritdoc/> |
269 | public event EventHandler<SetUpdateBeginEventArgs> SetUpdateBegin; | ||
270 | |||
271 | /// <inheritdoc/> | ||
272 | public event EventHandler<SetUpdateCompleteEventArgs> SetUpdateComplete; | ||
273 | |||
274 | /// <inheritdoc/> | ||
275 | public event EventHandler<PlanRestoreRelatedBundleEventArgs> PlanRestoreRelatedBundle; | 261 | public event EventHandler<PlanRestoreRelatedBundleEventArgs> PlanRestoreRelatedBundle; |
276 | 262 | ||
277 | /// <inheritdoc/> | 263 | /// <inheritdoc/> |
@@ -284,35 +270,73 @@ namespace WixToolset.Mba.Core | |||
284 | public event EventHandler<CachePackageNonVitalValidationFailureEventArgs> CachePackageNonVitalValidationFailure; | 270 | public event EventHandler<CachePackageNonVitalValidationFailureEventArgs> CachePackageNonVitalValidationFailure; |
285 | 271 | ||
286 | /// <summary> | 272 | /// <summary> |
273 | /// The default constructor. | ||
274 | /// </summary> | ||
275 | /// <remarks> | ||
276 | /// The engine object will be valid after handling the OnCreate() event. | ||
277 | /// </remarks> | ||
278 | protected BootstrapperApplication() | ||
279 | { | ||
280 | } | ||
281 | |||
282 | /// <summary> | ||
283 | /// This constructor is no longer used. | ||
284 | /// </summary> | ||
285 | [Obsolete("This constructor is no longer used. Use the default constructor. The engine object will be valid after handling the OnCreate() event.")] | ||
286 | protected BootstrapperApplication(IEngine engine) | ||
287 | { | ||
288 | throw new NotImplementedException("This constructor is no longer used. Use the default constructor. The engine object will be valid after handling the OnCreate() event."); | ||
289 | } | ||
290 | |||
291 | /// <summary> | ||
287 | /// Entry point that is called when the bootstrapper application is ready to run. | 292 | /// Entry point that is called when the bootstrapper application is ready to run. |
288 | /// </summary> | 293 | /// </summary> |
289 | protected abstract void Run(); | 294 | protected abstract void Run(); |
290 | 295 | ||
291 | /// <summary> | 296 | /// <summary> |
292 | /// Called by the engine, raises the <see cref="Startup"/> event. | 297 | /// Called by the engine, raises the <see cref="Create"/> event. |
293 | /// </summary> | 298 | /// </summary> |
294 | /// <param name="args">Additional arguments for this event.</param> | 299 | /// <param name="args">Additional arguments for this event.</param> |
295 | protected virtual void OnStartup(StartupEventArgs args) | 300 | protected virtual void OnCreate(CreateEventArgs args) |
296 | { | 301 | { |
297 | EventHandler<StartupEventArgs> handler = this.Startup; | 302 | this.engine = args.Engine; |
303 | |||
304 | EventHandler<CreateEventArgs> handler = this.Create; | ||
298 | if (null != handler) | 305 | if (null != handler) |
299 | { | 306 | { |
300 | handler(this, args); | 307 | handler(this, args); |
301 | } | 308 | } |
309 | } | ||
302 | 310 | ||
303 | if (this.asyncExecution) | 311 | /// <summary> |
312 | /// Called by the engine, raises the <see cref="Destroy"/> event. | ||
313 | /// </summary> | ||
314 | /// <param name="args">Additional arguments for this event.</param> | ||
315 | protected virtual void OnDestroy(DestroyEventArgs args) | ||
316 | { | ||
317 | EventHandler<DestroyEventArgs> handler = this.Destroy; | ||
318 | if (null != handler) | ||
304 | { | 319 | { |
305 | this.engine.Log(LogLevel.Verbose, "Creating BA thread to run asynchronously."); | 320 | handler(this, args); |
306 | Thread uiThread = new Thread(this.Run); | ||
307 | uiThread.Name = "UIThread"; | ||
308 | uiThread.SetApartmentState(ApartmentState.STA); | ||
309 | uiThread.Start(); | ||
310 | } | 321 | } |
311 | else | 322 | } |
323 | |||
324 | /// <summary> | ||
325 | /// Called by the engine, raises the <see cref="Startup"/> event. | ||
326 | /// </summary> | ||
327 | /// <param name="args">Additional arguments for this event.</param> | ||
328 | protected virtual void OnStartup(StartupEventArgs args) | ||
329 | { | ||
330 | EventHandler<StartupEventArgs> handler = this.Startup; | ||
331 | if (null != handler) | ||
312 | { | 332 | { |
313 | this.engine.Log(LogLevel.Verbose, "Creating BA thread to run synchronously."); | 333 | handler(this, args); |
314 | this.Run(); | ||
315 | } | 334 | } |
335 | |||
336 | Thread uiThread = new Thread(this.Run); | ||
337 | uiThread.Name = "UIThread"; | ||
338 | uiThread.SetApartmentState(ApartmentState.STA); | ||
339 | uiThread.Start(); | ||
316 | } | 340 | } |
317 | 341 | ||
318 | /// <summary> | 342 | /// <summary> |
@@ -1315,31 +1339,6 @@ namespace WixToolset.Mba.Core | |||
1315 | } | 1339 | } |
1316 | } | 1340 | } |
1317 | 1341 | ||
1318 | /// <summary> | ||
1319 | /// Called by the engine, raises the <see cref="SetUpdateBegin"/> event. | ||
1320 | /// </summary> | ||
1321 | /// <param name="args">Additional arguments for this event.</param> | ||
1322 | protected virtual void OnSetUpdateBegin(SetUpdateBeginEventArgs args) | ||
1323 | { | ||
1324 | EventHandler<SetUpdateBeginEventArgs> handler = this.SetUpdateBegin; | ||
1325 | if (null != handler) | ||
1326 | { | ||
1327 | handler(this, args); | ||
1328 | } | ||
1329 | } | ||
1330 | |||
1331 | /// <summary> | ||
1332 | /// Called by the engine, raises the <see cref="SetUpdateComplete"/> event. | ||
1333 | /// </summary> | ||
1334 | /// <param name="args">Additional arguments for this event.</param> | ||
1335 | protected virtual void OnSetUpdateComplete(SetUpdateCompleteEventArgs args) | ||
1336 | { | ||
1337 | EventHandler<SetUpdateCompleteEventArgs> handler = this.SetUpdateComplete; | ||
1338 | if (null != handler) | ||
1339 | { | ||
1340 | handler(this, args); | ||
1341 | } | ||
1342 | } | ||
1343 | 1342 | ||
1344 | /// <summary> | 1343 | /// <summary> |
1345 | /// Called by the engine, raises the <see cref="PlanRestoreRelatedBundle"/> event. | 1344 | /// Called by the engine, raises the <see cref="PlanRestoreRelatedBundle"/> event. |
@@ -1395,7 +1394,7 @@ namespace WixToolset.Mba.Core | |||
1395 | 1394 | ||
1396 | #region IBootstrapperApplication Members | 1395 | #region IBootstrapperApplication Members |
1397 | 1396 | ||
1398 | int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults, IntPtr pvContext) | 1397 | int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults) |
1399 | { | 1398 | { |
1400 | switch (message) | 1399 | switch (message) |
1401 | { | 1400 | { |
@@ -1404,8 +1403,24 @@ namespace WixToolset.Mba.Core | |||
1404 | } | 1403 | } |
1405 | } | 1404 | } |
1406 | 1405 | ||
1407 | void IBootstrapperApplication.BAProcFallback(int message, IntPtr pvArgs, IntPtr pvResults, ref int phr, IntPtr pvContext) | 1406 | void IBootstrapperApplication.BAProcFallback(int message, IntPtr pvArgs, IntPtr pvResults, ref int phr) |
1407 | { | ||
1408 | } | ||
1409 | |||
1410 | int IBootstrapperApplication.OnCreate(IBootstrapperEngine engine, ref Command command) | ||
1408 | { | 1411 | { |
1412 | CreateEventArgs args = new CreateEventArgs(new Engine(engine), command.GetBootstrapperCommand()); | ||
1413 | this.OnCreate(args); | ||
1414 | |||
1415 | return args.HResult; | ||
1416 | } | ||
1417 | |||
1418 | int IBootstrapperApplication.OnDestroy(bool reload) | ||
1419 | { | ||
1420 | DestroyEventArgs args = new DestroyEventArgs(reload); | ||
1421 | this.OnDestroy(args); | ||
1422 | |||
1423 | return args.HResult; | ||
1409 | } | 1424 | } |
1410 | 1425 | ||
1411 | int IBootstrapperApplication.OnStartup() | 1426 | int IBootstrapperApplication.OnStartup() |
@@ -2107,22 +2122,6 @@ namespace WixToolset.Mba.Core | |||
2107 | return args.HResult; | 2122 | return args.HResult; |
2108 | } | 2123 | } |
2109 | 2124 | ||
2110 | int IBootstrapperApplication.OnSetUpdateBegin() | ||
2111 | { | ||
2112 | SetUpdateBeginEventArgs args = new SetUpdateBeginEventArgs(); | ||
2113 | this.OnSetUpdateBegin(args); | ||
2114 | |||
2115 | return args.HResult; | ||
2116 | } | ||
2117 | |||
2118 | int IBootstrapperApplication.OnSetUpdateComplete(int hrStatus, string wzPreviousPackageId, string wzNewPackageId) | ||
2119 | { | ||
2120 | SetUpdateCompleteEventArgs args = new SetUpdateCompleteEventArgs(hrStatus, wzPreviousPackageId, wzNewPackageId); | ||
2121 | this.OnSetUpdateComplete(args); | ||
2122 | |||
2123 | return args.HResult; | ||
2124 | } | ||
2125 | |||
2126 | int IBootstrapperApplication.OnPlanRestoreRelatedBundle(string wzBundleId, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel) | 2125 | int IBootstrapperApplication.OnPlanRestoreRelatedBundle(string wzBundleId, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel) |
2127 | { | 2126 | { |
2128 | PlanRestoreRelatedBundleEventArgs args = new PlanRestoreRelatedBundleEventArgs(wzBundleId, recommendedState, pRequestedState, fCancel); | 2127 | PlanRestoreRelatedBundleEventArgs args = new PlanRestoreRelatedBundleEventArgs(wzBundleId, recommendedState, pRequestedState, fCancel); |
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationFactoryAttribute.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationFactoryAttribute.cs index 95252cf3..6b465408 100644 --- a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationFactoryAttribute.cs +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplicationFactoryAttribute.cs | |||
@@ -5,31 +5,27 @@ namespace WixToolset.Mba.Core | |||
5 | using System; | 5 | using System; |
6 | 6 | ||
7 | /// <summary> | 7 | /// <summary> |
8 | /// Identifies the bootstrapper application factory class. | 8 | /// This is no longer used. |
9 | /// </summary> | 9 | /// </summary> |
10 | /// <remarks> | 10 | [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.")] |
11 | /// This required assembly attribute identifies the bootstrapper application factory class. | ||
12 | /// </remarks> | ||
13 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] | 11 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] |
14 | public sealed class BootstrapperApplicationFactoryAttribute : Attribute | 12 | public sealed class BootstrapperApplicationFactoryAttribute : Attribute |
15 | { | 13 | { |
16 | private Type bootstrapperApplicationFactoryType; | ||
17 | |||
18 | /// <summary> | 14 | /// <summary> |
19 | /// Creates a new instance of the <see cref="BootstrapperApplicationFactoryAttribute"/> class. | 15 | /// This is no longer used. |
20 | /// </summary> | 16 | /// </summary> |
21 | /// <param name="bootstrapperApplicationFactoryType">The <see cref="Type"/> of the BA factory.</param> | 17 | /// <param name="bootstrapperApplicationFactoryType">This is no longer used</param> |
22 | public BootstrapperApplicationFactoryAttribute(Type bootstrapperApplicationFactoryType) | 18 | public BootstrapperApplicationFactoryAttribute(Type bootstrapperApplicationFactoryType) |
23 | { | 19 | { |
24 | this.bootstrapperApplicationFactoryType = bootstrapperApplicationFactoryType; | 20 | throw new NotImplementedException(); |
25 | } | 21 | } |
26 | 22 | ||
27 | /// <summary> | 23 | /// <summary> |
28 | /// Gets the type of the bootstrapper application factory class to create. | 24 | /// This is no longer used. |
29 | /// </summary> | 25 | /// </summary> |
30 | public Type BootstrapperApplicationFactoryType | 26 | public Type BootstrapperApplicationFactoryType |
31 | { | 27 | { |
32 | get { return this.bootstrapperApplicationFactoryType; } | 28 | get { throw new NotImplementedException(); } |
33 | } | 29 | } |
34 | } | 30 | } |
35 | } | 31 | } |
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs index ed1dc191..b96a8f95 100644 --- a/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperCommand.cs | |||
@@ -3,11 +3,55 @@ | |||
3 | namespace WixToolset.Mba.Core | 3 | namespace WixToolset.Mba.Core |
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.CodeDom.Compiler; | ||
6 | using System.Collections.Generic; | 7 | using System.Collections.Generic; |
7 | using System.ComponentModel; | 8 | using System.ComponentModel; |
8 | using System.Runtime.InteropServices; | 9 | using System.Runtime.InteropServices; |
9 | 10 | ||
10 | /// <summary> | 11 | /// <summary> |
12 | /// Command-line provided to the bootstrapper application. | ||
13 | /// </summary> | ||
14 | [Serializable] | ||
15 | [StructLayout(LayoutKind.Sequential)] | ||
16 | [GeneratedCodeAttribute("WixToolset.Bootstrapper.InteropCodeGenerator", "1.0.0.0")] | ||
17 | public struct Command | ||
18 | { | ||
19 | // Strings must be declared as pointers so that Marshaling doesn't free them. | ||
20 | [MarshalAs(UnmanagedType.I4)] internal int cbSize; | ||
21 | [MarshalAs(UnmanagedType.U4)] private readonly LaunchAction action; | ||
22 | [MarshalAs(UnmanagedType.U4)] private readonly Display display; | ||
23 | private readonly IntPtr wzCommandLine; | ||
24 | [MarshalAs(UnmanagedType.I4)] private readonly int nCmdShow; | ||
25 | [MarshalAs(UnmanagedType.U4)] private readonly ResumeType resume; | ||
26 | private readonly IntPtr hwndSplashScreen; | ||
27 | [MarshalAs(UnmanagedType.I4)] private readonly RelationType relation; | ||
28 | [MarshalAs(UnmanagedType.Bool)] private readonly bool passthrough; | ||
29 | private readonly IntPtr wzLayoutDirectory; | ||
30 | private readonly IntPtr wzBootstrapperWorkingFolder; | ||
31 | private readonly IntPtr wzBootstrapperApplicationDataPath; | ||
32 | |||
33 | /// <summary> | ||
34 | /// Gets the IBootstrapperCommand for this Command. | ||
35 | /// </summary> | ||
36 | /// <returns>IBootstrapperCommand</returns> | ||
37 | public IBootstrapperCommand GetBootstrapperCommand() | ||
38 | { | ||
39 | return new BootstrapperCommand( | ||
40 | this.action, | ||
41 | this.display, | ||
42 | Marshal.PtrToStringUni(this.wzCommandLine), | ||
43 | this.nCmdShow, | ||
44 | this.resume, | ||
45 | this.hwndSplashScreen, | ||
46 | this.relation, | ||
47 | this.passthrough, | ||
48 | Marshal.PtrToStringUni(this.wzLayoutDirectory), | ||
49 | Marshal.PtrToStringUni(this.wzBootstrapperWorkingFolder), | ||
50 | Marshal.PtrToStringUni(this.wzBootstrapperApplicationDataPath)); | ||
51 | } | ||
52 | } | ||
53 | |||
54 | /// <summary> | ||
11 | /// Default implementation of <see cref="IBootstrapperCommand"/>. | 55 | /// Default implementation of <see cref="IBootstrapperCommand"/>. |
12 | /// </summary> | 56 | /// </summary> |
13 | public sealed class BootstrapperCommand : IBootstrapperCommand | 57 | public sealed class BootstrapperCommand : IBootstrapperCommand |
diff --git a/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs b/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs index ee751ebf..0039f375 100644 --- a/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs +++ b/src/api/burn/WixToolset.Mba.Core/BundleInfo.cs | |||
@@ -34,17 +34,17 @@ namespace WixToolset.Mba.Core | |||
34 | } | 34 | } |
35 | 35 | ||
36 | /// <inheritdoc/> | 36 | /// <inheritdoc/> |
37 | public IPackageInfo AddRelatedBundleAsPackage(DetectRelatedBundleEventArgs e) | 37 | public IPackageInfo AddRelatedBundleAsPackage(string productCode, RelationType relationType, bool perMachine, string version) |
38 | { | 38 | { |
39 | var package = PackageInfo.GetRelatedBundleAsPackage(e.ProductCode, e.RelationType, e.PerMachine, e.Version); | 39 | var package = PackageInfo.GetRelatedBundleAsPackage(productCode, relationType, perMachine, version); |
40 | this.Packages.Add(package.Id, package); | 40 | this.Packages.Add(package.Id, package); |
41 | return package; | 41 | return package; |
42 | } | 42 | } |
43 | 43 | ||
44 | /// <inheritdoc/> | 44 | /// <inheritdoc/> |
45 | public IPackageInfo AddUpdateBundleAsPackage(SetUpdateCompleteEventArgs e) | 45 | public IPackageInfo AddUpdateBundleAsPackage(string packageId) |
46 | { | 46 | { |
47 | var package = PackageInfo.GetUpdateBundleAsPackage(e.NewPackageId); | 47 | var package = PackageInfo.GetUpdateBundleAsPackage(packageId); |
48 | this.Packages.Add(package.Id, package); | 48 | this.Packages.Add(package.Id, package); |
49 | return package; | 49 | return package; |
50 | } | 50 | } |
diff --git a/src/api/burn/WixToolset.Mba.Core/Engine.cs b/src/api/burn/WixToolset.Mba.Core/Engine.cs index 1120fb1c..df412e8c 100644 --- a/src/api/burn/WixToolset.Mba.Core/Engine.cs +++ b/src/api/burn/WixToolset.Mba.Core/Engine.cs | |||
@@ -253,9 +253,9 @@ namespace WixToolset.Mba.Core | |||
253 | } | 253 | } |
254 | 254 | ||
255 | /// <inheritdoc/> | 255 | /// <inheritdoc/> |
256 | public void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, string hash) | 256 | public void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, string hash, string updatePackageId) |
257 | { | 257 | { |
258 | this.engine.SetUpdate(localSource, downloadSource, size, hashType, hash); | 258 | this.engine.SetUpdate(localSource, downloadSource, size, hashType, hash, updatePackageId); |
259 | } | 259 | } |
260 | 260 | ||
261 | /// <inheritdoc/> | 261 | /// <inheritdoc/> |
diff --git a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs index 4b7f2245..6506c840 100644 --- a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs +++ b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs | |||
@@ -198,6 +198,54 @@ namespace WixToolset.Mba.Core | |||
198 | } | 198 | } |
199 | 199 | ||
200 | /// <summary> | 200 | /// <summary> |
201 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.Create"/>. | ||
202 | /// </summary> | ||
203 | [Serializable] | ||
204 | public class CreateEventArgs : HResultEventArgs | ||
205 | { | ||
206 | /// <summary> | ||
207 | /// This class is for events raised by the engine. | ||
208 | /// It is not intended to be instantiated by user code. | ||
209 | /// </summary> | ||
210 | public CreateEventArgs(IEngine engine, IBootstrapperCommand command) | ||
211 | { | ||
212 | this.Engine = engine; | ||
213 | this.Command = command; | ||
214 | } | ||
215 | |||
216 | /// <summary> | ||
217 | /// Engine running the application. | ||
218 | /// </summary> | ||
219 | public IEngine Engine { get; } | ||
220 | |||
221 | /// <summary> | ||
222 | /// Command line arguments. | ||
223 | /// </summary> | ||
224 | public IBootstrapperCommand Command { get; } | ||
225 | } | ||
226 | |||
227 | /// <summary> | ||
228 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.Destroy"/>. | ||
229 | /// </summary> | ||
230 | [Serializable] | ||
231 | public class DestroyEventArgs : HResultEventArgs | ||
232 | { | ||
233 | /// <summary> | ||
234 | /// This class is for events raised by the engine. | ||
235 | /// It is not intended to be instantiated by user code. | ||
236 | /// </summary> | ||
237 | public DestroyEventArgs(bool reload) | ||
238 | { | ||
239 | this.Reload = reload; | ||
240 | } | ||
241 | |||
242 | /// <summary> | ||
243 | /// Bootstrapper application is being reloaded. | ||
244 | /// </summary> | ||
245 | public bool Reload { get; } | ||
246 | } | ||
247 | |||
248 | /// <summary> | ||
201 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.Startup"/>. | 249 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.Startup"/>. |
202 | /// </summary> | 250 | /// </summary> |
203 | [Serializable] | 251 | [Serializable] |
@@ -2567,49 +2615,6 @@ namespace WixToolset.Mba.Core | |||
2567 | } | 2615 | } |
2568 | 2616 | ||
2569 | /// <summary> | 2617 | /// <summary> |
2570 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.SetUpdateBegin"/>. | ||
2571 | /// </summary> | ||
2572 | [Serializable] | ||
2573 | public class SetUpdateBeginEventArgs : HResultEventArgs | ||
2574 | { | ||
2575 | /// <summary> | ||
2576 | /// This class is for events raised by the engine. | ||
2577 | /// It is not intended to be instantiated by user code. | ||
2578 | /// </summary> | ||
2579 | public SetUpdateBeginEventArgs() | ||
2580 | { | ||
2581 | } | ||
2582 | } | ||
2583 | |||
2584 | /// <summary> | ||
2585 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.SetUpdateComplete"/> | ||
2586 | /// </summary> | ||
2587 | [Serializable] | ||
2588 | public class SetUpdateCompleteEventArgs : StatusEventArgs | ||
2589 | { | ||
2590 | /// <summary> | ||
2591 | /// This class is for events raised by the engine. | ||
2592 | /// It is not intended to be instantiated by user code. | ||
2593 | /// </summary> | ||
2594 | public SetUpdateCompleteEventArgs(int hrStatus, string previousPackageId, string newPackageId) | ||
2595 | : base(hrStatus) | ||
2596 | { | ||
2597 | this.PreviousPackageId = previousPackageId; | ||
2598 | this.NewPackageId = newPackageId; | ||
2599 | } | ||
2600 | |||
2601 | /// <summary> | ||
2602 | /// Gets the identifier of the update package that was removed. | ||
2603 | /// </summary> | ||
2604 | public string PreviousPackageId { get; private set; } | ||
2605 | |||
2606 | /// <summary> | ||
2607 | /// Gets the identifier of the update package that was added. | ||
2608 | /// </summary> | ||
2609 | public string NewPackageId { get; private set; } | ||
2610 | } | ||
2611 | |||
2612 | /// <summary> | ||
2613 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanRestoreRelatedBundle"/> | 2618 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanRestoreRelatedBundle"/> |
2614 | /// </summary> | 2619 | /// </summary> |
2615 | [Serializable] | 2620 | [Serializable] |
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs index 36c7fd33..8a255c44 100644 --- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs | |||
@@ -21,8 +21,7 @@ namespace WixToolset.Mba.Core | |||
21 | int BAProc( | 21 | int BAProc( |
22 | int message, | 22 | int message, |
23 | IntPtr pvArgs, | 23 | IntPtr pvArgs, |
24 | IntPtr pvResults, | 24 | IntPtr pvResults |
25 | IntPtr pvContext | ||
26 | ); | 25 | ); |
27 | 26 | ||
28 | /// <summary> | 27 | /// <summary> |
@@ -32,11 +31,24 @@ namespace WixToolset.Mba.Core | |||
32 | int message, | 31 | int message, |
33 | IntPtr pvArgs, | 32 | IntPtr pvArgs, |
34 | IntPtr pvResults, | 33 | IntPtr pvResults, |
35 | ref int phr, | 34 | ref int phr |
36 | IntPtr pvContext | ||
37 | ); | 35 | ); |
38 | 36 | ||
39 | /// <summary> | 37 | /// <summary> |
38 | /// See <see cref="IDefaultBootstrapperApplication.Create"/>. | ||
39 | /// </summary> | ||
40 | [PreserveSig] | ||
41 | [return: MarshalAs(UnmanagedType.I4)] | ||
42 | int OnCreate(IBootstrapperEngine engine, ref Command command); | ||
43 | |||
44 | /// <summary> | ||
45 | /// See <see cref="IDefaultBootstrapperApplication.Destroy"/>. | ||
46 | /// </summary> | ||
47 | [PreserveSig] | ||
48 | [return: MarshalAs(UnmanagedType.I4)] | ||
49 | int OnDestroy(bool reload); | ||
50 | |||
51 | /// <summary> | ||
40 | /// See <see cref="IDefaultBootstrapperApplication.Startup"/>. | 52 | /// See <see cref="IDefaultBootstrapperApplication.Startup"/>. |
41 | /// </summary> | 53 | /// </summary> |
42 | [PreserveSig] | 54 | [PreserveSig] |
@@ -940,24 +952,6 @@ namespace WixToolset.Mba.Core | |||
940 | ); | 952 | ); |
941 | 953 | ||
942 | /// <summary> | 954 | /// <summary> |
943 | /// See <see cref="IDefaultBootstrapperApplication.SetUpdateBegin"/>. | ||
944 | /// </summary> | ||
945 | [PreserveSig] | ||
946 | [return: MarshalAs(UnmanagedType.I4)] | ||
947 | int OnSetUpdateBegin(); | ||
948 | |||
949 | /// <summary> | ||
950 | /// See <see cref="IDefaultBootstrapperApplication.SetUpdateComplete"/>. | ||
951 | /// </summary> | ||
952 | [PreserveSig] | ||
953 | [return: MarshalAs(UnmanagedType.I4)] | ||
954 | int OnSetUpdateComplete( | ||
955 | int hrStatus, | ||
956 | [MarshalAs(UnmanagedType.LPWStr)] string wzPreviousPackageId, | ||
957 | [MarshalAs(UnmanagedType.LPWStr)] string wzNewPackageId | ||
958 | ); | ||
959 | |||
960 | /// <summary> | ||
961 | /// See <see cref="IDefaultBootstrapperApplication.PlanRestoreRelatedBundle"/>. | 955 | /// See <see cref="IDefaultBootstrapperApplication.PlanRestoreRelatedBundle"/>. |
962 | /// </summary> | 956 | /// </summary> |
963 | [PreserveSig] | 957 | [PreserveSig] |
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs index 2e84de67..393c7e31 100644 --- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs | |||
@@ -7,58 +7,16 @@ namespace WixToolset.Mba.Core | |||
7 | using System.Runtime.InteropServices; | 7 | using System.Runtime.InteropServices; |
8 | 8 | ||
9 | /// <summary> | 9 | /// <summary> |
10 | /// Interface used by the native host to dynamically load the BA. | 10 | /// This is no longer used. |
11 | /// </summary> | 11 | /// </summary> |
12 | [ComVisible(true)] | 12 | [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.")] |
13 | [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | ||
14 | [Guid("2965A12F-AC7B-43A0-85DF-E4B2168478A4")] | ||
15 | [GeneratedCodeAttribute("WixToolset.Bootstrapper.InteropCodeGenerator", "1.0.0.0")] | ||
16 | public interface IBootstrapperApplicationFactory | 13 | public interface IBootstrapperApplicationFactory |
17 | { | 14 | { |
18 | /// <summary> | 15 | /// <summary> |
19 | /// Low level method called by the native host. | 16 | /// This is no longer used. |
20 | /// </summary> | 17 | /// </summary> |
21 | /// <param name="pArgs"></param> | 18 | /// <param name="pArgs">This is no longer used.</param> |
22 | /// <param name="pResults"></param> | 19 | /// <param name="pResults">This is no longer used.</param> |
23 | void Create( | 20 | void Create(IntPtr pArgs, IntPtr pResults); |
24 | IntPtr pArgs, | ||
25 | IntPtr pResults | ||
26 | ); | ||
27 | } | ||
28 | |||
29 | [Serializable] | ||
30 | [StructLayout(LayoutKind.Sequential)] | ||
31 | [GeneratedCodeAttribute("WixToolset.Bootstrapper.InteropCodeGenerator", "1.0.0.0")] | ||
32 | internal struct Command | ||
33 | { | ||
34 | // Strings must be declared as pointers so that Marshaling doesn't free them. | ||
35 | [MarshalAs(UnmanagedType.I4)] internal int cbSize; | ||
36 | [MarshalAs(UnmanagedType.U4)] private readonly LaunchAction action; | ||
37 | [MarshalAs(UnmanagedType.U4)] private readonly Display display; | ||
38 | private readonly IntPtr wzCommandLine; | ||
39 | [MarshalAs(UnmanagedType.I4)] private readonly int nCmdShow; | ||
40 | [MarshalAs(UnmanagedType.U4)] private readonly ResumeType resume; | ||
41 | private readonly IntPtr hwndSplashScreen; | ||
42 | [MarshalAs(UnmanagedType.I4)] private readonly RelationType relation; | ||
43 | [MarshalAs(UnmanagedType.Bool)] private readonly bool passthrough; | ||
44 | private readonly IntPtr wzLayoutDirectory; | ||
45 | private readonly IntPtr wzBootstrapperWorkingFolder; | ||
46 | private readonly IntPtr wzBootstrapperApplicationDataPath; | ||
47 | |||
48 | public IBootstrapperCommand GetBootstrapperCommand() | ||
49 | { | ||
50 | return new BootstrapperCommand( | ||
51 | this.action, | ||
52 | this.display, | ||
53 | Marshal.PtrToStringUni(this.wzCommandLine), | ||
54 | this.nCmdShow, | ||
55 | this.resume, | ||
56 | this.hwndSplashScreen, | ||
57 | this.relation, | ||
58 | this.passthrough, | ||
59 | Marshal.PtrToStringUni(this.wzLayoutDirectory), | ||
60 | Marshal.PtrToStringUni(this.wzBootstrapperWorkingFolder), | ||
61 | Marshal.PtrToStringUni(this.wzBootstrapperApplicationDataPath)); | ||
62 | } | ||
63 | } | 21 | } |
64 | } | 22 | } |
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs index 3f90639f..a175bead 100644 --- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperEngine.cs | |||
@@ -108,14 +108,15 @@ namespace WixToolset.Mba.Core | |||
108 | ); | 108 | ); |
109 | 109 | ||
110 | /// <summary> | 110 | /// <summary> |
111 | /// See <see cref="IEngine.SetUpdate(string, string, long, UpdateHashType, string)"/>. | 111 | /// See <see cref="IEngine.SetUpdate(string, string, long, UpdateHashType, string, string)"/>. |
112 | /// </summary> | 112 | /// </summary> |
113 | void SetUpdate( | 113 | void SetUpdate( |
114 | [MarshalAs(UnmanagedType.LPWStr)] string wzLocalSource, | 114 | [MarshalAs(UnmanagedType.LPWStr)] string wzLocalSource, |
115 | [MarshalAs(UnmanagedType.LPWStr)] string wzDownloadSource, | 115 | [MarshalAs(UnmanagedType.LPWStr)] string wzDownloadSource, |
116 | [MarshalAs(UnmanagedType.U8)] long qwValue, | 116 | [MarshalAs(UnmanagedType.U8)] long qwValue, |
117 | [MarshalAs(UnmanagedType.U4)] UpdateHashType hashType, | 117 | [MarshalAs(UnmanagedType.U4)] UpdateHashType hashType, |
118 | [MarshalAs(UnmanagedType.LPWStr)] string wzHash | 118 | [MarshalAs(UnmanagedType.LPWStr)] string wzHash, |
119 | [MarshalAs(UnmanagedType.LPWStr)] string wzUpdatePackageId | ||
119 | ); | 120 | ); |
120 | 121 | ||
121 | /// <summary> | 122 | /// <summary> |
@@ -330,12 +331,12 @@ namespace WixToolset.Mba.Core | |||
330 | Repair, | 331 | Repair, |
331 | 332 | ||
332 | /// <summary> | 333 | /// <summary> |
333 | /// Launch the update registered with <see cref="IEngine.SetUpdate(string, string, long, UpdateHashType, string)"/> and then exit without waiting for it to complete. | 334 | /// Launch the update registered with <see cref="IEngine.SetUpdate(string, string, long, UpdateHashType, string, string)"/> and then exit without waiting for it to complete. |
334 | /// </summary> | 335 | /// </summary> |
335 | UpdateReplace, | 336 | UpdateReplace, |
336 | 337 | ||
337 | /// <summary> | 338 | /// <summary> |
338 | /// Launch the update registered with <see cref="IEngine.SetUpdate(string, string, long, UpdateHashType, string)"/> as an embedded bundle. | 339 | /// Launch the update registered with <see cref="IEngine.SetUpdate(string, string, long, UpdateHashType, string, string)"/> as an embedded bundle. |
339 | /// </summary> | 340 | /// </summary> |
340 | UpdateReplaceEmbedded, | 341 | UpdateReplaceEmbedded, |
341 | } | 342 | } |
diff --git a/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs b/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs index 951f511a..3c52fc02 100644 --- a/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs +++ b/src/api/burn/WixToolset.Mba.Core/IBundleInfo.cs | |||
@@ -37,15 +37,18 @@ namespace WixToolset.Mba.Core | |||
37 | /// <summary> | 37 | /// <summary> |
38 | /// Adds a related bundle as a package. | 38 | /// Adds a related bundle as a package. |
39 | /// </summary> | 39 | /// </summary> |
40 | /// <param name="e"></param> | 40 | /// <param name="productCode"></param> |
41 | /// <param name="relationType"></param> | ||
42 | /// <param name="perMachine"></param> | ||
43 | /// <param name="version"></param> | ||
41 | /// <returns>The created <see cref="IPackageInfo"/>.</returns> | 44 | /// <returns>The created <see cref="IPackageInfo"/>.</returns> |
42 | IPackageInfo AddRelatedBundleAsPackage(DetectRelatedBundleEventArgs e); | 45 | IPackageInfo AddRelatedBundleAsPackage(string productCode, RelationType relationType, bool perMachine, string version); |
43 | 46 | ||
44 | /// <summary> | 47 | /// <summary> |
45 | /// Adds an update bundle as a package. | 48 | /// Adds an update bundle as a package. |
46 | /// </summary> | 49 | /// </summary> |
47 | /// <param name="e"></param> | 50 | /// <param name="packageId">Package id added as update bundle.</param> |
48 | /// <returns>The created <see cref="IPackageInfo"/>.</returns> | 51 | /// <returns>The created <see cref="IPackageInfo"/>.</returns> |
49 | IPackageInfo AddUpdateBundleAsPackage(SetUpdateCompleteEventArgs e); | 52 | IPackageInfo AddUpdateBundleAsPackage(string packageId); |
50 | } | 53 | } |
51 | } | 54 | } |
diff --git a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs index 2fa88bdb..51ea4e4d 100644 --- a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs | |||
@@ -139,6 +139,16 @@ namespace WixToolset.Mba.Core | |||
139 | event EventHandler<CommitMsiTransactionCompleteEventArgs> CommitMsiTransactionComplete; | 139 | event EventHandler<CommitMsiTransactionCompleteEventArgs> CommitMsiTransactionComplete; |
140 | 140 | ||
141 | /// <summary> | 141 | /// <summary> |
142 | /// Fired when the application is being created. | ||
143 | /// </summary> | ||
144 | event EventHandler<CreateEventArgs> Create; | ||
145 | |||
146 | /// <summary> | ||
147 | /// Fired when the application is being destroyed. | ||
148 | /// </summary> | ||
149 | event EventHandler<DestroyEventArgs> Destroy; | ||
150 | |||
151 | /// <summary> | ||
142 | /// Fired when the overall detection phase has begun. | 152 | /// Fired when the overall detection phase has begun. |
143 | /// </summary> | 153 | /// </summary> |
144 | event EventHandler<DetectBeginEventArgs> DetectBegin; | 154 | event EventHandler<DetectBeginEventArgs> DetectBegin; |
@@ -394,16 +404,6 @@ namespace WixToolset.Mba.Core | |||
394 | event EventHandler<RollbackMsiTransactionCompleteEventArgs> RollbackMsiTransactionComplete; | 404 | event EventHandler<RollbackMsiTransactionCompleteEventArgs> RollbackMsiTransactionComplete; |
395 | 405 | ||
396 | /// <summary> | 406 | /// <summary> |
397 | /// Fired when the engine has begun to setup the update package. | ||
398 | /// </summary> | ||
399 | event EventHandler<SetUpdateBeginEventArgs> SetUpdateBegin; | ||
400 | |||
401 | /// <summary> | ||
402 | /// Fired when the engine has completed setting up the update package. | ||
403 | /// </summary> | ||
404 | event EventHandler<SetUpdateCompleteEventArgs> SetUpdateComplete; | ||
405 | |||
406 | /// <summary> | ||
407 | /// Fired when the engine is shutting down the bootstrapper application. | 407 | /// Fired when the engine is shutting down the bootstrapper application. |
408 | /// </summary> | 408 | /// </summary> |
409 | event EventHandler<ShutdownEventArgs> Shutdown; | 409 | event EventHandler<ShutdownEventArgs> Shutdown; |
diff --git a/src/api/burn/WixToolset.Mba.Core/IEngine.cs b/src/api/burn/WixToolset.Mba.Core/IEngine.cs index 7ffa80d7..dde97a70 100644 --- a/src/api/burn/WixToolset.Mba.Core/IEngine.cs +++ b/src/api/burn/WixToolset.Mba.Core/IEngine.cs | |||
@@ -149,7 +149,8 @@ namespace WixToolset.Mba.Core | |||
149 | /// <param name="size">Size of the expected update.</param> | 149 | /// <param name="size">Size of the expected update.</param> |
150 | /// <param name="hashType">Type of the hash expected on the update.</param> | 150 | /// <param name="hashType">Type of the hash expected on the update.</param> |
151 | /// <param name="hash">Optional hash expected for the update.</param> | 151 | /// <param name="hash">Optional hash expected for the update.</param> |
152 | void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, string hash); | 152 | /// <param name="updatePackageId">Optional package id for the update.</param> |
153 | void SetUpdate(string localSource, string downloadSource, long size, UpdateHashType hashType, string hash, string updatePackageId); | ||
153 | 154 | ||
154 | /// <summary> | 155 | /// <summary> |
155 | /// Sets the URL to the update feed. | 156 | /// Sets the URL to the update feed. |
diff --git a/src/api/burn/WixToolset.Mba.Core/ManagedBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/ManagedBootstrapperApplication.cs new file mode 100644 index 00000000..74bfbd73 --- /dev/null +++ b/src/api/burn/WixToolset.Mba.Core/ManagedBootstrapperApplication.cs | |||
@@ -0,0 +1,19 @@ | |||
1 | // 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. | ||
2 | |||
3 | namespace WixToolset.Mba.Core | ||
4 | { | ||
5 | /// <summary> | ||
6 | /// Managed bootstrapper application entry point. | ||
7 | /// </summary> | ||
8 | public static class ManagedBootstrapperApplication | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// Run the managed bootstrapper application. | ||
12 | /// </summary> | ||
13 | /// <param name="application">Bootstrapper applciation to run.</param> | ||
14 | public static void Run(IBootstrapperApplication application) | ||
15 | { | ||
16 | MbaNative.BootstrapperApplicationRun(application); | ||
17 | } | ||
18 | } | ||
19 | } | ||
diff --git a/src/api/burn/WixToolset.Mba.Core/MbaNative.cs b/src/api/burn/WixToolset.Mba.Core/MbaNative.cs index a68a3907..e8e9d576 100644 --- a/src/api/burn/WixToolset.Mba.Core/MbaNative.cs +++ b/src/api/burn/WixToolset.Mba.Core/MbaNative.cs | |||
@@ -8,14 +8,10 @@ namespace WixToolset.Mba.Core | |||
8 | internal static class MbaNative | 8 | internal static class MbaNative |
9 | { | 9 | { |
10 | [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] | 10 | [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] |
11 | internal static extern IBootstrapperEngine InitializeFromCreateArgs( | 11 | internal static extern void BootstrapperApplicationDebuggerCheck(); |
12 | IntPtr pArgs, | ||
13 | ref Command pCommand | ||
14 | ); | ||
15 | 12 | ||
16 | [DllImport("mbanative.dll", ExactSpelling = true)] | 13 | [DllImport("mbanative.dll", ExactSpelling = true, PreserveSig = false)] |
17 | internal static extern void StoreBAInCreateResults( | 14 | internal static extern void BootstrapperApplicationRun( |
18 | IntPtr pResults, | ||
19 | [MarshalAs(UnmanagedType.Interface)] IBootstrapperApplication pBA | 15 | [MarshalAs(UnmanagedType.Interface)] IBootstrapperApplication pBA |
20 | ); | 16 | ); |
21 | } | 17 | } |
diff --git a/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs b/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs index c6373647..b91c52c9 100644 --- a/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs +++ b/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs | |||
@@ -365,19 +365,19 @@ namespace WixToolset.Mba.Core | |||
365 | package.DisplayInternalUICondition = BootstrapperApplicationData.GetAttribute(node, "DisplayInternalUICondition"); | 365 | package.DisplayInternalUICondition = BootstrapperApplicationData.GetAttribute(node, "DisplayInternalUICondition"); |
366 | } | 366 | } |
367 | 367 | ||
368 | nodes = root.Select("/p:BootstrapperApplicationData/p:WixMbaPrereqInformation", namespaceManager); | 368 | nodes = root.Select("/p:BootstrapperApplicationData/p:WixPrereqInformation", namespaceManager); |
369 | 369 | ||
370 | foreach (XPathNavigator node in nodes) | 370 | foreach (XPathNavigator node in nodes) |
371 | { | 371 | { |
372 | string id = BootstrapperApplicationData.GetAttribute(node, "PackageId"); | 372 | string id = BootstrapperApplicationData.GetAttribute(node, "PackageId"); |
373 | if (id == null) | 373 | if (id == null) |
374 | { | 374 | { |
375 | throw new Exception("Failed to get package identifier for WixMbaPrereqInformation."); | 375 | throw new Exception("Failed to get package identifier for WixPrereqInformation."); |
376 | } | 376 | } |
377 | 377 | ||
378 | if (!packagesById.TryGetValue(id, out var ipackage)) | 378 | if (!packagesById.TryGetValue(id, out var ipackage)) |
379 | { | 379 | { |
380 | throw new Exception(String.Format("Failed to find package specified in WixMbaPrereqInformation: {0}", id)); | 380 | throw new Exception(String.Format("Failed to find package specified in WixPrereqInformation: {0}", id)); |
381 | } | 381 | } |
382 | 382 | ||
383 | var package = (PackageInfo)ipackage; | 383 | var package = (PackageInfo)ipackage; |