コード例 #1
0
    def save(self):
        """
            Function which allow to save the change made to the local variable
            inside the idb. This is necessary because by default the change
            made to a lvar using the IDA interface only change the object in
            memory and not its content.
            
            This function is called by default by the setters of this object
            if the ``_persistent`` property is at True (the default). It
            should not be necessary to call this directly.

            .. todo:: this should probably set the flags to ? flags are not
                directly accessible through the the lvar object from IDAPython
                rigth now...
        """
        # object needed for containing the information to save about the lvar
        lsi = lvar_saved_info_t()
        # set everything which need to be save
        lsi.ll = self._lvar
        lsi.name = self.name
        lsi.type = self._lvar.tif
        lsi.size = self.size
        lsi.cmt = self.comment
        # create the object which is used for saving in the idb
        lvuv = lvar_uservec_t()
        # get the info from the previously modify lvar
        restore_user_lvar_settings(lvuv, self._hxcfunc.ea)
        if not lvuv.lvvec.add_unique(lsi):  # adding this var to save
            # this is actually not an error but simply means the lvar
            #   was already at the same state
            return
        # saving in the idb
        save_user_lvar_settings(self._hxcfunc.ea, lvuv)
コード例 #2
0
 def _get_lvar_saved_info(dct):
     lv = ida_hexrays.lvar_saved_info_t()
     lv.ll = UserLvarSettingsEvent._get_lvar_locator(dct['ll'])
     lv.name = Event.encode(dct['name'])
     lv.type = UserLvarSettingsEvent._get_tinfo(dct['type'])
     lv.cmt = Event.encode(dct['cmt'])
     lv.flags = dct['flags']
     return lv
コード例 #3
0
ファイル: events.py プロジェクト: paulfariello-syn/IDArling
 def _get_lvar_saved_info(dct):
     lv = ida_hexrays.lvar_saved_info_t()
     lv.ll = UserLvarSettingsEvent._get_lvar_locator(dct["ll"])
     lv.name = dct["name"]
     lv.type = UserLvarSettingsEvent._get_tinfo(dct["type"])
     lv.cmt = dct["cmt"]
     lv.flags = dct["flags"]
     return lv
コード例 #4
0
 def _getLvarSavedInfo(dct):
     lv = ida_hexrays.lvar_saved_info_t()
     lv.ll = UserLvarSettingsEvent._getLvarLocator(dct['ll'])
     lv.name = dct['name']
     lv.type = UserLvarSettingsEvent._getTinfo(dct['type'])
     lv.cmt = dct['cmt']
     lv.flags = dct['flags']
     return lv
コード例 #5
0
def ChangeVariableType(func_ea, lvar, tif):
    lsi = ida_hexrays.lvar_saved_info_t()
    lsi.ll = lvar
    lsi.type = ida_typeinf.tinfo_t(tif)
    if not ida_hexrays.modify_user_lvar_info(func_ea, ida_hexrays.MLI_TYPE,
                                             lsi):
        ida_kernwin.warning("Could not modify lvar type for %s" % lvar.name)
        return False
    return True
コード例 #6
0
 def _to_saved_info(self):
     """
         Internal function for interface with IDA. This function return
         an ``ida_hexrays.lvar_saved_info_t`` object corresponding to this
         variable.
     """
     # object needed for containing the information to save about the lvar
     lsi = lvar_saved_info_t()
     # set everything which need to be save
     lsi.ll = self._lvar
     lsi.name = self.name
     lsi.type = self._lvar.tif
     lsi.size = self.size
     lsi.cmt = self.comment
     return lsi