diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-05-14 19:59:06 +1000 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-05-16 21:42:51 +1000 |
| commit | 50cb451bcee148afd9768086c1bb5ed4f75562df (patch) | |
| tree | b4a28ef01446f2afd02b803af28ee6c628816cee /src/engine/mspengine.cpp | |
| parent | d232c5621fe336b1f563b69be7637c93e795e151 (diff) | |
| download | wix-50cb451bcee148afd9768086c1bb5ed4f75562df.tar.gz wix-50cb451bcee148afd9768086c1bb5ed4f75562df.tar.bz2 wix-50cb451bcee148afd9768086c1bb5ed4f75562df.zip | |
WIXFEAT:6164 Give BA control over UI level and handler.
Diffstat (limited to 'src/engine/mspengine.cpp')
| -rw-r--r-- | src/engine/mspengine.cpp | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/src/engine/mspengine.cpp b/src/engine/mspengine.cpp index 463799e6..0dddb366 100644 --- a/src/engine/mspengine.cpp +++ b/src/engine/mspengine.cpp | |||
| @@ -44,7 +44,7 @@ static void DeterminePatchChainedTarget( | |||
| 44 | __out BOOL* pfSlipstreamed | 44 | __out BOOL* pfSlipstreamed |
| 45 | ); | 45 | ); |
| 46 | static HRESULT PlanTargetProduct( | 46 | static HRESULT PlanTargetProduct( |
| 47 | __in BOOTSTRAPPER_DISPLAY display, | 47 | __in BURN_USER_EXPERIENCE* pUserExperience, |
| 48 | __in BOOL fRollback, | 48 | __in BOOL fRollback, |
| 49 | __in BURN_PLAN* pPlan, | 49 | __in BURN_PLAN* pPlan, |
| 50 | __in BURN_LOGGING* pLog, | 50 | __in BURN_LOGGING* pLog, |
| @@ -73,10 +73,6 @@ extern "C" HRESULT MspEngineParsePackageFromXml( | |||
| 73 | hr = XmlGetAttributeEx(pixnMspPackage, L"PatchXml", &pPackage->Msp.sczApplicabilityXml); | 73 | hr = XmlGetAttributeEx(pixnMspPackage, L"PatchXml", &pPackage->Msp.sczApplicabilityXml); |
| 74 | ExitOnFailure(hr, "Failed to get @PatchXml."); | 74 | ExitOnFailure(hr, "Failed to get @PatchXml."); |
| 75 | 75 | ||
| 76 | // @DisplayInternalUI | ||
| 77 | hr = XmlGetYesNoAttribute(pixnMspPackage, L"DisplayInternalUI", &pPackage->Msp.fDisplayInternalUI); | ||
| 78 | ExitOnFailure(hr, "Failed to get @DisplayInternalUI."); | ||
| 79 | |||
| 80 | // Read properties. | 76 | // Read properties. |
| 81 | hr = MsiEngineParsePropertiesFromXml(pixnMspPackage, &pPackage->Msp.rgProperties, &pPackage->Msp.cProperties); | 77 | hr = MsiEngineParsePropertiesFromXml(pixnMspPackage, &pPackage->Msp.rgProperties, &pPackage->Msp.cProperties); |
| 82 | ExitOnFailure(hr, "Failed to parse properties from XML."); | 78 | ExitOnFailure(hr, "Failed to parse properties from XML."); |
| @@ -400,7 +396,7 @@ LExit: | |||
| 400 | // PlanAdd - adds the calculated execute and rollback actions for the package. | 396 | // PlanAdd - adds the calculated execute and rollback actions for the package. |
| 401 | // | 397 | // |
| 402 | extern "C" HRESULT MspEnginePlanAddPackage( | 398 | extern "C" HRESULT MspEnginePlanAddPackage( |
| 403 | __in BOOTSTRAPPER_DISPLAY display, | 399 | __in BURN_USER_EXPERIENCE* pUserExperience, |
| 404 | __in BURN_PACKAGE* pPackage, | 400 | __in BURN_PACKAGE* pPackage, |
| 405 | __in BURN_PLAN* pPlan, | 401 | __in BURN_PLAN* pPlan, |
| 406 | __in BURN_LOGGING* pLog, | 402 | __in BURN_LOGGING* pLog, |
| @@ -437,13 +433,13 @@ extern "C" HRESULT MspEnginePlanAddPackage( | |||
| 437 | 433 | ||
| 438 | if (BOOTSTRAPPER_ACTION_STATE_NONE != pTargetProduct->execute) | 434 | if (BOOTSTRAPPER_ACTION_STATE_NONE != pTargetProduct->execute) |
| 439 | { | 435 | { |
| 440 | hr = PlanTargetProduct(display, FALSE, pPlan, pLog, pVariables, pTargetProduct->execute, pPackage, pTargetProduct, hCacheEvent); | 436 | hr = PlanTargetProduct(pUserExperience, FALSE, pPlan, pLog, pVariables, pTargetProduct->execute, pPackage, pTargetProduct, hCacheEvent); |
| 441 | ExitOnFailure(hr, "Failed to plan target product."); | 437 | ExitOnFailure(hr, "Failed to plan target product."); |
| 442 | } | 438 | } |
| 443 | 439 | ||
| 444 | if (BOOTSTRAPPER_ACTION_STATE_NONE != pTargetProduct->rollback) | 440 | if (BOOTSTRAPPER_ACTION_STATE_NONE != pTargetProduct->rollback) |
| 445 | { | 441 | { |
| 446 | hr = PlanTargetProduct(display, TRUE, pPlan, pLog, pVariables, pTargetProduct->rollback, pPackage, pTargetProduct, hCacheEvent); | 442 | hr = PlanTargetProduct(pUserExperience, TRUE, pPlan, pLog, pVariables, pTargetProduct->rollback, pPackage, pTargetProduct, hCacheEvent); |
| 447 | ExitOnFailure(hr, "Failed to plan rollack target product."); | 443 | ExitOnFailure(hr, "Failed to plan rollack target product."); |
| 448 | } | 444 | } |
| 449 | } | 445 | } |
| @@ -464,7 +460,6 @@ extern "C" HRESULT MspEngineExecutePackage( | |||
| 464 | ) | 460 | ) |
| 465 | { | 461 | { |
| 466 | HRESULT hr = S_OK; | 462 | HRESULT hr = S_OK; |
| 467 | INSTALLUILEVEL uiLevel = pExecuteAction->mspTarget.pPackage->Msp.fDisplayInternalUI ? INSTALLUILEVEL_DEFAULT : static_cast<INSTALLUILEVEL>(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY); | ||
| 468 | WIU_MSI_EXECUTE_CONTEXT context = { }; | 463 | WIU_MSI_EXECUTE_CONTEXT context = { }; |
| 469 | WIU_RESTART restart = WIU_RESTART_NONE; | 464 | WIU_RESTART restart = WIU_RESTART_NONE; |
| 470 | 465 | ||
| @@ -517,8 +512,16 @@ extern "C" HRESULT MspEngineExecutePackage( | |||
| 517 | VariableSetNumeric(pVariables, BURN_BUNDLE_EXECUTE_PACKAGE_ACTION, pExecuteAction->mspTarget.action, TRUE); | 512 | VariableSetNumeric(pVariables, BURN_BUNDLE_EXECUTE_PACKAGE_ACTION, pExecuteAction->mspTarget.action, TRUE); |
| 518 | 513 | ||
| 519 | // Wire up the external UI handler and logging. | 514 | // Wire up the external UI handler and logging. |
| 520 | hr = WiuInitializeExternalUI(pfnMessageHandler, uiLevel, hwndParent, pvContext, fRollback, &context); | 515 | if (pExecuteAction->mspTarget.fDisableExternalUiHandler) |
| 521 | ExitOnFailure(hr, "Failed to initialize external UI handler."); | 516 | { |
| 517 | hr = WiuInitializeInternalUI(pExecuteAction->mspTarget.uiLevel, hwndParent, &context); | ||
| 518 | ExitOnFailure(hr, "Failed to initialize internal UI for MSP package."); | ||
| 519 | } | ||
| 520 | else | ||
| 521 | { | ||
| 522 | hr = WiuInitializeExternalUI(pfnMessageHandler, pExecuteAction->mspTarget.uiLevel, hwndParent, pvContext, fRollback, &context); | ||
| 523 | ExitOnFailure(hr, "Failed to initialize external UI handler."); | ||
| 524 | } | ||
| 522 | 525 | ||
| 523 | //if (BURN_LOGGING_LEVEL_DEBUG == logLevel) | 526 | //if (BURN_LOGGING_LEVEL_DEBUG == logLevel) |
| 524 | //{ | 527 | //{ |
| @@ -538,6 +541,12 @@ extern "C" HRESULT MspEngineExecutePackage( | |||
| 538 | hr = MsiEngineConcatProperties(pExecuteAction->mspTarget.pPackage->Msp.rgProperties, pExecuteAction->mspTarget.pPackage->Msp.cProperties, pVariables, fRollback, &sczObfuscatedProperties, TRUE); | 541 | hr = MsiEngineConcatProperties(pExecuteAction->mspTarget.pPackage->Msp.rgProperties, pExecuteAction->mspTarget.pPackage->Msp.cProperties, pVariables, fRollback, &sczObfuscatedProperties, TRUE); |
| 539 | ExitOnFailure(hr, "Failed to add properties to obfuscated argument string."); | 542 | ExitOnFailure(hr, "Failed to add properties to obfuscated argument string."); |
| 540 | 543 | ||
| 544 | hr = MsiEngineConcatActionProperty(pExecuteAction->mspTarget.actionMsiProperty, &sczProperties); | ||
| 545 | ExitOnFailure(hr, "Failed to add action property to argument string."); | ||
| 546 | |||
| 547 | hr = MsiEngineConcatActionProperty(pExecuteAction->mspTarget.actionMsiProperty, &sczObfuscatedProperties); | ||
| 548 | ExitOnFailure(hr, "Failed to add action property to obfuscated argument string."); | ||
| 549 | |||
| 541 | LogId(REPORT_STANDARD, MSG_APPLYING_PATCH_PACKAGE, pExecuteAction->mspTarget.pPackage->sczId, LoggingActionStateToString(pExecuteAction->mspTarget.action), sczPatches, sczObfuscatedProperties, pExecuteAction->mspTarget.sczTargetProductCode); | 550 | LogId(REPORT_STANDARD, MSG_APPLYING_PATCH_PACKAGE, pExecuteAction->mspTarget.pPackage->sczId, LoggingActionStateToString(pExecuteAction->mspTarget.action), sczPatches, sczObfuscatedProperties, pExecuteAction->mspTarget.sczTargetProductCode); |
| 542 | 551 | ||
| 543 | // | 552 | // |
| @@ -868,7 +877,7 @@ static void DeterminePatchChainedTarget( | |||
| 868 | } | 877 | } |
| 869 | 878 | ||
| 870 | static HRESULT PlanTargetProduct( | 879 | static HRESULT PlanTargetProduct( |
| 871 | __in BOOTSTRAPPER_DISPLAY display, | 880 | __in BURN_USER_EXPERIENCE* pUserExperience, |
| 872 | __in BOOL fRollback, | 881 | __in BOOL fRollback, |
| 873 | __in BURN_PLAN* pPlan, | 882 | __in BURN_PLAN* pPlan, |
| 874 | __in BURN_LOGGING* pLog, | 883 | __in BURN_LOGGING* pLog, |
| @@ -920,12 +929,15 @@ static HRESULT PlanTargetProduct( | |||
| 920 | pAction->mspTarget.action = actionState; | 929 | pAction->mspTarget.action = actionState; |
| 921 | pAction->mspTarget.pPackage = pPackage; | 930 | pAction->mspTarget.pPackage = pPackage; |
| 922 | pAction->mspTarget.fPerMachineTarget = (MSIINSTALLCONTEXT_MACHINE == pTargetProduct->context); | 931 | pAction->mspTarget.fPerMachineTarget = (MSIINSTALLCONTEXT_MACHINE == pTargetProduct->context); |
| 923 | pAction->mspTarget.uiLevel = MsiEngineCalculateInstallUiLevel(pPackage->Msp.fDisplayInternalUI, display, pAction->mspTarget.action); | ||
| 924 | pAction->mspTarget.pChainedTargetPackage = pTargetProduct->pChainedTargetPackage; | 932 | pAction->mspTarget.pChainedTargetPackage = pTargetProduct->pChainedTargetPackage; |
| 925 | pAction->mspTarget.fSlipstream = pTargetProduct->fSlipstream; | 933 | pAction->mspTarget.fSlipstream = pTargetProduct->fSlipstream; |
| 926 | hr = StrAllocString(&pAction->mspTarget.sczTargetProductCode, pTargetProduct->wzTargetProductCode, 0); | 934 | hr = StrAllocString(&pAction->mspTarget.sczTargetProductCode, pTargetProduct->wzTargetProductCode, 0); |
| 927 | ExitOnFailure(hr, "Failed to copy target product code."); | 935 | ExitOnFailure(hr, "Failed to copy target product code."); |
| 928 | 936 | ||
| 937 | hr = MsiEngineCalculateInstallUiLevel(pUserExperience, pPackage->sczId, !fRollback, pAction->mspTarget.action, | ||
| 938 | &pAction->mspTarget.actionMsiProperty, &pAction->mspTarget.uiLevel, &pAction->mspTarget.fDisableExternalUiHandler); | ||
| 939 | ExitOnFailure(hr, "Failed to get msp ui options."); | ||
| 940 | |||
| 929 | // If this is a per-machine target product, then the plan needs to be per-machine as well. | 941 | // If this is a per-machine target product, then the plan needs to be per-machine as well. |
| 930 | if (pAction->mspTarget.fPerMachineTarget) | 942 | if (pAction->mspTarget.fPerMachineTarget) |
| 931 | { | 943 | { |
