Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add func_offset to pydbg #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions pydbg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,31 @@ def func_resolve (self, dll, function):

return address


####################################################################################################################
def func_offset (self, dll, function):
'''
Utility function that resolves the offset of a given module / function name pair.

@see: func_offset()

@type dll: String
@param dll: Name of the DLL (case-insensitive)
@type function: String
@param function: Name of the function to resolve (case-sensitive)

@rtype: DWORD
@return: Offset
'''

handle = kernel32.LoadLibraryA(dll)
address = kernel32.GetProcAddress(handle, function)
offset = address-handle

kernel32.FreeLibrary(handle)

return offset


####################################################################################################################
def func_resolve_debuggee (self, dll_name, func_name):
Expand Down