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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 PLOG(DFATAL) << "GetPlatformFileInfo failed"; | 203 PLOG(DFATAL) << "GetPlatformFileInfo failed"; |
204 } | 204 } |
205 return result; | 205 return result; |
206 } | 206 } |
207 | 207 |
208 // Calls CreateProcess with good default parameters and waits for the process | 208 // Calls CreateProcess with good default parameters and waits for the process |
209 // to terminate returning the process exit code. | 209 // to terminate returning the process exit code. |
210 bool RunProcessAndWait(const wchar_t* exe_path, const std::wstring& cmdline, | 210 bool RunProcessAndWait(const wchar_t* exe_path, const std::wstring& cmdline, |
211 int* exit_code) { | 211 int* exit_code) { |
212 bool result = true; | 212 bool result = true; |
213 base::win::ScopedHandle process; | 213 base::ProcessHandle process; |
214 base::LaunchOptions options; | 214 base::LaunchOptions options; |
215 options.wait = true; | 215 options.wait = true; |
216 options.start_hidden = true; | 216 options.start_hidden = true; |
217 if (base::LaunchProcess(cmdline, options, &process)) { | 217 if (base::LaunchProcess(cmdline, options, &process)) { |
218 if (exit_code) { | 218 if (exit_code) { |
219 if (!GetExitCodeProcess(process.Get(), | 219 if (!GetExitCodeProcess(process, |
220 reinterpret_cast<DWORD*>(exit_code))) { | 220 reinterpret_cast<DWORD*>(exit_code))) { |
221 PLOG(DFATAL) << "Failed getting the exit code for \"" | 221 PLOG(DFATAL) << "Failed getting the exit code for \"" |
222 << cmdline << "\"."; | 222 << cmdline << "\"."; |
223 result = false; | 223 result = false; |
224 } else { | 224 } else { |
225 DCHECK_NE(*exit_code, STILL_ACTIVE); | 225 DCHECK_NE(*exit_code, STILL_ACTIVE); |
226 } | 226 } |
227 } | 227 } |
228 } else { | 228 } else { |
229 result = false; | 229 result = false; |
230 } | 230 } |
231 | 231 |
| 232 CloseHandle(process); |
232 return result; | 233 return result; |
233 } | 234 } |
234 | 235 |
235 // Retrieves the version number of |pe_file| from its version | 236 // Retrieves the version number of |pe_file| from its version |
236 // resource, placing the value in |version|. Returns true on success. | 237 // resource, placing the value in |version|. Returns true on success. |
237 bool GetFileVersion(const base::FilePath& pe_file, ChromeVersion* version) { | 238 bool GetFileVersion(const base::FilePath& pe_file, ChromeVersion* version) { |
238 DCHECK(version); | 239 DCHECK(version); |
239 bool result = false; | 240 bool result = false; |
240 upgrade_test::ResourceLoader pe_file_loader; | 241 upgrade_test::ResourceLoader pe_file_loader; |
241 std::pair<const uint8*, DWORD> version_info_data; | 242 std::pair<const uint8*, DWORD> version_info_data; |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 return false; | 693 return false; |
693 } | 694 } |
694 ctx.current_version_str = ctx.current_version.ToString(); | 695 ctx.current_version_str = ctx.current_version.ToString(); |
695 ctx.new_version = ChromeVersion::FromString(version.GetString()); | 696 ctx.new_version = ChromeVersion::FromString(version.GetString()); |
696 ctx.new_version_str = ctx.new_version.ToString(); | 697 ctx.new_version_str = ctx.new_version.ToString(); |
697 | 698 |
698 return UpdateVersionIfMatch(target_file, &ctx); | 699 return UpdateVersionIfMatch(target_file, &ctx); |
699 } | 700 } |
700 | 701 |
701 } // namespace upgrade_test | 702 } // namespace upgrade_test |
OLD | NEW |