Class LoaderInfoHeader

  • All Implemented Interfaces:
    StructConverter

    public class LoaderInfoHeader
    extends java.lang.Object
    implements StructConverter
    See Apple's -- PEFBinaryFormat.h
     struct PEFLoaderInfoHeader {
         SInt32  mainSection;              // Section containing the main symbol, -1 => none.
         UInt32  mainOffset;               // Offset of main symbol.
         SInt32  initSection;              // Section containing the init routine's TVector, -1 => none.
         UInt32  initOffset;               // Offset of the init routine's TVector.
         SInt32  termSection;              // Section containing the term routine's TVector, -1 => none.
         UInt32  termOffset;               // Offset of the term routine's TVector.
         UInt32  importedLibraryCount;     // Number of imported libraries.  ('l')
         UInt32  totalImportedSymbolCount; // Total number of imported symbols.  ('i')
         UInt32  relocSectionCount;        // Number of sections with relocations.  ('r')
         UInt32  relocInstrOffset;         // Offset of the relocation instructions.
         UInt32  loaderStringsOffset;      // Offset of the loader string table.
         UInt32  exportHashOffset;         // Offset of the export hash table.
         UInt32  exportHashTablePower;     // Export hash table size as log 2.  (Log2('h'))
         UInt32  exportedSymbolCount;      // Number of exported symbols.  ('e')
     };
     
    • Method Detail

      • getMainSection

        public int getMainSection()
        The mainSection field (4 bytes) specifies the number of the section in this container that contains the main symbol. If the fragment does not have a main symbol, this field is set to -1.
        Returns:
        number of section containing main symbol
      • getMainOffset

        public int getMainOffset()
        The mainOffset field (4 bytes) indicates the offset (in bytes) from the beginning of the section to the main symbol.
        Returns:
        offset to the main symbol
      • getInitSection

        public int getInitSection()
        The initSection field (4 bytes) contains the number of the section containing the initialization function's transition vector. If no initialization function exists, this field is set to -1.
        Returns:
        number of the section containing the initialization function's transition vector
      • getInitOffset

        public int getInitOffset()
        The initOffset field (4 bytes) indicates the offset (in bytes) from the beginning of the section to the initialization function's transition vector.
        Returns:
        offset to initialization function's transition vector
      • getTermSection

        public int getTermSection()
        The termSection field (4 bytes) contains the number of the section containing the termination routine's transition vector. If no termination routine exists, this field is set to -1.
        Returns:
        number of the section containing the termination routine's transition vector
      • getTermOffset

        public int getTermOffset()
        The termOffset field (4 bytes) indicates the offset (in bytes) from the beginning of the section to the termination routine's transition vector.
        Returns:
        offset to termination routine's transition vector
      • getImportedLibraryCount

        public int getImportedLibraryCount()
        The importedLibraryCount field (4 bytes) indicates the number of imported libraries.
        Returns:
        number of imported libraries
      • getTotalImportedSymbolCount

        public int getTotalImportedSymbolCount()
        The totalImportedSymbolCount field (4 bytes) indicates the total number of imported symbols.
        Returns:
        number of imported symbols
      • getRelocSectionCount

        public int getRelocSectionCount()
        The relocSectionCount field (4 bytes) indicates the number of sections containing load-time relocations.
        Returns:
        number of sections containing load-time relocations
      • getRelocInstrOffset

        public int getRelocInstrOffset()
        The relocInstrOffset field (4 bytes) indicates the offset (in bytes) from the beginning of the loader section to the start of the relocations area.
        Returns:
        offset to the relocations
      • getLoaderStringsOffset

        public int getLoaderStringsOffset()
        The loaderStringsOffset field (4 bytes) indicates the offset (in bytes) from the beginning of the loader section to the start of the loader string table.
        Returns:
        offset to the loader string table
      • getExportHashOffset

        public int getExportHashOffset()
        The exportHashOffset field (4 bytes) indicates the offset (in bytes) from the beginning of the loader section to the start of the export hash table. The hash table should be 4-byte aligned with padding added if necessary.
        Returns:
        offset to the export hash table
      • getExportHashTablePower

        public int getExportHashTablePower()
        The exportHashTablePower field (4 bytes) indicates the number of hash index values (that is, the number of entries in the hash table). The number of entries is specified as a power of two. For example, a value of 0 indicates one entry, while a value of 2 indicates four entries. If no exports exist, the hash table still contains one entry, and the value of this field is 0.
        Returns:
        number of hash index values
      • getExportedSymbolCount

        public int getExportedSymbolCount()
        The exportedSymbolCount field (4 bytes) indicates the number of symbols exported from this container.
        Returns:
        number of symbols exported from this container
      • getSection

        public SectionHeader getSection()
        Returns the section corresponding to this loader.
        Returns:
        the section corresponding to this loader
      • findLibrary

        public ImportedLibrary findLibrary​(int symbolIndex)
        Finds the PEF library that contains the specified imported symbol index.
        Parameters:
        loader - the PEF loader info header
        symbolIndex - the imported symbol index
        Returns:
        PEF library that contains the specified imported symbol index
      • getImportedLibraries

        public java.util.List<ImportedLibrary> getImportedLibraries()
      • getImportedSymbols

        public java.util.List<ImportedSymbol> getImportedSymbols()
      • getExportedSymbolKeys

        public java.util.List<ExportedSymbolKey> getExportedSymbolKeys()
      • getExportedSymbols

        public java.util.List<ExportedSymbol> getExportedSymbols()
      • 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 interface StructConverter
        Returns:
        returns a structure datatype representing the implementor of this interface
        Throws:
        DuplicateNameException - when a datatype of the same name already exists
        java.io.IOException
        See Also:
        StructureDataType