diff options
author | Rob Mensching <rob@firegiant.com> | 2021-04-13 00:09:00 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2021-04-14 12:15:52 -0700 |
commit | 6f7bb97daa1ae6bf2486b1c566c29e1b524b7548 (patch) | |
tree | 352197acd357fc135d9cbe018f95cdb9d2c05aaa | |
parent | 70adfc49cb05da4e7b9eb50a0c47635d2d20b366 (diff) | |
download | wix-6f7bb97daa1ae6bf2486b1c566c29e1b524b7548.tar.gz wix-6f7bb97daa1ae6bf2486b1c566c29e1b524b7548.tar.bz2 wix-6f7bb97daa1ae6bf2486b1c566c29e1b524b7548.zip |
Add MEND request state to repair any missing files in MSI packages
-rw-r--r-- | src/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h | 2 | ||||
-rw-r--r-- | src/engine/dependency.cpp | 2 | ||||
-rw-r--r-- | src/engine/logging.cpp | 4 | ||||
-rw-r--r-- | src/engine/msiengine.cpp | 21 |
4 files changed, 23 insertions, 6 deletions
diff --git a/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h b/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h index c0e4ded1..99e9b9f0 100644 --- a/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h +++ b/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h | |||
@@ -37,6 +37,7 @@ enum BOOTSTRAPPER_ACTION_STATE | |||
37 | BOOTSTRAPPER_ACTION_STATE_UNINSTALL, | 37 | BOOTSTRAPPER_ACTION_STATE_UNINSTALL, |
38 | BOOTSTRAPPER_ACTION_STATE_INSTALL, | 38 | BOOTSTRAPPER_ACTION_STATE_INSTALL, |
39 | BOOTSTRAPPER_ACTION_STATE_MODIFY, | 39 | BOOTSTRAPPER_ACTION_STATE_MODIFY, |
40 | BOOTSTRAPPER_ACTION_STATE_MEND, | ||
40 | BOOTSTRAPPER_ACTION_STATE_REPAIR, | 41 | BOOTSTRAPPER_ACTION_STATE_REPAIR, |
41 | BOOTSTRAPPER_ACTION_STATE_MINOR_UPGRADE, | 42 | BOOTSTRAPPER_ACTION_STATE_MINOR_UPGRADE, |
42 | }; | 43 | }; |
@@ -58,6 +59,7 @@ enum BOOTSTRAPPER_REQUEST_STATE | |||
58 | BOOTSTRAPPER_REQUEST_STATE_ABSENT, | 59 | BOOTSTRAPPER_REQUEST_STATE_ABSENT, |
59 | BOOTSTRAPPER_REQUEST_STATE_CACHE, | 60 | BOOTSTRAPPER_REQUEST_STATE_CACHE, |
60 | BOOTSTRAPPER_REQUEST_STATE_PRESENT, | 61 | BOOTSTRAPPER_REQUEST_STATE_PRESENT, |
62 | BOOTSTRAPPER_REQUEST_STATE_MEND, | ||
61 | BOOTSTRAPPER_REQUEST_STATE_REPAIR, | 63 | BOOTSTRAPPER_REQUEST_STATE_REPAIR, |
62 | }; | 64 | }; |
63 | 65 | ||
diff --git a/src/engine/dependency.cpp b/src/engine/dependency.cpp index 1bd0c7d4..c4af207a 100644 --- a/src/engine/dependency.cpp +++ b/src/engine/dependency.cpp | |||
@@ -1025,6 +1025,7 @@ static void CalculateDependencyActionStates( | |||
1025 | } | 1025 | } |
1026 | break; | 1026 | break; |
1027 | case BOOTSTRAPPER_REQUEST_STATE_PRESENT: __fallthrough; | 1027 | case BOOTSTRAPPER_REQUEST_STATE_PRESENT: __fallthrough; |
1028 | case BOOTSTRAPPER_REQUEST_STATE_MEND: __fallthrough; | ||
1028 | case BOOTSTRAPPER_REQUEST_STATE_REPAIR: | 1029 | case BOOTSTRAPPER_REQUEST_STATE_REPAIR: |
1029 | // Register if the package is requested but already installed. | 1030 | // Register if the package is requested but already installed. |
1030 | switch (pPackage->currentState) | 1031 | switch (pPackage->currentState) |
@@ -1048,6 +1049,7 @@ static void CalculateDependencyActionStates( | |||
1048 | break; | 1049 | break; |
1049 | case BOOTSTRAPPER_ACTION_STATE_INSTALL: __fallthrough; | 1050 | case BOOTSTRAPPER_ACTION_STATE_INSTALL: __fallthrough; |
1050 | case BOOTSTRAPPER_ACTION_STATE_MODIFY: __fallthrough; | 1051 | case BOOTSTRAPPER_ACTION_STATE_MODIFY: __fallthrough; |
1052 | case BOOTSTRAPPER_ACTION_STATE_MEND: __fallthrough; | ||
1051 | case BOOTSTRAPPER_ACTION_STATE_REPAIR: __fallthrough; | 1053 | case BOOTSTRAPPER_ACTION_STATE_REPAIR: __fallthrough; |
1052 | case BOOTSTRAPPER_ACTION_STATE_MINOR_UPGRADE: __fallthrough; | 1054 | case BOOTSTRAPPER_ACTION_STATE_MINOR_UPGRADE: __fallthrough; |
1053 | *pDependencyExecuteAction = BURN_DEPENDENCY_ACTION_REGISTER; | 1055 | *pDependencyExecuteAction = BURN_DEPENDENCY_ACTION_REGISTER; |
diff --git a/src/engine/logging.cpp b/src/engine/logging.cpp index d66f7cf5..67f39c85 100644 --- a/src/engine/logging.cpp +++ b/src/engine/logging.cpp | |||
@@ -326,6 +326,8 @@ extern "C" LPCSTR LoggingActionStateToString( | |||
326 | return "Install"; | 326 | return "Install"; |
327 | case BOOTSTRAPPER_ACTION_STATE_MODIFY: | 327 | case BOOTSTRAPPER_ACTION_STATE_MODIFY: |
328 | return "Modify"; | 328 | return "Modify"; |
329 | case BOOTSTRAPPER_ACTION_STATE_MEND: | ||
330 | return "Mend"; | ||
329 | case BOOTSTRAPPER_ACTION_STATE_REPAIR: | 331 | case BOOTSTRAPPER_ACTION_STATE_REPAIR: |
330 | return "Repair"; | 332 | return "Repair"; |
331 | case BOOTSTRAPPER_ACTION_STATE_MINOR_UPGRADE: | 333 | case BOOTSTRAPPER_ACTION_STATE_MINOR_UPGRADE: |
@@ -665,6 +667,8 @@ extern "C" LPCSTR LoggingRequestStateToString( | |||
665 | return "Cache"; | 667 | return "Cache"; |
666 | case BOOTSTRAPPER_REQUEST_STATE_PRESENT: | 668 | case BOOTSTRAPPER_REQUEST_STATE_PRESENT: |
667 | return "Present"; | 669 | return "Present"; |
670 | case BOOTSTRAPPER_REQUEST_STATE_MEND: | ||
671 | return "Mend"; | ||
668 | case BOOTSTRAPPER_REQUEST_STATE_REPAIR: | 672 | case BOOTSTRAPPER_REQUEST_STATE_REPAIR: |
669 | return "Repair"; | 673 | return "Repair"; |
670 | default: | 674 | default: |
diff --git a/src/engine/msiengine.cpp b/src/engine/msiengine.cpp index 4f6062ea..269fc831 100644 --- a/src/engine/msiengine.cpp +++ b/src/engine/msiengine.cpp | |||
@@ -789,7 +789,7 @@ extern "C" HRESULT MsiEnginePlanCalculatePackage( | |||
789 | { | 789 | { |
790 | case BOOTSTRAPPER_PACKAGE_STATE_PRESENT: __fallthrough; | 790 | case BOOTSTRAPPER_PACKAGE_STATE_PRESENT: __fallthrough; |
791 | case BOOTSTRAPPER_PACKAGE_STATE_SUPERSEDED: | 791 | case BOOTSTRAPPER_PACKAGE_STATE_SUPERSEDED: |
792 | if (BOOTSTRAPPER_REQUEST_STATE_PRESENT == pPackage->requested || BOOTSTRAPPER_REQUEST_STATE_REPAIR == pPackage->requested) | 792 | if (BOOTSTRAPPER_REQUEST_STATE_PRESENT == pPackage->requested || BOOTSTRAPPER_REQUEST_STATE_MEND == pPackage->requested || BOOTSTRAPPER_REQUEST_STATE_REPAIR == pPackage->requested) |
793 | { | 793 | { |
794 | hr = VerCompareParsedVersions(pVersion, pInstalledVersion, &nCompareResult); | 794 | hr = VerCompareParsedVersions(pVersion, pInstalledVersion, &nCompareResult); |
795 | ExitOnFailure(hr, "Failed to compare '%ls' to '%ls' for planning.", pVersion->sczVersion, pInstalledVersion->sczVersion); | 795 | ExitOnFailure(hr, "Failed to compare '%ls' to '%ls' for planning.", pVersion->sczVersion, pInstalledVersion->sczVersion); |
@@ -801,6 +801,10 @@ extern "C" HRESULT MsiEnginePlanCalculatePackage( | |||
801 | { | 801 | { |
802 | execute = BOOTSTRAPPER_ACTION_STATE_MINOR_UPGRADE; | 802 | execute = BOOTSTRAPPER_ACTION_STATE_MINOR_UPGRADE; |
803 | } | 803 | } |
804 | else if (BOOTSTRAPPER_REQUEST_STATE_MEND == pPackage->requested) | ||
805 | { | ||
806 | execute = BOOTSTRAPPER_ACTION_STATE_MEND; | ||
807 | } | ||
804 | else if (BOOTSTRAPPER_REQUEST_STATE_REPAIR == pPackage->requested) | 808 | else if (BOOTSTRAPPER_REQUEST_STATE_REPAIR == pPackage->requested) |
805 | { | 809 | { |
806 | execute = BOOTSTRAPPER_ACTION_STATE_REPAIR; | 810 | execute = BOOTSTRAPPER_ACTION_STATE_REPAIR; |
@@ -829,6 +833,7 @@ extern "C" HRESULT MsiEnginePlanCalculatePackage( | |||
829 | switch (pPackage->requested) | 833 | switch (pPackage->requested) |
830 | { | 834 | { |
831 | case BOOTSTRAPPER_REQUEST_STATE_PRESENT: __fallthrough; | 835 | case BOOTSTRAPPER_REQUEST_STATE_PRESENT: __fallthrough; |
836 | case BOOTSTRAPPER_REQUEST_STATE_MEND: __fallthrough; | ||
832 | case BOOTSTRAPPER_REQUEST_STATE_REPAIR: | 837 | case BOOTSTRAPPER_REQUEST_STATE_REPAIR: |
833 | execute = BOOTSTRAPPER_ACTION_STATE_INSTALL; | 838 | execute = BOOTSTRAPPER_ACTION_STATE_INSTALL; |
834 | break; | 839 | break; |
@@ -844,6 +849,7 @@ extern "C" HRESULT MsiEnginePlanCalculatePackage( | |||
844 | switch (pPackage->requested) | 849 | switch (pPackage->requested) |
845 | { | 850 | { |
846 | case BOOTSTRAPPER_REQUEST_STATE_PRESENT: __fallthrough; | 851 | case BOOTSTRAPPER_REQUEST_STATE_PRESENT: __fallthrough; |
852 | case BOOTSTRAPPER_REQUEST_STATE_MEND: __fallthrough; | ||
847 | case BOOTSTRAPPER_REQUEST_STATE_REPAIR: | 853 | case BOOTSTRAPPER_REQUEST_STATE_REPAIR: |
848 | execute = BOOTSTRAPPER_ACTION_STATE_INSTALL; | 854 | execute = BOOTSTRAPPER_ACTION_STATE_INSTALL; |
849 | break; | 855 | break; |
@@ -887,10 +893,12 @@ extern "C" HRESULT MsiEnginePlanCalculatePackage( | |||
887 | case BOOTSTRAPPER_PACKAGE_STATE_OBSOLETE: __fallthrough; | 893 | case BOOTSTRAPPER_PACKAGE_STATE_OBSOLETE: __fallthrough; |
888 | case BOOTSTRAPPER_PACKAGE_STATE_ABSENT: __fallthrough; | 894 | case BOOTSTRAPPER_PACKAGE_STATE_ABSENT: __fallthrough; |
889 | case BOOTSTRAPPER_PACKAGE_STATE_CACHED: | 895 | case BOOTSTRAPPER_PACKAGE_STATE_CACHED: |
890 | // If we requested to put the package on the machine then remove the package during rollback | 896 | // If the package is uninstallable and we requested to put the package on the machine then |
891 | // if the package is uninstallable. | 897 | // remove the package during rollback. |
892 | if ((BOOTSTRAPPER_REQUEST_STATE_PRESENT == pPackage->requested || BOOTSTRAPPER_REQUEST_STATE_REPAIR == pPackage->requested) && | 898 | if (pPackage->fUninstallable && |
893 | pPackage->fUninstallable) | 899 | (BOOTSTRAPPER_REQUEST_STATE_PRESENT == pPackage->requested || |
900 | BOOTSTRAPPER_REQUEST_STATE_MEND == pPackage->requested || | ||
901 | BOOTSTRAPPER_REQUEST_STATE_REPAIR == pPackage->requested)) | ||
894 | { | 902 | { |
895 | rollback = BOOTSTRAPPER_ACTION_STATE_UNINSTALL; | 903 | rollback = BOOTSTRAPPER_ACTION_STATE_UNINSTALL; |
896 | } | 904 | } |
@@ -1228,11 +1236,12 @@ extern "C" HRESULT MsiEngineExecutePackage( | |||
1228 | break; | 1236 | break; |
1229 | 1237 | ||
1230 | case BOOTSTRAPPER_ACTION_STATE_MODIFY: __fallthrough; | 1238 | case BOOTSTRAPPER_ACTION_STATE_MODIFY: __fallthrough; |
1239 | case BOOTSTRAPPER_ACTION_STATE_MEND: __fallthrough; | ||
1231 | case BOOTSTRAPPER_ACTION_STATE_REPAIR: | 1240 | case BOOTSTRAPPER_ACTION_STATE_REPAIR: |
1232 | { | 1241 | { |
1233 | LPCWSTR wzReinstallAll = (BOOTSTRAPPER_ACTION_STATE_MODIFY == pExecuteAction->msiPackage.action || | 1242 | LPCWSTR wzReinstallAll = (BOOTSTRAPPER_ACTION_STATE_MODIFY == pExecuteAction->msiPackage.action || |
1234 | pExecuteAction->msiPackage.pPackage->Msi.cFeatures) ? L"" : L" REINSTALL=ALL"; | 1243 | pExecuteAction->msiPackage.pPackage->Msi.cFeatures) ? L"" : L" REINSTALL=ALL"; |
1235 | LPCWSTR wzReinstallMode = (BOOTSTRAPPER_ACTION_STATE_MODIFY == pExecuteAction->msiPackage.action) ? L"o" : L"e"; | 1244 | LPCWSTR wzReinstallMode = (BOOTSTRAPPER_ACTION_STATE_MODIFY == pExecuteAction->msiPackage.action || BOOTSTRAPPER_ACTION_STATE_MEND == pExecuteAction->msiPackage.action) ? L"o" : L"e"; |
1236 | 1245 | ||
1237 | hr = StrAllocFormattedSecure(&sczProperties, L"%ls%ls REINSTALLMODE=\"cmus%ls\" REBOOT=ReallySuppress", sczProperties ? sczProperties : L"", wzReinstallAll, wzReinstallMode); | 1246 | hr = StrAllocFormattedSecure(&sczProperties, L"%ls%ls REINSTALLMODE=\"cmus%ls\" REBOOT=ReallySuppress", sczProperties ? sczProperties : L"", wzReinstallAll, wzReinstallMode); |
1238 | ExitOnFailure(hr, "Failed to add reinstall mode and reboot suppression properties on repair."); | 1247 | ExitOnFailure(hr, "Failed to add reinstall mode and reboot suppression properties on repair."); |