aboutsummaryrefslogtreecommitdiff
path: root/src/burn/engine/detect.cpp
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2022-08-31 16:07:08 -0400
committerBob Arnson <github@bobs.org>2022-08-31 19:59:16 -0400
commit914a92d16d7a0245f3cf0b42cc5e320c34d23d30 (patch)
treef145e999fc4ccefa2e92466a45b602f080a32440 /src/burn/engine/detect.cpp
parentf6c86c939af9f8b0036f4b197512f06e861e5fd3 (diff)
downloadwix-914a92d16d7a0245f3cf0b42cc5e320c34d23d30.tar.gz
wix-914a92d16d7a0245f3cf0b42cc5e320c34d23d30.tar.bz2
wix-914a92d16d7a0245f3cf0b42cc5e320c34d23d30.zip
Supply hashes to BA if present in update feed.
Fixes https://github.com/wixtoolset/issues/issues/6353.
Diffstat (limited to 'src/burn/engine/detect.cpp')
-rw-r--r--src/burn/engine/detect.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/burn/engine/detect.cpp b/src/burn/engine/detect.cpp
index 7628b26a..25d184c1 100644
--- a/src/burn/engine/detect.cpp
+++ b/src/burn/engine/detect.cpp
@@ -379,6 +379,7 @@ static HRESULT DetectAtomFeedUpdate(
379 ATOM_FEED* pAtomFeed = NULL; 379 ATOM_FEED* pAtomFeed = NULL;
380 APPLICATION_UPDATE_CHAIN* pApupChain = NULL; 380 APPLICATION_UPDATE_CHAIN* pApupChain = NULL;
381 BOOL fStopProcessingUpdates = FALSE; 381 BOOL fStopProcessingUpdates = FALSE;
382 LPWSTR sczHash = NULL;
382 383
383 hr = AtomInitialize(); 384 hr = AtomInitialize();
384 ExitOnFailure(hr, "Failed to initialize Atom."); 385 ExitOnFailure(hr, "Failed to initialize Atom.");
@@ -397,11 +398,25 @@ static HRESULT DetectAtomFeedUpdate(
397 for (DWORD i = 0; i < pApupChain->cEntries; ++i) 398 for (DWORD i = 0; i < pApupChain->cEntries; ++i)
398 { 399 {
399 APPLICATION_UPDATE_ENTRY* pAppUpdateEntry = &pApupChain->rgEntries[i]; 400 APPLICATION_UPDATE_ENTRY* pAppUpdateEntry = &pApupChain->rgEntries[i];
401 APPLICATION_UPDATE_ENCLOSURE* pEnclosure = pAppUpdateEntry->rgEnclosures;
400 402
401 hr = UserExperienceOnDetectUpdate(pUX, pAppUpdateEntry->rgEnclosures ? pAppUpdateEntry->rgEnclosures->wzUrl : NULL, 403 if (pEnclosure)
402 pAppUpdateEntry->rgEnclosures ? pAppUpdateEntry->rgEnclosures->dw64Size : 0, 404 {
403 pAppUpdateEntry->pVersion, pAppUpdateEntry->wzTitle, 405 hr = StrAllocHexEncode(pEnclosure->rgbDigest, pEnclosure->cbDigest, &sczHash);
404 pAppUpdateEntry->wzSummary, pAppUpdateEntry->wzContentType, pAppUpdateEntry->wzContent, &fStopProcessingUpdates); 406 ExitOnFailure(hr, "Failed to encode hash as string.");
407 }
408
409 hr = UserExperienceOnDetectUpdate(pUX,
410 pEnclosure ? pEnclosure->wzUrl : NULL,
411 pEnclosure ? pEnclosure->dw64Size : 0,
412 sczHash ? sczHash : L"",
413 pEnclosure ? pEnclosure->digestAlgorithm == APUP_HASH_ALGORITHM_SHA512 ? BOOTSTRAPPER_UPDATE_HASH_TYPE_SHA512 : BOOTSTRAPPER_UPDATE_HASH_TYPE_NONE : BOOTSTRAPPER_UPDATE_HASH_TYPE_NONE,
414 pAppUpdateEntry->pVersion,
415 pAppUpdateEntry->wzTitle,
416 pAppUpdateEntry->wzSummary,
417 pAppUpdateEntry->wzContentType,
418 pAppUpdateEntry->wzContent,
419 &fStopProcessingUpdates);
405 ExitOnRootFailure(hr, "BA aborted detect update."); 420 ExitOnRootFailure(hr, "BA aborted detect update.");
406 421
407 if (fStopProcessingUpdates) 422 if (fStopProcessingUpdates)
@@ -420,6 +435,7 @@ LExit:
420 ApupFreeChain(pApupChain); 435 ApupFreeChain(pApupChain);
421 AtomFreeFeed(pAtomFeed); 436 AtomFreeFeed(pAtomFeed);
422 ReleaseStr(sczUpdateFeedTempFile); 437 ReleaseStr(sczUpdateFeedTempFile);
438 ReleaseStr(sczHash);
423 AtomUninitialize(); 439 AtomUninitialize();
424 440
425 return hr; 441 return hr;