From 9b35784c5042984fbb60785f0a4a41a64af545f6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 12 Nov 2018 18:07:16 +0300 Subject: fix for a zoo with ME_OPT_INITIALISE inside mir_app.dll --- src/mir_app/src/FontService.cpp | 8 +------- src/mir_app/src/ei_services.cpp | 9 +-------- src/mir_app/src/hotkeys.cpp | 8 +------- src/mir_app/src/icolib.cpp | 8 +------- src/mir_app/src/miranda.cpp | 3 +++ src/mir_app/src/netlib.cpp | 4 ++-- src/mir_app/src/options.cpp | 3 +-- src/mir_app/src/sounds.cpp | 8 +------- src/mir_app/src/srmm_toolbar.cpp | 8 +------- 9 files changed, 12 insertions(+), 47 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/FontService.cpp b/src/mir_app/src/FontService.cpp index 0b4fbd1495..3dc2d924eb 100644 --- a/src/mir_app/src/FontService.cpp +++ b/src/mir_app/src/FontService.cpp @@ -451,12 +451,6 @@ MIR_APP_DLL(int) Effect_Get(const char *szGroup, const char *szName, FONTEFFECT int OptInit(WPARAM, LPARAM); -static int OnModulesLoaded(WPARAM, LPARAM) -{ - HookEvent(ME_OPT_INITIALISE, OptInit); - return 0; -} - static int OnPreShutdown(WPARAM, LPARAM) { DestroyHookableEvent(hFontReloadEvent); @@ -498,7 +492,7 @@ int LoadFontserviceModule(void) g_plugin.addFont(&fontid); // do last for silly dyna plugin - HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + HookEvent(ME_OPT_INITIALISE, OptInit); HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); return 0; } diff --git a/src/mir_app/src/ei_services.cpp b/src/mir_app/src/ei_services.cpp index 05e4969b2f..70fad400fb 100644 --- a/src/mir_app/src/ei_services.cpp +++ b/src/mir_app/src/ei_services.cpp @@ -47,13 +47,6 @@ static bool clistRebuildAlreadyCalled = false, clistApplyAlreadyCalled = false; int InitOptionsCallback(WPARAM wParam, LPARAM lParam); -// Called when all the modules are loaded -int ModulesLoaded(WPARAM, LPARAM) -{ - HookEvent(ME_OPT_INITIALISE, InitOptionsCallback); - return 0; -} - int ConvertToClistSlot(int slot) { if (slot < 0) @@ -483,7 +476,7 @@ void LoadExtraIconsModule() g_plugin.registerIcon(LPGEN("Contact list"), iconList); // Hooks - HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + HookEvent(ME_OPT_INITIALISE, InitOptionsCallback); HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, ClistExtraListRebuild); HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, ClistExtraImageApply); diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp index 63fdd8f8cc..4669e90435 100644 --- a/src/mir_app/src/hotkeys.cpp +++ b/src/mir_app/src/hotkeys.cpp @@ -303,12 +303,6 @@ void UnregisterHotkeys() UnregisterHotKey(g_hwndHotkeyHost, p->idHotkey); } -static int sttModulesLoaded(WPARAM, LPARAM) -{ - HookEvent(ME_OPT_INITIALISE, HotkeyOptionsInit); - return 0; -} - /////////////////////////////////////////////////////////////////////////////// // Hotkey manager @@ -343,7 +337,7 @@ int LoadSkinHotkeys(void) hEvChanged = CreateHookableEvent(ME_HOTKEYS_CHANGED); - HookEvent(ME_SYSTEM_MODULESLOADED, sttModulesLoaded); + HookEvent(ME_OPT_INITIALISE, HotkeyOptionsInit); for (int i = 0; i < _countof(oldSettings); i++) { char szSetting[100]; diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index f20a408870..b3254eff5d 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -772,12 +772,6 @@ MIR_APP_DLL(int) IcoLib_AddRef(HICON hIcon) return 1; } -static int SkinSystemModulesLoaded(WPARAM, LPARAM) -{ - HookEvent(ME_OPT_INITIALISE, SkinOptionsInit); - return 0; -} - ///////////////////////////////////////////////////////////////////////////////////////// // Module initialization and finalization procedure @@ -790,7 +784,7 @@ int LoadIcoLibModule(void) hIcons2ChangedEvent = CreateHookableEvent(ME_SKIN2_ICONSCHANGED); hIconsChangedEvent = CreateHookableEvent(ME_SKIN_ICONSCHANGED); - HookEvent(ME_SYSTEM_MODULESLOADED, SkinSystemModulesLoaded); + HookEvent(ME_OPT_INITIALISE, SkinOptionsInit); return 0; } diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp index cc7097eb4d..0d56c8ec35 100644 --- a/src/mir_app/src/miranda.cpp +++ b/src/mir_app/src/miranda.cpp @@ -481,11 +481,14 @@ MIR_APP_DLL(void) Miranda_GetVersionText(char *pDest, size_t cbSize) /////////////////////////////////////////////////////////////////////////////// +extern HANDLE hOptionsInitEvent; + int LoadSystemModule(void) { hShutdownEvent = CreateHookableEvent(ME_SYSTEM_SHUTDOWN); hPreShutdownEvent = CreateHookableEvent(ME_SYSTEM_PRESHUTDOWN); hModulesLoadedEvent = CreateHookableEvent(ME_SYSTEM_MODULESLOADED); hOkToExitEvent = CreateHookableEvent(ME_SYSTEM_OKTOEXIT); + hOptionsInitEvent = CreateHookableEvent(ME_OPT_INITIALISE); return 0; } diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp index 6e096cef27..5165ad0d1f 100644 --- a/src/mir_app/src/netlib.cpp +++ b/src/mir_app/src/netlib.cpp @@ -452,11 +452,11 @@ int LoadNetlibModule(void) WSADATA wsadata; WSAStartup(MAKEWORD(2, 2), &wsadata); - HookEvent(ME_OPT_INITIALISE, NetlibOptInitialise); - hConnectionHeaderMutex = CreateMutex(nullptr, FALSE, nullptr); NetlibLogInit(); + HookEvent(ME_OPT_INITIALISE, NetlibOptInitialise); + connectionTimeout = 0; OSVERSIONINFOEX osvi = { 0 }; diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index 59555a026e..24ed6fbe90 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -36,7 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. int LangpackOptionsInit(WPARAM, LPARAM); -static HANDLE hOptionsInitEvent; +HANDLE hOptionsInitEvent; static class COptionsDlg *pOptionsDlg = nullptr; // Thread for search keywords in dialogs @@ -1285,7 +1285,6 @@ int ShutdownOptionsModule(WPARAM, LPARAM) int LoadOptionsModule(void) { - hOptionsInitEvent = CreateHookableEvent(ME_OPT_INITIALISE); HookEvent(ME_OPT_INITIALISE, LangpackOptionsInit); HookEvent(ME_SYSTEM_MODULELOAD, OptDynamicLoadOptions); diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp index a0d2c7a281..593d571357 100644 --- a/src/mir_app/src/sounds.cpp +++ b/src/mir_app/src/sounds.cpp @@ -446,16 +446,10 @@ MIR_APP_DLL(int) Skin_PlaySound(const char *pszSoundName) return 0; } -static int SkinSystemModulesLoaded(WPARAM, LPARAM) +int LoadSkinSounds(void) { HookEvent(ME_OPT_INITIALISE, SkinOptionsInit); - return 0; -} -int LoadSkinSounds(void) -{ - HookEvent(ME_SYSTEM_MODULESLOADED, SkinSystemModulesLoaded); // because options module isn't loaded yet - hPlayEvent = CreateHookableEvent(ME_SKIN_PLAYINGSOUND); SetHookDefaultForHookableEvent(hPlayEvent, Skin_PlaySoundDefault); return 0; diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index bb4c076db0..40a789924b 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -800,12 +800,6 @@ static INT_PTR BroadcastMessage(WPARAM, LPARAM lParam) return 0; } -static int SrmmModulesLoaded(WPARAM, LPARAM) -{ - HookEvent(ME_OPT_INITIALISE, SrmmOptionsInit); - return 0; -} - static void CALLBACK SrmmLoadToolbar() { NotifyEventHooks(hHookToolBarLoadedEvt, 0, 0); @@ -826,7 +820,7 @@ void LoadSrmmToolbarModule() { CreateServiceFunction("SRMsg/BroadcastMessage", BroadcastMessage); - HookEvent(ME_SYSTEM_MODULESLOADED, SrmmModulesLoaded); + HookEvent(ME_OPT_INITIALISE, SrmmOptionsInit); Miranda_WaitOnHandle(SrmmLoadToolbar); -- cgit v1.2.3