| 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 // We need a chrome archive to do the installation. So if there | 395 // We need a chrome archive to do the installation. So if there |
| 396 // is a problem in fetching B7 resource, just return an error. | 396 // is a problem in fetching B7 resource, just return an error. |
| 397 if (!::EnumResourceNames(module, kLZMAResourceType, OnResourceFound, | 397 if (!::EnumResourceNames(module, kLZMAResourceType, OnResourceFound, |
| 398 reinterpret_cast<LONG_PTR>(&context)) || | 398 reinterpret_cast<LONG_PTR>(&context)) || |
| 399 archive_path->length() == 0) | 399 archive_path->length() == 0) |
| 400 return false; | 400 return false; |
| 401 | 401 |
| 402 // If we found setup 'B7' resource, handle it. | 402 // If we found setup 'B7' resource, handle it. |
| 403 if (setup_path->length() > 0) { | 403 if (setup_path->length() > 0) { |
| 404 CommandString cmd_line; | 404 CommandString cmd_line; |
| 405 PathString exe_path; |
| 405 // Get the path to setup.exe first. | 406 // Get the path to setup.exe first. |
| 406 bool success = true; | 407 bool success = true; |
| 407 if (!GetSetupExePathFromRegistry(configuration, cmd_line.get(), | 408 if (!GetSetupExePathFromRegistry(configuration, exe_path.get(), |
| 408 cmd_line.capacity()) || | 409 exe_path.capacity()) || |
| 410 !cmd_line.assign(exe_path.get()) || |
| 409 !cmd_line.append(kCmdUpdateSetupExe) || | 411 !cmd_line.append(kCmdUpdateSetupExe) || |
| 410 !cmd_line.append(L"=\"") || | 412 !cmd_line.append(L"=\"") || |
| 411 !cmd_line.append(setup_path->get()) || | 413 !cmd_line.append(setup_path->get()) || |
| 412 !cmd_line.append(L"\"") || | 414 !cmd_line.append(L"\"") || |
| 413 !cmd_line.append(kCmdNewSetupExe) || | 415 !cmd_line.append(kCmdNewSetupExe) || |
| 414 !cmd_line.append(L"=\"") || | 416 !cmd_line.append(L"=\"") || |
| 415 !cmd_line.append(setup_dest_path.get()) || | 417 !cmd_line.append(setup_dest_path.get()) || |
| 416 !cmd_line.append(L"\"")) { | 418 !cmd_line.append(L"\"")) { |
| 417 success = false; | 419 success = false; |
| 418 } | 420 } |
| 419 | 421 |
| 420 // Get any command line option specified for mini_installer and pass them | 422 // Get any command line option specified for mini_installer and pass them |
| 421 // on to setup.exe. This is important since switches such as | 423 // on to setup.exe. This is important since switches such as |
| 422 // --multi-install and --chrome-frame affect where setup.exe will write | 424 // --multi-install and --chrome-frame affect where setup.exe will write |
| 423 // installer results for consumption by Google Update. | 425 // installer results for consumption by Google Update. |
| 424 AppendCommandLineFlags(configuration, &cmd_line); | 426 AppendCommandLineFlags(configuration, &cmd_line); |
| 425 | 427 |
| 426 int exit_code = 0; | 428 int exit_code = 0; |
| 427 if (success && | 429 if (success && |
| 428 (!RunProcessAndWait(NULL, cmd_line.get(), &exit_code) || | 430 (!RunProcessAndWait(exe_path.get(), cmd_line.get(), &exit_code) || |
| 429 exit_code != ERROR_SUCCESS)) { | 431 exit_code != ERROR_SUCCESS)) { |
| 430 success = false; | 432 success = false; |
| 431 } | 433 } |
| 432 | 434 |
| 433 if (!success) | 435 if (!success) |
| 434 DeleteFile(setup_path->get()); | 436 DeleteFile(setup_path->get()); |
| 435 | 437 |
| 436 return success && setup_path->assign(setup_dest_path.get()); | 438 return success && setup_path->assign(setup_dest_path.get()); |
| 437 } | 439 } |
| 438 | 440 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 case 1: | 855 case 1: |
| 854 dest8[count - 1] = c; | 856 dest8[count - 1] = c; |
| 855 } | 857 } |
| 856 | 858 |
| 857 while (adjcount-- > 0) // Copy the rest, 4 bytes/32 bits at a time | 859 while (adjcount-- > 0) // Copy the rest, 4 bytes/32 bits at a time |
| 858 *(dest32++) = fill; | 860 *(dest32++) = fill; |
| 859 | 861 |
| 860 return dest; | 862 return dest; |
| 861 } | 863 } |
| 862 } // extern "C" | 864 } // extern "C" |
| OLD | NEW |