From 7cf03f0ecc0a54062548656fadcacfba996cd459 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 24 Feb 2021 17:30:28 -0600 Subject: Loosen restrictions for actions that don't affect machine state. --- src/engine/core.cpp | 11 +++++------ src/engine/core.h | 1 - src/engine/plan.cpp | 2 +- src/engine/plan.h | 3 ++- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/engine/core.cpp b/src/engine/core.cpp index 0a19ac8e..2f18e4d2 100644 --- a/src/engine/core.cpp +++ b/src/engine/core.cpp @@ -282,7 +282,6 @@ extern "C" HRESULT CoreDetect( // Always reset the detect state which means the plan should be reset too. pEngineState->fDetected = FALSE; pEngineState->fPlanned = FALSE; - pEngineState->fApplied = FALSE; DetectReset(&pEngineState->registration, &pEngineState->packages); PlanReset(&pEngineState->plan, &pEngineState->packages); @@ -458,7 +457,7 @@ extern "C" HRESULT CorePlan( { ExitOnFailure(hr = E_INVALIDSTATE, "Plan cannot be done without a successful Detect."); } - else if (pEngineState->fApplied) + else if (pEngineState->plan.fAffectedMachineState) { ExitOnFailure(hr = E_INVALIDSTATE, "Plan requires a new successful Detect after calling Apply."); } @@ -624,7 +623,7 @@ extern "C" HRESULT CoreApply( { ExitOnFailure(hr = E_INVALIDSTATE, "Apply cannot be done without a successful Plan."); } - else if (pEngineState->fApplied) + else if (pEngineState->plan.fAffectedMachineState) { ExitOnFailure(hr = E_INVALIDSTATE, "Plans cannot be applied multiple times."); } @@ -644,7 +643,7 @@ extern "C" HRESULT CoreApply( hr = UserExperienceOnApplyBegin(&pEngineState->userExperience, dwPhaseCount); ExitOnRootFailure(hr, "BA aborted apply begin."); - pEngineState->fApplied = TRUE; + pEngineState->plan.fAffectedMachineState = pEngineState->plan.fCanAffectMachineState; // Abort if this bundle already requires a restart. if (BOOTSTRAPPER_RESUME_TYPE_REBOOT_PENDING == pEngineState->command.resumeType) @@ -695,7 +694,7 @@ extern "C" HRESULT CoreApply( } // Register. - if (pEngineState->plan.fRegister) + if (pEngineState->plan.fCanAffectMachineState) { fRegistered = TRUE; hr = ApplyRegister(pEngineState); @@ -1107,7 +1106,7 @@ extern "C" void CoreCleanup( LogId(REPORT_STANDARD, MSG_CLEANUP_BEGIN); - if (pEngineState->fApplied && BOOTSTRAPPER_ACTION_LAYOUT < pEngineState->plan.action && BOOTSTRAPPER_ACTION_UPDATE_REPLACE > pEngineState->plan.action) + if (pEngineState->plan.fAffectedMachineState) { LogId(REPORT_STANDARD, MSG_CLEANUP_SKIPPED_APPLY); ExitFunction(); diff --git a/src/engine/core.h b/src/engine/core.h index d98c7646..75a61614 100644 --- a/src/engine/core.h +++ b/src/engine/core.h @@ -80,7 +80,6 @@ typedef struct _BURN_ENGINE_STATE // UX flow control BOOL fDetected; BOOL fPlanned; - BOOL fApplied; BOOL fQuit; //BOOL fSuspend; // Is TRUE when UX made Suspend() call on core. //BOOL fForcedReboot; // Is TRUE when UX made Reboot() call on core. diff --git a/src/engine/plan.cpp b/src/engine/plan.cpp index b3cb0ee3..d6cc63ad 100644 --- a/src/engine/plan.cpp +++ b/src/engine/plan.cpp @@ -519,7 +519,7 @@ extern "C" HRESULT PlanRegistration( STRINGDICT_HANDLE sdBundleDependents = NULL; STRINGDICT_HANDLE sdIgnoreDependents = NULL; - pPlan->fRegister = TRUE; // register the bundle since we're modifying machine state. + pPlan->fCanAffectMachineState = TRUE; // register the bundle since we're modifying machine state. pPlan->fDisallowRemoval = FALSE; // by default the bundle can be planned to be removed diff --git a/src/engine/plan.h b/src/engine/plan.h index 5e1985ea..c679d368 100644 --- a/src/engine/plan.h +++ b/src/engine/plan.h @@ -309,10 +309,11 @@ typedef struct _BURN_PLAN LPWSTR wzBundleId; // points directly into parent the ENGINE_STATE. LPWSTR wzBundleProviderKey; // points directly into parent the ENGINE_STATE. BOOL fPerMachine; - BOOL fRegister; + BOOL fCanAffectMachineState; DWORD dwRegistrationOperations; BOOL fDisallowRemoval; BOOL fDisableRollback; + BOOL fAffectedMachineState; DWORD64 qwCacheSizeTotal; -- cgit v1.2.3-55-g6feb