Class CliStreamHeader

java.lang.Object
ghidra.app.util.bin.format.pe.cli.CliStreamHeader
All Implemented Interfaces:
PeMarkupable, StructConverter

public class CliStreamHeader extends Object implements StructConverter, PeMarkupable
A structure used by a CliMetadataRoot describe a CliAbstractStream.

Note that this type of "header" isn't found at the start of the stream, but as elements of a list of headers at the end of a CliMetadataRoot. They are kind of like PE section headers.

  • Constructor Details

    • CliStreamHeader

      public CliStreamHeader(CliMetadataRoot metadataRoot, BinaryReader reader) throws IOException
      Constructs a new CLI Stream Header datatype.
      Parameters:
      metadataRoot - the metadata root.
      reader - A binary reader set to start reading at the start of this header.
      Throws:
      IOException - if there is a problem reading the header.
  • Method Details

    • markup

      public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, NTHeader ntHeader) throws DuplicateNameException, IOException, MemoryAccessException
      Description copied from interface: PeMarkupable
      Marks up a PE structure.
      Specified by:
      markup in interface PeMarkupable
      Parameters:
      program - The program to markup.
      isBinary - True if the program is binary; otherwise, false.
      monitor - The monitor.
      log - The log.
      ntHeader - The PE's NT Header structure.
      Throws:
      DuplicateNameException
      IOException
      MemoryAccessException
    • toDataType

      public DataType toDataType() throws DuplicateNameException, IOException
      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
      Throws:
      DuplicateNameException - when a datatype of the same name already exists
      IOException - if an IO-related error occurs
      See Also:
    • getMetadataRoot

      public CliMetadataRoot getMetadataRoot()
      Gets the CliMetadataRoot that contains us.
      Returns:
      The CliMetadataRoot that contains us.
    • getStream

      public CliAbstractStream getStream()
      Gets the CliAbstractStream that this is a header for.
      Returns:
      The CliAbstractStream that this is a header for. Could be null if we don't support the stream type.
    • getOffset

      public int getOffset()
      Gets the offset. This is not a file offset, but an offset that gets added to the metadata header's offset to obtain a file offset.
      Returns:
      The offset.
    • getSize

      public int getSize()
      Gets the size of this header's stream.
      Returns:
      The size of this header's stream.
    • getName

      public String getName()
      Gets the name of this header's stream.
      Returns:
      The name of this header's stream.
    • getNameLength

      public int getNameLength()
      Gets the name length.

      The name length may be larger than necessary because the name string is must be aligned to the next 4-byte boundary.

      Returns:
      The name length.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setStream

      protected void setStream(CliAbstractStream stream)
      Sets this header's stream.
      Parameters:
      stream - The stream associated with this header.