diff options
-rw-r--r-- | include/m_core.h | 4 | ||||
-rw-r--r-- | libs/win32/mir_core.lib | bin | 317222 -> 317458 bytes | |||
-rw-r--r-- | libs/win64/mir_core.lib | bin | 318184 -> 318400 bytes | |||
-rw-r--r-- | src/mir_core/src/mir_core.def | 1 | ||||
-rw-r--r-- | src/mir_core/src/mir_core64.def | 1 | ||||
-rw-r--r-- | src/mir_core/src/modules.cpp | 24 |
6 files changed, 30 insertions, 0 deletions
diff --git a/include/m_core.h b/include/m_core.h index 6d31fe17bb..eba11f2956 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -109,6 +109,10 @@ MIR_CORE_DLL(HANDLE) HookEventParam(const char *name, MIRANDAHOOKPARAM hookProc MIR_CORE_DLL(HANDLE) HookEventObj(const char *name, MIRANDAHOOKOBJ hookProc, void* object);
MIR_CORE_DLL(HANDLE) HookEventObjParam(const char *name, MIRANDAHOOKOBJPARAM hookProc, void* object, LPARAM lParam);
MIR_CORE_DLL(HANDLE) HookEventMessage(const char *name, HWND hwnd, UINT message);
+ +// executes the event handler if event is missing +MIR_CORE_DLL(HANDLE) HookTemporaryEvent(const char *name, MIRANDAHOOK hookProc); +
MIR_CORE_DLL(int) UnhookEvent(HANDLE hHook);
MIR_CORE_DLL(void) KillObjectEventHooks(void* pObject);
MIR_CORE_DLL(void) KillModuleEventHooks(HINSTANCE pModule);
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib Binary files differindex 4d146f0474..573e3e749a 100644 --- a/libs/win32/mir_core.lib +++ b/libs/win32/mir_core.lib diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib Binary files differindex 147ada0405..96c16192bd 100644 --- a/libs/win64/mir_core.lib +++ b/libs/win64/mir_core.lib diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index f5037de864..8a8e4df230 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1050,3 +1050,4 @@ CallFunctionSync @1170 ?Hide@CDlgBase@@QAEXXZ @1238 NONAME
?Resize@CDlgBase@@QAEXXZ @1239 NONAME
Utils_IsRtl @1240
+HookTemporaryEvent @1241
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 31edd2dbea..f188b5b51d 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1050,3 +1050,4 @@ CallFunctionSync @1170 ?Hide@CDlgBase@@QEAAXXZ @1238 NONAME
?Resize@CDlgBase@@QEAAXXZ @1239 NONAME
Utils_IsRtl @1240
+HookTemporaryEvent @1241
diff --git a/src/mir_core/src/modules.cpp b/src/mir_core/src/modules.cpp index c6908e723d..ae7cd45f1e 100644 --- a/src/mir_core/src/modules.cpp +++ b/src/mir_core/src/modules.cpp @@ -332,6 +332,30 @@ MIR_CORE_DLL(HANDLE) HookEventObjParam(const char *name, MIRANDAHOOKOBJPARAM hoo return HookEventInt(4, name, (MIRANDAHOOK)hookProc, object, lParam); } +MIR_CORE_DLL(HANDLE) HookTemporaryEvent(const char *name, MIRANDAHOOK hookProc) +{ + mir_cslockfull lck(csHooks); + + int idx; + if ((idx = hooks.getIndex((THook*)name)) == -1) { + lck.unlock(); + hookProc(0, 0); + return NULL; + } + + THook *p = hooks[idx]; + p->subscriber = (THookSubscriber*)mir_realloc(p->subscriber, sizeof(THookSubscriber)*(p->subscriberCount + 1)); + + THookSubscriber &s = p->subscriber[p->subscriberCount]; + memset(&s, 0, sizeof(THookSubscriber)); + s.type = 1; + s.pfnHook = hookProc; + s.hOwner = GetInstByAddress(hookProc); + + p->subscriberCount++; + return (HANDLE)((p->id << 16) | p->subscriberCount); +} + MIR_CORE_DLL(HANDLE) HookEventMessage(const char *name, HWND hwnd, UINT message) { mir_cslock lck(csHooks); |