Exemple #1
0
    def posterior(self, comment):
        if not comment:
            idaapi.del_extra_cmt(self._ea, idaapi.E_NEXT)
            return

        index = 0

        for index, line in enumerate(comment.splitlines()):
            idaapi.update_extra_cmt(self._ea, idaapi.E_NEXT + index, line)

        idaapi.del_extra_cmt(self._ea, idaapi.E_NEXT + (index + 1))
Exemple #2
0
def delete_comment_at_ea(ea, comment_type):
    logger.debug("Deleting comment at 0x%08X / %d" % (ea, comment_type))
    if comment_type == ya.COMMENT_REPEATABLE:
        idc.MakeRptCmt(ea, "")
        # TODO: remove the test with "comment" (temporary fix because of cache incoherency)
    elif comment_type == ya.COMMENT_NON_REPEATABLE or comment_type == "comment":
        idc.MakeComm(ea, "")
    elif comment_type == ya.COMMENT_ANTERIOR:
        for i in xrange(0, idaapi.get_first_free_extra_cmtidx(ea, idaapi.E_PREV)):
            idaapi.del_extra_cmt(ea, idaapi.E_PREV + i)
    elif comment_type == ya.COMMENT_POSTERIOR:
        for i in xrange(0, idaapi.get_first_free_extra_cmtidx(ea, idaapi.E_NEXT)):
            idaapi.del_extra_cmt(ea, idaapi.E_NEXT + i)
    elif comment_type == ya.COMMENT_BOOKMARK:
        # parse marked position
        for i in xrange(1, 1024):
            if idc.GetMarkedPos(i) == idc.BADADDR:
                break
            elif idc.GetMarkedPos(i) == ea:
                idc.MarkPosition(ea, 0, 0, 0, i, "")
Exemple #3
0
 def __call__(self):
     idaapi.del_extra_cmt(self.ea, self.line_idx)
     isprev = 1 if self.line_idx - 1000 < 1000 else 0
     if not self.cmt:
         return 0
     idaapi.add_extra_cmt(self.ea, isprev, self.cmt.encode('utf-8'))