| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 return false; | 144 return false; |
| 145 } | 145 } |
| 146 | 146 |
| 147 // This function sets the flag in registry to indicate that Google Update | 147 // This function sets the flag in registry to indicate that Google Update |
| 148 // should try full installer next time. If the current installer works, this | 148 // should try full installer next time. If the current installer works, this |
| 149 // flag is cleared by setup.exe at the end of install. | 149 // flag is cleared by setup.exe at the end of install. |
| 150 void SetFullInstallerFlag(HKEY root_key) { | 150 void SetFullInstallerFlag(HKEY root_key) { |
| 151 HKEY key; | 151 HKEY key; |
| 152 wchar_t ap_registry_key[128]; | 152 wchar_t ap_registry_key[128]; |
| 153 const wchar_t* app_guid = google_update::kAppGuid; |
| 154 |
| 155 int args_num; |
| 156 wchar_t* cmd_line = ::GetCommandLine(); |
| 157 wchar_t** args = ::CommandLineToArgvW(cmd_line, &args_num); |
| 158 for (int i = 1; i < args_num; ++i) { |
| 159 if (0 == ::lstrcmpi(args[i], L"--chrome-sxs")) |
| 160 app_guid = google_update::kSxSAppGuid; |
| 161 } |
| 162 |
| 153 if (!SafeStrCopy(ap_registry_key, _countof(ap_registry_key), | 163 if (!SafeStrCopy(ap_registry_key, _countof(ap_registry_key), |
| 154 kApRegistryKeyBase) || | 164 kApRegistryKeyBase) || |
| 155 !SafeStrCat(ap_registry_key, _countof(ap_registry_key), | 165 !SafeStrCat(ap_registry_key, _countof(ap_registry_key), |
| 156 google_update::kAppGuid)) { | 166 app_guid)) { |
| 157 return; | 167 return; |
| 158 } | 168 } |
| 159 if (::RegOpenKeyEx(root_key, ap_registry_key, NULL, | 169 if (::RegOpenKeyEx(root_key, ap_registry_key, NULL, |
| 160 KEY_READ | KEY_SET_VALUE, &key) != ERROR_SUCCESS) | 170 KEY_READ | KEY_SET_VALUE, &key) != ERROR_SUCCESS) |
| 161 return; | 171 return; |
| 162 | 172 |
| 163 wchar_t value[128]; | 173 wchar_t value[128]; |
| 164 size_t size = _countof(value); | 174 size_t size = _countof(value); |
| 165 size_t buf_size = size; | 175 size_t buf_size = size; |
| 166 LONG ret = ::RegQueryValueEx(key, kApRegistryValueName, NULL, NULL, | 176 LONG ret = ::RegQueryValueEx(key, kApRegistryValueName, NULL, NULL, |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 | 549 |
| 540 return exit_code; | 550 return exit_code; |
| 541 } | 551 } |
| 542 } // namespace mini_installer | 552 } // namespace mini_installer |
| 543 | 553 |
| 544 | 554 |
| 545 int MainEntryPoint() { | 555 int MainEntryPoint() { |
| 546 int result = mini_installer::WMain(::GetModuleHandle(NULL)); | 556 int result = mini_installer::WMain(::GetModuleHandle(NULL)); |
| 547 ::ExitProcess(result); | 557 ::ExitProcess(result); |
| 548 } | 558 } |
| OLD | NEW |