Ensure bundle is registered and cached when modifying machine state.

#5702
This commit is contained in:
Sean Hall 2021-03-09 14:05:08 -06:00
Родитель 8b25ff4180
Коммит 778b65643f
1 изменённых файлов: 13 добавлений и 20 удалений

Просмотреть файл

@ -523,6 +523,19 @@ extern "C" HRESULT PlanRegistration(
pPlan->fDisallowRemoval = FALSE; // by default the bundle can be planned to be removed pPlan->fDisallowRemoval = FALSE; // by default the bundle can be planned to be removed
// Ensure the bundle is cached if not running from the cache.
if (!CacheBundleRunningFromCache())
{
pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE;
}
// Always write registration since things may have changed or it just needs to be "fixed up".
pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION;
// Always update our estimated size registration when installing/modify/repair since things
// may have been added or removed or it just needs to be "fixed up".
pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_UPDATE_SIZE;
if (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action) if (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action)
{ {
// If our provider key was detected and it points to our current bundle then we can // If our provider key was detected and it points to our current bundle then we can
@ -621,26 +634,6 @@ extern "C" HRESULT PlanRegistration(
{ {
BOOL fAddonOrPatchBundle = (pRegistration->cAddonCodes || pRegistration->cPatchCodes); BOOL fAddonOrPatchBundle = (pRegistration->cAddonCodes || pRegistration->cPatchCodes);
// If the bundle is not cached or will not be cached after restart, ensure the bundle is cached.
if (!FileExistsAfterRestart(pRegistration->sczCacheExecutablePath, NULL))
{
pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE;
pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION;
}
else if (BOOTSTRAPPER_ACTION_REPAIR == pPlan->action && !CacheBundleRunningFromCache()) // repairing but not running from the cache.
{
pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE;
pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION;
}
else if (BOOTSTRAPPER_ACTION_REPAIR == pPlan->action) // just repair, make sure the registration is "fixed up".
{
pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION;
}
// Always update our estimated size registration when installing/modify/repair since things
// may have been added or removed or it just needs to be "fixed up".
pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_UPDATE_SIZE;
// Always plan to write our provider key registration when installing/modify/repair to "fix it" // Always plan to write our provider key registration when installing/modify/repair to "fix it"
// if broken. // if broken.
pPlan->dependencyRegistrationAction = BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER; pPlan->dependencyRegistrationAction = BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER;