Package ghidra.app.util.bin.format.pef
Class SectionHeader
java.lang.Object
ghidra.app.util.bin.format.pef.SectionHeader
- All Implemented Interfaces:
StructConverter
See Apple's -- PEFBinaryFormat
struct PEFSectionHeader { SInt32 nameOffset; // Offset of name within the section name table, -1 => none. UInt32 defaultAddress; // Default address, affects relocations. UInt32 totalLength; // Fully expanded size in bytes of the section contents. UInt32 unpackedLength; // Size in bytes of the "initialized" part of the contents. UInt32 containerLength; // Size in bytes of the raw data in the container. UInt32 containerOffset; // Offset of section's raw data. UInt8 sectionKind; // Kind of section contents/usage. UInt8 shareKind; // Sharing level, if a writeable section. UInt8 alignment; // Preferred alignment, expressed as log 2. UInt8 reservedA; // Reserved, must be zero. };
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte
int
Returns the size in bytes of the raw data in the container.int
getData()
Returns an input stream to underlying bytes of this section.int
Returns the preferred address of this section.getName()
Returns the name of this section.int
The offset from the start of the section name table to the name of this section.byte
Reserved!int
byte[]
getUnpackedData
(TaskMonitor monitor) Unpack the data in a packed section.int
Returns the size in bytes of the "initialized" part of the contents.boolean
Returns true if this section has execute permissions.boolean
isRead()
Returns true if this section has read permissions.boolean
isWrite()
Returns true if this section has write permissions.Returns a structure datatype representing the contents of the implementor of this interface.toString()
-
Field Details
-
NO_NAME_OFFSET
public static final int NO_NAME_OFFSET- See Also:
-
-
Method Details
-
getNameOffset
public int getNameOffset()The offset from the start of the section name table to the name of this section. A value of -1 indicates an unnamed section.- Returns:
- the offset from the start of the section name table
-
getName
Returns the name of this section.- Returns:
- the name of this section
-
getData
Returns an input stream to underlying bytes of this section.- Returns:
- an input stream to underlying bytes of this section
- Throws:
IOException
- if an i/o error occurs.
-
getUnpackedData
Unpack the data in a packed section. Calling this method is only valid on a packed section.- Parameters:
monitor
- the task monitor- Returns:
- the unpacked data
- Throws:
IOException
- if an i/o error occurs or the section is not packed.
-
getDefaultAddress
public int getDefaultAddress()Returns the preferred address of this section.- Returns:
- the preferred address of this section
-
getTotalLength
public int getTotalLength() -
getUnpackedLength
public int getUnpackedLength()Returns the size in bytes of the "initialized" part of the contents.- Returns:
- the size in bytes of the "initialized" part of the contents
-
getContainerLength
public int getContainerLength()Returns the size in bytes of the raw data in the container.- Returns:
- the size in bytes of the raw data in the container
-
getContainerOffset
public int getContainerOffset() -
getSectionKind
-
getAlignment
public byte getAlignment() -
getReservedA
public byte getReservedA()Reserved!- Returns:
- Reserved!
-
isRead
public boolean isRead()Returns true if this section has read permissions.- Returns:
- true if this section has read permissions
-
isWrite
public boolean isWrite()Returns true if this section has write permissions.- Returns:
- true if this section has write permissions
-
isExecute
public boolean isExecute()Returns true if this section has execute permissions.- Returns:
- true if this section has execute permissions
-
toString
-
toDataType
Description copied from interface:StructConverter
Returns a structure datatype representing the contents of the implementor of this interface.For example, given:
class A { int foo; double bar; }
The return value should be a structure data type with two data type components; an INT and a DOUBLE. The structure should contain field names and, if possible, field comments.
- Specified by:
toDataType
in interfaceStructConverter
- Returns:
- returns a structure datatype representing the implementor of this interface
- Throws:
DuplicateNameException
- when a datatype of the same name already existsIOException
- if an IO-related error occurs- See Also:
-