def __call__(self): cmts = ida_hexrays.user_cmts_new() for (tl_ea, tl_itp), cmt in self.cmts: tl = ida_hexrays.treeloc_t() tl.ea = tl_ea tl.itp = tl_itp cmts.insert(tl, ida_hexrays.citem_cmt_t(Event.encode(cmt))) ida_hexrays.save_user_cmts(self.ea, cmts) HexRaysEvent.refresh_pseudocode_view()
def set_decomp_comments(func_addr, cmt_dict: typing.Dict[int, str]): for addr in cmt_dict: ida_cmts = ida_hexrays.user_cmts_new() comment = cmt_dict[addr] tl = ida_hexrays.treeloc_t() tl.ea = addr # XXX: need a real value here at some point tl.itp = 90 ida_cmts.insert(tl, ida_hexrays.citem_cmt_t(comment)) ida_hexrays.save_user_cmts(func_addr, ida_cmts)
# XXX - ExpandingStrucEvent # XXX - SegmAddedEvent # XXX - SegmDeletedEvent # XXX - SegmStartChangedEvent # XXX - SegmEndChangedEvent # XXX - SegmNameChangedEvent # XXX - SegmClassChangedEvent # XXX - SegmAttrsUpdatedEvent # XXX - SegmMoved print("[+] Undefining string at 0x78DBDCB0 -> UndefinedEvent") del_items(0x78DBDCB0) # XXX - BytePatchedEvent # XXX - SgrChanged # XXX - UserLabelsEvent print("[+] Defining 2 comments in HexRays window in function defined at 0x78DBB091 -> UserCmtsEvent") list_comments = [((0x78DBB06A, 74), 'one comment in HexRays'), ((0x78DBB091, 74), 'another comment in HexRays')] cmts = ida_hexrays.user_cmts_new() for (tl_ea, tl_itp), cmt in list_comments: tl = ida_hexrays.treeloc_t() tl.ea = tl_ea tl.itp = tl_itp cmts.insert(tl, ida_hexrays.citem_cmt_t(cmt)) ida_hexrays.save_user_cmts(0x78DBB050, cmts) # XXX - UserIflagsEvent # XXX - UserLvarSettingsEvent # XXX - UserNumformsEvent