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 // See the corresponding header file for description of the functions in this | 5 // See the corresponding header file for description of the functions in this |
6 // file. | 6 // file. |
7 | 7 |
8 #include "chrome/installer/util/install_util.h" | 8 #include "chrome/installer/util/install_util.h" |
9 | 9 |
10 #include <shellapi.h> | 10 #include <shellapi.h> |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 178 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
179 LONG result = key.Open(reg_root, dist->GetVersionKey().c_str(), | 179 LONG result = key.Open(reg_root, dist->GetVersionKey().c_str(), |
180 KEY_QUERY_VALUE); | 180 KEY_QUERY_VALUE); |
181 | 181 |
182 string16 version_str; | 182 string16 version_str; |
183 if (result == ERROR_SUCCESS) | 183 if (result == ERROR_SUCCESS) |
184 result = key.ReadValue(google_update::kRegVersionField, &version_str); | 184 result = key.ReadValue(google_update::kRegVersionField, &version_str); |
185 | 185 |
186 Version* ret = NULL; | 186 Version* ret = NULL; |
187 if (result == ERROR_SUCCESS && !version_str.empty()) { | 187 if (result == ERROR_SUCCESS && !version_str.empty()) { |
188 VLOG(1) << "Existing " << dist->GetApplicationName() | 188 VLOG(1) << "Existing " << dist->GetBaseAppName() << " version found " |
189 << " version found " << version_str; | 189 << version_str; |
190 ret = Version::GetVersionFromString(WideToASCII(version_str)); | 190 ret = Version::GetVersionFromString(WideToASCII(version_str)); |
191 } else { | 191 } else { |
192 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); | 192 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); |
193 VLOG(1) << "No existing " << dist->GetApplicationName() | 193 VLOG(1) << "No existing " << dist->GetBaseAppName() << " install found."; |
194 << " install found."; | |
195 } | 194 } |
196 | 195 |
197 return ret; | 196 return ret; |
198 } | 197 } |
199 | 198 |
200 Version* InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist, | 199 Version* InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist, |
201 bool system_install) { | 200 bool system_install) { |
202 DCHECK(dist); | 201 DCHECK(dist); |
203 RegKey key; | 202 RegKey key; |
204 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 203 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
205 LONG result = | 204 LONG result = |
206 key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_QUERY_VALUE); | 205 key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_QUERY_VALUE); |
207 | 206 |
208 string16 version_str; | 207 string16 version_str; |
209 if (result == ERROR_SUCCESS) | 208 if (result == ERROR_SUCCESS) |
210 result = key.ReadValue(google_update::kRegCriticalVersionField, | 209 result = key.ReadValue(google_update::kRegCriticalVersionField, |
211 &version_str); | 210 &version_str); |
212 | 211 |
213 Version* ret = NULL; | 212 Version* ret = NULL; |
214 if (result == ERROR_SUCCESS && !version_str.empty()) { | 213 if (result == ERROR_SUCCESS && !version_str.empty()) { |
215 VLOG(1) << "Critical Update version for " << dist->GetApplicationName() | 214 VLOG(1) << "Critical Update version for " << dist->GetBaseAppName() |
216 << " found " << version_str; | 215 << " found " << version_str; |
217 ret = Version::GetVersionFromString(WideToASCII(version_str)); | 216 ret = Version::GetVersionFromString(WideToASCII(version_str)); |
218 } else { | 217 } else { |
219 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); | 218 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); |
220 VLOG(1) << "No existing " << dist->GetApplicationName() | 219 VLOG(1) << "No existing " << dist->GetBaseAppName() << " install found."; |
221 << " install found."; | |
222 } | 220 } |
223 | 221 |
224 return ret; | 222 return ret; |
225 } | 223 } |
226 | 224 |
227 bool InstallUtil::IsOSSupported() { | 225 bool InstallUtil::IsOSSupported() { |
228 // We do not support Win2K or older, or XP without service pack 2. | 226 // We do not support Win2K or older, or XP without service pack 2. |
229 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' | 227 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' |
230 << base::SysInfo::OperatingSystemVersion(); | 228 << base::SysInfo::OperatingSystemVersion(); |
231 base::win::Version version = base::win::GetVersion(); | 229 base::win::Version version = base::win::GetVersion(); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 // Open the program and see if it references the expected file. | 540 // Open the program and see if it references the expected file. |
543 base::win::ScopedHandle handle; | 541 base::win::ScopedHandle handle; |
544 BY_HANDLE_FILE_INFORMATION info = {}; | 542 BY_HANDLE_FILE_INFORMATION info = {}; |
545 | 543 |
546 return (OpenForInfo(program, &handle) && | 544 return (OpenForInfo(program, &handle) && |
547 GetInfo(handle, &info) && | 545 GetInfo(handle, &info) && |
548 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && | 546 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && |
549 info.nFileIndexHigh == file_info_.nFileIndexHigh && | 547 info.nFileIndexHigh == file_info_.nFileIndexHigh && |
550 info.nFileIndexLow == file_info_.nFileIndexLow); | 548 info.nFileIndexLow == file_info_.nFileIndexLow); |
551 } | 549 } |
OLD | NEW |