Class CliStreamMetadata

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

public class CliStreamMetadata extends CliAbstractStream
The Metadata stream is giant and complicated. It is made up of CliAbstractTables.
See Also:
  • Constructor Details

    • CliStreamMetadata

      public CliStreamMetadata(CliStreamHeader header, CliStreamGuid guidStream, CliStreamUserStrings userStringsStream, CliStreamStrings stringsStream, CliStreamBlob blobStream, long fileOffset, int rva, BinaryReader reader) throws IOException
      Creates a new Metadata stream.
      Parameters:
      header - The stream header associated with this stream.
      guidStream - The GUID stream.
      userStringsStream - The user strings stream.
      stringsStream - The strings stream.
      blobStream - The blob stream.
      fileOffset - The file offset where this stream starts.
      rva - The relative virtual address where this stream starts.
      reader - A reader that is set to the start of the stream.
      Throws:
      IOException - if there is a problem reading the stream.
  • Method Details

    • getName

      public static String getName()
      Gets the name of this stream.
      Returns:
      The name of this stream.
    • parse

      public boolean parse() throws IOException
      Description copied from class: CliAbstractStream
      Parses this stream.
      Specified by:
      parse in class CliAbstractStream
      Returns:
      True if parsing completed successfully; otherwise, false.
      Throws:
      IOException - If there was an IO problem while parsing.
    • getGuidStream

      public CliStreamGuid getGuidStream()
      Gets the GUID stream.
      Returns:
      The GUID stream. Could be null if one doesn't exist.
    • getUserStringsStream

      public CliStreamUserStrings getUserStringsStream()
      Gets the user strings stream.
      Returns:
      The user strings stream. Could be null if one doesn't exist.
    • getStringsStream

      public CliStreamStrings getStringsStream()
      Gets the strings stream.
      Returns:
      The strings stream. Could be null if one doesn't exist.
    • getBlobStream

      public CliStreamBlob getBlobStream()
      Gets the blob stream.
      Returns:
      The blob stream. Could be null if one doesn't exist.
    • getMajorVersion

      public short getMajorVersion()
      Gets the major version.
      Returns:
      The major version.
    • getMinorVersion

      public short getMinorVersion()
      Gets the minor version.
      Returns:
      The minor version.
    • getSorted

      public long getSorted()
      Gets the sorted field.
      Returns:
      The sorted field.
    • getValid

      public long getValid()
      Gets the valid field.
      Returns:
      The valid field.
    • getTable

      public CliAbstractTable getTable(CliTypeTable tableType)
      Gets the table with the provided table type from the metadata stream.
      Parameters:
      tableType - The type of table to get.
      Returns:
      The table with the provided table type. Could be null if it doesn't exist.
    • getTable

      public CliAbstractTable getTable(int tableId)
      Gets the table with the provided table type id from the metadata stream.
      Parameters:
      tableId - The id of the table type to get.
      Returns:
      The table with the provided table id. Could be null if it doesn't exist.
    • getNumberRowsForTable

      public int getNumberRowsForTable(CliTypeTable tableType)
      Gets the number of rows in the table with the given table type.
      Parameters:
      tableType - The type of table to get the number of rows of.
      Returns:
      The number of rows in the table with the given table type. Could be 0 if the table of the given type was not found.
    • getStringIndexDataType

      public DataType getStringIndexDataType()
      Gets the data type of the index into the string stream. Will be either DWordDataType or WordDataType.
      Returns:
      The data type of the index into the string stream.
    • getGuidIndexDataType

      public DataType getGuidIndexDataType()
      Gets the data type of the index into the GUID stream. Will be either DWordDataType or WordDataType.
      Returns:
      The data type of the index into the string stream.
    • getBlobIndexDataType

      public DataType getBlobIndexDataType()
      Gets the data type of the index into the Blob stream. Will be either DWordDataType or WordDataType.
      Returns:
      The data type of the index into the string stream.
    • getTableIndexDataType

      public DataType getTableIndexDataType(CliTypeTable table)
      Gets the data type of the index into a metadata table. Will be either DWordDataType or WordDataType.
      Returns:
      The data type of the index into the string stream.
    • markup

      public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, NTHeader ntHeader) throws DuplicateNameException, IOException
      Description copied from class: CliAbstractStream
      Does basic markup that all streams will want:
      • Set monitor message
      • Validate addresses
      • Add bookmark
      • Add symbol
      • Create data type
      Subclass should first call this and then provide any custom markup they need.
      Specified by:
      markup in interface PeMarkupable
      Overrides:
      markup in class CliAbstractStream
      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
    • 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.

      Returns:
      returns a structure datatype representing the implementor of this interface
      See Also: