def find_module(modlist, mod_addrs, addr):
"""Uses binary search to find what module a given address resides in.
This is much faster than a series of linear checks if you have
to do it many times. Note that modlist and mod_addrs must be sorted
in order of the module base address."""
pos = bisect_right(mod_addrs, addr) - 1
if pos == -1:
return None
mod = modlist[mod_addrs[pos]]
if (addr >= mod.DllBase.v() and
addr < mod.DllBase.v() + mod.SizeOfImage.v()):
return mod
else:
return None
评论列表
文章目录