Package ghidra.app.util.bin.format.pe
Class PortableExecutable
java.lang.Object
ghidra.app.util.bin.format.pe.PortableExecutable
A class to manage loading Portable Executables (PE).
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Indicates how sections of this PE are laid out in the underlying ByteProvider. -
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructs a new Portable Executable using the specified byte provider and layout.PortableExecutable
(ByteProvider bp, PortableExecutable.SectionLayout layout, boolean advancedProcess, boolean parseCliHeaders) Constructs a new Portable Executable using the specified byte provider and layout. -
Method Summary
Modifier and TypeMethodDescriptionstatic int
computeAlignment
(int value, int alignment) Returns the DOS header from the PE image.long
Returns the NT header from the PE image.Returns the Rich header from the PE image.void
writeHeader
(RandomAccessFile raf, DataConverter dc)
-
Field Details
-
NAME
- See Also:
-
DEBUG
public static boolean DEBUG
-
-
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 providerlayout
- 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 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:
IOException
- if an I/O error occurs.
-
-
Method Details
-
getDOSHeader
Returns the DOS header from the PE image.- Returns:
- the DOS header from the PE image
-
getRichHeader
Returns the Rich header from the PE image.- Returns:
- the Rich header from the PE image
-
getNTHeader
Returns the NT header from the PE image.- Returns:
- the NT header from the PE image
-
writeHeader
- Throws:
IOException
-
computeAlignment
public static int computeAlignment(int value, int alignment) -
getFileLength
public long getFileLength()
-