Package ghidra.app.util.bin.format.coff.archive

# Class CoffArchiveHeader

java.lang.Object
ghidra.app.util.bin.format.coff.archive.CoffArchiveHeader

All Implemented Interfaces:
  `StructConverter`

public final class CoffArchiveHeader extends Object implements StructConverter
A class that represents a COFF archive file (ie. MS .lib files, Unix .ar files)

COFF archives are very primitive compared to containers like ZIP or even TAR.

The name of entries (ie. files) inside the archive is limited to 16 bytes, and to support longer names a couple of different schemes have been invented. See the comments in `CoffArchiveMemberHeader.read(BinaryReader, LongNamesMember)` for decoding the name.

- ## Field Summary

  ### Fields inherited from interface ghidra.app.util.bin.StructConverter

  `ASCII, BYTE, DWORD, IBO32, IBO64, POINTER, QWORD, SLEB128, STRING, ULEB128, UTF16, UTF8, VOID, WORD`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `CoffArchiveHeader()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<CoffArchiveMemberHeader>`
  `getArchiveMemberHeaders()`
  `FirstLinkerMember`
  `getFirstLinkerMember()`
  `LongNamesMember`
  `getLongNameMember()`
  `SecondLinkerMember`
  `getSecondLinkerMember()`
  `static boolean`
  `isMatch(ByteProvider provider)`
  Returns true if the data contained in the `provider` contains a COFF Archive file.
  `boolean`
  `isMSFormat()`
  Returns true if this COFF archive seems to be a Microsoft lib file (ie.
  `static CoffArchiveHeader`
  `read(ByteProvider provider, TaskMonitor monitor)`
  Reads and parses the headers and meta-data in a COFF Archive file.
  `DataType`
  `toDataType()`
  Returns a structure datatype representing the contents of the implementor of this interface.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CoffArchiveHeader

    protected CoffArchiveHeader()

- ## Method Details

  - ### isMatch

    public static boolean isMatch(ByteProvider provider) throws IOException
    Returns true if the data contained in the `provider` contains a COFF Archive file.

    Parameters:
      `provider` -
    Returns:
    Throws:
      `IOException`

  - ### read

    public static CoffArchiveHeader read(ByteProvider provider, TaskMonitor monitor) throws CoffException, IOException
    Reads and parses the headers and meta-data in a COFF Archive file.

    Returns a `CoffArchiveHeader` that has a list of the `members` in the archive.

    Parameters:
      `provider` -
      `monitor` -
    Returns:
    Throws:
      `CoffException`
      `IOException`

  - ### toDataType

    public DataType toDataType() throws DuplicateNameException, 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
      `IOException`
    See Also:
      - `StructureDataType`

  - ### getArchiveMemberHeaders

    public List<CoffArchiveMemberHeader> getArchiveMemberHeaders()

  - ### getFirstLinkerMember

    public FirstLinkerMember getFirstLinkerMember()

  - ### getSecondLinkerMember

    public SecondLinkerMember getSecondLinkerMember()

  - ### getLongNameMember

    public LongNamesMember getLongNameMember()

  - ### isMSFormat

    public boolean isMSFormat()
    Returns true if this COFF archive seems to be a Microsoft lib file (ie. has linker members and other features specific to MS)
    Returns: