This source file includes following definitions.
- CalculateModuleNameDigest
- GetLoadedModules
- ReportModuleMatches
#include "chrome/browser/install_verification/win/module_verification_common.h"
#include "base/files/file_path.h"
#include "base/md5.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/install_verification/win/loaded_modules_snapshot.h"
#include "chrome/browser/install_verification/win/module_info.h"
#include "chrome/browser/install_verification/win/module_list.h"
std::string CalculateModuleNameDigest(const base::string16& module_name) {
return base::MD5String(StringToLowerASCII(base::UTF16ToUTF8(
base::FilePath(module_name).BaseName().value())));
}
bool GetLoadedModules(std::set<ModuleInfo>* loaded_modules) {
std::vector<HMODULE> snapshot;
if (!GetLoadedModulesSnapshot(&snapshot))
return false;
ModuleList::FromLoadedModuleSnapshot(snapshot)->GetModuleInfoSet(
loaded_modules);
return true;
}
void ReportModuleMatches(const std::vector<std::string>& module_name_digests,
const ModuleIDs& module_ids,
ModuleVerificationDelegate* delegate) {
for (size_t i = 0; i < module_name_digests.size(); ++i) {
ModuleIDs::const_iterator entry = module_ids.find(module_name_digests[i]);
if (entry != module_ids.end())
delegate(entry->second);
}
}