From b741619e220a230f2b7d07318eb68f412c93e43a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 30 Jun 2012 19:36:55 +0000 Subject: compatibility fix for core git-svn-id: http://svn.miranda-ng.org/main/trunk@706 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Mir_core/modules.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/Mir_core/modules.cpp b/plugins/Mir_core/modules.cpp index 61e7344676..6c023891a8 100644 --- a/plugins/Mir_core/modules.cpp +++ b/plugins/Mir_core/modules.cpp @@ -227,7 +227,7 @@ MIR_CORE_DLL(int) CallHookSubscribers(HANDLE hEvent, WPARAM wParam, LPARAM lPara return returnVal; } -static bool checkHook(HANDLE hHook) +__forceinline bool checkHook(HANDLE hHook, bool& bIsValid) { THook* p = (THook*)hHook; if (p == NULL) @@ -237,15 +237,15 @@ static bool checkHook(HANDLE hHook) __try { if (p->secretSignature != HOOK_SECRET_SIGNATURE) - ret = false; + bIsValid = ret = false; else if (p->subscriberCount == 0 && p->pfnHook == NULL) - ret = false; + bIsValid = true, ret = false; else ret = true; } __except(EXCEPTION_EXECUTE_HANDLER) { - ret = false; + bIsValid = ret = false; } return ret; @@ -260,8 +260,9 @@ static void CALLBACK HookToMainAPCFunc(ULONG_PTR dwParam) MIR_CORE_DLL(int) NotifyEventHooks(HANDLE hEvent, WPARAM wParam, LPARAM lParam) { - if ( !checkHook(hEvent)) - return -1; + bool bIsValid; + if ( !checkHook(hEvent, bIsValid)) + return (bIsValid) ? 0 : -1; if ( GetCurrentThreadId() == mainThreadId) return CallHookSubscribers(hEvent, wParam, lParam); -- cgit v1.2.3