| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "chrome/install_static/product_install_details.h" | 5 #include "chrome/install_static/product_install_details.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <assert.h> | |
| 9 | 8 |
| 10 #include <algorithm> | 9 #include <algorithm> |
| 11 | 10 |
| 12 #include "chrome/install_static/install_details.h" | 11 #include "chrome/install_static/install_details.h" |
| 13 #include "chrome/install_static/install_modes.h" | 12 #include "chrome/install_static/install_modes.h" |
| 14 #include "chrome/install_static/install_util.h" | 13 #include "chrome/install_static/install_util.h" |
| 15 #include "chrome_elf/nt_registry/nt_registry.h" | 14 #include "chrome_elf/nt_registry/nt_registry.h" |
| 16 | 15 |
| 17 namespace install_static { | 16 namespace install_static { |
| 18 | 17 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // Check for a match of the product directory name. | 111 // Check for a match of the product directory name. |
| 113 if (_wcsnicmp(&*name, kProductPathName, kProductPathNameLength)) | 112 if (_wcsnicmp(&*name, kProductPathName, kProductPathNameLength)) |
| 114 return std::wstring(); | 113 return std::wstring(); |
| 115 | 114 |
| 116 // Return the (possibly empty) suffix betwixt the product name and install | 115 // Return the (possibly empty) suffix betwixt the product name and install |
| 117 // binary dir. | 116 // binary dir. |
| 118 return std::wstring(&*(name - kProductPathNameLength), | 117 return std::wstring(&*(name - kProductPathNameLength), |
| 119 (name - scan) - kProductPathNameLength); | 118 (name - scan) - kProductPathNameLength); |
| 120 } | 119 } |
| 121 | 120 |
| 122 bool IsMultiInstall(const InstallConstants& mode, bool system_level) { | |
| 123 assert(mode.supports_multi_install); | |
| 124 std::wstring args; | |
| 125 return nt::QueryRegValueSZ(system_level ? nt::HKLM : nt::HKCU, nt::WOW6432, | |
| 126 GetClientStateKeyPath(mode.app_guid).c_str(), | |
| 127 L"UninstallArguments", &args) && | |
| 128 args.find(L"--multi-install") != std::wstring::npos; | |
| 129 } | |
| 130 | |
| 131 std::unique_ptr<PrimaryInstallDetails> MakeProductDetails( | 121 std::unique_ptr<PrimaryInstallDetails> MakeProductDetails( |
| 132 const std::wstring& exe_path) { | 122 const std::wstring& exe_path) { |
| 133 std::unique_ptr<PrimaryInstallDetails> details(new PrimaryInstallDetails()); | 123 std::unique_ptr<PrimaryInstallDetails> details(new PrimaryInstallDetails()); |
| 134 | 124 |
| 135 const InstallConstants* mode = FindInstallMode(GetInstallSuffix(exe_path)); | 125 const InstallConstants* mode = FindInstallMode(GetInstallSuffix(exe_path)); |
| 136 const bool system_level = | 126 const bool system_level = |
| 137 mode->supports_system_level && PathIsInProgramFiles(exe_path); | 127 mode->supports_system_level && PathIsInProgramFiles(exe_path); |
| 138 const bool multi_install = | |
| 139 mode->supports_multi_install && IsMultiInstall(*mode, system_level); | |
| 140 | 128 |
| 141 details->set_mode(mode); | 129 details->set_mode(mode); |
| 142 details->set_system_level(system_level); | 130 details->set_system_level(system_level); |
| 143 details->set_multi_install(multi_install); | 131 details->set_channel(DetermineChannel(*mode, system_level)); |
| 144 details->set_channel(DetermineChannel(*mode, system_level, multi_install)); | |
| 145 | 132 |
| 146 return details; | 133 return details; |
| 147 } | 134 } |
| 148 | 135 |
| 149 } // namespace install_static | 136 } // namespace install_static |
| OLD | NEW |