From b6a7c60ef4ae81c6b92f82198c79f421e6557593 Mon Sep 17 00:00:00 2001 From: "Mook (sb)" Date: Thu, 22 Jan 2009 19:37:39 -0800 Subject: [PATCH] Bug 470946 - PostUpdateWin WinPostProcess should launch synchronously. r=rstrong --- toolkit/mozapps/update/src/updater/updater.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/toolkit/mozapps/update/src/updater/updater.cpp b/toolkit/mozapps/update/src/updater/updater.cpp index 6c7d5732a77..90f1fe08d09 100644 --- a/toolkit/mozapps/update/src/updater/updater.cpp +++ b/toolkit/mozapps/update/src/updater/updater.cpp @@ -1069,6 +1069,8 @@ LaunchWinPostProcess(const WCHAR *appExe) WCHAR exefile[MAXPATHLEN]; WCHAR exearg[MAXPATHLEN]; + WCHAR exeasync[10]; + PRBool async = PR_TRUE; if (!GetPrivateProfileStringW(L"PostUpdateWin", L"ExeRelPath", NULL, exefile, MAXPATHLEN, inifile)) @@ -1078,6 +1080,10 @@ LaunchWinPostProcess(const WCHAR *appExe) MAXPATHLEN, inifile)) return; + if (!GetPrivateProfileStringW(L"PostUpdateWin", L"ExeAsync", L"TRUE", exeasync, + sizeof(exeasync)/sizeof(exeasync[0]), inifile)) + return; + WCHAR exefullpath[MAXPATHLEN]; wcscpy(exefullpath, appExe); @@ -1104,6 +1110,9 @@ LaunchWinPostProcess(const WCHAR *appExe) wcscpy(cmdline, dummyArg); wcscat(cmdline, exearg); + if (!_wcsnicmp(exeasync, L"false", 6) || !_wcsnicmp(exeasync, L"0", 2)) + async = PR_FALSE; + // We want to launch the post update helper app to update the Windows // registry even if there is a failure with removing the uninstall.update // file or copying the update.log file. @@ -1126,6 +1135,9 @@ LaunchWinPostProcess(const WCHAR *appExe) free(cmdline); if (ok) { + if (!async) + WaitForSingleObject(pi.hProcess, INFINITE); + CloseHandle(pi.hProcess); CloseHandle(pi.hThread); }