From 73d12d0f6eb5c673a951eec94ddf5cdeeacde369 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 18 May 2018 14:16:30 +0300 Subject: constructor of CMPlugin now registers it automatically in the module list, no need to call RegisterModule manually --- include/delphi/m_core.inc | 12 ------------ include/m_core.h | 6 ++++-- include/newpluginapi.h | 2 +- 3 files changed, 5 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index f5af2c3ca4..7e913e2d7a 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -381,18 +381,6 @@ function mir_strcmpi(const p1,p2:PAnsiChar):int; stdcall; function mir_wstrcmpi(const p1,p2:PWideChar):int; stdcall; external CoreDLL name 'mir_wstrcmpi'; -/////////////////////////////////////////////////////////////////////////////// -// modules - -procedure RegisterModule(hInst:HINST); stdcall; - external CoreDLL name 'RegisterModule'; -procedure UnregisterModule(hInst:HINST); stdcall; - external CoreDLL name 'UnregisterModule'; - -function GetInstByAddress(codePtr:pointer):HINST; stdcall; - external CoreDLL name 'GetInstByAddress'; - - /////////////////////////////////////////////////////////////////////////////// // print functions diff --git a/include/m_core.h b/include/m_core.h index e5d7cbfb59..2b85a8e36c 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -309,10 +309,12 @@ MIR_CORE_DLL(wchar_t*) mir_wstrndup(const wchar_t *str, size_t len); /////////////////////////////////////////////////////////////////////////////// // modules -MIR_CORE_DLL(void) RegisterModule(HINSTANCE hInst); -MIR_CORE_DLL(void) UnregisterModule(HINSTANCE hInst); +class CMPluginBase; +MIR_CORE_DLL(void) RegisterModule(CMPluginBase*); +MIR_CORE_DLL(void) UnregisterModule(CMPluginBase*); MIR_CORE_DLL(HINSTANCE) GetInstByAddress(void* codePtr); +MIR_CORE_DLL(CMPluginBase&) GetPluginByInstance(HINSTANCE hInst); /////////////////////////////////////////////////////////////////////////////// // print functions diff --git a/include/newpluginapi.h b/include/newpluginapi.h index 278b9192e4..c7c8f37a42 100644 --- a/include/newpluginapi.h +++ b/include/newpluginapi.h @@ -157,9 +157,9 @@ class MIR_APP_EXPORT CMPluginBase void tryOpenLog(); protected: + HINSTANCE m_hInst; const char *m_szModuleName; HANDLE m_hLogger = nullptr; - HINSTANCE m_hInst; CMPluginBase(const char *moduleName); ~CMPluginBase(); -- cgit v1.2.3