Update ManagedHost tests to run off of a bundle.
Sean Hall committed
Apr 23, 2020 at 12:17 UTC
bd3ee565f342bc0bb015594f303d13b67285a958
18 files changed
+184
-72
nuget.config
+1
@@ -11,6 +11,7 @@
11
<add key="wixtoolset-bootstrappercore" value="https://ci.appveyor.com/nuget/wixtoolset-bootstrappercore" />
12
<add key="wixtoolset-balutil" value="https://ci.appveyor.com/nuget/wixtoolset-balutil" />
13
<add key="wixtoolset-dutil" value="https://ci.appveyor.com/nuget/wixtoolset-dutil" />
14
+ <add key="wixtoolset-netfx-wixext" value="https://ci.appveyor.com/nuget/wixtoolset-netfx-wixext" />
15
<add key="wixtoolset-wcautil" value="https://ci.appveyor.com/nuget/wixtoolset-wcautil" />
16
<add key="wixtoolset-tools" value="https://ci.appveyor.com/nuget/wixtoolset-tools" />
17
<add key="wixbuildtools" value="https://ci.appveyor.com/nuget/wixbuildtools" />
src/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs
+58
-16
@@ -2,7 +2,9 @@
2
3
namespace WixToolsetTest.ManagedHost
4
{
5
+ using System.IO;
6
using WixBuildTools.TestSupport;
7
+ using WixToolset.Core.TestPackage;
8
using Xunit;
9
10
public class MbaHostFixture
@@ -10,31 +12,71 @@ namespace WixToolsetTest.ManagedHost
12
[Fact]
13
public void CanLoadFullFramework2MBA()
14
{
13
- var testEngine = new TestEngine();
14
- var baFile = TestData.Get(@"..\examples\Example.FullFramework2MBA\mbahost.dll");
15
+ using (var fs = new DisposableFileSystem())
16
+ {
17
+ var baseFolder = fs.GetFolder();
18
+ var binFolder = Path.Combine(baseFolder, "bin");
19
+ var bundleFile = Path.Combine(binFolder, "FullFramework2MBA.exe");
20
+ var baSourceFolder = TestData.Get(@"..\examples");
21
+ var bundleSourceFolder = TestData.Get(@"TestData\FullFramework2MBA");
22
+ var intermediateFolder = Path.Combine(baseFolder, "obj");
23
16
- var result = testEngine.RunShutdownEngine(baFile);
17
- Assert.Equal(0, result.ExitCode);
24
+ var compileResult = WixRunner.Execute(new[]
25
+ {
26
+ "build",
27
+ Path.Combine(bundleSourceFolder, "Bundle.wxs"),
28
+ "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
29
+ "-ext", TestData.Get(@"WixToolset.NetFx.wixext.dll"),
30
+ "-intermediateFolder", intermediateFolder,
31
+ "-bindpath", baSourceFolder,
32
+ "-burnStub", TestEngine.BurnStubFile,
33
+ "-o", bundleFile,
34
+ });
35
+ compileResult.AssertSuccess();
36
+ var testEngine = new TestEngine();
37
19
- var logMessages = result.Output;
20
- Assert.Equal(2, logMessages.Count);
21
- Assert.Equal("Loading managed bootstrapper application.", logMessages[0]);
22
- Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[1]);
38
+ var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
39
+ var logMessages = result.Output;
40
+ Assert.Equal("Loading managed bootstrapper application.", logMessages[0]);
41
+ Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]);
42
+ Assert.Equal("FullFramework2BA", logMessages[2]);
43
+ Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]);
44
+ }
45
}
46
47
[Fact]
48
public void CanLoadFullFramework4MBA()
49
{
28
- var testEngine = new TestEngine();
29
- var baFile = TestData.Get(@"..\examples\Example.FullFramework4MBA\net48\mbahost.dll");
50
+ using (var fs = new DisposableFileSystem())
51
+ {
52
+ var baseFolder = fs.GetFolder();
53
+ var binFolder = Path.Combine(baseFolder, "bin");
54
+ var bundleFile = Path.Combine(binFolder, "FullFramework4MBA.exe");
55
+ var baSourceFolder = TestData.Get(@"..\examples");
56
+ var bundleSourceFolder = TestData.Get(@"TestData\FullFramework4MBA");
57
+ var intermediateFolder = Path.Combine(baseFolder, "obj");
58
31
- var result = testEngine.RunShutdownEngine(baFile);
32
- Assert.Equal(0, result.ExitCode);
59
+ var compileResult = WixRunner.Execute(new[]
60
+ {
61
+ "build",
62
+ Path.Combine(bundleSourceFolder, "Bundle.wxs"),
63
+ "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
64
+ "-ext", TestData.Get(@"WixToolset.NetFx.wixext.dll"),
65
+ "-intermediateFolder", intermediateFolder,
66
+ "-bindpath", baSourceFolder,
67
+ "-burnStub", TestEngine.BurnStubFile,
68
+ "-o", bundleFile,
69
+ });
70
+ compileResult.AssertSuccess();
71
+ var testEngine = new TestEngine();
72
34
- var logMessages = result.Output;
35
- Assert.Equal(2, logMessages.Count);
36
- Assert.Equal("Loading managed bootstrapper application.", logMessages[0]);
37
- Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[1]);
73
+ var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
74
+ var logMessages = result.Output;
75
+ Assert.Equal("Loading managed bootstrapper application.", logMessages[0]);
76
+ Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]);
77
+ Assert.Equal("FullFramework4BA", logMessages[2]);
78
+ Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]);
79
+ }
80
}
81
}
82
}
src/test/WixToolsetTest.ManagedHost/TestData/FullFramework2MBA/Bundle.wxs
new
+15
@@ -0,0 +1,15 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
3
+ xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
4
+ <Bundle Name="FullFramework2MBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533">
5
+ <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
6
+ <Payload SourceFile="Example.FullFramework2MBA\Example.FullFramework2MBA.dll" />
7
+ <Payload SourceFile="Example.FullFramework2MBA\mbanative.dll" />
8
+ <Payload SourceFile="Example.FullFramework2MBA\WixToolset.Mba.Core.dll" />
9
+ <Payload SourceFile="Example.FullFramework2MBA\WixToolset.Mba.Host.config" />
10
+ </BootstrapperApplicationRef>
11
+ <Chain>
12
+ <PackageGroupRef Id="NetFx462RedistAsPrereq" />
13
+ </Chain>
14
+ </Bundle>
15
+</Wix>
src/test/WixToolsetTest.ManagedHost/TestData/FullFramework4MBA/Bundle.wxs
new
+15
@@ -0,0 +1,15 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
3
+ xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
4
+ <Bundle Name="FullFramework4MBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="E08068E0-4FBA-439D-A1C8-4CD1FE27093F">
5
+ <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
6
+ <Payload SourceFile="Example.FullFramework4MBA\net48\Example.FullFramework4MBA.dll" />
7
+ <Payload SourceFile="Example.FullFramework4MBA\net48\mbanative.dll" />
8
+ <Payload SourceFile="Example.FullFramework4MBA\net48\WixToolset.Mba.Core.dll" />
9
+ <Payload SourceFile="Example.FullFramework4MBA\net48\WixToolset.Mba.Host.config" />
10
+ </BootstrapperApplicationRef>
11
+ <Chain>
12
+ <PackageGroupRef Id="NetFx462RedistAsPrereq" />
13
+ </Chain>
14
+ </Bundle>
15
+</Wix>
src/test/WixToolsetTest.ManagedHost/TestEngine.cs
+13
-2
@@ -4,15 +4,26 @@ namespace WixToolsetTest.ManagedHost
4
{
5
using System.Collections.Generic;
6
using System.Diagnostics;
7
+ using System.IO;
8
using WixBuildTools.TestSupport;
9
+ using WixToolset.Core.TestPackage;
10
11
public class TestEngine
12
{
13
private static readonly string TestEngineFile = TestData.Get(@"..\Win32\examples\Example.TestEngine\Example.TestEngine.exe");
14
+ public static readonly string BurnStubFile = TestData.Get(@"runtimes\win-x86\native\burn.x86.exe");
15
13
- public TestEngineResult RunShutdownEngine(string baFile)
16
+ public TestEngineResult RunShutdownEngine(string bundleFilePath, string tempFolderPath)
17
{
15
- var args = new string[] { '"' + baFile + '"' };
18
+ var baFolderPath = Path.Combine(tempFolderPath, "ba");
19
+ var extractFolderPath = Path.Combine(tempFolderPath, "extract");
20
+ var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFilePath, baFolderPath, extractFolderPath);
21
+ extractResult.AssertSuccess();
22
+
23
+ var args = new string[] {
24
+ '"' + bundleFilePath + '"',
25
+ '"' + extractResult.GetBAFilePath(baFolderPath) + '"',
26
+ };
27
return RunProcessCaptureOutput(TestEngineFile, args);
28
}
29
src/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj
+12
@@ -12,15 +12,27 @@
12
</PropertyGroup>
13
14
<ItemGroup>
15
+ <Content Include="TestData\FullFramework2MBA\Bundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
16
+ <Content Include="TestData\FullFramework4MBA\Bundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
17
</ItemGroup>
18
19
+ <Target Name="CopyExtensions" AfterTargets="Build">
20
+ <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(WixExtension)" />
21
+ </Target>
22
+
23
<ItemGroup>
24
<ProjectReference Include="..\examples\FullFramework2MBA\Example.FullFramework2MBA.csproj" />
25
+ <ProjectReference Include="..\examples\FullFramework4MBA\Example.FullFramework4MBA.csproj" />
26
<ProjectReference Include="..\examples\TestEngine\Example.TestEngine.vcxproj" />
27
+ <ProjectReference Include="..\..\wixext\WixToolset.Bal.wixext.csproj" />
28
</ItemGroup>
29
30
<ItemGroup>
31
+ <PackageReference Include="runtime.win.WixToolset.Burn" Version="4.0.*" />
32
<PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" />
33
+ <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" />
34
+ <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" />
35
+ <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" />
36
</ItemGroup>
37
38
<ItemGroup>
src/test/examples/FullFramework2MBA/BootstrapperApplicationData.xml
Binary files a/src/test/examples/FullFramework2MBA/BootstrapperApplicationData.xml and /dev/null differ
src/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj
-21
@@ -28,7 +28,6 @@
28
<Compile Include="Properties\AssemblyInfo.cs" />
29
</ItemGroup>
30
<ItemGroup>
31
- <Content Include="BootstrapperApplicationData.xml" CopyToOutputDirectory="PreserveNewest" />
31
<Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" />
32
</ItemGroup>
33
<ItemGroup>
@@ -43,22 +42,6 @@
42
<HintPath>..\..\..\..\packages\WixToolset.Mba.Core.4.0.18\lib\net20\WixToolset.Mba.Core.dll</HintPath>
43
</Reference>
44
</ItemGroup>
46
- <ItemGroup>
47
- <ProjectReference Include="..\..\..\mbahost\mbahost.vcxproj">
48
- <Project>{12c87c77-3547-44f8-8134-29bc915cb19d}</Project>
49
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
50
- </ProjectReference>
51
- <ProjectReference Include="..\..\..\WixToolset.Mba.Host\WixToolset.Mba.Host.csproj">
52
- <Project>{F2BA1935-70FA-4156-B161-FD03850B4FAA}</Project>
53
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
54
- <OutputItemType>Content</OutputItemType>
55
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
56
- </ProjectReference>
57
- </ItemGroup>
58
-
59
- <ItemGroup>
60
- <MbaHostDependency Include="$(BaseOutputPath)$(Configuration)\Win32\mbahost.dll" />
61
- </ItemGroup>
45
46
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
47
@@ -70,8 +53,4 @@
53
<Error Condition="!Exists('..\..\..\..\packages\WixToolset.Mba.Core.4.0.18\build\net20\WixToolset.Mba.Core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.Mba.Core.4.0.18\build\net20\WixToolset.Mba.Core.props'))" />
54
<Error Condition="!Exists('..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" />
55
</Target>
73
-
74
- <Target Name="CopyMbaHostDependencies" AfterTargets="Build">
75
- <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(MbaHostDependency)" SkipUnchangedFiles="true" />
76
- </Target>
56
</Project>
\ No newline at end of file
src/test/examples/FullFramework2MBA/FullFramework2BA.cs
+7
@@ -16,6 +16,13 @@ namespace Example.FullFramework2MBA
16
{
17
}
18
19
+ protected override void OnStartup(StartupEventArgs args)
20
+ {
21
+ base.OnStartup(args);
22
+
23
+ this.engine.Log(LogLevel.Standard, nameof(FullFramework2BA));
24
+ }
25
+
26
protected override void OnShutdown(ShutdownEventArgs args)
27
{
28
base.OnShutdown(args);
src/test/examples/FullFramework4MBA/BootstrapperApplicationData.xml
Binary files a/src/test/examples/FullFramework4MBA/BootstrapperApplicationData.xml and /dev/null differ
src/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj
+3
-23
@@ -1,5 +1,7 @@
1
-<Project Sdk="Microsoft.NET.Sdk">
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!-- 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. -->
3
4
+<Project Sdk="Microsoft.NET.Sdk">
5
<PropertyGroup>
6
<TargetFramework>net48</TargetFramework>
7
<Description>Full Framework v4 MBA</Description>
@@ -11,28 +13,6 @@
13
</ItemGroup>
14
15
<ItemGroup>
14
- <Content Include="BootstrapperApplicationData.xml" CopyToOutputDirectory="PreserveNewest" />
16
<Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" />
17
</ItemGroup>
17
-
18
- <ItemGroup>
19
- <ProjectReference Include="..\..\..\mbahost\mbahost.vcxproj">
20
- <Project>{12c87c77-3547-44f8-8134-29bc915cb19d}</Project>
21
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
22
- </ProjectReference>
23
- <ProjectReference Include="..\..\..\WixToolset.Mba.Host\WixToolset.Mba.Host.csproj">
24
- <Project>{F2BA1935-70FA-4156-B161-FD03850B4FAA}</Project>
25
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
26
- <OutputItemType>Content</OutputItemType>
27
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
28
- </ProjectReference>
29
- </ItemGroup>
30
-
31
- <ItemGroup>
32
- <MbaHostDependency Include="$(BaseOutputPath)$(Configuration)\Win32\mbahost.dll" />
33
- </ItemGroup>
34
-
35
- <Target Name="CopyMbaHostDependencies" AfterTargets="Build">
36
- <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(MbaHostDependency)" SkipUnchangedFiles="true" />
37
- </Target>
18
</Project>
\ No newline at end of file
src/test/examples/FullFramework4MBA/FullFramework4BA.cs
+7
@@ -16,6 +16,13 @@ namespace Example.FullFramework4MBA
16
{
17
}
18
19
+ protected override void OnStartup(StartupEventArgs args)
20
+ {
21
+ base.OnStartup(args);
22
+
23
+ this.engine.Log(LogLevel.Standard, nameof(FullFramework4BA));
24
+ }
25
+
26
protected override void OnShutdown(ShutdownEventArgs args)
27
{
28
base.OnShutdown(args);
src/test/examples/TestEngine/ExampleTestEngine.cpp
+4
-4
@@ -8,15 +8,15 @@ int __cdecl wmain(int argc, LPWSTR argv[])
8
9
ConsoleInitialize();
10
11
- if (argc != 2)
11
+ if (argc != 3)
12
{
13
- ConsoleWriteError(hr, CONSOLE_COLOR_RED, "Usage: Example.TestEngine.exe BA.dll");
13
+ ConsoleWriteError(hr, CONSOLE_COLOR_RED, "Usage: Example.TestEngine.exe Bundle.exe BA.dll");
14
}
15
else
16
{
17
- hr = RunShutdownEngine(argv[1]);
17
+ hr = RunShutdownEngine(argv[1], argv[2]);
18
}
19
20
ConsoleUninitialize();
21
- return HRESULT_CODE(hr);
21
+ return hr;
22
}
src/test/examples/TestEngine/ShutdownEngine.cpp
+7
-1
@@ -3,6 +3,7 @@
3
#include "precomp.h"
4
5
HRESULT RunShutdownEngine(
6
+ __in LPCWSTR wzBundleFilePath,
7
__in LPCWSTR wzBAFilePath
8
)
9
{
@@ -12,12 +13,17 @@ HRESULT RunShutdownEngine(
13
pTestEngine = new TestEngine();
14
ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine.");
15
15
- hr = pTestEngine->LoadBA(wzBAFilePath);
16
+ hr = pTestEngine->LoadBA(wzBundleFilePath, wzBAFilePath);
17
ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA.");
18
19
+ hr = pTestEngine->SendStartupEvent();
20
+ ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup.");
21
+
22
hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER);
23
ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown.");
24
25
+ pTestEngine->UnloadBA();
26
+
27
LExit:
28
return hr;
29
}
src/test/examples/TestEngine/TestEngine.cpp
+29
-5
@@ -3,13 +3,13 @@
3
#include "precomp.h"
4
5
HRESULT TestEngine::LoadBA(
6
+ __in LPCWSTR wzBundleFilePath,
7
__in LPCWSTR wzBAFilePath
8
)
9
{
10
HRESULT hr = S_OK;
11
BOOTSTRAPPER_COMMAND command = { };
12
BOOTSTRAPPER_CREATE_ARGS args = { };
12
- HMODULE hBAModule = NULL;
13
PFN_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = NULL;
14
15
if (m_pCreateResults)
@@ -19,7 +19,7 @@ HRESULT TestEngine::LoadBA(
19
20
LogInitialize(::GetModuleHandleW(NULL));
21
22
- hr = LogOpen(NULL, L"ExampleTestEngine", NULL, L"txt", FALSE, FALSE, NULL);
22
+ hr = LogOpen(NULL, PathFile(wzBundleFilePath), NULL, L"txt", FALSE, FALSE, NULL);
23
ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to open log.");
24
25
m_pCreateResults = static_cast<BOOTSTRAPPER_CREATE_RESULTS*>(MemAlloc(sizeof(BOOTSTRAPPER_CREATE_RESULTS), TRUE));
@@ -34,10 +34,10 @@ HRESULT TestEngine::LoadBA(
34
35
m_pCreateResults->cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS);
36
37
- hBAModule = ::LoadLibraryExW(wzBAFilePath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
38
- ExitOnNullWithLastError(hBAModule, hr, "Failed to load BA dll.");
37
+ m_hBAModule = ::LoadLibraryExW(wzBAFilePath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
38
+ ExitOnNullWithLastError(m_hBAModule, hr, "Failed to load BA dll.");
39
40
- pfnCreate = (PFN_BOOTSTRAPPER_APPLICATION_CREATE)::GetProcAddress(hBAModule, "BootstrapperApplicationCreate");
40
+ pfnCreate = (PFN_BOOTSTRAPPER_APPLICATION_CREATE)::GetProcAddress(m_hBAModule, "BootstrapperApplicationCreate");
41
ConsoleExitOnNull(pfnCreate, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to get address for BootstrapperApplicationCreate.");
42
43
hr = pfnCreate(&args, m_pCreateResults);
@@ -68,6 +68,29 @@ HRESULT TestEngine::SendShutdownEvent(
68
return hr;
69
}
70
71
+HRESULT TestEngine::SendStartupEvent()
72
+{
73
+ HRESULT hr = S_OK;
74
+ BA_ONSTARTUP_ARGS startupArgs = { };
75
+ BA_ONSTARTUP_RESULTS startupResults = { };
76
+ startupArgs.cbSize = sizeof(BA_ONSTARTUP_ARGS);
77
+ startupResults.cbSize = sizeof(BA_ONSTARTUP_RESULTS);
78
+ hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &startupArgs, &startupResults, m_pCreateResults->pvBootstrapperApplicationProcContext);
79
+ return hr;
80
+}
81
+
82
+void TestEngine::UnloadBA()
83
+{
84
+ PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = NULL;
85
+
86
+ pfnDestroy = (PFN_BOOTSTRAPPER_APPLICATION_DESTROY)::GetProcAddress(m_hBAModule, "BootstrapperApplicationDestroy");
87
+
88
+ if (pfnDestroy)
89
+ {
90
+ pfnDestroy();
91
+ }
92
+}
93
+
94
HRESULT TestEngine::BAEngineLog(
95
__in TestEngine* pContext,
96
__in BAENGINE_LOG_ARGS* pArgs,
@@ -108,6 +131,7 @@ LExit:
131
132
TestEngine::TestEngine()
133
{
134
+ m_hBAModule = NULL;
135
m_pCreateResults = NULL;
136
}
137
src/test/examples/TestEngine/TestEngine.h
+6
@@ -7,6 +7,7 @@ class TestEngine
7
{
8
public:
9
HRESULT LoadBA(
10
+ __in LPCWSTR wzBundleFilePath,
11
__in LPCWSTR wzBAFilePath
12
);
13
@@ -18,6 +19,10 @@ public:
19
__in BOOTSTRAPPER_SHUTDOWN_ACTION defaultAction
20
);
21
22
+ HRESULT SendStartupEvent();
23
+
24
+ void UnloadBA();
25
+
26
private:
27
static HRESULT BAEngineLog(
28
__in TestEngine* pContext,
@@ -38,5 +43,6 @@ public:
43
~TestEngine();
44
45
private:
46
+ HMODULE m_hBAModule;
47
BOOTSTRAPPER_CREATE_RESULTS* m_pCreateResults;
48
};
\ No newline at end of file
src/test/examples/TestEngine/precomp.h
+2
@@ -8,6 +8,7 @@
8
#include "conutil.h"
9
#include "logutil.h"
10
#include "memutil.h"
11
+#include "pathutil.h"
12
13
#include "BootstrapperEngine.h"
14
#include "BootstrapperApplication.h"
@@ -15,5 +16,6 @@
16
#include "TestEngine.h"
17
18
HRESULT RunShutdownEngine(
19
+ __in LPCWSTR wzBundleFilePath,
20
__in LPCWSTR wzBAFilePath
21
);
src/wixstdba/WixStandardBootstrapperApplication.cpp
+5
@@ -3752,6 +3752,11 @@ HRESULT CreateBootstrapperApplication(
3752
HRESULT hr = S_OK;
3753
CWixStandardBootstrapperApplication* pApplication = NULL;
3754
3755
+ if (BOOTSTRAPPER_DISPLAY_UNKNOWN == pArgs->pCommand->display)
3756
+ {
3757
+ ExitOnFailure(hr = E_INVALIDARG, "Engine requested Unknown display type.");
3758
+ }
3759
+
3760
pApplication = new CWixStandardBootstrapperApplication(hModule, fPrereq, hrHostInitialization, pEngine, pArgs);
3761
ExitOnNull(pApplication, hr, E_OUTOFMEMORY, "Failed to create new standard bootstrapper application object.");
3762