Class CliMetadataRoot

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

public class CliMetadataRoot extends Object implements StructConverter, PeMarkupable
The header of a CliMetadataDirectory.
  • Field Details

  • Constructor Details

    • CliMetadataRoot

      public CliMetadataRoot(BinaryReader reader, int rva) throws IOException
      Constructs a new CLI Metadata Root datatype. Matches ISO 23271 II.24.2.
      Parameters:
      reader - A binary reader set to start reading at the start of this header.
      rva - The RVA of this header.
      Throws:
      IOException - if there is a problem reading the header.
  • Method Details

    • parse

      public boolean parse() throws IOException
      Throws:
      IOException
    • markup

      public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException, 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
      CodeUnitInsertionException
      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
      See Also:
    • getFileOffset

      public long getFileOffset()
      Gets the file offset of this header.
      Returns:
      The file offset of this header.
    • getRva

      public int getRva()
      Gets the relative virtual address of this header.
      Returns:
      The relative virtual address of this header.
    • getSignature

      public int getSignature()
      Gets the signature.

      Should always be 0x424a5342.

      Returns:
      The signature.
    • getMajorVersion

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

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

      public int getReserved()
      Gets the reserved field.

      Should always be 0.

      Returns:
      The reserved field.
    • getVersionLength

      public int getVersionLength()
      Gets the length of the version string that follows the length field.
      Returns:
      The length of the version string that follows the length field.
    • getVersion

      public String getVersion()
      Gets the version string.
      Returns:
      The version string. Could be null if the version length appeared too long during parsing of the header.
    • getFlags

      public short getFlags()
      Gets the flags.

      Should always be 0.

      Returns:
      The flags.
    • getStreamsCount

      public short getStreamsCount()
      Gets the number of streams present in the metadata.
      Returns:
      The number of streams present in the metadata.
    • getGuidStream

      public CliStreamGuid getGuidStream()
      Gets the GUID stream.
      Returns:
      The GUID stream. Could be null if it did not parse correctly.
    • getUserStringsStream

      public CliStreamUserStrings getUserStringsStream()
      Gets the user strings stream.
      Returns:
      The user strings stream. Could be null if it did not parse correctly.
    • getStringsStream

      public CliStreamStrings getStringsStream()
      Gets the strings stream.
      Returns:
      The strings stream. Could be null if it did not parse correctly.
    • getBlobStream

      public CliStreamBlob getBlobStream()
      Gets the blob stream.
      Returns:
      The blob stream. Could be null if it did not parse correctly.
    • getMetadataStream

      public CliStreamMetadata getMetadataStream()
      Gets the Metadata stream.
      Returns:
      The Metadata stream. Could be null if it did not parse correctly.
    • getStreamHeaders

      public Collection<CliStreamHeader> getStreamHeaders()
      Gets the stream headers.
      Returns:
      A collection of stream headers.
    • getStreamHeader

      public CliStreamHeader getStreamHeader(String name)
      Gets the stream header with the given name.
      Parameters:
      name - The name of the stream header to get.
      Returns:
      The stream header that matches the given name, or null if it wasn't found.
    • getBlobOffsetAtIndex

      public int getBlobOffsetAtIndex(int index)