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

Fixed 64-bit fixup issue #36

Open
wants to merge 2 commits 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
19 changes: 6 additions & 13 deletions keypatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,12 @@ def _resolve(_op, ignore_kw=True):
if parts[2] != '':
sym = parts[2]

(t, v) = idaapi.get_name_value(address, sym)

# skip if name doesn't exist or segment / segment registers
if t in (idaapi.NT_SEG, idaapi.NT_NONE):
ea = idaapi.get_name_ea(address, sym)
# skip if name doesn't exist
if ea == idaapi.BADADDR:
continue

_op = _op.replace(sym, '0x{0:X}'.format(v))
_op = _op.replace(sym, '0x{0:X}'.format(ea))

return _op

Expand Down Expand Up @@ -669,14 +668,8 @@ def patch(self, address, patch_data, len):
return (None, None)

# ask IDA to re-analyze the patched area
if orig_func_end == idc.BADADDR:
# only analyze patched bytes, otherwise it would take a lot of time to re-analyze the whole binary
idaapi.analyze_area(address, address + patched_len + 1)
else:
idaapi.analyze_area(address, orig_func_end)

# try to fix IDA function re-analyze issue after patching
idaapi.func_setend(address, orig_func_end)
# only analyze patched bytes, otherwise it would take a lot of time to re-analyze the whole binary
idaapi.analyze_area(address, address + patched_len + 1)

return (patched_len, orig_data)

Expand Down