def __start__(self): self.mesg = RegisterWindowMessage(FFDSHOW_REMOTE_MESSAGE) eg.messageReceiver.AddHandler(WM_COPYDATA, self.Handler)
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABuklEQVR42o1Sv0tCYRQ9" "L1FccpCEB73wVy1NjTrUPxD1lgZp0dWKaAhXxWhoyWgoIUjHBEH65RSE0CAUgWIPLAqR" "gkAQIQXR8nW/Z0ai6btweJfDd847934fhz8VCARkqCjTmBGra+sc67kOGQqFZIfDMVCo" "1WphMpng9/vxkMvi9u6e4zp/ZmStVkOpVOor1mg00Ol0CIfDKBQK/Q1isRhcLhedJpIn" "vHXkI+D5SUSj+0in0wMM4mSw6WqL9whLhHeCYAA/tobo9twQgxsyEMjglUj6IE7YIJxQ" "gk9K8DwsgTLCMjGGdvJxJibMUgJ+hUaYGWyQSCQQDO7+ZO8uo1EHn8/2v4Hb7UYmkxl4" "jY1GA9lsFrlcDl+fDZxfJNsGHo9H1QNiVa/XlQSiuIAp2wS466ukHNjaUauHXq+H0+n8" "HYPrzF+pVHriSpLUxbGHJAgCIpFIr0EqlYI0KmH6Y1o5XC6XaaFBpW+1WqhWq7BYLLRI" "X9ciFQNRFJHP53FoO4T3xdsTu9lsolgswm63Kz1b9tPTI6xmAVzk+Eg+PbtUvQNWstxS" "xHv7B+1bEBfnVd8CK6vFrIhZ/w1wBAQrC42uqQAAAABJRU5ErkJggg=="), ) ENUM_WINDOWS_PROC_TYPE = WINFUNCTYPE(BOOL, HWND, LPARAM) EnumWindows.argtypes = [ENUM_WINDOWS_PROC_TYPE, LPARAM] WM_SHELLHOOKMESSAGE = RegisterWindowMessage("SHELLHOOK") class TaskMonitorPlus(eg.PluginBase): def __init__(self): self.AddEvents() def __start__(self, *dummyArgs): self.pids, self.hwnds = EnumProcesses() self.flashing = set() self.lastActivated = None eg.messageReceiver.AddHandler(WM_APP + 1, self.WindowGotFocusProc) eg.messageReceiver.AddHandler(WM_APP + 2, self.WindowCreatedProc) eg.messageReceiver.AddHandler(WM_APP + 3, self.WindowDestroyedProc) eg.messageReceiver.AddHandler(WM_SHELLHOOKMESSAGE, self.MyWndProc) RegisterShellHookWindow(eg.messageReceiver.hwnd)
def __call__( self, pathname='', arguments='', winState=0, waitForCompletion=False, priority=2, workingDir="", triggerEvent=False, disableWOW64=False, ): returnValue = None pathname = eg.ParseString(pathname) if not workingDir: workingDir = dirname(abspath(pathname)) arguments = eg.ParseString(arguments) commandLine = create_unicode_buffer('"%s" %s' % (pathname, arguments)) startupInfo = STARTUPINFO() startupInfo.cb = sizeof(STARTUPINFO) startupInfo.dwFlags = STARTF_USESHOWWINDOW startupInfo.wShowWindow = WINSTATE_FLAGS[winState] priorityFlag = PRIORITY_FLAGS[priority] processInformation = self.processInformation = PROCESS_INFORMATION() disableWOW64 = disableWOW64 and IsWin64() if disableWOW64: prevVal = Wow64DisableWow64FsRedirection() res = CreateProcess( None, # lpApplicationName commandLine, # lpCommandLine None, # lpProcessAttributes None, # lpThreadAttributes False, # bInheritHandles priorityFlag | CREATE_NEW_CONSOLE, # dwCreationFlags None, # lpEnvironment workingDir, # lpCurrentDirectory startupInfo, # lpStartupInfo processInformation # lpProcessInformation ) if disableWOW64: Wow64RevertWow64FsRedirection(prevVal) suffix = "%s.%s" % (self.text.eventSuffix, splitext( split(pathname)[1])[0]) prefix = self.plugin.name.replace(' ', '') if res == 0: raise self.Exception(FormatError()) if winState != 3 and PluginIsEnabled("Task"): def callback(dummyHwnd, dummyMesg, wParam, lParam): pids = GetPids(hwnd=lParam) pid = pids[0] if pids else False if pid == processInformation.dwProcessId: try: eg.messageReceiver.RemoveHandler( WM_SHELLHOOKMESSAGE, refCallback) except: pass sleep(0.3) # Wait for windows to appear hwnds = GetHwnds(pid=processInformation.dwProcessId) if hwnds: #print "Focused via GetHwnds" for hwnd in hwnds: if IsWindowVisible(hwnd): BringHwndToFront(hwnd) break elif IsWindowVisible(lParam): #print "Focused via ShellHook" BringHwndToFront(lParam) elif not ProcessExists(processInformation.dwProcessId): try: eg.messageReceiver.RemoveHandler( WM_SHELLHOOKMESSAGE, refCallback) except: pass try: eg.plugins.Window.FindWindow(basename(pathname)) if len(eg.lastFoundWindows): #print "Focused via FindWindow" BringHwndToFront(eg.lastFoundWindows[0]) except: pass refCallback = callback WM_SHELLHOOKMESSAGE = RegisterWindowMessage("SHELLHOOK") eg.messageReceiver.AddHandler(WM_SHELLHOOKMESSAGE, callback) if waitForCompletion: WaitForSingleObject(processInformation.hProcess, INFINITE) exitCode = DWORD() if not GetExitCodeProcess(processInformation.hProcess, byref(exitCode)): raise self.Exception(FormatError()) returnValue = exitCode.value if triggerEvent: eg.TriggerEvent(suffix, prefix=prefix) CloseHandle(processInformation.hProcess) CloseHandle(processInformation.hThread) return returnValue elif triggerEvent: te = self.TriggerEvent(processInformation, suffix, prefix) te.start() else: CloseHandle(processInformation.hProcess) CloseHandle(processInformation.hThread)
"IiJiEAkpJjJMA6G2MOk+QloeR3mwq0jAOLuO0Zfvu0RCIF81SZkWERHhf8wMAYEBSgHy" "jDaEgNy5UdNi9DMpShgxQACLgBhC0BARiAjSVEMkASsCaQi0BhgwJZZII+YwUY/PDv9O" "rAyw1bAkbzFEWAABAIhoiAZ0KuJlCdv1DOwM0KhsBBrY4lYQz1cOj6qlvTn8jFeIW3vw" "fZt0StCAQESEFQodWUqbTzCvXpXi3hwq+0/3ASwqiLTCVC57rb+e96/f5u1jxrizIYN9" "PXBtG1nLRHeHoH6wJl+sXUCrYwjbX90MN3cOvofK3FGO4zbPgrDRrD0byx795jvjt/iR" "XEGrdoQ0buG4FmLxX8Ld40mcxjlsfj6dLC8uLCWp/riQc9ZVrLVWRJV2lLRqh7vD8dYP" "eaVEPeVLtB4NYanmYW0vQuX3u3rlzrvByoP7S0EYf6IU3zsLk4iYGRAhYc5Jmk4Zpj1b" "9L1Jr9TdZWcLGRCk2TgNGyeVg+qz+nyaxF8bBi8miW53egWQbduIoghETEopM9W6X4tM" "MNE4EQ0A0FrLP4DcJ+IHhsEHcRSlAISZ8B9r7Ju1EcqVkQAAAABJRU5ErkJggg==)")) from eg.WinApi.Dynamic import RegisterWindowMessage import imon, actions from imon import DSPNotifyCode, DSPNInitResult, DSPType # Registers a custom message type for the windows event system WM_IMON_DISPLAY = RegisterWindowMessage("IMON_DISPLAY") class imonHandler(object): def __init__(self, plugin): self.plugin = plugin def handle(self, notifyCode, payload): try: notify = getattr(self, notifyCode.name) except AttributeError: self.plugin.PrintError("Unhandled Display Notification: " + str(notifyCode.name)) else: notify(payload)