Exemple #1
0
 def check(self, hx_view):
     cfunc, ctree_item = hx_view.cfunc, hx_view.item
     if ctree_item.citype != idaapi.VDI_FUNC:
         return False
     tinfo = idaapi.tinfo_t()
     hx_view.cfunc.get_func_type(tinfo)
     return helper.is_legal_type(tinfo.get_rettype())
Exemple #2
0
 def set_first_argument_type(self, name):
     func_data = idaapi.func_type_data_t()
     func_tinfo = self.tinfo.get_pointed_object()
     class_tinfo = idaapi.tinfo_t()
     if func_tinfo.get_func_details(func_data) and func_tinfo.get_nargs() and \
             class_tinfo.get_named_type(idaapi.cvar.idati, name):
         class_tinfo.create_ptr(class_tinfo)
         first_arg_tinfo = func_data[0].type
         if (first_arg_tinfo.is_ptr() and first_arg_tinfo.get_pointed_object().is_udt()) or \
                 helper.is_legal_type(func_data[0].type):
             func_data[0].type = class_tinfo
             func_data[0].name = "this"
             func_tinfo.create_func(func_data)
             func_tinfo.create_ptr(func_tinfo)
             if func_tinfo.dstr() != self.tinfo.dstr():
                 self.tinfo = func_tinfo
                 self.tinfo_modified = True
                 for parent in self.parents:
                     parent.modified = True
         else:
             print("[Warning] function {0} probably have wrong type".format(
                 self.name))
Exemple #3
0
 def _can_be_scanned(self, cfunc, ctree_item):
     obj = api.ScanObject.create(cfunc, ctree_item)
     return obj and helper.is_legal_type(obj.tinfo)