Loosen restrictions for actions that don't affect machine state.
Sean Hall committed
Feb 24, 2021 at 17:30 UTC
7cf03f0ecc0a54062548656fadcacfba996cd459
4 files changed
+8
-9
src/engine/core.cpp
+5
-6
@@ -282,7 +282,6 @@ extern "C" HRESULT CoreDetect(
282
// Always reset the detect state which means the plan should be reset too.
283
pEngineState->fDetected = FALSE;
284
pEngineState->fPlanned = FALSE;
285
- pEngineState->fApplied = FALSE;
285
DetectReset(&pEngineState->registration, &pEngineState->packages);
286
PlanReset(&pEngineState->plan, &pEngineState->packages);
287
@@ -458,7 +457,7 @@ extern "C" HRESULT CorePlan(
457
{
458
ExitOnFailure(hr = E_INVALIDSTATE, "Plan cannot be done without a successful Detect.");
459
}
461
- else if (pEngineState->fApplied)
460
+ else if (pEngineState->plan.fAffectedMachineState)
461
{
462
ExitOnFailure(hr = E_INVALIDSTATE, "Plan requires a new successful Detect after calling Apply.");
463
}
@@ -624,7 +623,7 @@ extern "C" HRESULT CoreApply(
623
{
624
ExitOnFailure(hr = E_INVALIDSTATE, "Apply cannot be done without a successful Plan.");
625
}
627
- else if (pEngineState->fApplied)
626
+ else if (pEngineState->plan.fAffectedMachineState)
627
{
628
ExitOnFailure(hr = E_INVALIDSTATE, "Plans cannot be applied multiple times.");
629
}
@@ -644,7 +643,7 @@ extern "C" HRESULT CoreApply(
643
hr = UserExperienceOnApplyBegin(&pEngineState->userExperience, dwPhaseCount);
644
ExitOnRootFailure(hr, "BA aborted apply begin.");
645
647
- pEngineState->fApplied = TRUE;
646
+ pEngineState->plan.fAffectedMachineState = pEngineState->plan.fCanAffectMachineState;
647
648
// Abort if this bundle already requires a restart.
649
if (BOOTSTRAPPER_RESUME_TYPE_REBOOT_PENDING == pEngineState->command.resumeType)
@@ -695,7 +694,7 @@ extern "C" HRESULT CoreApply(
694
}
695
696
// Register.
698
- if (pEngineState->plan.fRegister)
697
+ if (pEngineState->plan.fCanAffectMachineState)
698
{
699
fRegistered = TRUE;
700
hr = ApplyRegister(pEngineState);
@@ -1107,7 +1106,7 @@ extern "C" void CoreCleanup(
1106
1107
LogId(REPORT_STANDARD, MSG_CLEANUP_BEGIN);
1108
1110
- if (pEngineState->fApplied && BOOTSTRAPPER_ACTION_LAYOUT < pEngineState->plan.action && BOOTSTRAPPER_ACTION_UPDATE_REPLACE > pEngineState->plan.action)
1109
+ if (pEngineState->plan.fAffectedMachineState)
1110
{
1111
LogId(REPORT_STANDARD, MSG_CLEANUP_SKIPPED_APPLY);
1112
ExitFunction();
src/engine/core.h
-1
@@ -80,7 +80,6 @@ typedef struct _BURN_ENGINE_STATE
80
// UX flow control
81
BOOL fDetected;
82
BOOL fPlanned;
83
- BOOL fApplied;
83
BOOL fQuit;
84
//BOOL fSuspend; // Is TRUE when UX made Suspend() call on core.
85
//BOOL fForcedReboot; // Is TRUE when UX made Reboot() call on core.
src/engine/plan.cpp
+1
-1
@@ -519,7 +519,7 @@ extern "C" HRESULT PlanRegistration(
519
STRINGDICT_HANDLE sdBundleDependents = NULL;
520
STRINGDICT_HANDLE sdIgnoreDependents = NULL;
521
522
- pPlan->fRegister = TRUE; // register the bundle since we're modifying machine state.
522
+ pPlan->fCanAffectMachineState = TRUE; // register the bundle since we're modifying machine state.
523
524
pPlan->fDisallowRemoval = FALSE; // by default the bundle can be planned to be removed
525
src/engine/plan.h
+2
-1
@@ -309,10 +309,11 @@ typedef struct _BURN_PLAN
309
LPWSTR wzBundleId; // points directly into parent the ENGINE_STATE.
310
LPWSTR wzBundleProviderKey; // points directly into parent the ENGINE_STATE.
311
BOOL fPerMachine;
312
- BOOL fRegister;
312
+ BOOL fCanAffectMachineState;
313
DWORD dwRegistrationOperations;
314
BOOL fDisallowRemoval;
315
BOOL fDisableRollback;
316
+ BOOL fAffectedMachineState;
317
318
DWORD64 qwCacheSizeTotal;
319