WIXFEAT:5267 - Skip bal:Conditions for special actions like layout.
Sean Hall committed
Dec 15, 2020 at 20:56 UTC
5f00aece054d074fc651e542432f349e3055f582
1 file changed
+41
-27
src/wixstdba/WixStandardBootstrapperApplication.cpp
+41
-27
@@ -311,11 +311,29 @@ public: // IBootstrapperApplication
311
)
312
{
313
HRESULT hr = S_OK;
314
-
315
- if (SUCCEEDED(hrStatus))
314
+ // If we're not interacting with the user or we're doing a layout or we're resuming just after a force restart
315
+ // then automatically start planning.
316
+ BOOL fSkipToPlan = SUCCEEDED(hrStatus) &&
317
+ (BOOTSTRAPPER_DISPLAY_FULL > m_command.display ||
318
+ BOOTSTRAPPER_ACTION_LAYOUT == m_command.action ||
319
+ BOOTSTRAPPER_RESUME_TYPE_REBOOT == m_command.resumeType);
320
+ // If we're requiring user input (which currently means Install, Repair, or Uninstall)
321
+ // or if we're skipping to an action that modifies machine state
322
+ // then evaluate conditions.
323
+ BOOL fEvaluateConditions = SUCCEEDED(hrStatus) &&
324
+ (!fSkipToPlan || BOOTSTRAPPER_ACTION_LAYOUT < m_command.action && BOOTSTRAPPER_ACTION_UPDATE_REPLACE > m_command.action);
325
+
326
+ if (fEvaluateConditions)
327
{
328
hrStatus = EvaluateConditions();
329
+ }
330
331
+ if (FAILED(hrStatus))
332
+ {
333
+ fSkipToPlan = FALSE;
334
+ }
335
+ else
336
+ {
337
if (m_fPrereq)
338
{
339
m_fPrereqAlreadyInstalled = TRUE;
@@ -336,32 +354,9 @@ public: // IBootstrapperApplication
354
355
SetState(WIXSTDBA_STATE_DETECTED, hrStatus);
356
339
- if (BOOTSTRAPPER_ACTION_CACHE == m_plannedAction)
340
- {
341
- if (m_fSupportCacheOnly)
342
- {
343
- // Doesn't make sense to prompt the user if cache only is requested.
344
- if (BOOTSTRAPPER_DISPLAY_PASSIVE < m_command.display)
345
- {
346
- m_command.display = BOOTSTRAPPER_DISPLAY_PASSIVE;
347
- }
348
-
349
- m_command.action = BOOTSTRAPPER_ACTION_CACHE;
350
- }
351
- else
352
- {
353
- BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Ignoring attempt to only cache a bundle that does not explicitly support it.");
354
- }
355
- }
356
-
357
- // If we're not interacting with the user or we're doing a layout or we're just after a force restart
358
- // then automatically start planning.
359
- if (BOOTSTRAPPER_DISPLAY_FULL > m_command.display || BOOTSTRAPPER_ACTION_LAYOUT == m_command.action || BOOTSTRAPPER_RESUME_TYPE_REBOOT == m_command.resumeType)
357
+ if (fSkipToPlan)
358
{
361
- if (SUCCEEDED(hrStatus))
362
- {
363
- ::PostMessageW(m_hWnd, WM_WIXSTDBA_PLAN_PACKAGES, 0, m_command.action);
364
- }
359
+ ::PostMessageW(m_hWnd, WM_WIXSTDBA_PLAN_PACKAGES, 0, m_command.action);
360
}
361
362
return hr;
@@ -2000,6 +1995,25 @@ private: // privates
1995
BalExitOnFailure(hr, "Failed to read bootstrapper application data.");
1996
}
1997
1998
+ if (BOOTSTRAPPER_ACTION_CACHE == m_plannedAction)
1999
+ {
2000
+ if (m_fSupportCacheOnly)
2001
+ {
2002
+ // Doesn't make sense to prompt the user if cache only is requested.
2003
+ if (BOOTSTRAPPER_DISPLAY_PASSIVE < m_command.display)
2004
+ {
2005
+ m_command.display = BOOTSTRAPPER_DISPLAY_PASSIVE;
2006
+ }
2007
+
2008
+ m_command.action = BOOTSTRAPPER_ACTION_CACHE;
2009
+ }
2010
+ else
2011
+ {
2012
+ BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Ignoring attempt to only cache a bundle that does not explicitly support it.");
2013
+ m_plannedAction = BOOTSTRAPPER_ACTION_UNKNOWN;
2014
+ }
2015
+ }
2016
+
2017
LExit:
2018
ReleaseObject(pixdManifest);
2019
ReleaseStr(sczModulePath);