Class ImportedLibrary
- java.lang.Object
-
- ghidra.app.util.bin.format.pef.ImportedLibrary
-
- All Implemented Interfaces:
StructConverter
public class ImportedLibrary extends java.lang.Object implements StructConverter
Imported Libraries See Apple's -- PEFBinaryFormat.hstruct PEFImportedLibrary { UInt32 nameOffset; // Loader string table offset of library's name. UInt32 oldImpVersion; // Oldest compatible implementation version. UInt32 currentVersion; // Current version at build time. UInt32 importedSymbolCount; // Imported symbol count for this library. UInt32 firstImportedSymbol; // Index of first imported symbol from this library. UInt8 options; // Option bits for this library. UInt8 reservedA; // Reserved, must be zero. UInt16 reservedB; // Reserved, must be zero. };
-
-
Field Summary
Fields Modifier and Type Field Description static int
OPTION_kPEFInitLibBeforeMask
The imported library must be initialized first.static int
OPTION_kPEFWeakImportLibMask
The imported library is allowed to be missing.static int
SIZEOF
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCurrentVersion()
The oldImpVersion and currentVersion fields (4 bytes each) provide version information for checking the compatibility of the imported library.int
getFirstImportedSymbol()
The firstImportedSymbol field (4 bytes) holds the (zero-based) index of the first entry in the imported symbol table for this library.int
getImportedSymbolCount()
The importedSymbolCount field (4 bytes) indicates the number of symbols imported from this library.java.lang.String
getName()
Returns the name of the library being imported.int
getNameOffset()
The nameOffset field (4 bytes) indicates the offset (in bytes) from the beginning of the loader string table to the start of the null-terminated library name.int
getOldImpVersion()
The oldImpVersion and currentVersion fields (4 bytes each) provide version information for checking the compatibility of the imported library.byte
getOptions()
The options byte contains bit flag information as follows:byte
getReservedA()
Reserved, must be set to zero (0).short
getReservedB()
Reserved, must be set to zero (0).DataType
toDataType()
Returns a structure datatype representing the contents of the implementor of this interface.java.lang.String
toString()
-
-
-
Field Detail
-
SIZEOF
public static final int SIZEOF
- See Also:
- Constant Field Values
-
OPTION_kPEFWeakImportLibMask
public static final int OPTION_kPEFWeakImportLibMask
The imported library is allowed to be missing.- See Also:
- Constant Field Values
-
OPTION_kPEFInitLibBeforeMask
public static final int OPTION_kPEFInitLibBeforeMask
The imported library must be initialized first.- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the name of the library being imported.- Returns:
- the name of the library being imported
-
getNameOffset
public int getNameOffset()
The nameOffset field (4 bytes) indicates the offset (in bytes) from the beginning of the loader string table to the start of the null-terminated library name.- Returns:
- loader string table offset of library's name.
-
getOldImpVersion
public int getOldImpVersion()
The oldImpVersion and currentVersion fields (4 bytes each) provide version information for checking the compatibility of the imported library.- Returns:
- oldest compatible implementation version
-
getCurrentVersion
public int getCurrentVersion()
The oldImpVersion and currentVersion fields (4 bytes each) provide version information for checking the compatibility of the imported library.- Returns:
- current version at build time
-
getImportedSymbolCount
public int getImportedSymbolCount()
The importedSymbolCount field (4 bytes) indicates the number of symbols imported from this library.- Returns:
- imported symbol count for this library
-
getFirstImportedSymbol
public int getFirstImportedSymbol()
The firstImportedSymbol field (4 bytes) holds the (zero-based) index of the first entry in the imported symbol table for this library.- Returns:
- index of first imported symbol from this library
-
getOptions
public byte getOptions()
The options byte contains bit flag information as follows:The high-order bit (mask 0x80) controls the order that the import libraries are initialized. If set to 0, the default initialization order is used, which specifies that the Code Fragment Manager should try to initialize the import library before the fragment that imports it. When set to 1, the import library must be initialized before the client fragment.
The next bit (mask 0x40) controls whether the import library is weak. When set to 1 (weak import), the Code Fragment Manager continues preparation of the client fragment (and does not generate an error) even if the import library cannot be found. If the import library is not found, all imported symbols from that library have their addresses set to 0. You can use this information to determine whether a weak import library is actually present.
- Returns:
- option bits for this library
-
getReservedA
public byte getReservedA()
Reserved, must be set to zero (0).- Returns:
- reserved, must be set to zero (0)
-
getReservedB
public short getReservedB()
Reserved, must be set to zero (0).- Returns:
- reserved, must be set to zero (0)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
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
-
-