1f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 2f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// found in the LICENSE file. 4f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 5f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#ifndef CHROME_BROWSER_INSTALL_VERIFICATION_WIN_MODULE_INFO_H_ 6f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#define CHROME_BROWSER_INSTALL_VERIFICATION_WIN_MODULE_INFO_H_ 7f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 8f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "base/strings/string16.h" 9f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 10f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Represents and facilitates operations on the address range corresponding to a 11f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// loaded module. 12f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)struct ModuleInfo { 13f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) ModuleInfo() : base_address(0), size(0) { 14f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) } 15f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 16f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) ModuleInfo(const base::char16* const module_name, 17f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) uintptr_t module_base_address, 18f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) size_t module_size) 19f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) : base_address(module_base_address), 20f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) size(module_size), 21f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) name(module_name) { 22f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) } 23f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 24f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Sorts modules by their base address. 25f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) bool operator< (const ModuleInfo& compare) const { 26f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) return base_address < compare.base_address; 27f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) } 28f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 29f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Identifies if an address is within a module. 30f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) bool ContainsAddress(uintptr_t address) const { 31f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) return address >= base_address && address < base_address + size; 32f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) } 33f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 34f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) base::string16 name; 35f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) uintptr_t base_address; 36f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) size_t size; 37f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}; 38f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 39f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#endif // CHROME_BROWSER_INSTALL_VERIFICATION_WIN_MODULE_INFO_H_ 40