From d5985a1688bc878e42ffd3ce3939fa52303cab16 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 13 May 2022 15:39:40 -0500 Subject: Add option to hosts to always install prereqs. Add PrereqPackage to BundlePackage Implements 4718 --- .../TestData/PrereqBaTests/BundleA/BundleA.wixproj | 5 +- .../TestData/PrereqBaTests/BundleA/BundleA.wxs | 12 +++- .../TestData/PrereqBaTests/BundleB/BundleB.wixproj | 5 +- .../TestData/PrereqBaTests/BundleB/BundleB.wxs | 12 +++- .../TestData/PrereqBaTests/BundleC/BundleC.wixproj | 24 +++++++ .../TestData/PrereqBaTests/BundleC/BundleC.wxs | 30 ++++++++ .../PrereqBaTests/BundleC/bad.runtimeconfig.json | 10 +++ .../TestData/PrereqBaTests/BundleD/BundleD.wixproj | 24 +++++++ .../TestData/PrereqBaTests/BundleD/BundleD.wxs | 29 ++++++++ .../burn/TestData/PrereqBaTests/BundleD/bad.config | 17 +++++ .../TestData/PrereqBaTests/BundleE/BundleE.wixproj | 22 ++++++ .../TestData/PrereqBaTests/BundleE/BundleE.wxs | 26 +++++++ .../PrereqBaTests/PackageC/PackageC.wixproj | 9 +++ .../PrereqBaTests/PackageF/PackageF.wixproj | 12 ---- .../TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp | 79 ++++++++++++++++++++++ .../TestData/PrereqBaTests/PrereqBaf/PrereqBaf.def | 6 ++ .../PrereqBaTests/PrereqBaf/PrereqBaf.vcxproj | 66 ++++++++++++++++++ .../TestData/PrereqBaTests/PrereqBaf/precomp.cpp | 48 +++++++++++++ .../TestData/PrereqBaTests/PrereqBaf/precomp.h | 31 +++++++++ .../PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp | 33 +++++++++ .../ReplaceConfig/ReplaceConfig.vcxproj | 63 +++++++++++++++++ .../PrereqBaTests/ReplaceConfig/precomp.cpp | 3 + .../TestData/PrereqBaTests/ReplaceConfig/precomp.h | 17 +++++ 23 files changed, 565 insertions(+), 18 deletions(-) create mode 100644 src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj create mode 100644 src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs create mode 100644 src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json create mode 100644 src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj create mode 100644 src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs create mode 100644 src/test/burn/TestData/PrereqBaTests/BundleD/bad.config create mode 100644 src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wixproj create mode 100644 src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs create mode 100644 src/test/burn/TestData/PrereqBaTests/PackageC/PackageC.wixproj delete mode 100644 src/test/burn/TestData/PrereqBaTests/PackageF/PackageF.wixproj create mode 100644 src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp create mode 100644 src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.def create mode 100644 src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.vcxproj create mode 100644 src/test/burn/TestData/PrereqBaTests/PrereqBaf/precomp.cpp create mode 100644 src/test/burn/TestData/PrereqBaTests/PrereqBaf/precomp.h create mode 100644 src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp create mode 100644 src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.vcxproj create mode 100644 src/test/burn/TestData/PrereqBaTests/ReplaceConfig/precomp.cpp create mode 100644 src/test/burn/TestData/PrereqBaTests/ReplaceConfig/precomp.h (limited to 'src/test/burn/TestData') diff --git a/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wixproj b/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wixproj index 0199f91f..b084997c 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wixproj +++ b/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wixproj @@ -13,9 +13,12 @@ - + + + + \ No newline at end of file diff --git a/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs b/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs index 682f0bd7..6073e09f 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs +++ b/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs @@ -1,22 +1,30 @@  - + + + + + + + - + diff --git a/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wixproj b/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wixproj index d4288d4b..843b382a 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wixproj +++ b/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wixproj @@ -13,9 +13,12 @@ - + + + + \ No newline at end of file diff --git a/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs b/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs index 603c3aee..b7742582 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs +++ b/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs @@ -1,21 +1,29 @@  - + + + + + + + - + diff --git a/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj new file mode 100644 index 00000000..81641f66 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj @@ -0,0 +1,24 @@ + + + + Bundle + BrokenDncAlwaysPrereq + {D2763AB7-979B-485C-AE52-DD03C23CCB93} + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs new file mode 100644 index 00000000..fe9425f7 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json b/src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json new file mode 100644 index 00000000..07a1a830 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json @@ -0,0 +1,10 @@ +{ + "runtimeOptions": { + "tfm": "net5.5", + "rollForward": "Disable", + "framework": { + "name": "Microsoft.WindowsDesktop.App", + "version": "5.5.0" + } + } +} \ No newline at end of file diff --git a/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj new file mode 100644 index 00000000..314fe2e2 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj @@ -0,0 +1,24 @@ + + + + Bundle + BrokenMbaAlwaysPrereq + {415CA128-60E1-4D16-ACE8-A1D43E98B997} + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs new file mode 100644 index 00000000..0e866295 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/burn/TestData/PrereqBaTests/BundleD/bad.config b/src/test/burn/TestData/PrereqBaTests/BundleD/bad.config new file mode 100644 index 00000000..1512e59a --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleD/bad.config @@ -0,0 +1,17 @@ + + + + + + + +
+ + + + + + + + + diff --git a/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wixproj b/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wixproj new file mode 100644 index 00000000..5d271f55 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wixproj @@ -0,0 +1,22 @@ + + + + Bundle + DncAlwaysPrereq + {2F61ECD8-C28B-4FF9-9609-0E9633716CF9} + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs b/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs new file mode 100644 index 00000000..5f2e6a75 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/burn/TestData/PrereqBaTests/PackageC/PackageC.wixproj b/src/test/burn/TestData/PrereqBaTests/PackageC/PackageC.wixproj new file mode 100644 index 00000000..1c8c4fa8 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/PackageC/PackageC.wixproj @@ -0,0 +1,9 @@ + + + + {7DEEE928-CD7F-49AD-8000-2ED6339D8A78} + + + + + \ No newline at end of file diff --git a/src/test/burn/TestData/PrereqBaTests/PackageF/PackageF.wixproj b/src/test/burn/TestData/PrereqBaTests/PackageF/PackageF.wixproj deleted file mode 100644 index 00ffb7d8..00000000 --- a/src/test/burn/TestData/PrereqBaTests/PackageF/PackageF.wixproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - {7DEEE928-CD7F-49AD-8000-2ED6339D8A78} - - - - - - - - \ No newline at end of file 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 @@ +// 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. + +#include "precomp.h" +#include "BalBaseBAFunctions.h" +#include "BalBaseBAFunctionsProc.h" + +class CPrereqBaf : public CBalBaseBAFunctions +{ +public: // IBAFunctions + +public: //IBootstrapperApplication + + virtual STDMETHODIMP OnDetectBegin( + __in BOOL /*fCached*/, + __in BOOTSTRAPPER_REGISTRATION_TYPE /*registrationType*/, + __in DWORD /*cPackages*/, + __inout BOOL* /*pfCancel*/ + ) + { + HRESULT hr = S_OK; + + hr = m_pEngine->SetVariableString(L"BARuntimeDirectory", m_command.wzBootstrapperWorkingFolder, FALSE); + ExitOnFailure(hr, "Failed to set BARuntimeDirectory"); + + LExit: + return hr; + } + +private: + +public: + // + // Constructor - initialize member variables. + // + CPrereqBaf( + __in HMODULE hModule, + __in IBootstrapperEngine* pEngine, + __in const BA_FUNCTIONS_CREATE_ARGS* pArgs + ) : CBalBaseBAFunctions(hModule, pEngine, pArgs) + { + } + + // + // Destructor - release member variables. + // + ~CPrereqBaf() + { + } + +private: +}; + + +HRESULT WINAPI CreateBAFunctions( + __in HMODULE hModule, + __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, + __inout BA_FUNCTIONS_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + CPrereqBaf* pBAFunctions = NULL; + IBootstrapperEngine* pEngine = NULL; + + hr = BalInitializeFromCreateArgs(pArgs->pBootstrapperCreateArgs, &pEngine); + ExitOnFailure(hr, "Failed to initialize Bal."); + + pBAFunctions = new CPrereqBaf(hModule, pEngine, pArgs); + ExitOnNull(pBAFunctions, hr, E_OUTOFMEMORY, "Failed to create new CPrereqBaf object."); + + pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; + pResults->pvBAFunctionsProcContext = pBAFunctions; + pBAFunctions = NULL; + +LExit: + ReleaseObject(pBAFunctions); + ReleaseObject(pEngine); + + return hr; +} 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 @@ +; 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. + + +EXPORTS + BAFunctionsCreate + 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 @@ + + + + + + + Debug + ARM64 + + + Release + ARM64 + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + {C0A11DDB-6CCE-44EC-88FD-93910C2916E3} + DynamicLibrary + Unicode + PrereqBaf + PrereqBaf.def + true + + + + + + + comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib + + + + + Create + + + + + + + + + + + + + + + + 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 @@ +// 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. + +#include "precomp.h" + +static HINSTANCE vhInstance = NULL; + +extern "C" BOOL WINAPI DllMain( + IN HINSTANCE hInstance, + IN DWORD dwReason, + IN LPVOID /* pvReserved */ + ) +{ + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + ::DisableThreadLibraryCalls(hInstance); + vhInstance = hInstance; + break; + + case DLL_PROCESS_DETACH: + vhInstance = NULL; + break; + } + + return TRUE; +} + +extern "C" HRESULT WINAPI BAFunctionsCreate( + __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, + __inout BA_FUNCTIONS_CREATE_RESULTS* pResults + ) +{ + HRESULT hr = S_OK; + + hr = CreateBAFunctions(vhInstance, pArgs, pResults); + BalExitOnFailure(hr, "Failed to create BAFunctions interface."); + +LExit: + return hr; +} + +extern "C" void WINAPI BAFunctionsDestroy( + __in const BA_FUNCTIONS_DESTROY_ARGS* /*pArgs*/, + __inout BA_FUNCTIONS_DESTROY_RESULTS* /*pResults*/ + ) +{ + BalUninitialize(); +} 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 @@ +#pragma once +// 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. + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dutil.h" +#include "dictutil.h" +#include "fileutil.h" +#include "locutil.h" +#include "pathutil.h" +#include "strutil.h" + +#include "BalBaseBootstrapperApplication.h" +#include "balutil.h" + +#include "BAFunctions.h" +#include "IBAFunctions.h" + +HRESULT WINAPI CreateBAFunctions( + __in HMODULE hModule, + __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, + __inout BA_FUNCTIONS_CREATE_RESULTS* pResults + ); diff --git a/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp new file mode 100644 index 00000000..1fa71bc2 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp @@ -0,0 +1,33 @@ +// 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. + +#include "precomp.h" + +int __cdecl wmain( + __in int argc, + __in LPWSTR argv[] + ) +{ + HRESULT hr = S_OK; + DWORD dwExitCode = 0; + LPCWSTR wzDestinationFile = argc > 1 ? argv[1] : NULL; + LPCWSTR wzGoodFile = argc > 2 ? argv[2] : NULL; + LPCWSTR wzBadFile = argc > 3 ? argv[3] : NULL; + + if (argc != 4) + { + ExitWithRootFailure(hr, E_INVALIDARG, "Invalid args"); + } + + if (!::MoveFileW(wzDestinationFile, wzBadFile)) + { + ExitWithLastError(hr, "Failed to move bad file"); + } + + if (!::MoveFileW(wzGoodFile, wzDestinationFile)) + { + ExitWithLastError(hr, "Failed to move good file"); + } + +LExit: + return FAILED(hr) ? (int)hr : (int)dwExitCode; +} diff --git a/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.vcxproj b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.vcxproj new file mode 100644 index 00000000..c5d7b046 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.vcxproj @@ -0,0 +1,63 @@ + + + + + + + Debug + ARM64 + + + Release + ARM64 + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + {3D10A07D-3321-4F8E-B884-951F8FB5D636} + Application + Console + Unicode + ReplaceConfig + true + + + + + + + comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib + + + + + Create + + + + + + + + + + + + + diff --git a/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/precomp.cpp b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/precomp.cpp @@ -0,0 +1,3 @@ +// 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. + +#include "precomp.h" diff --git a/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/precomp.h b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/precomp.h new file mode 100644 index 00000000..f4180c2e --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/precomp.h @@ -0,0 +1,17 @@ +#pragma once +// 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. + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dutil.h" +#include "fileutil.h" +#include "pathutil.h" +#include "strutil.h" -- cgit v1.2.3-55-g6feb