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> | 8 #include <assert.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // Check for a match of the product directory name. | 112 // Check for a match of the product directory name. |
113 if (_wcsnicmp(&*name, kProductPathName, kProductPathNameLength)) | 113 if (_wcsnicmp(&*name, kProductPathName, kProductPathNameLength)) |
114 return std::wstring(); | 114 return std::wstring(); |
115 | 115 |
116 // Return the (possibly empty) suffix betwixt the product name and install | 116 // Return the (possibly empty) suffix betwixt the product name and install |
117 // binary dir. | 117 // binary dir. |
118 return std::wstring(&*(name - kProductPathNameLength), | 118 return std::wstring(&*(name - kProductPathNameLength), |
119 (name - scan) - kProductPathNameLength); | 119 (name - scan) - kProductPathNameLength); |
120 } | 120 } |
121 | 121 |
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( | 122 std::unique_ptr<PrimaryInstallDetails> MakeProductDetails( |
132 const std::wstring& exe_path) { | 123 const std::wstring& exe_path) { |
133 std::unique_ptr<PrimaryInstallDetails> details(new PrimaryInstallDetails()); | 124 std::unique_ptr<PrimaryInstallDetails> details(new PrimaryInstallDetails()); |
134 | 125 |
135 const InstallConstants* mode = FindInstallMode(GetInstallSuffix(exe_path)); | 126 const InstallConstants* mode = FindInstallMode(GetInstallSuffix(exe_path)); |
136 const bool system_level = | 127 const bool system_level = |
137 mode->supports_system_level && PathIsInProgramFiles(exe_path); | 128 mode->supports_system_level && PathIsInProgramFiles(exe_path); |
138 const bool multi_install = | |
139 mode->supports_multi_install && IsMultiInstall(*mode, system_level); | |
140 | 129 |
141 details->set_mode(mode); | 130 details->set_mode(mode); |
142 details->set_system_level(system_level); | 131 details->set_system_level(system_level); |
143 details->set_multi_install(multi_install); | 132 details->set_channel(DetermineChannel(*mode, system_level)); |
144 details->set_channel(DetermineChannel(*mode, system_level, multi_install)); | |
145 | 133 |
146 return details; | 134 return details; |
147 } | 135 } |
148 | 136 |
149 } // namespace install_static | 137 } // namespace install_static |
OLD | NEW |