diff options
author | George Hazan <george.hazan@gmail.com> | 2023-12-07 12:22:10 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-12-07 12:22:10 +0300 |
commit | e767d690d104bf83b8efe28e338768aec3406bfc (patch) | |
tree | 92a5dc20ead507d08ffa9c66e1c9fe2aaea15494 | |
parent | c6ef1e6b965f3175f7e1f46c1a6c57d0f0f8ccf5 (diff) |
EventExists: a helper to check the hookable event's presence
-rw-r--r-- | include/m_core.h | 1 | ||||
-rw-r--r-- | libs/win32/mir_core.lib | bin | 493794 -> 493990 bytes | |||
-rw-r--r-- | libs/win64/mir_core.lib | bin | 499060 -> 499242 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 | 9 |
6 files changed, 12 insertions, 0 deletions
diff --git a/include/m_core.h b/include/m_core.h index 6f2b88f631..d4fd0f197a 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -109,6 +109,7 @@ typedef INT_PTR (*MIRANDASERVICEOBJPARAM)(void*, WPARAM, LPARAM, LPARAM); MIR_CORE_DLL(HANDLE) CreateHookableEvent(const char *name);
MIR_CORE_DLL(int) DestroyHookableEvent(HANDLE hEvent);
+MIR_CORE_DLL(bool) EventExists(const char *name);
MIR_CORE_DLL(int) SetHookDefaultForHookableEvent(HANDLE hEvent, MIRANDAHOOK pfnHook);
MIR_CORE_DLL(int) CallPluginEventHook(HINSTANCE hInst, const char *pszEvent, WPARAM wParam = 0, LPARAM lParam = 0);
MIR_CORE_DLL(int) CallObjectEventHook(void *pObject, HANDLE hEvent, WPARAM wParam = 0, LPARAM lParam = 0);
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib Binary files differindex f8e046d131..6adf3dddb9 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 16cfc1e6f1..d0a67b237e 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 1b934ef47f..0d7894a5c5 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1560,3 +1560,4 @@ db_event_updateId @1772 ?GetPlugin@CDlgBase@@QBEPBVCMPluginBase@@XZ @1784 NONAME
_TranslateW_UUID@8 @1785 NONAME
?Langpack_GetDefaultLocaleName@@YGPADXZ @1786 NONAME
+_EventExists@4 @1787 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 8007570bba..db7faf95a8 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1560,3 +1560,4 @@ db_event_updateId @1772 ?GetPlugin@CDlgBase@@QEBAPEBVCMPluginBase@@XZ @1784 NONAME
TranslateW_UUID @1785 NONAME
?Langpack_GetDefaultLocaleName@@YAPEADXZ @1786 NONAME
+EventExists @1787 NONAME
diff --git a/src/mir_core/src/modules.cpp b/src/mir_core/src/modules.cpp index 0d471c8c6c..e62f72a4be 100644 --- a/src/mir_core/src/modules.cpp +++ b/src/mir_core/src/modules.cpp @@ -102,6 +102,15 @@ static int QueueMainThread(PAPCFUNC pFunc, void* pParam, HANDLE hDoneEvent) ///////////////////////////////////////////////////////////////////////////////
// HOOKS
+MIR_CORE_DLL(bool) EventExists(const char *name)
+{
+ if (name == nullptr)
+ return false;
+
+ mir_cslock lck(csHooks);
+ return hooks.getIndex((THook *)name) != -1;
+}
+
MIR_CORE_DLL(HANDLE) CreateHookableEvent(const char *name)
{
if (name == nullptr)
|