Exemplo n.º 1
0
    def on_frame_mem_changed(self, offset, was, now):
        put = self.put
        put("""ida_struct.del_struc_member(frame, 0x%x)""" % offset)
        if now:
            put("""opinfo = None""")
            put("""tif = ida_typeinf.tinfo_t()""")
            if now.type.type:
                put("""if tif.deserialize(None, "%s", "%s"):""" %
                    (escaped_bytestr(
                        now.type.type), escaped_bytestr(now.type.fields)))
                put("""    ok, size, flags, opinfo, alsize = ida_typeinf.get_idainfo_by_type(tif)"""
                    )

            elif ida_bytes.is_off0(now.flags):
                put("""opinfo = ida_nalt.opinfo_t()""")
                put("""opinfo.ri.target = 0x%x""" % now.opinfo.ri.target)
                put("""opinfo.ri.base = 0x%x""" % now.opinfo.ri.base)
                put("""opinfo.ri.tdelta = 0x%x""" % now.opinfo.ri.tdelta)
                put("""opinfo.ri.flags = 0x%x""" % now.opinfo.ri.flags)

            put("""ida_struct.add_struc_member(frame, "%s", 0x%x, 0x%x, opinfo, %d)"""
                % (dquot_escaped_str(
                    now.name), offset, now.info.flags, now.nbytes))
            put("""mptr = ida_struct.get_member(frame, 0x%x)""" % offset)
            put("""if not tif.empty():""")
            put("""    ida_struct.set_member_tinfo(frame, mptr, 0, tif, ida_struct.SET_MEMTI_USERTI)"""
                )
            put("""    ida_nalt.set_userti(mptr.id)""")
            if now.cmt:
                put("""ida_struct.set_member_cmt(mptr, "%s", False)""" %
                    dquot_escaped_str(now.cmt))
            if now.rptcmt:
                put("""ida_struct.set_member_cmt(mptr, "%s", True)""" %
                    dquot_escaped_str(now.rptcmt))
 def __call__(self):
     mt = ida_nalt.opinfo_t()
     if ida_bytes.is_struct(self.flag):
         mt.tid = self.extra['id']
     if ida_bytes.is_off0(self.flag) or ida_bytes.is_off1(self.flag):
         mt.ri = ida_nalt.refinfo_t(self.extra['flags'], self.extra['base'],
                                    self.extra['target'],
                                    self.extra['tdelta'])
     if ida_bytes.is_strlit(self.flag):
         mt.strtype = self.extra['strtype']
     struc = ida_struct.get_struc_id(Event.encode(self.sname))
     sptr = ida_struct.get_struc(struc)
     ida_struct.set_member_type(sptr, self.soff, self.flag, mt,
                                self.eoff - self.soff)
Exemplo n.º 3
0
 def __call__(self):
     mt = ida_nalt.opinfo_t()
     if ida_bytes.is_struct(self.flag):
         mt.tid = self.extra["id"]
     if ida_bytes.is_off0(self.flag) or ida_bytes.is_off1(self.flag):
         mt.ri = ida_nalt.refinfo_t(
             self.extra["flags"],
             self.extra["base"],
             self.extra["target"],
             self.extra["tdelta"],
         )
     if ida_bytes.is_strlit(self.flag):
         mt.strtype = self.extra["strtype"]
     struc = ida_struct.get_struc_id(Event.encode(self.sname))
     sptr = ida_struct.get_struc(struc)
     ida_struct.set_member_type(sptr, self.soff, self.flag, mt,
                                self.eoff - self.soff)
Exemplo n.º 4
0
 def __call__(self):
     mt = ida_nalt.opinfo_t()
     if ida_bytes.is_struct(self.flag):
         mt.tid = self.extra["id"]
     if ida_bytes.is_off0(self.flag) or ida_bytes.is_off1(self.flag):
         mt.ri = ida_nalt.refinfo_t(
             self.extra["flags"],
             self.extra["base"],
             self.extra["target"],
             self.extra["tdelta"],
         )
     if ida_bytes.is_strlit(self.flag):
         mt.strtype = self.extra["strtype"]
     struc = ida_struct.get_struc_id(self.sname)
     sptr = ida_struct.get_struc(struc)
     ida_struct.add_struc_member(
         sptr,
         self.fieldname,
         self.offset,
         self.flag,
         mt,
         self.nbytes,
     )