diff options
author | Nir Bar <nir.bar@panel-sw.co.il> | 2021-03-17 14:45:03 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-03-17 14:49:24 -0500 |
commit | b7582318f6cb6e166f5ca22128caea2a97551a1f (patch) | |
tree | f92071000dd33376e6b982b52ed2172278ef4035 /src/engine/msiengine.cpp | |
parent | af68033509730ffe01602f839861a47287bb709f (diff) | |
download | wix-b7582318f6cb6e166f5ca22128caea2a97551a1f.tar.gz wix-b7582318f6cb6e166f5ca22128caea2a97551a1f.tar.bz2 wix-b7582318f6cb6e166f5ca22128caea2a97551a1f.zip |
Use wiutil to start/end msi transactions
Release MSI transaction handles immediately
contributes to #5386
Diffstat (limited to 'src/engine/msiengine.cpp')
-rw-r--r-- | src/engine/msiengine.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/engine/msiengine.cpp b/src/engine/msiengine.cpp index f0aa784e..6c5b760b 100644 --- a/src/engine/msiengine.cpp +++ b/src/engine/msiengine.cpp | |||
@@ -1016,40 +1016,41 @@ LExit: | |||
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | extern "C" HRESULT MsiEngineBeginTransaction( | 1018 | extern "C" HRESULT MsiEngineBeginTransaction( |
1019 | __in LPCWSTR wzName | 1019 | __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary |
1020 | ) | 1020 | ) |
1021 | { | 1021 | { |
1022 | HRESULT hr = S_OK; | 1022 | HRESULT hr = S_OK; |
1023 | UINT uResult = ERROR_SUCCESS; | ||
1024 | MSIHANDLE hTransactionHandle = NULL; | 1023 | MSIHANDLE hTransactionHandle = NULL; |
1025 | HANDLE hChangeOfOwnerEvent = NULL; | 1024 | HANDLE hChangeOfOwnerEvent = NULL; |
1026 | 1025 | ||
1027 | LogId(REPORT_STANDARD, MSG_MSI_TRANSACTION_BEGIN, wzName); | 1026 | LogId(REPORT_STANDARD, MSG_MSI_TRANSACTION_BEGIN, pRollbackBoundary->sczId); |
1028 | 1027 | ||
1029 | uResult = ::MsiBeginTransaction(wzName, 0, &hTransactionHandle, &hChangeOfOwnerEvent); | 1028 | hr = WiuBeginTransaction(pRollbackBoundary->sczId, 0, &hTransactionHandle, &hChangeOfOwnerEvent, WIU_LOG_DEFAULT | INSTALLLOGMODE_VERBOSE, pRollbackBoundary->sczLogPath); |
1030 | 1029 | ||
1031 | if (ERROR_ROLLBACK_DISABLED == uResult) | 1030 | if (HRESULT_FROM_WIN32(ERROR_ROLLBACK_DISABLED) == hr) |
1032 | { | 1031 | { |
1033 | LogId(REPORT_ERROR, MSG_MSI_TRANSACTIONS_DISABLED); | 1032 | LogId(REPORT_ERROR, MSG_MSI_TRANSACTIONS_DISABLED); |
1034 | } | 1033 | } |
1035 | 1034 | ||
1036 | ExitOnWin32Error(uResult, hr, "Failed to begin an MSI transaction"); | 1035 | ExitOnFailure(hr, "Failed to begin an MSI transaction"); |
1037 | 1036 | ||
1038 | LExit: | 1037 | LExit: |
1038 | ReleaseMsi(hTransactionHandle); | ||
1039 | ReleaseHandle(hChangeOfOwnerEvent); | ||
1040 | |||
1039 | return hr; | 1041 | return hr; |
1040 | } | 1042 | } |
1041 | 1043 | ||
1042 | extern "C" HRESULT MsiEngineCommitTransaction( | 1044 | extern "C" HRESULT MsiEngineCommitTransaction( |
1043 | __in LPCWSTR wzName | 1045 | __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary |
1044 | ) | 1046 | ) |
1045 | { | 1047 | { |
1046 | HRESULT hr = S_OK; | 1048 | HRESULT hr = S_OK; |
1047 | UINT uResult = ERROR_SUCCESS; | ||
1048 | 1049 | ||
1049 | LogId(REPORT_STANDARD, MSG_MSI_TRANSACTION_COMMIT, wzName); | 1050 | LogId(REPORT_STANDARD, MSG_MSI_TRANSACTION_COMMIT, pRollbackBoundary->sczId); |
1050 | 1051 | ||
1051 | uResult = ::MsiEndTransaction(MSITRANSACTIONSTATE_COMMIT); | 1052 | hr = WiuEndTransaction(MSITRANSACTIONSTATE_COMMIT, WIU_LOG_DEFAULT | INSTALLLOGMODE_VERBOSE, pRollbackBoundary->sczLogPath); |
1052 | ExitOnWin32Error(uResult, hr, "Failed to commit the MSI transaction"); | 1053 | ExitOnFailure(hr, "Failed to commit the MSI transaction"); |
1053 | 1054 | ||
1054 | LExit: | 1055 | LExit: |
1055 | 1056 | ||
@@ -1057,16 +1058,15 @@ LExit: | |||
1057 | } | 1058 | } |
1058 | 1059 | ||
1059 | extern "C" HRESULT MsiEngineRollbackTransaction( | 1060 | extern "C" HRESULT MsiEngineRollbackTransaction( |
1060 | __in LPCWSTR wzName | 1061 | __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary |
1061 | ) | 1062 | ) |
1062 | { | 1063 | { |
1063 | HRESULT hr = S_OK; | 1064 | HRESULT hr = S_OK; |
1064 | UINT uResult = ERROR_SUCCESS; | ||
1065 | 1065 | ||
1066 | LogId(REPORT_WARNING, MSG_MSI_TRANSACTION_ROLLBACK, wzName); | 1066 | LogId(REPORT_WARNING, MSG_MSI_TRANSACTION_ROLLBACK, pRollbackBoundary->sczId); |
1067 | 1067 | ||
1068 | uResult = ::MsiEndTransaction(MSITRANSACTIONSTATE_ROLLBACK); | 1068 | hr = WiuEndTransaction(MSITRANSACTIONSTATE_ROLLBACK, WIU_LOG_DEFAULT | INSTALLLOGMODE_VERBOSE, pRollbackBoundary->sczLogPath); |
1069 | ExitOnWin32Error(uResult, hr, "Failed to rollback the MSI transaction"); | 1069 | ExitOnFailure(hr, "Failed to rollback the MSI transaction"); |
1070 | 1070 | ||
1071 | LExit: | 1071 | LExit: |
1072 | 1072 | ||