public class PEFile extends Object implements Closeable
| Constructor and Description |
|---|
PEFile(File file)
Create a PEFile from the specified file.
|
PEFile(SeekableByteChannel channel)
Create a PEFile from the specified channel.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
long |
computeChecksum()
Compute the checksum of the image file.
|
byte[] |
computeDigest(DigestAlgorithm algorithm)
Compute the checksum of the file using the specified digest algorithm.
|
long |
getAddressOfEntryPoint()
The address of the entry point relative to the image base when the
executable file is loaded into memory.
|
long |
getBaseOfCode()
The address that is relative to the image base of the beginning-of-code
section when it is loaded into memory.
|
long |
getBaseOfData()
The address that is relative to the image base of the beginning-of-data
section when it is loaded into memory (PE32 only).
|
int |
getCharacteristics()
The flags that indicate the attributes of the file.
|
long |
getCheckSum()
The image file checksum.
|
DataDirectory |
getDataDirectory(DataDirectoryType type)
Returns the data directory of the specified type.
|
int |
getDllCharacteristics() |
long |
getFileAlignment()
The alignment factor (in bytes) that is used to align the raw data of
sections in the image file.
|
PEFormat |
getFormat() |
long |
getImageBase()
The preferred address of the first byte of image when loaded into memory;
must be a multiple of 64 K.
|
long |
getLoaderFlags()
Reserved, must be zero.
|
MachineType |
getMachineType() |
int |
getMajorImageVersion()
The major version number of the image.
|
int |
getMajorLinkerVersion()
The linker major version number.
|
int |
getMajorOperatingSystemVersion()
The major version number of the required operating system.
|
int |
getMajorSubsystemVersion()
The major version number of the subsystem.
|
int |
getMinorImageVersion()
The minor version number of the image.
|
int |
getMinorLinkerVersion()
The linker minor version number.
|
int |
getMinorOperatingSystemVersion()
The minor version number of the required operating system.
|
int |
getMinorSubsystemVersion()
The minor version number of the subsystem.
|
int |
getNumberOfRvaAndSizes()
The number of data-directory entries in the remainder of the optional
header.
|
int |
getNumberOfSections()
The number of sections.
|
long |
getNumberOfSymbols()
The number of entries in the symbol table.
|
long |
getPointerToSymbolTable()
The file offset of the COFF symbol table, or zero if no COFF symbol table
is present.
|
long |
getSectionAlignment()
The alignment (in bytes) of sections when they are loaded into memory.
|
List<Section> |
getSections() |
List<CMSSignedData> |
getSignatures()
Returns the authenticode signatures on the file.
|
long |
getSizeOfCode()
The size of the code (text) section, or the sum of all code sections
if there are multiple sections.
|
long |
getSizeOfHeaders()
The combined size of an MS DOS stub, PE header, and section headers
rounded up to a multiple of FileAlignment.
|
long |
getSizeOfHeapCommit()
The size of the local heap space to commit.
|
long |
getSizeOfHeapReserve()
The size of the local heap space to reserve.
|
long |
getSizeOfImage()
The size (in bytes) of the image, including all headers, as the image
is loaded in memory.
|
long |
getSizeOfInitializedData()
The size of the initialized data section, or the sum of all such
sections if there are multiple data sections.
|
int |
getSizeOfOptionalHeader()
The size of the optional header, which is required for executable files
but not for object files.
|
long |
getSizeOfStackCommit()
The size of the stack to commit.
|
long |
getSizeOfStackReserve()
The size of the stack to reserve.
|
long |
getSizeOfUninitializedData()
The size of the uninitialized data section (BSS), or the sum of all such
sections if there are multiple BSS sections.
|
Subsystem |
getSubsystem()
The subsystem that is required to run this image.
|
Date |
getTimeDateStamp()
The low 32 bits of the number of seconds since 00:00 January 1, 1970
(a C runtime time_t value), that indicates when the file was created.
|
long |
getWin32VersionValue()
Reserved, must be zero.
|
void |
pad(int multiple)
Increase the size of the file up to a size that is a multiple of the specified value.
|
void |
printInfo(OutputStream out)
Print detailed informations about the PE file.
|
void |
printInfo(PrintWriter out)
Print detailed informations about the PE file.
|
void |
updateChecksum() |
void |
writeDataDirectory(DataDirectoryType type,
byte[] data)
Writes the data directory of the specified type.
|
public PEFile(File file) throws IOException
file - IOExceptionpublic PEFile(SeekableByteChannel channel) throws IOException
IOExceptionpublic void close() throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic long computeChecksum()
public byte[] computeDigest(DigestAlgorithm algorithm) throws IOException
algorithm - the digest algorithm, typically SHA1IOExceptionpublic long getAddressOfEntryPoint()
public long getBaseOfCode()
public long getBaseOfData()
public int getCharacteristics()
public long getCheckSum()
public DataDirectory getDataDirectory(DataDirectoryType type)
public int getDllCharacteristics()
public long getFileAlignment()
public long getImageBase()
public long getLoaderFlags()
public MachineType getMachineType()
public int getMajorImageVersion()
public int getMajorLinkerVersion()
public int getMajorOperatingSystemVersion()
public int getMajorSubsystemVersion()
public int getMinorImageVersion()
public int getMinorLinkerVersion()
public int getMinorOperatingSystemVersion()
public int getMinorSubsystemVersion()
public int getNumberOfRvaAndSizes()
public int getNumberOfSections()
public long getNumberOfSymbols()
public long getPointerToSymbolTable()
public long getSectionAlignment()
public List<Section> getSections()
public List<CMSSignedData> getSignatures()
public long getSizeOfCode()
public long getSizeOfHeaders()
public long getSizeOfHeapCommit()
public long getSizeOfHeapReserve()
public long getSizeOfImage()
public long getSizeOfInitializedData()
public int getSizeOfOptionalHeader()
public long getSizeOfStackCommit()
public long getSizeOfStackReserve()
public long getSizeOfUninitializedData()
public Subsystem getSubsystem()
public Date getTimeDateStamp()
public long getWin32VersionValue()
public void pad(int multiple) throws IOException
multiple - IOExceptionpublic void printInfo(OutputStream out)
public void printInfo(PrintWriter out)
public void updateChecksum()
public void writeDataDirectory(DataDirectoryType type, byte[] data) throws IOException
type - the type of the data directorydata - the content of the data directoryIOExceptionCopyright © 2012–2019. All rights reserved.