Class PortableExecutable


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

      • DEBUG

        public static boolean DEBUG
    • Constructor Detail

      • PortableExecutable

        public PortableExecutable()
        DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
    • Method Detail

      • createPortableExecutable

        public static PortableExecutable createPortableExecutable​(GenericFactory factory,
                                                                  ByteProvider bp,
                                                                  PortableExecutable.SectionLayout layout,
                                                                  boolean advancedProcess,
                                                                  boolean parseCliHeaders)
                                                           throws java.io.IOException
        Constructs a new Portable Executable using the specified byte provider and layout.
        Parameters:
        factory - generic factory instance
        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:
        java.io.IOException - if an I/O error occurs.
      • 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​(java.io.RandomAccessFile raf,
                                DataConverter dc)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • computeAlignment

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

        public long getFileLength()