OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // The file contains the implementation of the mini_installer re-versioner. | 5 // The file contains the implementation of the mini_installer re-versioner. |
6 // The main function (GenerateNextVersion) does the following in a temp dir: | 6 // The main function (GenerateNextVersion) does the following in a temp dir: |
7 // - Extracts and unpacks setup.exe and the Chrome-bin folder from | 7 // - Extracts and unpacks setup.exe and the Chrome-bin folder from |
8 // mini_installer.exe. | 8 // mini_installer.exe. |
9 // - Inspects setup.exe to determine the current version. | 9 // - Inspects setup.exe to determine the current version. |
10 // - Runs through all .dll and .exe files: | 10 // - Runs through all .dll and .exe files: |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 } | 207 } |
208 file_ = file.Pass(); | 208 file_ = file.Pass(); |
209 return result; | 209 return result; |
210 } | 210 } |
211 | 211 |
212 // Calls CreateProcess with good default parameters and waits for the process | 212 // Calls CreateProcess with good default parameters and waits for the process |
213 // to terminate returning the process exit code. | 213 // to terminate returning the process exit code. |
214 bool RunProcessAndWait(const wchar_t* exe_path, const std::wstring& cmdline, | 214 bool RunProcessAndWait(const wchar_t* exe_path, const std::wstring& cmdline, |
215 int* exit_code) { | 215 int* exit_code) { |
216 bool result = true; | 216 bool result = true; |
217 base::win::ScopedHandle process; | |
218 base::LaunchOptions options; | 217 base::LaunchOptions options; |
219 options.wait = true; | 218 options.wait = true; |
220 options.start_hidden = true; | 219 options.start_hidden = true; |
221 if (base::LaunchProcess(cmdline, options, &process)) { | 220 base::Process process = base::LaunchProcess(cmdline, options); |
| 221 if (process.IsValid()) { |
222 if (exit_code) { | 222 if (exit_code) { |
223 if (!GetExitCodeProcess(process.Get(), | 223 if (!GetExitCodeProcess(process.Handle(), |
224 reinterpret_cast<DWORD*>(exit_code))) { | 224 reinterpret_cast<DWORD*>(exit_code))) { |
225 PLOG(DFATAL) << "Failed getting the exit code for \"" | 225 PLOG(DFATAL) << "Failed getting the exit code for \"" |
226 << cmdline << "\"."; | 226 << cmdline << "\"."; |
227 result = false; | 227 result = false; |
228 } else { | 228 } else { |
229 DCHECK_NE(*exit_code, STILL_ACTIVE); | 229 DCHECK_NE(*exit_code, STILL_ACTIVE); |
230 } | 230 } |
231 } | 231 } |
232 } else { | 232 } else { |
233 result = false; | 233 result = false; |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 return false; | 691 return false; |
692 } | 692 } |
693 ctx.current_version_str = ctx.current_version.ToString(); | 693 ctx.current_version_str = ctx.current_version.ToString(); |
694 ctx.new_version = ChromeVersion::FromString(version.GetString()); | 694 ctx.new_version = ChromeVersion::FromString(version.GetString()); |
695 ctx.new_version_str = ctx.new_version.ToString(); | 695 ctx.new_version_str = ctx.new_version.ToString(); |
696 | 696 |
697 return UpdateVersionIfMatch(target_file, &ctx); | 697 return UpdateVersionIfMatch(target_file, &ctx); |
698 } | 698 } |
699 | 699 |
700 } // namespace upgrade_test | 700 } // namespace upgrade_test |
OLD | NEW |