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 | |
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')
-rw-r--r-- | src/burn/engine/apply.cpp | 43 | ||||
-rw-r--r-- | src/burn/engine/elevation.cpp | 10 | ||||
-rw-r--r-- | src/burn/engine/elevation.h | 1 | ||||
-rw-r--r-- | src/burn/engine/plan.cpp | 26 | ||||
-rw-r--r-- | src/burn/engine/plan.h | 2 | ||||
-rw-r--r-- | src/burn/engine/registration.cpp | 61 | ||||
-rw-r--r-- | src/burn/engine/registration.h | 1 |
7 files changed, 86 insertions, 58 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( |
diff --git a/src/burn/engine/elevation.cpp b/src/burn/engine/elevation.cpp index 56a62955..3305cf62 100644 --- a/src/burn/engine/elevation.cpp +++ b/src/burn/engine/elevation.cpp | |||
@@ -636,6 +636,7 @@ extern "C" HRESULT ElevationSessionEnd( | |||
636 | __in BURN_RESUME_MODE resumeMode, | 636 | __in BURN_RESUME_MODE resumeMode, |
637 | __in BOOTSTRAPPER_APPLY_RESTART restart, | 637 | __in BOOTSTRAPPER_APPLY_RESTART restart, |
638 | __in BOOL fDetectedForeignProviderKeyBundleId, | 638 | __in BOOL fDetectedForeignProviderKeyBundleId, |
639 | __in DWORD64 qwEstimatedSize, | ||
639 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType | 640 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType |
640 | ) | 641 | ) |
641 | { | 642 | { |
@@ -654,6 +655,9 @@ extern "C" HRESULT ElevationSessionEnd( | |||
654 | hr = BuffWriteNumber(&pbData, &cbData, (DWORD)fDetectedForeignProviderKeyBundleId); | 655 | hr = BuffWriteNumber(&pbData, &cbData, (DWORD)fDetectedForeignProviderKeyBundleId); |
655 | ExitOnFailure(hr, "Failed to write dependency registration action to message buffer."); | 656 | ExitOnFailure(hr, "Failed to write dependency registration action to message buffer."); |
656 | 657 | ||
658 | hr = BuffWriteNumber64(&pbData, &cbData, qwEstimatedSize); | ||
659 | ExitOnFailure(hr, "Failed to write estimated size to message buffer."); | ||
660 | |||
657 | hr = BuffWriteNumber(&pbData, &cbData, (DWORD)registrationType); | 661 | hr = BuffWriteNumber(&pbData, &cbData, (DWORD)registrationType); |
658 | ExitOnFailure(hr, "Failed to write registration type to message buffer."); | 662 | ExitOnFailure(hr, "Failed to write registration type to message buffer."); |
659 | 663 | ||
@@ -2580,6 +2584,7 @@ static HRESULT OnSessionEnd( | |||
2580 | SIZE_T iData = 0; | 2584 | SIZE_T iData = 0; |
2581 | DWORD dwResumeMode = 0; | 2585 | DWORD dwResumeMode = 0; |
2582 | DWORD dwRestart = 0; | 2586 | DWORD dwRestart = 0; |
2587 | DWORD64 qwEstimatedSize = 0; | ||
2583 | DWORD dwRegistrationType = 0; | 2588 | DWORD dwRegistrationType = 0; |
2584 | 2589 | ||
2585 | // Deserialize message data. | 2590 | // Deserialize message data. |
@@ -2592,11 +2597,14 @@ static HRESULT OnSessionEnd( | |||
2592 | hr = BuffReadNumber(pbData, cbData, &iData, (DWORD*)&pRegistration->fDetectedForeignProviderKeyBundleId); | 2597 | hr = BuffReadNumber(pbData, cbData, &iData, (DWORD*)&pRegistration->fDetectedForeignProviderKeyBundleId); |
2593 | ExitOnFailure(hr, "Failed to read dependency registration action."); | 2598 | ExitOnFailure(hr, "Failed to read dependency registration action."); |
2594 | 2599 | ||
2600 | hr = BuffReadNumber64(pbData, cbData, &iData, &qwEstimatedSize); | ||
2601 | ExitOnFailure(hr, "Failed to read estimated size."); | ||
2602 | |||
2595 | hr = BuffReadNumber(pbData, cbData, &iData, &dwRegistrationType); | 2603 | hr = BuffReadNumber(pbData, cbData, &iData, &dwRegistrationType); |
2596 | ExitOnFailure(hr, "Failed to read dependency registration action."); | 2604 | ExitOnFailure(hr, "Failed to read dependency registration action."); |
2597 | 2605 | ||
2598 | // suspend session in per-machine process | 2606 | // suspend session in per-machine process |
2599 | hr = RegistrationSessionEnd(pRegistration, pCache, pVariables, pPackages, (BURN_RESUME_MODE)dwResumeMode, (BOOTSTRAPPER_APPLY_RESTART)dwRestart, (BOOTSTRAPPER_REGISTRATION_TYPE)dwRegistrationType); | 2607 | hr = RegistrationSessionEnd(pRegistration, pCache, pVariables, pPackages, (BURN_RESUME_MODE)dwResumeMode, (BOOTSTRAPPER_APPLY_RESTART)dwRestart, qwEstimatedSize, (BOOTSTRAPPER_REGISTRATION_TYPE)dwRegistrationType); |
2600 | ExitOnFailure(hr, "Failed to suspend registration session."); | 2608 | ExitOnFailure(hr, "Failed to suspend registration session."); |
2601 | 2609 | ||
2602 | LExit: | 2610 | LExit: |
diff --git a/src/burn/engine/elevation.h b/src/burn/engine/elevation.h index 3484057e..a74b6027 100644 --- a/src/burn/engine/elevation.h +++ b/src/burn/engine/elevation.h | |||
@@ -44,6 +44,7 @@ HRESULT ElevationSessionEnd( | |||
44 | __in BURN_RESUME_MODE resumeMode, | 44 | __in BURN_RESUME_MODE resumeMode, |
45 | __in BOOTSTRAPPER_APPLY_RESTART restart, | 45 | __in BOOTSTRAPPER_APPLY_RESTART restart, |
46 | __in BOOL fDetectedForeignProviderKeyBundleId, | 46 | __in BOOL fDetectedForeignProviderKeyBundleId, |
47 | __in DWORD64 qwEstimatedSize, | ||
47 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType | 48 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType |
48 | ); | 49 | ); |
49 | HRESULT ElevationSaveState( | 50 | HRESULT ElevationSaveState( |
diff --git a/src/burn/engine/plan.cpp b/src/burn/engine/plan.cpp index 47da22c0..68c1d2ba 100644 --- a/src/burn/engine/plan.cpp +++ b/src/burn/engine/plan.cpp | |||
@@ -1178,31 +1178,6 @@ extern "C" HRESULT PlanExecutePackage( | |||
1178 | pPackage->rollback = BOOTSTRAPPER_ACTION_STATE_NONE; | 1178 | pPackage->rollback = BOOTSTRAPPER_ACTION_STATE_NONE; |
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | // Add the cache and install size to estimated size if it will be on the machine at the end of the install | ||
1182 | if (BOOTSTRAPPER_REQUEST_STATE_PRESENT == pPackage->requested || | ||
1183 | fRequestedCache || | ||
1184 | (BOOTSTRAPPER_PACKAGE_STATE_PRESENT == pPackage->currentState && BOOTSTRAPPER_REQUEST_STATE_ABSENT < pPackage->requested) | ||
1185 | ) | ||
1186 | { | ||
1187 | // If the package will remain in the cache, add the package size to the estimated size | ||
1188 | if (BOOTSTRAPPER_CACHE_TYPE_REMOVE < pPackage->cacheType) | ||
1189 | { | ||
1190 | pPlan->qwEstimatedSize += pPackage->qwSize; | ||
1191 | } | ||
1192 | |||
1193 | // If the package will end up installed on the machine, add the install size to the estimated size. | ||
1194 | if (BOOTSTRAPPER_REQUEST_STATE_CACHE < pPackage->requested) | ||
1195 | { | ||
1196 | // MSP packages get cached automatically by windows installer with any embedded cabs, so include that in the size as well | ||
1197 | if (BURN_PACKAGE_TYPE_MSP == pPackage->type) | ||
1198 | { | ||
1199 | pPlan->qwEstimatedSize += pPackage->qwSize; | ||
1200 | } | ||
1201 | |||
1202 | pPlan->qwEstimatedSize += pPackage->qwInstallSize; | ||
1203 | } | ||
1204 | } | ||
1205 | |||
1206 | // Add execute actions. | 1181 | // Add execute actions. |
1207 | switch (pPackage->type) | 1182 | switch (pPackage->type) |
1208 | { | 1183 | { |
@@ -3079,7 +3054,6 @@ extern "C" void PlanDump( | |||
3079 | LogStringLine(PlanDumpLevel, " disallow-removal: %hs", LoggingTrueFalseToString(pPlan->fDisallowRemoval)); | 3054 | LogStringLine(PlanDumpLevel, " disallow-removal: %hs", LoggingTrueFalseToString(pPlan->fDisallowRemoval)); |
3080 | LogStringLine(PlanDumpLevel, " downgrade: %hs", LoggingTrueFalseToString(pPlan->fDowngrade)); | 3055 | LogStringLine(PlanDumpLevel, " downgrade: %hs", LoggingTrueFalseToString(pPlan->fDowngrade)); |
3081 | LogStringLine(PlanDumpLevel, " registration options: %hs", LoggingRegistrationOptionsToString(pPlan->dwRegistrationOperations)); | 3056 | LogStringLine(PlanDumpLevel, " registration options: %hs", LoggingRegistrationOptionsToString(pPlan->dwRegistrationOperations)); |
3082 | LogStringLine(PlanDumpLevel, " estimated size: %llu", pPlan->qwEstimatedSize); | ||
3083 | if (pPlan->sczLayoutDirectory) | 3057 | if (pPlan->sczLayoutDirectory) |
3084 | { | 3058 | { |
3085 | LogStringLine(PlanDumpLevel, " layout directory: %ls", pPlan->sczLayoutDirectory); | 3059 | LogStringLine(PlanDumpLevel, " layout directory: %ls", pPlan->sczLayoutDirectory); |
diff --git a/src/burn/engine/plan.h b/src/burn/engine/plan.h index fbb7a5a1..2b04e097 100644 --- a/src/burn/engine/plan.h +++ b/src/burn/engine/plan.h | |||
@@ -267,8 +267,6 @@ typedef struct _BURN_PLAN | |||
267 | 267 | ||
268 | DWORD64 qwCacheSizeTotal; | 268 | DWORD64 qwCacheSizeTotal; |
269 | 269 | ||
270 | DWORD64 qwEstimatedSize; | ||
271 | |||
272 | DWORD cExecutePackagesTotal; | 270 | DWORD cExecutePackagesTotal; |
273 | DWORD cOverallProgressTicksTotal; | 271 | DWORD cOverallProgressTicksTotal; |
274 | 272 | ||
diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp index 0ffbc89e..9953be83 100644 --- a/src/burn/engine/registration.cpp +++ b/src/burn/engine/registration.cpp | |||
@@ -102,6 +102,10 @@ static HRESULT UpdateBundleNameRegistration( | |||
102 | __in HKEY hkRegistration, | 102 | __in HKEY hkRegistration, |
103 | __in BOOL fInProgressRegistration | 103 | __in BOOL fInProgressRegistration |
104 | ); | 104 | ); |
105 | static HRESULT UpdateEstimatedSize( | ||
106 | __in HKEY hkRegistration, | ||
107 | __in DWORD64 qwEstimatedSize | ||
108 | ); | ||
105 | static BOOL IsWuRebootPending(); | 109 | static BOOL IsWuRebootPending(); |
106 | static BOOL IsRegistryRebootPending(); | 110 | static BOOL IsRegistryRebootPending(); |
107 | 111 | ||
@@ -600,8 +604,8 @@ extern "C" HRESULT RegistrationSessionBegin( | |||
600 | ) | 604 | ) |
601 | { | 605 | { |
602 | HRESULT hr = S_OK; | 606 | HRESULT hr = S_OK; |
603 | DWORD dwSize = 0; | ||
604 | HKEY hkRegistration = NULL; | 607 | HKEY hkRegistration = NULL; |
608 | BOOL fCreated = FALSE; | ||
605 | LPWSTR sczPublisher = NULL; | 609 | LPWSTR sczPublisher = NULL; |
606 | 610 | ||
607 | AssertSz(BOOTSTRAPPER_REGISTRATION_TYPE_NONE != registrationType, "Registration type can't be NONE"); | 611 | AssertSz(BOOTSTRAPPER_REGISTRATION_TYPE_NONE != registrationType, "Registration type can't be NONE"); |
@@ -620,7 +624,7 @@ extern "C" HRESULT RegistrationSessionBegin( | |||
620 | } | 624 | } |
621 | 625 | ||
622 | // create registration key | 626 | // create registration key |
623 | hr = RegCreate(pRegistration->hkRoot, pRegistration->sczRegistrationKey, KEY_WRITE, &hkRegistration); | 627 | hr = RegCreateEx(pRegistration->hkRoot, pRegistration->sczRegistrationKey, KEY_WRITE, REG_KEY_DEFAULT, FALSE, NULL, &hkRegistration, &fCreated); |
624 | ExitOnFailure(hr, "Failed to create registration key."); | 628 | ExitOnFailure(hr, "Failed to create registration key."); |
625 | 629 | ||
626 | // Write any ARP values and software tags. | 630 | // Write any ARP values and software tags. |
@@ -797,22 +801,12 @@ extern "C" HRESULT RegistrationSessionBegin( | |||
797 | ExitOnFailure(hr, "Failed to write update registration."); | 801 | ExitOnFailure(hr, "Failed to write update registration."); |
798 | } | 802 | } |
799 | 803 | ||
800 | // Update estimated size. | 804 | // Only set estimated size here for the first time. |
801 | qwEstimatedSize /= 1024; // Convert bytes to KB | 805 | // It will always get updated at the end of the session. |
802 | if (0 < qwEstimatedSize) | 806 | if (fCreated) |
803 | { | 807 | { |
804 | if (DWORD_MAX < qwEstimatedSize) | 808 | hr = UpdateEstimatedSize(hkRegistration, qwEstimatedSize); |
805 | { | 809 | ExitOnFailure(hr, "Failed to update estimated size."); |
806 | // ARP doesn't support QWORDs here | ||
807 | dwSize = DWORD_MAX; | ||
808 | } | ||
809 | else | ||
810 | { | ||
811 | dwSize = static_cast<DWORD>(qwEstimatedSize); | ||
812 | } | ||
813 | |||
814 | hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_ESTIMATED_SIZE, dwSize); | ||
815 | ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_ESTIMATED_SIZE); | ||
816 | } | 810 | } |
817 | 811 | ||
818 | // Register the bundle dependency key. | 812 | // Register the bundle dependency key. |
@@ -879,6 +873,7 @@ extern "C" HRESULT RegistrationSessionEnd( | |||
879 | __in BURN_PACKAGES* pPackages, | 873 | __in BURN_PACKAGES* pPackages, |
880 | __in BURN_RESUME_MODE resumeMode, | 874 | __in BURN_RESUME_MODE resumeMode, |
881 | __in BOOTSTRAPPER_APPLY_RESTART restart, | 875 | __in BOOTSTRAPPER_APPLY_RESTART restart, |
876 | __in DWORD64 qwEstimatedSize, | ||
882 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType | 877 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType |
883 | ) | 878 | ) |
884 | { | 879 | { |
@@ -921,6 +916,9 @@ extern "C" HRESULT RegistrationSessionEnd( | |||
921 | // update display name | 916 | // update display name |
922 | hr = UpdateBundleNameRegistration(pRegistration, pVariables, hkRegistration, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS == registrationType); | 917 | hr = UpdateBundleNameRegistration(pRegistration, pVariables, hkRegistration, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS == registrationType); |
923 | ExitOnFailure(hr, "Failed to update name and publisher."); | 918 | ExitOnFailure(hr, "Failed to update name and publisher."); |
919 | |||
920 | hr = UpdateEstimatedSize(hkRegistration, qwEstimatedSize); | ||
921 | ExitOnFailure(hr, "Failed to update estimated size."); | ||
924 | } | 922 | } |
925 | 923 | ||
926 | // Update resume mode. | 924 | // Update resume mode. |
@@ -1604,6 +1602,35 @@ LExit: | |||
1604 | return hr; | 1602 | return hr; |
1605 | } | 1603 | } |
1606 | 1604 | ||
1605 | static HRESULT UpdateEstimatedSize( | ||
1606 | __in HKEY hkRegistration, | ||
1607 | __in DWORD64 qwEstimatedSize | ||
1608 | ) | ||
1609 | { | ||
1610 | HRESULT hr = S_OK; | ||
1611 | DWORD dwSize = 0; | ||
1612 | |||
1613 | qwEstimatedSize /= 1024; // Convert bytes to KB | ||
1614 | if (0 < qwEstimatedSize) | ||
1615 | { | ||
1616 | if (DWORD_MAX < qwEstimatedSize) | ||
1617 | { | ||
1618 | // ARP doesn't support QWORDs here | ||
1619 | dwSize = DWORD_MAX; | ||
1620 | } | ||
1621 | else | ||
1622 | { | ||
1623 | dwSize = static_cast<DWORD>(qwEstimatedSize); | ||
1624 | } | ||
1625 | |||
1626 | hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_ESTIMATED_SIZE, dwSize); | ||
1627 | ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_ESTIMATED_SIZE); | ||
1628 | } | ||
1629 | |||
1630 | LExit: | ||
1631 | return hr; | ||
1632 | } | ||
1633 | |||
1607 | static BOOL IsWuRebootPending() | 1634 | static BOOL IsWuRebootPending() |
1608 | { | 1635 | { |
1609 | HRESULT hr = S_OK; | 1636 | HRESULT hr = S_OK; |
diff --git a/src/burn/engine/registration.h b/src/burn/engine/registration.h index c07be962..cb5349a3 100644 --- a/src/burn/engine/registration.h +++ b/src/burn/engine/registration.h | |||
@@ -213,6 +213,7 @@ HRESULT RegistrationSessionEnd( | |||
213 | __in BURN_PACKAGES* pPackages, | 213 | __in BURN_PACKAGES* pPackages, |
214 | __in BURN_RESUME_MODE resumeMode, | 214 | __in BURN_RESUME_MODE resumeMode, |
215 | __in BOOTSTRAPPER_APPLY_RESTART restart, | 215 | __in BOOTSTRAPPER_APPLY_RESTART restart, |
216 | __in DWORD64 qwEstimatedSize, | ||
216 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType | 217 | __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType |
217 | ); | 218 | ); |
218 | HRESULT RegistrationSaveState( | 219 | HRESULT RegistrationSaveState( |