Bug 758998 - Use the correct installation directory when attempting to upgrade the maintenance service; r=bbondy

This commit is contained in:
Ehsan Akhgari 2012-05-29 17:31:04 -04:00
parent 6ebed5316f
commit 84a34d8b3f
4 changed files with 12 additions and 12 deletions

View File

@ -409,7 +409,7 @@ ProcessSoftwareUpdateCommand(DWORD argc, LPWSTR *argv)
// We might not execute code after StartServiceUpdate because
// the service installer will stop the service if it is running.
StartServiceUpdate(argc, argv);
StartServiceUpdate(installDir);
} else {
result = FALSE;
LOG(("Error running update process. Updating update.status"

View File

@ -184,17 +184,13 @@ LaunchWinPostProcess(const WCHAR *installationDir,
* Starts the upgrade process for update of the service if it is
* already installed.
*
* @param argc The argc value normally sent to updater.exe
* @param argv The argv value normally sent to updater.exe
* @param installDir the installation directory where
* maintenanceservice_installer.exe is located.
* @return TRUE if successful
*/
BOOL
StartServiceUpdate(int argc, LPWSTR *argv)
StartServiceUpdate(LPCWSTR installDir)
{
if (argc < 2) {
return FALSE;
}
// Get a handle to the local computer SCM database
SC_HANDLE manager = OpenSCManager(NULL, NULL,
SC_MANAGER_ALL_ACCESS);
@ -222,7 +218,7 @@ StartServiceUpdate(int argc, LPWSTR *argv)
PROCESS_INFORMATION pi = {0};
WCHAR maintserviceInstallerPath[MAX_PATH + 1];
wcscpy(maintserviceInstallerPath, argv[2]);
wcscpy(maintserviceInstallerPath, installDir);
PathAppendSafe(maintserviceInstallerPath,
L"maintenanceservice_installer.exe");
WCHAR cmdLine[64];
@ -231,7 +227,7 @@ StartServiceUpdate(int argc, LPWSTR *argv)
cmdLine,
NULL, NULL, FALSE,
0,
NULL, argv[2], &si, &pi);
NULL, installDir, &si, &pi);
if (svcUpdateProcessStarted) {
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);

View File

@ -6,7 +6,7 @@ BOOL LaunchWinPostProcess(const WCHAR *installationDir,
const WCHAR *updateInfoDir,
bool forceSync,
HANDLE userToken);
BOOL StartServiceUpdate(int argc, LPWSTR *argv);
BOOL StartServiceUpdate(LPCWSTR installDir);
BOOL GetUpdateDirectoryPath(LPWSTR path);
DWORD LaunchServiceSoftwareUpdateCommand(int argc, LPCWSTR *argv);
BOOL WriteStatusFailure(LPCWSTR updateDirPath, int errorCode);

View File

@ -2754,7 +2754,11 @@ int NS_main(int argc, NS_tchar **argv)
if (!LaunchWinPostProcess(argv[callbackIndex], gSourcePath, false, NULL)) {
LOG(("NS_main: The post update process could not be launched.\n"));
}
StartServiceUpdate(argc, argv);
NS_tchar installDir[MAXPATHLEN];
if (GetInstallationDir(installDir)) {
StartServiceUpdate(installDir);
}
}
}
EXIT_WHEN_ELEVATED(elevatedLockFilePath, updateLockFileHandle, 0);