00001 /* 00002 PeRdr - PE file disassembler 00003 Copyright (C) 1999-2003 Frediano Ziglio 00004 ----- 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 ----- 00020 00021 INFORMATION 00022 www: https://freddy77.tripod.com/perdr/ 00023 e-mail: freddy77@angelfire.com 00024 */ 00025 #ifndef FILE_RELOCATIONINFO_H 00026 #define FILE_RELOCATIONINFO_H 00027 00028 #include <set> 00029 00030 // contiene informazioni circa le rilocazioni di un letterale 00031 class Relocation 00032 { 00033 public: 00034 // tipi di rilocazione 00035 // relError e' usata nel caso che la rilocazione non sia completa 00036 // (es: presi 2 byte di una rilocazione) 00037 typedef enum _Type { relNone, relRelative, relAbsolute } Type; 00038 Relocation(Type _type = relNone):type(_type) {}; 00039 Type GetType() const { return type; }; 00040 void SetType(Type _type) { type = _type; }; 00041 private: 00042 Type type; 00043 }; 00044 00045 class RelocationInfos 00046 { 00047 public: 00048 /** Hold relocation info for returning error */ 00049 static const Relocation relError; 00050 void AddRelocation(const Relocation& rel,vma_t address); 00051 /** 00052 * return relocation at a given address 00053 * @return Valid relocation pointer or &RelocationInfos::relError 00054 */ 00055 const Relocation* GetRelocation(vma_t address,unsigned bytes) const; 00056 const Relocation* GetRelocation(vma_t address) const; 00057 private: 00058 // per ora contiene solo rilocazioni di tipo relativo 00059 typedef std::set<vma_t,std::less<vma_t> > t_relocations; 00060 t_relocations relocations; 00061 }; 00062 00063 #endif //FILE_RELOCATIONINFO_H