| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // mini_installer.exe is the first exe that is run when chrome is being | 5 // mini_installer.exe is the first exe that is run when chrome is being |
| 6 // installed or upgraded. It is designed to be extremely small (~5KB with no | 6 // installed or upgraded. It is designed to be extremely small (~5KB with no |
| 7 // extra resources linked) and it has two main jobs: | 7 // extra resources linked) and it has two main jobs: |
| 8 // 1) unpack the resources (possibly decompressing some) | 8 // 1) unpack the resources (possibly decompressing some) |
| 9 // 2) run the real installer (setup.exe) with appropriate flags. | 9 // 2) run the real installer (setup.exe) with appropriate flags. |
| 10 // | 10 // |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 // We need a chrome archive to do the installation. So if there | 398 // We need a chrome archive to do the installation. So if there |
| 399 // is a problem in fetching B7 resource, just return an error. | 399 // is a problem in fetching B7 resource, just return an error. |
| 400 if (!::EnumResourceNames(module, kLZMAResourceType, OnResourceFound, | 400 if (!::EnumResourceNames(module, kLZMAResourceType, OnResourceFound, |
| 401 reinterpret_cast<LONG_PTR>(&context)) || | 401 reinterpret_cast<LONG_PTR>(&context)) || |
| 402 archive_path->length() == 0) | 402 archive_path->length() == 0) |
| 403 return false; | 403 return false; |
| 404 | 404 |
| 405 // If we found setup 'B7' resource, handle it. | 405 // If we found setup 'B7' resource, handle it. |
| 406 if (setup_path->length() > 0) { | 406 if (setup_path->length() > 0) { |
| 407 CommandString cmd_line; | 407 CommandString cmd_line; |
| 408 PathString exe_path; |
| 408 // Get the path to setup.exe first. | 409 // Get the path to setup.exe first. |
| 409 bool success = true; | 410 bool success = true; |
| 410 if (!GetSetupExePathFromRegistry(configuration, cmd_line.get(), | 411 if (!GetSetupExePathFromRegistry(configuration, exe_path.get(), |
| 411 cmd_line.capacity()) || | 412 exe_path.capacity()) || |
| 413 !cmd_line.append(exe_path.get()) || |
| 412 !cmd_line.append(L" --") || | 414 !cmd_line.append(L" --") || |
| 413 !cmd_line.append(kCmdUpdateSetupExe) || | 415 !cmd_line.append(kCmdUpdateSetupExe) || |
| 414 !cmd_line.append(L"=\"") || | 416 !cmd_line.append(L"=\"") || |
| 415 !cmd_line.append(setup_path->get()) || | 417 !cmd_line.append(setup_path->get()) || |
| 416 !cmd_line.append(L"\" --") || | 418 !cmd_line.append(L"\" --") || |
| 417 !cmd_line.append(kCmdNewSetupExe) || | 419 !cmd_line.append(kCmdNewSetupExe) || |
| 418 !cmd_line.append(L"=\"") || | 420 !cmd_line.append(L"=\"") || |
| 419 !cmd_line.append(setup_dest_path.get()) || | 421 !cmd_line.append(setup_dest_path.get()) || |
| 420 !cmd_line.append(L"\"")) { | 422 !cmd_line.append(L"\"")) { |
| 421 success = false; | 423 success = false; |
| 422 } | 424 } |
| 423 | 425 |
| 424 // Get any command line option specified for mini_installer and pass them | 426 // Get any command line option specified for mini_installer and pass them |
| 425 // on to setup.exe. This is important since switches such as | 427 // on to setup.exe. This is important since switches such as |
| 426 // --multi-install and --chrome-frame affect where setup.exe will write | 428 // --multi-install and --chrome-frame affect where setup.exe will write |
| 427 // installer results for consumption by Google Update. | 429 // installer results for consumption by Google Update. |
| 428 AppendCommandLineFlags(configuration, &cmd_line); | 430 AppendCommandLineFlags(configuration, &cmd_line); |
| 429 | 431 |
| 430 ProcessExitCode exit_code = SUCCESS_EXIT_CODE; | 432 ProcessExitCode exit_code = SUCCESS_EXIT_CODE; |
| 431 if (success && | 433 if (success && |
| 432 (!RunProcessAndWait(NULL, cmd_line.get(), &exit_code) || | 434 (!RunProcessAndWait(exe_path.get(), cmd_line.get(), &exit_code) || |
| 433 exit_code != SUCCESS_EXIT_CODE)) { | 435 exit_code != SUCCESS_EXIT_CODE)) { |
| 434 success = false; | 436 success = false; |
| 435 } | 437 } |
| 436 | 438 |
| 437 if (!success) | 439 if (!success) |
| 438 DeleteFile(setup_path->get()); | 440 DeleteFile(setup_path->get()); |
| 439 | 441 |
| 440 return success && setup_path->assign(setup_dest_path.get()); | 442 return success && setup_path->assign(setup_dest_path.get()); |
| 441 } | 443 } |
| 442 | 444 |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 #pragma function(memset) | 855 #pragma function(memset) |
| 854 void* memset(void* dest, int c, size_t count) { | 856 void* memset(void* dest, int c, size_t count) { |
| 855 void* start = dest; | 857 void* start = dest; |
| 856 while (count--) { | 858 while (count--) { |
| 857 *reinterpret_cast<char*>(dest) = static_cast<char>(c); | 859 *reinterpret_cast<char*>(dest) = static_cast<char>(c); |
| 858 dest = reinterpret_cast<char*>(dest) + 1; | 860 dest = reinterpret_cast<char*>(dest) + 1; |
| 859 } | 861 } |
| 860 return start; | 862 return start; |
| 861 } | 863 } |
| 862 } // extern "C" | 864 } // extern "C" |
| OLD | NEW |