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