summaryrefslogtreecommitdiff
path: root/src/burn/engine/msuengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/burn/engine/msuengine.cpp')
-rw-r--r--src/burn/engine/msuengine.cpp32
1 files changed, 2 insertions, 30 deletions
diff --git a/src/burn/engine/msuengine.cpp b/src/burn/engine/msuengine.cpp
index 091bbe62..2f1fb61c 100644
--- a/src/burn/engine/msuengine.cpp
+++ b/src/burn/engine/msuengine.cpp
@@ -264,7 +264,6 @@ extern "C" HRESULT MsuEngineExecutePackage(
264 ) 264 )
265{ 265{
266 HRESULT hr = S_OK; 266 HRESULT hr = S_OK;
267 int nResult = IDNOACTION;
268 LPWSTR sczCachedDirectory = NULL; 267 LPWSTR sczCachedDirectory = NULL;
269 LPWSTR sczMsuPath = NULL; 268 LPWSTR sczMsuPath = NULL;
270 LPWSTR sczWindowsPath = NULL; 269 LPWSTR sczWindowsPath = NULL;
@@ -350,35 +349,8 @@ extern "C" HRESULT MsuEngineExecutePackage(
350 hr = EnsureWUServiceEnabled(fStopWusaService, &schWu, &fWuWasDisabled); 349 hr = EnsureWUServiceEnabled(fStopWusaService, &schWu, &fWuWasDisabled);
351 ExitOnFailure(hr, "Failed to ensure WU service was enabled to install MSU package."); 350 ExitOnFailure(hr, "Failed to ensure WU service was enabled to install MSU package.");
352 351
353 // create process 352 hr = ExeEngineRunProcess(pfnGenericMessageHandler, pvContext, pPackage, sczWusaPath, sczCommand, NULL, &dwExitCode);
354 si.cb = sizeof(si); 353 ExitOnFailure(hr, "Failed to run MSU process");
355 if (!::CreateProcessW(sczWusaPath, sczCommand, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi))
356 {
357 ExitWithLastError(hr, "Failed to CreateProcess on path: %ls", sczWusaPath);
358 }
359
360 do
361 {
362 message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS;
363 message.dwUIHint = MB_OKCANCEL;
364 message.progress.dwPercentage = 50;
365 nResult = pfnGenericMessageHandler(&message, pvContext);
366 hr = (IDOK == nResult || IDNOACTION == nResult) ? S_OK : IDCANCEL == nResult ? HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT) : HRESULT_FROM_WIN32(ERROR_INSTALL_FAILURE);
367 ExitOnRootFailure(hr, "Bootstrapper application aborted during MSU progress.");
368
369 // wait for process to terminate
370 hr = ProcWaitForCompletion(pi.hProcess, 500, &dwExitCode);
371 if (HRESULT_FROM_WIN32(WAIT_TIMEOUT) != hr)
372 {
373 ExitOnFailure(hr, "Failed to wait for executable to complete: %ls", sczWusaPath);
374 }
375 } while (HRESULT_FROM_WIN32(WAIT_TIMEOUT) == hr);
376
377 // get process exit code
378 if (!::GetExitCodeProcess(pi.hProcess, &dwExitCode))
379 {
380 ExitWithLastError(hr, "Failed to get process exit code.");
381 }
382 354
383 // We'll normalize the restart required error code from wusa.exe just in case. Most likely 355 // We'll normalize the restart required error code from wusa.exe just in case. Most likely
384 // that on reboot we'll actually get WU_S_REBOOT_REQUIRED. 356 // that on reboot we'll actually get WU_S_REBOOT_REQUIRED.