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 ofCliAbstractTable
s.- See Also:
CliTypeTable
-
-
Constructor Summary
Constructors Constructor Description CliStreamMetadata(CliStreamHeader header, CliStreamGuid guidStream, CliStreamUserStrings userStringsStream, CliStreamStrings stringsStream, CliStreamBlob blobStream, long fileOffset, int rva, BinaryReader reader)
Creates a new Metadata stream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DataType
getBlobIndexDataType()
Gets the data type of the index into the Blob stream.CliStreamBlob
getBlobStream()
Gets the blob stream.DataType
getGuidIndexDataType()
Gets the data type of the index into the GUID stream.CliStreamGuid
getGuidStream()
Gets the GUID stream.short
getMajorVersion()
Gets the major version.short
getMinorVersion()
Gets the minor version.static java.lang.String
getName()
Gets the name of this stream.int
getNumberRowsForTable(CliTypeTable tableType)
Gets the number of rows in the table with the given table type.long
getSorted()
Gets the sorted field.DataType
getStringIndexDataType()
Gets the data type of the index into the string stream.CliStreamStrings
getStringsStream()
Gets the strings stream.CliAbstractTable
getTable(int tableId)
Gets the table with the provided table type id from the metadata stream.CliAbstractTable
getTable(CliTypeTable tableType)
Gets the table with the provided table type from the metadata stream.DataType
getTableIndexDataType(CliTypeTable table)
Gets the data type of the index into a metadata table.CliStreamUserStrings
getUserStringsStream()
Gets the user strings stream.long
getValid()
Gets the valid field.void
markup(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, NTHeader ntHeader)
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.boolean
parse()
Parses this stream.DataType
toDataType()
Returns a structure datatype representing the contents of the implementor of this interface.-
Methods inherited from class ghidra.app.util.bin.format.pe.cli.streams.CliAbstractStream
getStreamHeader, getStreamMarkupAddress
-
-
-
-
Constructor Detail
-
CliStreamMetadata
public CliStreamMetadata(CliStreamHeader header, CliStreamGuid guidStream, CliStreamUserStrings userStringsStream, CliStreamStrings stringsStream, CliStreamBlob blobStream, long fileOffset, int rva, BinaryReader reader) throws java.io.IOException
Creates a new Metadata stream.- Parameters:
header
- The stream header associated with this stream.guidStream
- The GUID stream.userStringStream
- The user strings stream.stringsStrings
- 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:
java.io.IOException
- if there is a problem reading the stream.
-
-
Method Detail
-
getName
public static java.lang.String getName()
Gets the name of this stream.- Returns:
- The name of this stream.
-
parse
public boolean parse() throws java.io.IOException
Description copied from class:CliAbstractStream
Parses this stream.- Specified by:
parse
in classCliAbstractStream
- Returns:
- True if parsing completed successfully; otherwise, false.
- Throws:
java.io.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 eitherDWordDataType
orWordDataType
.- 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 eitherDWordDataType
orWordDataType
.- 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 eitherDWordDataType
orWordDataType
.- 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 eitherDWordDataType
orWordDataType
.- 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, java.io.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
- Specified by:
markup
in interfacePeMarkupable
- Overrides:
markup
in classCliAbstractStream
- 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
java.io.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:
StructureDataType
-
-