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 // Return whether this is a component build then exit. This is used by | |
grt (UTC plus 2)
2014/05/28 18:51:44
nit: returning is exiting. how about
// Exit i
robertshield
2014/05/28 21:27:30
Done.
| |
782 // the tests in /src/chrome/test/mini_installer/. | |
783 #if defined(COMPONENT_BUILD) | |
784 return 1; | |
785 #else | |
786 return 0; | |
787 #endif | |
788 } | |
789 | |
778 // If the --cleanup switch was specified on the command line, then that means | 790 // If the --cleanup switch was specified on the command line, then that means |
779 // we should only do the cleanup and then exit. | 791 // we should only do the cleanup and then exit. |
780 if (ProcessNonInstallOperations(configuration, &exit_code)) | 792 if (ProcessNonInstallOperations(configuration, &exit_code)) |
781 return exit_code; | 793 return exit_code; |
782 | 794 |
783 // First get a path where we can extract payload | 795 // First get a path where we can extract payload |
784 PathString base_path; | 796 PathString base_path; |
785 if (!GetWorkDir(module, &base_path)) | 797 if (!GetWorkDir(module, &base_path)) |
786 return 101; | 798 return 101; |
787 | 799 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
853 case 1: | 865 case 1: |
854 dest8[count - 1] = c; | 866 dest8[count - 1] = c; |
855 } | 867 } |
856 | 868 |
857 while (adjcount-- > 0) // Copy the rest, 4 bytes/32 bits at a time | 869 while (adjcount-- > 0) // Copy the rest, 4 bytes/32 bits at a time |
858 *(dest32++) = fill; | 870 *(dest32++) = fill; |
859 | 871 |
860 return dest; | 872 return dest; |
861 } | 873 } |
862 } // extern "C" | 874 } // extern "C" |
OLD | NEW |