From e027c6c571a4bc8c818244e2b0c5015eb4ef3110 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 4 Mar 2022 17:55:17 -0600 Subject: Change ARP property Installed to 0 when registrationType is InProgress. Being registered in ARP and "installed" were always separate concepts, and some things like fEligibleForCleanup were looking at the wrong thing. This also allows the BA to tell the difference. --- src/burn/engine/core.cpp | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'src/burn/engine/core.cpp') diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index 9d5364a4..ca4d607b 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp @@ -315,26 +315,19 @@ extern "C" HRESULT CoreDetect( DetectReset(&pEngineState->registration, &pEngineState->packages); PlanReset(&pEngineState->plan, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads); - // Detect if bundle installed state has changed since start up. This - // only happens if Apply() changed the state of bundle (installed or - // uninstalled). In that case, Detect() can be used here to reset - // the installed state. + // Detect if bundle installed state has changed since start up. + // This only happens if Apply() changed the state of bundle (installed, in progress, or uninstalled). + // In that case, Detect() can be used here to reset the installed state. + // Of course, there's also cases outside of this bundle's control, + // like other processes messing with its registration. hr = RegistrationDetectInstalled(&pEngineState->registration); ExitOnFailure(hr, "Failed to detect bundle install state."); - if (pEngineState->registration.fInstalled) - { - hr = VariableSetNumeric(&pEngineState->variables, BURN_BUNDLE_INSTALLED, 1, TRUE); - ExitOnFailure(hr, "Failed to set the bundle installed built-in variable."); - } - else - { - hr = VariableSetString(&pEngineState->variables, BURN_BUNDLE_INSTALLED, NULL, TRUE, FALSE); - ExitOnFailure(hr, "Failed to unset the bundle installed built-in variable."); - } + hr = RegistrationSetDynamicVariables(&pEngineState->registration, &pEngineState->variables); + ExitOnFailure(hr, "Failed to reset the dynamic registration variables during detect."); fDetectBegan = TRUE; - hr = UserExperienceOnDetectBegin(&pEngineState->userExperience, pEngineState->registration.fCached, pEngineState->registration.fInstalled, pEngineState->packages.cPackages); + hr = UserExperienceOnDetectBegin(&pEngineState->userExperience, pEngineState->registration.fCached, pEngineState->registration.detectedRegistrationType, pEngineState->packages.cPackages); ExitOnRootFailure(hr, "UX aborted detect begin."); pEngineState->userExperience.hwndDetect = hwndParent; @@ -444,7 +437,7 @@ LExit: pEngineState->userExperience.hwndDetect = NULL; - LogId(REPORT_STANDARD, MSG_DETECT_COMPLETE, hr, !fDetectBegan ? "(failed)" : LoggingBoolToString(pEngineState->registration.fInstalled), !fDetectBegan ? "(failed)" : LoggingBoolToString(pEngineState->registration.fCached), FAILED(hr) ? "(failed)" : LoggingBoolToString(pEngineState->registration.fEligibleForCleanup)); + LogId(REPORT_STANDARD, MSG_DETECT_COMPLETE, hr, !fDetectBegan ? "(failed)" : LoggingRegistrationTypeToString(pEngineState->registration.detectedRegistrationType), !fDetectBegan ? "(failed)" : LoggingBoolToString(pEngineState->registration.fCached), FAILED(hr) ? "(failed)" : LoggingBoolToString(pEngineState->registration.fEligibleForCleanup)); return hr; } @@ -489,7 +482,7 @@ extern "C" HRESULT CorePlan( pEngineState->plan.wzBundleId = pEngineState->registration.sczId; pEngineState->plan.wzBundleProviderKey = pEngineState->registration.sczId; pEngineState->plan.fDisableRollback = pEngineState->fDisableRollback || BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL == pEngineState->plan.action; - pEngineState->plan.fBundleAlreadyRegistered = pEngineState->registration.fInstalled; + pEngineState->plan.fPlanPackageCacheRollback = BOOTSTRAPPER_REGISTRATION_TYPE_NONE == pEngineState->registration.detectedRegistrationType; hr = PlanSetVariables(action, &pEngineState->variables); ExitOnFailure(hr, "Failed to update action."); -- cgit v1.2.3-55-g6feb