diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-11-16 19:05:29 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-11-17 19:06:00 -0600 |
commit | 7d45238e97c35ccea1f77be9065b9a3ed9213bfb (patch) | |
tree | 92a482536f944347ab9be9f1321c400d900e1cc2 /src/engine/elevation.cpp | |
parent | 7a942746bc535d319bdfa7f17025347ac6913ba2 (diff) | |
download | wix-7d45238e97c35ccea1f77be9065b9a3ed9213bfb.tar.gz wix-7d45238e97c35ccea1f77be9065b9a3ed9213bfb.tar.bz2 wix-7d45238e97c35ccea1f77be9065b9a3ed9213bfb.zip |
Add logging and BA messages around MSI transactions.
Diffstat (limited to 'src/engine/elevation.cpp')
-rw-r--r-- | src/engine/elevation.cpp | 70 |
1 files changed, 57 insertions, 13 deletions
diff --git a/src/engine/elevation.cpp b/src/engine/elevation.cpp index 81a48316..1d0e1f1d 100644 --- a/src/engine/elevation.cpp +++ b/src/engine/elevation.cpp | |||
@@ -237,8 +237,14 @@ static HRESULT OnMsiBeginTransaction( | |||
237 | __in BYTE* pbData, | 237 | __in BYTE* pbData, |
238 | __in DWORD cbData | 238 | __in DWORD cbData |
239 | ); | 239 | ); |
240 | static HRESULT OnMsiCommitTransaction(); | 240 | static HRESULT OnMsiCommitTransaction( |
241 | static HRESULT OnMsiRollbackTransaction(); | 241 | __in BYTE* pbData, |
242 | __in DWORD cbData | ||
243 | ); | ||
244 | static HRESULT OnMsiRollbackTransaction( | ||
245 | __in BYTE* pbData, | ||
246 | __in DWORD cbData | ||
247 | ); | ||
242 | 248 | ||
243 | 249 | ||
244 | 250 | ||
@@ -730,7 +736,7 @@ extern "C" HRESULT ElevationMsiBeginTransaction( | |||
730 | hr = BuffWriteString(&pbData, &cbData, wzName); | 736 | hr = BuffWriteString(&pbData, &cbData, wzName); |
731 | ExitOnFailure(hr, "Failed to write transaction name to message buffer."); | 737 | ExitOnFailure(hr, "Failed to write transaction name to message buffer."); |
732 | 738 | ||
733 | hr = PipeSendMessage(hPipe, BURN_ELEVATION_MESSAGE_TYPE_BEGIN_MSI_TRANSACTION, NULL, 0, NULL, NULL, &dwResult); | 739 | hr = PipeSendMessage(hPipe, BURN_ELEVATION_MESSAGE_TYPE_BEGIN_MSI_TRANSACTION, pbData, cbData, NULL, NULL, &dwResult); |
734 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_BEGIN_MSI_TRANSACTION message to per-machine process."); | 740 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_BEGIN_MSI_TRANSACTION message to per-machine process."); |
735 | 741 | ||
736 | hr = static_cast<HRESULT>(dwResult); | 742 | hr = static_cast<HRESULT>(dwResult); |
@@ -742,13 +748,20 @@ LExit: | |||
742 | } | 748 | } |
743 | 749 | ||
744 | extern "C" HRESULT ElevationMsiCommitTransaction( | 750 | extern "C" HRESULT ElevationMsiCommitTransaction( |
745 | __in HANDLE hPipe | 751 | __in HANDLE hPipe, |
752 | __in LPCWSTR wzName | ||
746 | ) | 753 | ) |
747 | { | 754 | { |
748 | HRESULT hr = S_OK; | 755 | HRESULT hr = S_OK; |
756 | BYTE* pbData = NULL; | ||
757 | SIZE_T cbData = 0; | ||
749 | DWORD dwResult = ERROR_SUCCESS; | 758 | DWORD dwResult = ERROR_SUCCESS; |
750 | 759 | ||
751 | hr = PipeSendMessage(hPipe, BURN_ELEVATION_MESSAGE_TYPE_COMMIT_MSI_TRANSACTION, NULL, 0, NULL, NULL, &dwResult); | 760 | // serialize message data |
761 | hr = BuffWriteString(&pbData, &cbData, wzName); | ||
762 | ExitOnFailure(hr, "Failed to write transaction name to message buffer."); | ||
763 | |||
764 | hr = PipeSendMessage(hPipe, BURN_ELEVATION_MESSAGE_TYPE_COMMIT_MSI_TRANSACTION, pbData, cbData, NULL, NULL, &dwResult); | ||
752 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_COMMIT_MSI_TRANSACTION message to per-machine process."); | 765 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_COMMIT_MSI_TRANSACTION message to per-machine process."); |
753 | 766 | ||
754 | hr = static_cast<HRESULT>(dwResult); | 767 | hr = static_cast<HRESULT>(dwResult); |
@@ -758,13 +771,20 @@ LExit: | |||
758 | } | 771 | } |
759 | 772 | ||
760 | extern "C" HRESULT ElevationMsiRollbackTransaction( | 773 | extern "C" HRESULT ElevationMsiRollbackTransaction( |
761 | __in HANDLE hPipe | 774 | __in HANDLE hPipe, |
775 | __in LPCWSTR wzName | ||
762 | ) | 776 | ) |
763 | { | 777 | { |
764 | HRESULT hr = S_OK; | 778 | HRESULT hr = S_OK; |
779 | BYTE* pbData = NULL; | ||
780 | SIZE_T cbData = 0; | ||
765 | DWORD dwResult = ERROR_SUCCESS; | 781 | DWORD dwResult = ERROR_SUCCESS; |
766 | 782 | ||
767 | hr = PipeSendMessage(hPipe, BURN_ELEVATION_MESSAGE_TYPE_ROLLBACK_MSI_TRANSACTION, NULL, 0, NULL, NULL, &dwResult); | 783 | // serialize message data |
784 | hr = BuffWriteString(&pbData, &cbData, wzName); | ||
785 | ExitOnFailure(hr, "Failed to write transaction name to message buffer."); | ||
786 | |||
787 | hr = PipeSendMessage(hPipe, BURN_ELEVATION_MESSAGE_TYPE_ROLLBACK_MSI_TRANSACTION, pbData, cbData, NULL, NULL, &dwResult); | ||
768 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_ROLLBACK_MSI_TRANSACTION message to per-machine process."); | 788 | ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_ROLLBACK_MSI_TRANSACTION message to per-machine process."); |
769 | 789 | ||
770 | hr = static_cast<HRESULT>(dwResult); | 790 | hr = static_cast<HRESULT>(dwResult); |
@@ -1534,11 +1554,11 @@ static HRESULT ProcessElevatedChildMessage( | |||
1534 | break; | 1554 | break; |
1535 | 1555 | ||
1536 | case BURN_ELEVATION_MESSAGE_TYPE_COMMIT_MSI_TRANSACTION: | 1556 | case BURN_ELEVATION_MESSAGE_TYPE_COMMIT_MSI_TRANSACTION: |
1537 | hrResult = OnMsiCommitTransaction(); | 1557 | hrResult = OnMsiCommitTransaction((BYTE*)pMsg->pvData, pMsg->cbData); |
1538 | break; | 1558 | break; |
1539 | 1559 | ||
1540 | case BURN_ELEVATION_MESSAGE_TYPE_ROLLBACK_MSI_TRANSACTION: | 1560 | case BURN_ELEVATION_MESSAGE_TYPE_ROLLBACK_MSI_TRANSACTION: |
1541 | hrResult = OnMsiRollbackTransaction(); | 1561 | hrResult = OnMsiRollbackTransaction((BYTE*)pMsg->pvData, pMsg->cbData); |
1542 | break; | 1562 | break; |
1543 | 1563 | ||
1544 | case BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE: | 1564 | case BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE: |
@@ -2806,20 +2826,44 @@ LExit: | |||
2806 | return hr; | 2826 | return hr; |
2807 | } | 2827 | } |
2808 | 2828 | ||
2809 | static HRESULT OnMsiCommitTransaction() | 2829 | static HRESULT OnMsiCommitTransaction( |
2830 | __in BYTE* pbData, | ||
2831 | __in DWORD cbData | ||
2832 | ) | ||
2810 | { | 2833 | { |
2811 | HRESULT hr = S_OK; | 2834 | HRESULT hr = S_OK; |
2835 | SIZE_T iData = 0; | ||
2836 | LPWSTR sczName = NULL; | ||
2837 | |||
2838 | // Deserialize message data. | ||
2839 | hr = BuffReadString(pbData, cbData, &iData, &sczName); | ||
2840 | ExitOnFailure(hr, "Failed to read transaction name."); | ||
2812 | 2841 | ||
2813 | hr = MsiEngineCommitTransaction(); | 2842 | hr = MsiEngineCommitTransaction(sczName); |
2843 | |||
2844 | LExit: | ||
2845 | ReleaseStr(sczName); | ||
2814 | 2846 | ||
2815 | return hr; | 2847 | return hr; |
2816 | } | 2848 | } |
2817 | 2849 | ||
2818 | static HRESULT OnMsiRollbackTransaction() | 2850 | static HRESULT OnMsiRollbackTransaction( |
2851 | __in BYTE* pbData, | ||
2852 | __in DWORD cbData | ||
2853 | ) | ||
2819 | { | 2854 | { |
2820 | HRESULT hr = S_OK; | 2855 | HRESULT hr = S_OK; |
2856 | SIZE_T iData = 0; | ||
2857 | LPWSTR sczName = NULL; | ||
2858 | |||
2859 | // Deserialize message data. | ||
2860 | hr = BuffReadString(pbData, cbData, &iData, &sczName); | ||
2861 | ExitOnFailure(hr, "Failed to read transaction name."); | ||
2821 | 2862 | ||
2822 | hr = MsiEngineRollbackTransaction(); | 2863 | hr = MsiEngineRollbackTransaction(sczName); |
2864 | |||
2865 | LExit: | ||
2866 | ReleaseStr(sczName); | ||
2823 | 2867 | ||
2824 | return hr; | 2868 | return hr; |
2825 | } | 2869 | } |