summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-18 18:14:33 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-18 18:14:33 +0300
commitb172c4bbc75cdad0e8ccd22292aa671ba43cac45 (patch)
tree4677a04a47f3987c88f3fb44c6b70d2642b1f8a3 /src
parent524d1c7186eca3f0a4da08548eeb919785227101 (diff)
PLUGIN<> to half-automatically calculate the dll's g_hInstance and pass it inside
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/CMPluginBase.cpp6
-rw-r--r--src/mir_app/src/mir_app.def3
-rw-r--r--src/mir_app/src/mir_app64.def3
-rw-r--r--src/mir_app/src/protocols.cpp1
4 files changed, 9 insertions, 4 deletions
diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp
index 8a17a6ac8e..b2fd90b048 100644
--- a/src/mir_app/src/CMPluginBase.cpp
+++ b/src/mir_app/src/CMPluginBase.cpp
@@ -24,8 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-CMPluginBase::CMPluginBase(const char *moduleName) :
- m_szModuleName(moduleName)
+CMPluginBase::CMPluginBase(HINSTANCE hInst, const char *moduleName) :
+ m_szModuleName(moduleName),
+ m_hInst(hInst)
{
}
@@ -74,5 +75,6 @@ void CMPluginBase::RegisterProtocol(int type, pfnInitProto fnInit, pfnUninitProt
pd.type = type;
pd.fnInit = fnInit;
pd.fnUninit = fnUninit;
+ pd.hInst = m_hInst;
Proto_RegisterModule(&pd);
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 6b296a7b83..74e2bb6bbb 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -487,7 +487,7 @@ GetDatabasePlugin @508
SetServiceModePlugin @510
Proto_CreateAccount @511
Proto_GetAverageStatus @512
-??0CMPluginBase@@IAE@PBD@Z @513 NONAME
+??0CMPluginBase@@IAE@PAUHINSTANCE__@@PBD@Z @513 NONAME
??1CMPluginBase@@IAE@XZ @514 NONAME
??4CMPluginBase@@QAEAAV0@ABV0@@Z @515 NONAME
?debugLogA@CMPluginBase@@QAAXPBDZZ @516 NONAME
@@ -578,3 +578,4 @@ Clist_GetGeneralizedStatus @600
Proto_GetStatus @601
?getCache@MDatabaseCommon@@QBEPAUMIDatabaseCache@@XZ @602 NONAME
?Compact@MDatabaseCommon@@UAGHXZ @603 NONAME
+?getInst@CMPluginBase@@QBEPAUHINSTANCE__@@XZ @604 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 6e3946adff..d0e558a650 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -487,7 +487,7 @@ GetDatabasePlugin @508
SetServiceModePlugin @510
Proto_CreateAccount @511
Proto_GetAverageStatus @512
-??0CMPluginBase@@IEAA@PEBD@Z @513 NONAME
+??0CMPluginBase@@IEAA@PEAUHINSTANCE__@@PEBD@Z @513 NONAME
??1CMPluginBase@@IEAA@XZ @514 NONAME
??4CMPluginBase@@QEAAAEAV0@AEBV0@@Z @515 NONAME
?debugLogA@CMPluginBase@@QEAAXPEBDZZ @516 NONAME
@@ -578,3 +578,4 @@ Clist_GetGeneralizedStatus @600
Proto_GetStatus @601
?getCache@MDatabaseCommon@@QEBAPEAUMIDatabaseCache@@XZ @602 NONAME
?Compact@MDatabaseCommon@@UEAAHXZ @603 NONAME
+?getInst@CMPluginBase@@QEBAPEAUHINSTANCE__@@XZ @604 NONAME
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp
index 477dbd2083..3384bef71d 100644
--- a/src/mir_app/src/protocols.cpp
+++ b/src/mir_app/src/protocols.cpp
@@ -110,6 +110,7 @@ MIR_APP_DLL(int) Proto_RegisterModule(PROTOCOLDESCRIPTOR *pd)
p->cbSize = pd->cbSize;
p->szName = mir_strdup(pd->szName);
p->type = pd->type;
+ p->hInst = pd->hInst;
if (pd->cbSize == sizeof(PROTOCOLDESCRIPTOR)) {
p->fnInit = pd->fnInit;
p->fnUninit = pd->fnUninit;