1 #ifndef __INTELCOFFFILE_H__
2 #define __INTELCOFFFILE_H__
5 #include "BinaryFile.h"
8 #define PACKED __attribute__((packed))
13 uint16_t coff_sections
;
14 uint32_t coff_timestamp
;
15 uint32_t coff_symtab_ofs
;
16 uint32_t coff_num_syment
;
17 uint16_t coff_opthead_size
;
21 class IntelCoffFile
: public BinaryFile
30 virtual void UnLoad();
32 virtual bool Open(const char *sName
);
33 virtual bool RealLoad(const char*);
34 virtual bool PostLoad(void*);
37 virtual LOAD_FMT
GetFormat() const;
38 virtual MACHINE
GetMachine() const;
39 virtual const char *getFilename() const;
40 virtual bool isLibrary() const;
41 virtual std::list
<const char *> getDependencyList();
42 virtual ADDRESS
getImageBase();
43 virtual size_t getImageSize();
44 virtual ADDRESS
GetMainEntryPoint();
45 virtual ADDRESS
GetEntryPoint();
46 virtual std::list
<SectionInfo
*>& GetEntryPoints(const char* pEntry
= "main");
48 virtual const char* SymbolByAddress(ADDRESS uNative
);
49 // Lookup the name, return the address. If not found, return NO_ADDRESS
50 // virtual ADDRESS GetAddressByName(const char* pName, bool bNoTypeOK = false);
51 // virtual void AddSymbol(ADDRESS uNative, const char *pName) { }
52 virtual bool IsDynamicLinkedProc(ADDRESS uNative
);
53 virtual bool IsRelocationAt(ADDRESS uNative
);
54 virtual std::map
<ADDRESS
, std::string
> &getSymbols();
56 virtual int readNative4(ADDRESS a
);
57 virtual int readNative2(ADDRESS a
);
58 virtual int readNative1(ADDRESS a
);
64 const char *m_pFilename
;
66 std::list
<SectionInfo
*> m_EntryPoints
;
67 std::list
<ADDRESS
> m_Relocations
;
68 struct coff_header m_Header
;
70 PSectionInfo
AddSection(SectionInfo
*);
71 unsigned char* getAddrPtr(ADDRESS a
, ADDRESS range
);
72 int readNative(ADDRESS a
, unsigned short n
);
77 #endif // !defined(__INTELCOFFFILE_H__)