def set_name(func, string):
'''Set the name of the function ``func`` to ``string``.'''
rt,ea = __addressOfRtOrSt(func)
res = idaapi.validate_name2(buffer(string)[:])
if string and string != res:
logging.warn('{:s}.set_name({:x}, {!r}) : Stripping invalid chars from function name. : {!r}'.format(__name__, ea, string, res))
string = res
if rt:
# FIXME: shuffle the new name into the prototype and then re-mangle it
res, ok = get_name(ea), database.set_name(ea, string)
else:
res, ok = get_name(ea), idaapi.set_name(ea, string, idaapi.SN_PUBLIC)
if not ok:
raise ValueError("{:s}.set_name({:x}, {!r}) : Unable to apply function name.".format(__name__, ea, string))
return res
评论列表
文章目录