Package ghidra.app.util.bin.format.pe

# Class RichHeader

java.lang.Object
ghidra.app.util.bin.format.pe.RichHeader

All Implemented Interfaces:
  `Writeable`, `StructConverter`

public class RichHeader extends Object implements StructConverter, Writeable
The "Rich" header contains encoded metadata about the tool chain used to generate the binary. This class decodes and writes the Rich header (if it exists).

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `IMAGE_DANS_SIGNATURE`
  `static final int`
  `IMAGE_RICH_SIGNATURE`
  `static final String`
  `NAME`

  ### Fields inherited from interface ghidra.app.util.bin.StructConverter

  `ASCII, BYTE, DWORD, IBO32, IBO64, POINTER, QWORD, SLEB128, STRING, ULEB128, UTF16, UTF8, VOID, WORD`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RichHeader(BinaryReader reader)`
  Creates the Rich header found from the given reader.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getMask()`
  Gets the Rich header mask.
  `int`
  `getOffset()`
  Gets the offset of the Rich header.
  `RichHeaderRecord[]`
  `getRecords()`
  Gets the Rich header records.
  `int`
  `getSize()`
  Gets the size of the Rich header.
  `DataType`
  `toDataType()`
  Returns a structure datatype representing the contents of the implementor of this interface.
  `void`
  `write(RandomAccessFile raf, DataConverter dc)`
  Writes this object to the specified random access file using the data converter to handle endianness.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### IMAGE_RICH_SIGNATURE

    public static final int IMAGE_RICH_SIGNATURE
    See Also:
      - Constant Field Values

  - ### IMAGE_DANS_SIGNATURE

    public static final int IMAGE_DANS_SIGNATURE
    See Also:
      - Constant Field Values

  - ### NAME

    public static final String NAME
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### RichHeader

    public RichHeader(BinaryReader reader)
    Creates the Rich header found from the given reader. The reader should be positioned directly after the DOS header.
    Parameters:
      `reader` - The reader to read the PE with.

- ## Method Details

  - ### getOffset

    public int getOffset()
    Gets the offset of the Rich header.
    Returns:
      the offset of the Rich header, or -1 if a Rich header was not found.

  - ### getSize

    public int getSize()
    Gets the size of the Rich header.
    Returns:
      the size of the Rich header. Will be 0 if a Rich header was not found.

  - ### getMask

    public int getMask()
    Gets the Rich header mask.
    Returns:
      the Rich header mask, or -1 if a Rich header was not found.

  - ### getRecords

    public RichHeaderRecord[] getRecords()
    Gets the Rich header records.
    Returns:
      the Rich header records. Could be empty if a Rich header was not found.

  - ### toDataType

    public DataType toDataType()
    Description copied from interface: `StructConverter`
    Returns 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:
      `toDataType` in interface `StructConverter`
    Returns:
      returns a structure datatype representing the implementor of this interface
    See Also:
      - `StructureDataType`

  - ### write

    public void write(RandomAccessFile raf, DataConverter dc) throws IOException
    Description copied from interface: `Writeable`
    Writes this object to the specified random access file using the data converter to handle endianness.
    Specified by:
      `write` in interface `Writeable`
    Parameters:
      `raf` - the random access file
      `dc` - the data converter
    Throws:
      `IOException` - if an I/O error occurs