Пример #1
0
 def activate(self, ctx):
     # ctx - action_activation_ctx_t
     vu = idaapi.get_tform_vdui(ctx.form)
     function_tinfo = idaapi.tinfo_t()
     if not vu.cfunc.get_func_type(function_tinfo):
         return
     function_details = idaapi.func_type_data_t()
     function_tinfo.get_func_details(function_details)
     if function_details.rettype.equals_to(Const.VOID_TINFO):
         function_details.rettype = idaapi.tinfo_t(Const.PVOID_TINFO)
     else:
         function_details.rettype = idaapi.tinfo_t(idaapi.BT_VOID)
     function_tinfo.create_func(function_details)
     idaapi.set_tinfo2(vu.cfunc.entry_ea, function_tinfo)
     vu.refresh_view(True)
Пример #2
0
 def activate(self, ctx):
     # ctx - action_activation_ctx_t
     vu = idaapi.get_tform_vdui(ctx.form)
     function_tinfo = idaapi.tinfo_t()
     if not vu.cfunc.get_func_type(function_tinfo):
         return
     function_details = idaapi.func_type_data_t()
     function_tinfo.get_func_details(function_details)
     convention = idaapi.CM_CC_MASK & function_details.cc
     if convention == idaapi.CM_CC_CDECL:
         function_details.cc = idaapi.CM_CC_SPECIAL
     elif convention in (idaapi.CM_CC_STDCALL, idaapi.CM_CC_FASTCALL,
                         idaapi.CM_CC_PASCAL, idaapi.CM_CC_THISCALL):
         function_details.cc = idaapi.CM_CC_SPECIALP
     elif convention == idaapi.CM_CC_ELLIPSIS:
         function_details.cc = idaapi.CM_CC_SPECIALE
     else:
         return
     function_tinfo.create_func(function_details)
     idaapi.set_tinfo2(vu.cfunc.entry_ea, function_tinfo)
     vu.refresh_view(True)
Пример #3
0
def fixup_this_arg_types(cfunc):
    ''' Modifies a cfuncptr_t such that its first argument is a pointer
    to the Type that has this cfunc in its vtable (and is named 'this')
    '''
    # Don't do anything if the type has already been set
    if idc.GetType(cfunc.entry_ea) is not None:
        return

    t = get_type_by_func(cfunc.entry_ea)
    if t is None:
        return

    tinfo = t.tinfo
    tinfo.create_ptr(tinfo)

    #TODO: add missing this argument?
    if len(cfunc.arguments) == 0:
        return

    cfunc.arguments[0].set_lvar_type(tinfo)
    cfunc.arguments[0].name = "this"

    cfunc.get_func_type(tinfo)
    idaapi.set_tinfo2(cfunc.entry_ea, tinfo)
Пример #4
0
 def apply_type(self, tinfo):
     if self._applicable:
         idaapi.set_tinfo2(self.__obj_ea, tinfo)