Package ghidra.app.util.bin.format.pe
Class ThunkData
java.lang.Object
ghidra.app.util.bin.format.pe.ThunkData
- All Implemented Interfaces:
ByteArrayConverter,StructConverter
A class to represent the
IMAGE_THUNK_DATA32 struct
as defined in
winnt.h.
typedef struct _IMAGE_THUNK_DATA32 {
union {
DWORD ForwarderString; // PBYTE
DWORD Function; // PDWORD
DWORD Ordinal;
DWORD AddressOfData; // PIMAGE_IMPORT_BY_NAME
} u1;
} IMAGE_THUNK_DATA32;
typedef IMAGE_THUNK_DATA32 * PIMAGE_THUNK_DATA32;
typedef struct _IMAGE_THUNK_DATA64 {
union {
PBYTE ForwarderString;
PDWORD Function;
ULONGLONG Ordinal;
PIMAGE_IMPORT_BY_NAME AddressOfData;
} u1;
} IMAGE_THUNK_DATA64;
typedef IMAGE_THUNK_DATA64 * PIMAGE_THUNK_DATA64;
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the address of the data.longReturns the forward string pointer.longReturns the function pointer.Returns the underlying import by name structure.longReturns the ordinal.Returns the struct name.intReturns the size of the thunk (in bytes) based on the size of the executable (32 vs 64 bit).booleanvoidsetValue(int value) Sets the value of the thunk.byte[]toBytes(DataConverter dc) Returns a byte array representing this implementor of this interface.Returns a structure datatype representing the contents of the implementor of this interface.
-
Constructor Details
-
ThunkData
public ThunkData(int value) Constructs a new thunk data with the specified value- Parameters:
value- the new thunk value
-
-
Method Details
-
getStructSize
public int getStructSize()Returns the size of the thunk (in bytes) based on the size of the executable (32 vs 64 bit).- Returns:
- the size of the thunk (in bytes)
-
getStructName
Returns the struct name.- Returns:
- the struct name
-
setValue
public void setValue(int value) Sets the value of the thunk.- Parameters:
value- the new thunk value
-
getForwarderString
public long getForwarderString()Returns the forward string pointer.- Returns:
- the forward string pointer
-
getFunction
public long getFunction()Returns the function pointer.- Returns:
- the function pointer
-
getOrdinal
public long getOrdinal()Returns the ordinal.- Returns:
- the ordinal
-
isOrdinal
public boolean isOrdinal() -
getAddressOfData
public long getAddressOfData()Returns the address of the data.- Returns:
- the address of the data
-
getImportByName
Returns the underlying import by name structure.- Returns:
- the underlying import by name structure
-
toDataType
Description copied from interface:StructConverterReturns 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:
toDataTypein interfaceStructConverter- Returns:
- returns a structure datatype representing the implementor of this interface
- Throws:
DuplicateNameException- when a datatype of the same name already exists- See Also:
-
toBytes
Description copied from interface:ByteArrayConverterReturns a byte array representing this implementor of this interface.- Specified by:
toBytesin interfaceByteArrayConverter- Parameters:
dc- the data converter to use- Returns:
- a byte array representing this object
-