Package ghidra.app.util.bin.format.coff
Class CoffFileHeader
- java.lang.Object
-
- ghidra.app.util.bin.format.coff.CoffFileHeader
-
- All Implemented Interfaces:
StructConverter
public class CoffFileHeader extends java.lang.Object implements StructConverter
-
-
Constructor Summary
Constructors Constructor Description CoffFileHeader(ByteProvider provider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description shortgetFlags()Returns the flags about this COFF.longgetImageBase(boolean isWindowsPlatform)Returns the image base.shortgetMachine()java.lang.StringgetMachineName()Returns the machine name.shortgetMagic()Returns the magic COFF file identifier.AoutHeadergetOptionalHeader()Returns the a.out optional header.shortgetOptionalHeaderSize()Returns the size in bytes of the optional header.shortgetSectionCount()Returns the number of sections in this COFF file.java.util.List<CoffSectionHeader>getSections()Returns the sections in this COFF header.CoffSymbolgetSymbolAtIndex(long index)java.util.List<CoffSymbol>getSymbols()Returns the symbols in this COFF header.intgetSymbolTableEntries()Returns the number of symbols in the symbol table.intgetSymbolTablePointer()Returns the file offset to the symbol table.shortgetTargetID()Returns the specific target idintgetTimestamp()Returns the time stamp of when this file was created.voidparse(ByteProvider provider, TaskMonitor monitor)Finishes the parsing of this file header.voidparseSectionHeaders(ByteProvider provider)Read just the section headers, not including line numbers and relocationsintsizeof()Returns the size (in bytes) of this COFF file header.DataTypetoDataType()Returns a structure datatype representing the contents of the implementor of this interface.
-
-
-
Constructor Detail
-
CoffFileHeader
public CoffFileHeader(ByteProvider provider) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getMagic
public short getMagic()
Returns the magic COFF file identifier.- Returns:
- the magic COFF file identifier
-
getSectionCount
public short getSectionCount()
Returns the number of sections in this COFF file.- Returns:
- the number of sections in this COFF file
-
getTimestamp
public int getTimestamp()
Returns the time stamp of when this file was created.- Returns:
- the time stamp of when this file was created
-
getSymbolTablePointer
public int getSymbolTablePointer()
Returns the file offset to the symbol table.- Returns:
- the file offset to the symbol table
-
getSymbolTableEntries
public int getSymbolTableEntries()
Returns the number of symbols in the symbol table.- Returns:
- the number of symbols in the symbol table
-
getOptionalHeaderSize
public short getOptionalHeaderSize()
Returns the size in bytes of the optional header. The optional header immediately follows the file header and immediately proceeds the sections headers.- Returns:
- the size in bytes of the optional header
-
getFlags
public short getFlags()
Returns the flags about this COFF.- Returns:
- the flags about this COFF
-
getTargetID
public short getTargetID() throws CoffExceptionReturns the specific target id- Returns:
- the specific target id
- Throws:
CoffException
-
getImageBase
public long getImageBase(boolean isWindowsPlatform)
Returns the image base.- Returns:
- the image base
-
getMachineName
public java.lang.String getMachineName()
Returns the machine name.- Returns:
- the machine name
-
getMachine
public short getMachine()
-
parseSectionHeaders
public void parseSectionHeaders(ByteProvider provider) throws java.io.IOException
Read just the section headers, not including line numbers and relocations- Parameters:
provider-- Throws:
java.io.IOException
-
parse
public void parse(ByteProvider provider, TaskMonitor monitor) throws java.io.IOException
Finishes the parsing of this file header.- Parameters:
monitor- the task monitor- Throws:
java.io.IOException- if an i/o error occurs
-
getSections
public java.util.List<CoffSectionHeader> getSections()
Returns the sections in this COFF header.- Returns:
- the sections in this COFF header
-
getSymbols
public java.util.List<CoffSymbol> getSymbols()
Returns the symbols in this COFF header.- Returns:
- the symbols in this COFF header
-
getSymbolAtIndex
public CoffSymbol getSymbolAtIndex(long index)
-
sizeof
public int sizeof()
Returns the size (in bytes) of this COFF file header.- Returns:
- the size (in bytes) of this COFF file header
-
getOptionalHeader
public AoutHeader getOptionalHeader()
Returns the a.out optional header. This return value may be null.- Returns:
- the a.out optional header
-
toDataType
public DataType toDataType() throws DuplicateNameException, java.io.IOException
Description copied from interface:StructConverterReturns a structure datatype representing the contents of the implementor of this interface.For example, given:
class A { int foo; double bar; }The return value should be a structure data type with two data type components; an INT and a DOUBLE. The structure should contain field names and, if possible, field comments.
- Specified by:
toDataTypein interfaceStructConverter- Returns:
- returns a structure datatype representing the implementor of this interface
- Throws:
DuplicateNameException- when a datatype of the same name already existsjava.io.IOException- See Also:
StructureDataType
-
-