| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 appropiate flags. | 9 // 2) run the real installer (setup.exe) with appropiate flags. |
| 10 // | 10 // |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 } | 498 } |
| 499 | 499 |
| 500 // Main function. First gets a working dir, unpacks the resources and finally | 500 // Main function. First gets a working dir, unpacks the resources and finally |
| 501 // executes setup.exe to do the install/upgrade. | 501 // executes setup.exe to do the install/upgrade. |
| 502 int WMain(HMODULE module) { | 502 int WMain(HMODULE module) { |
| 503 // First get a path where we can extract payload | 503 // First get a path where we can extract payload |
| 504 wchar_t base_path[MAX_PATH]; | 504 wchar_t base_path[MAX_PATH]; |
| 505 if (!GetWorkDir(module, base_path)) | 505 if (!GetWorkDir(module, base_path)) |
| 506 return 101; | 506 return 101; |
| 507 | 507 |
| 508 #if defined(GOOGLE_CHROME_BUILD) |
| 508 // Set the magic suffix in registry to try full installer next time. We ignore | 509 // Set the magic suffix in registry to try full installer next time. We ignore |
| 509 // any errors here and we try to set the suffix for user level as well as | 510 // any errors here and we try to set the suffix for user level as well as |
| 510 // system level. | 511 // system level. This only applies to Google Chrome distribution. |
| 511 SetFullInstallerFlag(HKEY_LOCAL_MACHINE); | 512 SetFullInstallerFlag(HKEY_LOCAL_MACHINE); |
| 512 SetFullInstallerFlag(HKEY_CURRENT_USER); | 513 SetFullInstallerFlag(HKEY_CURRENT_USER); |
| 514 #endif |
| 513 | 515 |
| 514 wchar_t archive_path[MAX_PATH] = {0}; | 516 wchar_t archive_path[MAX_PATH] = {0}; |
| 515 wchar_t setup_path[MAX_PATH] = {0}; | 517 wchar_t setup_path[MAX_PATH] = {0}; |
| 516 if (!UnpackBinaryResources(module, base_path, archive_path, MAX_PATH, | 518 if (!UnpackBinaryResources(module, base_path, archive_path, MAX_PATH, |
| 517 setup_path, MAX_PATH)) | 519 setup_path, MAX_PATH)) |
| 518 return 102; | 520 return 102; |
| 519 | 521 |
| 520 int exit_code = 103; | 522 int exit_code = 103; |
| 521 if (!RunSetup(archive_path, setup_path, &exit_code)) | 523 if (!RunSetup(archive_path, setup_path, &exit_code)) |
| 522 return exit_code; | 524 return exit_code; |
| 523 | 525 |
| 524 wchar_t value[4]; | 526 wchar_t value[4]; |
| 525 if ((!ReadValueFromRegistry(HKEY_CURRENT_USER, kCleanupRegistryKey, | 527 if ((!ReadValueFromRegistry(HKEY_CURRENT_USER, kCleanupRegistryKey, |
| 526 kCleanupRegistryValueName, value, 4)) || | 528 kCleanupRegistryValueName, value, 4)) || |
| 527 (value[0] != L'0')) | 529 (value[0] != L'0')) |
| 528 DeleteExtractedFiles(base_path, archive_path, setup_path); | 530 DeleteExtractedFiles(base_path, archive_path, setup_path); |
| 529 | 531 |
| 530 return exit_code; | 532 return exit_code; |
| 531 } | 533 } |
| 532 } // namespace mini_installer | 534 } // namespace mini_installer |
| 533 | 535 |
| 534 | 536 |
| 535 int MainEntryPoint() { | 537 int MainEntryPoint() { |
| 536 int result = mini_installer::WMain(::GetModuleHandle(NULL)); | 538 int result = mini_installer::WMain(::GetModuleHandle(NULL)); |
| 537 ::ExitProcess(result); | 539 ::ExitProcess(result); |
| 538 } | 540 } |
| OLD | NEW |