From 488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 12 Nov 2018 20:12:53 +0300 Subject: end of ME_OPT_INITIALISE related zoo in another plugins --- plugins/ConnectionNotify/src/ConnectionNotify.cpp | 29 +++++++---------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to 'plugins/ConnectionNotify/src') diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index c18dad2c35..107ff78e04 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -2,15 +2,10 @@ CMPlugin g_plugin; -//PLUGINLINK *pluginLink=NULL; -HANDLE hOptInit = nullptr; static HWND hTimerWnd = (HWND)nullptr; static UINT TID = (UINT)12021; -//HANDLE hHookModulesLoaded=NULL; HANDLE hCheckEvent = nullptr; HANDLE hCheckHook = nullptr; -HANDLE hHookModulesLoaded = nullptr; -HANDLE hHookPreShutdown = nullptr; HANDLE hConnectionCheckThread = nullptr; HANDLE hFilterOptionsThread = nullptr; HANDLE killCheckThreadEvent = nullptr; @@ -861,13 +856,9 @@ int CMPlugin::Load() g_plugin.addSound(PLUGINNAME_NEWSOUND, PLUGINNAMEW, LPGENW("New Connection Notification")); - hOptInit = HookEvent(ME_OPT_INITIALISE, ConnectionNotifyOptInit);//register service to hook option call - assert(hOptInit); - - hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, modulesloaded);//hook event that all plugins are loaded - assert(hHookModulesLoaded); - - hHookPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, preshutdown); + HookEvent(ME_OPT_INITIALISE, ConnectionNotifyOptInit); // register service to hook option call + HookEvent(ME_SYSTEM_MODULESLOADED, modulesloaded); // hook event that all plugins are loaded + HookEvent(ME_SYSTEM_PRESHUTDOWN, preshutdown); return 0; } @@ -876,15 +867,11 @@ int CMPlugin::Load() int CMPlugin::Unload() { WaitForSingleObjectEx(hConnectionCheckThread, INFINITE, FALSE); - if (hConnectionCheckThread)CloseHandle(hConnectionCheckThread); - if (hCheckEvent)DestroyHookableEvent(hCheckEvent); - if (hOptInit) UnhookEvent(hOptInit); - if (hCheckHook)UnhookEvent(hCheckHook); - if (hHookModulesLoaded)UnhookEvent(hHookModulesLoaded); - if (hHookPreShutdown)UnhookEvent(hHookPreShutdown); - if (killCheckThreadEvent) - CloseHandle(killCheckThreadEvent); - //if (hCurrentEditMutex) CloseHandle(hCurrentEditMutex); + + if (hConnectionCheckThread) CloseHandle(hConnectionCheckThread); + if (hCheckEvent) DestroyHookableEvent(hCheckEvent); + if (hCheckHook) UnhookEvent(hCheckHook); + if (killCheckThreadEvent) CloseHandle(killCheckThreadEvent); if (hExceptionsMutex) CloseHandle(hExceptionsMutex); #ifdef _DEBUG -- cgit v1.2.3