aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-03-30 18:52:22 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-03-30 21:43:47 +1000
commit51af2090a7c911d0ae1b8232b11ca67613adf3ef (patch)
treeb73a03186dac016c9c7f31237b8bcdb5ba8ea58e
parent83e4e5d759903e70a9bbf75d4d084bfda49e5877 (diff)
downloadwix-51af2090a7c911d0ae1b8232b11ca67613adf3ef.tar.gz
wix-51af2090a7c911d0ae1b8232b11ca67613adf3ef.tar.bz2
wix-51af2090a7c911d0ae1b8232b11ca67613adf3ef.zip
Add bextutil.
-rw-r--r--appveyor.cmd1
-rw-r--r--balutil.sln10
-rw-r--r--src/bextutil/BextBundleExtensionEngine.cpp331
-rw-r--r--src/bextutil/bextutil.cpp179
-rw-r--r--src/bextutil/bextutil.nuspec26
-rw-r--r--src/bextutil/bextutil.vcxproj86
-rw-r--r--src/bextutil/build/WixToolset.BextUtil.props23
-rw-r--r--src/bextutil/inc/BextBaseBundleExtension.h120
-rw-r--r--src/bextutil/inc/BextBaseBundleExtensionProc.h48
-rw-r--r--src/bextutil/inc/BextBundleExtensionEngine.h17
-rw-r--r--src/bextutil/inc/IBundleExtension.h20
-rw-r--r--src/bextutil/inc/IBundleExtensionEngine.h64
-rw-r--r--src/bextutil/inc/bextutil.h76
-rw-r--r--src/bextutil/packages.config6
-rw-r--r--src/bextutil/precomp.cpp3
-rw-r--r--src/bextutil/precomp.h22
16 files changed, 1032 insertions, 0 deletions
diff --git a/appveyor.cmd b/appveyor.cmd
index 1aceb3b0..8a7782de 100644
--- a/appveyor.cmd
+++ b/appveyor.cmd
@@ -8,6 +8,7 @@ msbuild -p:Configuration=Release;Platform=x86;PlatformToolset=v140_xp
8msbuild -p:Configuration=Release;Platform=x86;PlatformToolset=v141_xp 8msbuild -p:Configuration=Release;Platform=x86;PlatformToolset=v141_xp
9 9
10msbuild -p:Configuration=Release -t:Pack src\balutil\balutil.vcxproj 10msbuild -p:Configuration=Release -t:Pack src\balutil\balutil.vcxproj
11msbuild -p:Configuration=Release -t:Pack src\bextutil\bextutil.vcxproj
11msbuild -p:Configuration=Release -t:Pack src\WixToolset.Mba.Core\WixToolset.Mba.Core.csproj 12msbuild -p:Configuration=Release -t:Pack src\WixToolset.Mba.Core\WixToolset.Mba.Core.csproj
12 13
13@popd 14@popd
diff --git a/balutil.sln b/balutil.sln
index 37d391fc..73df2292 100644
--- a/balutil.sln
+++ b/balutil.sln
@@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.29503.13
5MinimumVisualStudioVersion = 15.0.26124.0 5MinimumVisualStudioVersion = 15.0.26124.0
6Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "balutil", "src\balutil\balutil.vcxproj", "{EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}" 6Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "balutil", "src\balutil\balutil.vcxproj", "{EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}"
7EndProject 7EndProject
8Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bextutil", "src\bextutil\bextutil.vcxproj", "{06027492-1CB9-48BC-B31E-C1F9356ED07E}"
9EndProject
8Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WixToolset.Mba.Core", "src\WixToolset.Mba.Core\WixToolset.Mba.Core.csproj", "{E7E1841E-A58E-4901-B9CA-4845B807D45F}" 10Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WixToolset.Mba.Core", "src\WixToolset.Mba.Core\WixToolset.Mba.Core.csproj", "{E7E1841E-A58E-4901-B9CA-4845B807D45F}"
9EndProject 11EndProject
10Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mbanative", "src\mbanative\mbanative.vcxproj", "{665E0441-17F9-4105-B202-EDF274657F6E}" 12Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mbanative", "src\mbanative\mbanative.vcxproj", "{665E0441-17F9-4105-B202-EDF274657F6E}"
@@ -27,6 +29,14 @@ Global
27 {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Release|x64.Build.0 = Release|x64 29 {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Release|x64.Build.0 = Release|x64
28 {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Release|x86.ActiveCfg = Release|Win32 30 {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Release|x86.ActiveCfg = Release|Win32
29 {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Release|x86.Build.0 = Release|Win32 31 {EDCB8095-0E6A-43E0-BC33-C4F762FC5CDB}.Release|x86.Build.0 = Release|Win32
32 {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Debug|x64.ActiveCfg = Debug|x64
33 {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Debug|x64.Build.0 = Debug|x64
34 {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Debug|x86.ActiveCfg = Debug|Win32
35 {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Debug|x86.Build.0 = Debug|Win32
36 {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Release|x64.ActiveCfg = Release|x64
37 {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Release|x64.Build.0 = Release|x64
38 {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Release|x86.ActiveCfg = Release|Win32
39 {06027492-1CB9-48BC-B31E-C1F9356ED07E}.Release|x86.Build.0 = Release|Win32
30 {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Debug|x64.ActiveCfg = Debug|Any CPU 40 {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Debug|x64.ActiveCfg = Debug|Any CPU
31 {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Debug|x64.Build.0 = Debug|Any CPU 41 {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Debug|x64.Build.0 = Debug|Any CPU
32 {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Debug|x86.ActiveCfg = Debug|Any CPU 42 {E7E1841E-A58E-4901-B9CA-4845B807D45F}.Debug|x86.ActiveCfg = Debug|Any CPU
diff --git a/src/bextutil/BextBundleExtensionEngine.cpp b/src/bextutil/BextBundleExtensionEngine.cpp
new file mode 100644
index 00000000..02070a6f
--- /dev/null
+++ b/src/bextutil/BextBundleExtensionEngine.cpp
@@ -0,0 +1,331 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3#include "precomp.h"
4
5
6class CBextBundleExtensionEngine : public IBundleExtensionEngine
7{
8public: // IUnknown
9 virtual STDMETHODIMP QueryInterface(
10 __in REFIID riid,
11 __out LPVOID *ppvObject
12 )
13 {
14 if (!ppvObject)
15 {
16 return E_INVALIDARG;
17 }
18
19 *ppvObject = NULL;
20
21 if (::IsEqualIID(__uuidof(IBundleExtensionEngine), riid))
22 {
23 *ppvObject = static_cast<IBundleExtensionEngine*>(this);
24 }
25 else if (::IsEqualIID(IID_IUnknown, riid))
26 {
27 *ppvObject = reinterpret_cast<IUnknown*>(this);
28 }
29 else // no interface for requested iid
30 {
31 return E_NOINTERFACE;
32 }
33
34 AddRef();
35 return S_OK;
36 }
37
38 virtual STDMETHODIMP_(ULONG) AddRef()
39 {
40 return ::InterlockedIncrement(&this->m_cReferences);
41 }
42
43 virtual STDMETHODIMP_(ULONG) Release()
44 {
45 long l = ::InterlockedDecrement(&this->m_cReferences);
46 if (0 < l)
47 {
48 return l;
49 }
50
51 delete this;
52 return 0;
53 }
54
55public: // IBundleExtensionEngine
56 virtual STDMETHODIMP EscapeString(
57 __in_z LPCWSTR wzIn,
58 __out_ecount_opt(*pcchOut) LPWSTR wzOut,
59 __inout DWORD* pcchOut
60 )
61 {
62 HRESULT hr = S_OK;
63 BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_ARGS args = { };
64 BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_RESULTS results = { };
65
66 ExitOnNull(pcchOut, hr, E_INVALIDARG, "pcchOut is required");
67
68 args.cbSize = sizeof(args);
69 args.wzIn = wzIn;
70
71 results.cbSize = sizeof(results);
72 results.wzOut = wzOut;
73 results.cchOut = *pcchOut;
74
75 hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_ESCAPESTRING, &args, &results, m_pvBundleExtensionEngineProcContext);
76
77 *pcchOut = results.cchOut;
78
79 LExit:
80 return hr;
81 }
82
83 virtual STDMETHODIMP EvaluateCondition(
84 __in_z LPCWSTR wzCondition,
85 __out BOOL* pf
86 )
87 {
88 HRESULT hr = S_OK;
89 BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_ARGS args = { };
90 BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS results = { };
91
92 ExitOnNull(pf, hr, E_INVALIDARG, "pf is required");
93
94 args.cbSize = sizeof(args);
95 args.wzCondition = wzCondition;
96
97 results.cbSize = sizeof(results);
98
99 hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_EVALUATECONDITION, &args, &results, m_pvBundleExtensionEngineProcContext);
100
101 *pf = results.f;
102
103 LExit:
104 return hr;
105 }
106
107 virtual STDMETHODIMP FormatString(
108 __in_z LPCWSTR wzIn,
109 __out_ecount_opt(*pcchOut) LPWSTR wzOut,
110 __inout DWORD* pcchOut
111 )
112 {
113 HRESULT hr = S_OK;
114 BUNDLE_EXTENSION_ENGINE_FORMATSTRING_ARGS args = { };
115 BUNDLE_EXTENSION_ENGINE_FORMATSTRING_RESULTS results = { };
116
117 ExitOnNull(pcchOut, hr, E_INVALIDARG, "pcchOut is required");
118
119 args.cbSize = sizeof(args);
120 args.wzIn = wzIn;
121
122 results.cbSize = sizeof(results);
123 results.wzOut = wzOut;
124 results.cchOut = *pcchOut;
125
126 hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_FORMATSTRING, &args, &results, m_pvBundleExtensionEngineProcContext);
127
128 *pcchOut = results.cchOut;
129
130 LExit:
131 return hr;
132 }
133
134 virtual STDMETHODIMP GetVariableNumeric(
135 __in_z LPCWSTR wzVariable,
136 __out LONGLONG* pllValue
137 )
138 {
139 HRESULT hr = S_OK;
140 BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS args = { };
141 BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS results = { };
142
143 ExitOnNull(pllValue, hr, E_INVALIDARG, "pllValue is required");
144
145 args.cbSize = sizeof(args);
146 args.wzVariable = wzVariable;
147
148 results.cbSize = sizeof(results);
149
150 hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLENUMERIC, &args, &results, m_pvBundleExtensionEngineProcContext);
151
152 *pllValue = results.llValue;
153
154 LExit:
155 SecureZeroMemory(&results, sizeof(results));
156 return hr;
157 }
158
159 virtual STDMETHODIMP GetVariableString(
160 __in_z LPCWSTR wzVariable,
161 __out_ecount_opt(*pcchValue) LPWSTR wzValue,
162 __inout DWORD* pcchValue
163 )
164 {
165 HRESULT hr = S_OK;
166 BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS args = { };
167 BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS results = { };
168
169 ExitOnNull(pcchValue, hr, E_INVALIDARG, "pcchValue is required");
170
171 args.cbSize = sizeof(args);
172 args.wzVariable = wzVariable;
173
174 results.cbSize = sizeof(results);
175 results.wzValue = wzValue;
176 results.cchValue = *pcchValue;
177
178 hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLESTRING, &args, &results, m_pvBundleExtensionEngineProcContext);
179
180 *pcchValue = results.cchValue;
181
182 LExit:
183 return hr;
184 }
185
186 virtual STDMETHODIMP GetVariableVersion(
187 __in_z LPCWSTR wzVariable,
188 __out DWORD64* pqwValue
189 )
190 {
191 HRESULT hr = S_OK;
192 BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS args = { };
193 BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS results = { };
194
195 ExitOnNull(pqwValue, hr, E_INVALIDARG, "pqwValue is required");
196
197 args.cbSize = sizeof(args);
198 args.wzVariable = wzVariable;
199
200 results.cbSize = sizeof(results);
201
202 hr = m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLEVERSION, &args, &results, m_pvBundleExtensionEngineProcContext);
203
204 *pqwValue = results.qwValue;
205
206 LExit:
207 SecureZeroMemory(&results, sizeof(results));
208 return hr;
209 }
210
211 virtual STDMETHODIMP Log(
212 __in BUNDLE_EXTENSION_LOG_LEVEL level,
213 __in_z LPCWSTR wzMessage
214 )
215 {
216 BUNDLE_EXTENSION_ENGINE_LOG_ARGS args = { };
217 BUNDLE_EXTENSION_ENGINE_LOG_RESULTS results = { };
218
219 args.cbSize = sizeof(args);
220 args.level = level;
221 args.wzMessage = wzMessage;
222
223 results.cbSize = sizeof(results);
224
225 return m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_LOG, &args, &results, m_pvBundleExtensionEngineProcContext);
226 }
227
228 virtual STDMETHODIMP SetVariableLiteralString(
229 __in_z LPCWSTR wzVariable,
230 __in_z_opt LPCWSTR wzValue
231 )
232 {
233 BUNDLE_EXTENSION_ENGINE_SETVARIABLELITERALSTRING_ARGS args = { };
234 BUNDLE_EXTENSION_ENGINE_SETVARIABLELITERALSTRING_RESULTS results = { };
235
236 args.cbSize = sizeof(args);
237 args.wzVariable = wzVariable;
238 args.wzValue = wzValue;
239
240 results.cbSize = sizeof(results);
241
242 return m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLELITERALSTRING, &args, &results, m_pvBundleExtensionEngineProcContext);
243 }
244
245 virtual STDMETHODIMP SetVariableNumeric(
246 __in_z LPCWSTR wzVariable,
247 __in LONGLONG llValue
248 )
249 {
250 BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS args = { };
251 BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS results = { };
252
253 args.cbSize = sizeof(args);
254 args.wzVariable = wzVariable;
255 args.llValue = llValue;
256
257 results.cbSize = sizeof(results);
258
259 return m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLENUMERIC, &args, &results, m_pvBundleExtensionEngineProcContext);
260 }
261
262 virtual STDMETHODIMP SetVariableString(
263 __in_z LPCWSTR wzVariable,
264 __in_z_opt LPCWSTR wzValue
265 )
266 {
267 BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS args = { };
268 BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS results = { };
269
270 args.cbSize = sizeof(args);
271 args.wzVariable = wzVariable;
272 args.wzValue = wzValue;
273
274 results.cbSize = sizeof(results);
275
276 return m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLESTRING, &args, &results, m_pvBundleExtensionEngineProcContext);
277 }
278
279 virtual STDMETHODIMP SetVariableVersion(
280 __in_z LPCWSTR wzVariable,
281 __in DWORD64 qwValue
282 )
283 {
284 BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS args = { };
285 BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS results = { };
286
287 args.cbSize = sizeof(args);
288 args.wzVariable = wzVariable;
289 args.qwValue = qwValue;
290
291 results.cbSize = sizeof(results);
292
293 return m_pfnBundleExtensionEngineProc(BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLEVERSION, &args, &results, m_pvBundleExtensionEngineProcContext);
294 }
295
296public:
297 CBextBundleExtensionEngine(
298 __in PFN_BUNDLE_EXTENSION_ENGINE_PROC pfnBundleExtensionEngineProc,
299 __in_opt LPVOID pvBundleExtensionEngineProcContext
300 )
301 {
302 m_cReferences = 1;
303 m_pfnBundleExtensionEngineProc = pfnBundleExtensionEngineProc;
304 m_pvBundleExtensionEngineProcContext = pvBundleExtensionEngineProcContext;
305 }
306
307private:
308 long m_cReferences;
309 PFN_BUNDLE_EXTENSION_ENGINE_PROC m_pfnBundleExtensionEngineProc;
310 LPVOID m_pvBundleExtensionEngineProcContext;
311};
312
313HRESULT BextBundleExtensionEngineCreate(
314 __in PFN_BUNDLE_EXTENSION_ENGINE_PROC pfnBundleExtensionEngineProc,
315 __in_opt LPVOID pvBundleExtensionEngineProcContext,
316 __out IBundleExtensionEngine** ppEngineForExtension
317 )
318{
319 HRESULT hr = S_OK;
320 CBextBundleExtensionEngine* pBundleExtensionEngine = NULL;
321
322 pBundleExtensionEngine = new CBextBundleExtensionEngine(pfnBundleExtensionEngineProc, pvBundleExtensionEngineProcContext);
323 ExitOnNull(pBundleExtensionEngine, hr, E_OUTOFMEMORY, "Failed to allocate new BextBundleExtensionEngine object.");
324
325 hr = pBundleExtensionEngine->QueryInterface(IID_PPV_ARGS(ppEngineForExtension));
326 ExitOnFailure(hr, "Failed to QI for IBundleExtensionEngine from BextBundleExtensionEngine object.");
327
328LExit:
329 ReleaseObject(pBundleExtensionEngine);
330 return hr;
331}
diff --git a/src/bextutil/bextutil.cpp b/src/bextutil/bextutil.cpp
new file mode 100644
index 00000000..baf35591
--- /dev/null
+++ b/src/bextutil/bextutil.cpp
@@ -0,0 +1,179 @@
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
5static IBundleExtensionEngine* vpEngine = NULL;
6
7// prototypes
8
9DAPI_(void) BextInitialize(
10 __in IBundleExtensionEngine* pEngine
11 )
12{
13 pEngine->AddRef();
14
15 ReleaseObject(vpEngine);
16 vpEngine = pEngine;
17}
18
19DAPI_(HRESULT) BextInitializeFromCreateArgs(
20 __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs,
21 __out_opt IBundleExtensionEngine** ppEngine
22 )
23{
24 HRESULT hr = S_OK;
25 IBundleExtensionEngine* pEngine = NULL;
26
27 hr = BextBundleExtensionEngineCreate(pArgs->pfnBundleExtensionEngineProc, pArgs->pvBundleExtensionEngineProcContext, &pEngine);
28 ExitOnFailure(hr, "Failed to create BextBundleExtensionEngine.");
29
30 BextInitialize(pEngine);
31
32 if (ppEngine)
33 {
34 *ppEngine = pEngine;
35 }
36 pEngine = NULL;
37
38LExit:
39 ReleaseObject(pEngine);
40
41 return hr;
42}
43
44
45DAPI_(void) BextUninitialize()
46{
47 ReleaseNullObject(vpEngine);
48}
49
50DAPI_(HRESULT) BextGetBundleExtensionDataNode(
51 __in IXMLDOMDocument* pixdManifest,
52 __in LPCWSTR wzExtensionId,
53 __out IXMLDOMNode** ppixnBundleExtension
54 )
55{
56 HRESULT hr = S_OK;
57 IXMLDOMElement* pixeBundleExtensionData = NULL;
58 IXMLDOMNodeList* pixnNodes = NULL;
59 IXMLDOMNode* pixnNode = NULL;
60 DWORD cNodes = 0;
61 LPWSTR sczId = NULL;
62
63 // Get BundleExtensionData element.
64 hr = pixdManifest->get_documentElement(&pixeBundleExtensionData);
65 ExitOnFailure(hr, "Failed to get BundleExtensionData element.");
66
67 // Select BundleExtension nodes.
68 hr = XmlSelectNodes(pixeBundleExtensionData, L"BundleExtension", &pixnNodes);
69 ExitOnFailure(hr, "Failed to select BundleExtension nodes.");
70
71 // Get BundleExtension node count.
72 hr = pixnNodes->get_length((long*)&cNodes);
73 ExitOnFailure(hr, "Failed to get BundleExtension node count.");
74
75 if (!cNodes)
76 {
77 ExitFunction();
78 }
79
80 // Find requested extension.
81 for (DWORD i = 0; i < cNodes; ++i)
82 {
83 hr = XmlNextElement(pixnNodes, &pixnNode, NULL);
84 ExitOnFailure(hr, "Failed to get next node.");
85
86 // @Id
87 hr = XmlGetAttributeEx(pixnNode, L"Id", &sczId);
88 ExitOnFailure(hr, "Failed to get @Id.");
89
90 if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, sczId, -1, wzExtensionId, -1))
91 {
92 *ppixnBundleExtension = pixnNode;
93 pixnNode = NULL;
94
95 ExitFunction1(hr = S_OK);
96 }
97
98 // Prepare next iteration.
99 ReleaseNullObject(pixnNode);
100 }
101
102 hr = E_NOTFOUND;
103
104LExit:
105 ReleaseStr(sczId);
106 ReleaseObject(pixnNode);
107 ReleaseObject(pixnNodes);
108 ReleaseObject(pixeBundleExtensionData);
109
110 return hr;
111}
112
113
114DAPIV_(HRESULT) BextLog(
115 __in BUNDLE_EXTENSION_LOG_LEVEL level,
116 __in_z __format_string LPCSTR szFormat,
117 ...
118 )
119{
120 HRESULT hr = S_OK;
121 va_list args;
122 LPSTR sczFormattedAnsi = NULL;
123 LPWSTR sczMessage = NULL;
124
125 if (!vpEngine)
126 {
127 hr = E_POINTER;
128 ExitOnRootFailure(hr, "BextInitialize() must be called first.");
129 }
130
131 va_start(args, szFormat);
132 hr = StrAnsiAllocFormattedArgs(&sczFormattedAnsi, szFormat, args);
133 va_end(args);
134 ExitOnFailure(hr, "Failed to format log string.");
135
136 hr = StrAllocStringAnsi(&sczMessage, sczFormattedAnsi, 0, CP_UTF8);
137 ExitOnFailure(hr, "Failed to convert log string to Unicode.");
138
139 hr = vpEngine->Log(level, sczMessage);
140
141LExit:
142 ReleaseStr(sczMessage);
143 ReleaseStr(sczFormattedAnsi);
144 return hr;
145}
146
147
148DAPIV_(HRESULT) BextLogError(
149 __in HRESULT hrError,
150 __in_z __format_string LPCSTR szFormat,
151 ...
152 )
153{
154 HRESULT hr = S_OK;
155 va_list args;
156 LPSTR sczFormattedAnsi = NULL;
157 LPWSTR sczMessage = NULL;
158
159 if (!vpEngine)
160 {
161 hr = E_POINTER;
162 ExitOnRootFailure(hr, "BextInitialize() must be called first.");
163 }
164
165 va_start(args, szFormat);
166 hr = StrAnsiAllocFormattedArgs(&sczFormattedAnsi, szFormat, args);
167 va_end(args);
168 ExitOnFailure(hr, "Failed to format error log string.");
169
170 hr = StrAllocFormatted(&sczMessage, L"Error 0x%08x: %S", hrError, sczFormattedAnsi);
171 ExitOnFailure(hr, "Failed to prepend error number to error log string.");
172
173 hr = vpEngine->Log(BUNDLE_EXTENSION_LOG_LEVEL_ERROR, sczMessage);
174
175LExit:
176 ReleaseStr(sczMessage);
177 ReleaseStr(sczFormattedAnsi);
178 return hr;
179}
diff --git a/src/bextutil/bextutil.nuspec b/src/bextutil/bextutil.nuspec
new file mode 100644
index 00000000..30e0871d
--- /dev/null
+++ b/src/bextutil/bextutil.nuspec
@@ -0,0 +1,26 @@
1<?xml version="1.0"?>
2<package >
3 <metadata>
4 <id>$id$</id>
5 <version>$version$</version>
6 <authors>$authors$</authors>
7 <owners>$authors$</owners>
8 <!-- <license type="expression">MS-RL</license> -->
9 <licenseUrl>https://licenses.nuget.org/MS-RL</licenseUrl>
10 <projectUrl>https://github.com/wixtoolset/balutil</projectUrl>
11 <requireLicenseAcceptance>false</requireLicenseAcceptance>
12 <description>$description$</description>
13 <copyright>$copyright$</copyright>
14 <dependencies>
15 <dependency id="WixToolset.BootstrapperCore.Native" version="[4,5)" />
16 <dependency id="WixToolset.DUtil" version="[4,5)" />
17 </dependencies>
18 </metadata>
19
20 <files>
21 <file src="build\$id$.props" target="build\" />
22 <file src="inc\*" target="build\native\include" />
23 <file src="..\..\build\$configuration$\v140_xp\x86\bextutil.lib" target="build\native\v140\x86" />
24 <file src="..\..\build\$configuration$\v141_xp\x86\bextutil.lib" target="build\native\v141\x86" />
25 </files>
26</package>
diff --git a/src/bextutil/bextutil.vcxproj b/src/bextutil/bextutil.vcxproj
new file mode 100644
index 00000000..3deb3317
--- /dev/null
+++ b/src/bextutil/bextutil.vcxproj
@@ -0,0 +1,86 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
4<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 <Import Project="..\..\packages\WixToolset.BootstrapperCore.Native.4.0.13\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.13\build\WixToolset.BootstrapperCore.Native.props')" />
6 <Import Project="..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" />
7
8 <ItemGroup Label="ProjectConfigurations">
9 <ProjectConfiguration Include="Debug|Win32">
10 <Configuration>Debug</Configuration>
11 <Platform>Win32</Platform>
12 </ProjectConfiguration>
13 <ProjectConfiguration Include="Release|Win32">
14 <Configuration>Release</Configuration>
15 <Platform>Win32</Platform>
16 </ProjectConfiguration>
17 <ProjectConfiguration Include="Debug|x64">
18 <Configuration>Debug</Configuration>
19 <Platform>x64</Platform>
20 </ProjectConfiguration>
21 <ProjectConfiguration Include="Release|x64">
22 <Configuration>Release</Configuration>
23 <Platform>x64</Platform>
24 </ProjectConfiguration>
25 </ItemGroup>
26
27 <PropertyGroup Label="Globals">
28 <ProjectGuid>{06027492-1CB9-48BC-B31E-C1F9356ED07E}</ProjectGuid>
29 <ConfigurationType>StaticLibrary</ConfigurationType>
30 <TargetName>bextutil</TargetName>
31 <PlatformToolset>v141</PlatformToolset>
32 <CharacterSet>MultiByte</CharacterSet>
33 <Description>WiX Toolset Bundle Extension native utility library</Description>
34 </PropertyGroup>
35
36 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
37 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
38 <Import Project="..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" />
39 <Import Project="..\NativeMultiTargeting.Build.props" />
40
41 <ImportGroup Label="ExtensionSettings">
42 </ImportGroup>
43
44 <ImportGroup Label="Shared">
45 </ImportGroup>
46
47 <PropertyGroup>
48 <ProjectAdditionalIncludeDirectories>$(ProjectDir)..\inc</ProjectAdditionalIncludeDirectories>
49 </PropertyGroup>
50
51 <ItemGroup>
52 <ClCompile Include="BextBundleExtensionEngine.cpp" />
53 <ClCompile Include="bextutil.cpp" />
54 <ClCompile Include="precomp.cpp">
55 <PrecompiledHeader>Create</PrecompiledHeader>
56 </ClCompile>
57 </ItemGroup>
58 <ItemGroup>
59 <ClInclude Include="inc\BextBaseBundleExtension.h" />
60 <ClInclude Include="inc\BextBaseBundleExtensionProc.h" />
61 <ClInclude Include="inc\BextBundleExtensionEngine.h" />
62 <ClInclude Include="inc\bextutil.h" />
63 <ClInclude Include="inc\IBundleExtension.h" />
64 <ClInclude Include="inc\IBundleExtensionEngine.h" />
65 <ClInclude Include="precomp.h" />
66 </ItemGroup>
67
68 <ItemGroup>
69 <None Include="packages.config" />
70 </ItemGroup>
71
72 <Target Name="Pack"
73 DependsOnTargets="GetBuildVersion">
74 <Exec Command='nuget pack bextutil.nuspec -OutputDirectory "$(BaseOutputPath)$(Configuration)" -Properties Configuration=$(Configuration);Id=WixToolset.BextUtil;Version="$(BuildVersionSimple)";Authors="$(Authors)";Copyright="$(Copyright)";Description="$(Description)";Title="$(Title)"' />
75 </Target>
76
77 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
78 <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
79 <PropertyGroup>
80 <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
81 </PropertyGroup>
82 <Error Condition="!Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.13\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.BootstrapperCore.Native.4.0.13\build\WixToolset.BootstrapperCore.Native.props'))" />
83 <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props'))" />
84 <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" />
85 </Target>
86</Project>
diff --git a/src/bextutil/build/WixToolset.BextUtil.props b/src/bextutil/build/WixToolset.BextUtil.props
new file mode 100644
index 00000000..3e2980ec
--- /dev/null
+++ b/src/bextutil/build/WixToolset.BextUtil.props
@@ -0,0 +1,23 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
4<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 <ItemDefinitionGroup>
6 <ClCompile>
7 <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
8 </ClCompile>
9 <ResourceCompile>
10 <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
11 </ResourceCompile>
12 </ItemDefinitionGroup>
13 <ItemDefinitionGroup Condition=" $(PlatformToolset.ToLower().StartsWith('v140')) ">
14 <Link>
15 <AdditionalDependencies>$(MSBuildThisFileDirectory)native\v140\$(PlatformTarget)\bextutil.lib;%(AdditionalDependencies)</AdditionalDependencies>
16 </Link>
17 </ItemDefinitionGroup>
18 <ItemDefinitionGroup Condition=" $(PlatformToolset.ToLower().StartsWith('v141')) ">
19 <Link>
20 <AdditionalDependencies>$(MSBuildThisFileDirectory)native\v141\$(PlatformTarget)\bextutil.lib;%(AdditionalDependencies)</AdditionalDependencies>
21 </Link>
22 </ItemDefinitionGroup>
23</Project>
diff --git a/src/bextutil/inc/BextBaseBundleExtension.h b/src/bextutil/inc/BextBaseBundleExtension.h
new file mode 100644
index 00000000..69c338e4
--- /dev/null
+++ b/src/bextutil/inc/BextBaseBundleExtension.h
@@ -0,0 +1,120 @@
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 <windows.h>
4
5#include "BundleExtensionEngine.h"
6#include "BundleExtension.h"
7#include "IBundleExtensionEngine.h"
8#include "IBundleExtension.h"
9
10#include "bextutil.h"
11
12class CBextBaseBundleExtension : public IBundleExtension
13{
14public: // IUnknown
15 virtual STDMETHODIMP QueryInterface(
16 __in REFIID riid,
17 __out LPVOID *ppvObject
18 )
19 {
20 if (!ppvObject)
21 {
22 return E_INVALIDARG;
23 }
24
25 *ppvObject = NULL;
26
27 if (::IsEqualIID(__uuidof(IBundleExtension), riid))
28 {
29 *ppvObject = static_cast<IBundleExtension*>(this);
30 }
31 else if (::IsEqualIID(IID_IUnknown, riid))
32 {
33 *ppvObject = static_cast<IUnknown*>(this);
34 }
35 else // no interface for requested iid
36 {
37 return E_NOINTERFACE;
38 }
39
40 AddRef();
41 return S_OK;
42 }
43
44 virtual STDMETHODIMP_(ULONG) AddRef()
45 {
46 return ::InterlockedIncrement(&this->m_cReferences);
47 }
48
49 virtual STDMETHODIMP_(ULONG) Release()
50 {
51 long l = ::InterlockedDecrement(&this->m_cReferences);
52 if (0 < l)
53 {
54 return l;
55 }
56
57 delete this;
58 return 0;
59 }
60
61public: // IBundleExtension
62 virtual STDMETHODIMP Search(
63 __in LPCWSTR /*wzId*/,
64 __in LPCWSTR /*wzVariable*/
65 )
66 {
67 return E_NOTIMPL;
68 }
69
70 virtual STDMETHODIMP BundleExtensionProc(
71 __in BUNDLE_EXTENSION_MESSAGE /*message*/,
72 __in const LPVOID /*pvArgs*/,
73 __inout LPVOID /*pvResults*/,
74 __in_opt LPVOID /*pvContext*/
75 )
76 {
77 return E_NOTIMPL;
78 }
79
80public: //CBextBaseBundleExtension
81 virtual STDMETHODIMP Initialize(
82 __in const BUNDLE_EXTENSION_CREATE_ARGS* pCreateArgs
83 )
84 {
85 HRESULT hr = S_OK;
86
87 hr = StrAllocString(&m_sczBundleExtensionDataPath, pCreateArgs->wzBundleExtensionDataPath, 0);
88 ExitOnFailure(hr, "Failed to copy BundleExtensionDataPath.");
89
90 LExit:
91 return hr;
92 }
93
94protected:
95
96 CBextBaseBundleExtension(
97 __in IBundleExtensionEngine* pEngine
98 )
99 {
100 m_cReferences = 1;
101
102 pEngine->AddRef();
103 m_pEngine = pEngine;
104
105 m_sczBundleExtensionDataPath = NULL;
106 }
107
108 virtual ~CBextBaseBundleExtension()
109 {
110 ReleaseNullObject(m_pEngine);
111 ReleaseStr(m_sczBundleExtensionDataPath);
112 }
113
114protected:
115 IBundleExtensionEngine* m_pEngine;
116 LPWSTR m_sczBundleExtensionDataPath;
117
118private:
119 long m_cReferences;
120};
diff --git a/src/bextutil/inc/BextBaseBundleExtensionProc.h b/src/bextutil/inc/BextBaseBundleExtensionProc.h
new file mode 100644
index 00000000..f71e3b92
--- /dev/null
+++ b/src/bextutil/inc/BextBaseBundleExtensionProc.h
@@ -0,0 +1,48 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#include <windows.h>
6
7#include "BundleExtensionEngine.h"
8#include "BundleExtension.h"
9#include "IBundleExtensionEngine.h"
10#include "IBundleExtension.h"
11
12static HRESULT BextBaseBEProcSearch(
13 __in IBundleExtension* pBE,
14 __in BUNDLE_EXTENSION_SEARCH_ARGS* pArgs,
15 __inout BUNDLE_EXTENSION_SEARCH_RESULTS* /*pResults*/
16 )
17{
18 return pBE->Search(pArgs->wzId, pArgs->wzVariable);
19}
20
21/*******************************************************************
22BextBaseBundleExtensionProc - requires pvContext to be of type IBundleExtension.
23 Provides a default mapping between the message based
24 BundleExtension interface and the COM-based BundleExtension interface.
25
26*******************************************************************/
27static HRESULT WINAPI BextBaseBundleExtensionProc(
28 __in BUNDLE_EXTENSION_MESSAGE message,
29 __in const LPVOID pvArgs,
30 __inout LPVOID pvResults,
31 __in_opt LPVOID pvContext
32 )
33{
34 IBundleExtension* pBE = reinterpret_cast<IBundleExtension*>(pvContext);
35 HRESULT hr = pBE->BundleExtensionProc(message, pvArgs, pvResults, pvContext);
36
37 if (E_NOTIMPL == hr)
38 {
39 switch (message)
40 {
41 case BUNDLE_EXTENSION_MESSAGE_SEARCH:
42 hr = BextBaseBEProcSearch(pBE, reinterpret_cast<BUNDLE_EXTENSION_SEARCH_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_SEARCH_RESULTS*>(pvResults));
43 break;
44 }
45 }
46
47 return hr;
48}
diff --git a/src/bextutil/inc/BextBundleExtensionEngine.h b/src/bextutil/inc/BextBundleExtensionEngine.h
new file mode 100644
index 00000000..9fdcb700
--- /dev/null
+++ b/src/bextutil/inc/BextBundleExtensionEngine.h
@@ -0,0 +1,17 @@
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#ifdef __cplusplus
4extern "C" {
5#endif
6
7// function declarations
8
9HRESULT BextBundleExtensionEngineCreate(
10 __in PFN_BUNDLE_EXTENSION_ENGINE_PROC pfnBundleExtensionEngineProc,
11 __in_opt LPVOID pvBundleExtensionEngineProcContext,
12 __out IBundleExtensionEngine** ppEngineForExtension
13 );
14
15#ifdef __cplusplus
16}
17#endif
diff --git a/src/bextutil/inc/IBundleExtension.h b/src/bextutil/inc/IBundleExtension.h
new file mode 100644
index 00000000..7516c11b
--- /dev/null
+++ b/src/bextutil/inc/IBundleExtension.h
@@ -0,0 +1,20 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5DECLARE_INTERFACE_IID_(IBundleExtension, IUnknown, "93123C9D-796B-4FCD-A507-6EDEF9A925FD")
6{
7 STDMETHOD(Search)(
8 __in LPCWSTR wzId,
9 __in LPCWSTR wzVariable
10 ) = 0;
11
12 // BundleExtensionProc - The PFN_BUNDLE_EXTENSION_PROC can call this method to give the BundleExtension raw access to the callback from the engine.
13 // This might be used to help the BundleExtension support more than one version of the engine.
14 STDMETHOD(BundleExtensionProc)(
15 __in BUNDLE_EXTENSION_MESSAGE message,
16 __in const LPVOID pvArgs,
17 __inout LPVOID pvResults,
18 __in_opt LPVOID pvContext
19 ) = 0;
20};
diff --git a/src/bextutil/inc/IBundleExtensionEngine.h b/src/bextutil/inc/IBundleExtensionEngine.h
new file mode 100644
index 00000000..869c6695
--- /dev/null
+++ b/src/bextutil/inc/IBundleExtensionEngine.h
@@ -0,0 +1,64 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5DECLARE_INTERFACE_IID_(IBundleExtensionEngine, IUnknown, "9D027A39-F6B6-42CC-9737-C185089EB263")
6{
7 STDMETHOD(EscapeString)(
8 __in_z LPCWSTR wzIn,
9 __out_ecount_opt(*pcchOut) LPWSTR wzOut,
10 __inout DWORD * pcchOut
11 ) = 0;
12
13 STDMETHOD(EvaluateCondition)(
14 __in_z LPCWSTR wzCondition,
15 __out BOOL * pf
16 ) = 0;
17
18 STDMETHOD(FormatString)(
19 __in_z LPCWSTR wzIn,
20 __out_ecount_opt(*pcchOut) LPWSTR wzOut,
21 __inout DWORD * pcchOut
22 ) = 0;
23
24 STDMETHOD(GetVariableNumeric)(
25 __in_z LPCWSTR wzVariable,
26 __out LONGLONG* pllValue
27 ) = 0;
28
29 STDMETHOD(GetVariableString)(
30 __in_z LPCWSTR wzVariable,
31 __out_ecount_opt(*pcchValue) LPWSTR wzValue,
32 __inout DWORD* pcchValue
33 ) = 0;
34
35 STDMETHOD(GetVariableVersion)(
36 __in_z LPCWSTR wzVariable,
37 __out DWORD64* pqwValue
38 ) = 0;
39
40 STDMETHOD(Log)(
41 __in BUNDLE_EXTENSION_LOG_LEVEL level,
42 __in_z LPCWSTR wzMessage
43 ) = 0;
44
45 STDMETHOD(SetVariableLiteralString)(
46 __in_z LPCWSTR wzVariable,
47 __in_z_opt LPCWSTR wzValue
48 ) = 0;
49
50 STDMETHOD(SetVariableNumeric)(
51 __in_z LPCWSTR wzVariable,
52 __in LONGLONG llValue
53 ) = 0;
54
55 STDMETHOD(SetVariableString)(
56 __in_z LPCWSTR wzVariable,
57 __in_z_opt LPCWSTR wzValue
58 ) = 0;
59
60 STDMETHOD(SetVariableVersion)(
61 __in_z LPCWSTR wzVariable,
62 __in DWORD64 qwValue
63 ) = 0;
64};
diff --git a/src/bextutil/inc/bextutil.h b/src/bextutil/inc/bextutil.h
new file mode 100644
index 00000000..0472f854
--- /dev/null
+++ b/src/bextutil/inc/bextutil.h
@@ -0,0 +1,76 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#include "dutil.h"
6
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#define BextExitOnFailure(x, f, ...) if (FAILED(x)) { BextLogError(x, f, __VA_ARGS__); ExitTrace(x, f, __VA_ARGS__); goto LExit; }
13#define BextExitOnRootFailure(x, f, ...) if (FAILED(x)) { BextLogError(x, f, __VA_ARGS__); Dutil_RootFailure(__FILE__, __LINE__, x); ExitTrace(x, f, __VA_ARGS__); goto LExit; }
14#define BextExitOnNullWithLastError(p, x, f, ...) if (NULL == p) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } BextLogError(x, f, __VA_ARGS__); ExitTrace(x, f, __VA_ARGS__); goto LExit; }
15
16const LPCWSTR BUNDLE_EXTENSION_MANIFEST_FILENAME = L"BundleExtensionData.xml";
17
18
19/*******************************************************************
20 BextInitialize - remembers the engine interface to enable logging and
21 other functions.
22
23********************************************************************/
24DAPI_(void) BextInitialize(
25 __in IBundleExtensionEngine* pEngine
26 );
27
28/*******************************************************************
29 BextInitializeFromCreateArgs - convenience function to call BextBundleExtensionEngineCreate
30 then pass it along to BextInitialize.
31
32********************************************************************/
33DAPI_(HRESULT) BextInitializeFromCreateArgs(
34 __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs,
35 __out IBundleExtensionEngine** ppEngine
36 );
37
38/*******************************************************************
39 BextUninitialize - cleans up utility layer internals.
40
41********************************************************************/
42DAPI_(void) BextUninitialize();
43
44/*******************************************************************
45 BextGetBundleExtensionDataNode - gets the requested BundleExtension node.
46
47********************************************************************/
48DAPI_(HRESULT) BextGetBundleExtensionDataNode(
49 __in IXMLDOMDocument* pixdManifest,
50 __in LPCWSTR wzExtensionId,
51 __out IXMLDOMNode** ppixnBundleExtension
52 );
53
54/*******************************************************************
55 BextLog - logs a message with the engine.
56
57********************************************************************/
58DAPIV_(HRESULT) BextLog(
59 __in BUNDLE_EXTENSION_LOG_LEVEL level,
60 __in_z __format_string LPCSTR szFormat,
61 ...
62 );
63
64/*******************************************************************
65 BextLogError - logs an error message with the engine.
66
67********************************************************************/
68DAPIV_(HRESULT) BextLogError(
69 __in HRESULT hr,
70 __in_z __format_string LPCSTR szFormat,
71 ...
72 );
73
74#ifdef __cplusplus
75}
76#endif
diff --git a/src/bextutil/packages.config b/src/bextutil/packages.config
new file mode 100644
index 00000000..75a6476b
--- /dev/null
+++ b/src/bextutil/packages.config
@@ -0,0 +1,6 @@
1<?xml version="1.0" encoding="utf-8"?>
2<packages>
3 <package id="Nerdbank.GitVersioning" version="2.1.65" targetFramework="native" developmentDependency="true" />
4 <package id="WixToolset.BootstrapperCore.Native" version="4.0.13" targetFramework="native" />
5 <package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" />
6</packages> \ No newline at end of file
diff --git a/src/bextutil/precomp.cpp b/src/bextutil/precomp.cpp
new file mode 100644
index 00000000..37664a1c
--- /dev/null
+++ b/src/bextutil/precomp.cpp
@@ -0,0 +1,3 @@
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"
diff --git a/src/bextutil/precomp.h b/src/bextutil/precomp.h
new file mode 100644
index 00000000..5d1dd20b
--- /dev/null
+++ b/src/bextutil/precomp.h
@@ -0,0 +1,22 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#include <windows.h>
6#include <strsafe.h>
7#include <msxml2.h>
8
9#include <dutil.h>
10#include <locutil.h>
11#include <memutil.h>
12#include <strutil.h>
13#include <xmlutil.h>
14
15#include <BundleExtensionEngine.h>
16#include <BundleExtension.h>
17
18#include "IBundleExtensionEngine.h"
19#include "IBundleExtension.h"
20
21#include "bextutil.h"
22#include "BextBundleExtensionEngine.h"