| 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/win/enumerate_modules_model.h" | 5 #include "chrome/browser/win/enumerate_modules_model.h" |
| 6 | 6 |
| 7 #include <Tlhelp32.h> | 7 #include <Tlhelp32.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <wintrust.h> | 10 #include <wintrust.h> |
| 11 | 11 |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <memory> | 13 #include <memory> |
| 14 | 14 |
| 15 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/environment.h" | 17 #include "base/environment.h" |
| 18 #include "base/file_version_info_win.h" | 18 #include "base/file_version_info.h" |
| 19 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
| 20 #include "base/i18n/case_conversion.h" | 20 #include "base/i18n/case_conversion.h" |
| 21 #include "base/macros.h" | 21 #include "base/macros.h" |
| 22 #include "base/metrics/histogram.h" | 22 #include "base/metrics/histogram.h" |
| 23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
| 25 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
| 26 #include "base/time/time.h" | 26 #include "base/time/time.h" |
| 27 #include "base/values.h" | 27 #include "base/values.h" |
| 28 #include "base/version.h" | 28 #include "base/version.h" |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 | 623 |
| 624 void ModuleEnumerator::PopulateModuleInformation(Module* module) { | 624 void ModuleEnumerator::PopulateModuleInformation(Module* module) { |
| 625 module->status = NOT_MATCHED; | 625 module->status = NOT_MATCHED; |
| 626 module->duplicate_count = 0; | 626 module->duplicate_count = 0; |
| 627 module->normalized = false; | 627 module->normalized = false; |
| 628 module->digital_signer = | 628 module->digital_signer = |
| 629 GetSubjectNameFromDigitalSignature(base::FilePath(module->location)); | 629 GetSubjectNameFromDigitalSignature(base::FilePath(module->location)); |
| 630 module->recommended_action = NONE; | 630 module->recommended_action = NONE; |
| 631 std::unique_ptr<FileVersionInfo> version_info( | 631 std::unique_ptr<FileVersionInfo> version_info( |
| 632 FileVersionInfo::CreateFileVersionInfo(base::FilePath(module->location))); | 632 FileVersionInfo::CreateFileVersionInfo(base::FilePath(module->location))); |
| 633 if (version_info.get()) { | 633 if (version_info) { |
| 634 FileVersionInfoWin* version_info_win = | 634 module->description = version_info->file_description(); |
| 635 static_cast<FileVersionInfoWin*>(version_info.get()); | 635 module->version = version_info->file_version(); |
| 636 | 636 module->product_name = version_info->product_name(); |
| 637 VS_FIXEDFILEINFO* fixed_file_info = version_info_win->fixed_file_info(); | |
| 638 if (fixed_file_info) { | |
| 639 module->description = version_info_win->file_description(); | |
| 640 module->version = version_info_win->file_version(); | |
| 641 module->product_name = version_info_win->product_name(); | |
| 642 } | |
| 643 } | 637 } |
| 644 } | 638 } |
| 645 | 639 |
| 646 void ModuleEnumerator::AddToListWithoutDuplicating(const Module& module) { | 640 void ModuleEnumerator::AddToListWithoutDuplicating(const Module& module) { |
| 647 DCHECK(module.normalized); | 641 DCHECK(module.normalized); |
| 648 // These are registered modules, not loaded modules so the same module | 642 // These are registered modules, not loaded modules so the same module |
| 649 // can be registered multiple times, often dozens of times. There is no need | 643 // can be registered multiple times, often dozens of times. There is no need |
| 650 // to list each registration, so we just increment the count for each module | 644 // to list each registration, so we just increment the count for each module |
| 651 // that is counted multiple times. | 645 // that is counted multiple times. |
| 652 ModulesVector::iterator iter; | 646 ModulesVector::iterator iter; |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 GenerateHash(base::WideToUTF8(module.location), &location); | 1067 GenerateHash(base::WideToUTF8(module.location), &location); |
| 1074 GenerateHash(base::WideToUTF8(module.description), &description); | 1068 GenerateHash(base::WideToUTF8(module.description), &description); |
| 1075 GenerateHash(base::WideToUTF8(module.digital_signer), &signer); | 1069 GenerateHash(base::WideToUTF8(module.digital_signer), &signer); |
| 1076 | 1070 |
| 1077 base::string16 url = | 1071 base::string16 url = |
| 1078 l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, | 1072 l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, |
| 1079 base::ASCIIToUTF16(filename), base::ASCIIToUTF16(location), | 1073 base::ASCIIToUTF16(filename), base::ASCIIToUTF16(location), |
| 1080 base::ASCIIToUTF16(description), base::ASCIIToUTF16(signer)); | 1074 base::ASCIIToUTF16(description), base::ASCIIToUTF16(signer)); |
| 1081 return GURL(base::UTF16ToUTF8(url)); | 1075 return GURL(base::UTF16ToUTF8(url)); |
| 1082 } | 1076 } |
| OLD | NEW |