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 : Stripping invalid chars from function name {!r} at {:x}. : {!r}'.format(__name__, string, ea, 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 AssertionError('{:s}.set_name : Unable to set function name for {:x} : {!r}'.format(__name__, ea, string))
return res
评论列表
文章目录