From 6573eb709147ec52455d03fde60ad567bc79d1bd Mon Sep 17 00:00:00 2001
From: Bob Arnson <bob@firegiant.com>
Date: Sun, 14 Aug 2022 17:24:59 -0400
Subject: Fix OnExecuteMsiMessage to return chosen result.

---
 .../WixStandardBootstrapperApplication.cpp         | 24 +++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

(limited to 'src/ext')

diff --git a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
index 0f1a9f49..fc262e0e 100644
--- a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
+++ b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
@@ -832,12 +832,16 @@ public: // IBootstrapperApplication
         __in DWORD dwCode,
         __in_z LPCWSTR wzError,
         __in DWORD dwUIHint,
-        __in DWORD /*cData*/,
-        __in_ecount_z_opt(cData) LPCWSTR* /*rgwzData*/,
-        __in int /*nRecommendation*/,
+        __in DWORD cData,
+        __in_ecount_z_opt(cData) LPCWSTR* rgwzData,
+        __in int nRecommendation,
         __inout int* pResult
         )
     {
+#ifdef DEBUG
+        BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnError() - package: %ls, code: %d, ui hint: %d, message: %ls", wzPackageId, dwCode, dwUIHint, wzError);
+#endif
+
         HRESULT hr = S_OK;
         int nResult = *pResult;
         LPWSTR sczError = NULL;
@@ -887,8 +891,14 @@ public: // IBootstrapperApplication
         }
 
         ReleaseStr(sczError);
+
         *pResult = nResult;
-        return hr;
+
+#ifdef DEBUG
+        BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnError() - package: %ls, hr: 0x%0x, result: %d", wzPackageId, hr, nResult);
+#endif
+
+        return FAILED(hr) ? hr : __super::OnError(errorType, wzPackageId, dwCode, wzError, dwUIHint, cData, rgwzData, nRecommendation, pResult);
     }
 
 
@@ -906,12 +916,16 @@ public: // IBootstrapperApplication
 #ifdef DEBUG
         BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnExecuteMsiMessage() - package: %ls, message: %ls", wzPackageId, wzMessage);
 #endif
+
         if (BOOTSTRAPPER_DISPLAY_FULL == m_command.display && (INSTALLMESSAGE_WARNING == messageType || INSTALLMESSAGE_USER == messageType))
         {
             if (!m_fShowingInternalUiThisPackage)
             {
                 int nResult = ::MessageBoxW(m_hWnd, wzMessage, m_pTheme->sczCaption, dwUIHint);
-                return nResult;
+
+                *pResult = nResult;
+
+                return __super::OnExecuteMsiMessage(wzPackageId, messageType, dwUIHint, wzMessage, cData, rgwzData, nRecommendation, pResult);
             }
         }
 
-- 
cgit v1.2.3-55-g6feb