Add logging and BA messages around MSI transactions.
Sean Hall committed
Nov 16, 2020 at 19:05 UTC
7d45238e97c35ccea1f77be9065b9a3ed9213bfb
9 files changed
+414
-31
src/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h
+77
@@ -135,6 +135,12 @@ enum BOOTSTRAPPER_APPLICATION_MESSAGE
135
BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN,
136
BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE,
137
BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE,
138
+ BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN,
139
+ BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE,
140
+ BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN,
141
+ BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE,
142
+ BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN,
143
+ BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE,
144
};
145
146
enum BOOTSTRAPPER_APPLYCOMPLETE_ACTION
@@ -274,6 +280,30 @@ struct BA_ONAPPLYCOMPLETE_RESULTS
280
BOOTSTRAPPER_APPLYCOMPLETE_ACTION action;
281
};
282
283
+struct BA_ONBEGINMSITRANSACTIONBEGIN_ARGS
284
+{
285
+ DWORD cbSize;
286
+ LPCWSTR wzTransactionId;
287
+};
288
+
289
+struct BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS
290
+{
291
+ DWORD cbSize;
292
+ BOOL fCancel;
293
+};
294
+
295
+struct BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS
296
+{
297
+ DWORD cbSize;
298
+ LPCWSTR wzTransactionId;
299
+ HRESULT hrStatus;
300
+};
301
+
302
+struct BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS
303
+{
304
+ DWORD cbSize;
305
+};
306
+
307
struct BA_ONCACHEACQUIREBEGIN_ARGS
308
{
309
DWORD cbSize;
@@ -398,6 +428,30 @@ struct BA_ONCACHEVERIFYCOMPLETE_RESULTS
428
BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action;
429
};
430
431
+struct BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS
432
+{
433
+ DWORD cbSize;
434
+ LPCWSTR wzTransactionId;
435
+};
436
+
437
+struct BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS
438
+{
439
+ DWORD cbSize;
440
+ BOOL fCancel;
441
+};
442
+
443
+struct BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS
444
+{
445
+ DWORD cbSize;
446
+ LPCWSTR wzTransactionId;
447
+ HRESULT hrStatus;
448
+};
449
+
450
+struct BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS
451
+{
452
+ DWORD cbSize;
453
+};
454
+
455
struct BA_ONDETECTBEGIN_ARGS
456
{
457
DWORD cbSize;
@@ -963,6 +1017,29 @@ struct BA_ONRESOLVESOURCE_RESULTS
1017
BOOL fCancel;
1018
};
1019
1020
+struct BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS
1021
+{
1022
+ DWORD cbSize;
1023
+ LPCWSTR wzTransactionId;
1024
+};
1025
+
1026
+struct BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS
1027
+{
1028
+ DWORD cbSize;
1029
+};
1030
+
1031
+struct BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS
1032
+{
1033
+ DWORD cbSize;
1034
+ LPCWSTR wzTransactionId;
1035
+ HRESULT hrStatus;
1036
+};
1037
+
1038
+struct BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS
1039
+{
1040
+ DWORD cbSize;
1041
+};
1042
+
1043
struct BA_ONSHUTDOWN_ARGS
1044
{
1045
DWORD cbSize;
src/engine/apply.cpp
+38
-9
@@ -783,7 +783,7 @@ extern "C" HRESULT ApplyExecute(
783
if (pCheckpoint && pCheckpoint->pActiveRollbackBoundary && pCheckpoint->pActiveRollbackBoundary->fActiveTransaction)
784
{
785
hr = E_INVALIDSTATE;
786
- LogString(REPORT_ERROR, "Ilegal state: Reboot requested within an MSI transaction. Transaction will rollback.");
786
+ LogId(REPORT_ERROR, MSG_RESTART_REQUEST_DURING_MSI_TRANSACTION, pCheckpoint->pActiveRollbackBoundary->sczId);
787
}
788
else
789
{
@@ -796,6 +796,8 @@ extern "C" HRESULT ApplyExecute(
796
// If rollback is disabled, keep what we have and always end execution here.
797
if (pEngineState->plan.fDisableRollback)
798
{
799
+ LogId(REPORT_WARNING, MSG_PLAN_ROLLBACK_DISABLED);
800
+
801
if (pCheckpoint && pCheckpoint->pActiveRollbackBoundary && pCheckpoint->pActiveRollbackBoundary->fActiveTransaction)
802
{
803
hrRollback = ExecuteMsiCommitTransaction(pEngineState, pCheckpoint->pActiveRollbackBoundary, &context);
@@ -1732,13 +1734,11 @@ static HRESULT DoExecuteAction(
1734
break;
1735
1736
case BURN_EXECUTE_ACTION_TYPE_BEGIN_MSI_TRANSACTION:
1735
- LogString(REPORT_STANDARD, "Starting a new MSI transaction\n");
1737
hr = ExecuteMsiBeginTransaction(pEngineState, pExecuteAction->msiTransaction.pRollbackBoundary, pContext);
1738
ExitOnFailure(hr, "Failed to execute begin MSI transaction action.");
1739
break;
1740
1741
case BURN_EXECUTE_ACTION_TYPE_COMMIT_MSI_TRANSACTION:
1741
- LogString(REPORT_STANDARD, "Committing MSI transaction\n");
1742
hr = ExecuteMsiCommitTransaction(pEngineState, pExecuteAction->msiTransaction.pRollbackBoundary, pContext);
1743
ExitOnFailure(hr, "Failed to execute commit MSI transaction action.");
1744
break;
@@ -1899,7 +1899,7 @@ static HRESULT ExecuteExePackage(
1899
fBeginCalled = TRUE;
1900
1901
// Send package execute begin to BA.
1902
- hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pExecuteAction->exePackage.pPackage->sczId, !fRollback, pExecuteAction->exePackage.action, INSTALLUILEVEL_NOCHANGE, false);
1902
+ hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pExecuteAction->exePackage.pPackage->sczId, !fRollback, pExecuteAction->exePackage.action, INSTALLUILEVEL_NOCHANGE, FALSE);
1903
ExitOnRootFailure(hr, "BA aborted execute EXE package begin.");
1904
1905
message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS;
@@ -2090,7 +2090,7 @@ static HRESULT ExecuteMsuPackage(
2090
fBeginCalled = TRUE;
2091
2092
// Send package execute begin to BA.
2093
- hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pExecuteAction->msuPackage.pPackage->sczId, !fRollback, pExecuteAction->msuPackage.action, INSTALLUILEVEL_NOCHANGE, false);
2093
+ hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pExecuteAction->msuPackage.pPackage->sczId, !fRollback, pExecuteAction->msuPackage.action, INSTALLUILEVEL_NOCHANGE, FALSE);
2094
ExitOnRootFailure(hr, "BA aborted execute MSU package begin.");
2095
2096
message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS;
@@ -2206,12 +2206,17 @@ static HRESULT ExecuteMsiBeginTransaction(
2206
)
2207
{
2208
HRESULT hr = S_OK;
2209
+ BOOL fBeginCalled = FALSE;
2210
2211
if (pRollbackBoundary->fActiveTransaction)
2212
{
2213
ExitFunction1(hr = E_INVALIDSTATE);
2214
}
2215
2216
+ fBeginCalled = TRUE;
2217
+ hr = UserExperienceOnBeginMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId);
2218
+ ExitOnRootFailure(hr, "BA aborted execute begin MSI transaction.");
2219
+
2220
if (pEngineState->plan.fPerMachine)
2221
{
2222
hr = ElevationMsiBeginTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary->sczId);
@@ -2228,6 +2233,11 @@ static HRESULT ExecuteMsiBeginTransaction(
2233
}
2234
2235
LExit:
2236
+ if (fBeginCalled)
2237
+ {
2238
+ UserExperienceOnBeginMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr);
2239
+ }
2240
+
2241
return hr;
2242
}
2243
@@ -2238,20 +2248,25 @@ static HRESULT ExecuteMsiCommitTransaction(
2248
)
2249
{
2250
HRESULT hr = S_OK;
2251
+ BOOL fBeginCalled = FALSE;
2252
2253
if (!pRollbackBoundary->fActiveTransaction)
2254
{
2255
ExitFunction1(hr = E_INVALIDSTATE);
2256
}
2257
2258
+ fBeginCalled = TRUE;
2259
+ hr = UserExperienceOnCommitMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId);
2260
+ ExitOnRootFailure(hr, "BA aborted execute commit MSI transaction.");
2261
+
2262
if (pEngineState->plan.fPerMachine)
2263
{
2249
- hr = ElevationMsiCommitTransaction(pEngineState->companionConnection.hPipe);
2264
+ hr = ElevationMsiCommitTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary->sczId);
2265
ExitOnFailure(hr, "Failed to commit an elevated MSI transaction.");
2266
}
2267
else
2268
{
2254
- hr = MsiEngineCommitTransaction();
2269
+ hr = MsiEngineCommitTransaction(pRollbackBoundary->sczId);
2270
}
2271
2272
if (SUCCEEDED(hr))
@@ -2260,6 +2275,11 @@ static HRESULT ExecuteMsiCommitTransaction(
2275
}
2276
2277
LExit:
2278
+ if (fBeginCalled)
2279
+ {
2280
+ UserExperienceOnCommitMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr);
2281
+ }
2282
+
2283
return hr;
2284
}
2285
@@ -2270,25 +2290,34 @@ static HRESULT ExecuteMsiRollbackTransaction(
2290
)
2291
{
2292
HRESULT hr = S_OK;
2293
+ BOOL fBeginCalled = FALSE;
2294
2295
if (!pRollbackBoundary->fActiveTransaction)
2296
{
2297
ExitFunction();
2298
}
2299
2300
+ fBeginCalled = TRUE;
2301
+ UserExperienceOnRollbackMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId);
2302
+
2303
if (pEngineState->plan.fPerMachine)
2304
{
2281
- hr = ElevationMsiRollbackTransaction(pEngineState->companionConnection.hPipe);
2305
+ hr = ElevationMsiRollbackTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary->sczId);
2306
ExitOnFailure(hr, "Failed to rollback an elevated MSI transaction.");
2307
}
2308
else
2309
{
2286
- hr = MsiEngineRollbackTransaction();
2310
+ hr = MsiEngineRollbackTransaction(pRollbackBoundary->sczId);
2311
}
2312
2313
LExit:
2314
pRollbackBoundary->fActiveTransaction = FALSE;
2315
2316
+ if (fBeginCalled)
2317
+ {
2318
+ UserExperienceOnRollbackMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr);
2319
+ }
2320
+
2321
return hr;
2322
}
2323
src/engine/elevation.cpp
+57
-13
@@ -237,8 +237,14 @@ static HRESULT OnMsiBeginTransaction(
237
__in BYTE* pbData,
238
__in DWORD cbData
239
);
240
-static HRESULT OnMsiCommitTransaction();
241
-static HRESULT OnMsiRollbackTransaction();
240
+static HRESULT OnMsiCommitTransaction(
241
+ __in BYTE* pbData,
242
+ __in DWORD cbData
243
+ );
244
+static HRESULT OnMsiRollbackTransaction(
245
+ __in BYTE* pbData,
246
+ __in DWORD cbData
247
+ );
248
249
250
@@ -730,7 +736,7 @@ extern "C" HRESULT ElevationMsiBeginTransaction(
736
hr = BuffWriteString(&pbData, &cbData, wzName);
737
ExitOnFailure(hr, "Failed to write transaction name to message buffer.");
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);
740
ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_BEGIN_MSI_TRANSACTION message to per-machine process.");
741
742
hr = static_cast<HRESULT>(dwResult);
@@ -742,13 +748,20 @@ LExit:
748
}
749
750
extern "C" HRESULT ElevationMsiCommitTransaction(
745
- __in HANDLE hPipe
751
+ __in HANDLE hPipe,
752
+ __in LPCWSTR wzName
753
)
754
{
755
HRESULT hr = S_OK;
756
+ BYTE* pbData = NULL;
757
+ SIZE_T cbData = 0;
758
DWORD dwResult = ERROR_SUCCESS;
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);
765
ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_COMMIT_MSI_TRANSACTION message to per-machine process.");
766
767
hr = static_cast<HRESULT>(dwResult);
@@ -758,13 +771,20 @@ LExit:
771
}
772
773
extern "C" HRESULT ElevationMsiRollbackTransaction(
761
- __in HANDLE hPipe
774
+ __in HANDLE hPipe,
775
+ __in LPCWSTR wzName
776
)
777
{
778
HRESULT hr = S_OK;
779
+ BYTE* pbData = NULL;
780
+ SIZE_T cbData = 0;
781
DWORD dwResult = ERROR_SUCCESS;
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);
788
ExitOnFailure(hr, "Failed to send BURN_ELEVATION_MESSAGE_TYPE_ROLLBACK_MSI_TRANSACTION message to per-machine process.");
789
790
hr = static_cast<HRESULT>(dwResult);
@@ -1534,11 +1554,11 @@ static HRESULT ProcessElevatedChildMessage(
1554
break;
1555
1556
case BURN_ELEVATION_MESSAGE_TYPE_COMMIT_MSI_TRANSACTION:
1537
- hrResult = OnMsiCommitTransaction();
1557
+ hrResult = OnMsiCommitTransaction((BYTE*)pMsg->pvData, pMsg->cbData);
1558
break;
1559
1560
case BURN_ELEVATION_MESSAGE_TYPE_ROLLBACK_MSI_TRANSACTION:
1541
- hrResult = OnMsiRollbackTransaction();
1561
+ hrResult = OnMsiRollbackTransaction((BYTE*)pMsg->pvData, pMsg->cbData);
1562
break;
1563
1564
case BURN_ELEVATION_MESSAGE_TYPE_APPLY_INITIALIZE:
@@ -2806,20 +2826,44 @@ LExit:
2826
return hr;
2827
}
2828
2809
-static HRESULT OnMsiCommitTransaction()
2829
+static HRESULT OnMsiCommitTransaction(
2830
+ __in BYTE* pbData,
2831
+ __in DWORD cbData
2832
+ )
2833
{
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.");
2841
2813
- hr = MsiEngineCommitTransaction();
2842
+ hr = MsiEngineCommitTransaction(sczName);
2843
+
2844
+LExit:
2845
+ ReleaseStr(sczName);
2846
2847
return hr;
2848
}
2849
2818
-static HRESULT OnMsiRollbackTransaction()
2850
+static HRESULT OnMsiRollbackTransaction(
2851
+ __in BYTE* pbData,
2852
+ __in DWORD cbData
2853
+ )
2854
{
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.");
2862
2822
- hr = MsiEngineRollbackTransaction();
2863
+ hr = MsiEngineRollbackTransaction(sczName);
2864
+
2865
+LExit:
2866
+ ReleaseStr(sczName);
2867
2868
return hr;
2869
}
src/engine/elevation.h
+4
-2
@@ -162,10 +162,12 @@ HRESULT ElevationMsiBeginTransaction(
162
__in LPCWSTR wzName
163
);
164
HRESULT ElevationMsiCommitTransaction(
165
- __in HANDLE hPipe
165
+ __in HANDLE hPipe,
166
+ __in LPCWSTR wzName
167
);
168
HRESULT ElevationMsiRollbackTransaction(
168
- __in HANDLE hPipe
169
+ __in HANDLE hPipe,
170
+ __in LPCWSTR wzName
171
);
172
173
#ifdef __cplusplus
src/engine/engine.mc
+42
@@ -843,6 +843,48 @@ Language=English
843
Ignoring application request to cancel from %1!ls! during rollback.
844
.
845
846
+MessageId=382
847
+Severity=Warning
848
+SymbolicName=MSG_PLAN_ROLLBACK_DISABLED
849
+Language=English
850
+Rollback is disabled for this bundle.
851
+.
852
+
853
+MessageId=383
854
+Severity=Error
855
+SymbolicName=MSG_MSI_TRANSACTIONS_DISABLED
856
+Language=English
857
+Windows Installer rollback is disabled on this computer. It must be enabled for this bundle to proceed.
858
+.
859
+
860
+MessageId=384
861
+Severity=Success
862
+SymbolicName=MSG_MSI_TRANSACTION_BEGIN
863
+Language=English
864
+Starting a new MSI transaction, id: %1!ls!
865
+.
866
+
867
+MessageId=385
868
+Severity=Success
869
+SymbolicName=MSG_MSI_TRANSACTION_COMMIT
870
+Language=English
871
+Committing MSI transaction, id: %1!ls!
872
+.
873
+
874
+MessageId=386
875
+Severity=Warning
876
+SymbolicName=MSG_MSI_TRANSACTION_ROLLBACK
877
+Language=English
878
+Rolling back MSI transaction, id: %1!ls!
879
+.
880
+
881
+MessageId=387
882
+Severity=Error
883
+SymbolicName=MSG_RESTART_REQUEST_DURING_MSI_TRANSACTION
884
+Language=English
885
+Illegal state: Reboot requested within an MSI transaction, id: %1!ls!
886
+.
887
+
888
MessageId=399
889
Severity=Success
890
SymbolicName=MSG_APPLY_COMPLETE
src/engine/msiengine.cpp
+18
-2
@@ -1147,18 +1147,30 @@ extern "C" HRESULT MsiEngineBeginTransaction(
1147
MSIHANDLE hTransactionHandle = NULL;
1148
HANDLE hChangeOfOwnerEvent = NULL;
1149
1150
+ LogId(REPORT_STANDARD, MSG_MSI_TRANSACTION_BEGIN, wzName);
1151
+
1152
uResult = ::MsiBeginTransaction(wzName, 0, &hTransactionHandle, &hChangeOfOwnerEvent);
1153
+
1154
+ if (ERROR_ROLLBACK_DISABLED == uResult)
1155
+ {
1156
+ LogId(REPORT_ERROR, MSG_MSI_TRANSACTIONS_DISABLED);
1157
+ }
1158
+
1159
ExitOnWin32Error(uResult, hr, "Failed to begin an MSI transaction");
1160
1161
LExit:
1162
return hr;
1163
}
1164
1157
-extern "C" HRESULT MsiEngineCommitTransaction()
1165
+extern "C" HRESULT MsiEngineCommitTransaction(
1166
+ __in LPCWSTR wzName
1167
+ )
1168
{
1169
HRESULT hr = S_OK;
1170
UINT uResult = ERROR_SUCCESS;
1171
1172
+ LogId(REPORT_STANDARD, MSG_MSI_TRANSACTION_COMMIT, wzName);
1173
+
1174
uResult = ::MsiEndTransaction(MSITRANSACTIONSTATE_COMMIT);
1175
ExitOnWin32Error(uResult, hr, "Failed to commit the MSI transaction");
1176
@@ -1167,11 +1179,15 @@ LExit:
1179
return hr;
1180
}
1181
1170
-extern "C" HRESULT MsiEngineRollbackTransaction()
1182
+extern "C" HRESULT MsiEngineRollbackTransaction(
1183
+ __in LPCWSTR wzName
1184
+ )
1185
{
1186
HRESULT hr = S_OK;
1187
UINT uResult = ERROR_SUCCESS;
1188
1189
+ LogId(REPORT_WARNING, MSG_MSI_TRANSACTION_ROLLBACK, wzName);
1190
+
1191
uResult = ::MsiEndTransaction(MSITRANSACTIONSTATE_ROLLBACK);
1192
ExitOnWin32Error(uResult, hr, "Failed to rollback the MSI transaction");
1193
src/engine/msiengine.h
+6
-2
@@ -56,8 +56,12 @@ HRESULT MsiEngineAddCompatiblePackage(
56
HRESULT MsiEngineBeginTransaction(
57
__in LPCWSTR wzName
58
);
59
-HRESULT MsiEngineCommitTransaction();
60
-HRESULT MsiEngineRollbackTransaction();
59
+HRESULT MsiEngineCommitTransaction(
60
+ __in LPCWSTR wzName
61
+ );
62
+HRESULT MsiEngineRollbackTransaction(
63
+ __in LPCWSTR wzName
64
+ );
65
HRESULT MsiEngineExecutePackage(
66
__in_opt HWND hwndParent,
67
__in BURN_EXECUTE_ACTION* pExecuteAction,
src/engine/userexperience.cpp
+142
@@ -348,6 +348,55 @@ LExit:
348
return hr;
349
}
350
351
+EXTERN_C BAAPI UserExperienceOnBeginMsiTransactionBegin(
352
+ __in BURN_USER_EXPERIENCE* pUserExperience,
353
+ __in LPCWSTR wzTransactionId
354
+ )
355
+{
356
+ HRESULT hr = S_OK;
357
+ BA_ONBEGINMSITRANSACTIONBEGIN_ARGS args = { };
358
+ BA_ONBEGINMSITRANSACTIONBEGIN_RESULTS results = { };
359
+
360
+ args.cbSize = sizeof(args);
361
+ args.wzTransactionId = wzTransactionId;
362
+
363
+ results.cbSize = sizeof(results);
364
+
365
+ hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONBEGIN, &args, &results, pUserExperience->pvBAProcContext);
366
+ ExitOnFailure(hr, "BA OnBeginMsiTransactionBegin failed.");
367
+
368
+ if (results.fCancel)
369
+ {
370
+ hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT);
371
+ }
372
+
373
+LExit:
374
+ return hr;
375
+}
376
+
377
+EXTERN_C BAAPI UserExperienceOnBeginMsiTransactionComplete(
378
+ __in BURN_USER_EXPERIENCE* pUserExperience,
379
+ __in LPCWSTR wzTransactionId,
380
+ __in HRESULT hrStatus
381
+ )
382
+{
383
+ HRESULT hr = S_OK;
384
+ BA_ONBEGINMSITRANSACTIONCOMPLETE_ARGS args = { };
385
+ BA_ONBEGINMSITRANSACTIONCOMPLETE_RESULTS results = { };
386
+
387
+ args.cbSize = sizeof(args);
388
+ args.wzTransactionId = wzTransactionId;
389
+ args.hrStatus = hrStatus;
390
+
391
+ results.cbSize = sizeof(results);
392
+
393
+ hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONBEGINMSITRANSACTIONCOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
394
+ ExitOnFailure(hr, "BA OnBeginMsiTransactionComplete failed.");
395
+
396
+LExit:
397
+ return hr;
398
+}
399
+
400
EXTERN_C BAAPI UserExperienceOnCacheAcquireBegin(
401
__in BURN_USER_EXPERIENCE* pUserExperience,
402
__in_z_opt LPCWSTR wzPackageOrContainerId,
@@ -614,6 +663,55 @@ LExit:
663
return hr;
664
}
665
666
+EXTERN_C BAAPI UserExperienceOnCommitMsiTransactionBegin(
667
+ __in BURN_USER_EXPERIENCE* pUserExperience,
668
+ __in LPCWSTR wzTransactionId
669
+ )
670
+{
671
+ HRESULT hr = S_OK;
672
+ BA_ONCOMMITMSITRANSACTIONBEGIN_ARGS args = { };
673
+ BA_ONCOMMITMSITRANSACTIONBEGIN_RESULTS results = { };
674
+
675
+ args.cbSize = sizeof(args);
676
+ args.wzTransactionId = wzTransactionId;
677
+
678
+ results.cbSize = sizeof(results);
679
+
680
+ hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONBEGIN, &args, &results, pUserExperience->pvBAProcContext);
681
+ ExitOnFailure(hr, "BA OnCommitMsiTransactionBegin failed.");
682
+
683
+ if (results.fCancel)
684
+ {
685
+ hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT);
686
+ }
687
+
688
+LExit:
689
+ return hr;
690
+}
691
+
692
+EXTERN_C BAAPI UserExperienceOnCommitMsiTransactionComplete(
693
+ __in BURN_USER_EXPERIENCE* pUserExperience,
694
+ __in LPCWSTR wzTransactionId,
695
+ __in HRESULT hrStatus
696
+ )
697
+{
698
+ HRESULT hr = S_OK;
699
+ BA_ONCOMMITMSITRANSACTIONCOMPLETE_ARGS args = { };
700
+ BA_ONCOMMITMSITRANSACTIONCOMPLETE_RESULTS results = { };
701
+
702
+ args.cbSize = sizeof(args);
703
+ args.wzTransactionId = wzTransactionId;
704
+ args.hrStatus = hrStatus;
705
+
706
+ results.cbSize = sizeof(results);
707
+
708
+ hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONCOMMITMSITRANSACTIONCOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
709
+ ExitOnFailure(hr, "BA OnCommitMsiTransactionComplete failed.");
710
+
711
+LExit:
712
+ return hr;
713
+}
714
+
715
EXTERN_C BAAPI UserExperienceOnDetectBegin(
716
__in BURN_USER_EXPERIENCE* pUserExperience,
717
__in BOOL fInstalled,
@@ -1799,6 +1897,50 @@ LExit:
1897
return hr;
1898
}
1899
1900
+EXTERN_C BAAPI UserExperienceOnRollbackMsiTransactionBegin(
1901
+ __in BURN_USER_EXPERIENCE* pUserExperience,
1902
+ __in LPCWSTR wzTransactionId
1903
+ )
1904
+{
1905
+ HRESULT hr = S_OK;
1906
+ BA_ONROLLBACKMSITRANSACTIONBEGIN_ARGS args = { };
1907
+ BA_ONROLLBACKMSITRANSACTIONBEGIN_RESULTS results = { };
1908
+
1909
+ args.cbSize = sizeof(args);
1910
+ args.wzTransactionId = wzTransactionId;
1911
+
1912
+ results.cbSize = sizeof(results);
1913
+
1914
+ hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONBEGIN, &args, &results, pUserExperience->pvBAProcContext);
1915
+ ExitOnFailure(hr, "BA OnRollbackMsiTransactionBegin failed.");
1916
+
1917
+LExit:
1918
+ return hr;
1919
+}
1920
+
1921
+EXTERN_C BAAPI UserExperienceOnRollbackMsiTransactionComplete(
1922
+ __in BURN_USER_EXPERIENCE* pUserExperience,
1923
+ __in LPCWSTR wzTransactionId,
1924
+ __in HRESULT hrStatus
1925
+ )
1926
+{
1927
+ HRESULT hr = S_OK;
1928
+ BA_ONROLLBACKMSITRANSACTIONCOMPLETE_ARGS args = { };
1929
+ BA_ONROLLBACKMSITRANSACTIONCOMPLETE_RESULTS results = { };
1930
+
1931
+ args.cbSize = sizeof(args);
1932
+ args.wzTransactionId = wzTransactionId;
1933
+ args.hrStatus = hrStatus;
1934
+
1935
+ results.cbSize = sizeof(results);
1936
+
1937
+ hr = pUserExperience->pfnBAProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONROLLBACKMSITRANSACTIONCOMPLETE, &args, &results, pUserExperience->pvBAProcContext);
1938
+ ExitOnFailure(hr, "BA OnRollbackMsiTransactionComplete failed.");
1939
+
1940
+LExit:
1941
+ return hr;
1942
+}
1943
+
1944
EXTERN_C BAAPI UserExperienceOnShutdown(
1945
__in BURN_USER_EXPERIENCE* pUserExperience,
1946
__inout BOOTSTRAPPER_SHUTDOWN_ACTION* pAction
src/engine/userexperience.h
+30
-3
@@ -108,7 +108,16 @@ BAAPI UserExperienceOnApplyComplete(
108
__in HRESULT hrStatus,
109
__in BOOTSTRAPPER_APPLY_RESTART restart,
110
__inout BOOTSTRAPPER_APPLYCOMPLETE_ACTION* pAction
111
-);
111
+ );
112
+BAAPI UserExperienceOnBeginMsiTransactionBegin(
113
+ __in BURN_USER_EXPERIENCE* pUserExperience,
114
+ __in LPCWSTR wzTransactionId
115
+ );
116
+BAAPI UserExperienceOnBeginMsiTransactionComplete(
117
+ __in BURN_USER_EXPERIENCE* pUserExperience,
118
+ __in LPCWSTR wzTransactionId,
119
+ __in HRESULT hrStatus
120
+ );
121
BAAPI UserExperienceOnCacheAcquireBegin(
122
__in BURN_USER_EXPERIENCE* pUserExperience,
123
__in_z_opt LPCWSTR wzPackageOrContainerId,
@@ -162,6 +171,15 @@ BAAPI UserExperienceOnCacheVerifyComplete(
171
__in HRESULT hrStatus,
172
__inout BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION* pAction
173
);
174
+BAAPI UserExperienceOnCommitMsiTransactionBegin(
175
+ __in BURN_USER_EXPERIENCE* pUserExperience,
176
+ __in LPCWSTR wzTransactionId
177
+ );
178
+BAAPI UserExperienceOnCommitMsiTransactionComplete(
179
+ __in BURN_USER_EXPERIENCE* pUserExperience,
180
+ __in LPCWSTR wzTransactionId,
181
+ __in HRESULT hrStatus
182
+ );
183
BAAPI UserExperienceOnDetectBegin(
184
__in BURN_USER_EXPERIENCE* pUserExperience,
185
__in BOOL fInstalled,
@@ -272,7 +290,7 @@ BAAPI UserExperienceOnExecuteBegin(
290
BAAPI UserExperienceOnExecuteComplete(
291
__in BURN_USER_EXPERIENCE* pUserExperience,
292
__in HRESULT hrStatus
275
-);
293
+ );
294
BAAPI UserExperienceOnExecuteFilesInUse(
295
__in BURN_USER_EXPERIENCE* pUserExperience,
296
__in_z LPCWSTR wzPackageId,
@@ -315,7 +333,7 @@ BAAPI UserExperienceOnExecuteProgress(
333
__in_z LPCWSTR wzPackageId,
334
__in DWORD dwProgressPercentage,
335
__in DWORD dwOverallPercentage,
318
- __inout int* pnResult
336
+ __out int* pnResult
337
);
338
BAAPI UserExperienceOnLaunchApprovedExeBegin(
339
__in BURN_USER_EXPERIENCE* pUserExperience
@@ -411,6 +429,15 @@ BAAPI UserExperienceOnResolveSource(
429
__in_z_opt LPCWSTR wzDownloadSource,
430
__inout BOOTSTRAPPER_RESOLVESOURCE_ACTION* pAction
431
);
432
+BAAPI UserExperienceOnRollbackMsiTransactionBegin(
433
+ __in BURN_USER_EXPERIENCE* pUserExperience,
434
+ __in LPCWSTR wzTransactionId
435
+ );
436
+BAAPI UserExperienceOnRollbackMsiTransactionComplete(
437
+ __in BURN_USER_EXPERIENCE* pUserExperience,
438
+ __in LPCWSTR wzTransactionId,
439
+ __in HRESULT hrStatus
440
+ );
441
BAAPI UserExperienceOnShutdown(
442
__in BURN_USER_EXPERIENCE* pUserExperience,
443
__inout BOOTSTRAPPER_SHUTDOWN_ACTION* pAction