Class PortableExecutable

java.lang.Object
ghidra.app.util.bin.format.pe.PortableExecutable

public class PortableExecutable extends Object
A class to manage loading Portable Executables (PE).
  • Field Details

  • Constructor Details

    • PortableExecutable

      public PortableExecutable(ByteProvider bp, PortableExecutable.SectionLayout layout) throws IOException
      Constructs a new Portable Executable using the specified byte provider and layout.

      Same as calling createFileAlignedPortableExecutable(factory, bp, layout, true, false)

      Parameters:
      bp - the byte provider
      layout - specifies the layout of the underlying provider and governs RVA resolution
      Throws:
      IOException - if an I/O error occurs.
      See Also:
    • PortableExecutable

      public PortableExecutable(ByteProvider bp, PortableExecutable.SectionLayout layout, boolean advancedProcess, boolean parseCliHeaders) throws IOException
      Constructs a new Portable Executable using the specified byte provider and layout.
      Parameters:
      bp - the byte provider
      layout - specifies the layout of the underlying provider and governs RVA resolution
      advancedProcess - if true, the data directories are also processed
      parseCliHeaders - if true, CLI headers are parsed (if present)
      Throws:
      IOException - if an I/O error occurs.
  • Method Details

    • getDOSHeader

      public DOSHeader getDOSHeader()
      Returns the DOS header from the PE image.
      Returns:
      the DOS header from the PE image
    • getRichHeader

      public RichHeader getRichHeader()
      Returns the Rich header from the PE image.
      Returns:
      the Rich header from the PE image
    • getNTHeader

      public NTHeader getNTHeader()
      Returns the NT header from the PE image.
      Returns:
      the NT header from the PE image
    • writeHeader

      public void writeHeader(RandomAccessFile raf, DataConverter dc) throws IOException
      Throws:
      IOException
    • computeAlignment

      public static int computeAlignment(int value, int alignment)
    • getFileLength

      public long getFileLength()