@joebigelow / wix / commits / 100944a4

Let the BA request the bundle to stay installed from OnUnregisterBegin.

#6297

Sean Hall committed Feb 24, 2021 at 17:42 UTC 100944a40f363c1a8ce0cd8c5c27728d1db0912e
4 files changed +11 -7
src/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h
+2 -1
@@ -1089,12 +1089,13 @@ struct BA_ONSYSTEMSHUTDOWN_RESULTS
1089 struct BA_ONUNREGISTERBEGIN_ARGS
1090 {
1091 DWORD cbSize;
1092 + BOOL fKeepRegistration;
1093 };
1094
1095 struct BA_ONUNREGISTERBEGIN_RESULTS
1096 {
1097 DWORD cbSize;
1097 - BOOL fCancel;
1098 + BOOL fForceKeepRegistration;
1099 };
1100
1101 struct BA_ONUNREGISTERCOMPLETE_ARGS
src/engine/apply.cpp
+1 -1
@@ -399,7 +399,7 @@ extern "C" HRESULT ApplyUnregister(
399
400 CalculateKeepRegistration(pEngineState, &fKeepRegistration);
401
402 - hr = UserExperienceOnUnregisterBegin(&pEngineState->userExperience);
402 + hr = UserExperienceOnUnregisterBegin(&pEngineState->userExperience, &fKeepRegistration);
403 ExitOnRootFailure(hr, "BA aborted unregister begin.");
404
405 // Calculate the correct resume mode. If a restart has been initiated, that trumps all other
src/engine/userexperience.cpp
+6 -4
@@ -111,7 +111,7 @@ extern "C" HRESULT UserExperienceLoad(
111 args.pCommand = pCommand;
112 args.pfnBootstrapperEngineProc = EngineForApplicationProc;
113 args.pvBootstrapperEngineProcContext = pEngineContext;
114 - args.qwEngineAPIVersion = MAKEQWORDVERSION(2021, 2, 18, 0);
114 + args.qwEngineAPIVersion = MAKEQWORDVERSION(2021, 2, 24, 0);
115
116 results.cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS);
117
@@ -2011,7 +2011,8 @@ LExit:
2011 }
2012
2013 EXTERN_C BAAPI UserExperienceOnUnregisterBegin(
2014 - __in BURN_USER_EXPERIENCE* pUserExperience
2014 + __in BURN_USER_EXPERIENCE* pUserExperience,
2015 + __inout BOOL* pfKeepRegistration
2016 )
2017 {
2018 HRESULT hr = S_OK;
@@ -2019,15 +2020,16 @@ EXTERN_C BAAPI UserExperienceOnUnregisterBegin(
2020 BA_ONUNREGISTERBEGIN_RESULTS results = { };
2021
2022 args.cbSize = sizeof(args);
2023 + args.fKeepRegistration = *pfKeepRegistration;
2024
2025 results.cbSize = sizeof(results);
2026
2027 hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN, &args, &results);
2028 ExitOnFailure(hr, "BA OnUnregisterBegin failed.");
2029
2028 - if (results.fCancel)
2030 + if (!args.fKeepRegistration && results.fForceKeepRegistration)
2031 {
2030 - hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT);
2032 + *pfKeepRegistration = TRUE;
2033 }
2034
2035 LExit:
src/engine/userexperience.h
+2 -1
@@ -452,7 +452,8 @@ BAAPI UserExperienceOnSystemShutdown(
452 __inout BOOL* pfCancel
453 );
454 BAAPI UserExperienceOnUnregisterBegin(
455 - __in BURN_USER_EXPERIENCE* pUserExperience
455 + __in BURN_USER_EXPERIENCE* pUserExperience,
456 + __inout BOOL* pfKeepRegistration
457 );
458 BAAPI UserExperienceOnUnregisterComplete(
459 __in BURN_USER_EXPERIENCE* pUserExperience,