| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 options.start_hidden = true; | 219 options.start_hidden = true; |
| 220 base::Process process = base::LaunchProcess(cmdline, options); | 220 base::Process process = base::LaunchProcess(cmdline, options); |
| 221 if (process.IsValid()) { | 221 if (process.IsValid()) { |
| 222 if (exit_code) { | 222 if (exit_code) { |
| 223 if (!GetExitCodeProcess(process.Handle(), | 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, static_cast<int>(STILL_ACTIVE)); | 229 DCHECK_NE(*exit_code, STILL_ACTIVE); |
| 230 } | 230 } |
| 231 } | 231 } |
| 232 } else { | 232 } else { |
| 233 result = false; | 233 result = false; |
| 234 } | 234 } |
| 235 | 235 |
| 236 return result; | 236 return result; |
| 237 } | 237 } |
| 238 | 238 |
| 239 // Retrieves the version number of |pe_file| from its version | 239 // Retrieves the version number of |pe_file| from its version |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 if (!resource_loader.Initialize(mini_installer)) | 540 if (!resource_loader.Initialize(mini_installer)) |
| 541 return false; | 541 return false; |
| 542 | 542 |
| 543 // Write out setup.ex_ | 543 // Write out setup.ex_ |
| 544 if (!resource_loader.Load(&kSetupEx_[0], &kBl[0], &resource_data)) | 544 if (!resource_loader.Load(&kSetupEx_[0], &kBl[0], &resource_data)) |
| 545 return false; | 545 return false; |
| 546 int written = | 546 int written = |
| 547 base::WriteFile(setup_ex_, | 547 base::WriteFile(setup_ex_, |
| 548 reinterpret_cast<const char*>(resource_data.first), | 548 reinterpret_cast<const char*>(resource_data.first), |
| 549 static_cast<int>(resource_data.second)); | 549 static_cast<int>(resource_data.second)); |
| 550 if (written != static_cast<int>(resource_data.second)) { | 550 if (written != resource_data.second) { |
| 551 LOG(DFATAL) << "Failed writing \"" << setup_ex_.value() << "\""; | 551 LOG(DFATAL) << "Failed writing \"" << setup_ex_.value() << "\""; |
| 552 return false; | 552 return false; |
| 553 } | 553 } |
| 554 | 554 |
| 555 // Write out chrome.packed.7z | 555 // Write out chrome.packed.7z |
| 556 if (!resource_loader.Load(&kChromePacked7z[0], &kB7[0], &resource_data)) | 556 if (!resource_loader.Load(&kChromePacked7z[0], &kB7[0], &resource_data)) |
| 557 return false; | 557 return false; |
| 558 written = | 558 written = |
| 559 base::WriteFile(chrome_packed_7z, | 559 base::WriteFile(chrome_packed_7z, |
| 560 reinterpret_cast<const char*>(resource_data.first), | 560 reinterpret_cast<const char*>(resource_data.first), |
| 561 static_cast<int>(resource_data.second)); | 561 static_cast<int>(resource_data.second)); |
| 562 if (written != static_cast<int>(resource_data.second)) { | 562 if (written != resource_data.second) { |
| 563 LOG(DFATAL) << "Failed writing \"" << chrome_packed_7z.value() << "\""; | 563 LOG(DFATAL) << "Failed writing \"" << chrome_packed_7z.value() << "\""; |
| 564 return false; | 564 return false; |
| 565 } | 565 } |
| 566 } | 566 } |
| 567 | 567 |
| 568 // Expand setup.ex_ | 568 // Expand setup.ex_ |
| 569 base::FilePath setup_exe = setup_ex_.ReplaceExtension(&kExe[0]); | 569 base::FilePath setup_exe = setup_ex_.ReplaceExtension(&kExe[0]); |
| 570 std::wstring command_line; | 570 std::wstring command_line; |
| 571 command_line.append(1, L'"') | 571 command_line.append(1, L'"') |
| 572 .append(&kExpandExe[0]) | 572 .append(&kExpandExe[0]) |
| (...skipping 118 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 |