diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-05-13 15:39:40 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-05-14 11:12:31 -0500 |
| commit | d5985a1688bc878e42ffd3ce3939fa52303cab16 (patch) | |
| tree | 0c283fe5454659c569317b37840a040474cfa032 /src/test/burn/TestData/PrereqBaTests/PrereqBaf | |
| parent | 6a6974a15deb6edf593736cdb8043bfb93064782 (diff) | |
| download | wix-d5985a1688bc878e42ffd3ce3939fa52303cab16.tar.gz wix-d5985a1688bc878e42ffd3ce3939fa52303cab16.tar.bz2 wix-d5985a1688bc878e42ffd3ce3939fa52303cab16.zip | |
Add option to hosts to always install prereqs.
Add PrereqPackage to BundlePackage
Implements 4718
Diffstat (limited to 'src/test/burn/TestData/PrereqBaTests/PrereqBaf')
5 files changed, 230 insertions, 0 deletions
diff --git a/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp new file mode 100644 index 00000000..35949eb9 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp | |||
| @@ -0,0 +1,79 @@ | |||
| 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 | #include "precomp.h" | ||
| 4 | #include "BalBaseBAFunctions.h" | ||
| 5 | #include "BalBaseBAFunctionsProc.h" | ||
| 6 | |||
| 7 | class CPrereqBaf : public CBalBaseBAFunctions | ||
| 8 | { | ||
| 9 | public: // IBAFunctions | ||
| 10 | |||
| 11 | public: //IBootstrapperApplication | ||
| 12 | |||
| 13 | virtual STDMETHODIMP OnDetectBegin( | ||
| 14 | __in BOOL /*fCached*/, | ||
| 15 | __in BOOTSTRAPPER_REGISTRATION_TYPE /*registrationType*/, | ||
| 16 | __in DWORD /*cPackages*/, | ||
| 17 | __inout BOOL* /*pfCancel*/ | ||
| 18 | ) | ||
| 19 | { | ||
| 20 | HRESULT hr = S_OK; | ||
| 21 | |||
| 22 | hr = m_pEngine->SetVariableString(L"BARuntimeDirectory", m_command.wzBootstrapperWorkingFolder, FALSE); | ||
| 23 | ExitOnFailure(hr, "Failed to set BARuntimeDirectory"); | ||
| 24 | |||
| 25 | LExit: | ||
| 26 | return hr; | ||
| 27 | } | ||
| 28 | |||
| 29 | private: | ||
| 30 | |||
| 31 | public: | ||
| 32 | // | ||
| 33 | // Constructor - initialize member variables. | ||
| 34 | // | ||
| 35 | CPrereqBaf( | ||
| 36 | __in HMODULE hModule, | ||
| 37 | __in IBootstrapperEngine* pEngine, | ||
| 38 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs | ||
| 39 | ) : CBalBaseBAFunctions(hModule, pEngine, pArgs) | ||
| 40 | { | ||
| 41 | } | ||
| 42 | |||
| 43 | // | ||
| 44 | // Destructor - release member variables. | ||
| 45 | // | ||
| 46 | ~CPrereqBaf() | ||
| 47 | { | ||
| 48 | } | ||
| 49 | |||
| 50 | private: | ||
| 51 | }; | ||
| 52 | |||
| 53 | |||
| 54 | HRESULT WINAPI CreateBAFunctions( | ||
| 55 | __in HMODULE hModule, | ||
| 56 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, | ||
| 57 | __inout BA_FUNCTIONS_CREATE_RESULTS* pResults | ||
| 58 | ) | ||
| 59 | { | ||
| 60 | HRESULT hr = S_OK; | ||
| 61 | CPrereqBaf* pBAFunctions = NULL; | ||
| 62 | IBootstrapperEngine* pEngine = NULL; | ||
| 63 | |||
| 64 | hr = BalInitializeFromCreateArgs(pArgs->pBootstrapperCreateArgs, &pEngine); | ||
| 65 | ExitOnFailure(hr, "Failed to initialize Bal."); | ||
| 66 | |||
| 67 | pBAFunctions = new CPrereqBaf(hModule, pEngine, pArgs); | ||
| 68 | ExitOnNull(pBAFunctions, hr, E_OUTOFMEMORY, "Failed to create new CPrereqBaf object."); | ||
| 69 | |||
| 70 | pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; | ||
| 71 | pResults->pvBAFunctionsProcContext = pBAFunctions; | ||
| 72 | pBAFunctions = NULL; | ||
| 73 | |||
| 74 | LExit: | ||
| 75 | ReleaseObject(pBAFunctions); | ||
| 76 | ReleaseObject(pEngine); | ||
| 77 | |||
| 78 | return hr; | ||
| 79 | } | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.def b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.def new file mode 100644 index 00000000..6e016dad --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.def | |||
| @@ -0,0 +1,6 @@ | |||
| 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 | |||
| 4 | EXPORTS | ||
| 5 | BAFunctionsCreate | ||
| 6 | BAFunctionsDestroy | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.vcxproj b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.vcxproj new file mode 100644 index 00000000..0d8d63be --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.vcxproj | |||
| @@ -0,0 +1,66 @@ | |||
| 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 DefaultTargets="Build" Toolsxmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| 5 | <ItemGroup Label="ProjectConfigurations"> | ||
| 6 | <ProjectConfiguration Include="Debug|ARM64"> | ||
| 7 | <Configuration>Debug</Configuration> | ||
| 8 | <Platform>ARM64</Platform> | ||
| 9 | </ProjectConfiguration> | ||
| 10 | <ProjectConfiguration Include="Release|ARM64"> | ||
| 11 | <Configuration>Release</Configuration> | ||
| 12 | <Platform>ARM64</Platform> | ||
| 13 | </ProjectConfiguration> | ||
| 14 | <ProjectConfiguration Include="Debug|Win32"> | ||
| 15 | <Configuration>Debug</Configuration> | ||
| 16 | <Platform>Win32</Platform> | ||
| 17 | </ProjectConfiguration> | ||
| 18 | <ProjectConfiguration Include="Release|Win32"> | ||
| 19 | <Configuration>Release</Configuration> | ||
| 20 | <Platform>Win32</Platform> | ||
| 21 | </ProjectConfiguration> | ||
| 22 | <ProjectConfiguration Include="Debug|x64"> | ||
| 23 | <Configuration>Debug</Configuration> | ||
| 24 | <Platform>x64</Platform> | ||
| 25 | </ProjectConfiguration> | ||
| 26 | <ProjectConfiguration Include="Release|x64"> | ||
| 27 | <Configuration>Release</Configuration> | ||
| 28 | <Platform>x64</Platform> | ||
| 29 | </ProjectConfiguration> | ||
| 30 | </ItemGroup> | ||
| 31 | |||
| 32 | <PropertyGroup Label="Globals"> | ||
| 33 | <ProjectGuid>{C0A11DDB-6CCE-44EC-88FD-93910C2916E3}</ProjectGuid> | ||
| 34 | <ConfigurationType>DynamicLibrary</ConfigurationType> | ||
| 35 | <CharacterSet>Unicode</CharacterSet> | ||
| 36 | <TargetName>PrereqBaf</TargetName> | ||
| 37 | <ProjectModuleDefinitionFile>PrereqBaf.def</ProjectModuleDefinitionFile> | ||
| 38 | <IsWixTestProject>true</IsWixTestProject> | ||
| 39 | </PropertyGroup> | ||
| 40 | |||
| 41 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
| 42 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
| 43 | |||
| 44 | <PropertyGroup> | ||
| 45 | <ProjectAdditionalLinkLibraries>comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib</ProjectAdditionalLinkLibraries> | ||
| 46 | </PropertyGroup> | ||
| 47 | |||
| 48 | <ItemGroup> | ||
| 49 | <ClCompile Include="precomp.cpp"> | ||
| 50 | <PrecompiledHeader>Create</PrecompiledHeader> | ||
| 51 | </ClCompile> | ||
| 52 | <ClCompile Include="PrereqBaf.cpp" /> | ||
| 53 | </ItemGroup> | ||
| 54 | <ItemGroup> | ||
| 55 | <ClInclude Include="precomp.h" /> | ||
| 56 | </ItemGroup> | ||
| 57 | <ItemGroup> | ||
| 58 | <None Include="PrereqBaf.def" /> | ||
| 59 | </ItemGroup> | ||
| 60 | |||
| 61 | <ItemGroup> | ||
| 62 | <PackageReference Include="WixToolset.BalUtil" /> | ||
| 63 | </ItemGroup> | ||
| 64 | |||
| 65 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
| 66 | </Project> | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/PrereqBaf/precomp.cpp b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/precomp.cpp new file mode 100644 index 00000000..fc9d1177 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/precomp.cpp | |||
| @@ -0,0 +1,48 @@ | |||
| 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 | #include "precomp.h" | ||
| 4 | |||
| 5 | static HINSTANCE vhInstance = NULL; | ||
| 6 | |||
| 7 | extern "C" BOOL WINAPI DllMain( | ||
| 8 | IN HINSTANCE hInstance, | ||
| 9 | IN DWORD dwReason, | ||
| 10 | IN LPVOID /* pvReserved */ | ||
| 11 | ) | ||
| 12 | { | ||
| 13 | switch (dwReason) | ||
| 14 | { | ||
| 15 | case DLL_PROCESS_ATTACH: | ||
| 16 | ::DisableThreadLibraryCalls(hInstance); | ||
| 17 | vhInstance = hInstance; | ||
| 18 | break; | ||
| 19 | |||
| 20 | case DLL_PROCESS_DETACH: | ||
| 21 | vhInstance = NULL; | ||
| 22 | break; | ||
| 23 | } | ||
| 24 | |||
| 25 | return TRUE; | ||
| 26 | } | ||
| 27 | |||
| 28 | extern "C" HRESULT WINAPI BAFunctionsCreate( | ||
| 29 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, | ||
| 30 | __inout BA_FUNCTIONS_CREATE_RESULTS* pResults | ||
| 31 | ) | ||
| 32 | { | ||
| 33 | HRESULT hr = S_OK; | ||
| 34 | |||
| 35 | hr = CreateBAFunctions(vhInstance, pArgs, pResults); | ||
| 36 | BalExitOnFailure(hr, "Failed to create BAFunctions interface."); | ||
| 37 | |||
| 38 | LExit: | ||
| 39 | return hr; | ||
| 40 | } | ||
| 41 | |||
| 42 | extern "C" void WINAPI BAFunctionsDestroy( | ||
| 43 | __in const BA_FUNCTIONS_DESTROY_ARGS* /*pArgs*/, | ||
| 44 | __inout BA_FUNCTIONS_DESTROY_RESULTS* /*pResults*/ | ||
| 45 | ) | ||
| 46 | { | ||
| 47 | BalUninitialize(); | ||
| 48 | } | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/PrereqBaf/precomp.h b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/precomp.h new file mode 100644 index 00000000..8320bdd8 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/precomp.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #pragma once | ||
| 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 | |||
| 5 | #include <windows.h> | ||
| 6 | #include <msiquery.h> | ||
| 7 | #include <objbase.h> | ||
| 8 | #include <shlobj.h> | ||
| 9 | #include <shlwapi.h> | ||
| 10 | #include <stdlib.h> | ||
| 11 | #include <strsafe.h> | ||
| 12 | #include <CommCtrl.h> | ||
| 13 | |||
| 14 | #include "dutil.h" | ||
| 15 | #include "dictutil.h" | ||
| 16 | #include "fileutil.h" | ||
| 17 | #include "locutil.h" | ||
| 18 | #include "pathutil.h" | ||
| 19 | #include "strutil.h" | ||
| 20 | |||
| 21 | #include "BalBaseBootstrapperApplication.h" | ||
| 22 | #include "balutil.h" | ||
| 23 | |||
| 24 | #include "BAFunctions.h" | ||
| 25 | #include "IBAFunctions.h" | ||
| 26 | |||
| 27 | HRESULT WINAPI CreateBAFunctions( | ||
| 28 | __in HMODULE hModule, | ||
| 29 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, | ||
| 30 | __inout BA_FUNCTIONS_CREATE_RESULTS* pResults | ||
| 31 | ); | ||
