IDA 9.2 compatibility update
Starting with IDA 9.2, the QT Framework has been updated from QT5 to QT6 and patching is using QT5.
Therefore the plugin does no longer work.
When using Macos 9.2 to close IDA, an error occurs
qt.py:
# this global is used to indicate whether Qt bindings for python are present
# and whether the plugin should expect to be using UI features
QT_AVAILABLE = False
# attempt to load PySide6
try:
from PySide6 import QtGui, QtCore, QtWidgets
import shiboken6
# importing PySide6 went okay, let's see if we're in an IDA Qt context
try:
import ida_kernwin
QT_AVAILABLE = ida_kernwin.is_idaq()
except ImportError:
pass
# import failed, PySide6 is not available
except ImportError:
pass
#--------------------------------------------------------------------------
# Qt Misc Helpers
#--------------------------------------------------------------------------
def get_main_window():
"""
Return the Qt Main Window.
"""
app = QtWidgets.QApplication.instance()
for widget in app.topLevelWidgets():
if isinstance(widget, QtWidgets.QMainWindow):
return widget
return None
def center_widget(widget):
"""
Center the given widget to the Qt Main Window.
"""
main_window = get_main_window()
if not main_window:
return False
# compute a new position for the floating widget such that it will center
# over the Qt application's main window
rect_main = main_window.geometry()
rect_widget = widget.rect()
centered_position = rect_main.center() - rect_widget.center()
widget.move(centered_position)
return True
ida.py:
......
#
# convert IDA alt shortcut syntax to whatever they use in Qt Text menus
# eg: '~A~ssemble patches to...' --> '&Assemble patches to...'
#
prev_action_name = re.sub(r'~(.)~', r'&\1', prev_action_name)
# cast an IDA 'popup handle' pointer back to a QMenu object
p_qmenu = ctypes.cast(int(popup_handle), ctypes.POINTER(ctypes.c_void_p))[0]
qmenu = shiboken6 .wrapInstance(int(p_qmenu), QtWidgets.QMenu)
......
p_qmenu = ctypes.cast(int(popup), ctypes.POINTER(ctypes.c_void_p))[0]
qmenu = shiboken6 .wrapInstance(int(p_qmenu), QtWidgets.QMenu)
filter = FilterMenu(qmenu)
qmenu.installEventFilter(filter)
# return the filter as I think we need to maintain its lifetime in py
return filter
using Macos 9.2 to close IDA, an error occurs,patching, intel CPU
index 693a6e8..93ee99f 100644
--- a/plugins/patching/util/ida.py
+++ b/plugins/patching/util/ida.py
@@ -170,7 +170,7 @@ def attach_submenu_to_popup(popup_handle, submenu_name, prev_action_name):
qmenu = sip.wrapinstance(int(p_qmenu), QtWidgets.QMenu)
# create a Qt (sub)menu that can be injected into an IDA-originating menu
- submenu = QtWidgets.QMenu(submenu_name)
+ submenu = QtWidgets.QMenu(submenu_name, qmenu)
# search for the target action to insert the submenu next to
all_actions = list(qmenu.actions())
@@ -896,7 +896,7 @@ def remove_ida_actions(popup):
class FilterMenu(QtCore.QObject):
def __init__(self, qmenu):
- super(FilterMenu, self).__init__()
+ super(FilterMenu, self).__init__(qmenu)
self.qmenu = qmenu
def eventFilter(self, obj, event):
try to apply this diff to avoid orphaned idapro popup menus, this may be the reason that lead crash on linux when close idapro.
index 693a6e8..93ee99f 100644 --- a/plugins/patching/util/ida.py +++ b/plugins/patching/util/ida.py @@ -170,7 +170,7 @@ def attach_submenu_to_popup(popup_handle, submenu_name, prev_action_name): qmenu = sip.wrapinstance(int(p_qmenu), QtWidgets.QMenu)
# create a Qt (sub)menu that can be injected into an IDA-originating menu
- submenu = QtWidgets.QMenu(submenu_name)
submenu = QtWidgets.QMenu(submenu_name, qmenu)
search for the target action to insert the submenu next to
all_actions = list(qmenu.actions()) @@ -896,7 +896,7 @@ def remove_ida_actions(popup):
class FilterMenu(QtCore.QObject): def init(self, qmenu):
super(FilterMenu, self).__init__()
super(FilterMenu, self).__init__(qmenu) self.qmenu = qmenu def eventFilter(self, obj, event):尝试应用此差异以避免孤立的 idapro 弹出菜单,这可能是关闭 idapro 时导致 Linux 崩溃的原因。 Thank you for the guidance from the teacher. After making the necessary modifications, the error message did not pop up,