Class CliAbstractTable
java.lang.Object
ghidra.app.util.bin.format.pe.cli.tables.CliAbstractTable
- All Implemented Interfaces:
PeMarkupable
,StructConverter
- Direct Known Subclasses:
CliTableAssembly
,CliTableAssemblyOS
,CliTableAssemblyProcessor
,CliTableAssemblyRef
,CliTableAssemblyRefOS
,CliTableAssemblyRefProcessor
,CliTableClassLayout
,CliTableConstant
,CliTableCustomAttribute
,CliTableDeclSecurity
,CliTableEvent
,CliTableEventMap
,CliTableExportedType
,CliTableField
,CliTableFieldLayout
,CliTableFieldMarshall
,CliTableFieldRVA
,CliTableFile
,CliTableGenericParam
,CliTableGenericParamConstraint
,CliTableImplMap
,CliTableInterfaceImpl
,CliTableManifestResource
,CliTableMemberRef
,CliTableMethodDef
,CliTableMethodImpl
,CliTableMethodSemantics
,CliTableMethodSpec
,CliTableModule
,CliTableModuleRef
,CliTableNestedClass
,CliTableParam
,CliTableProperty
,CliTablePropertyMap
,CliTableStandAloneSig
,CliTableTypeDef
,CliTableTypeRef
,CliTableTypeSpec
Generic Metadata table. Subclasses should provided implementations for the actual
tables.
-
Field Summary
Modifier and TypeFieldDescriptionprotected CliStreamMetadata
protected int
static final String
protected long
protected ArrayList
<CliAbstractTableRow> protected CliTypeTable
-
Constructor Summary
ConstructorDescriptionCliAbstractTable
(BinaryReader reader, CliStreamMetadata metadataStream, CliTypeTable tableType) Creates a new generic CLI metadata table. -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the number of rows in this table.getRow
(int rowIndex) Gets the row at the given index.abstract DataType
Gets the data type of a row in this table.protected String
getRowRepresentationSafe
(CliTypeTable table, int index) Convenience method for getting the row representation of a table.protected String
getRowShortRepSafe
(CliTypeTable otherTable, int index) Convenience method for getting a safe row representation of a table.int
Gets the size in bytes of a row in this table.int
Gets the size in bytes of this table.Gets this table's table type.void
markup
(Program program, boolean isBinary, TaskMonitor monitor, MessageLog log, NTHeader ntHeader) Marks up a PE structure.protected int
readBlobIndex
(BinaryReader reader) Reads the blob index that the reader is positioned at.protected int
readGuidIndex
(BinaryReader reader) Reads the GUID index that the reader is positioned at.protected int
readStringIndex
(BinaryReader reader) Reads the string index that the reader is positioned at.protected int
readTableIndex
(BinaryReader reader, CliTypeTable table) Reads the table index that the reader is positioned at.Returns a structure datatype representing the contents of the implementor of this interface.toString()
-
Field Details
-
PATH
- See Also:
-
readerOffset
protected long readerOffset -
tableType
-
numRows
protected int numRows -
rows
-
metadataStream
-
strings
-
blobs
-
userStrings
-
-
Constructor Details
-
CliAbstractTable
public CliAbstractTable(BinaryReader reader, CliStreamMetadata metadataStream, CliTypeTable tableType) Creates a new generic CLI metadata table. This is intended to be called by a subclass metadata table during its creation.- Parameters:
reader
- A reader that is used to read the table.metadataStream
- The metadata stream that the table lives in.tableType
- The type of table to create.
-
-
Method Details
-
getTableType
Gets this table's table type.- Returns:
- This table's table type.
-
getNumRows
public int getNumRows()Gets the number of rows in this table. return The number of rows in this table. -
getRowSize
public int getRowSize()Gets the size in bytes of a row in this table. return The size in bytes of a row in this table. -
getTableSize
public int getTableSize()Gets the size in bytes of this table.- Returns:
- The size in bytes of this table.
-
getRow
Gets the row at the given index.NOTE: Per ISO/IEC 23271:2012(E) III.1.9, Row indices start from 1, while heap/stream indices start from 0.
- Parameters:
rowIndex
- The index of the row to get (starting at 1).- Returns:
- The row at the given index.
- Throws:
IndexOutOfBoundsException
- if the row index is invalid.
-
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 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
IOException
MemoryAccessException
-
getRowDataType
Gets the data type of a row in this table.- Returns:
- The data type of a row in this table.
-
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.
- Specified by:
toDataType
in interfaceStructConverter
- Returns:
- returns a structure datatype representing the implementor of this interface
- See Also:
-
toString
-
readBlobIndex
Reads the blob index that the reader is positioned at.- Parameters:
reader
- A reader that is positioned at the blob index to read.- Returns:
- The blob index that the reader is positioned at.
- Throws:
IOException
- if there is a problem reading the blob index.
-
readStringIndex
Reads the string index that the reader is positioned at.- Parameters:
reader
- A reader that is positioned at the string index to read.- Returns:
- The string index that the reader is positioned at.
- Throws:
IOException
- if there is a problem reading the string index.
-
readGuidIndex
Reads the GUID index that the reader is positioned at.- Parameters:
reader
- A reader that is positioned at the GUID index to read.- Returns:
- The GUID index that the reader is positioned at.
- Throws:
IOException
- if there is a problem reading the GUID index.
-
readTableIndex
Reads the table index that the reader is positioned at.- Parameters:
reader
- A reader that is positioned at the table index to read.- Returns:
- The table index that the reader is positioned at.
- Throws:
IOException
- if there is a problem reading the table index.
-
getRowRepresentationSafe
Convenience method for getting the row representation of a table.- Parameters:
table
- The table that has the row.index
- The index of the row.- Returns:
- The row representation of a table.
-
getRowShortRepSafe
Convenience method for getting a safe row representation of a table.- Parameters:
otherTable
- The table that has the row.index
- The index of the row.- Returns:
- The safe row representation of a table.
-