Use wiutil to start/end msi transactions Release MSI transaction handles immediately
Use wiutil to start/end msi transactions Release MSI transaction handles immediately contributes to #5386
Nir Bar committed
Mar 17, 2021 at 14:45 UTC
b7582318f6cb6e166f5ca22128caea2a97551a1f
10 files changed
+163
-81
src/engine/apply.cpp
+20
-20
@@ -821,16 +821,16 @@ extern "C" HRESULT ApplyExecute(
821
break;
822
}
823
824
- // If inside a MSI transaction, roll it back.
825
- if (pCheckpoint && pCheckpoint->pActiveRollbackBoundary && pCheckpoint->pActiveRollbackBoundary->fActiveTransaction)
826
- {
827
- hrRollback = ExecuteMsiRollbackTransaction(pEngineState, pCheckpoint->pActiveRollbackBoundary, &context);
828
- IgnoreRollbackError(hrRollback, "Failed rolling back transaction");
829
- }
830
-
831
- // The action failed, roll back to previous rollback boundary.
824
if (pCheckpoint)
825
{
826
+ // If inside a MSI transaction, roll it back.
827
+ if (pCheckpoint->pActiveRollbackBoundary && pCheckpoint->pActiveRollbackBoundary->fActiveTransaction)
828
+ {
829
+ hrRollback = ExecuteMsiRollbackTransaction(pEngineState, pCheckpoint->pActiveRollbackBoundary, &context);
830
+ IgnoreRollbackError(hrRollback, "Failed rolling back transaction");
831
+ }
832
+
833
+ // The action failed, roll back to previous rollback boundary.
834
hrRollback = DoRollbackActions(pEngineState, &context, pCheckpoint->dwId, pRestart);
835
IgnoreRollbackError(hrRollback, "Failed rollback actions");
836
}
@@ -2316,12 +2316,12 @@ static HRESULT ExecuteMsiBeginTransaction(
2316
2317
if (pEngineState->plan.fPerMachine)
2318
{
2319
- hr = ElevationMsiBeginTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary->sczId);
2319
+ hr = ElevationMsiBeginTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary);
2320
ExitOnFailure(hr, "Failed to begin an elevated MSI transaction.");
2321
}
2322
else
2323
{
2324
- hr = MsiEngineBeginTransaction(pRollbackBoundary->sczId);
2324
+ hr = MsiEngineBeginTransaction(pRollbackBoundary);
2325
}
2326
2327
if (SUCCEEDED(hr))
@@ -2347,25 +2347,25 @@ static HRESULT ExecuteMsiCommitTransaction(
2347
)
2348
{
2349
HRESULT hr = S_OK;
2350
- BOOL fBeginCalled = FALSE;
2350
+ BOOL fCommitBeginCalled = FALSE;
2351
2352
if (!pRollbackBoundary->fActiveTransaction)
2353
{
2354
ExitFunction1(hr = E_INVALIDSTATE);
2355
}
2356
2357
- fBeginCalled = TRUE;
2357
+ fCommitBeginCalled = TRUE;
2358
hr = UserExperienceOnCommitMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId);
2359
ExitOnRootFailure(hr, "BA aborted execute commit MSI transaction.");
2360
2361
if (pEngineState->plan.fPerMachine)
2362
{
2363
- hr = ElevationMsiCommitTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary->sczId);
2363
+ hr = ElevationMsiCommitTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary);
2364
ExitOnFailure(hr, "Failed to commit an elevated MSI transaction.");
2365
}
2366
else
2367
{
2368
- hr = MsiEngineCommitTransaction(pRollbackBoundary->sczId);
2368
+ hr = MsiEngineCommitTransaction(pRollbackBoundary);
2369
}
2370
2371
if (SUCCEEDED(hr))
@@ -2376,7 +2376,7 @@ static HRESULT ExecuteMsiCommitTransaction(
2376
}
2377
2378
LExit:
2379
- if (fBeginCalled)
2379
+ if (fCommitBeginCalled)
2380
{
2381
UserExperienceOnCommitMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr);
2382
}
@@ -2391,24 +2391,24 @@ static HRESULT ExecuteMsiRollbackTransaction(
2391
)
2392
{
2393
HRESULT hr = S_OK;
2394
- BOOL fBeginCalled = FALSE;
2394
+ BOOL fRollbackBeginCalled = FALSE;
2395
2396
if (!pRollbackBoundary->fActiveTransaction)
2397
{
2398
ExitFunction();
2399
}
2400
2401
- fBeginCalled = TRUE;
2401
+ fRollbackBeginCalled = TRUE;
2402
UserExperienceOnRollbackMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId);
2403
2404
if (pEngineState->plan.fPerMachine)
2405
{
2406
- hr = ElevationMsiRollbackTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary->sczId);
2406
+ hr = ElevationMsiRollbackTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary);
2407
ExitOnFailure(hr, "Failed to rollback an elevated MSI transaction.");
2408
}
2409
else
2410
{
2411
- hr = MsiEngineRollbackTransaction(pRollbackBoundary->sczId);
2411
+ hr = MsiEngineRollbackTransaction(pRollbackBoundary);
2412
}
2413
2414
LExit:
@@ -2416,7 +2416,7 @@ LExit:
2416
2417
ResetTransactionRegistrationState(pEngineState, FALSE);
2418
2419
- if (fBeginCalled)
2419
+ if (fRollbackBeginCalled)
2420
{
2421
UserExperienceOnRollbackMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr);
2422
}
src/engine/elevation.cpp
+87
-24
@@ -246,14 +246,17 @@ static HRESULT OnLaunchApprovedExe(
246
__in DWORD cbData
247
);
248
static HRESULT OnMsiBeginTransaction(
249
+ __in BURN_PACKAGES* pPackages,
250
__in BYTE* pbData,
251
__in DWORD cbData
252
);
253
static HRESULT OnMsiCommitTransaction(
254
+ __in BURN_PACKAGES* pPackages,
255
__in BYTE* pbData,
256
__in DWORD cbData
257
);
258
static HRESULT OnMsiRollbackTransaction(
259
+ __in BURN_PACKAGES* pPackages,
260
__in BYTE* pbData,
261
__in DWORD cbData
262
);
@@ -763,7 +766,7 @@ LExit:
766
767
extern "C" HRESULT ElevationMsiBeginTransaction(
768
__in HANDLE hPipe,
766
- __in LPCWSTR wzName
769
+ __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
770
)
771
{
772
HRESULT hr = S_OK;
@@ -772,9 +775,12 @@ extern "C" HRESULT ElevationMsiBeginTransaction(
775
DWORD dwResult = ERROR_SUCCESS;
776
777
// serialize message data
775
- hr = BuffWriteString(&pbData, &cbData, wzName);
778
+ hr = BuffWriteString(&pbData, &cbData, pRollbackBoundary->sczId);
779
ExitOnFailure(hr, "Failed to write transaction name to message buffer.");
780
781
+ hr = BuffWriteString(&pbData, &cbData, pRollbackBoundary->sczLogPath);
782
+ ExitOnFailure(hr, "Failed to write transaction log path to message buffer.");
783
+
784
hr = PipeSendMessage(hPipe, BURN_ELEVATION_MESSAGE_TYPE_BEGIN_MSI_TRANSACTION, pbData, cbData, NULL, NULL, &dwResult);
785
ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_BEGIN_MSI_TRANSACTION message to per-machine process.");
786
@@ -788,7 +794,7 @@ LExit:
794
795
extern "C" HRESULT ElevationMsiCommitTransaction(
796
__in HANDLE hPipe,
791
- __in LPCWSTR wzName
797
+ __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
798
)
799
{
800
HRESULT hr = S_OK;
@@ -797,9 +803,12 @@ extern "C" HRESULT ElevationMsiCommitTransaction(
803
DWORD dwResult = ERROR_SUCCESS;
804
805
// serialize message data
800
- hr = BuffWriteString(&pbData, &cbData, wzName);
806
+ hr = BuffWriteString(&pbData, &cbData, pRollbackBoundary->sczId);
807
ExitOnFailure(hr, "Failed to write transaction name to message buffer.");
808
809
+ hr = BuffWriteString(&pbData, &cbData, pRollbackBoundary->sczLogPath);
810
+ ExitOnFailure(hr, "Failed to write transaction log path to message buffer.");
811
+
812
hr = PipeSendMessage(hPipe, BURN_ELEVATION_MESSAGE_TYPE_COMMIT_MSI_TRANSACTION, pbData, cbData, NULL, NULL, &dwResult);
813
ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_COMMIT_MSI_TRANSACTION message to per-machine process.");
814
@@ -811,7 +820,7 @@ LExit:
820
821
extern "C" HRESULT ElevationMsiRollbackTransaction(
822
__in HANDLE hPipe,
814
- __in LPCWSTR wzName
823
+ __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
824
)
825
{
826
HRESULT hr = S_OK;
@@ -820,9 +829,12 @@ extern "C" HRESULT ElevationMsiRollbackTransaction(
829
DWORD dwResult = ERROR_SUCCESS;
830
831
// serialize message data
823
- hr = BuffWriteString(&pbData, &cbData, wzName);
832
+ hr = BuffWriteString(&pbData, &cbData, pRollbackBoundary->sczId);
833
ExitOnFailure(hr, "Failed to write transaction name to message buffer.");
834
835
+ hr = BuffWriteString(&pbData, &cbData, pRollbackBoundary->sczLogPath);
836
+ ExitOnFailure(hr, "Failed to write transaction log path to message buffer.");
837
+
838
hr = PipeSendMessage(hPipe, BURN_ELEVATION_MESSAGE_TYPE_ROLLBACK_MSI_TRANSACTION, pbData, cbData, NULL, NULL, &dwResult);
839
ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_ROLLBACK_MSI_TRANSACTION message to per-machine process.");
840
@@ -1610,15 +1622,15 @@ static HRESULT ProcessElevatedChildMessage(
1622
switch (pMsg->dwMessage)
1623
{
1624
case BURN_ELEVATION_MESSAGE_TYPE_BEGIN_MSI_TRANSACTION:
1613
- hrResult = OnMsiBeginTransaction((BYTE*)pMsg->pvData, pMsg->cbData);
1625
+ hrResult = OnMsiBeginTransaction(pContext->pPackages, (BYTE*)pMsg->pvData, pMsg->cbData);
1626
break;
1627
1628
case BURN_ELEVATION_MESSAGE_TYPE_COMMIT_MSI_TRANSACTION:
1617
- hrResult = OnMsiCommitTransaction((BYTE*)pMsg->pvData, pMsg->cbData);
1629
+ hrResult = OnMsiCommitTransaction(pContext->pPackages, (BYTE*)pMsg->pvData, pMsg->cbData);
1630
break;
1631
1632
case BURN_ELEVATION_MESSAGE_TYPE_ROLLBACK_MSI_TRANSACTION:
1621
- hrResult = OnMsiRollbackTransaction((BYTE*)pMsg->pvData, pMsg->cbData);
1633
+ hrResult = OnMsiRollbackTransaction(pContext->pPackages, (BYTE*)pMsg->pvData, pMsg->cbData);
1634
break;
1635
1636
case BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE:
@@ -2824,64 +2836,115 @@ LExit:
2836
}
2837
2838
static HRESULT OnMsiBeginTransaction(
2839
+ __in BURN_PACKAGES* pPackages,
2840
__in BYTE* pbData,
2841
__in DWORD cbData
2842
)
2843
{
2844
HRESULT hr = S_OK;
2845
SIZE_T iData = 0;
2833
- LPWSTR sczName = NULL;
2846
+ LPWSTR sczId = NULL;
2847
+ LPWSTR sczLogPath = NULL;
2848
+ BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL;
2849
2850
// Deserialize message data.
2836
- hr = BuffReadString(pbData, cbData, &iData, &sczName);
2837
- ExitOnFailure(hr, "Failed to read transaction name.");
2851
+ hr = BuffReadString(pbData, cbData, &iData, &sczId);
2852
+ ExitOnFailure(hr, "Failed to read rollback boundary id.");
2853
2839
- hr = MsiEngineBeginTransaction(sczName);
2854
+ hr = BuffReadString(pbData, cbData, &iData, &sczLogPath);
2855
+ ExitOnFailure(hr, "Failed to read transaction log path.");
2856
+
2857
+ PackageFindRollbackBoundaryById(pPackages, sczId, &pRollbackBoundary);
2858
+ ExitOnFailure(hr, "Failed to find rollback boundary: %ls", sczId);
2859
+
2860
+ pRollbackBoundary->sczLogPath = sczLogPath;
2861
+
2862
+ hr = MsiEngineBeginTransaction(pRollbackBoundary);
2863
2864
LExit:
2842
- ReleaseStr(sczName);
2865
+ ReleaseStr(sczId);
2866
+ ReleaseStr(sczLogPath);
2867
+
2868
+ if (pRollbackBoundary)
2869
+ {
2870
+ pRollbackBoundary->sczLogPath = NULL;
2871
+ }
2872
2873
return hr;
2874
}
2875
2876
static HRESULT OnMsiCommitTransaction(
2877
+ __in BURN_PACKAGES* pPackages,
2878
__in BYTE* pbData,
2879
__in DWORD cbData
2880
)
2881
{
2882
HRESULT hr = S_OK;
2883
SIZE_T iData = 0;
2854
- LPWSTR sczName = NULL;
2884
+ LPWSTR sczId = NULL;
2885
+ LPWSTR sczLogPath = NULL;
2886
+ BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL;
2887
2888
// Deserialize message data.
2857
- hr = BuffReadString(pbData, cbData, &iData, &sczName);
2858
- ExitOnFailure(hr, "Failed to read transaction name.");
2889
+ hr = BuffReadString(pbData, cbData, &iData, &sczId);
2890
+ ExitOnFailure(hr, "Failed to read rollback boundary id.");
2891
2860
- hr = MsiEngineCommitTransaction(sczName);
2892
+ hr = BuffReadString(pbData, cbData, &iData, &sczLogPath);
2893
+ ExitOnFailure(hr, "Failed to read transaction log path.");
2894
+
2895
+ PackageFindRollbackBoundaryById(pPackages, sczId, &pRollbackBoundary);
2896
+ ExitOnFailure(hr, "Failed to find rollback boundary: %ls", sczId);
2897
+
2898
+ pRollbackBoundary->sczLogPath = sczLogPath;
2899
+
2900
+ hr = MsiEngineCommitTransaction(pRollbackBoundary);
2901
2902
LExit:
2863
- ReleaseStr(sczName);
2903
+ ReleaseStr(sczId);
2904
+ ReleaseStr(sczLogPath);
2905
+
2906
+ if (pRollbackBoundary)
2907
+ {
2908
+ pRollbackBoundary->sczLogPath = NULL;
2909
+ }
2910
2911
return hr;
2912
}
2913
2914
static HRESULT OnMsiRollbackTransaction(
2915
+ __in BURN_PACKAGES* pPackages,
2916
__in BYTE* pbData,
2917
__in DWORD cbData
2918
)
2919
{
2920
HRESULT hr = S_OK;
2921
SIZE_T iData = 0;
2875
- LPWSTR sczName = NULL;
2922
+ LPWSTR sczId = NULL;
2923
+ LPWSTR sczLogPath = NULL;
2924
+ BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL;
2925
2926
// Deserialize message data.
2878
- hr = BuffReadString(pbData, cbData, &iData, &sczName);
2879
- ExitOnFailure(hr, "Failed to read transaction name.");
2927
+ hr = BuffReadString(pbData, cbData, &iData, &sczId);
2928
+ ExitOnFailure(hr, "Failed to read rollback boundary id.");
2929
2881
- hr = MsiEngineRollbackTransaction(sczName);
2930
+ hr = BuffReadString(pbData, cbData, &iData, &sczLogPath);
2931
+ ExitOnFailure(hr, "Failed to read transaction log path.");
2932
+
2933
+ PackageFindRollbackBoundaryById(pPackages, sczId, &pRollbackBoundary);
2934
+ ExitOnFailure(hr, "Failed to find rollback boundary: %ls", sczId);
2935
+
2936
+ pRollbackBoundary->sczLogPath = sczLogPath;
2937
+
2938
+ hr = MsiEngineRollbackTransaction(pRollbackBoundary);
2939
2940
LExit:
2884
- ReleaseStr(sczName);
2941
+ ReleaseStr(sczId);
2942
+ ReleaseStr(sczLogPath);
2943
+
2944
+ if (pRollbackBoundary)
2945
+ {
2946
+ pRollbackBoundary->sczLogPath = NULL;
2947
+ }
2948
2949
return hr;
2950
}
src/engine/elevation.h
+3
-3
@@ -156,15 +156,15 @@ HRESULT ElevationChildResumeAutomaticUpdates();
156
157
HRESULT ElevationMsiBeginTransaction(
158
__in HANDLE hPipe,
159
- __in LPCWSTR wzName
159
+ __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
160
);
161
HRESULT ElevationMsiCommitTransaction(
162
__in HANDLE hPipe,
163
- __in LPCWSTR wzName
163
+ __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
164
);
165
HRESULT ElevationMsiRollbackTransaction(
166
__in HANDLE hPipe,
167
- __in LPCWSTR wzName
167
+ __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
168
);
169
170
#ifdef __cplusplus
src/engine/msiengine.cpp
+16
-16
@@ -1016,40 +1016,41 @@ LExit:
1016
}
1017
1018
extern "C" HRESULT MsiEngineBeginTransaction(
1019
- __in LPCWSTR wzName
1019
+ __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
1020
)
1021
{
1022
HRESULT hr = S_OK;
1023
- UINT uResult = ERROR_SUCCESS;
1023
MSIHANDLE hTransactionHandle = NULL;
1024
HANDLE hChangeOfOwnerEvent = NULL;
1025
1027
- LogId(REPORT_STANDARD, MSG_MSI_TRANSACTION_BEGIN, wzName);
1026
+ LogId(REPORT_STANDARD, MSG_MSI_TRANSACTION_BEGIN, pRollbackBoundary->sczId);
1027
1029
- uResult = ::MsiBeginTransaction(wzName, 0, &hTransactionHandle, &hChangeOfOwnerEvent);
1028
+ hr = WiuBeginTransaction(pRollbackBoundary->sczId, 0, &hTransactionHandle, &hChangeOfOwnerEvent, WIU_LOG_DEFAULT | INSTALLLOGMODE_VERBOSE, pRollbackBoundary->sczLogPath);
1029
1031
- if (ERROR_ROLLBACK_DISABLED == uResult)
1030
+ if (HRESULT_FROM_WIN32(ERROR_ROLLBACK_DISABLED) == hr)
1031
{
1032
LogId(REPORT_ERROR, MSG_MSI_TRANSACTIONS_DISABLED);
1033
}
1034
1036
- ExitOnWin32Error(uResult, hr, "Failed to begin an MSI transaction");
1035
+ ExitOnFailure(hr, "Failed to begin an MSI transaction");
1036
1037
LExit:
1038
+ ReleaseMsi(hTransactionHandle);
1039
+ ReleaseHandle(hChangeOfOwnerEvent);
1040
+
1041
return hr;
1042
}
1043
1044
extern "C" HRESULT MsiEngineCommitTransaction(
1043
- __in LPCWSTR wzName
1045
+ __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
1046
)
1047
{
1048
HRESULT hr = S_OK;
1047
- UINT uResult = ERROR_SUCCESS;
1049
1049
- LogId(REPORT_STANDARD, MSG_MSI_TRANSACTION_COMMIT, wzName);
1050
+ LogId(REPORT_STANDARD, MSG_MSI_TRANSACTION_COMMIT, pRollbackBoundary->sczId);
1051
1051
- uResult = ::MsiEndTransaction(MSITRANSACTIONSTATE_COMMIT);
1052
- ExitOnWin32Error(uResult, hr, "Failed to commit the MSI transaction");
1052
+ hr = WiuEndTransaction(MSITRANSACTIONSTATE_COMMIT, WIU_LOG_DEFAULT | INSTALLLOGMODE_VERBOSE, pRollbackBoundary->sczLogPath);
1053
+ ExitOnFailure(hr, "Failed to commit the MSI transaction");
1054
1055
LExit:
1056
@@ -1057,16 +1058,15 @@ LExit:
1058
}
1059
1060
extern "C" HRESULT MsiEngineRollbackTransaction(
1060
- __in LPCWSTR wzName
1061
+ __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
1062
)
1063
{
1064
HRESULT hr = S_OK;
1064
- UINT uResult = ERROR_SUCCESS;
1065
1066
- LogId(REPORT_WARNING, MSG_MSI_TRANSACTION_ROLLBACK, wzName);
1066
+ LogId(REPORT_WARNING, MSG_MSI_TRANSACTION_ROLLBACK, pRollbackBoundary->sczId);
1067
1068
- uResult = ::MsiEndTransaction(MSITRANSACTIONSTATE_ROLLBACK);
1069
- ExitOnWin32Error(uResult, hr, "Failed to rollback the MSI transaction");
1068
+ hr = WiuEndTransaction(MSITRANSACTIONSTATE_ROLLBACK, WIU_LOG_DEFAULT | INSTALLLOGMODE_VERBOSE, pRollbackBoundary->sczLogPath);
1069
+ ExitOnFailure(hr, "Failed to rollback the MSI transaction");
1070
1071
LExit:
1072
src/engine/msiengine.h
+3
-3
@@ -54,13 +54,13 @@ HRESULT MsiEnginePlanAddPackage(
54
__in BOOL fPlanPackageCacheRollback
55
);
56
HRESULT MsiEngineBeginTransaction(
57
- __in LPCWSTR wzName
57
+ __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
58
);
59
HRESULT MsiEngineCommitTransaction(
60
- __in LPCWSTR wzName
60
+ __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
61
);
62
HRESULT MsiEngineRollbackTransaction(
63
- __in LPCWSTR wzName
63
+ __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
64
);
65
HRESULT MsiEngineExecutePackage(
66
__in_opt HWND hwndParent,
src/engine/package.cpp
+27
@@ -377,6 +377,7 @@ extern "C" void PackagesUninitialize(
377
for (DWORD i = 0; i < pPackages->cRollbackBoundaries; ++i)
378
{
379
ReleaseStr(pPackages->rgRollbackBoundaries[i].sczId);
380
+ ReleaseStr(pPackages->rgRollbackBoundaries[i].sczLogPath);
381
}
382
MemFree(pPackages->rgRollbackBoundaries);
383
}
@@ -511,6 +512,32 @@ LExit:
512
return hr;
513
}
514
515
+extern "C" HRESULT PackageFindRollbackBoundaryById(
516
+ __in BURN_PACKAGES* pPackages,
517
+ __in_z LPCWSTR wzId,
518
+ __out BURN_ROLLBACK_BOUNDARY** ppRollbackBoundary
519
+ )
520
+{
521
+ HRESULT hr = S_OK;
522
+ BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL;
523
+
524
+ for (DWORD i = 0; i < pPackages->cRollbackBoundaries; ++i)
525
+ {
526
+ pRollbackBoundary = &pPackages->rgRollbackBoundaries[i];
527
+
528
+ if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, pRollbackBoundary->sczId, -1, wzId, -1))
529
+ {
530
+ *ppRollbackBoundary = pRollbackBoundary;
531
+ ExitFunction1(hr = S_OK);
532
+ }
533
+ }
534
+
535
+ hr = E_NOTFOUND;
536
+
537
+LExit:
538
+ return hr;
539
+}
540
+
541
542
// internal function declarations
543
src/engine/package.h
+6
@@ -214,6 +214,7 @@ typedef struct _BURN_ROLLBACK_BOUNDARY
214
BOOL fVital;
215
BOOL fTransaction;
216
BOOL fActiveTransaction; // only valid during Apply.
217
+ LPWSTR sczLogPath;
218
} BURN_ROLLBACK_BOUNDARY;
219
220
typedef struct _BURN_PATCH_TARGETCODE
@@ -386,6 +387,11 @@ HRESULT PackageGetProperty(
387
__in_z LPCWSTR wzProperty,
388
__out_z_opt LPWSTR* psczValue
389
);
390
+HRESULT PackageFindRollbackBoundaryById(
391
+ __in BURN_PACKAGES* pPackages,
392
+ __in_z LPCWSTR wzId,
393
+ __out BURN_ROLLBACK_BOUNDARY** ppRollbackBoundary
394
+ );
395
396
397
#if defined(__cplusplus)
src/engine/plan.cpp
+1
@@ -1946,6 +1946,7 @@ static void ResetPlannedRollbackBoundaryState(
1946
)
1947
{
1948
pRollbackBoundary->fActiveTransaction = FALSE;
1949
+ ReleaseNullStr(pRollbackBoundary->sczLogPath);
1950
}
1951
1952
static HRESULT GetActionDefaultRequestState(
src/engine/userexperience.cpp
-10
@@ -2117,16 +2117,6 @@ extern "C" int UserExperienceCheckExecuteResult(
2117
return nResult;
2118
}
2119
2120
-extern "C" HRESULT UserExperienceInterpretResult(
2121
- __in BURN_USER_EXPERIENCE* /*pUserExperience*/,
2122
- __in DWORD dwAllowedResults,
2123
- __in int nResult
2124
- )
2125
-{
2126
- int nFilteredResult = FilterResult(dwAllowedResults, nResult);
2127
- return IDOK == nFilteredResult || IDNOACTION == nFilteredResult ? S_OK : IDCANCEL == nFilteredResult || IDABORT == nFilteredResult ? HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT) : HRESULT_FROM_WIN32(ERROR_INSTALL_FAILURE);
2128
-}
2129
-
2120
extern "C" HRESULT UserExperienceInterpretExecuteResult(
2121
__in BURN_USER_EXPERIENCE* pUserExperience,
2122
__in BOOL fRollback,
src/engine/userexperience.h
-5
@@ -469,11 +469,6 @@ BAAPI UserExperienceOnUnregisterComplete(
469
__in BURN_USER_EXPERIENCE* pUserExperience,
470
__in HRESULT hrStatus
471
);
472
-HRESULT UserExperienceInterpretResult(
473
- __in BURN_USER_EXPERIENCE* pUserExperience,
474
- __in DWORD dwAllowedResults,
475
- __in int nResult
476
- );
472
int UserExperienceCheckExecuteResult(
473
__in BURN_USER_EXPERIENCE* pUserExperience,
474
__in BOOL fRollback,