Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1250)

Unified Diff: chrome/browser/conflicts/module_database_win.h

Issue 2653333002: [win] Create utilities for helping to populate ModuleDatabase. (Closed)
Patch Set: Fix include order. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/conflicts/module_database_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/conflicts/module_database_win.h
diff --git a/chrome/browser/conflicts/module_database_win.h b/chrome/browser/conflicts/module_database_win.h
index 73725556ab257f8ee26874544daa6b4e5f55bf9e..6fa87b8b11edf476f2293486644cd78377ebe5f2 100644
--- a/chrome/browser/conflicts/module_database_win.h
+++ b/chrome/browser/conflicts/module_database_win.h
@@ -22,6 +22,36 @@
// be set as the process-wide singleton via SetInstance.
class ModuleDatabase {
public:
+ // Used as a unique identifier for a module in a ModuleSet.
+ using ModuleId = int;
+
+ // The type of certificate found for the module.
+ enum CertificateType {
+ // The module is not signed.
+ NO_CERTIFICATE,
+ // The module is signed and the certificate is in the module.
+ CERTIFICATE_IN_FILE,
+ // The module is signed and the certificate is in an external catalog.
+ CERTIFICATE_IN_CATALOG,
+ };
+
+ // Structures for maintaining information about modules.
+ struct ModuleInfoKey;
+ struct CertificateInfo;
+ struct ModuleInfoData;
+ using ModuleMap = std::map<ModuleInfoKey, ModuleInfoData>;
+ using ModuleInfo = ModuleMap::value_type;
+
+ // Used for maintaing a list of modules loaded in a process. Maps module IDs
+ // to load addresses.
+ using ModuleLoadAddresses = std::vector<std::pair<ModuleId, uintptr_t>>;
+
+ // Structures for maintaining information about running processes.
+ struct ProcessInfoKey;
+ struct ProcessInfoData;
+ using ProcessMap = std::map<ProcessInfoKey, ProcessInfoData>;
+ using ProcessInfo = ProcessMap::value_type;
+
// A ModuleDatabase is by default bound to a provided sequenced task runner.
// All calls must be made in the context of this task runner, unless
// otherwise noted. For calls from other contexts this task runner is used to
@@ -79,25 +109,6 @@ class ModuleDatabase {
// been found.
static constexpr size_t kInvalidIndex = ~0u;
- // Used as a unique identifier for a module in a ModuleSet.
- using ModuleId = int;
-
- // Structures for maintaining information about modules.
- struct ModuleInfoKey;
- struct ModuleInfoData;
- using ModuleMap = std::map<ModuleInfoKey, ModuleInfoData>;
- using ModuleInfo = ModuleMap::value_type;
-
- // Used for maintaing a list of modules loaded in a process. Maps module IDs
- // to load addresses.
- using ModuleLoadAddresses = std::vector<std::pair<ModuleId, uintptr_t>>;
-
- // Structures for maintaining information about running processes.
- struct ProcessInfoKey;
- struct ProcessInfoData;
- using ProcessMap = std::map<ProcessInfoKey, ProcessInfoData>;
- using ProcessInfo = ProcessMap::value_type;
-
// Converts a valid |process_type| to a bit for use in a bitmask of process
// values. Exposed in the header for testing.
static uint32_t ProcessTypeToBit(content::ProcessType process_type);
@@ -195,16 +206,59 @@ struct ModuleDatabase::ModuleInfoKey {
ModuleId module_id;
};
+// Information about the certificate of a file.
+struct ModuleDatabase::CertificateInfo {
+ CertificateInfo();
+
+ // The type of signature encountered.
+ CertificateType type;
+
+ // Path to the file containing the certificate. Empty if |type| is
+ // NO_CERTIFICATE.
+ base::FilePath path;
+
+ // The "Subject" name of the certificate. This is the signer (ie,
+ // "Google Inc." or "Microsoft Inc.").
+ base::string16 subject;
+};
+
// This is the mutable portion of the module information, and is the storage
// type in a std::map.
struct ModuleDatabase::ModuleInfoData {
ModuleInfoData();
+ ModuleInfoData(const ModuleInfoData& others);
+ ~ModuleInfoData();
// Set of all process types in which this module has been seen (may not be
// currently present in a process of that type). This is a conversion of
// ProcessType enumeration to a bitfield. See "ProcessTypeToBit" and
// "BitIndexToProcessType" for details.
uint32_t process_types;
+
+ // The following pieces of information are determined via a detailed
+ // inspection of the module. This is relatively expensive and uses blocking
+ // IO, so is performed in a background task.
+
+ // The module path, not including the basename. This is cleaned and normalized
+ // so that common paths are converted to their environment variable mappings
+ // (ie, %systemroot%). This makes i18n localized paths easily comparable.
+ base::string16 location;
+
+ // The basename of the module.
+ base::string16 basename;
+
+ // The name of the product the module belongs to.
+ base::string16 product_name;
+
+ // The module file description.
+ base::string16 description;
+
+ // The module version. This is usually in the form a.b.c.d (where a, b, c and
+ // d are integers), but may also have fewer than 4 components.
+ base::string16 version;
+
+ // The certificate info for the module.
+ CertificateInfo certificate_info;
};
// Information about a running process. This ties modules in a ModuleSet to
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/conflicts/module_database_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698