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. --- .../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 +- 19 files changed, 714 insertions(+), 714 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 (limited to 'src/api/burn/bextutil') 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" -- cgit v1.2.3-55-g6feb