Class CliMetadataRoot
- java.lang.Object
-
- ghidra.app.util.bin.format.pe.cli.CliMetadataRoot
-
- All Implemented Interfaces:
PeMarkupable
,StructConverter
public class CliMetadataRoot extends java.lang.Object implements StructConverter, PeMarkupable
The header of aCliMetadataDirectory
.
-
-
Constructor Summary
Constructors Constructor Description CliMetadataRoot(BinaryReader reader, int rva)
Constructs a new CLI Metadata Root datatype.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBlobOffsetAtIndex(int index)
CliStreamBlob
getBlobStream()
Gets the blob stream.long
getFileOffset()
Gets the file offset of this header.short
getFlags()
Gets the flags.CliStreamGuid
getGuidStream()
Gets the GUID stream.short
getMajorVersion()
Gets the major version.CliStreamMetadata
getMetadataStream()
Gets the Metadata stream.short
getMinorVersion()
Gets the minor version.int
getReserved()
Gets the reserved field.int
getRva()
Gets the relative virtual address of this header.int
getSignature()
Gets the signature.CliStreamHeader
getStreamHeader(java.lang.String name)
Gets the stream header with the given name.java.util.Collection<CliStreamHeader>
getStreamHeaders()
Gets the stream headers.short
getStreamsCount()
Gets the number of streams present in the metadata.CliStreamStrings
getStringsStream()
Gets the strings stream.CliStreamUserStrings
getUserStringsStream()
Gets the user strings stream.java.lang.String
getVersion()
Gets the version string.int
getVersionLength()
Gets the length of the version string that follows the length field.void
markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, NTHeader ntHeader)
Marks up a PE structure.boolean
parse()
DataType
toDataType()
Returns a structure datatype representing the contents of the implementor of this interface.
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
PATH
public static final java.lang.String PATH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CliMetadataRoot
public CliMetadataRoot(BinaryReader reader, int rva) throws java.io.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:
java.io.IOException
- if there is a problem reading the header.
-
-
Method Detail
-
parse
public boolean parse() throws java.io.IOException
- Throws:
java.io.IOException
-
markup
public void markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, NTHeader ntHeader) throws DuplicateNameException, CodeUnitInsertionException, java.io.IOException, MemoryAccessException
Description copied from interface:PeMarkupable
Marks up a PE structure.- Specified by:
markup
in interfacePeMarkupable
- 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
java.io.IOException
MemoryAccessException
-
toDataType
public DataType toDataType() throws DuplicateNameException, java.io.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 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
-
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 java.lang.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 java.util.Collection<CliStreamHeader> getStreamHeaders()
Gets the stream headers.- Returns:
- A collection of stream headers.
-
getStreamHeader
public CliStreamHeader getStreamHeader(java.lang.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)
-
-