OpenRCE/pydbg — pull request #2 by jevinskie (2012-09-18 19:30:43+00:00)
Title: Add func_offset to pydbg

func_offset returns the offset of the specified function from the DLL's
base address

func_resolve wasn't working for me in the following use case. func_offset lets me work around the issue.

def handler_load_dll(dbg):
last_dll = dbg.get_system_dll(-1)
# Wait for the DLL we're looking for ...
if "ftd2xx.dll".lower() == last_dll.name.lower():
# Now resolve the address of the function (see note: requires debug symbols)
write_off = dbg.func_offset(last_dll.name, "FT_Write")
write_addr = last_dll.base + write_off
# this didnt work
# write_addr = dbg.func_resolve(last_dll.name, "FT_Write")