| 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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 return false; | 745 return false; |
| 746 } | 746 } |
| 747 | 747 |
| 748 return true; | 748 return true; |
| 749 } | 749 } |
| 750 | 750 |
| 751 // Main function. First gets a working dir, unpacks the resources and finally | 751 // Main function. First gets a working dir, unpacks the resources and finally |
| 752 // executes setup.exe to do the install/upgrade. | 752 // executes setup.exe to do the install/upgrade. |
| 753 int WMain(HMODULE module) { | 753 int WMain(HMODULE module) { |
| 754 #if defined(COMPONENT_BUILD) | 754 #if defined(COMPONENT_BUILD) |
| 755 static const wchar_t kComponentBuildIncompatibleMessage[] = | 755 if (::GetEnvironmentVariable(L"MINI_INSTALLER_TEST", NULL, 0) == 0) { |
| 756 L"mini_installer.exe is incompatible with the component build, please run" | 756 static const wchar_t kComponentBuildIncompatibleMessage[] = |
| 757 L" setup.exe with the same command line instead. See" | 757 L"mini_installer.exe is incompatible with the component build, please" |
| 758 L" http://crbug.com/127233#c17 for details."; | 758 L" run setup.exe with the same command line instead. See" |
| 759 ::MessageBox(NULL, kComponentBuildIncompatibleMessage, NULL, MB_ICONERROR); | 759 L" http://crbug.com/127233#c17 for details."; |
| 760 return 1; | 760 ::MessageBox(NULL, kComponentBuildIncompatibleMessage, NULL, MB_ICONERROR); |
| 761 return 1; |
| 762 } |
| 761 #endif | 763 #endif |
| 762 | 764 |
| 763 // Always start with deleting potential leftovers from previous installations. | 765 // Always start with deleting potential leftovers from previous installations. |
| 764 // This can make the difference between success and failure. We've seen | 766 // This can make the difference between success and failure. We've seen |
| 765 // many installations out in the field fail due to out of disk space problems | 767 // many installations out in the field fail due to out of disk space problems |
| 766 // so this could buy us some space. | 768 // so this could buy us some space. |
| 767 DeleteOldChromeTempDirectories(); | 769 DeleteOldChromeTempDirectories(); |
| 768 | 770 |
| 769 // TODO(grt): Make the exit codes more granular so we know where the popular | 771 // TODO(grt): Make the exit codes more granular so we know where the popular |
| 770 // errors truly are. | 772 // errors truly are. |
| 771 int exit_code = 101; | 773 int exit_code = 101; |
| 772 | 774 |
| 773 // Parse the command line. | 775 // Parse the command line. |
| 774 Configuration configuration; | 776 Configuration configuration; |
| 775 if (!configuration.Initialize()) | 777 if (!configuration.Initialize()) |
| 776 return exit_code; | 778 return exit_code; |
| 777 | 779 |
| 780 if (configuration.query_component_build()) { |
| 781 // Exit immediately with an exit code of 1 to indicate component build and 0 |
| 782 // to indicate static build. This is used by the tests in |
| 783 // /src/chrome/test/mini_installer/. |
| 784 #if defined(COMPONENT_BUILD) |
| 785 return 1; |
| 786 #else |
| 787 return 0; |
| 788 #endif |
| 789 } |
| 790 |
| 778 // If the --cleanup switch was specified on the command line, then that means | 791 // If the --cleanup switch was specified on the command line, then that means |
| 779 // we should only do the cleanup and then exit. | 792 // we should only do the cleanup and then exit. |
| 780 if (ProcessNonInstallOperations(configuration, &exit_code)) | 793 if (ProcessNonInstallOperations(configuration, &exit_code)) |
| 781 return exit_code; | 794 return exit_code; |
| 782 | 795 |
| 783 // First get a path where we can extract payload | 796 // First get a path where we can extract payload |
| 784 PathString base_path; | 797 PathString base_path; |
| 785 if (!GetWorkDir(module, &base_path)) | 798 if (!GetWorkDir(module, &base_path)) |
| 786 return 101; | 799 return 101; |
| 787 | 800 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 case 1: | 866 case 1: |
| 854 dest8[count - 1] = c; | 867 dest8[count - 1] = c; |
| 855 } | 868 } |
| 856 | 869 |
| 857 while (adjcount-- > 0) // Copy the rest, 4 bytes/32 bits at a time | 870 while (adjcount-- > 0) // Copy the rest, 4 bytes/32 bits at a time |
| 858 *(dest32++) = fill; | 871 *(dest32++) = fill; |
| 859 | 872 |
| 860 return dest; | 873 return dest; |
| 861 } | 874 } |
| 862 } // extern "C" | 875 } // extern "C" |
| OLD | NEW |