Chromium Code Reviews| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 386 #else | 386 #else |
| 387 base::DIR_PROGRAM_FILES; | 387 base::DIR_PROGRAM_FILES; |
| 388 #endif | 388 #endif |
| 389 if (!PathService::Get(kProgramFilesKey, &program_files_path)) { | 389 if (!PathService::Get(kProgramFilesKey, &program_files_path)) { |
| 390 NOTREACHED(); | 390 NOTREACHED(); |
| 391 return true; | 391 return true; |
| 392 } | 392 } |
| 393 env->SetVar(kEnvProgramFilesPath, | 393 env->SetVar(kEnvProgramFilesPath, |
| 394 base::WideToUTF8(program_files_path.value())); | 394 base::WideToUTF8(program_files_path.value())); |
| 395 } | 395 } |
| 396 return !base::StartsWith(exe_path.value(), program_files_path.value(), false); | 396 |
| 397 // Return true if the program files path is not a case-insensitive prefix of | |
| 398 // the exe path. | |
| 399 if (exe_path.value().size() < program_files_path.value().size()) | |
| 400 return true; | |
| 401 DWORD prefix_len = static_cast<DWORD>(program_files_path.value().size()); | |
|
grt (UTC plus 2)
2015/07/01 17:55:42
base::saturated_cast<DWORD, size_t>()?
| |
| 402 return ::CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, | |
| 403 exe_path.value().data(), prefix_len, | |
| 404 program_files_path.value().data(), prefix_len) != | |
| 405 CSTR_EQUAL; | |
| 397 } | 406 } |
| 398 | 407 |
| 399 bool InstallUtil::IsMultiInstall(BrowserDistribution* dist, | 408 bool InstallUtil::IsMultiInstall(BrowserDistribution* dist, |
| 400 bool system_install) { | 409 bool system_install) { |
| 401 DCHECK(dist); | 410 DCHECK(dist); |
| 402 ProductState state; | 411 ProductState state; |
| 403 return state.Initialize(system_install, dist) && state.is_multi_install(); | 412 return state.Initialize(system_install, dist) && state.is_multi_install(); |
| 404 } | 413 } |
| 405 | 414 |
| 406 bool CheckIsChromeSxSProcess() { | 415 bool CheckIsChromeSxSProcess() { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 665 // Open the program and see if it references the expected file. | 674 // Open the program and see if it references the expected file. |
| 666 base::File file; | 675 base::File file; |
| 667 BY_HANDLE_FILE_INFORMATION info = {}; | 676 BY_HANDLE_FILE_INFORMATION info = {}; |
| 668 | 677 |
| 669 return (OpenForInfo(path, &file) && | 678 return (OpenForInfo(path, &file) && |
| 670 GetInfo(file, &info) && | 679 GetInfo(file, &info) && |
| 671 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && | 680 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && |
| 672 info.nFileIndexHigh == file_info_.nFileIndexHigh && | 681 info.nFileIndexHigh == file_info_.nFileIndexHigh && |
| 673 info.nFileIndexLow == file_info_.nFileIndexLow); | 682 info.nFileIndexLow == file_info_.nFileIndexLow); |
| 674 } | 683 } |
| OLD | NEW |