From 95e8b1be902cce3b5a394066a62e0c32d0688261 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Thu, 15 Sep 2022 12:17:07 -0500 Subject: Add more burn E2E tests. Fix bug where first splash screen wasn't closed. Fix bug where billboard only started the first time. Fix bug where the restart status was lost when the exit code was an error. Fix bug where the hash byte array length was compared to the hash string length (string is twice as long). Fix bug where Burn didn't give update hash if the first byte was 0. --- src/burn/engine/apply.cpp | 23 +++++++++++++++++++++-- src/burn/engine/detect.cpp | 11 ++++++++--- src/burn/engine/engine.mc | 2 +- src/burn/engine/externalengine.cpp | 2 +- src/burn/engine/splashscreen.cpp | 6 ++++++ 5 files changed, 37 insertions(+), 7 deletions(-) (limited to 'src/burn') diff --git a/src/burn/engine/apply.cpp b/src/burn/engine/apply.cpp index e67208b4..8fbaa76e 100644 --- a/src/burn/engine/apply.cpp +++ b/src/burn/engine/apply.cpp @@ -2547,6 +2547,11 @@ static HRESULT DoExecuteAction( } while (fRetry && *pRestart < BOOTSTRAPPER_APPLY_RESTART_INITIATED); LExit: + if (*pRestart < restart) + { + *pRestart = restart; + } + return hr; } @@ -2561,6 +2566,7 @@ static HRESULT DoRollbackActions( DWORD iCheckpoint = 0; BOOL fRetryIgnored = FALSE; BOOL fSuspendIgnored = FALSE; + BOOTSTRAPPER_APPLY_RESTART restart = BOOTSTRAPPER_APPLY_RESTART_NONE; pContext->fRollback = TRUE; @@ -2598,7 +2604,8 @@ static HRESULT DoRollbackActions( continue; } - BOOTSTRAPPER_APPLY_RESTART restart = BOOTSTRAPPER_APPLY_RESTART_NONE; + restart = BOOTSTRAPPER_APPLY_RESTART_NONE; + switch (pRollbackAction->type) { case BURN_EXECUTE_ACTION_TYPE_CHECKPOINT: @@ -2674,6 +2681,11 @@ static HRESULT DoRollbackActions( } LExit: + if (*pRestart < restart) + { + *pRestart = restart; + } + return hr; } @@ -2791,6 +2803,7 @@ static HRESULT DoRestoreRelatedBundleActions( HRESULT hr = S_OK; BOOL fRetryIgnored = FALSE; BOOL fSuspendIgnored = FALSE; + BOOTSTRAPPER_APPLY_RESTART restart = BOOTSTRAPPER_APPLY_RESTART_NONE; // execute restore related bundle actions for (DWORD i = 0; i < pEngineState->plan.cRestoreRelatedBundleActions; ++i) @@ -2804,7 +2817,8 @@ static HRESULT DoRestoreRelatedBundleActions( pContext->wzExecutingPackageId = NULL; pContext->fAbandonedProcess = FALSE; - BOOTSTRAPPER_APPLY_RESTART restart = BOOTSTRAPPER_APPLY_RESTART_NONE; + restart = BOOTSTRAPPER_APPLY_RESTART_NONE; + switch (pRestoreRelatedBundleAction->type) { case BURN_EXECUTE_ACTION_TYPE_RELATED_BUNDLE: @@ -2824,6 +2838,11 @@ static HRESULT DoRestoreRelatedBundleActions( } LExit: + if (*pRestart < restart) + { + *pRestart = restart; + } + return hr; } diff --git a/src/burn/engine/detect.cpp b/src/burn/engine/detect.cpp index fcd1c966..f573e259 100644 --- a/src/burn/engine/detect.cpp +++ b/src/burn/engine/detect.cpp @@ -399,18 +399,23 @@ static HRESULT DetectAtomFeedUpdate( { APPLICATION_UPDATE_ENTRY* pAppUpdateEntry = &pApupChain->rgEntries[i]; APPLICATION_UPDATE_ENCLOSURE* pEnclosure = pAppUpdateEntry->rgEnclosures; + LPCWSTR wzHash = L""; + BOOTSTRAPPER_UPDATE_HASH_TYPE hashType = BOOTSTRAPPER_UPDATE_HASH_TYPE_NONE; - if (pEnclosure && pEnclosure->rgbDigest && *pEnclosure->rgbDigest) + if (pEnclosure && pEnclosure->rgbDigest && APUP_HASH_ALGORITHM_SHA512 == pEnclosure->digestAlgorithm) { hr = StrAllocHexEncode(pEnclosure->rgbDigest, pEnclosure->cbDigest, &sczHash); ExitOnFailure(hr, "Failed to encode hash as string."); + + wzHash = sczHash; + hashType = BOOTSTRAPPER_UPDATE_HASH_TYPE_SHA512; } hr = UserExperienceOnDetectUpdate(pUX, pEnclosure ? pEnclosure->wzUrl : NULL, pEnclosure ? pEnclosure->dw64Size : 0, - sczHash ? sczHash : L"", - pEnclosure ? pEnclosure->digestAlgorithm == APUP_HASH_ALGORITHM_SHA512 ? BOOTSTRAPPER_UPDATE_HASH_TYPE_SHA512 : BOOTSTRAPPER_UPDATE_HASH_TYPE_NONE : BOOTSTRAPPER_UPDATE_HASH_TYPE_NONE, + wzHash, + hashType, pAppUpdateEntry->pVersion, pAppUpdateEntry->wzTitle, pAppUpdateEntry->wzSummary, diff --git a/src/burn/engine/engine.mc b/src/burn/engine/engine.mc index d965d4ad..cebd1325 100644 --- a/src/burn/engine/engine.mc +++ b/src/burn/engine/engine.mc @@ -1006,7 +1006,7 @@ MessageId=366 Severity=Success SymbolicName=MSG_EXECUTE_PACKAGE_PROCESS_EXITED Language=English -The process for package: %1!ls! exited with code: %2!u!. The exit code has been translated to type: %3!hs! and restart: %4!hs!. +The process for package: %1!ls! exited with code: 0x%2!x!. The exit code has been translated to type: %3!hs! and restart: %4!hs!. . MessageId=370 diff --git a/src/burn/engine/externalengine.cpp b/src/burn/engine/externalengine.cpp index e18b9486..5e540c2a 100644 --- a/src/burn/engine/externalengine.cpp +++ b/src/burn/engine/externalengine.cpp @@ -296,7 +296,7 @@ HRESULT ExternalEngineSetUpdate( { ExitFunction1(hr = E_INVALIDARG); } - else if (BOOTSTRAPPER_UPDATE_HASH_TYPE_SHA512 == hashType && (!wzHash || !*wzHash || SHA512_HASH_LEN != lstrlenW(wzHash))) + else if (BOOTSTRAPPER_UPDATE_HASH_TYPE_SHA512 == hashType && (!wzHash || !*wzHash || SHA512_HASH_LEN * 2 != lstrlenW(wzHash))) { ExitFunction1(hr = E_INVALIDARG); } diff --git a/src/burn/engine/splashscreen.cpp b/src/burn/engine/splashscreen.cpp index d8618feb..b9dc9f55 100644 --- a/src/burn/engine/splashscreen.cpp +++ b/src/burn/engine/splashscreen.cpp @@ -221,6 +221,11 @@ LExit: ::DeleteObject(splashScreenInfo.hBitmap); } + if (splashScreenInfo.hwndPrevious) + { + ::PostMessageW(splashScreenInfo.hwndPrevious, WM_CLOSE, 0, 0); + } + return hr; } @@ -261,6 +266,7 @@ static LRESULT CALLBACK WndProc( return 1; case WM_ENTERIDLE: + case WM_MOVING: lres = ::DefWindowProcW(hWnd, uMsg, wParam, lParam); // We had to create our own splash screen so that Windows would automatically transfer focus from the other process's splash screen. -- cgit v1.2.3-55-g6feb