def resolveRelocation(ea): rtype = idc.GetFixupTgtType(ea) if rtype == idc.FIXUP_OFF32: relocVal = readDword(ea) return relocVal elif rtype == -1: raise Exception("No relocation type at ea: {:x}".format(ea)) else: return idc.GetFixupTgtOff(ea)
def resolveRelocation(ea): rtype = idc.GetFixupTgtType(ea) if rtype == idc.FIXUP_OFF32: bytestr = readBytesSlowly(ea, ea+4); relocVal = struct.unpack("<L", bytestr)[0] return relocVal elif rtype == -1: raise Exception("No relocation type at ea: {:x}".format(ea)) else: return idc.GetFixupTgtOff(ea)
def resolveRelocation(ea): rtype = idc.GetFixupTgtType(ea) relocSize = -1 relocVal = -1 if getBitness() == 64: if rtype == -1: raise Exception("No relocation type at ea: {:x}".format(ea)) DEBUG("rtype : {0:x}, {1:x}, {2:x}\n".format(rtype, idc.GetFixupTgtOff(ea), idc.GetFixupTgtDispl(ea))) relocVal = idc.GetFixupTgtDispl(ea) + idc.GetFixupTgtOff(ea) else: if rtype == idc.FIXUP_OFF32: relocVal = readDword(ea) elif rtype == -1: raise Exception("No relocation type at ea: {:x}".format(ea)) else: relocVal = idc.GetFixupTgtOff(ea) relocSize = relocationSize(rtype) return relocVal, relocSize