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
The Metadata stream is giant and complicated. It is made up of
CliAbstractTable
s.- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCliStreamMetadata
(CliStreamHeader header, CliStreamGuid guidStream, CliStreamUserStrings userStringsStream, CliStreamStrings stringsStream, CliStreamBlob blobStream, long fileOffset, int rva, BinaryReader reader) Creates a new Metadata stream. -
Method Summary
Modifier and TypeMethodDescriptionGets the data type of the index into the Blob stream.Gets the blob stream.Gets the data type of the index into the GUID stream.Gets the GUID stream.short
Gets the major version.short
Gets the minor version.static 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
Gets the sorted field.Gets the data type of the index into the string stream.Gets the strings stream.getTable
(int tableId) Gets the table with the provided table type id from the metadata stream.getTable
(CliTypeTable tableType) Gets the table with the provided table type from the metadata stream.Gets the data type of the index into a metadata table.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.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 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
Gets the name of this stream.- Returns:
- The name of this stream.
-
parse
Description copied from class:CliAbstractStream
Parses this stream.- Specified by:
parse
in classCliAbstractStream
- Returns:
- True if parsing completed successfully; otherwise, false.
- Throws:
IOException
- If there was an IO problem while parsing.
-
getGuidStream
Gets the GUID stream.- Returns:
- The GUID stream. Could be null if one doesn't exist.
-
getUserStringsStream
Gets the user strings stream.- Returns:
- The user strings stream. Could be null if one doesn't exist.
-
getStringsStream
Gets the strings stream.- Returns:
- The strings stream. Could be null if one doesn't exist.
-
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
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
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
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
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
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
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
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, 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
IOException
-
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:
-