Skip to content

Conversation

@fjh658
Copy link
Contributor

@fjh658 fjh658 commented Sep 4, 2017

  1. fixed ida pro 7 beta6 x86 crash. idainfo object has no attribute 'procname'
    image

image

ida pro 7 beta6 x86, The idainfo object has still procName api

  1. refactor: removed "from idc_bc695" According to hexray log document, idc has been done on the adapter idc_bc695, do not need to expose idc_bc695.
// python.cfg 
// Should the plugin automatically load a 6.95 bw-compatibility layer?
AUTOIMPORT_COMPAT_IDA695 = YES
# idc.py
# Compatibility macros (auto-generated part. Comes first so
# that any re-definition below will override auto-generated part)
if sys.modules["__main__"].IDAPYTHON_COMPAT_695_API:
    # ...
    from idc_bc695 import *
  1. refactor: removed the adapter idaapi.read_selection. idaapi.read_selection has been adapted internally
    ida_kernwin.py
    image

jianhua.fengjh and others added 30 commits August 1, 2017 21:45
…mpatible with ida pro 6, 7(beta);

for everyone is happy
…mpatible with ida pro 6, 7(beta);

for everyone is happy
…mpatible with ida pro 6, 7(beta);

for everyone is happy
…mpatible with ida pro 6, 7(beta);

for everyone is happy
* fixed inf no attribute "mf",   because ida pro beta 3 (170724)   renamed inf.is_mf()/set_mf() -> is_be()/set_be()

* fixed inf no attribute "mf",   because ida pro7 beta 3 (170724)   renamed inf.is_mf()/set_mf() -> is_be()/set_be()

* Add ida pro version check, about be(big endian)

* Since ida pro7 beta 3 (170724) renamed inf.mf -> is_be()/set_be(),  Compatible with ida pro 6, 7(beta);
for everyone is happy
@fjh658
Copy link
Contributor Author

fjh658 commented Sep 6, 2017

@aquynh
Q2, 3 is the same type of problem.

In the ida 7 for x64 python done refactoring operation, in order to be compatible with 695, in the configuration file python.cfg added
// shoulder the plugin automatically load a backward-compatibility-provide
// 'idaapi' wrapper module?
AUTOIMPORT_COMPAT_IDAAPI = YES

// Should the plugin automatically load a 6.95 bw-compatibility layer?
AUTOIMPORT_COMPAT_IDA695 = YES

and the default value is yes

# init.py
try:
    import ida_idaapi
    import ida_kernwin  #importance
    import ida_diskio
except ImportError as e:
    print "Import failed: %s. Current sys.path:" % str(e)
    for p in sys.path:
        print "\t%s" % p
    raise

ida_kernwin.py

import ida_idaapi
import sys
_BC695 = sys.modules["__main__"].IDAPYTHON_COMPAT_695_API  #importance
# ...
if _BC695:
    AST_DISABLE_FOR_FORM=AST_DISABLE_FOR_WIDGET
    AST_ENABLE_FOR_FORM=AST_ENABLE_FOR_WIDGET
    CB_CLOSE_IDB=CB_INVISIBLE
    chtype_generic2=chtype_generic
    chtype_segreg=chtype_srcp
    close_tform=close_widget
    find_tform=find_widget
    get_current_tform=get_current_widget
    get_highlighted_identifier=get_highlight
    get_tform_title=get_widget_title
    get_tform_type=get_widget_type
    is_chooser_tform=is_chooser_widget
    open_tform=display_widget
    pyscv_get_tcustom_control=pyscv_get_widget
    pyscv_get_tform=pyscv_get_widget
    __read_selection70 = read_selection
    def read_selection(*args):  #importance
        if len(args) == 0:
            # bw-compat
            t0, t1, view = twinpos_t(), twinpos_t(), get_current_viewer()
            sel = __read_selection70(view, t0, t1)
            import ida_idaapi
            a0, a1 = ida_idaapi.BADADDR, ida_idaapi.BADADDR
            if sel:
                a0, a1 = t0.place(view).toea(), t1.place(view).toea()
            return sel, a0, a1
        else:
            return __read_selection70(*args)
    readsel2=read_selection

The value of IDAPYTHON_COMPAT_695_API is determined by AUTOIMPORT_COMPAT_IDA695 = YES

Similarly, we can see

# idc.py
# Compatibility macros (auto-generated part. Comes first so
# that any re-definition below will override auto-generated part)
if sys.modules["__main__"].IDAPYTHON_COMPAT_695_API: # importance
    # ...
    from idc_bc695 import *

@Rupan
Copy link
Contributor

Rupan commented Sep 6, 2017

Indeed the code in this PR appears to be fine. I just have a couple of suggestions regarding code style. In my initial pull request I was going for the minimal amount changes required to resolve errors I saw in the code.

I've been playing around with a more thorough cleanup, but the code churn is significant and I want to be sure that I haven't introduced bugs in the process.

fjh658 and others added 18 commits September 6, 2017 13:24
@aquynh aquynh merged commit bfcaef1 into keystone-engine:master Sep 7, 2017
@aquynh
Copy link
Member

aquynh commented Sep 7, 2017

merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants