Package ghidra.app.util.bin.format.pe
Class PortableExecutable
- java.lang.Object
-
- ghidra.app.util.bin.format.pe.PortableExecutable
-
public class PortableExecutable extends java.lang.Object
A class to manage loading Portable Executables (PE).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PortableExecutable.SectionLayout
Indicates how sections of this PE are laid out in the underlying ByteProvider.
-
Constructor Summary
Constructors Constructor Description PortableExecutable()
DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
computeAlignment(int value, int alignment)
static PortableExecutable
createPortableExecutable(GenericFactory factory, ByteProvider bp, PortableExecutable.SectionLayout layout)
Constructs a new Portable Executable using the specified byte provider and layout.static PortableExecutable
createPortableExecutable(GenericFactory factory, ByteProvider bp, PortableExecutable.SectionLayout layout, boolean advancedProcess, boolean parseCliHeaders)
Constructs a new Portable Executable using the specified byte provider and layout.DOSHeader
getDOSHeader()
Returns the DOS header from the PE image.long
getFileLength()
NTHeader
getNTHeader()
Returns the NT header from the PE image.RichHeader
getRichHeader()
Returns the Rich header from the PE image.void
writeHeader(java.io.RandomAccessFile raf, DataConverter dc)
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
DEBUG
public static boolean DEBUG
-
-
Method Detail
-
createPortableExecutable
public static PortableExecutable createPortableExecutable(GenericFactory factory, ByteProvider bp, PortableExecutable.SectionLayout layout) throws java.io.IOException
Constructs a new Portable Executable using the specified byte provider and layout.Same as calling
createFileAlignedPortableExecutable(factory, bp, layout, true, false)
- Parameters:
factory
- generic factory instancebp
- the byte providerlayout
- specifies the layout of the underlying provider and governs RVA resolution- Throws:
java.io.IOException
- if an I/O error occurs.- See Also:
createPortableExecutable(GenericFactory, ByteProvider, SectionLayout, boolean, boolean)
-
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 instancebp
- the byte providerlayout
- specifies the layout of the underlying provider and governs RVA resolutionadvancedProcess
- if true, the data directories are also processedparseCliHeaders
- 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()
-
-