diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-04-16 09:40:18 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-04-19 23:12:55 -0500 |
commit | 941c47e5a3f57ce9626b447a95740b1444e69343 (patch) | |
tree | 6225b78f5fc7c8f88a2abf187a6a76d45b36ec26 /src/engine/relatedbundle.cpp | |
parent | d32f770ca05748df9e356444c7e617d5eeedb60c (diff) | |
download | wix-941c47e5a3f57ce9626b447a95740b1444e69343.tar.gz wix-941c47e5a3f57ce9626b447a95740b1444e69343.tar.bz2 wix-941c47e5a3f57ce9626b447a95740b1444e69343.zip |
Detect a package as cached if any of its payloads exist.
Detect is supposed to be fast, so it can't fully verify every payload for every package. The engine was wasting its time by trying to verify file sizes without the hash. Even worse, it was making decisions during planning based on that insufficient verification.
Contributes to #3640
Diffstat (limited to 'src/engine/relatedbundle.cpp')
-rw-r--r-- | src/engine/relatedbundle.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/engine/relatedbundle.cpp b/src/engine/relatedbundle.cpp index a4948a88..6953c678 100644 --- a/src/engine/relatedbundle.cpp +++ b/src/engine/relatedbundle.cpp | |||
@@ -391,14 +391,14 @@ static HRESULT LoadRelatedBundleFromKey( | |||
391 | __in HKEY hkBundleId, | 391 | __in HKEY hkBundleId, |
392 | __in BOOL fPerMachine, | 392 | __in BOOL fPerMachine, |
393 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | 393 | __in BOOTSTRAPPER_RELATION_TYPE relationType, |
394 | __inout BURN_RELATED_BUNDLE *pRelatedBundle | 394 | __inout BURN_RELATED_BUNDLE* pRelatedBundle |
395 | ) | 395 | ) |
396 | { | 396 | { |
397 | HRESULT hr = S_OK; | 397 | HRESULT hr = S_OK; |
398 | DWORD64 qwEngineVersion = 0; | 398 | DWORD64 qwEngineVersion = 0; |
399 | LPWSTR sczBundleVersion = NULL; | 399 | LPWSTR sczBundleVersion = NULL; |
400 | LPWSTR sczCachePath = NULL; | 400 | LPWSTR sczCachePath = NULL; |
401 | BURN_CACHE_STATE cacheState = BURN_CACHE_STATE_NONE; | 401 | BOOL fCached = FALSE; |
402 | DWORD64 qwFileSize = 0; | 402 | DWORD64 qwFileSize = 0; |
403 | BURN_DEPENDENCY_PROVIDER dependencyProvider = { }; | 403 | BURN_DEPENDENCY_PROVIDER dependencyProvider = { }; |
404 | 404 | ||
@@ -423,19 +423,16 @@ static HRESULT LoadRelatedBundleFromKey( | |||
423 | hr = RegReadString(hkBundleId, BURN_REGISTRATION_REGISTRY_BUNDLE_CACHE_PATH, &sczCachePath); | 423 | hr = RegReadString(hkBundleId, BURN_REGISTRATION_REGISTRY_BUNDLE_CACHE_PATH, &sczCachePath); |
424 | ExitOnFailure(hr, "Failed to read cache path from registry for bundle: %ls", wzRelatedBundleId); | 424 | ExitOnFailure(hr, "Failed to read cache path from registry for bundle: %ls", wzRelatedBundleId); |
425 | 425 | ||
426 | hr = FileSize(sczCachePath, reinterpret_cast<LONGLONG *>(&qwFileSize)); | 426 | if (FileExistsEx(sczCachePath, NULL)) |
427 | if (SUCCEEDED(hr)) | ||
428 | { | 427 | { |
429 | cacheState = BURN_CACHE_STATE_COMPLETE; | 428 | fCached = TRUE; |
430 | } | 429 | } |
431 | else if (E_FILENOTFOUND != hr) | 430 | else |
432 | { | 431 | { |
433 | cacheState = BURN_CACHE_STATE_PARTIAL; | 432 | LogId(REPORT_STANDARD, MSG_DETECT_RELATED_BUNDLE_NOT_CACHED, wzRelatedBundleId, sczCachePath); |
434 | LogId(REPORT_STANDARD, MSG_DETECT_RELATED_BUNDLE_NOT_FULLY_CACHED, wzRelatedBundleId, sczCachePath, hr); | ||
435 | } | 433 | } |
436 | hr = S_OK; | ||
437 | 434 | ||
438 | pRelatedBundle->fPlannable = BURN_CACHE_STATE_COMPLETE == cacheState; | 435 | pRelatedBundle->fPlannable = fCached; |
439 | 436 | ||
440 | hr = RegReadString(hkBundleId, BURN_REGISTRATION_REGISTRY_BUNDLE_PROVIDER_KEY, &dependencyProvider.sczKey); | 437 | hr = RegReadString(hkBundleId, BURN_REGISTRATION_REGISTRY_BUNDLE_PROVIDER_KEY, &dependencyProvider.sczKey); |
441 | if (E_FILENOTFOUND != hr) | 438 | if (E_FILENOTFOUND != hr) |
@@ -464,7 +461,7 @@ static HRESULT LoadRelatedBundleFromKey( | |||
464 | pRelatedBundle->relationType = relationType; | 461 | pRelatedBundle->relationType = relationType; |
465 | 462 | ||
466 | hr = PseudoBundleInitialize(qwEngineVersion, &pRelatedBundle->package, fPerMachine, wzRelatedBundleId, pRelatedBundle->relationType, | 463 | hr = PseudoBundleInitialize(qwEngineVersion, &pRelatedBundle->package, fPerMachine, wzRelatedBundleId, pRelatedBundle->relationType, |
467 | BOOTSTRAPPER_PACKAGE_STATE_PRESENT, cacheState, sczCachePath, sczCachePath, NULL, qwFileSize, FALSE, | 464 | BOOTSTRAPPER_PACKAGE_STATE_PRESENT, fCached, sczCachePath, sczCachePath, NULL, qwFileSize, FALSE, |
468 | L"-quiet", L"-repair -quiet", L"-uninstall -quiet", | 465 | L"-quiet", L"-repair -quiet", L"-uninstall -quiet", |
469 | (dependencyProvider.sczKey && *dependencyProvider.sczKey) ? &dependencyProvider : NULL, | 466 | (dependencyProvider.sczKey && *dependencyProvider.sczKey) ? &dependencyProvider : NULL, |
470 | NULL, 0); | 467 | NULL, 0); |