Package ghidra.app.util.bin.format.pe
Interface OptionalHeader
-
- All Superinterfaces:
StructConverter
- All Known Implementing Classes:
OptionalHeaderImpl
public interface OptionalHeader extends StructConverter
-
-
Field Summary
Fields Modifier and Type Field Description static byteIMAGE_DIRECTORY_ENTRY_ARCHITECTUREArchitecture Specific Data directory indexstatic byteIMAGE_DIRECTORY_ENTRY_BASERELOCBase Relocation Table directory indexstatic byteIMAGE_DIRECTORY_ENTRY_BOUND_IMPORTBound Import directory indexstatic byteIMAGE_DIRECTORY_ENTRY_COM_DESCRIPTORCOM Runtime Descriptor directory indexstatic byteIMAGE_DIRECTORY_ENTRY_COMHEADERNew name for the COM Descriptor directory indexstatic byteIMAGE_DIRECTORY_ENTRY_DEBUGDebug directory indexstatic byteIMAGE_DIRECTORY_ENTRY_DELAY_IMPORTDelay Load Import Descriptors directory indexstatic byteIMAGE_DIRECTORY_ENTRY_EXCEPTIONException directory indexstatic byteIMAGE_DIRECTORY_ENTRY_EXPORTExport directory indexstatic byteIMAGE_DIRECTORY_ENTRY_GLOBALPTRGlobal Pointer directory indexstatic byteIMAGE_DIRECTORY_ENTRY_IATImport Address Table directory indexstatic byteIMAGE_DIRECTORY_ENTRY_IMPORTImport directory indexstatic byteIMAGE_DIRECTORY_ENTRY_LOAD_CONFIGLoad Configuration directory indexstatic byteIMAGE_DIRECTORY_ENTRY_RESOURCEResource directory indexstatic byteIMAGE_DIRECTORY_ENTRY_SECURITYSecurity directory indexstatic byteIMAGE_DIRECTORY_ENTRY_TLSTLS directory indexstatic byteIMAGE_NUMBEROF_DIRECTORY_ENTRIESThe count of data directories in the optional header.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longgetAddressOfEntryPoint()longgetBaseOfCode()Returns the RVA of the first byte of code when loaded in memory.longgetBaseOfData()intgetChecksum()Get the image file checksum.DataDirectory[]getDataDirectories()Returns the array of data directories.shortgetDllCharacteristics()Return flags that describe properties of and features of this binary.intgetFileAlignment()longgetImageBase()intgetLoaderFlags()Return the flags passed to the loader.shortgetMajorImageVersion()Get the major version number of the image.bytegetMajorLinkerVersion()Return the major version number of the linker that built this binary.shortgetMajorOperatingSystemVersion()Return the major version number of the required operating system.shortgetMajorSubsystemVersion()Get the major version number of the subsystem.shortgetMinorImageVersion()Get the minor version number of the image.bytegetMinorLinkerVersion()Return the minor version number of the linker that built this binary.shortgetMinorOperatingSystemVersion()Return the minor version number of the required operating system.shortgetMinorSubsystemVersion()Get the minor version number of the subsystem.longgetNumberOfRvaAndSizes()longgetOriginalImageBase()intgetSectionAlignment()longgetSizeOfCode()Returns the combined total size of all sections with theIMAGE_SCN_CNT_CODEattribute.longgetSizeOfHeaders()longgetSizeOfHeapCommit()Return the size of the heap to commitlonggetSizeOfHeapReserve()Return the size of the heap reservationlonggetSizeOfImage()longgetSizeOfInitializedData()Returns the combined size of all initialized data sections.longgetSizeOfStackCommit()Return the size of the stack to commitlonggetSizeOfStackReserve()Return the size of the stack reservationlonggetSizeOfUninitializedData()Returns the size of all sections with the uninitialized data attributes.intgetSubsystem()Get the subsystem that is required to run this image.intgetWin32VersionValue()This value is reserved, and must be 0booleanis64bit()Returns true of this optional header is 64-bit.booleanisCLI()voidprocessDataDirectories(TaskMonitor monitor)This methods tells this optional header to process its data directories.voidsetSizeOfCode(long size)voidsetSizeOfHeaders(long size)voidsetSizeOfImage(long size)voidsetSizeOfInitializedData(long size)voidsetSizeOfUninitializedData(long size)voidvalidateDataDirectories(Program program)booleanwasRebased()voidwriteHeader(java.io.RandomAccessFile raf, DataConverter dc)Writes this optional header to the specified random access file.-
Methods inherited from interface ghidra.app.util.bin.StructConverter
toDataType
-
-
-
-
Field Detail
-
IMAGE_NUMBEROF_DIRECTORY_ENTRIES
static final byte IMAGE_NUMBEROF_DIRECTORY_ENTRIES
The count of data directories in the optional header.- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_EXPORT
static final byte IMAGE_DIRECTORY_ENTRY_EXPORT
Export directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_IMPORT
static final byte IMAGE_DIRECTORY_ENTRY_IMPORT
Import directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_RESOURCE
static final byte IMAGE_DIRECTORY_ENTRY_RESOURCE
Resource directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_EXCEPTION
static final byte IMAGE_DIRECTORY_ENTRY_EXCEPTION
Exception directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_SECURITY
static final byte IMAGE_DIRECTORY_ENTRY_SECURITY
Security directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_BASERELOC
static final byte IMAGE_DIRECTORY_ENTRY_BASERELOC
Base Relocation Table directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_DEBUG
static final byte IMAGE_DIRECTORY_ENTRY_DEBUG
Debug directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_ARCHITECTURE
static final byte IMAGE_DIRECTORY_ENTRY_ARCHITECTURE
Architecture Specific Data directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_GLOBALPTR
static final byte IMAGE_DIRECTORY_ENTRY_GLOBALPTR
Global Pointer directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_TLS
static final byte IMAGE_DIRECTORY_ENTRY_TLS
TLS directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG
static final byte IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG
Load Configuration directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
static final byte IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
Bound Import directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_IAT
static final byte IMAGE_DIRECTORY_ENTRY_IAT
Import Address Table directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT
static final byte IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT
Delay Load Import Descriptors directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR
static final byte IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR
COM Runtime Descriptor directory index- See Also:
- Constant Field Values
-
IMAGE_DIRECTORY_ENTRY_COMHEADER
static final byte IMAGE_DIRECTORY_ENTRY_COMHEADER
New name for the COM Descriptor directory index- See Also:
- Constant Field Values
-
-
Method Detail
-
is64bit
boolean is64bit()
Returns true of this optional header is 64-bit.- Returns:
- true of this optional header is 64-bit
-
getMajorLinkerVersion
byte getMajorLinkerVersion()
Return the major version number of the linker that built this binary.- Returns:
-
getMinorLinkerVersion
byte getMinorLinkerVersion()
Return the minor version number of the linker that built this binary.- Returns:
-
getMajorOperatingSystemVersion
short getMajorOperatingSystemVersion()
Return the major version number of the required operating system.- Returns:
-
getMinorOperatingSystemVersion
short getMinorOperatingSystemVersion()
Return the minor version number of the required operating system.- Returns:
-
getMajorImageVersion
short getMajorImageVersion()
Get the major version number of the image.- Returns:
-
getMinorImageVersion
short getMinorImageVersion()
Get the minor version number of the image.- Returns:
-
getMajorSubsystemVersion
short getMajorSubsystemVersion()
Get the major version number of the subsystem.
-
getMinorSubsystemVersion
short getMinorSubsystemVersion()
Get the minor version number of the subsystem.- Returns:
-
getWin32VersionValue
int getWin32VersionValue()
This value is reserved, and must be 0
-
getChecksum
int getChecksum()
Get the image file checksum.- Returns:
-
getSubsystem
int getSubsystem()
Get the subsystem that is required to run this image.- Returns:
-
getDllCharacteristics
short getDllCharacteristics()
Return flags that describe properties of and features of this binary.- Returns:
- See Also:
DllCharacteristics
-
getSizeOfStackReserve
long getSizeOfStackReserve()
Return the size of the stack reservation- Returns:
-
getSizeOfStackCommit
long getSizeOfStackCommit()
Return the size of the stack to commit- Returns:
-
getSizeOfHeapReserve
long getSizeOfHeapReserve()
Return the size of the heap reservation- Returns:
-
getSizeOfHeapCommit
long getSizeOfHeapCommit()
Return the size of the heap to commit- Returns:
-
getLoaderFlags
int getLoaderFlags()
Return the flags passed to the loader. Obsolete.- Returns:
-
getAddressOfEntryPoint
long getAddressOfEntryPoint()
- Returns:
- the RVA of the first code byte in the file that will be executed
-
getImageBase
long getImageBase()
- Returns:
- the preferred load address of this file in memory
-
getOriginalImageBase
long getOriginalImageBase()
-
wasRebased
boolean wasRebased()
-
getSizeOfImage
long getSizeOfImage()
- Returns:
- the RVA that would be assigned to the next section following the last section
-
setSizeOfImage
void setSizeOfImage(long size)
- See Also:
getSizeOfImage()
-
getSizeOfHeaders
long getSizeOfHeaders()
- Returns:
- the combined size of all headers
-
setSizeOfHeaders
void setSizeOfHeaders(long size)
- See Also:
getSizeOfHeaders()
-
getSizeOfCode
long getSizeOfCode()
Returns the combined total size of all sections with theIMAGE_SCN_CNT_CODEattribute.- Returns:
- the combined total size of all sections with
the
IMAGE_SCN_CNT_CODEattribute.
-
setSizeOfCode
void setSizeOfCode(long size)
- See Also:
getSizeOfCode()
-
getNumberOfRvaAndSizes
long getNumberOfRvaAndSizes()
-
getSizeOfInitializedData
long getSizeOfInitializedData()
Returns the combined size of all initialized data sections.- Returns:
- the combined size of all initialized data sections
-
setSizeOfInitializedData
void setSizeOfInitializedData(long size)
- See Also:
getSizeOfInitializedData()
-
getSizeOfUninitializedData
long getSizeOfUninitializedData()
Returns the size of all sections with the uninitialized data attributes.- Returns:
- the size of all sections with the uninitialized data attributes
-
setSizeOfUninitializedData
void setSizeOfUninitializedData(long size)
- See Also:
getSizeOfUninitializedData()
-
getBaseOfCode
long getBaseOfCode()
Returns the RVA of the first byte of code when loaded in memory.- Returns:
- the RVA of the first byte of code when loaded in memory
-
getBaseOfData
long getBaseOfData()
- Returns:
- the RVA of the first byte of data when loaded into memory
-
processDataDirectories
void processDataDirectories(TaskMonitor monitor) throws java.io.IOException
This methods tells this optional header to process its data directories.- Throws:
java.io.IOException
-
getDataDirectories
DataDirectory[] getDataDirectories()
Returns the array of data directories.- Returns:
- the array of data directories
-
getSectionAlignment
int getSectionAlignment()
- Returns:
- the section alignment
-
getFileAlignment
int getFileAlignment()
- Returns:
- the file alignment
-
writeHeader
void writeHeader(java.io.RandomAccessFile raf, DataConverter dc) throws java.io.IOExceptionWrites this optional header to the specified random access file.- Parameters:
raf- the random access filedc- the data converter- Throws:
java.io.IOException
-
validateDataDirectories
void validateDataDirectories(Program program)
-
isCLI
boolean isCLI() throws java.io.IOException- Returns:
- true if the PE uses predominantly CLI code; otherwise, false.
- Throws:
java.io.IOException
-
-