diff options
author | Rob Mensching <rob@firegiant.com> | 2024-03-07 09:41:29 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2024-03-07 10:55:57 -0800 |
commit | 5baa1dfe8ba2a3bd4728bca118fe1de225f848d4 (patch) | |
tree | 4f1c216075173e0e4d0863ada195f21d7ec976e0 /src/ext/Util/be/UtilBootstrapperExtension.cpp | |
parent | dea25ba9bcfd65200b60339c2e4bc060cdf20723 (diff) | |
download | wix-5baa1dfe8ba2a3bd4728bca118fe1de225f848d4.tar.gz wix-5baa1dfe8ba2a3bd4728bca118fe1de225f848d4.tar.bz2 wix-5baa1dfe8ba2a3bd4728bca118fe1de225f848d4.zip |
Rename "bundle extension" to "bootstrapper extension" for more consistency
Also renames WixToolet.BextUtil nupkg to WixToolset.BootstrapperExtensionApi.
Diffstat (limited to 'src/ext/Util/be/UtilBootstrapperExtension.cpp')
-rw-r--r-- | src/ext/Util/be/UtilBootstrapperExtension.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/ext/Util/be/UtilBootstrapperExtension.cpp b/src/ext/Util/be/UtilBootstrapperExtension.cpp new file mode 100644 index 00000000..4d4d89c7 --- /dev/null +++ b/src/ext/Util/be/UtilBootstrapperExtension.cpp | |||
@@ -0,0 +1,87 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | #include "BextBaseBootstrapperExtension.h" | ||
5 | |||
6 | class CWixUtilBootstrapperExtension : public CBextBaseBootstrapperExtension | ||
7 | { | ||
8 | public: // IBootstrapperExtension | ||
9 | virtual STDMETHODIMP Search( | ||
10 | __in LPCWSTR wzId, | ||
11 | __in LPCWSTR wzVariable | ||
12 | ) | ||
13 | { | ||
14 | HRESULT hr = S_OK; | ||
15 | |||
16 | hr = UtilSearchExecute(&m_searches, wzId, wzVariable, m_pEngine); | ||
17 | |||
18 | return hr; | ||
19 | } | ||
20 | |||
21 | public: //CBextBaseBootstrapperExtension | ||
22 | virtual STDMETHODIMP Initialize( | ||
23 | __in const BOOTSTRAPPER_EXTENSION_CREATE_ARGS* pCreateArgs | ||
24 | ) | ||
25 | { | ||
26 | HRESULT hr = S_OK; | ||
27 | IXMLDOMDocument* pixdManifest = NULL; | ||
28 | IXMLDOMNode* pixnBootstrapperExtension = NULL; | ||
29 | |||
30 | hr = __super::Initialize(pCreateArgs); | ||
31 | BextExitOnFailure(hr, "CBextBaseBootstrapperExtension initialization failed."); | ||
32 | |||
33 | hr = XmlLoadDocumentFromFile(m_sczBootstrapperExtensionDataPath, &pixdManifest); | ||
34 | BextExitOnFailure(hr, "Failed to load bundle extension manifest from path: %ls", m_sczBootstrapperExtensionDataPath); | ||
35 | |||
36 | hr = BextGetBootstrapperExtensionDataNode(pixdManifest, UTIL_BOOTSTRAPPER_EXTENSION_ID, &pixnBootstrapperExtension); | ||
37 | BextExitOnFailure(hr, "Failed to get BootstrapperExtension '%ls'", UTIL_BOOTSTRAPPER_EXTENSION_ID); | ||
38 | |||
39 | hr = UtilSearchParseFromXml(&m_searches, pixnBootstrapperExtension); | ||
40 | BextExitOnFailure(hr, "Failed to parse searches from bundle extension manifest."); | ||
41 | |||
42 | LExit: | ||
43 | ReleaseObject(pixnBootstrapperExtension); | ||
44 | ReleaseObject(pixdManifest); | ||
45 | |||
46 | return hr; | ||
47 | } | ||
48 | |||
49 | public: | ||
50 | CWixUtilBootstrapperExtension( | ||
51 | __in IBootstrapperExtensionEngine* pEngine | ||
52 | ) : CBextBaseBootstrapperExtension(pEngine) | ||
53 | { | ||
54 | m_searches = { }; | ||
55 | } | ||
56 | |||
57 | ~CWixUtilBootstrapperExtension() | ||
58 | { | ||
59 | UtilSearchUninitialize(&m_searches); | ||
60 | } | ||
61 | |||
62 | private: | ||
63 | UTIL_SEARCHES m_searches; | ||
64 | }; | ||
65 | |||
66 | HRESULT UtilBootstrapperExtensionCreate( | ||
67 | __in IBootstrapperExtensionEngine* pEngine, | ||
68 | __in const BOOTSTRAPPER_EXTENSION_CREATE_ARGS* pArgs, | ||
69 | __out IBootstrapperExtension** ppBootstrapperExtension | ||
70 | ) | ||
71 | { | ||
72 | HRESULT hr = S_OK; | ||
73 | CWixUtilBootstrapperExtension* pExtension = NULL; | ||
74 | |||
75 | pExtension = new CWixUtilBootstrapperExtension(pEngine); | ||
76 | BextExitOnNull(pExtension, hr, E_OUTOFMEMORY, "Failed to create new CWixUtilBootstrapperExtension."); | ||
77 | |||
78 | hr = pExtension->Initialize(pArgs); | ||
79 | BextExitOnFailure(hr, "CWixUtilBootstrapperExtension initialization failed."); | ||
80 | |||
81 | *ppBootstrapperExtension = pExtension; | ||
82 | pExtension = NULL; | ||
83 | |||
84 | LExit: | ||
85 | ReleaseObject(pExtension); | ||
86 | return hr; | ||
87 | } | ||