From 24379873f589cff33965f1104041f61c0c4503e0 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 22 Dec 2019 10:31:33 +1100 Subject: Move the responsibility of wrapping the binary interfaces from mbahost to the new mbanative dll of WixToolset.Mba.Core. --- .../BaseBootstrapperApplicationFactory.cs | 28 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'src/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs') diff --git a/src/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs b/src/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs index 20151b71..264733ac 100644 --- a/src/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs +++ b/src/WixToolset.Mba.Core/BaseBootstrapperApplicationFactory.cs @@ -2,15 +2,35 @@ namespace WixToolset.Mba.Core { + using System; + using System.Runtime.InteropServices; + public abstract class BaseBootstrapperApplicationFactory : IBootstrapperApplicationFactory { - public IBootstrapperApplication Create(IBootstrapperEngine pEngine, ref Command command) + public void Create(IntPtr pArgs, IntPtr pResults) { - IEngine engine = new Engine(pEngine); - IBootstrapperCommand bootstrapperCommand = command.GetBootstrapperCommand(); - return this.Create(engine, bootstrapperCommand); + InitializeFromCreateArgs(pArgs, out var engine, out var bootstrapperCommand); + + var ba = this.Create(engine, bootstrapperCommand); + StoreBAInCreateResults(pResults, ba); } protected abstract IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand); + + public static void InitializeFromCreateArgs(IntPtr pArgs, out IEngine engine, out IBootstrapperCommand bootstrapperCommand) + { + Command pCommand = new Command + { + cbSize = Marshal.SizeOf(typeof(Command)) + }; + var pEngine = BalUtil.InitializeFromCreateArgs(pArgs, ref pCommand); + engine = new Engine(pEngine); + bootstrapperCommand = pCommand.GetBootstrapperCommand(); + } + + public static void StoreBAInCreateResults(IntPtr pResults, IBootstrapperApplication ba) + { + BalUtil.StoreBAInCreateResults(pResults, ba); + } } } -- cgit v1.2.3-55-g6feb