From 8e8f724d90c6835febb8b5865009746aea73a334 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Tue, 22 Feb 2022 20:23:43 -0600 Subject: Add UnsafeUninstall action. Fixes #6721 --- src/burn/engine/core.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'src/burn/engine/core.cpp') diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index 8fac7bd0..9d5364a4 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp @@ -488,7 +488,7 @@ extern "C" HRESULT CorePlan( pEngineState->plan.pPayloads = &pEngineState->payloads; pEngineState->plan.wzBundleId = pEngineState->registration.sczId; pEngineState->plan.wzBundleProviderKey = pEngineState->registration.sczId; - pEngineState->plan.fDisableRollback = pEngineState->fDisableRollback; + pEngineState->plan.fDisableRollback = pEngineState->fDisableRollback || BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL == pEngineState->plan.action; pEngineState->plan.fBundleAlreadyRegistered = pEngineState->registration.fInstalled; hr = PlanSetVariables(action, &pEngineState->variables); @@ -756,6 +756,14 @@ extern "C" HRESULT CoreApply( } } + if (BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL == pEngineState->plan.action) + { + fSuspend = FALSE; + restart = BOOTSTRAPPER_APPLY_RESTART_NONE; + + LogId(REPORT_STANDARD, MSG_UNSAFE_APPLY_COMPLETED); + } + if (fSuspend || BOOTSTRAPPER_APPLY_RESTART_INITIATED == restart) { // Leave cache alone. @@ -773,7 +781,7 @@ extern "C" HRESULT CoreApply( } LExit: - if (fRollbackCache) + if (fRollbackCache && !pEngineState->plan.fDisableRollback) { ApplyCacheRollback(&pEngineState->userExperience, &pEngineState->plan, pEngineState->companionConnection.hCachePipe, &applyContext); } @@ -978,6 +986,9 @@ static HRESULT CoreRecreateCommandLine( case BOOTSTRAPPER_ACTION_UNINSTALL: hr = StrAllocConcat(psczCommandLine, L" /uninstall", 0); break; + case BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL: + hr = StrAllocConcat(psczCommandLine, L" /unsafeuninstall", 0); + break; } ExitOnFailure(hr, "Failed to append action state to command-line"); @@ -1414,6 +1425,13 @@ extern "C" HRESULT CoreParseCommandLine( ExitOnFailure(hr, "Failed to copy path for layout directory."); } } + else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, L"unsafeuninstall", -1)) + { + if (BOOTSTRAPPER_ACTION_HELP != pCommand->action) + { + pCommand->action = BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL; + } + } else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, L"uninstall", -1)) { if (BOOTSTRAPPER_ACTION_HELP != pCommand->action) @@ -2207,7 +2225,7 @@ static void LogPackages( __in const BOOTSTRAPPER_ACTION action ) { - BOOL fUninstalling = BOOTSTRAPPER_ACTION_UNINSTALL == action; + BOOL fUninstalling = BOOTSTRAPPER_ACTION_UNINSTALL == action || BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL == action; if (pUpgradeBundlePackage) { @@ -2286,8 +2304,8 @@ static void LogPackages( } } - // Display related bundles last if caching, installing, modifying, or repairing. - if (BOOTSTRAPPER_ACTION_UNINSTALL < action) + // Display related bundles last if not uninstalling. + if (!fUninstalling) { LogRelatedBundles(pRelatedBundles, FALSE); } -- cgit v1.2.3-55-g6feb