Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

references.h

Go to the documentation of this file.
00001 /*
00002 PeRdr - PE file disassembler
00003 Copyright (C) 1999-2002 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_REFERENCES_H
00026 #define FILE_REFERENCES_H
00027 
00028 #include <set>
00029 
00030 enum FlowTypes { FLOW_NONE, FLOW_RET, FLOW_CALL, FLOW_JUMP, FLOW_CJUMP };
00031 
00032 struct IstrReference
00033 {
00034   IstrReference() {};
00035   IstrReference(vma_t _from,vma_t _to,bool _direct,enum FlowTypes _type,bool _isApi=false):
00036     from(_from),to(_to),type(_type),direct(_direct),isApi(_isApi) {};
00037   IstrReference(vma_t _from,vma_t _to):
00038     from(_from),to(_to) {};
00039   vma_t from;
00040   vma_t to;
00041   enum FlowTypes type;
00042   bool direct;
00043   bool isApi;
00044   bool operator==(const IstrReference& rhs) const
00045   { return from==rhs.from && to==rhs.to; };
00046   bool operator<(const IstrReference& rhs) const
00047   { return from<rhs.from || (from==rhs.from && to<rhs.to); }
00048 };
00049 
00050 class IstrReferences
00051 {
00052   typedef std::set< IstrReference,std::less<IstrReference> > TRefs;
00053   TRefs refs;
00054 public:
00055   typedef TRefs::const_iterator iterator;
00056   void Add(vma_t from,vma_t to,enum FlowTypes type);
00057   bool IsPresent(vma_t from,vma_t to) const;
00058   iterator beginReferenceTo(vma_t addr) const;
00059   iterator endReferenceTo(vma_t addr) const;
00060 };
00061 
00062 #endif // FILE_REFERENCES_H

Generated on Mon Jan 13 22:20:34 2003 for perdr by doxygen1.2.15