diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-04-22 16:56:21 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-04-23 15:40:21 -0500 |
| commit | a981e29d7a3df566754356c3fe1eb938a5cac4c1 (patch) | |
| tree | 9d2b2abac872ae3c4917003812951e68b72e7163 /src/burn/engine/apply.cpp | |
| parent | 72e20f682c0d64102e86439ba5527dd0d71932ae (diff) | |
| download | wix-a981e29d7a3df566754356c3fe1eb938a5cac4c1.tar.gz wix-a981e29d7a3df566754356c3fe1eb938a5cac4c1.tar.bz2 wix-a981e29d7a3df566754356c3fe1eb938a5cac4c1.zip | |
Make the estimated size in ARP a little more accurate.
Fixes 4039
Diffstat (limited to 'src/burn/engine/apply.cpp')
| -rw-r--r-- | src/burn/engine/apply.cpp | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/src/burn/engine/apply.cpp b/src/burn/engine/apply.cpp index 9ee7b58c..69106f65 100644 --- a/src/burn/engine/apply.cpp +++ b/src/burn/engine/apply.cpp | |||
| @@ -79,7 +79,8 @@ static HRESULT WINAPI AuthenticationRequired( | |||
| 79 | static void CalculateKeepRegistration( | 79 | static void CalculateKeepRegistration( |
| 80 | __in BURN_ENGINE_STATE* pEngineState, | 80 | __in BURN_ENGINE_STATE* pEngineState, |
| 81 | __in BOOL fLog, | 81 | __in BOOL fLog, |
| 82 | __inout BOOTSTRAPPER_REGISTRATION_TYPE* pRegistrationType | 82 | __inout BOOTSTRAPPER_REGISTRATION_TYPE* pRegistrationType, |
| 83 | __inout DWORD64* pqwEstimatedSize | ||
| 83 | ); | 84 | ); |
| 84 | static HRESULT ExecuteDependentRegistrationActions( | 85 | static HRESULT ExecuteDependentRegistrationActions( |
| 85 | __in HANDLE hPipe, | 86 | __in HANDLE hPipe, |
| @@ -422,8 +423,9 @@ extern "C" HRESULT ApplyRegister( | |||
| 422 | HRESULT hr = S_OK; | 423 | HRESULT hr = S_OK; |
| 423 | LPWSTR sczEngineWorkingPath = NULL; | 424 | LPWSTR sczEngineWorkingPath = NULL; |
| 424 | BOOTSTRAPPER_REGISTRATION_TYPE registrationType = BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS; | 425 | BOOTSTRAPPER_REGISTRATION_TYPE registrationType = BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS; |
| 426 | DWORD64 qwEstimatedSize = 0; | ||
| 425 | 427 | ||
| 426 | CalculateKeepRegistration(pEngineState, FALSE, ®istrationType); | 428 | CalculateKeepRegistration(pEngineState, FALSE, ®istrationType, &qwEstimatedSize); |
| 427 | 429 | ||
| 428 | hr = UserExperienceOnRegisterBegin(&pEngineState->userExperience, ®istrationType); | 430 | hr = UserExperienceOnRegisterBegin(&pEngineState->userExperience, ®istrationType); |
| 429 | ExitOnRootFailure(hr, "BA aborted register begin."); | 431 | ExitOnRootFailure(hr, "BA aborted register begin."); |
| @@ -451,12 +453,12 @@ extern "C" HRESULT ApplyRegister( | |||
| 451 | // begin new session | 453 | // begin new session |
| 452 | if (pEngineState->registration.fPerMachine) | 454 | if (pEngineState->registration.fPerMachine) |
| 453 | { | 455 | { |
| 454 | hr = ElevationSessionBegin(pEngineState->companionConnection.hPipe, sczEngineWorkingPath, pEngineState->registration.sczResumeCommandLine, pEngineState->registration.fDisableResume, &pEngineState->variables, pEngineState->plan.dwRegistrationOperations, pEngineState->registration.fDetectedForeignProviderKeyBundleId, pEngineState->plan.qwEstimatedSize, registrationType); | 456 | hr = ElevationSessionBegin(pEngineState->companionConnection.hPipe, sczEngineWorkingPath, pEngineState->registration.sczResumeCommandLine, pEngineState->registration.fDisableResume, &pEngineState->variables, pEngineState->plan.dwRegistrationOperations, pEngineState->registration.fDetectedForeignProviderKeyBundleId, qwEstimatedSize, registrationType); |
| 455 | ExitOnFailure(hr, "Failed to begin registration session in per-machine process."); | 457 | ExitOnFailure(hr, "Failed to begin registration session in per-machine process."); |
| 456 | } | 458 | } |
| 457 | else | 459 | else |
| 458 | { | 460 | { |
| 459 | hr = RegistrationSessionBegin(sczEngineWorkingPath, &pEngineState->registration, &pEngineState->cache, &pEngineState->variables, pEngineState->plan.dwRegistrationOperations, pEngineState->plan.qwEstimatedSize, registrationType); | 461 | hr = RegistrationSessionBegin(sczEngineWorkingPath, &pEngineState->registration, &pEngineState->cache, &pEngineState->variables, pEngineState->plan.dwRegistrationOperations, qwEstimatedSize, registrationType); |
| 460 | ExitOnFailure(hr, "Failed to begin registration session."); | 462 | ExitOnFailure(hr, "Failed to begin registration session."); |
| 461 | } | 463 | } |
| 462 | } | 464 | } |
| @@ -491,6 +493,7 @@ extern "C" HRESULT ApplyUnregister( | |||
| 491 | BURN_RESUME_MODE resumeMode = BURN_RESUME_MODE_NONE; | 493 | BURN_RESUME_MODE resumeMode = BURN_RESUME_MODE_NONE; |
| 492 | BOOTSTRAPPER_REGISTRATION_TYPE defaultRegistrationType = BOOTSTRAPPER_REGISTRATION_TYPE_NONE; | 494 | BOOTSTRAPPER_REGISTRATION_TYPE defaultRegistrationType = BOOTSTRAPPER_REGISTRATION_TYPE_NONE; |
| 493 | BOOTSTRAPPER_REGISTRATION_TYPE registrationType = BOOTSTRAPPER_REGISTRATION_TYPE_NONE; | 495 | BOOTSTRAPPER_REGISTRATION_TYPE registrationType = BOOTSTRAPPER_REGISTRATION_TYPE_NONE; |
| 496 | DWORD64 qwEstimatedSize = 0; | ||
| 494 | 497 | ||
| 495 | // Calculate special cases for the resume mode. If a restart has been initiated, that trumps all other | 498 | // Calculate special cases for the resume mode. If a restart has been initiated, that trumps all other |
| 496 | // modes. If the user chose to suspend the install then we'll use that as the resume mode. | 499 | // modes. If the user chose to suspend the install then we'll use that as the resume mode. |
| @@ -513,7 +516,7 @@ extern "C" HRESULT ApplyUnregister( | |||
| 513 | defaultRegistrationType = BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS; | 516 | defaultRegistrationType = BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS; |
| 514 | } | 517 | } |
| 515 | 518 | ||
| 516 | CalculateKeepRegistration(pEngineState, TRUE, &defaultRegistrationType); | 519 | CalculateKeepRegistration(pEngineState, TRUE, &defaultRegistrationType, &qwEstimatedSize); |
| 517 | 520 | ||
| 518 | registrationType = defaultRegistrationType; | 521 | registrationType = defaultRegistrationType; |
| 519 | 522 | ||
| @@ -547,12 +550,12 @@ extern "C" HRESULT ApplyUnregister( | |||
| 547 | 550 | ||
| 548 | if (pEngineState->registration.fPerMachine) | 551 | if (pEngineState->registration.fPerMachine) |
| 549 | { | 552 | { |
| 550 | hr = ElevationSessionEnd(pEngineState->companionConnection.hPipe, resumeMode, restart, pEngineState->registration.fDetectedForeignProviderKeyBundleId, registrationType); | 553 | hr = ElevationSessionEnd(pEngineState->companionConnection.hPipe, resumeMode, restart, pEngineState->registration.fDetectedForeignProviderKeyBundleId, qwEstimatedSize, registrationType); |
| 551 | ExitOnFailure(hr, "Failed to end session in per-machine process."); | 554 | ExitOnFailure(hr, "Failed to end session in per-machine process."); |
| 552 | } | 555 | } |
| 553 | else | 556 | else |
| 554 | { | 557 | { |
| 555 | hr = RegistrationSessionEnd(&pEngineState->registration, &pEngineState->cache, &pEngineState->variables, &pEngineState->packages, resumeMode, restart, registrationType); | 558 | hr = RegistrationSessionEnd(&pEngineState->registration, &pEngineState->cache, &pEngineState->variables, &pEngineState->packages, resumeMode, restart, qwEstimatedSize, registrationType); |
| 556 | ExitOnFailure(hr, "Failed to end session in per-user process."); | 559 | ExitOnFailure(hr, "Failed to end session in per-user process."); |
| 557 | } | 560 | } |
| 558 | 561 | ||
| @@ -880,9 +883,12 @@ extern "C" void ApplyClean( | |||
| 880 | static void CalculateKeepRegistration( | 883 | static void CalculateKeepRegistration( |
| 881 | __in BURN_ENGINE_STATE* pEngineState, | 884 | __in BURN_ENGINE_STATE* pEngineState, |
| 882 | __in BOOL fLog, | 885 | __in BOOL fLog, |
| 883 | __inout BOOTSTRAPPER_REGISTRATION_TYPE* pRegistrationType | 886 | __inout BOOTSTRAPPER_REGISTRATION_TYPE* pRegistrationType, |
| 887 | __inout DWORD64* pqwEstimatedSize | ||
| 884 | ) | 888 | ) |
| 885 | { | 889 | { |
| 890 | DWORD64 qwEstimatedSize = pEngineState->section.qwBundleSize; | ||
| 891 | |||
| 886 | if (fLog) | 892 | if (fLog) |
| 887 | { | 893 | { |
| 888 | LogId(REPORT_STANDARD, MSG_POST_APPLY_CALCULATE_REGISTRATION); | 894 | LogId(REPORT_STANDARD, MSG_POST_APPLY_CALCULATE_REGISTRATION); |
| @@ -911,16 +917,29 @@ static void CalculateKeepRegistration( | |||
| 911 | { | 917 | { |
| 912 | *pRegistrationType = BOOTSTRAPPER_REGISTRATION_TYPE_FULL; | 918 | *pRegistrationType = BOOTSTRAPPER_REGISTRATION_TYPE_FULL; |
| 913 | 919 | ||
| 914 | if (!fLog) | 920 | if (BURN_PACKAGE_TYPE_MSP == pPackage->type) |
| 915 | { | 921 | { |
| 916 | break; | 922 | qwEstimatedSize += pPackage->qwSize; |
| 917 | } | 923 | } |
| 924 | |||
| 925 | qwEstimatedSize += pPackage->qwInstallSize; | ||
| 918 | } | 926 | } |
| 919 | else if (BURN_PACKAGE_REGISTRATION_STATE_PRESENT == pPackage->cacheRegistrationState && BOOTSTRAPPER_REGISTRATION_TYPE_NONE == *pRegistrationType) | 927 | |
| 928 | if (BURN_PACKAGE_REGISTRATION_STATE_PRESENT == pPackage->cacheRegistrationState) | ||
| 920 | { | 929 | { |
| 921 | *pRegistrationType = BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS; | 930 | if (BOOTSTRAPPER_REGISTRATION_TYPE_NONE == *pRegistrationType) |
| 931 | { | ||
| 932 | *pRegistrationType = BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS; | ||
| 933 | } | ||
| 934 | |||
| 935 | qwEstimatedSize += pPackage->qwSize; | ||
| 922 | } | 936 | } |
| 923 | } | 937 | } |
| 938 | |||
| 939 | if (pqwEstimatedSize) | ||
| 940 | { | ||
| 941 | *pqwEstimatedSize = qwEstimatedSize; | ||
| 942 | } | ||
| 924 | } | 943 | } |
| 925 | 944 | ||
| 926 | static HRESULT ExecuteDependentRegistrationActions( | 945 | static HRESULT ExecuteDependentRegistrationActions( |
