diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/burn/engine/apply.cpp | 36 | ||||
| -rw-r--r-- | src/burn/engine/core.h | 2 | ||||
| -rw-r--r-- | src/burn/engine/uithread.cpp | 4 |
3 files changed, 27 insertions, 15 deletions
diff --git a/src/burn/engine/apply.cpp b/src/burn/engine/apply.cpp index d0db053a..41cb6ad4 100644 --- a/src/burn/engine/apply.cpp +++ b/src/burn/engine/apply.cpp | |||
| @@ -329,8 +329,7 @@ static HRESULT ReportOverallProgressTicks( | |||
| 329 | __in BURN_APPLY_CONTEXT* pApplyContext | 329 | __in BURN_APPLY_CONTEXT* pApplyContext |
| 330 | ); | 330 | ); |
| 331 | static HRESULT ExecutePackageComplete( | 331 | static HRESULT ExecutePackageComplete( |
| 332 | __in BURN_USER_EXPERIENCE* pUX, | 332 | __in BURN_ENGINE_STATE* pEngineState, |
| 333 | __in BURN_VARIABLES* pVariables, | ||
| 334 | __in LPCWSTR wzPackageId, | 333 | __in LPCWSTR wzPackageId, |
| 335 | __in BOOL fPackageVital, | 334 | __in BOOL fPackageVital, |
| 336 | __in BOOL fAbandonedProcess, | 335 | __in BOOL fAbandonedProcess, |
| @@ -2400,8 +2399,6 @@ static HRESULT DoExecuteAction( | |||
| 2400 | ExitOnFailure(hr, "Failed to execute dependency action."); | 2399 | ExitOnFailure(hr, "Failed to execute dependency action."); |
| 2401 | break; | 2400 | break; |
| 2402 | 2401 | ||
| 2403 | break; | ||
| 2404 | |||
| 2405 | case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_START: __fallthrough; | 2402 | case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_START: __fallthrough; |
| 2406 | case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_END: | 2403 | case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_END: |
| 2407 | *ppCheckpoint = NULL; | 2404 | *ppCheckpoint = NULL; |
| @@ -2653,7 +2650,7 @@ LExit: | |||
| 2653 | if (fBeginCalled) | 2650 | if (fBeginCalled) |
| 2654 | { | 2651 | { |
| 2655 | pPackage->fAbandonedProcess = pContext->fAbandonedProcess; | 2652 | pPackage->fAbandonedProcess = pContext->fAbandonedProcess; |
| 2656 | hr = ExecutePackageComplete(&pEngineState->userExperience, &pEngineState->variables, pPackage->sczId, pPackage->fVital, pPackage->fAbandonedProcess, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); | 2653 | hr = ExecutePackageComplete(pEngineState, pPackage->sczId, pPackage->fVital, pPackage->fAbandonedProcess, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); |
| 2657 | } | 2654 | } |
| 2658 | 2655 | ||
| 2659 | return hr; | 2656 | return hr; |
| @@ -2778,7 +2775,7 @@ LExit: | |||
| 2778 | if (fBeginCalled) | 2775 | if (fBeginCalled) |
| 2779 | { | 2776 | { |
| 2780 | pPackage->fAbandonedProcess = pContext->fAbandonedProcess; | 2777 | pPackage->fAbandonedProcess = pContext->fAbandonedProcess; |
| 2781 | hr = ExecutePackageComplete(&pEngineState->userExperience, &pEngineState->variables, pPackage->sczId, pPackage->fVital, pPackage->fAbandonedProcess, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); | 2778 | hr = ExecutePackageComplete(pEngineState, pPackage->sczId, pPackage->fVital, pPackage->fAbandonedProcess, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); |
| 2782 | } | 2779 | } |
| 2783 | 2780 | ||
| 2784 | return hr; | 2781 | return hr; |
| @@ -2858,7 +2855,7 @@ LExit: | |||
| 2858 | if (fBeginCalled) | 2855 | if (fBeginCalled) |
| 2859 | { | 2856 | { |
| 2860 | pPackage->fAbandonedProcess = pContext->fAbandonedProcess; | 2857 | pPackage->fAbandonedProcess = pContext->fAbandonedProcess; |
| 2861 | hr = ExecutePackageComplete(&pEngineState->userExperience, &pEngineState->variables, pPackage->sczId, pPackage->fVital, pPackage->fAbandonedProcess, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); | 2858 | hr = ExecutePackageComplete(pEngineState, pPackage->sczId, pPackage->fVital, pPackage->fAbandonedProcess, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); |
| 2862 | } | 2859 | } |
| 2863 | 2860 | ||
| 2864 | return hr; | 2861 | return hr; |
| @@ -2923,7 +2920,7 @@ LExit: | |||
| 2923 | if (fBeginCalled) | 2920 | if (fBeginCalled) |
| 2924 | { | 2921 | { |
| 2925 | Assert(!pContext->fAbandonedProcess); | 2922 | Assert(!pContext->fAbandonedProcess); |
| 2926 | hr = ExecutePackageComplete(&pEngineState->userExperience, &pEngineState->variables, pPackage->sczId, pPackage->fVital, FALSE, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); | 2923 | hr = ExecutePackageComplete(pEngineState, pPackage->sczId, pPackage->fVital, FALSE, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); |
| 2927 | } | 2924 | } |
| 2928 | 2925 | ||
| 2929 | return hr; | 2926 | return hr; |
| @@ -2997,7 +2994,7 @@ LExit: | |||
| 2997 | if (fBeginCalled) | 2994 | if (fBeginCalled) |
| 2998 | { | 2995 | { |
| 2999 | Assert(!pContext->fAbandonedProcess); | 2996 | Assert(!pContext->fAbandonedProcess); |
| 3000 | hr = ExecutePackageComplete(&pEngineState->userExperience, &pEngineState->variables, pPackage->sczId, pPackage->fVital, FALSE, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); | 2997 | hr = ExecutePackageComplete(pEngineState, pPackage->sczId, pPackage->fVital, FALSE, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); |
| 3001 | } | 2998 | } |
| 3002 | 2999 | ||
| 3003 | return hr; | 3000 | return hr; |
| @@ -3078,7 +3075,7 @@ LExit: | |||
| 3078 | if (fBeginCalled) | 3075 | if (fBeginCalled) |
| 3079 | { | 3076 | { |
| 3080 | pPackage->fAbandonedProcess = pContext->fAbandonedProcess; | 3077 | pPackage->fAbandonedProcess = pContext->fAbandonedProcess; |
| 3081 | hr = ExecutePackageComplete(&pEngineState->userExperience, &pEngineState->variables, pPackage->sczId, pPackage->fVital, pPackage->fAbandonedProcess, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); | 3078 | hr = ExecutePackageComplete(pEngineState, pPackage->sczId, pPackage->fVital, pPackage->fAbandonedProcess, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); |
| 3082 | } | 3079 | } |
| 3083 | 3080 | ||
| 3084 | return hr; | 3081 | return hr; |
| @@ -3398,7 +3395,7 @@ LExit: | |||
| 3398 | if (fBeginCalled) | 3395 | if (fBeginCalled) |
| 3399 | { | 3396 | { |
| 3400 | Assert(!pContext->fAbandonedProcess); | 3397 | Assert(!pContext->fAbandonedProcess); |
| 3401 | hr = ExecutePackageComplete(&pEngineState->userExperience, &pEngineState->variables, pContext->wzExecutingPackageId, FALSE, FALSE, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); | 3398 | hr = ExecutePackageComplete(pEngineState, pContext->wzExecutingPackageId, FALSE, FALSE, hr, hrExecute, fRollback, pRestart, pfRetry, pfSuspend); |
| 3402 | } | 3399 | } |
| 3403 | 3400 | ||
| 3404 | return hr; | 3401 | return hr; |
| @@ -3574,8 +3571,7 @@ static HRESULT ReportOverallProgressTicks( | |||
| 3574 | } | 3571 | } |
| 3575 | 3572 | ||
| 3576 | static HRESULT ExecutePackageComplete( | 3573 | static HRESULT ExecutePackageComplete( |
| 3577 | __in BURN_USER_EXPERIENCE* pUX, | 3574 | __in BURN_ENGINE_STATE* pEngineState, |
| 3578 | __in BURN_VARIABLES* pVariables, | ||
| 3579 | __in LPCWSTR wzPackageId, | 3575 | __in LPCWSTR wzPackageId, |
| 3580 | __in BOOL fPackageVital, | 3576 | __in BOOL fPackageVital, |
| 3581 | __in BOOL fAbandonedProcess, | 3577 | __in BOOL fAbandonedProcess, |
| @@ -3589,6 +3585,13 @@ static HRESULT ExecutePackageComplete( | |||
| 3589 | { | 3585 | { |
| 3590 | HRESULT hr = FAILED(hrOverall) ? hrOverall : hrExecute; // if the overall function failed use that otherwise use the execution result. | 3586 | HRESULT hr = FAILED(hrOverall) ? hrOverall : hrExecute; // if the overall function failed use that otherwise use the execution result. |
| 3591 | BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION executePackageCompleteAction = FAILED(hrOverall) || SUCCEEDED(hrExecute) || fPackageVital ? BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_NONE : BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_IGNORE; | 3587 | BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION executePackageCompleteAction = FAILED(hrOverall) || SUCCEEDED(hrExecute) || fPackageVital ? BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_NONE : BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_IGNORE; |
| 3588 | BURN_USER_EXPERIENCE* pUX = &pEngineState->userExperience; | ||
| 3589 | BURN_VARIABLES* pVariables = &pEngineState->variables; | ||
| 3590 | |||
| 3591 | if (pEngineState->fCriticalShutdownInitiated) | ||
| 3592 | { | ||
| 3593 | *pRestart = BOOTSTRAPPER_APPLY_RESTART_INITIATED; | ||
| 3594 | } | ||
| 3592 | 3595 | ||
| 3593 | // Send package execute complete to BA. | 3596 | // Send package execute complete to BA. |
| 3594 | UserExperienceOnExecutePackageComplete(pUX, wzPackageId, hr, *pRestart, &executePackageCompleteAction); | 3597 | UserExperienceOnExecutePackageComplete(pUX, wzPackageId, hr, *pRestart, &executePackageCompleteAction); |
| @@ -3596,12 +3599,15 @@ static HRESULT ExecutePackageComplete( | |||
| 3596 | { | 3599 | { |
| 3597 | *pRestart = BOOTSTRAPPER_APPLY_RESTART_INITIATED; | 3600 | *pRestart = BOOTSTRAPPER_APPLY_RESTART_INITIATED; |
| 3598 | } | 3601 | } |
| 3599 | *pfRetry = (FAILED(hrExecute) && BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_RETRY == executePackageCompleteAction && !fAbandonedProcess); // allow retry only on failures. | 3602 | *pfRetry = (BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_RETRY == executePackageCompleteAction && |
| 3603 | FAILED(hrExecute) && !fAbandonedProcess && BOOTSTRAPPER_APPLY_RESTART_INITIATED != *pRestart); // allow retry only on non-fatal failures. | ||
| 3600 | *pfSuspend = (BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_SUSPEND == executePackageCompleteAction); | 3604 | *pfSuspend = (BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_SUSPEND == executePackageCompleteAction); |
| 3601 | 3605 | ||
| 3602 | // Remember this package as the package that initiated the forced restart. | 3606 | // Remember this package as the package that initiated the forced restart. |
| 3603 | if (BOOTSTRAPPER_APPLY_RESTART_INITIATED == *pRestart) | 3607 | if (BOOTSTRAPPER_APPLY_RESTART_INITIATED == *pRestart && !pEngineState->wzRestartInitiatedPackageId) |
| 3604 | { | 3608 | { |
| 3609 | pEngineState->wzRestartInitiatedPackageId = wzPackageId; | ||
| 3610 | |||
| 3605 | // Best effort to set the forced restart package variable. | 3611 | // Best effort to set the forced restart package variable. |
| 3606 | VariableSetString(pVariables, BURN_BUNDLE_FORCED_RESTART_PACKAGE, wzPackageId, TRUE, FALSE); | 3612 | VariableSetString(pVariables, BURN_BUNDLE_FORCED_RESTART_PACKAGE, wzPackageId, TRUE, FALSE); |
| 3607 | } | 3613 | } |
diff --git a/src/burn/engine/core.h b/src/burn/engine/core.h index c04de20a..28d7ea78 100644 --- a/src/burn/engine/core.h +++ b/src/burn/engine/core.h | |||
| @@ -159,7 +159,9 @@ typedef struct _BURN_ENGINE_STATE | |||
| 159 | BURN_PIPE_CONNECTION companionConnection; | 159 | BURN_PIPE_CONNECTION companionConnection; |
| 160 | BURN_PIPE_CONNECTION embeddedConnection; | 160 | BURN_PIPE_CONNECTION embeddedConnection; |
| 161 | 161 | ||
| 162 | BOOL fCriticalShutdownInitiated; | ||
| 162 | BURN_RESUME_MODE resumeMode; | 163 | BURN_RESUME_MODE resumeMode; |
| 164 | LPCWSTR wzRestartInitiatedPackageId; | ||
| 163 | 165 | ||
| 164 | BURN_ENGINE_COMMAND internalCommand; | 166 | BURN_ENGINE_COMMAND internalCommand; |
| 165 | } BURN_ENGINE_STATE; | 167 | } BURN_ENGINE_STATE; |
diff --git a/src/burn/engine/uithread.cpp b/src/burn/engine/uithread.cpp index 187f3349..bb1e5972 100644 --- a/src/burn/engine/uithread.cpp +++ b/src/burn/engine/uithread.cpp | |||
| @@ -18,6 +18,7 @@ struct UITHREAD_INFO | |||
| 18 | { | 18 | { |
| 19 | BOOL fElevatedEngine; | 19 | BOOL fElevatedEngine; |
| 20 | BURN_USER_EXPERIENCE* pUserExperience; | 20 | BURN_USER_EXPERIENCE* pUserExperience; |
| 21 | BOOL* pfCriticalShutdownInitiated; | ||
| 21 | }; | 22 | }; |
| 22 | 23 | ||
| 23 | 24 | ||
| @@ -132,6 +133,7 @@ static DWORD WINAPI ThreadProc( | |||
| 132 | 133 | ||
| 133 | info.fElevatedEngine = fElevatedEngine; | 134 | info.fElevatedEngine = fElevatedEngine; |
| 134 | info.pUserExperience = &pEngineState->userExperience; | 135 | info.pUserExperience = &pEngineState->userExperience; |
| 136 | info.pfCriticalShutdownInitiated = &pEngineState->fCriticalShutdownInitiated; | ||
| 135 | 137 | ||
| 136 | // Create the window to handle reboots without activating it. | 138 | // Create the window to handle reboots without activating it. |
| 137 | hWnd = ::CreateWindowExW(WS_EX_NOACTIVATE, wc.lpszClassName, NULL, WS_POPUP, 0, 0, 0, 0, HWND_DESKTOP, NULL, pContext->hInstance, &info); | 139 | hWnd = ::CreateWindowExW(WS_EX_NOACTIVATE, wc.lpszClassName, NULL, WS_POPUP, 0, 0, 0, 0, HWND_DESKTOP, NULL, pContext->hInstance, &info); |
| @@ -208,6 +210,8 @@ static LRESULT CALLBACK WndProc( | |||
| 208 | UserExperienceOnSystemShutdown(pInfo->pUserExperience, dwEndSession, &fCancel); | 210 | UserExperienceOnSystemShutdown(pInfo->pUserExperience, dwEndSession, &fCancel); |
| 209 | } | 211 | } |
| 210 | 212 | ||
| 213 | *pInfo->pfCriticalShutdownInitiated |= fCritical; | ||
| 214 | |||
| 211 | fRet = !fCancel; | 215 | fRet = !fCancel; |
| 212 | LogId(REPORT_STANDARD, MSG_SYSTEM_SHUTDOWN, LoggingBoolToString(fCritical), LoggingBoolToString(pInfo->fElevatedEngine), LoggingBoolToString(fRet)); | 216 | LogId(REPORT_STANDARD, MSG_SYSTEM_SHUTDOWN, LoggingBoolToString(fCritical), LoggingBoolToString(pInfo->fElevatedEngine), LoggingBoolToString(fRet)); |
| 213 | return fRet; | 217 | return fRet; |
