本文整理汇总了Python中winappdbg.EventHandler方法的典型用法代码示例。如果您正苦于以下问题:Python winappdbg.EventHandler方法的具体用法?Python winappdbg.EventHandler怎么用?Python winappdbg.EventHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类winappdbg
的用法示例。
在下文中一共展示了winappdbg.EventHandler方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __call__
# 需要导入模块: import winappdbg [as 别名]
# 或者: from winappdbg import EventHandler [as 别名]
def __call__(self, event):
try:
eventCode = event.get_event_code()
if eventCode in (win32.LOAD_DLL_DEBUG_EVENT,
win32.LOAD_DLL_DEBUG_EVENT):
pid = event.get_pid()
handler = self.forward.get(pid, None)
if handler is None:
handler = self.cls(*self.argv, **self.argd)
self.forward[pid] = handler
if isinstance(handler, EventHandler):
if eventCode == win32.LOAD_DLL_DEBUG_EVENT:
handler.__EventHandler_hook_dll(event)
else:
handler.__EventHandler_unhook_dll(event)
finally:
return super(EventSift, self).__call__(event)
示例2: __init__
# 需要导入模块: import winappdbg [as 别名]
# 或者: from winappdbg import EventHandler [as 别名]
def __init__(self, eventHandler = None):
"""
Event dispatcher.
@type eventHandler: L{EventHandler}
@param eventHandler: (Optional) User-defined event handler.
@raise TypeError: The event handler is of an incorrect type.
@note: The L{eventHandler} parameter may be any callable Python object
(for example a function, or an instance method).
However you'll probably find it more convenient to use an instance
of a subclass of L{EventHandler} here.
"""
self.set_event_handler(eventHandler)
示例3: get_event_handler
# 需要导入模块: import winappdbg [as 别名]
# 或者: from winappdbg import EventHandler [as 别名]
def get_event_handler(self):
"""
Get the event handler.
@see: L{set_event_handler}
@rtype: L{EventHandler}
@return: Current event handler object, or C{None}.
"""
return self.__eventHandler
示例4: set_event_handler
# 需要导入模块: import winappdbg [as 别名]
# 或者: from winappdbg import EventHandler [as 别名]
def set_event_handler(self, eventHandler):
"""
Set the event handler.
@warn: This is normally not needed. Use with care!
@type eventHandler: L{EventHandler}
@param eventHandler: New event handler object, or C{None}.
@rtype: L{EventHandler}
@return: Previous event handler object, or C{None}.
@raise TypeError: The event handler is of an incorrect type.
@note: The L{eventHandler} parameter may be any callable Python object
(for example a function, or an instance method).
However you'll probably find it more convenient to use an instance
of a subclass of L{EventHandler} here.
"""
if eventHandler is not None and not callable(eventHandler):
raise TypeError("Event handler must be a callable object")
try:
wrong_type = issubclass(eventHandler, EventHandler)
except TypeError:
wrong_type = False
if wrong_type:
classname = str(eventHandler)
msg = "Event handler must be an instance of class %s"
msg += "rather than the %s class itself. (Missing parens?)"
msg = msg % (classname, classname)
raise TypeError(msg)
try:
previous = self.__eventHandler
except AttributeError:
previous = None
self.__eventHandler = eventHandler
return previous