diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-12-10 11:42:44 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-12-11 20:03:13 -0600 |
commit | fc30db9fa3aa1d25a6ef078452864673caa67ec5 (patch) | |
tree | e3415a5a1329a867b2934a038243e95098214ec3 /src/burn/engine/pseudobundle.cpp | |
parent | 1d58b3333d1d694d08b68f6c87223aa504bfe773 (diff) | |
download | wix-fc30db9fa3aa1d25a6ef078452864673caa67ec5.tar.gz wix-fc30db9fa3aa1d25a6ef078452864673caa67ec5.tar.bz2 wix-fc30db9fa3aa1d25a6ef078452864673caa67ec5.zip |
Add BA events for setting the update bundle.
Fixes #6410
Diffstat (limited to 'src/burn/engine/pseudobundle.cpp')
-rw-r--r-- | src/burn/engine/pseudobundle.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/burn/engine/pseudobundle.cpp b/src/burn/engine/pseudobundle.cpp index 52b7bd8a..91c6c14f 100644 --- a/src/burn/engine/pseudobundle.cpp +++ b/src/burn/engine/pseudobundle.cpp | |||
@@ -240,3 +240,80 @@ LExit: | |||
240 | ReleaseStr(sczArguments); | 240 | ReleaseStr(sczArguments); |
241 | return hr; | 241 | return hr; |
242 | } | 242 | } |
243 | |||
244 | extern "C" HRESULT PseudoBundleInitializeUpdateBundle( | ||
245 | __in BURN_PACKAGE* pPackage, | ||
246 | __in_z LPCWSTR wzId, | ||
247 | __in_z LPCWSTR wzCacheId, | ||
248 | __in_z LPCWSTR wzFilePath, | ||
249 | __in_z LPCWSTR wzLocalSource, | ||
250 | __in_z_opt LPCWSTR wzDownloadSource, | ||
251 | __in DWORD64 qwSize, | ||
252 | __in_z LPCWSTR wzInstallArguments, | ||
253 | __in_opt const BYTE* pbHash, | ||
254 | __in const DWORD cbHash | ||
255 | ) | ||
256 | { | ||
257 | HRESULT hr = S_OK; | ||
258 | BURN_PAYLOAD* pPayload = NULL; | ||
259 | |||
260 | // Initialize the single payload, and fill out all the necessary fields | ||
261 | pPackage->payloads.rgItems = (BURN_PAYLOAD_GROUP_ITEM*)MemAlloc(sizeof(BURN_PAYLOAD_GROUP_ITEM), TRUE); | ||
262 | ExitOnNull(pPackage->payloads.rgItems, hr, E_OUTOFMEMORY, "Failed to allocate space for burn payload group inside of update bundle struct"); | ||
263 | pPackage->payloads.cItems = 1; | ||
264 | |||
265 | pPayload = (BURN_PAYLOAD*)MemAlloc(sizeof(BURN_PAYLOAD), TRUE); | ||
266 | ExitOnNull(pPayload, hr, E_OUTOFMEMORY, "Failed to allocate space for burn payload inside of update bundle struct"); | ||
267 | pPackage->payloads.rgItems[0].pPayload = pPayload; | ||
268 | pPayload->packaging = BURN_PAYLOAD_PACKAGING_EXTERNAL; | ||
269 | pPayload->qwFileSize = qwSize; | ||
270 | pPayload->verification = BURN_PAYLOAD_VERIFICATION_UPDATE_BUNDLE; | ||
271 | |||
272 | hr = StrAllocString(&pPayload->sczKey, wzId, 0); | ||
273 | ExitOnFailure(hr, "Failed to copy key for pseudo bundle payload."); | ||
274 | |||
275 | hr = StrAllocString(&pPayload->sczFilePath, wzFilePath, 0); | ||
276 | ExitOnFailure(hr, "Failed to copy filename for pseudo bundle."); | ||
277 | |||
278 | hr = StrAllocString(&pPayload->sczSourcePath, wzLocalSource, 0); | ||
279 | ExitOnFailure(hr, "Failed to copy local source path for pseudo bundle."); | ||
280 | |||
281 | if (wzDownloadSource && *wzDownloadSource) | ||
282 | { | ||
283 | hr = StrAllocString(&pPayload->downloadSource.sczUrl, wzDownloadSource, 0); | ||
284 | ExitOnFailure(hr, "Failed to copy download source for pseudo bundle."); | ||
285 | } | ||
286 | |||
287 | if (pbHash) | ||
288 | { | ||
289 | pPayload->pbHash = static_cast<BYTE*>(MemAlloc(cbHash, FALSE)); | ||
290 | ExitOnNull(pPayload->pbHash, hr, E_OUTOFMEMORY, "Failed to allocate memory for update bundle payload hash."); | ||
291 | |||
292 | pPayload->cbHash = cbHash; | ||
293 | memcpy_s(pPayload->pbHash, pPayload->cbHash, pbHash, cbHash); | ||
294 | } | ||
295 | |||
296 | pPackage->Exe.fPseudoBundle = TRUE; | ||
297 | |||
298 | pPackage->type = BURN_PACKAGE_TYPE_EXE; | ||
299 | pPackage->currentState = BOOTSTRAPPER_PACKAGE_STATE_ABSENT; | ||
300 | pPackage->qwInstallSize = qwSize; | ||
301 | pPackage->qwSize = qwSize; | ||
302 | pPackage->fVital = TRUE; | ||
303 | |||
304 | hr = StrAllocString(&pPackage->sczId, wzId, 0); | ||
305 | ExitOnFailure(hr, "Failed to copy id for update bundle."); | ||
306 | |||
307 | hr = StrAllocString(&pPackage->sczCacheId, wzCacheId, 0); | ||
308 | ExitOnFailure(hr, "Failed to copy cache id for update bundle."); | ||
309 | |||
310 | hr = StrAllocString(&pPackage->Exe.sczInstallArguments, wzInstallArguments, 0); | ||
311 | ExitOnFailure(hr, "Failed to copy install arguments for update bundle package"); | ||
312 | |||
313 | // Assume the update bundle has the same engine version as this one. | ||
314 | pPackage->Exe.protocol = BURN_EXE_PROTOCOL_TYPE_BURN; | ||
315 | pPackage->Exe.fSupportsAncestors = TRUE; | ||
316 | |||
317 | LExit: | ||
318 | return hr; | ||
319 | } \ No newline at end of file | ||