From 5baa1dfe8ba2a3bd4728bca118fe1de225f848d4 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 7 Mar 2024 09:41:29 -0800 Subject: Rename "bundle extension" to "bootstrapper extension" for more consistency Also renames WixToolet.BextUtil nupkg to WixToolset.BootstrapperExtensionApi. --- src/api/api.cmd | 2 + .../bextutil/BextBootstrapperExtensionEngine.cpp | 373 +++++++++++++++++++++ .../burn/bextutil/BextBundleExtensionEngine.cpp | 373 --------------------- src/api/burn/bextutil/bextutil.cpp | 46 +-- src/api/burn/bextutil/bextutil.nuspec | 4 +- src/api/burn/bextutil/bextutil.vcxproj | 16 +- .../burn/bextutil/build/WixToolset.BextUtil.props | 18 - .../WixToolset.BootstrapperExtensionApi.props | 18 + .../bextutil/inc/BextBaseBootstrapperExtension.h | 115 +++++++ .../inc/BextBaseBootstrapperExtensionProc.h | 46 +++ .../burn/bextutil/inc/BextBaseBundleExtension.h | 115 ------- .../bextutil/inc/BextBaseBundleExtensionProc.h | 46 --- .../bextutil/inc/BextBootstrapperExtensionEngine.h | 20 ++ .../burn/bextutil/inc/BextBundleExtensionEngine.h | 20 -- src/api/burn/bextutil/inc/IBootstrapperExtension.h | 21 ++ .../bextutil/inc/IBootstrapperExtensionEngine.h | 75 +++++ src/api/burn/bextutil/inc/IBundleExtension.h | 21 -- src/api/burn/bextutil/inc/IBundleExtensionEngine.h | 75 ----- src/api/burn/bextutil/inc/bextutil.h | 24 +- src/api/burn/bextutil/precomp.h | 2 +- src/api/burn/inc/BootstrapperExtension.h | 61 ++++ src/api/burn/inc/BootstrapperExtensionEngine.h | 200 +++++++++++ src/api/burn/inc/BundleExtension.h | 61 ---- src/api/burn/inc/BundleExtensionEngine.h | 200 ----------- .../test/BextUtilUnitTest/BextUtilUnitTest.vcxproj | 6 +- .../BextUtilUnitTest.vcxproj.filters | 8 +- .../BootstrapperExtensionTests.cpp | 44 +++ .../test/BextUtilUnitTest/BundleExtensionTests.cpp | 44 --- .../BextUtilUnitTest/TestBootstrapperExtension.cpp | 42 +++ .../BextUtilUnitTest/TestBootstrapperExtension.h | 9 + .../test/BextUtilUnitTest/TestBundleExtension.cpp | 42 --- .../test/BextUtilUnitTest/TestBundleExtension.h | 9 - src/api/burn/test/BextUtilUnitTest/precomp.h | 2 +- src/api/wix/WixToolset.Data/Burn/BurnConstants.cs | 6 +- .../WixToolset.Data/Symbols/SymbolDefinitions.cs | 6 +- .../Symbols/WixBootstrapperExtensionSymbol.cs | 44 +++ .../Symbols/WixBundleCustomDataSymbol.cs | 12 +- .../Symbols/WixBundleExtensionSymbol.cs | 44 --- .../wix/WixToolset.Data/Symbols/WixSearchSymbol.cs | 12 +- .../Services/IBurnBackendHelper.cs | 8 +- .../Services/IParseHelper.cs | 4 +- 41 files changed, 1148 insertions(+), 1146 deletions(-) create mode 100644 src/api/burn/bextutil/BextBootstrapperExtensionEngine.cpp delete mode 100644 src/api/burn/bextutil/BextBundleExtensionEngine.cpp delete mode 100644 src/api/burn/bextutil/build/WixToolset.BextUtil.props create mode 100644 src/api/burn/bextutil/build/WixToolset.BootstrapperExtensionApi.props create mode 100644 src/api/burn/bextutil/inc/BextBaseBootstrapperExtension.h create mode 100644 src/api/burn/bextutil/inc/BextBaseBootstrapperExtensionProc.h delete mode 100644 src/api/burn/bextutil/inc/BextBaseBundleExtension.h delete mode 100644 src/api/burn/bextutil/inc/BextBaseBundleExtensionProc.h create mode 100644 src/api/burn/bextutil/inc/BextBootstrapperExtensionEngine.h delete mode 100644 src/api/burn/bextutil/inc/BextBundleExtensionEngine.h create mode 100644 src/api/burn/bextutil/inc/IBootstrapperExtension.h create mode 100644 src/api/burn/bextutil/inc/IBootstrapperExtensionEngine.h delete mode 100644 src/api/burn/bextutil/inc/IBundleExtension.h delete mode 100644 src/api/burn/bextutil/inc/IBundleExtensionEngine.h create mode 100644 src/api/burn/inc/BootstrapperExtension.h create mode 100644 src/api/burn/inc/BootstrapperExtensionEngine.h delete mode 100644 src/api/burn/inc/BundleExtension.h delete mode 100644 src/api/burn/inc/BundleExtensionEngine.h create mode 100644 src/api/burn/test/BextUtilUnitTest/BootstrapperExtensionTests.cpp delete mode 100644 src/api/burn/test/BextUtilUnitTest/BundleExtensionTests.cpp create mode 100644 src/api/burn/test/BextUtilUnitTest/TestBootstrapperExtension.cpp create mode 100644 src/api/burn/test/BextUtilUnitTest/TestBootstrapperExtension.h delete mode 100644 src/api/burn/test/BextUtilUnitTest/TestBundleExtension.cpp delete mode 100644 src/api/burn/test/BextUtilUnitTest/TestBundleExtension.h create mode 100644 src/api/wix/WixToolset.Data/Symbols/WixBootstrapperExtensionSymbol.cs delete mode 100644 src/api/wix/WixToolset.Data/Symbols/WixBundleExtensionSymbol.cs (limited to 'src/api') diff --git a/src/api/api.cmd b/src/api/api.cmd index 42453449..cae0cf5a 100644 --- a/src/api/api.cmd +++ b/src/api/api.cmd @@ -41,11 +41,13 @@ dotnet test ^ @del "..\..\build\artifacts\WixToolset.Data.*.nupkg" 2> nul @del "..\..\build\artifacts\WixToolset.Extensibility.*.nupkg" 2> nul @del "..\..\build\artifacts\WixToolset.BootstrapperApplicationApi.*.nupkg" 2> nul +@del "..\..\build\artifacts\WixToolset.BootstrapperExtensionApi.*.nupkg" 2> nul @del "%_L%\TestResults\api.trx" 2> nul @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.bextutil" 2> nul @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.data" 2> nul @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.extensibility" 2> nul @rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.bootstrapperapplicationapi" 2> nul +@rd /s/q "%USERPROFILE%\.nuget\packages\wixtoolset.bootstrapperextensionapi" 2> nul @exit /b :end diff --git a/src/api/burn/bextutil/BextBootstrapperExtensionEngine.cpp b/src/api/burn/bextutil/BextBootstrapperExtensionEngine.cpp new file mode 100644 index 00000000..a5e40c8e --- /dev/null +++ b/src/api/burn/bextutil/BextBootstrapperExtensionEngine.cpp @@ -0,0 +1,373 @@ +// 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" + + +class CBextBootstrapperExtensionEngine : public IBootstrapperExtensionEngine +{ +public: // IUnknown + virtual STDMETHODIMP QueryInterface( + __in REFIID riid, + __out LPVOID *ppvObject + ) + { + if (!ppvObject) + { + return E_INVALIDARG; + } + + *ppvObject = NULL; + + if (::IsEqualIID(__uuidof(IBootstrapperExtensionEngine), riid)) + { + *ppvObject = static_cast(this); + } + else if (::IsEqualIID(IID_IUnknown, riid)) + { + *ppvObject = reinterpret_cast(this); + } + else // no interface for requested iid + { + return E_NOINTERFACE; + } + + AddRef(); + return S_OK; + } + + virtual STDMETHODIMP_(ULONG) AddRef() + { + return ::InterlockedIncrement(&this->m_cReferences); + } + + virtual STDMETHODIMP_(ULONG) Release() + { + long l = ::InterlockedDecrement(&this->m_cReferences); + if (0 < l) + { + return l; + } + + delete this; + return 0; + } + +public: // IBootstrapperExtensionEngine + virtual STDMETHODIMP EscapeString( + __in_z LPCWSTR wzIn, + __out_ecount_opt(*pcchOut) LPWSTR wzOut, + __inout SIZE_T* pcchOut + ) + { + HRESULT hr = S_OK; + BOOTSTRAPPER_EXTENSION_ENGINE_ESCAPESTRING_ARGS args = { }; + BOOTSTRAPPER_EXTENSION_ENGINE_ESCAPESTRING_RESULTS results = { }; + + ExitOnNull(pcchOut, hr, E_INVALIDARG, "pcchOut is required"); + + args.cbSize = sizeof(args); + args.wzIn = wzIn; + + results.cbSize = sizeof(results); + results.wzOut = wzOut; + results.cchOut = *pcchOut; + + hr = m_pfnBootstrapperExtensionEngineProc(BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_ESCAPESTRING, &args, &results, m_pvBootstrapperExtensionEngineProcContext); + + *pcchOut = results.cchOut; + + LExit: + return hr; + } + + virtual STDMETHODIMP EvaluateCondition( + __in_z LPCWSTR wzCondition, + __out BOOL* pf + ) + { + HRESULT hr = S_OK; + BOOTSTRAPPER_EXTENSION_ENGINE_EVALUATECONDITION_ARGS args = { }; + BOOTSTRAPPER_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS results = { }; + + ExitOnNull(pf, hr, E_INVALIDARG, "pf is required"); + + args.cbSize = sizeof(args); + args.wzCondition = wzCondition; + + results.cbSize = sizeof(results); + + hr = m_pfnBootstrapperExtensionEngineProc(BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_EVALUATECONDITION, &args, &results, m_pvBootstrapperExtensionEngineProcContext); + + *pf = results.f; + + LExit: + return hr; + } + + virtual STDMETHODIMP FormatString( + __in_z LPCWSTR wzIn, + __out_ecount_opt(*pcchOut) LPWSTR wzOut, + __inout SIZE_T* pcchOut + ) + { + HRESULT hr = S_OK; + BOOTSTRAPPER_EXTENSION_ENGINE_FORMATSTRING_ARGS args = { }; + BOOTSTRAPPER_EXTENSION_ENGINE_FORMATSTRING_RESULTS results = { }; + + ExitOnNull(pcchOut, hr, E_INVALIDARG, "pcchOut is required"); + + args.cbSize = sizeof(args); + args.wzIn = wzIn; + + results.cbSize = sizeof(results); + results.wzOut = wzOut; + results.cchOut = *pcchOut; + + hr = m_pfnBootstrapperExtensionEngineProc(BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_FORMATSTRING, &args, &results, m_pvBootstrapperExtensionEngineProcContext); + + *pcchOut = results.cchOut; + + LExit: + return hr; + } + + virtual STDMETHODIMP GetVariableNumeric( + __in_z LPCWSTR wzVariable, + __out LONGLONG* pllValue + ) + { + HRESULT hr = S_OK; + BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS args = { }; + BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS results = { }; + + ExitOnNull(pllValue, hr, E_INVALIDARG, "pllValue is required"); + + args.cbSize = sizeof(args); + args.wzVariable = wzVariable; + + results.cbSize = sizeof(results); + + hr = m_pfnBootstrapperExtensionEngineProc(BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_GETVARIABLENUMERIC, &args, &results, m_pvBootstrapperExtensionEngineProcContext); + + *pllValue = results.llValue; + + LExit: + SecureZeroMemory(&results, sizeof(results)); + return hr; + } + + virtual STDMETHODIMP GetVariableString( + __in_z LPCWSTR wzVariable, + __out_ecount_opt(*pcchValue) LPWSTR wzValue, + __inout SIZE_T* pcchValue + ) + { + HRESULT hr = S_OK; + BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS args = { }; + BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS results = { }; + + ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required"); + + args.cbSize = sizeof(args); + args.wzVariable = wzVariable; + + results.cbSize = sizeof(results); + results.wzValue = wzValue; + results.cchValue = *pcchValue; + + hr = m_pfnBootstrapperExtensionEngineProc(BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_GETVARIABLESTRING, &args, &results, m_pvBootstrapperExtensionEngineProcContext); + + *pcchValue = results.cchValue; + + LExit: + return hr; + } + + virtual STDMETHODIMP GetVariableVersion( + __in_z LPCWSTR wzVariable, + __out_ecount_opt(*pcchValue) LPWSTR wzValue, + __inout SIZE_T* pcchValue + ) + { + HRESULT hr = S_OK; + BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS args = { }; + BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS results = { }; + + ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required"); + + args.cbSize = sizeof(args); + args.wzVariable = wzVariable; + + results.cbSize = sizeof(results); + results.wzValue = wzValue; + results.cchValue = *pcchValue; + + hr = m_pfnBootstrapperExtensionEngineProc(BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_GETVARIABLEVERSION, &args, &results, m_pvBootstrapperExtensionEngineProcContext); + + *pcchValue = results.cchValue; + + LExit: + return hr; + } + + virtual STDMETHODIMP Log( + __in BOOTSTRAPPER_EXTENSION_LOG_LEVEL level, + __in_z LPCWSTR wzMessage + ) + { + BOOTSTRAPPER_EXTENSION_ENGINE_LOG_ARGS args = { }; + BOOTSTRAPPER_EXTENSION_ENGINE_LOG_RESULTS results = { }; + + args.cbSize = sizeof(args); + args.level = level; + args.wzMessage = wzMessage; + + results.cbSize = sizeof(results); + + return m_pfnBootstrapperExtensionEngineProc(BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_LOG, &args, &results, m_pvBootstrapperExtensionEngineProcContext); + } + + virtual STDMETHODIMP SetVariableNumeric( + __in_z LPCWSTR wzVariable, + __in LONGLONG llValue + ) + { + BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS args = { }; + BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS results = { }; + + args.cbSize = sizeof(args); + args.wzVariable = wzVariable; + args.llValue = llValue; + + results.cbSize = sizeof(results); + + return m_pfnBootstrapperExtensionEngineProc(BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_SETVARIABLENUMERIC, &args, &results, m_pvBootstrapperExtensionEngineProcContext); + } + + virtual STDMETHODIMP SetVariableString( + __in_z LPCWSTR wzVariable, + __in_z_opt LPCWSTR wzValue, + __in BOOL fFormatted + ) + { + BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS args = { }; + BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS results = { }; + + args.cbSize = sizeof(args); + args.wzVariable = wzVariable; + args.wzValue = wzValue; + args.fFormatted = fFormatted; + + results.cbSize = sizeof(results); + + return m_pfnBootstrapperExtensionEngineProc(BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_SETVARIABLESTRING, &args, &results, m_pvBootstrapperExtensionEngineProcContext); + } + + virtual STDMETHODIMP SetVariableVersion( + __in_z LPCWSTR wzVariable, + __in_z_opt LPCWSTR wzValue + ) + { + BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS args = { }; + BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS results = { }; + + args.cbSize = sizeof(args); + args.wzVariable = wzVariable; + args.wzValue = wzValue; + + results.cbSize = sizeof(results); + + return m_pfnBootstrapperExtensionEngineProc(BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_SETVARIABLEVERSION, &args, &results, m_pvBootstrapperExtensionEngineProcContext); + } + + virtual STDMETHODIMP CompareVersions( + __in_z LPCWSTR wzVersion1, + __in_z LPCWSTR wzVersion2, + __out int* pnResult + ) + { + HRESULT hr = S_OK; + BOOTSTRAPPER_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS args = { }; + BOOTSTRAPPER_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS results = { }; + + ExitOnNull(pnResult, hr, E_INVALIDARG, "pnResult is required"); + + args.cbSize = sizeof(args); + args.wzVersion1 = wzVersion1; + args.wzVersion2 = wzVersion2; + + results.cbSize = sizeof(results); + + hr = m_pfnBootstrapperExtensionEngineProc(BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_COMPAREVERSIONS, &args, &results, m_pvBootstrapperExtensionEngineProcContext); + + *pnResult = results.nResult; + + LExit: + return hr; + } + + virtual STDMETHODIMP GetRelatedBundleVariable( + __in_z LPCWSTR wzBundleId, + __in_z LPCWSTR wzVariable, + __out_ecount_opt(*pcchValue) LPWSTR wzValue, + __inout SIZE_T* pcchValue + ) + { + HRESULT hr = S_OK; + BOOTSTRAPPER_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_ARGS args = { }; + BOOTSTRAPPER_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS results = { }; + + ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required"); + + args.cbSize = sizeof(args); + args.wzBundleId = wzBundleId; + args.wzVariable = wzVariable; + + results.cbSize = sizeof(results); + results.wzValue = wzValue; + results.cchValue = *pcchValue; + + hr = m_pfnBootstrapperExtensionEngineProc(BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE, &args, &results, m_pvBootstrapperExtensionEngineProcContext); + + *pcchValue = results.cchValue; + + LExit: + return hr; + } + +public: + CBextBootstrapperExtensionEngine( + __in PFN_BOOTSTRAPPER_EXTENSION_ENGINE_PROC pfnBootstrapperExtensionEngineProc, + __in_opt LPVOID pvBootstrapperExtensionEngineProcContext + ) + { + m_cReferences = 1; + m_pfnBootstrapperExtensionEngineProc = pfnBootstrapperExtensionEngineProc; + m_pvBootstrapperExtensionEngineProcContext = pvBootstrapperExtensionEngineProcContext; + } + +private: + long m_cReferences; + PFN_BOOTSTRAPPER_EXTENSION_ENGINE_PROC m_pfnBootstrapperExtensionEngineProc; + LPVOID m_pvBootstrapperExtensionEngineProcContext; +}; + +HRESULT BextBootstrapperExtensionEngineCreate( + __in PFN_BOOTSTRAPPER_EXTENSION_ENGINE_PROC pfnBootstrapperExtensionEngineProc, + __in_opt LPVOID pvBootstrapperExtensionEngineProcContext, + __out IBootstrapperExtensionEngine** ppEngineForExtension + ) +{ + HRESULT hr = S_OK; + CBextBootstrapperExtensionEngine* pBootstrapperExtensionEngine = NULL; + + pBootstrapperExtensionEngine = new CBextBootstrapperExtensionEngine(pfnBootstrapperExtensionEngineProc, pvBootstrapperExtensionEngineProcContext); + ExitOnNull(pBootstrapperExtensionEngine, hr, E_OUTOFMEMORY, "Failed to allocate new BextBootstrapperExtensionEngine object."); + + hr = pBootstrapperExtensionEngine->QueryInterface(IID_PPV_ARGS(ppEngineForExtension)); + ExitOnFailure(hr, "Failed to QI for IBootstrapperExtensionEngine from BextBootstrapperExtensionEngine object."); + +LExit: + ReleaseObject(pBootstrapperExtensionEngine); + return hr; +} diff --git a/src/api/burn/bextutil/BextBundleExtensionEngine.cpp b/src/api/burn/bextutil/BextBundleExtensionEngine.cpp deleted file mode 100644 index 2c854817..00000000 --- a/src/api/burn/bextutil/BextBundleExtensionEngine.cpp +++ /dev/null @@ -1,373 +0,0 @@ -// 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" - - -class CBextBundleExtensionEngine : public IBundleExtensionEngine -{ -public: // IUnknown - virtual STDMETHODIMP QueryInterface( - __in REFIID riid, - __out LPVOID *ppvObject - ) - { - if (!ppvObject) - { - return E_INVALIDARG; - } - - *ppvObject = NULL; - - if (::IsEqualIID(__uuidof(IBundleExtensionEngine), riid)) - { - *ppvObject = static_cast(this); - } - else if (::IsEqualIID(IID_IUnknown, riid)) - { - *ppvObject = reinterpret_cast(this); - } - else // no interface for requested iid - { - return E_NOINTERFACE; - } - - AddRef(); - return S_OK; - } - - virtual STDMETHODIMP_(ULONG) AddRef() - { - return ::InterlockedIncrement(&this->m_cReferences); - } - - virtual STDMETHODIMP_(ULONG) Release() - { - long l = ::InterlockedDecrement(&this->m_cReferences); - if (0 < l) - { - return l; - } - - delete this; - return 0; - } - -public: // IBundleExtensionEngine - virtual STDMETHODIMP EscapeString( - __in_z LPCWSTR wzIn, - __out_ecount_opt(*pcchOut) LPWSTR wzOut, - __inout SIZE_T* pcchOut - ) - { - HRESULT hr = S_OK; - BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_ARGS args = { }; - BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_RESULTS results = { }; - - ExitOnNull(pcchOut, hr, E_INVALIDARG, "pcchOut is required"); - - args.cbSize = sizeof(args); - args.wzIn = wzIn; - - results.cbSize = sizeof(results); - results.wzOut = wzOut; - results.cchOut = *pcchOut; - - hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_ESCAPESTRING, &args, &results, m_pvBundleExtensionEngineProcContext); - - *pcchOut = results.cchOut; - - LExit: - return hr; - } - - virtual STDMETHODIMP EvaluateCondition( - __in_z LPCWSTR wzCondition, - __out BOOL* pf - ) - { - HRESULT hr = S_OK; - BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_ARGS args = { }; - BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS results = { }; - - ExitOnNull(pf, hr, E_INVALIDARG, "pf is required"); - - args.cbSize = sizeof(args); - args.wzCondition = wzCondition; - - results.cbSize = sizeof(results); - - hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_EVALUATECONDITION, &args, &results, m_pvBundleExtensionEngineProcContext); - - *pf = results.f; - - LExit: - return hr; - } - - virtual STDMETHODIMP FormatString( - __in_z LPCWSTR wzIn, - __out_ecount_opt(*pcchOut) LPWSTR wzOut, - __inout SIZE_T* pcchOut - ) - { - HRESULT hr = S_OK; - BUNDLE_EXTENSION_ENGINE_FORMATSTRING_ARGS args = { }; - BUNDLE_EXTENSION_ENGINE_FORMATSTRING_RESULTS results = { }; - - ExitOnNull(pcchOut, hr, E_INVALIDARG, "pcchOut is required"); - - args.cbSize = sizeof(args); - args.wzIn = wzIn; - - results.cbSize = sizeof(results); - results.wzOut = wzOut; - results.cchOut = *pcchOut; - - hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_FORMATSTRING, &args, &results, m_pvBundleExtensionEngineProcContext); - - *pcchOut = results.cchOut; - - LExit: - return hr; - } - - virtual STDMETHODIMP GetVariableNumeric( - __in_z LPCWSTR wzVariable, - __out LONGLONG* pllValue - ) - { - HRESULT hr = S_OK; - BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS args = { }; - BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS results = { }; - - ExitOnNull(pllValue, hr, E_INVALIDARG, "pllValue is required"); - - args.cbSize = sizeof(args); - args.wzVariable = wzVariable; - - results.cbSize = sizeof(results); - - hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLENUMERIC, &args, &results, m_pvBundleExtensionEngineProcContext); - - *pllValue = results.llValue; - - LExit: - SecureZeroMemory(&results, sizeof(results)); - return hr; - } - - virtual STDMETHODIMP GetVariableString( - __in_z LPCWSTR wzVariable, - __out_ecount_opt(*pcchValue) LPWSTR wzValue, - __inout SIZE_T* pcchValue - ) - { - HRESULT hr = S_OK; - BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS args = { }; - BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS results = { }; - - ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required"); - - args.cbSize = sizeof(args); - args.wzVariable = wzVariable; - - results.cbSize = sizeof(results); - results.wzValue = wzValue; - results.cchValue = *pcchValue; - - hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLESTRING, &args, &results, m_pvBundleExtensionEngineProcContext); - - *pcchValue = results.cchValue; - - LExit: - return hr; - } - - virtual STDMETHODIMP GetVariableVersion( - __in_z LPCWSTR wzVariable, - __out_ecount_opt(*pcchValue) LPWSTR wzValue, - __inout SIZE_T* pcchValue - ) - { - HRESULT hr = S_OK; - BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS args = { }; - BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS results = { }; - - ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required"); - - args.cbSize = sizeof(args); - args.wzVariable = wzVariable; - - results.cbSize = sizeof(results); - results.wzValue = wzValue; - results.cchValue = *pcchValue; - - hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLEVERSION, &args, &results, m_pvBundleExtensionEngineProcContext); - - *pcchValue = results.cchValue; - - LExit: - return hr; - } - - virtual STDMETHODIMP Log( - __in BUNDLE_EXTENSION_LOG_LEVEL level, - __in_z LPCWSTR wzMessage - ) - { - BUNDLE_EXTENSION_ENGINE_LOG_ARGS args = { }; - BUNDLE_EXTENSION_ENGINE_LOG_RESULTS results = { }; - - args.cbSize = sizeof(args); - args.level = level; - args.wzMessage = wzMessage; - - results.cbSize = sizeof(results); - - return m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_LOG, &args, &results, m_pvBundleExtensionEngineProcContext); - } - - virtual STDMETHODIMP SetVariableNumeric( - __in_z LPCWSTR wzVariable, - __in LONGLONG llValue - ) - { - BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS args = { }; - BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS results = { }; - - args.cbSize = sizeof(args); - args.wzVariable = wzVariable; - args.llValue = llValue; - - results.cbSize = sizeof(results); - - return m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLENUMERIC, &args, &results, m_pvBundleExtensionEngineProcContext); - } - - virtual STDMETHODIMP SetVariableString( - __in_z LPCWSTR wzVariable, - __in_z_opt LPCWSTR wzValue, - __in BOOL fFormatted - ) - { - BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS args = { }; - BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS results = { }; - - args.cbSize = sizeof(args); - args.wzVariable = wzVariable; - args.wzValue = wzValue; - args.fFormatted = fFormatted; - - results.cbSize = sizeof(results); - - return m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLESTRING, &args, &results, m_pvBundleExtensionEngineProcContext); - } - - virtual STDMETHODIMP SetVariableVersion( - __in_z LPCWSTR wzVariable, - __in_z_opt LPCWSTR wzValue - ) - { - BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS args = { }; - BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS results = { }; - - args.cbSize = sizeof(args); - args.wzVariable = wzVariable; - args.wzValue = wzValue; - - results.cbSize = sizeof(results); - - return m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLEVERSION, &args, &results, m_pvBundleExtensionEngineProcContext); - } - - virtual STDMETHODIMP CompareVersions( - __in_z LPCWSTR wzVersion1, - __in_z LPCWSTR wzVersion2, - __out int* pnResult - ) - { - HRESULT hr = S_OK; - BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS args = { }; - BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS results = { }; - - ExitOnNull(pnResult, hr, E_INVALIDARG, "pnResult is required"); - - args.cbSize = sizeof(args); - args.wzVersion1 = wzVersion1; - args.wzVersion2 = wzVersion2; - - results.cbSize = sizeof(results); - - hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_COMPAREVERSIONS, &args, &results, m_pvBundleExtensionEngineProcContext); - - *pnResult = results.nResult; - - LExit: - return hr; - } - - virtual STDMETHODIMP GetRelatedBundleVariable( - __in_z LPCWSTR wzBundleId, - __in_z LPCWSTR wzVariable, - __out_ecount_opt(*pcchValue) LPWSTR wzValue, - __inout SIZE_T* pcchValue - ) - { - HRESULT hr = S_OK; - BUNDLE_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_ARGS args = { }; - BUNDLE_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS results = { }; - - ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required"); - - args.cbSize = sizeof(args); - args.wzBundleId = wzBundleId; - args.wzVariable = wzVariable; - - results.cbSize = sizeof(results); - results.wzValue = wzValue; - results.cchValue = *pcchValue; - - hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE, &args, &results, m_pvBundleExtensionEngineProcContext); - - *pcchValue = results.cchValue; - - LExit: - return hr; - } - -public: - CBextBundleExtensionEngine( - __in PFN_BUNDLE_EXTENSION_ENGINE_PROC pfnBundleExtensionEngineProc, - __in_opt LPVOID pvBundleExtensionEngineProcContext - ) - { - m_cReferences = 1; - m_pfnBundleExtensionEngineProc = pfnBundleExtensionEngineProc; - m_pvBundleExtensionEngineProcContext = pvBundleExtensionEngineProcContext; - } - -private: - long m_cReferences; - PFN_BUNDLE_EXTENSION_ENGINE_PROC m_pfnBundleExtensionEngineProc; - LPVOID m_pvBundleExtensionEngineProcContext; -}; - -HRESULT BextBundleExtensionEngineCreate( - __in PFN_BUNDLE_EXTENSION_ENGINE_PROC pfnBundleExtensionEngineProc, - __in_opt LPVOID pvBundleExtensionEngineProcContext, - __out IBundleExtensionEngine** ppEngineForExtension - ) -{ - HRESULT hr = S_OK; - CBextBundleExtensionEngine* pBundleExtensionEngine = NULL; - - pBundleExtensionEngine = new CBextBundleExtensionEngine(pfnBundleExtensionEngineProc, pvBundleExtensionEngineProcContext); - ExitOnNull(pBundleExtensionEngine, hr, E_OUTOFMEMORY, "Failed to allocate new BextBundleExtensionEngine object."); - - hr = pBundleExtensionEngine->QueryInterface(IID_PPV_ARGS(ppEngineForExtension)); - ExitOnFailure(hr, "Failed to QI for IBundleExtensionEngine from BextBundleExtensionEngine object."); - -LExit: - ReleaseObject(pBundleExtensionEngine); - return hr; -} diff --git a/src/api/burn/bextutil/bextutil.cpp b/src/api/burn/bextutil/bextutil.cpp index b2e689c3..6f960ef5 100644 --- a/src/api/burn/bextutil/bextutil.cpp +++ b/src/api/burn/bextutil/bextutil.cpp @@ -2,12 +2,12 @@ #include "precomp.h" -static IBundleExtensionEngine* vpEngine = NULL; +static IBootstrapperExtensionEngine* vpEngine = NULL; // prototypes DAPI_(void) BextInitialize( - __in IBundleExtensionEngine* pEngine + __in IBootstrapperExtensionEngine* pEngine ) { pEngine->AddRef(); @@ -17,15 +17,15 @@ DAPI_(void) BextInitialize( } DAPI_(HRESULT) BextInitializeFromCreateArgs( - __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs, - __out_opt IBundleExtensionEngine** ppEngine + __in const BOOTSTRAPPER_EXTENSION_CREATE_ARGS* pArgs, + __out_opt IBootstrapperExtensionEngine** ppEngine ) { HRESULT hr = S_OK; - IBundleExtensionEngine* pEngine = NULL; + IBootstrapperExtensionEngine* pEngine = NULL; - hr = BextBundleExtensionEngineCreate(pArgs->pfnBundleExtensionEngineProc, pArgs->pvBundleExtensionEngineProcContext, &pEngine); - ExitOnFailure(hr, "Failed to create BextBundleExtensionEngine."); + hr = BextBootstrapperExtensionEngineCreate(pArgs->pfnBootstrapperExtensionEngineProc, pArgs->pvBootstrapperExtensionEngineProcContext, &pEngine); + ExitOnFailure(hr, "Failed to create BextBootstrapperExtensionEngine."); BextInitialize(pEngine); @@ -47,30 +47,30 @@ DAPI_(void) BextUninitialize() ReleaseNullObject(vpEngine); } -DAPI_(HRESULT) BextGetBundleExtensionDataNode( +DAPI_(HRESULT) BextGetBootstrapperExtensionDataNode( __in IXMLDOMDocument* pixdManifest, __in LPCWSTR wzExtensionId, - __out IXMLDOMNode** ppixnBundleExtension + __out IXMLDOMNode** ppixnBootstrapperExtension ) { HRESULT hr = S_OK; - IXMLDOMElement* pixeBundleExtensionData = NULL; + IXMLDOMElement* pixeBootstrapperExtensionData = NULL; IXMLDOMNodeList* pixnNodes = NULL; IXMLDOMNode* pixnNode = NULL; DWORD cNodes = 0; LPWSTR sczId = NULL; - // Get BundleExtensionData element. - hr = pixdManifest->get_documentElement(&pixeBundleExtensionData); - ExitOnFailure(hr, "Failed to get BundleExtensionData element."); + // Get BootstrapperExtensionData element. + hr = pixdManifest->get_documentElement(&pixeBootstrapperExtensionData); + ExitOnFailure(hr, "Failed to get BootstrapperExtensionData element."); - // Select BundleExtension nodes. - hr = XmlSelectNodes(pixeBundleExtensionData, L"BundleExtension", &pixnNodes); - ExitOnFailure(hr, "Failed to select BundleExtension nodes."); + // Select BootstrapperExtension nodes. + hr = XmlSelectNodes(pixeBootstrapperExtensionData, L"BootstrapperExtension", &pixnNodes); + ExitOnFailure(hr, "Failed to select BootstrapperExtension nodes."); - // Get BundleExtension node count. + // Get BootstrapperExtension node count. hr = pixnNodes->get_length((long*)&cNodes); - ExitOnFailure(hr, "Failed to get BundleExtension node count."); + ExitOnFailure(hr, "Failed to get BootstrapperExtension node count."); if (!cNodes) { @@ -89,7 +89,7 @@ DAPI_(HRESULT) BextGetBundleExtensionDataNode( if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, sczId, -1, wzExtensionId, -1)) { - *ppixnBundleExtension = pixnNode; + *ppixnBootstrapperExtension = pixnNode; pixnNode = NULL; ExitFunction1(hr = S_OK); @@ -105,14 +105,14 @@ LExit: ReleaseStr(sczId); ReleaseObject(pixnNode); ReleaseObject(pixnNodes); - ReleaseObject(pixeBundleExtensionData); + ReleaseObject(pixeBootstrapperExtensionData); return hr; } DAPIV_(HRESULT) BextLog( - __in BUNDLE_EXTENSION_LOG_LEVEL level, + __in BOOTSTRAPPER_EXTENSION_LOG_LEVEL level, __in_z __format_string LPCSTR szFormat, ... ) @@ -136,7 +136,7 @@ LExit: DAPI_(HRESULT) BextLogArgs( - __in BUNDLE_EXTENSION_LOG_LEVEL level, + __in BOOTSTRAPPER_EXTENSION_LOG_LEVEL level, __in_z __format_string LPCSTR szFormat, __in va_list args ) @@ -212,7 +212,7 @@ DAPI_(HRESULT) BextLogErrorArgs( hr = StrAllocFormatted(&sczMessage, L"Error 0x%08x: %S", hrError, sczFormattedAnsi); ExitOnFailure(hr, "Failed to prepend error number to error log string."); - hr = vpEngine->Log(BUNDLE_EXTENSION_LOG_LEVEL_ERROR, sczMessage); + hr = vpEngine->Log(BOOTSTRAPPER_EXTENSION_LOG_LEVEL_ERROR, sczMessage); LExit: ReleaseStr(sczMessage); diff --git a/src/api/burn/bextutil/bextutil.nuspec b/src/api/burn/bextutil/bextutil.nuspec index b2881354..c710f424 100644 --- a/src/api/burn/bextutil/bextutil.nuspec +++ b/src/api/burn/bextutil/bextutil.nuspec @@ -21,8 +21,8 @@ - - + + diff --git a/src/api/burn/bextutil/bextutil.vcxproj b/src/api/burn/bextutil/bextutil.vcxproj index 467f2d56..0299c381 100644 --- a/src/api/burn/bextutil/bextutil.vcxproj +++ b/src/api/burn/bextutil/bextutil.vcxproj @@ -34,8 +34,8 @@ StaticLibrary bextutil MultiByte - WiX Toolset Bundle Extension native utility library - WixToolset.BextUtil + WiX Toolset Bundle Extension API + WixToolset.BootstrapperExtensionApi @@ -53,19 +53,19 @@ - + Create - - - + + + - - + + diff --git a/src/api/burn/bextutil/build/WixToolset.BextUtil.props b/src/api/burn/bextutil/build/WixToolset.BextUtil.props deleted file mode 100644 index dbaddb70..00000000 --- a/src/api/burn/bextutil/build/WixToolset.BextUtil.props +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - $(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories) - - - $(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories) - - - - - $(MSBuildThisFileDirectory)native\v14\$(PlatformTarget)\bextutil.lib;%(AdditionalDependencies) - - - diff --git a/src/api/burn/bextutil/build/WixToolset.BootstrapperExtensionApi.props b/src/api/burn/bextutil/build/WixToolset.BootstrapperExtensionApi.props new file mode 100644 index 00000000..dbaddb70 --- /dev/null +++ b/src/api/burn/bextutil/build/WixToolset.BootstrapperExtensionApi.props @@ -0,0 +1,18 @@ + + + + + + + $(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories) + + + $(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories) + + + + + $(MSBuildThisFileDirectory)native\v14\$(PlatformTarget)\bextutil.lib;%(AdditionalDependencies) + + + diff --git a/src/api/burn/bextutil/inc/BextBaseBootstrapperExtension.h b/src/api/burn/bextutil/inc/BextBaseBootstrapperExtension.h new file mode 100644 index 00000000..83ba23a6 --- /dev/null +++ b/src/api/burn/bextutil/inc/BextBaseBootstrapperExtension.h @@ -0,0 +1,115 @@ +// 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 "bextutil.h" + +class CBextBaseBootstrapperExtension : public IBootstrapperExtension +{ +public: // IUnknown + virtual STDMETHODIMP QueryInterface( + __in REFIID riid, + __out LPVOID *ppvObject + ) + { + if (!ppvObject) + { + return E_INVALIDARG; + } + + *ppvObject = NULL; + + if (::IsEqualIID(__uuidof(IBootstrapperExtension), riid)) + { + *ppvObject = static_cast(this); + } + else if (::IsEqualIID(IID_IUnknown, riid)) + { + *ppvObject = static_cast(this); + } + else // no interface for requested iid + { + return E_NOINTERFACE; + } + + AddRef(); + return S_OK; + } + + virtual STDMETHODIMP_(ULONG) AddRef() + { + return ::InterlockedIncrement(&this->m_cReferences); + } + + virtual STDMETHODIMP_(ULONG) Release() + { + long l = ::InterlockedDecrement(&this->m_cReferences); + if (0 < l) + { + return l; + } + + delete this; + return 0; + } + +public: // IBootstrapperExtension + virtual STDMETHODIMP Search( + __in LPCWSTR /*wzId*/, + __in LPCWSTR /*wzVariable*/ + ) + { + return E_NOTIMPL; + } + + virtual STDMETHODIMP BootstrapperExtensionProc( + __in BOOTSTRAPPER_EXTENSION_MESSAGE /*message*/, + __in const LPVOID /*pvArgs*/, + __inout LPVOID /*pvResults*/, + __in_opt LPVOID /*pvContext*/ + ) + { + return E_NOTIMPL; + } + +public: //CBextBaseBootstrapperExtension + virtual STDMETHODIMP Initialize( + __in const BOOTSTRAPPER_EXTENSION_CREATE_ARGS* pCreateArgs + ) + { + HRESULT hr = S_OK; + + hr = StrAllocString(&m_sczBootstrapperExtensionDataPath, pCreateArgs->wzBootstrapperExtensionDataPath, 0); + ExitOnFailure(hr, "Failed to copy BootstrapperExtensionDataPath."); + + LExit: + return hr; + } + +protected: + + CBextBaseBootstrapperExtension( + __in IBootstrapperExtensionEngine* pEngine + ) + { + m_cReferences = 1; + + pEngine->AddRef(); + m_pEngine = pEngine; + + m_sczBootstrapperExtensionDataPath = NULL; + } + + virtual ~CBextBaseBootstrapperExtension() + { + ReleaseNullObject(m_pEngine); + ReleaseStr(m_sczBootstrapperExtensionDataPath); + } + +protected: + IBootstrapperExtensionEngine* m_pEngine; + LPWSTR m_sczBootstrapperExtensionDataPath; + +private: + long m_cReferences; +}; diff --git a/src/api/burn/bextutil/inc/BextBaseBootstrapperExtensionProc.h b/src/api/burn/bextutil/inc/BextBaseBootstrapperExtensionProc.h new file mode 100644 index 00000000..4f96399c --- /dev/null +++ b/src/api/burn/bextutil/inc/BextBaseBootstrapperExtensionProc.h @@ -0,0 +1,46 @@ +#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 + +static HRESULT BextBaseBEProcSearch( + __in IBootstrapperExtension* pBE, + __in BOOTSTRAPPER_EXTENSION_SEARCH_ARGS* pArgs, + __inout BOOTSTRAPPER_EXTENSION_SEARCH_RESULTS* /*pResults*/ + ) +{ + return pBE->Search(pArgs->wzId, pArgs->wzVariable); +} + +/******************************************************************* +BextBaseBootstrapperExtensionProc - requires pvContext to be of type IBootstrapperExtension. + Provides a default mapping between the message based + BootstrapperExtension interface and the COM-based BootstrapperExtension interface. + +*******************************************************************/ +static HRESULT WINAPI BextBaseBootstrapperExtensionProc( + __in BOOTSTRAPPER_EXTENSION_MESSAGE message, + __in const LPVOID pvArgs, + __inout LPVOID pvResults, + __in_opt LPVOID pvContext + ) +{ + IBootstrapperExtension* pBE = reinterpret_cast(pvContext); + HRESULT hr = pBE->BootstrapperExtensionProc(message, pvArgs, pvResults, pvContext); + + if (E_NOTIMPL == hr) + { + switch (message) + { + case BOOTSTRAPPER_EXTENSION_MESSAGE_SEARCH: + hr = BextBaseBEProcSearch(pBE, reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; + } + } + + return hr; +} diff --git a/src/api/burn/bextutil/inc/BextBaseBundleExtension.h b/src/api/burn/bextutil/inc/BextBaseBundleExtension.h deleted file mode 100644 index 5bda04e1..00000000 --- a/src/api/burn/bextutil/inc/BextBaseBundleExtension.h +++ /dev/null @@ -1,115 +0,0 @@ -// 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 "bextutil.h" - -class CBextBaseBundleExtension : public IBundleExtension -{ -public: // IUnknown - virtual STDMETHODIMP QueryInterface( - __in REFIID riid, - __out LPVOID *ppvObject - ) - { - if (!ppvObject) - { - return E_INVALIDARG; - } - - *ppvObject = NULL; - - if (::IsEqualIID(__uuidof(IBundleExtension), riid)) - { - *ppvObject = static_cast(this); - } - else if (::IsEqualIID(IID_IUnknown, riid)) - { - *ppvObject = static_cast(this); - } - else // no interface for requested iid - { - return E_NOINTERFACE; - } - - AddRef(); - return S_OK; - } - - virtual STDMETHODIMP_(ULONG) AddRef() - { - return ::InterlockedIncrement(&this->m_cReferences); - } - - virtual STDMETHODIMP_(ULONG) Release() - { - long l = ::InterlockedDecrement(&this->m_cReferences); - if (0 < l) - { - return l; - } - - delete this; - return 0; - } - -public: // IBundleExtension - virtual STDMETHODIMP Search( - __in LPCWSTR /*wzId*/, - __in LPCWSTR /*wzVariable*/ - ) - { - return E_NOTIMPL; - } - - virtual STDMETHODIMP BundleExtensionProc( - __in BUNDLE_EXTENSION_MESSAGE /*message*/, - __in const LPVOID /*pvArgs*/, - __inout LPVOID /*pvResults*/, - __in_opt LPVOID /*pvContext*/ - ) - { - return E_NOTIMPL; - } - -public: //CBextBaseBundleExtension - virtual STDMETHODIMP Initialize( - __in const BUNDLE_EXTENSION_CREATE_ARGS* pCreateArgs - ) - { - HRESULT hr = S_OK; - - hr = StrAllocString(&m_sczBundleExtensionDataPath, pCreateArgs->wzBundleExtensionDataPath, 0); - ExitOnFailure(hr, "Failed to copy BundleExtensionDataPath."); - - LExit: - return hr; - } - -protected: - - CBextBaseBundleExtension( - __in IBundleExtensionEngine* pEngine - ) - { - m_cReferences = 1; - - pEngine->AddRef(); - m_pEngine = pEngine; - - m_sczBundleExtensionDataPath = NULL; - } - - virtual ~CBextBaseBundleExtension() - { - ReleaseNullObject(m_pEngine); - ReleaseStr(m_sczBundleExtensionDataPath); - } - -protected: - IBundleExtensionEngine* m_pEngine; - LPWSTR m_sczBundleExtensionDataPath; - -private: - long m_cReferences; -}; diff --git a/src/api/burn/bextutil/inc/BextBaseBundleExtensionProc.h b/src/api/burn/bextutil/inc/BextBaseBundleExtensionProc.h deleted file mode 100644 index cd7e3cb3..00000000 --- a/src/api/burn/bextutil/inc/BextBaseBundleExtensionProc.h +++ /dev/null @@ -1,46 +0,0 @@ -#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 - -static HRESULT BextBaseBEProcSearch( - __in IBundleExtension* pBE, - __in BUNDLE_EXTENSION_SEARCH_ARGS* pArgs, - __inout BUNDLE_EXTENSION_SEARCH_RESULTS* /*pResults*/ - ) -{ - return pBE->Search(pArgs->wzId, pArgs->wzVariable); -} - -/******************************************************************* -BextBaseBundleExtensionProc - requires pvContext to be of type IBundleExtension. - Provides a default mapping between the message based - BundleExtension interface and the COM-based BundleExtension interface. - -*******************************************************************/ -static HRESULT WINAPI BextBaseBundleExtensionProc( - __in BUNDLE_EXTENSION_MESSAGE message, - __in const LPVOID pvArgs, - __inout LPVOID pvResults, - __in_opt LPVOID pvContext - ) -{ - IBundleExtension* pBE = reinterpret_cast(pvContext); - HRESULT hr = pBE->BundleExtensionProc(message, pvArgs, pvResults, pvContext); - - if (E_NOTIMPL == hr) - { - switch (message) - { - case BUNDLE_EXTENSION_MESSAGE_SEARCH: - hr = BextBaseBEProcSearch(pBE, reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); - break; - } - } - - return hr; -} diff --git a/src/api/burn/bextutil/inc/BextBootstrapperExtensionEngine.h b/src/api/burn/bextutil/inc/BextBootstrapperExtensionEngine.h new file mode 100644 index 00000000..a27ff186 --- /dev/null +++ b/src/api/burn/bextutil/inc/BextBootstrapperExtensionEngine.h @@ -0,0 +1,20 @@ +#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 + +#ifdef __cplusplus +extern "C" { +#endif + +// function declarations + +HRESULT BextBootstrapperExtensionEngineCreate( + __in PFN_BOOTSTRAPPER_EXTENSION_ENGINE_PROC pfnBootstrapperExtensionEngineProc, + __in_opt LPVOID pvBootstrapperExtensionEngineProcContext, + __out IBootstrapperExtensionEngine** ppEngineForExtension + ); + +#ifdef __cplusplus +} +#endif diff --git a/src/api/burn/bextutil/inc/BextBundleExtensionEngine.h b/src/api/burn/bextutil/inc/BextBundleExtensionEngine.h deleted file mode 100644 index 97b02f36..00000000 --- a/src/api/burn/bextutil/inc/BextBundleExtensionEngine.h +++ /dev/null @@ -1,20 +0,0 @@ -#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 - -#ifdef __cplusplus -extern "C" { -#endif - -// function declarations - -HRESULT BextBundleExtensionEngineCreate( - __in PFN_BUNDLE_EXTENSION_ENGINE_PROC pfnBundleExtensionEngineProc, - __in_opt LPVOID pvBundleExtensionEngineProcContext, - __out IBundleExtensionEngine** ppEngineForExtension - ); - -#ifdef __cplusplus -} -#endif diff --git a/src/api/burn/bextutil/inc/IBootstrapperExtension.h b/src/api/burn/bextutil/inc/IBootstrapperExtension.h new file mode 100644 index 00000000..4005a9fd --- /dev/null +++ b/src/api/burn/bextutil/inc/IBootstrapperExtension.h @@ -0,0 +1,21 @@ +#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 + +DECLARE_INTERFACE_IID_(IBootstrapperExtension, IUnknown, "93123C9D-796B-4FCD-A507-6EDEF9A925FD") +{ + STDMETHOD(Search)( + __in LPCWSTR wzId, + __in LPCWSTR wzVariable + ) = 0; + + // BootstrapperExtensionProc - The PFN_BOOTSTRAPPER_EXTENSION_PROC can call this method to give the BootstrapperExtension raw access to the callback from the engine. + // This might be used to help the BootstrapperExtension support more than one version of the engine. + STDMETHOD(BootstrapperExtensionProc)( + __in BOOTSTRAPPER_EXTENSION_MESSAGE message, + __in const LPVOID pvArgs, + __inout LPVOID pvResults, + __in_opt LPVOID pvContext + ) = 0; +}; diff --git a/src/api/burn/bextutil/inc/IBootstrapperExtensionEngine.h b/src/api/burn/bextutil/inc/IBootstrapperExtensionEngine.h new file mode 100644 index 00000000..b23a57b7 --- /dev/null +++ b/src/api/burn/bextutil/inc/IBootstrapperExtensionEngine.h @@ -0,0 +1,75 @@ +#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 + +DECLARE_INTERFACE_IID_(IBootstrapperExtensionEngine, IUnknown, "9D027A39-F6B6-42CC-9737-C185089EB263") +{ + STDMETHOD(EscapeString)( + __in_z LPCWSTR wzIn, + __out_ecount_opt(*pcchOut) LPWSTR wzOut, + __inout SIZE_T* pcchOut + ) = 0; + + STDMETHOD(EvaluateCondition)( + __in_z LPCWSTR wzCondition, + __out BOOL* pf + ) = 0; + + STDMETHOD(FormatString)( + __in_z LPCWSTR wzIn, + __out_ecount_opt(*pcchOut) LPWSTR wzOut, + __inout SIZE_T* pcchOut + ) = 0; + + STDMETHOD(GetVariableNumeric)( + __in_z LPCWSTR wzVariable, + __out LONGLONG* pllValue + ) = 0; + + STDMETHOD(GetVariableString)( + __in_z LPCWSTR wzVariable, + __out_ecount_opt(*pcchValue) LPWSTR wzValue, + __inout SIZE_T* pcchValue + ) = 0; + + STDMETHOD(GetVariableVersion)( + __in_z LPCWSTR wzVariable, + __out_ecount_opt(*pcchValue) LPWSTR wzValue, + __inout SIZE_T* pcchValue + ) = 0; + + STDMETHOD(Log)( + __in BOOTSTRAPPER_EXTENSION_LOG_LEVEL level, + __in_z LPCWSTR wzMessage + ) = 0; + + STDMETHOD(SetVariableNumeric)( + __in_z LPCWSTR wzVariable, + __in LONGLONG llValue + ) = 0; + + STDMETHOD(SetVariableString)( + __in_z LPCWSTR wzVariable, + __in_z_opt LPCWSTR wzValue, + __in BOOL fFormatted + ) = 0; + + STDMETHOD(SetVariableVersion)( + __in_z LPCWSTR wzVariable, + __in_z_opt LPCWSTR wzValue + ) = 0; + + STDMETHOD(CompareVersions)( + __in_z LPCWSTR wzVersion1, + __in_z LPCWSTR wzVersion2, + __out int* pnResult + ) = 0; + + STDMETHOD(GetRelatedBundleVariable)( + __in_z LPCWSTR wzBundleId, + __in_z LPCWSTR wzVariable, + __out_ecount_opt(*pcchValue) LPWSTR wzValue, + __inout SIZE_T * pcchValue + ) = 0; +}; diff --git a/src/api/burn/bextutil/inc/IBundleExtension.h b/src/api/burn/bextutil/inc/IBundleExtension.h deleted file mode 100644 index 00301672..00000000 --- a/src/api/burn/bextutil/inc/IBundleExtension.h +++ /dev/null @@ -1,21 +0,0 @@ -#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 - -DECLARE_INTERFACE_IID_(IBundleExtension, IUnknown, "93123C9D-796B-4FCD-A507-6EDEF9A925FD") -{ - STDMETHOD(Search)( - __in LPCWSTR wzId, - __in LPCWSTR wzVariable - ) = 0; - - // BundleExtensionProc - The PFN_BUNDLE_EXTENSION_PROC can call this method to give the BundleExtension raw access to the callback from the engine. - // This might be used to help the BundleExtension support more than one version of the engine. - STDMETHOD(BundleExtensionProc)( - __in BUNDLE_EXTENSION_MESSAGE message, - __in const LPVOID pvArgs, - __inout LPVOID pvResults, - __in_opt LPVOID pvContext - ) = 0; -}; diff --git a/src/api/burn/bextutil/inc/IBundleExtensionEngine.h b/src/api/burn/bextutil/inc/IBundleExtensionEngine.h deleted file mode 100644 index a4a27fb1..00000000 --- a/src/api/burn/bextutil/inc/IBundleExtensionEngine.h +++ /dev/null @@ -1,75 +0,0 @@ -#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 - -DECLARE_INTERFACE_IID_(IBundleExtensionEngine, IUnknown, "9D027A39-F6B6-42CC-9737-C185089EB263") -{ - STDMETHOD(EscapeString)( - __in_z LPCWSTR wzIn, - __out_ecount_opt(*pcchOut) LPWSTR wzOut, - __inout SIZE_T* pcchOut - ) = 0; - - STDMETHOD(EvaluateCondition)( - __in_z LPCWSTR wzCondition, - __out BOOL* pf - ) = 0; - - STDMETHOD(FormatString)( - __in_z LPCWSTR wzIn, - __out_ecount_opt(*pcchOut) LPWSTR wzOut, - __inout SIZE_T* pcchOut - ) = 0; - - STDMETHOD(GetVariableNumeric)( - __in_z LPCWSTR wzVariable, - __out LONGLONG* pllValue - ) = 0; - - STDMETHOD(GetVariableString)( - __in_z LPCWSTR wzVariable, - __out_ecount_opt(*pcchValue) LPWSTR wzValue, - __inout SIZE_T* pcchValue - ) = 0; - - STDMETHOD(GetVariableVersion)( - __in_z LPCWSTR wzVariable, - __out_ecount_opt(*pcchValue) LPWSTR wzValue, - __inout SIZE_T* pcchValue - ) = 0; - - STDMETHOD(Log)( - __in BUNDLE_EXTENSION_LOG_LEVEL level, - __in_z LPCWSTR wzMessage - ) = 0; - - STDMETHOD(SetVariableNumeric)( - __in_z LPCWSTR wzVariable, - __in LONGLONG llValue - ) = 0; - - STDMETHOD(SetVariableString)( - __in_z LPCWSTR wzVariable, - __in_z_opt LPCWSTR wzValue, - __in BOOL fFormatted - ) = 0; - - STDMETHOD(SetVariableVersion)( - __in_z LPCWSTR wzVariable, - __in_z_opt LPCWSTR wzValue - ) = 0; - - STDMETHOD(CompareVersions)( - __in_z LPCWSTR wzVersion1, - __in_z LPCWSTR wzVersion2, - __out int* pnResult - ) = 0; - - STDMETHOD(GetRelatedBundleVariable)( - __in_z LPCWSTR wzBundleId, - __in_z LPCWSTR wzVariable, - __out_ecount_opt(*pcchValue) LPWSTR wzValue, - __inout SIZE_T * pcchValue - ) = 0; -}; diff --git a/src/api/burn/bextutil/inc/bextutil.h b/src/api/burn/bextutil/inc/bextutil.h index b8536444..64633cf1 100644 --- a/src/api/burn/bextutil/inc/bextutil.h +++ b/src/api/burn/bextutil/inc/bextutil.h @@ -4,8 +4,8 @@ #include "dutil.h" -#include "IBundleExtensionEngine.h" -#include "IBundleExtension.h" +#include "IBootstrapperExtensionEngine.h" +#include "IBootstrapperExtension.h" #ifdef __cplusplus extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define BextExitOnOptionalXmlQueryFailure(x, b, f, ...) BextExitOnOptionalXmlQueryFailureSource(DUTIL_SOURCE_DEFAULT, x, b, f, __VA_ARGS__) #define BextExitOnRequiredXmlQueryFailure(x, f, ...) BextExitOnRequiredXmlQueryFailureSource(DUTIL_SOURCE_DEFAULT, x, f, __VA_ARGS__) -const LPCWSTR BUNDLE_EXTENSION_MANIFEST_FILENAME = L"BundleExtensionData.xml"; +const LPCWSTR BOOTSTRAPPER_EXTENSION_MANIFEST_FILENAME = L"BootstrapperExtensionData.xml"; /******************************************************************* @@ -42,17 +42,17 @@ const LPCWSTR BUNDLE_EXTENSION_MANIFEST_FILENAME = L"BundleExtensionData.xml"; ********************************************************************/ DAPI_(void) BextInitialize( - __in IBundleExtensionEngine* pEngine + __in IBootstrapperExtensionEngine* pEngine ); /******************************************************************* - BextInitializeFromCreateArgs - convenience function to call BextBundleExtensionEngineCreate + BextInitializeFromCreateArgs - convenience function to call BextBootstrapperExtensionEngineCreate then pass it along to BextInitialize. ********************************************************************/ DAPI_(HRESULT) BextInitializeFromCreateArgs( - __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs, - __out IBundleExtensionEngine** ppEngine + __in const BOOTSTRAPPER_EXTENSION_CREATE_ARGS* pArgs, + __out IBootstrapperExtensionEngine** ppEngine ); /******************************************************************* @@ -62,13 +62,13 @@ DAPI_(HRESULT) BextInitializeFromCreateArgs( DAPI_(void) BextUninitialize(); /******************************************************************* - BextGetBundleExtensionDataNode - gets the requested BundleExtension node. + BextGetBootstrapperExtensionDataNode - gets the requested BootstrapperExtension node. ********************************************************************/ -DAPI_(HRESULT) BextGetBundleExtensionDataNode( +DAPI_(HRESULT) BextGetBootstrapperExtensionDataNode( __in IXMLDOMDocument* pixdManifest, __in LPCWSTR wzExtensionId, - __out IXMLDOMNode** ppixnBundleExtension + __out IXMLDOMNode** ppixnBootstrapperExtension ); /******************************************************************* @@ -76,7 +76,7 @@ DAPI_(HRESULT) BextGetBundleExtensionDataNode( ********************************************************************/ DAPIV_(HRESULT) BextLog( - __in BUNDLE_EXTENSION_LOG_LEVEL level, + __in BOOTSTRAPPER_EXTENSION_LOG_LEVEL level, __in_z __format_string LPCSTR szFormat, ... ); @@ -86,7 +86,7 @@ DAPIV_(HRESULT) BextLog( ********************************************************************/ DAPI_(HRESULT) BextLogArgs( - __in BUNDLE_EXTENSION_LOG_LEVEL level, + __in BOOTSTRAPPER_EXTENSION_LOG_LEVEL level, __in_z __format_string LPCSTR szFormat, __in va_list args ); diff --git a/src/api/burn/bextutil/precomp.h b/src/api/burn/bextutil/precomp.h index d5714cc2..52962c06 100644 --- a/src/api/burn/bextutil/precomp.h +++ b/src/api/burn/bextutil/precomp.h @@ -13,4 +13,4 @@ #include #include "bextutil.h" -#include "BextBundleExtensionEngine.h" +#include "BextBootstrapperExtensionEngine.h" diff --git a/src/api/burn/inc/BootstrapperExtension.h b/src/api/burn/inc/BootstrapperExtension.h new file mode 100644 index 00000000..b1fa6408 --- /dev/null +++ b/src/api/burn/inc/BootstrapperExtension.h @@ -0,0 +1,61 @@ +#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 + +#if defined(__cplusplus) +extern "C" { +#endif + +enum BOOTSTRAPPER_EXTENSION_MESSAGE +{ + BOOTSTRAPPER_EXTENSION_MESSAGE_SEARCH, +}; + +typedef struct _BOOTSTRAPPER_EXTENSION_SEARCH_ARGS +{ + DWORD cbSize; + LPCWSTR wzId; + LPCWSTR wzVariable; +} BOOTSTRAPPER_EXTENSION_SEARCH_ARGS; + +typedef struct _BOOTSTRAPPER_EXTENSION_SEARCH_RESULTS +{ + DWORD cbSize; +} BOOTSTRAPPER_EXTENSION_SEARCH_RESULTS; + +extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_EXTENSION_PROC)( + __in BOOTSTRAPPER_EXTENSION_MESSAGE message, + __in const LPVOID pvArgs, + __inout LPVOID pvResults, + __in_opt LPVOID pvContext + ); + +typedef struct _BOOTSTRAPPER_EXTENSION_CREATE_ARGS +{ + DWORD cbSize; + DWORD64 qwEngineAPIVersion; + PFN_BOOTSTRAPPER_EXTENSION_ENGINE_PROC pfnBootstrapperExtensionEngineProc; + LPVOID pvBootstrapperExtensionEngineProcContext; + LPCWSTR wzBootstrapperWorkingFolder; + LPCWSTR wzBootstrapperExtensionDataPath; + LPCWSTR wzExtensionId; +} BOOTSTRAPPER_EXTENSION_CREATE_ARGS; + +typedef struct _BOOTSTRAPPER_EXTENSION_CREATE_RESULTS +{ + DWORD cbSize; + PFN_BOOTSTRAPPER_EXTENSION_PROC pfnBootstrapperExtensionProc; + LPVOID pvBootstrapperExtensionProcContext; +} BOOTSTRAPPER_EXTENSION_CREATE_RESULTS; + +extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_EXTENSION_CREATE)( + __in const BOOTSTRAPPER_EXTENSION_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_EXTENSION_CREATE_RESULTS* pResults + ); + +extern "C" typedef void (WINAPI *PFN_BOOTSTRAPPER_EXTENSION_DESTROY)(); + +#if defined(__cplusplus) +} +#endif diff --git a/src/api/burn/inc/BootstrapperExtensionEngine.h b/src/api/burn/inc/BootstrapperExtensionEngine.h new file mode 100644 index 00000000..24c304c6 --- /dev/null +++ b/src/api/burn/inc/BootstrapperExtensionEngine.h @@ -0,0 +1,200 @@ +#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. + + +#if defined(__cplusplus) +extern "C" { +#endif + +enum BOOTSTRAPPER_EXTENSION_LOG_LEVEL +{ + BOOTSTRAPPER_EXTENSION_LOG_LEVEL_NONE, // turns off report (only valid for XXXSetLevel()) + BOOTSTRAPPER_EXTENSION_LOG_LEVEL_STANDARD, // written if reporting is on + BOOTSTRAPPER_EXTENSION_LOG_LEVEL_VERBOSE, // written only if verbose reporting is on + BOOTSTRAPPER_EXTENSION_LOG_LEVEL_DEBUG, // reporting useful when debugging code + BOOTSTRAPPER_EXTENSION_LOG_LEVEL_ERROR, // always gets reported, but can never be specified +}; + +enum BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE +{ + BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_ESCAPESTRING, + BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_EVALUATECONDITION, + BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_FORMATSTRING, + BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_GETVARIABLENUMERIC, + BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_GETVARIABLESTRING, + BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_GETVARIABLEVERSION, + BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_LOG, + BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_SETVARIABLENUMERIC, + BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_SETVARIABLESTRING, + BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_SETVARIABLEVERSION, + BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_COMPAREVERSIONS, + BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE, +}; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS +{ + DWORD cbSize; + LPCWSTR wzVersion1; + LPCWSTR wzVersion2; +} BOOTSTRAPPER_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS +{ + DWORD cbSize; + int nResult; +} BOOTSTRAPPER_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_ESCAPESTRING_ARGS +{ + DWORD cbSize; + LPCWSTR wzIn; +} BOOTSTRAPPER_EXTENSION_ENGINE_ESCAPESTRING_ARGS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_ESCAPESTRING_RESULTS +{ + DWORD cbSize; + LPWSTR wzOut; + // Should be initialized to the size of wzOut. + SIZE_T cchOut; +} BOOTSTRAPPER_EXTENSION_ENGINE_ESCAPESTRING_RESULTS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_EVALUATECONDITION_ARGS +{ + DWORD cbSize; + LPCWSTR wzCondition; +} BOOTSTRAPPER_EXTENSION_ENGINE_EVALUATECONDITION_ARGS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS +{ + DWORD cbSize; + BOOL f; +} BOOTSTRAPPER_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_FORMATSTRING_ARGS +{ + DWORD cbSize; + LPCWSTR wzIn; +} BOOTSTRAPPER_EXTENSION_ENGINE_FORMATSTRING_ARGS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_FORMATSTRING_RESULTS +{ + DWORD cbSize; + LPWSTR wzOut; + // Should be initialized to the size of wzOut. + SIZE_T cchOut; +} BOOTSTRAPPER_EXTENSION_ENGINE_FORMATSTRING_RESULTS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; +} BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS +{ + DWORD cbSize; + LONGLONG llValue; +} BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; +} BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS +{ + DWORD cbSize; + LPWSTR wzValue; + // Should be initialized to the size of wzValue. + SIZE_T cchValue; +} BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; +} BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS +{ + DWORD cbSize; + LPWSTR wzValue; + // Should be initialized to the size of wzValue. + SIZE_T cchValue; +} BOOTSTRAPPER_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_LOG_ARGS +{ + DWORD cbSize; + BOOTSTRAPPER_EXTENSION_LOG_LEVEL level; + LPCWSTR wzMessage; +} BOOTSTRAPPER_EXTENSION_ENGINE_LOG_ARGS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_LOG_RESULTS +{ + DWORD cbSize; +} BOOTSTRAPPER_EXTENSION_ENGINE_LOG_RESULTS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; + LONGLONG llValue; +} BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS +{ + DWORD cbSize; +} BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; + LPCWSTR wzValue; + BOOL fFormatted; +} BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS +{ + DWORD cbSize; +} BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; + LPCWSTR wzValue; +} BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS +{ + DWORD cbSize; +} BOOTSTRAPPER_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_ARGS +{ + DWORD cbSize; + LPCWSTR wzBundleId; + LPCWSTR wzVariable; +} BOOTSTRAPPER_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_ARGS; + +typedef struct _BOOTSTRAPPER_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS +{ + DWORD cbSize; + LPWSTR wzValue; + // Should be initialized to the size of wzValue. + SIZE_T cchValue; +} BOOTSTRAPPER_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS; + +extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_EXTENSION_ENGINE_PROC)( + __in BOOTSTRAPPER_EXTENSION_ENGINE_MESSAGE message, + __in const LPVOID pvArgs, + __inout LPVOID pvResults, + __in_opt LPVOID pvContext + ); + +#if defined(__cplusplus) +} +#endif diff --git a/src/api/burn/inc/BundleExtension.h b/src/api/burn/inc/BundleExtension.h deleted file mode 100644 index 17acff6e..00000000 --- a/src/api/burn/inc/BundleExtension.h +++ /dev/null @@ -1,61 +0,0 @@ -#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 - -#if defined(__cplusplus) -extern "C" { -#endif - -enum BUNDLE_EXTENSION_MESSAGE -{ - BUNDLE_EXTENSION_MESSAGE_SEARCH, -}; - -typedef struct _BUNDLE_EXTENSION_SEARCH_ARGS -{ - DWORD cbSize; - LPCWSTR wzId; - LPCWSTR wzVariable; -} BUNDLE_EXTENSION_SEARCH_ARGS; - -typedef struct _BUNDLE_EXTENSION_SEARCH_RESULTS -{ - DWORD cbSize; -} BUNDLE_EXTENSION_SEARCH_RESULTS; - -extern "C" typedef HRESULT(WINAPI *PFN_BUNDLE_EXTENSION_PROC)( - __in BUNDLE_EXTENSION_MESSAGE message, - __in const LPVOID pvArgs, - __inout LPVOID pvResults, - __in_opt LPVOID pvContext - ); - -typedef struct _BUNDLE_EXTENSION_CREATE_ARGS -{ - DWORD cbSize; - DWORD64 qwEngineAPIVersion; - PFN_BUNDLE_EXTENSION_ENGINE_PROC pfnBundleExtensionEngineProc; - LPVOID pvBundleExtensionEngineProcContext; - LPCWSTR wzBootstrapperWorkingFolder; - LPCWSTR wzBundleExtensionDataPath; - LPCWSTR wzExtensionId; -} BUNDLE_EXTENSION_CREATE_ARGS; - -typedef struct _BUNDLE_EXTENSION_CREATE_RESULTS -{ - DWORD cbSize; - PFN_BUNDLE_EXTENSION_PROC pfnBundleExtensionProc; - LPVOID pvBundleExtensionProcContext; -} BUNDLE_EXTENSION_CREATE_RESULTS; - -extern "C" typedef HRESULT(WINAPI *PFN_BUNDLE_EXTENSION_CREATE)( - __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs, - __inout BUNDLE_EXTENSION_CREATE_RESULTS* pResults - ); - -extern "C" typedef void (WINAPI *PFN_BUNDLE_EXTENSION_DESTROY)(); - -#if defined(__cplusplus) -} -#endif diff --git a/src/api/burn/inc/BundleExtensionEngine.h b/src/api/burn/inc/BundleExtensionEngine.h deleted file mode 100644 index b585d1a2..00000000 --- a/src/api/burn/inc/BundleExtensionEngine.h +++ /dev/null @@ -1,200 +0,0 @@ -#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. - - -#if defined(__cplusplus) -extern "C" { -#endif - -enum BUNDLE_EXTENSION_LOG_LEVEL -{ - BUNDLE_EXTENSION_LOG_LEVEL_NONE, // turns off report (only valid for XXXSetLevel()) - BUNDLE_EXTENSION_LOG_LEVEL_STANDARD, // written if reporting is on - BUNDLE_EXTENSION_LOG_LEVEL_VERBOSE, // written only if verbose reporting is on - BUNDLE_EXTENSION_LOG_LEVEL_DEBUG, // reporting useful when debugging code - BUNDLE_EXTENSION_LOG_LEVEL_ERROR, // always gets reported, but can never be specified -}; - -enum BUNDLE_EXTENSION_ENGINE_MESSAGE -{ - BUNDLE_EXTENSION_ENGINE_MESSAGE_ESCAPESTRING, - BUNDLE_EXTENSION_ENGINE_MESSAGE_EVALUATECONDITION, - BUNDLE_EXTENSION_ENGINE_MESSAGE_FORMATSTRING, - BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLENUMERIC, - BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLESTRING, - BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLEVERSION, - BUNDLE_EXTENSION_ENGINE_MESSAGE_LOG, - BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLENUMERIC, - BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLESTRING, - BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLEVERSION, - BUNDLE_EXTENSION_ENGINE_MESSAGE_COMPAREVERSIONS, - BUNDLE_EXTENSION_ENGINE_MESSAGE_GETRELATEDBUNDLEVARIABLE, -}; - -typedef struct _BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS -{ - DWORD cbSize; - LPCWSTR wzVersion1; - LPCWSTR wzVersion2; -} BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS -{ - DWORD cbSize; - int nResult; -} BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_ARGS -{ - DWORD cbSize; - LPCWSTR wzIn; -} BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_ARGS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_RESULTS -{ - DWORD cbSize; - LPWSTR wzOut; - // Should be initialized to the size of wzOut. - SIZE_T cchOut; -} BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_RESULTS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_ARGS -{ - DWORD cbSize; - LPCWSTR wzCondition; -} BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_ARGS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS -{ - DWORD cbSize; - BOOL f; -} BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_FORMATSTRING_ARGS -{ - DWORD cbSize; - LPCWSTR wzIn; -} BUNDLE_EXTENSION_ENGINE_FORMATSTRING_ARGS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_FORMATSTRING_RESULTS -{ - DWORD cbSize; - LPWSTR wzOut; - // Should be initialized to the size of wzOut. - SIZE_T cchOut; -} BUNDLE_EXTENSION_ENGINE_FORMATSTRING_RESULTS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS -{ - DWORD cbSize; - LPCWSTR wzVariable; -} BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS -{ - DWORD cbSize; - LONGLONG llValue; -} BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS -{ - DWORD cbSize; - LPCWSTR wzVariable; -} BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS -{ - DWORD cbSize; - LPWSTR wzValue; - // Should be initialized to the size of wzValue. - SIZE_T cchValue; -} BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS -{ - DWORD cbSize; - LPCWSTR wzVariable; -} BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS -{ - DWORD cbSize; - LPWSTR wzValue; - // Should be initialized to the size of wzValue. - SIZE_T cchValue; -} BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_LOG_ARGS -{ - DWORD cbSize; - BUNDLE_EXTENSION_LOG_LEVEL level; - LPCWSTR wzMessage; -} BUNDLE_EXTENSION_ENGINE_LOG_ARGS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_LOG_RESULTS -{ - DWORD cbSize; -} BUNDLE_EXTENSION_ENGINE_LOG_RESULTS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS -{ - DWORD cbSize; - LPCWSTR wzVariable; - LONGLONG llValue; -} BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS -{ - DWORD cbSize; -} BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS -{ - DWORD cbSize; - LPCWSTR wzVariable; - LPCWSTR wzValue; - BOOL fFormatted; -} BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS -{ - DWORD cbSize; -} BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS -{ - DWORD cbSize; - LPCWSTR wzVariable; - LPCWSTR wzValue; -} BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS -{ - DWORD cbSize; -} BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_ARGS -{ - DWORD cbSize; - LPCWSTR wzBundleId; - LPCWSTR wzVariable; -} BUNDLE_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_ARGS; - -typedef struct _BUNDLE_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS -{ - DWORD cbSize; - LPWSTR wzValue; - // Should be initialized to the size of wzValue. - SIZE_T cchValue; -} BUNDLE_EXTENSION_ENGINE_GETRELATEDBUNDLEVARIABLE_RESULTS; - -extern "C" typedef HRESULT(WINAPI *PFN_BUNDLE_EXTENSION_ENGINE_PROC)( - __in BUNDLE_EXTENSION_ENGINE_MESSAGE message, - __in const LPVOID pvArgs, - __inout LPVOID pvResults, - __in_opt LPVOID pvContext - ); - -#if defined(__cplusplus) -} -#endif diff --git a/src/api/burn/test/BextUtilUnitTest/BextUtilUnitTest.vcxproj b/src/api/burn/test/BextUtilUnitTest/BextUtilUnitTest.vcxproj index 6e8dfee1..39135dcf 100644 --- a/src/api/burn/test/BextUtilUnitTest/BextUtilUnitTest.vcxproj +++ b/src/api/burn/test/BextUtilUnitTest/BextUtilUnitTest.vcxproj @@ -36,18 +36,18 @@ - + Create 4564;4691 - + - + diff --git a/src/api/burn/test/BextUtilUnitTest/BextUtilUnitTest.vcxproj.filters b/src/api/burn/test/BextUtilUnitTest/BextUtilUnitTest.vcxproj.filters index 73f2194d..678f04f5 100644 --- a/src/api/burn/test/BextUtilUnitTest/BextUtilUnitTest.vcxproj.filters +++ b/src/api/burn/test/BextUtilUnitTest/BextUtilUnitTest.vcxproj.filters @@ -15,13 +15,13 @@ - + Source Files Source Files - + Source Files @@ -29,8 +29,8 @@ Header Files - + Header Files - \ No newline at end of file + diff --git a/src/api/burn/test/BextUtilUnitTest/BootstrapperExtensionTests.cpp b/src/api/burn/test/BextUtilUnitTest/BootstrapperExtensionTests.cpp new file mode 100644 index 00000000..c2882587 --- /dev/null +++ b/src/api/burn/test/BextUtilUnitTest/BootstrapperExtensionTests.cpp @@ -0,0 +1,44 @@ +// 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" + +using namespace System; +using namespace Xunit; +using namespace WixInternal::TestSupport; +using namespace WixInternal::TestSupport::XunitExtensions; + +namespace BextUtilTests +{ + public ref class BootstrapperExtension + { + public: + [Fact] + void CanCreateTestBootstrapperExtension() + { + HRESULT hr = S_OK; + BOOTSTRAPPER_EXTENSION_CREATE_ARGS args = { }; + BOOTSTRAPPER_EXTENSION_CREATE_RESULTS results = { }; + IBootstrapperExtensionEngine* pEngine = NULL; + IBootstrapperExtension* pBootstrapperExtension = NULL; + + args.cbSize = sizeof(args); + args.wzBootstrapperExtensionDataPath = L"test.xml"; + + results.cbSize = sizeof(results); + + try + { + hr = BextInitializeFromCreateArgs(&args, &pEngine); + NativeAssert::Succeeded(hr, "Failed to create engine."); + + hr = TestBootstrapperExtensionCreate(pEngine, &args, &results, &pBootstrapperExtension); + NativeAssert::Succeeded(hr, "Failed to create BootstrapperApplication."); + } + finally + { + ReleaseObject(pEngine); + ReleaseObject(pBootstrapperExtension); + } + } + }; +} diff --git a/src/api/burn/test/BextUtilUnitTest/BundleExtensionTests.cpp b/src/api/burn/test/BextUtilUnitTest/BundleExtensionTests.cpp deleted file mode 100644 index 5c5c5812..00000000 --- a/src/api/burn/test/BextUtilUnitTest/BundleExtensionTests.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// 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" - -using namespace System; -using namespace Xunit; -using namespace WixInternal::TestSupport; -using namespace WixInternal::TestSupport::XunitExtensions; - -namespace BextUtilTests -{ - public ref class BundleExtension - { - public: - [Fact] - void CanCreateTestBundleExtension() - { - HRESULT hr = S_OK; - BUNDLE_EXTENSION_CREATE_ARGS args = { }; - BUNDLE_EXTENSION_CREATE_RESULTS results = { }; - IBundleExtensionEngine* pEngine = NULL; - IBundleExtension* pBundleExtension = NULL; - - args.cbSize = sizeof(args); - args.wzBundleExtensionDataPath = L"test.xml"; - - results.cbSize = sizeof(results); - - try - { - hr = BextInitializeFromCreateArgs(&args, &pEngine); - NativeAssert::Succeeded(hr, "Failed to create engine."); - - hr = TestBundleExtensionCreate(pEngine, &args, &results, &pBundleExtension); - NativeAssert::Succeeded(hr, "Failed to create BootstrapperApplication."); - } - finally - { - ReleaseObject(pEngine); - ReleaseObject(pBundleExtension); - } - } - }; -} diff --git a/src/api/burn/test/BextUtilUnitTest/TestBootstrapperExtension.cpp b/src/api/burn/test/BextUtilUnitTest/TestBootstrapperExtension.cpp new file mode 100644 index 00000000..225123da --- /dev/null +++ b/src/api/burn/test/BextUtilUnitTest/TestBootstrapperExtension.cpp @@ -0,0 +1,42 @@ +// 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 "BextBaseBootstrapperExtension.h" +#include "BextBaseBootstrapperExtensionProc.h" + +class CTestBootstrapperExtension : public CBextBaseBootstrapperExtension +{ +public: + CTestBootstrapperExtension( + __in IBootstrapperExtensionEngine* pEngine + ) : CBextBaseBootstrapperExtension(pEngine) + { + } +}; + +HRESULT TestBootstrapperExtensionCreate( + __in IBootstrapperExtensionEngine* pEngine, + __in const BOOTSTRAPPER_EXTENSION_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_EXTENSION_CREATE_RESULTS* pResults, + __out IBootstrapperExtension** ppBootstrapperExtension + ) +{ + HRESULT hr = S_OK; + CTestBootstrapperExtension* pExtension = NULL; + + pExtension = new CTestBootstrapperExtension(pEngine); + ExitOnNull(pExtension, hr, E_OUTOFMEMORY, "Failed to create new CTestBootstrapperExtension."); + + hr = pExtension->Initialize(pArgs); + ExitOnFailure(hr, "CTestBootstrapperExtension initialization failed"); + + pResults->pfnBootstrapperExtensionProc = BextBaseBootstrapperExtensionProc; + pResults->pvBootstrapperExtensionProcContext = pExtension; + + *ppBootstrapperExtension = pExtension; + pExtension = NULL; + +LExit: + ReleaseObject(pExtension); + return hr; +} diff --git a/src/api/burn/test/BextUtilUnitTest/TestBootstrapperExtension.h b/src/api/burn/test/BextUtilUnitTest/TestBootstrapperExtension.h new file mode 100644 index 00000000..00e4243c --- /dev/null +++ b/src/api/burn/test/BextUtilUnitTest/TestBootstrapperExtension.h @@ -0,0 +1,9 @@ +#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. + +HRESULT TestBootstrapperExtensionCreate( + __in IBootstrapperExtensionEngine* pEngine, + __in const BOOTSTRAPPER_EXTENSION_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_EXTENSION_CREATE_RESULTS* pResults, + __out IBootstrapperExtension** ppBootstrapperExtension + ); diff --git a/src/api/burn/test/BextUtilUnitTest/TestBundleExtension.cpp b/src/api/burn/test/BextUtilUnitTest/TestBundleExtension.cpp deleted file mode 100644 index 921303bb..00000000 --- a/src/api/burn/test/BextUtilUnitTest/TestBundleExtension.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// 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 "BextBaseBundleExtension.h" -#include "BextBaseBundleExtensionProc.h" - -class CTestBundleExtension : public CBextBaseBundleExtension -{ -public: - CTestBundleExtension( - __in IBundleExtensionEngine* pEngine - ) : CBextBaseBundleExtension(pEngine) - { - } -}; - -HRESULT TestBundleExtensionCreate( - __in IBundleExtensionEngine* pEngine, - __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs, - __inout BUNDLE_EXTENSION_CREATE_RESULTS* pResults, - __out IBundleExtension** ppBundleExtension - ) -{ - HRESULT hr = S_OK; - CTestBundleExtension* pExtension = NULL; - - pExtension = new CTestBundleExtension(pEngine); - ExitOnNull(pExtension, hr, E_OUTOFMEMORY, "Failed to create new CTestBundleExtension."); - - hr = pExtension->Initialize(pArgs); - ExitOnFailure(hr, "CTestBundleExtension initialization failed"); - - pResults->pfnBundleExtensionProc = BextBaseBundleExtensionProc; - pResults->pvBundleExtensionProcContext = pExtension; - - *ppBundleExtension = pExtension; - pExtension = NULL; - -LExit: - ReleaseObject(pExtension); - return hr; -} diff --git a/src/api/burn/test/BextUtilUnitTest/TestBundleExtension.h b/src/api/burn/test/BextUtilUnitTest/TestBundleExtension.h deleted file mode 100644 index 5cfe8b39..00000000 --- a/src/api/burn/test/BextUtilUnitTest/TestBundleExtension.h +++ /dev/null @@ -1,9 +0,0 @@ -#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. - -HRESULT TestBundleExtensionCreate( - __in IBundleExtensionEngine* pEngine, - __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs, - __inout BUNDLE_EXTENSION_CREATE_RESULTS* pResults, - __out IBundleExtension** ppBundleExtension - ); diff --git a/src/api/burn/test/BextUtilUnitTest/precomp.h b/src/api/burn/test/BextUtilUnitTest/precomp.h index 00bf872f..893a2ac4 100644 --- a/src/api/burn/test/BextUtilUnitTest/precomp.h +++ b/src/api/burn/test/BextUtilUnitTest/precomp.h @@ -9,7 +9,7 @@ #include #include -#include "TestBundleExtension.h" +#include "TestBootstrapperExtension.h" #pragma managed #include diff --git a/src/api/wix/WixToolset.Data/Burn/BurnConstants.cs b/src/api/wix/WixToolset.Data/Burn/BurnConstants.cs index 9e74827c..1b082952 100644 --- a/src/api/wix/WixToolset.Data/Burn/BurnConstants.cs +++ b/src/api/wix/WixToolset.Data/Burn/BurnConstants.cs @@ -11,13 +11,13 @@ namespace WixToolset.Data.Burn public const string BundleLayoutOnlyPayloadsName = "BundleLayoutOnlyPayloads"; public const string BurnManifestWixOutputStreamName = "wix-burndata.xml"; - public const string BundleExtensionDataWixOutputStreamName = "wix-bextdata"; + public const string BootstrapperExtensionDataWixOutputStreamName = "wix-bextdata"; public const string BootstrapperApplicationDataWixOutputStreamName = "wix-badata.xml"; public const string BootstrapperApplicationDataNamespace = "http://wixtoolset.org/schemas/v4/BootstrapperApplicationData"; - public const string BundleExtensionDataNamespace = "http://wixtoolset.org/schemas/v4/BundleExtensionData"; + public const string BootstrapperExtensionDataNamespace = "http://wixtoolset.org/schemas/v4/BootstrapperExtensionData"; public const string BootstrapperApplicationDataSymbolDefinitionTag = "WixBootstrapperApplicationData"; - public const string BundleExtensionSearchSymbolDefinitionTag = "WixBundleExtensionSearch"; + public const string BootstrapperExtensionSearchSymbolDefinitionTag = "WixBootstrapperExtensionSearch"; } } diff --git a/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs b/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs index 688c34ed..facca956 100644 --- a/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs +++ b/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs @@ -130,7 +130,7 @@ namespace WixToolset.Data WixBundleBundlePackagePayload, WixBundleExePackage, WixBundleExePackagePayload, - WixBundleExtension, + WixBootstrapperExtension, WixBundleHarvestedBundlePackage, WixBundleHarvestedDependencyProvider, WixBundleHarvestedMsiPackage, @@ -579,8 +579,8 @@ namespace WixToolset.Data case SymbolDefinitionType.WixBundleCustomDataCell: return SymbolDefinitions.WixBundleCustomDataCell; - case SymbolDefinitionType.WixBundleExtension: - return SymbolDefinitions.WixBundleExtension; + case SymbolDefinitionType.WixBootstrapperExtension: + return SymbolDefinitions.WixBootstrapperExtension; case SymbolDefinitionType.WixBundleExePackage: return SymbolDefinitions.WixBundleExePackage; diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBootstrapperExtensionSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBootstrapperExtensionSymbol.cs new file mode 100644 index 00000000..b53848fc --- /dev/null +++ b/src/api/wix/WixToolset.Data/Symbols/WixBootstrapperExtensionSymbol.cs @@ -0,0 +1,44 @@ +// 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. + +namespace WixToolset.Data +{ + using WixToolset.Data.Symbols; + + public static partial class SymbolDefinitions + { + public static readonly IntermediateSymbolDefinition WixBootstrapperExtension = new IntermediateSymbolDefinition( + SymbolDefinitionType.WixBootstrapperExtension, + new[] + { + new IntermediateFieldDefinition(nameof(WixBootstrapperExtensionSymbolFields.PayloadRef), IntermediateFieldType.String), + }, + typeof(WixBootstrapperExtensionSymbol)); + } +} + +namespace WixToolset.Data.Symbols +{ + public enum WixBootstrapperExtensionSymbolFields + { + PayloadRef, + } + + public class WixBootstrapperExtensionSymbol : IntermediateSymbol + { + public WixBootstrapperExtensionSymbol() : base(SymbolDefinitions.WixBootstrapperExtension, null, null) + { + } + + public WixBootstrapperExtensionSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.WixBootstrapperExtension, sourceLineNumber, id) + { + } + + public IntermediateField this[WixBootstrapperExtensionSymbolFields index] => this.Fields[(int)index]; + + public string PayloadRef + { + get => (string)this.Fields[(int)WixBootstrapperExtensionSymbolFields.PayloadRef]; + set => this.Set((int)WixBootstrapperExtensionSymbolFields.PayloadRef, value); + } + } +} diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleCustomDataSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleCustomDataSymbol.cs index 0490f9f7..032ebda8 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleCustomDataSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleCustomDataSymbol.cs @@ -12,7 +12,7 @@ namespace WixToolset.Data { new IntermediateFieldDefinition(nameof(WixBundleCustomDataSymbolFields.AttributeNames), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundleCustomDataSymbolFields.Type), IntermediateFieldType.Number), - new IntermediateFieldDefinition(nameof(WixBundleCustomDataSymbolFields.BundleExtensionRef), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixBundleCustomDataSymbolFields.BootstrapperExtensionRef), IntermediateFieldType.String), }, typeof(WixBundleCustomDataSymbol)); } @@ -24,14 +24,14 @@ namespace WixToolset.Data.Symbols { AttributeNames, Type, - BundleExtensionRef, + BootstrapperExtensionRef, } public enum WixBundleCustomDataType { Unknown, BootstrapperApplication, - BundleExtension, + BootstrapperExtension, } public class WixBundleCustomDataSymbol : IntermediateSymbol @@ -60,10 +60,10 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundleCustomDataSymbolFields.Type, (int)value); } - public string BundleExtensionRef + public string BootstrapperExtensionRef { - get => (string)this.Fields[(int)WixBundleCustomDataSymbolFields.BundleExtensionRef]; - set => this.Set((int)WixBundleCustomDataSymbolFields.BundleExtensionRef, value); + get => (string)this.Fields[(int)WixBundleCustomDataSymbolFields.BootstrapperExtensionRef]; + set => this.Set((int)WixBundleCustomDataSymbolFields.BootstrapperExtensionRef, value); } public string[] AttributeNamesSeparated => this.AttributeNames.Split(AttributeNamesSeparator); diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleExtensionSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleExtensionSymbol.cs deleted file mode 100644 index 8e6bea58..00000000 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleExtensionSymbol.cs +++ /dev/null @@ -1,44 +0,0 @@ -// 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. - -namespace WixToolset.Data -{ - using WixToolset.Data.Symbols; - - public static partial class SymbolDefinitions - { - public static readonly IntermediateSymbolDefinition WixBundleExtension = new IntermediateSymbolDefinition( - SymbolDefinitionType.WixBundleExtension, - new[] - { - new IntermediateFieldDefinition(nameof(WixBundleExtensionSymbolFields.PayloadRef), IntermediateFieldType.String), - }, - typeof(WixBundleExtensionSymbol)); - } -} - -namespace WixToolset.Data.Symbols -{ - public enum WixBundleExtensionSymbolFields - { - PayloadRef, - } - - public class WixBundleExtensionSymbol : IntermediateSymbol - { - public WixBundleExtensionSymbol() : base(SymbolDefinitions.WixBundleExtension, null, null) - { - } - - public WixBundleExtensionSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.WixBundleExtension, sourceLineNumber, id) - { - } - - public IntermediateField this[WixBundleExtensionSymbolFields index] => this.Fields[(int)index]; - - public string PayloadRef - { - get => (string)this.Fields[(int)WixBundleExtensionSymbolFields.PayloadRef]; - set => this.Set((int)WixBundleExtensionSymbolFields.PayloadRef, value); - } - } -} diff --git a/src/api/wix/WixToolset.Data/Symbols/WixSearchSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixSearchSymbol.cs index 2d6a927c..5327d035 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixSearchSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixSearchSymbol.cs @@ -12,7 +12,7 @@ namespace WixToolset.Data { new IntermediateFieldDefinition(nameof(WixSearchSymbolFields.Variable), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixSearchSymbolFields.Condition), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixSearchSymbolFields.BundleExtensionRef), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixSearchSymbolFields.BootstrapperExtensionRef), IntermediateFieldType.String), }, typeof(WixSearchSymbol)); } @@ -24,7 +24,7 @@ namespace WixToolset.Data.Symbols { Variable, Condition, - BundleExtensionRef, + BootstrapperExtensionRef, } public class WixSearchSymbol : IntermediateSymbol @@ -51,10 +51,10 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixSearchSymbolFields.Condition, value); } - public string BundleExtensionRef + public string BootstrapperExtensionRef { - get => (string)this.Fields[(int)WixSearchSymbolFields.BundleExtensionRef]; - set => this.Set((int)WixSearchSymbolFields.BundleExtensionRef, value); + get => (string)this.Fields[(int)WixSearchSymbolFields.BootstrapperExtensionRef]; + set => this.Set((int)WixSearchSymbolFields.BootstrapperExtensionRef, value); } } -} \ No newline at end of file +} diff --git a/src/api/wix/WixToolset.Extensibility/Services/IBurnBackendHelper.cs b/src/api/wix/WixToolset.Extensibility/Services/IBurnBackendHelper.cs index 1b6a2828..a404a778 100644 --- a/src/api/wix/WixToolset.Extensibility/Services/IBurnBackendHelper.cs +++ b/src/api/wix/WixToolset.Extensibility/Services/IBurnBackendHelper.cs @@ -28,14 +28,14 @@ namespace WixToolset.Extensibility.Services void AddBootstrapperApplicationData(IntermediateSymbol symbol, bool symbolIdIsIdAttribute = false); /// - /// Adds the given XML to the BundleExtensionData manifest for the given bundle extension. + /// Adds the given XML to the BootstrapperExtensionData manifest for the given bundle extension. /// /// The bundle extension's id. /// A valid XML fragment. - void AddBundleExtensionData(string extensionId, string xml); + void AddBootstrapperExtensionData(string extensionId, string xml); /// - /// Adds an XML element for the given symbol to the BundleExtensionData manifest for the given bundle extension. + /// Adds an XML element for the given symbol to the BootstrapperExtensionData manifest for the given bundle extension. /// The symbol's name is used for the element's name. /// All of the symbol's fields are used for the element's attributes. /// @@ -45,6 +45,6 @@ namespace WixToolset.Extensibility.Services /// If true and the symbol has an Id, /// then an Id attribute is created with a value of the symbol's Id. /// - void AddBundleExtensionData(string extensionId, IntermediateSymbol symbol, bool symbolIdIsIdAttribute = false); + void AddBootstrapperExtensionData(string extensionId, IntermediateSymbol symbol, bool symbolIdIsIdAttribute = false); } } diff --git a/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs b/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs index e7856c7c..b3b1b4c1 100644 --- a/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs +++ b/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs @@ -201,8 +201,8 @@ namespace WixToolset.Extensibility.Services /// The Burn variable to store the result into. /// A condition to test before evaluating the search. /// The search that this one will execute after. - /// The id of the bundle extension that handles this search. - void CreateWixSearchSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, string elementName, Identifier id, string variable, string condition, string after, string bundleExtensionId); + /// The id of the bootstrapper extension that handles this search. + void CreateWixSearchSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, string elementName, Identifier id, string variable, string condition, string after, string bootstrapperExtensionId); /// /// -- cgit v1.2.3-55-g6feb