From f43d176f95601ff7524e06247166d4f3b6e61c05 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 2 Jul 2021 10:18:08 -0500 Subject: Make the BA responsible for parsing restart prompt behavior. Fixes #4975 --- .../balutil/inc/BalBaseBootstrapperApplication.h | 28 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h') diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h index 393987ba..53fa369b 100644 --- a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h +++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h @@ -9,6 +9,7 @@ #include "IBootstrapperApplication.h" #include "balutil.h" +#include "balinfo.h" #include "balretry.h" class CBalBaseBootstrapperApplication : public IBootstrapperApplication @@ -794,7 +795,7 @@ public: // IBootstrapperApplication { HRESULT hr = S_OK; BOOL fRestartRequired = BOOTSTRAPPER_APPLY_RESTART_REQUIRED == restart; - BOOL fShouldBlockRestart = BOOTSTRAPPER_DISPLAY_FULL <= m_display && BOOTSTRAPPER_RESTART_PROMPT >= m_restart; + BOOL fShouldBlockRestart = BOOTSTRAPPER_DISPLAY_FULL <= m_display && BAL_INFO_RESTART_PROMPT >= m_BalInfoCommand.restart; if (fRestartRequired && !fShouldBlockRestart) { @@ -976,6 +977,22 @@ public: // IBootstrapperApplication return S_OK; } +public: //CBalBaseBootstrapperApplication + virtual STDMETHODIMP Initialize( + __in const BOOTSTRAPPER_CREATE_ARGS* pCreateArgs + ) + { + HRESULT hr = S_OK; + + m_display = pCreateArgs->pCommand->display; + + hr = BalInfoParseCommandLine(&m_BalInfoCommand, pCreateArgs->pCommand); + BalExitOnFailure(hr, "Failed to parse command line with balutil."); + + LExit: + return hr; + } + protected: // // PromptCancel - prompts the user to close (if not forced). @@ -1029,20 +1046,19 @@ protected: CBalBaseBootstrapperApplication( __in IBootstrapperEngine* pEngine, - __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, __in DWORD dwRetryCount = 0, __in DWORD dwRetryTimeout = 1000 ) { m_cReferences = 1; - m_display = pArgs->pCommand->display; - m_restart = pArgs->pCommand->restart; + m_display = BOOTSTRAPPER_DISPLAY_UNKNOWN; pEngine->AddRef(); m_pEngine = pEngine; ::InitializeCriticalSection(&m_csCanceled); m_fCanceled = FALSE; + m_BalInfoCommand = { }; m_fApplying = FALSE; m_fRollingBack = FALSE; @@ -1054,6 +1070,7 @@ protected: virtual ~CBalBaseBootstrapperApplication() { + BalInfoUninitializeCommandLine(&m_BalInfoCommand); BalRetryUninitialize(); ::DeleteCriticalSection(&m_csCanceled); @@ -1064,10 +1081,11 @@ protected: CRITICAL_SECTION m_csCanceled; BOOL m_fCanceled; + BAL_INFO_COMMAND m_BalInfoCommand; + private: long m_cReferences; BOOTSTRAPPER_DISPLAY m_display; - BOOTSTRAPPER_RESTART m_restart; IBootstrapperEngine* m_pEngine; BOOL m_fApplying; -- cgit v1.2.3-55-g6feb