| 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 #include "chrome/browser/enumerate_modules_model_win.h" | 5 #include "chrome/browser/enumerate_modules_model_win.h" |
| 6 | 6 |
| 7 #include <Tlhelp32.h> | 7 #include <Tlhelp32.h> |
| 8 #include <wintrust.h> | 8 #include <wintrust.h> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 std::string filename_hash, location_hash; | 377 std::string filename_hash, location_hash; |
| 378 GenerateHash(base::WideToUTF8(module.name), &filename_hash); | 378 GenerateHash(base::WideToUTF8(module.name), &filename_hash); |
| 379 GenerateHash(base::WideToUTF8(module.location), &location_hash); | 379 GenerateHash(base::WideToUTF8(module.location), &location_hash); |
| 380 | 380 |
| 381 // Filenames are mandatory. Location is mandatory if given. | 381 // Filenames are mandatory. Location is mandatory if given. |
| 382 if (filename_hash == blacklisted.filename && | 382 if (filename_hash == blacklisted.filename && |
| 383 (std::string(blacklisted.location).empty() || | 383 (std::string(blacklisted.location).empty() || |
| 384 location_hash == blacklisted.location)) { | 384 location_hash == blacklisted.location)) { |
| 385 // We have a name match against the blacklist (and possibly location match | 385 // We have a name match against the blacklist (and possibly location match |
| 386 // also), so check version. | 386 // also), so check version. |
| 387 Version module_version(UTF16ToASCII(module.version)); | 387 Version module_version(base::UTF16ToASCII(module.version)); |
| 388 Version version_min(blacklisted.version_from); | 388 Version version_min(blacklisted.version_from); |
| 389 Version version_max(blacklisted.version_to); | 389 Version version_max(blacklisted.version_to); |
| 390 bool version_ok = !version_min.IsValid() && !version_max.IsValid(); | 390 bool version_ok = !version_min.IsValid() && !version_max.IsValid(); |
| 391 if (!version_ok) { | 391 if (!version_ok) { |
| 392 bool too_low = version_min.IsValid() && | 392 bool too_low = version_min.IsValid() && |
| 393 (!module_version.IsValid() || | 393 (!module_version.IsValid() || |
| 394 module_version.CompareTo(version_min) < 0); | 394 module_version.CompareTo(version_min) < 0); |
| 395 bool too_high = version_max.IsValid() && | 395 bool too_high = version_max.IsValid() && |
| 396 (!module_version.IsValid() || | 396 (!module_version.IsValid() || |
| 397 module_version.CompareTo(version_max) >= 0); | 397 module_version.CompareTo(version_max) >= 0); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 env_vars.push_back(L"ProgramFiles"); | 637 env_vars.push_back(L"ProgramFiles"); |
| 638 env_vars.push_back(L"ProgramData"); | 638 env_vars.push_back(L"ProgramData"); |
| 639 env_vars.push_back(L"USERPROFILE"); | 639 env_vars.push_back(L"USERPROFILE"); |
| 640 env_vars.push_back(L"SystemRoot"); | 640 env_vars.push_back(L"SystemRoot"); |
| 641 env_vars.push_back(L"TEMP"); | 641 env_vars.push_back(L"TEMP"); |
| 642 env_vars.push_back(L"TMP"); | 642 env_vars.push_back(L"TMP"); |
| 643 env_vars.push_back(L"CommonProgramFiles"); | 643 env_vars.push_back(L"CommonProgramFiles"); |
| 644 for (std::vector<base::string16>::const_iterator variable = env_vars.begin(); | 644 for (std::vector<base::string16>::const_iterator variable = env_vars.begin(); |
| 645 variable != env_vars.end(); ++variable) { | 645 variable != env_vars.end(); ++variable) { |
| 646 std::string path; | 646 std::string path; |
| 647 if (environment->GetVar(WideToASCII(*variable).c_str(), &path)) { | 647 if (environment->GetVar(base::UTF16ToASCII(*variable).c_str(), &path)) { |
| 648 path_mapping_.push_back( | 648 path_mapping_.push_back( |
| 649 std::make_pair(base::i18n::ToLower(base::UTF8ToUTF16(path)) + L"\\", | 649 std::make_pair(base::i18n::ToLower(base::UTF8ToUTF16(path)) + L"\\", |
| 650 L"%" + base::i18n::ToLower(*variable) + L"%")); | 650 L"%" + base::i18n::ToLower(*variable) + L"%")); |
| 651 } | 651 } |
| 652 } | 652 } |
| 653 } | 653 } |
| 654 | 654 |
| 655 void ModuleEnumerator::CollapsePath(Module* entry) { | 655 void ModuleEnumerator::CollapsePath(Module* entry) { |
| 656 // Take the path and see if we can use any of the substitution values | 656 // Take the path and see if we can use any of the substitution values |
| 657 // from the vector constructed above to replace c:\windows with, for | 657 // from the vector constructed above to replace c:\windows with, for |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 GenerateHash(base::WideToUTF8(module.location), &location); | 1063 GenerateHash(base::WideToUTF8(module.location), &location); |
| 1064 GenerateHash(base::WideToUTF8(module.description), &description); | 1064 GenerateHash(base::WideToUTF8(module.description), &description); |
| 1065 GenerateHash(base::WideToUTF8(module.digital_signer), &signer); | 1065 GenerateHash(base::WideToUTF8(module.digital_signer), &signer); |
| 1066 | 1066 |
| 1067 base::string16 url = | 1067 base::string16 url = |
| 1068 l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, | 1068 l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, |
| 1069 base::ASCIIToUTF16(filename), base::ASCIIToUTF16(location), | 1069 base::ASCIIToUTF16(filename), base::ASCIIToUTF16(location), |
| 1070 base::ASCIIToUTF16(description), base::ASCIIToUTF16(signer)); | 1070 base::ASCIIToUTF16(description), base::ASCIIToUTF16(signer)); |
| 1071 return GURL(base::UTF16ToUTF8(url)); | 1071 return GURL(base::UTF16ToUTF8(url)); |
| 1072 } | 1072 } |
| OLD | NEW |