-
Notifications
You must be signed in to change notification settings - Fork 558
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
use new IDAPython 9.0 APIs #2339
Conversation
what?!? 🏃 so fast nice work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we should introduce some wrappers that can switch on the IDA version. we can maintain those while we want to support 7/8/9 and then maybe deprecate them in a year or so?
i'm pleasantly surprised how small the delta is so this seems maintainable enough. thoughts?
I second this, a few wrappers should enable us to maintain compatibility across supported IDA versions. |
yes, sounds good - luckily here we only use a few affected APIs |
so something along those lines?! def get_filetype() -> "filetype_t":
version = float(idaapi.get_kernel_version())
if version < 9.0:
file_info = idaapi.get_inf_structure()
return file_info.filetype
else:
import ida_ida
return ida_ida.inf_get_filetype() |
I would recommend doing the version check at the top level of the Python module and defining the functions within the if/else blocks, so that the cost of the version check is O(1) at import-time versus O(#api calls) at runtime. Something like: version = float(idaapi.get_kernel_version())
if version < 9.0:
def get_filetype() -> "filetype_t":
file_info = idaapi.get_inf_structure()
return file_info.filetype
else:
import ida_ida
def get_filetype() -> "filetype_t":
return ida_ida.inf_get_filetype() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good 🚀
closes #2311
WIP as we need to figure out how to use 8.0 and 9.0 APIs
currently this should work just for IDA Pro 9.0 only though
Checklist