From 10091bbca1380a1d8e3b9d61b8c175490036af5b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 2 Dec 2016 22:21:55 +0300 Subject: old shit died now there's no need to create fake services & events --- plugins/CryptoPP/crypto/src/wait.cpp | 2 ++ plugins/Sessions/Src/Main.cpp | 12 ++---------- plugins/Sessions/Src/stdafx.h | 2 -- plugins/TopToolBar/src/toolbar.cpp | 7 ++----- plugins/TopToolBar/src/toolbarwnd.cpp | 10 ++-------- plugins/Watrack/watrack.dpr | 15 ++------------- 6 files changed, 10 insertions(+), 38 deletions(-) (limited to 'plugins') diff --git a/plugins/CryptoPP/crypto/src/wait.cpp b/plugins/CryptoPP/crypto/src/wait.cpp index e4bae04faa..b031922638 100644 --- a/plugins/CryptoPP/crypto/src/wait.cpp +++ b/plugins/CryptoPP/crypto/src/wait.cpp @@ -13,6 +13,8 @@ #include #endif +#define MAXIMUM_WAIT_OBJECTS 64 + NAMESPACE_BEGIN(CryptoPP) unsigned int WaitObjectContainer::MaxWaitObjects() diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index d1c379893d..ba1cbaf64d 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -740,11 +740,8 @@ static int CreateButtons(WPARAM, LPARAM) return 0; } -static INT_PTR LaunchSessions(WPARAM wParam, LPARAM) +static void CALLBACK LaunchSessions() { - CallService(MS_SYSTEM_REMOVEWAIT, wParam, 0); - CloseHandle((HANDLE)wParam); - int startup = db_get_b(NULL, MODNAME, "StartupMode", 3); if (startup == 1 || (startup == 3 && isLastTRUE == TRUE)) { StartUp = TRUE; @@ -754,7 +751,6 @@ static INT_PTR LaunchSessions(WPARAM wParam, LPARAM) g_hghostw = TRUE; g_hDlg = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_WLCMDIALOG), 0, LoadSessionDlgProc); } - return 0; } static int PluginInit(WPARAM, LPARAM) @@ -846,11 +842,7 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction(MS_SESSIONS_SAVEUSERSESSION, SaveUserSessionHandles); CreateServiceFunction(MS_SESSIONS_CLOSESESSION, CloseCurrentSession); - HANDLE hEvent = CreateEvent(NULL, TRUE, TRUE, NULL); - if (hEvent != 0) { - CreateServiceFunction(MS_SESSIONS_LAUNCHME, LaunchSessions); - CallService(MS_SYSTEM_WAITONHANDLE, (WPARAM)hEvent, (LPARAM)MS_SESSIONS_LAUNCHME); - } + Miranda_WaitOnHandle(LaunchSessions); g_ses_count = db_get_b(NULL, MODNAME, "UserSessionsCount", 0); g_ses_limit = db_get_b(NULL, MODNAME, "TrackCount", 10); diff --git a/plugins/Sessions/Src/stdafx.h b/plugins/Sessions/Src/stdafx.h index d6cad97c92..35d25db35b 100644 --- a/plugins/Sessions/Src/stdafx.h +++ b/plugins/Sessions/Src/stdafx.h @@ -44,8 +44,6 @@ along with this program. If not, see . #define MODNAME "Sessions" -#define MS_SESSIONS_LAUNCHME "Sessions/Service/LaunchMe" - extern IconItem iconList[]; #define MIIM_STRING 0x00000040 diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index a8c037a7ac..ecb7db6de1 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -5,7 +5,7 @@ pfnCustomProc g_CustomProc = NULL; LPARAM g_CustomProcParam = 0; TTBCtrl *g_ctrl = NULL; -INT_PTR OnEventFire(WPARAM wParam, LPARAM lParam); +void CALLBACK OnEventFire(); HWND hwndContactList = 0; @@ -575,9 +575,7 @@ static int OnModulesLoad(WPARAM, LPARAM) ArrangeButtons(); - HANDLE hEvent = CreateEvent(NULL, TRUE, TRUE, NULL);//anonymous event - if (hEvent != 0) - CallService(MS_SYSTEM_WAITONHANDLE, (WPARAM)hEvent, (LPARAM)"TTB_ONSTARTUPFIRE"); + Miranda_WaitOnHandle(OnEventFire); if (HookEvent(ME_BACKGROUNDCONFIG_CHANGED, OnBGChange)) { char buf[256]; @@ -662,7 +660,6 @@ int LoadToolbarModule() CreateServiceFunction(TTB_LAUNCHSERVICE, LaunchService); CreateServiceFunction("TopToolBar/SetCustomProc", TTBSetCustomProc); - CreateServiceFunction("TTB_ONSTARTUPFIRE", OnEventFire); buttonWndProc = (WNDPROC)CallService("Button/GetWindowProc", 0, 0); WNDCLASSEX wc = {0}; diff --git a/plugins/TopToolBar/src/toolbarwnd.cpp b/plugins/TopToolBar/src/toolbarwnd.cpp index 8962a36af0..f02645e039 100644 --- a/plugins/TopToolBar/src/toolbarwnd.cpp +++ b/plugins/TopToolBar/src/toolbarwnd.cpp @@ -238,14 +238,11 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara ///////////////////////////////////////////////////////////////////////////////////////// -INT_PTR OnEventFire(WPARAM wParam, LPARAM) +void CALLBACK OnEventFire() { - CallService(MS_SYSTEM_REMOVEWAIT, wParam, 0); - CloseHandle((HANDLE)wParam); - HWND parent = pcli->hwndContactList; if (parent == NULL) // no clist, no buttons - return -1; + return; WNDCLASS wndclass = {0}; wndclass.lpfnWndProc = TopToolBarProc; @@ -284,8 +281,6 @@ INT_PTR OnEventFire(WPARAM wParam, LPARAM) // receive buttons NotifyEventHooks(hTTBModuleLoaded, 0, 0); - - return 0; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -309,6 +304,5 @@ int LoadBackgroundOptions() GetClientRect(g_ctrl->hWnd, &rc); InvalidateRect(g_ctrl->hWnd, &rc, TRUE); UpdateWindow(g_ctrl->hWnd); - return 0; } diff --git a/plugins/Watrack/watrack.dpr b/plugins/Watrack/watrack.dpr index c1c947704a..478ced86a1 100644 --- a/plugins/Watrack/watrack.dpr +++ b/plugins/Watrack/watrack.dpr @@ -417,14 +417,10 @@ begin NotifyEventHooks(hHookWATStatus,WAT_EVENT_PLUGINSTATUS,DisablePlugin); end; -function WaitAllModules(wParam:WPARAM;lParam:LPARAM):int;cdecl; +procedure WaitAllModules; stdcall; var ptr:pwModule; begin - result:=0; - - CallService(MS_SYSTEM_REMOVEWAIT,wParam,0); - ptr:=ModuleLink; while ptr<>nil do begin @@ -439,7 +435,6 @@ begin StartTimer; NotifyEventHooks(hHookWATLoaded,0,0); - CloseHandle(hEvent); end; procedure DoTheDew(load:boolean); @@ -561,13 +556,7 @@ begin end; // Load WATrack modules - hEvent:=CreateEvent(nil,true,true,nil); - if hEvent<>0 then - begin - p:='WAT_INIT'; - CreateServiceFunction(p,@WaitAllModules); - CallService(MS_SYSTEM_WAITONHANDLE,hEvent,tlparam(p)); - end; + Miranda_WaitOnHandle(@WaitAllModules, 0); LoadOpt; if DisablePlugin=dsPermanent then -- cgit v1.2.3