Package ghidra.app.util.bin.format.pe
Class BaseRelocation
java.lang.Object
ghidra.app.util.bin.format.pe.BaseRelocation
- All Implemented Interfaces:
- ByteArrayConverter,- StructConverter
A class to represent the 
IMAGE_BASE_RELOCATION
 data structure defined in winnt.h.
 
 typedef struct _IMAGE_BASE_RELOCATION {
     DWORD   VirtualAddress;
     DWORD   SizeOfBlock;
 //  WORD    TypeOffset[1];
 } IMAGE_BASE_RELOCATION;
 typedef IMAGE_BASE_RELOCATION UNALIGNED * PIMAGE_BASE_RELOCATION;
 - 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intThe size of theIMAGE_BASE_RELOCATIONin bytes.static final StringThe name to use when converting into a structure data type.static final String[]Names of the available base relocations.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddRelocation(int type, int offset) Adds a relocation to this base relocation block.intgetCount()Returns the number of relocation in this block.intgetOffset(int index) Returns the lower 12 bits of the offset.intReturns the size (in bytes) of this relocation block.intgetType(int index) Returns the upper 4 bits of the offset.intReturns the base address of the relocations in this block.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.
- 
Field Details- 
NAMEThe name to use when converting into a structure data type.- See Also:
 
- 
IMAGE_SIZEOF_BASE_RELOCATIONpublic static final int IMAGE_SIZEOF_BASE_RELOCATIONThe size of theIMAGE_BASE_RELOCATIONin bytes.- See Also:
 
- 
IMAGE_REL_BASED_NOOPpublic static final int IMAGE_REL_BASED_NOOP- See Also:
 
- 
IMAGE_REL_BASED_ABSOLUTEpublic static final int IMAGE_REL_BASED_ABSOLUTE- See Also:
 
- 
IMAGE_REL_BASED_HIGHpublic static final int IMAGE_REL_BASED_HIGH- See Also:
 
- 
IMAGE_REL_BASED_LOWpublic static final int IMAGE_REL_BASED_LOW- See Also:
 
- 
IMAGE_REL_BASED_HIGHLOWpublic static final int IMAGE_REL_BASED_HIGHLOW- See Also:
 
- 
IMAGE_REL_BASED_HIGHADJpublic static final int IMAGE_REL_BASED_HIGHADJ- See Also:
 
- 
IMAGE_REL_BASED_MIPS_JMPADDRpublic static final int IMAGE_REL_BASED_MIPS_JMPADDR- See Also:
 
- 
IMAGE_REL_BASED_SECTIONpublic static final int IMAGE_REL_BASED_SECTION- See Also:
 
- 
IMAGE_REL_BASED_REL32public static final int IMAGE_REL_BASED_REL32- See Also:
 
- 
IMAGE_REL_BASED_MIPS_JMPADDR16public static final int IMAGE_REL_BASED_MIPS_JMPADDR16- See Also:
 
- 
IMAGE_REL_BASED_IA64_IMM64public static final int IMAGE_REL_BASED_IA64_IMM64- See Also:
 
- 
IMAGE_REL_BASED_DIR64public static final int IMAGE_REL_BASED_DIR64- See Also:
 
- 
IMAGE_REL_BASED_HIGH3ADJpublic static final int IMAGE_REL_BASED_HIGH3ADJ- See Also:
 
- 
TYPE_STRINGSNames of the available base relocations.
 
- 
- 
Method Details- 
addRelocationpublic void addRelocation(int type, int offset) Adds a relocation to this base relocation block.- Parameters:
- type- the relocation type
- offset- the relocation offset
 
- 
getVirtualAddresspublic int getVirtualAddress()Returns the base address of the relocations in this block.- Returns:
- the base address of the relocations in this block
 
- 
getSizeOfBlockpublic int getSizeOfBlock()Returns the size (in bytes) of this relocation block.- Returns:
- the size (in bytes) of this relocation block
 
- 
getCountpublic int getCount()Returns the number of relocation in this block.- Returns:
- the number of relocation in this block
 
- 
getOffsetpublic int getOffset(int index) Returns the lower 12 bits of the offset.- Parameters:
- index- the ith relocation
- Returns:
- int the offset of the relocation
 
- 
getTypepublic int getType(int index) Returns the upper 4 bits of the offset.- Parameters:
- index- the ith relocation
- Returns:
- int the type of the relocation ,
 
- 
toDataTypeDescription 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 interface- StructConverter
- Returns:
- returns a structure datatype representing the implementor of this interface
- Throws:
- DuplicateNameException- when a datatype of the same name already exists
- See Also:
 
- 
toBytesDescription copied from interface:ByteArrayConverterReturns a byte array representing this implementor of this interface.- Specified by:
- toBytesin interface- ByteArrayConverter
- Parameters:
- dc- the data converter to use
- Returns:
- a byte array representing this object
 
 
-