From 5658492062bf28ffb670ede15cbd1413bf1182d8 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Tue, 17 Feb 2026 19:41:03 -0500 Subject: Lock upgrade bundles to original bundle's scope. Fixes https://github.com/wixtoolset/issues/issues/9236 --- src/burn/engine/registration.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/burn/engine/registration.cpp') diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp index e588bef0..7c9ca182 100644 --- a/src/burn/engine/registration.cpp +++ b/src/burn/engine/registration.cpp @@ -29,9 +29,10 @@ const LPCWSTR REGISTRY_BUNDLE_UNINSTALL_STRING = L"UninstallString"; const LPCWSTR REGISTRY_BUNDLE_RESUME_COMMAND_LINE = L"BundleResumeCommandLine"; const LPCWSTR REGISTRY_BUNDLE_VERSION_MAJOR = L"VersionMajor"; const LPCWSTR REGISTRY_BUNDLE_VERSION_MINOR = L"VersionMinor"; -const LPCWSTR REGISTRY_BUNDLE_SCOPE = L"BundleScope"; const LPCWSTR SWIDTAG_FOLDER = L"swidtag"; const LPCWSTR REGISTRY_BUNDLE_VARIABLE_KEY = L"variables"; +const LPCWSTR REGISTRY_BUNDLE_INSTALLED = L"Installed"; + // internal function declarations @@ -146,6 +147,10 @@ extern "C" HRESULT RegistrationParseFromXml( hr = XmlGetAttributeEx(pixnRegistrationNode, L"Tag", &pRegistration->sczTag); ExitOnRequiredXmlQueryFailure(hr, "Failed to get @Tag."); + // @PrimaryUpgradeCode + hr = XmlGetAttributeEx(pixnRegistrationNode, L"PrimaryUpgradeCode", &pRegistration->sczPrimaryUpgradeCode); + ExitOnOptionalXmlQueryFailure(hr, fFoundXml, "Failed to get @PrimaryUpgradeCode."); + hr = BundlePackageEngineParseRelatedCodes(pixnBundle, &pRegistration->rgsczDetectCodes, &pRegistration->cDetectCodes, &pRegistration->rgsczUpgradeCodes, &pRegistration->cUpgradeCodes, &pRegistration->rgsczAddonCodes, &pRegistration->cAddonCodes, &pRegistration->rgsczPatchCodes, &pRegistration->cPatchCodes); ExitOnFailure(hr, "Failed to parse related bundles"); @@ -327,7 +332,8 @@ extern "C" void RegistrationUninitialize( { ReleaseStr(pRegistration->sczCode); ReleaseStr(pRegistration->sczTag); - + ReleaseStr(pRegistration->sczPrimaryUpgradeCode); + for (DWORD i = 0; i < pRegistration->cDetectCodes; ++i) { ReleaseStr(pRegistration->rgsczDetectCodes[i]); @@ -666,8 +672,8 @@ extern "C" HRESULT RegistrationSessionBegin( hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_DISPLAY_ICON, L"%s,0", pRegistration->sczCacheExecutablePath); ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_DISPLAY_ICON); - hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_SCOPE, pRegistration->fPerMachine ? BOOTSTRAPPER_SCOPE_PER_MACHINE : BOOTSTRAPPER_SCOPE_PER_USER); - ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_SCOPE); + hr = RegWriteNumber(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_SCOPE, pRegistration->fPerMachine ? BOOTSTRAPPER_SCOPE_PER_MACHINE : BOOTSTRAPPER_SCOPE_PER_USER); + ExitOnFailure(hr, "Failed to write %ls value.", BURN_REGISTRATION_REGISTRY_BUNDLE_SCOPE); // update display name hr = UpdateBundleNameRegistration(pRegistration, pVariables, hkRegistration, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS == registrationType); @@ -1780,8 +1786,8 @@ static HRESULT DetectInstalled( pRegistration->detectedRegistrationType = (1 == dwInstalled) ? BOOTSTRAPPER_REGISTRATION_TYPE_FULL : BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS; - hr = RegReadNumber(hkRegistration, REGISTRY_BUNDLE_SCOPE, &dwScope); - ExitOnFailure(hr, "Failed to read registration %ls@%ls.", pRegistration->sczRegistrationKey, REGISTRY_BUNDLE_SCOPE); + hr = RegReadNumber(hkRegistration, BURN_REGISTRATION_REGISTRY_BUNDLE_SCOPE, &dwScope); + ExitOnFailure(hr, "Failed to read registration %ls@%ls.", pRegistration->sczRegistrationKey, BURN_REGISTRATION_REGISTRY_BUNDLE_SCOPE); pRegistration->detectedScope = static_cast(dwScope); } -- cgit v1.2.3-55-g6feb