diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-01-03 15:35:14 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-01-04 19:19:43 -0600 |
commit | 1f5314302b3c8bc1977aed79df1d05c52608f382 (patch) | |
tree | f0fef3a4462352c914a4cc9413515d07f2244703 /src/burn/engine/relatedbundle.cpp | |
parent | db44f6cf3b1eb476e47384f2eccba5712808def5 (diff) | |
download | wix-1f5314302b3c8bc1977aed79df1d05c52608f382.tar.gz wix-1f5314302b3c8bc1977aed79df1d05c52608f382.tar.bz2 wix-1f5314302b3c8bc1977aed79df1d05c52608f382.zip |
Don't assume Exe packages with Burn protocol are bundles.
Related to #3693
Diffstat (limited to 'src/burn/engine/relatedbundle.cpp')
-rw-r--r-- | src/burn/engine/relatedbundle.cpp | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/src/burn/engine/relatedbundle.cpp b/src/burn/engine/relatedbundle.cpp index 4a694ef6..e2380aab 100644 --- a/src/burn/engine/relatedbundle.cpp +++ b/src/burn/engine/relatedbundle.cpp | |||
@@ -98,6 +98,37 @@ extern "C" void RelatedBundlesUninitialize( | |||
98 | } | 98 | } |
99 | 99 | ||
100 | 100 | ||
101 | extern "C" HRESULT RelatedBundleFindById( | ||
102 | __in BURN_RELATED_BUNDLES* pRelatedBundles, | ||
103 | __in_z LPCWSTR wzId, | ||
104 | __out BURN_RELATED_BUNDLE** ppRelatedBundle | ||
105 | ) | ||
106 | { | ||
107 | HRESULT hr = S_OK; | ||
108 | BURN_RELATED_BUNDLE* pRelatedBundle = NULL; | ||
109 | BURN_PACKAGE* pPackage = NULL; | ||
110 | |||
111 | *ppRelatedBundle = NULL; | ||
112 | |||
113 | for (DWORD i = 0; i < pRelatedBundles->cRelatedBundles; ++i) | ||
114 | { | ||
115 | pRelatedBundle = pRelatedBundles->rgRelatedBundles + i; | ||
116 | pPackage = &pRelatedBundle->package; | ||
117 | |||
118 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, pPackage->sczId, -1, wzId, -1)) | ||
119 | { | ||
120 | *ppRelatedBundle = pRelatedBundle; | ||
121 | ExitFunction1(hr = S_OK); | ||
122 | } | ||
123 | } | ||
124 | |||
125 | hr = E_NOTFOUND; | ||
126 | |||
127 | LExit: | ||
128 | return hr; | ||
129 | } | ||
130 | |||
131 | |||
101 | // internal helper functions | 132 | // internal helper functions |
102 | 133 | ||
103 | static HRESULT LoadIfRelatedBundle( | 134 | static HRESULT LoadIfRelatedBundle( |
@@ -410,6 +441,7 @@ static HRESULT LoadRelatedBundleFromKey( | |||
410 | BOOL fCached = FALSE; | 441 | BOOL fCached = FALSE; |
411 | DWORD64 qwFileSize = 0; | 442 | DWORD64 qwFileSize = 0; |
412 | BURN_DEPENDENCY_PROVIDER dependencyProvider = { }; | 443 | BURN_DEPENDENCY_PROVIDER dependencyProvider = { }; |
444 | BURN_DEPENDENCY_PROVIDER* pBundleDependencyProvider = NULL; | ||
413 | 445 | ||
414 | // Only support progress from engines that are compatible. | 446 | // Only support progress from engines that are compatible. |
415 | hr = RegReadNumber(hkBundleId, BURN_REGISTRATION_REGISTRY_ENGINE_PROTOCOL_VERSION, &dwEngineProtocolVersion); | 447 | hr = RegReadNumber(hkBundleId, BURN_REGISTRATION_REGISTRY_ENGINE_PROTOCOL_VERSION, &dwEngineProtocolVersion); |
@@ -458,6 +490,11 @@ static HRESULT LoadRelatedBundleFromKey( | |||
458 | if (E_FILENOTFOUND != hr) | 490 | if (E_FILENOTFOUND != hr) |
459 | { | 491 | { |
460 | ExitOnFailure(hr, "Failed to read provider key from registry for bundle: %ls", wzRelatedBundleId); | 492 | ExitOnFailure(hr, "Failed to read provider key from registry for bundle: %ls", wzRelatedBundleId); |
493 | } | ||
494 | |||
495 | if (dependencyProvider.sczKey && *dependencyProvider.sczKey) | ||
496 | { | ||
497 | pBundleDependencyProvider = &dependencyProvider; | ||
461 | 498 | ||
462 | dependencyProvider.fImported = TRUE; | 499 | dependencyProvider.fImported = TRUE; |
463 | 500 | ||
@@ -480,11 +517,11 @@ static HRESULT LoadRelatedBundleFromKey( | |||
480 | 517 | ||
481 | pRelatedBundle->relationType = relationType; | 518 | pRelatedBundle->relationType = relationType; |
482 | 519 | ||
483 | hr = PseudoBundleInitialize(&pRelatedBundle->package, fSupportsBurnProtocol, fPerMachine, wzRelatedBundleId, pRelatedBundle->relationType, | 520 | hr = PseudoBundleInitializeRelated(&pRelatedBundle->package, fSupportsBurnProtocol, fPerMachine, wzRelatedBundleId, |
484 | BOOTSTRAPPER_PACKAGE_STATE_PRESENT, fCached, sczCachePath, sczCachePath, NULL, qwFileSize, FALSE, | 521 | #ifdef DEBUG |
485 | L"-quiet", L"-repair -quiet", L"-uninstall -quiet", | 522 | pRelatedBundle->relationType, |
486 | (dependencyProvider.sczKey && *dependencyProvider.sczKey) ? &dependencyProvider : NULL, | 523 | #endif |
487 | NULL, 0); | 524 | fCached, sczCachePath, qwFileSize, pBundleDependencyProvider); |
488 | ExitOnFailure(hr, "Failed to initialize related bundle to represent bundle: %ls", wzRelatedBundleId); | 525 | ExitOnFailure(hr, "Failed to initialize related bundle to represent bundle: %ls", wzRelatedBundleId); |
489 | 526 | ||
490 | LExit: | 527 | LExit: |