diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-03-16 15:20:15 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-03-16 20:14:37 -0500 |
commit | 8c9ca787bee29f969cd7ca9aeaa46626d557d196 (patch) | |
tree | 8a7278a4035b584e1f1585e3215766af3ca0a62b /src/burn | |
parent | c1694843f7c54c7f9feb3f7074a31ff8499c9644 (diff) | |
download | wix-8c9ca787bee29f969cd7ca9aeaa46626d557d196.tar.gz wix-8c9ca787bee29f969cd7ca9aeaa46626d557d196.tar.bz2 wix-8c9ca787bee29f969cd7ca9aeaa46626d557d196.zip |
Add WixBundleCommandLineAction, don't set dynamic variables at startup.
Fixes 6736
Diffstat (limited to 'src/burn')
-rw-r--r-- | src/burn/engine/core.cpp | 10 | ||||
-rw-r--r-- | src/burn/engine/core.h | 1 | ||||
-rw-r--r-- | src/burn/engine/engine.cpp | 4 | ||||
-rw-r--r-- | src/burn/engine/plan.cpp | 3 | ||||
-rw-r--r-- | src/burn/engine/plan.h | 1 | ||||
-rw-r--r-- | src/burn/engine/registration.cpp | 3 | ||||
-rw-r--r-- | src/burn/engine/variable.cpp | 1 | ||||
-rw-r--r-- | src/burn/test/BurnUnitTest/PlanTest.cpp | 2 | ||||
-rw-r--r-- | src/burn/test/BurnUnitTest/RegistrationTest.cpp | 7 |
9 files changed, 19 insertions, 13 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index 37872e52..becece86 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
@@ -309,7 +309,7 @@ extern "C" HRESULT CoreDetect( | |||
309 | pEngineState->fDetected = FALSE; | 309 | pEngineState->fDetected = FALSE; |
310 | pEngineState->fPlanned = FALSE; | 310 | pEngineState->fPlanned = FALSE; |
311 | DetectReset(&pEngineState->registration, &pEngineState->packages); | 311 | DetectReset(&pEngineState->registration, &pEngineState->packages); |
312 | PlanReset(&pEngineState->plan, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads); | 312 | PlanReset(&pEngineState->plan, &pEngineState->variables, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads); |
313 | 313 | ||
314 | hr = RegistrationSetDynamicVariables(&pEngineState->registration, &pEngineState->variables); | 314 | hr = RegistrationSetDynamicVariables(&pEngineState->registration, &pEngineState->variables); |
315 | ExitOnFailure(hr, "Failed to reset the dynamic registration variables during detect."); | 315 | ExitOnFailure(hr, "Failed to reset the dynamic registration variables during detect."); |
@@ -441,6 +441,9 @@ extern "C" HRESULT CorePlan( | |||
441 | BURN_PACKAGE* pForwardCompatibleBundlePackage = NULL; | 441 | BURN_PACKAGE* pForwardCompatibleBundlePackage = NULL; |
442 | BOOL fContinuePlanning = TRUE; // assume we won't skip planning due to dependencies. | 442 | BOOL fContinuePlanning = TRUE; // assume we won't skip planning due to dependencies. |
443 | 443 | ||
444 | hr = PlanSetVariables(action, &pEngineState->variables); | ||
445 | ExitOnFailure(hr, "Failed to update action."); | ||
446 | |||
444 | LogId(REPORT_STANDARD, MSG_PLAN_BEGIN, pEngineState->packages.cPackages, LoggingBurnActionToString(action)); | 447 | LogId(REPORT_STANDARD, MSG_PLAN_BEGIN, pEngineState->packages.cPackages, LoggingBurnActionToString(action)); |
445 | 448 | ||
446 | fPlanBegan = TRUE; | 449 | fPlanBegan = TRUE; |
@@ -458,7 +461,7 @@ extern "C" HRESULT CorePlan( | |||
458 | 461 | ||
459 | // Always reset the plan. | 462 | // Always reset the plan. |
460 | pEngineState->fPlanned = FALSE; | 463 | pEngineState->fPlanned = FALSE; |
461 | PlanReset(&pEngineState->plan, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads); | 464 | PlanReset(&pEngineState->plan, &pEngineState->variables, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads); |
462 | 465 | ||
463 | // Remember the overall action state in the plan since it shapes the changes | 466 | // Remember the overall action state in the plan since it shapes the changes |
464 | // we make everywhere. | 467 | // we make everywhere. |
@@ -472,9 +475,6 @@ extern "C" HRESULT CorePlan( | |||
472 | pEngineState->plan.fDisableRollback = pEngineState->fDisableRollback || BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL == pEngineState->plan.action; | 475 | pEngineState->plan.fDisableRollback = pEngineState->fDisableRollback || BOOTSTRAPPER_ACTION_UNSAFE_UNINSTALL == pEngineState->plan.action; |
473 | pEngineState->plan.fPlanPackageCacheRollback = BOOTSTRAPPER_REGISTRATION_TYPE_NONE == pEngineState->registration.detectedRegistrationType; | 476 | pEngineState->plan.fPlanPackageCacheRollback = BOOTSTRAPPER_REGISTRATION_TYPE_NONE == pEngineState->registration.detectedRegistrationType; |
474 | 477 | ||
475 | hr = PlanSetVariables(action, &pEngineState->variables); | ||
476 | ExitOnFailure(hr, "Failed to update action."); | ||
477 | |||
478 | // Set resume commandline | 478 | // Set resume commandline |
479 | hr = PlanSetResumeCommand(&pEngineState->plan, &pEngineState->registration, &pEngineState->log); | 479 | hr = PlanSetResumeCommand(&pEngineState->plan, &pEngineState->registration, &pEngineState->log); |
480 | ExitOnFailure(hr, "Failed to set resume command"); | 480 | ExitOnFailure(hr, "Failed to set resume command"); |
diff --git a/src/burn/engine/core.h b/src/burn/engine/core.h index ff983d60..6ba1aa2a 100644 --- a/src/burn/engine/core.h +++ b/src/burn/engine/core.h | |||
@@ -37,6 +37,7 @@ const LPCWSTR BURN_COMMANDLINE_SWITCH_PREFIX = L"burn."; | |||
37 | const LPCWSTR BURN_BUNDLE_LAYOUT_DIRECTORY = L"WixBundleLayoutDirectory"; | 37 | const LPCWSTR BURN_BUNDLE_LAYOUT_DIRECTORY = L"WixBundleLayoutDirectory"; |
38 | const LPCWSTR BURN_BUNDLE_ACTION = L"WixBundleAction"; | 38 | const LPCWSTR BURN_BUNDLE_ACTION = L"WixBundleAction"; |
39 | const LPCWSTR BURN_BUNDLE_ACTIVE_PARENT = L"WixBundleActiveParent"; | 39 | const LPCWSTR BURN_BUNDLE_ACTIVE_PARENT = L"WixBundleActiveParent"; |
40 | const LPCWSTR BURN_BUNDLE_COMMAND_LINE_ACTION = L"WixBundleCommandLineAction"; | ||
40 | const LPCWSTR BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER = L"WixBundleExecutePackageCacheFolder"; | 41 | const LPCWSTR BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER = L"WixBundleExecutePackageCacheFolder"; |
41 | const LPCWSTR BURN_BUNDLE_EXECUTE_PACKAGE_ACTION = L"WixBundleExecutePackageAction"; | 42 | const LPCWSTR BURN_BUNDLE_EXECUTE_PACKAGE_ACTION = L"WixBundleExecutePackageAction"; |
42 | const LPCWSTR BURN_BUNDLE_FORCED_RESTART_PACKAGE = L"WixBundleForcedRestartPackage"; | 43 | const LPCWSTR BURN_BUNDLE_FORCED_RESTART_PACKAGE = L"WixBundleForcedRestartPackage"; |
diff --git a/src/burn/engine/engine.cpp b/src/burn/engine/engine.cpp index 1f2dac3c..9b94552b 100644 --- a/src/burn/engine/engine.cpp +++ b/src/burn/engine/engine.cpp | |||
@@ -557,8 +557,8 @@ static HRESULT RunNormal( | |||
557 | hr = S_OK; | 557 | hr = S_OK; |
558 | 558 | ||
559 | // Set some built-in variables before loading the BA. | 559 | // Set some built-in variables before loading the BA. |
560 | hr = PlanSetVariables(pEngineState->command.action, &pEngineState->variables); | 560 | hr = VariableSetNumeric(&pEngineState->variables, BURN_BUNDLE_COMMAND_LINE_ACTION, pEngineState->command.action, TRUE); |
561 | ExitOnFailure(hr, "Failed to set action variables."); | 561 | ExitOnFailure(hr, "Failed to set command line action variable."); |
562 | 562 | ||
563 | hr = RegistrationSetVariables(&pEngineState->registration, &pEngineState->variables); | 563 | hr = RegistrationSetVariables(&pEngineState->registration, &pEngineState->variables); |
564 | ExitOnFailure(hr, "Failed to set registration variables."); | 564 | ExitOnFailure(hr, "Failed to set registration variables."); |
diff --git a/src/burn/engine/plan.cpp b/src/burn/engine/plan.cpp index 46680636..5e1d2654 100644 --- a/src/burn/engine/plan.cpp +++ b/src/burn/engine/plan.cpp | |||
@@ -147,6 +147,7 @@ static BOOL ForceCache( | |||
147 | 147 | ||
148 | extern "C" void PlanReset( | 148 | extern "C" void PlanReset( |
149 | __in BURN_PLAN* pPlan, | 149 | __in BURN_PLAN* pPlan, |
150 | __in BURN_VARIABLES* pVariables, | ||
150 | __in BURN_CONTAINERS* pContainers, | 151 | __in BURN_CONTAINERS* pContainers, |
151 | __in BURN_PACKAGES* pPackages, | 152 | __in BURN_PACKAGES* pPackages, |
152 | __in BURN_PAYLOAD_GROUP* pLayoutPayloads | 153 | __in BURN_PAYLOAD_GROUP* pLayoutPayloads |
@@ -274,6 +275,8 @@ extern "C" void PlanReset( | |||
274 | ResetPlannedRollbackBoundaryState(&pPackages->rgRollbackBoundaries[i]); | 275 | ResetPlannedRollbackBoundaryState(&pPackages->rgRollbackBoundaries[i]); |
275 | } | 276 | } |
276 | } | 277 | } |
278 | |||
279 | PlanSetVariables(BOOTSTRAPPER_ACTION_UNKNOWN, pVariables); | ||
277 | } | 280 | } |
278 | 281 | ||
279 | extern "C" void PlanUninitializeExecuteAction( | 282 | extern "C" void PlanUninitializeExecuteAction( |
diff --git a/src/burn/engine/plan.h b/src/burn/engine/plan.h index e73cbcfa..834d2567 100644 --- a/src/burn/engine/plan.h +++ b/src/burn/engine/plan.h | |||
@@ -306,6 +306,7 @@ typedef struct _BURN_PLAN | |||
306 | 306 | ||
307 | void PlanReset( | 307 | void PlanReset( |
308 | __in BURN_PLAN* pPlan, | 308 | __in BURN_PLAN* pPlan, |
309 | __in BURN_VARIABLES* pVariables, | ||
309 | __in BURN_CONTAINERS* pContainers, | 310 | __in BURN_CONTAINERS* pContainers, |
310 | __in BURN_PACKAGES* pPackages, | 311 | __in BURN_PACKAGES* pPackages, |
311 | __in BURN_PAYLOAD_GROUP* pLayoutPayloads | 312 | __in BURN_PAYLOAD_GROUP* pLayoutPayloads |
diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp index 6bae2e7b..a65c30d3 100644 --- a/src/burn/engine/registration.cpp +++ b/src/burn/engine/registration.cpp | |||
@@ -445,9 +445,6 @@ extern "C" HRESULT RegistrationSetVariables( | |||
445 | HRESULT hr = S_OK; | 445 | HRESULT hr = S_OK; |
446 | LPWSTR scz = NULL; | 446 | LPWSTR scz = NULL; |
447 | 447 | ||
448 | hr = RegistrationSetDynamicVariables(pRegistration, pVariables); | ||
449 | ExitOnFailure(hr, "Failed to set the dynamic registration variables."); | ||
450 | |||
451 | // Ensure the registration bundle name is updated. | 448 | // Ensure the registration bundle name is updated. |
452 | hr = GetBundleInProgressName(pRegistration, pVariables, &scz); | 449 | hr = GetBundleInProgressName(pRegistration, pVariables, &scz); |
453 | ExitOnFailure(hr, "Failed to initialize bundle name."); | 450 | ExitOnFailure(hr, "Failed to initialize bundle name."); |
diff --git a/src/burn/engine/variable.cpp b/src/burn/engine/variable.cpp index ae06c1d5..718751e5 100644 --- a/src/burn/engine/variable.cpp +++ b/src/burn/engine/variable.cpp | |||
@@ -268,6 +268,7 @@ extern "C" HRESULT VariableInitialize( | |||
268 | {L"WindowsFolder", InitializeVariableCsidlFolder, CSIDL_WINDOWS}, | 268 | {L"WindowsFolder", InitializeVariableCsidlFolder, CSIDL_WINDOWS}, |
269 | {L"WindowsVolume", InitializeVariableWindowsVolumeFolder, 0}, | 269 | {L"WindowsVolume", InitializeVariableWindowsVolumeFolder, 0}, |
270 | {BURN_BUNDLE_ACTION, InitializeVariableNumeric, 0, FALSE, TRUE}, | 270 | {BURN_BUNDLE_ACTION, InitializeVariableNumeric, 0, FALSE, TRUE}, |
271 | {BURN_BUNDLE_COMMAND_LINE_ACTION, InitializeVariableNumeric, 0, FALSE, TRUE}, | ||
271 | {BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER, InitializeVariableString, NULL, FALSE, TRUE}, | 272 | {BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER, InitializeVariableString, NULL, FALSE, TRUE}, |
272 | {BURN_BUNDLE_EXECUTE_PACKAGE_ACTION, InitializeVariableString, NULL, FALSE, TRUE}, | 273 | {BURN_BUNDLE_EXECUTE_PACKAGE_ACTION, InitializeVariableString, NULL, FALSE, TRUE}, |
273 | {BURN_BUNDLE_FORCED_RESTART_PACKAGE, InitializeVariableString, NULL, TRUE, TRUE}, | 274 | {BURN_BUNDLE_FORCED_RESTART_PACKAGE, InitializeVariableString, NULL, TRUE, TRUE}, |
diff --git a/src/burn/test/BurnUnitTest/PlanTest.cpp b/src/burn/test/BurnUnitTest/PlanTest.cpp index 0a8ac369..4d726fb4 100644 --- a/src/burn/test/BurnUnitTest/PlanTest.cpp +++ b/src/burn/test/BurnUnitTest/PlanTest.cpp | |||
@@ -2040,7 +2040,7 @@ namespace Bootstrapper | |||
2040 | void PlanTestDetect(BURN_ENGINE_STATE* pEngineState) | 2040 | void PlanTestDetect(BURN_ENGINE_STATE* pEngineState) |
2041 | { | 2041 | { |
2042 | DetectReset(&pEngineState->registration, &pEngineState->packages); | 2042 | DetectReset(&pEngineState->registration, &pEngineState->packages); |
2043 | PlanReset(&pEngineState->plan, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads); | 2043 | PlanReset(&pEngineState->plan, &pEngineState->variables, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads); |
2044 | 2044 | ||
2045 | pEngineState->userExperience.fEngineActive = TRUE; | 2045 | pEngineState->userExperience.fEngineActive = TRUE; |
2046 | pEngineState->fDetected = TRUE; | 2046 | pEngineState->fDetected = TRUE; |
diff --git a/src/burn/test/BurnUnitTest/RegistrationTest.cpp b/src/burn/test/BurnUnitTest/RegistrationTest.cpp index 86ea86b0..f01d92a4 100644 --- a/src/burn/test/BurnUnitTest/RegistrationTest.cpp +++ b/src/burn/test/BurnUnitTest/RegistrationTest.cpp | |||
@@ -313,6 +313,9 @@ namespace Bootstrapper | |||
313 | plan.pCommand = &command; | 313 | plan.pCommand = &command; |
314 | plan.pInternalCommand = &internalCommand; | 314 | plan.pInternalCommand = &internalCommand; |
315 | 315 | ||
316 | hr = RegistrationSetVariables(®istration, &variables); | ||
317 | TestThrowOnFailure(hr, L"Failed to set registration variables."); | ||
318 | |||
316 | hr = PlanSetResumeCommand(&plan, ®istration, &logging); | 319 | hr = PlanSetResumeCommand(&plan, ®istration, &logging); |
317 | TestThrowOnFailure(hr, L"Failed to set registration resume command."); | 320 | TestThrowOnFailure(hr, L"Failed to set registration resume command."); |
318 | 321 | ||
@@ -339,8 +342,8 @@ namespace Bootstrapper | |||
339 | this->ValidateUninstallKeyDisplayName(L"Product1"); | 342 | this->ValidateUninstallKeyDisplayName(L"Product1"); |
340 | registration.detectedRegistrationType = BOOTSTRAPPER_REGISTRATION_TYPE_FULL; | 343 | registration.detectedRegistrationType = BOOTSTRAPPER_REGISTRATION_TYPE_FULL; |
341 | 344 | ||
342 | hr = RegistrationSetVariables(®istration, &variables); | 345 | hr = RegistrationSetDynamicVariables(®istration, &variables); |
343 | TestThrowOnFailure(hr, L"Failed to set registration variables."); | 346 | TestThrowOnFailure(hr, L"Failed to set dynamic registration variables."); |
344 | 347 | ||
345 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, BURN_BUNDLE_INSTALLED)); | 348 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, BURN_BUNDLE_INSTALLED)); |
346 | Assert::Equal<String^>(gcnew String(L"foo"), VariableGetStringHelper(&variables, BURN_BUNDLE_TAG)); | 349 | Assert::Equal<String^>(gcnew String(L"foo"), VariableGetStringHelper(&variables, BURN_BUNDLE_TAG)); |