diff options
-rw-r--r-- | plugins/Clist_blind/src/init.cpp | 10 | ||||
-rw-r--r-- | plugins/Clist_modern/src/init.cpp | 15 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/init.cpp | 10 | ||||
-rw-r--r-- | src/core/stdclist/src/init.cpp | 10 | ||||
-rw-r--r-- | src/mir_app/src/newplugins.cpp | 30 | ||||
-rw-r--r-- | src/mir_app/src/plugins.h | 10 |
6 files changed, 15 insertions, 70 deletions
diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index cb83fe7179..69d8883d96 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -115,7 +115,7 @@ static INT_PTR GetStatusMode(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
// main clist initialization routine
-extern "C" int __declspec(dllexport) CListInitialise()
+int CMPlugin::Load()
{
g_bSortByStatus = db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT);
g_bSortByProto = db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT);
@@ -146,14 +146,6 @@ extern "C" int __declspec(dllexport) CListInitialise() }
/////////////////////////////////////////////////////////////////////////////////////////
-// a plugin loader aware of CList exports will never call this.
-
-int CMPlugin::Load()
-{
- return 1;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
wchar_t* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char* setting, wchar_t* out, size_t len, wchar_t *def)
{
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index 34282b8c25..8969f7ed31 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -67,7 +67,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_CLIST, /////////////////////////////////////////////////////////////////////////////////////////
-extern "C" __declspec(dllexport) int CListInitialise()
+int CMPlugin::Load(void)
{
g_dwMainThreadID = GetCurrentThreadId();
g_hMirApp = GetModuleHandleA("mir_app.mir");
@@ -81,18 +81,7 @@ extern "C" __declspec(dllexport) int CListInitialise() CHECKRES(ClcLoadModule());
CHECKRES(ToolbarButtonLoadModule());
CHECKRES(ToolbarLoadModule());
-
- TRACE("CListInitialise Modern Contact List ... Done\r\n");
-
- return S_OK;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// never called by a newer plugin loader.
-
-int CMPlugin::Load(void)
-{
- return 1;
+ return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index d4132cf8a7..4bf1266d31 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -107,7 +107,7 @@ static int systemModulesLoaded(WPARAM, LPARAM) return 0;
}
-extern "C" int __declspec(dllexport) CListInitialise()
+int CMPlugin::Load()
{
Clist_GetInterface();
coreCli = g_clistApi;
@@ -219,14 +219,6 @@ extern "C" int __declspec(dllexport) CListInitialise() }
/////////////////////////////////////////////////////////////////////////////////////////
-// a plugin loader aware of CList exports will never call this.
-
-int CMPlugin::Load()
-{
- return 1;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
int CMPlugin::Unload()
{
diff --git a/src/core/stdclist/src/init.cpp b/src/core/stdclist/src/init.cpp index 046273e99d..ce90b6e13d 100644 --- a/src/core/stdclist/src/init.cpp +++ b/src/core/stdclist/src/init.cpp @@ -105,7 +105,7 @@ static INT_PTR GetStatusMode(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
// main clist initialization routine
-extern "C" __declspec(dllexport) int CListInitialise()
+int CMPlugin::Load()
{
g_bSortByStatus = db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT);
g_bSortByProto = db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT);
@@ -126,11 +126,3 @@ extern "C" __declspec(dllexport) int CListInitialise() InitCustomMenus();
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// a plugin loader aware of CList exports will never call this.
-
-int CMPlugin::Load()
-{
- return 1;
-}
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index 4d6c27c146..f7f8b5814d 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -176,7 +176,7 @@ static bool validInterfaceList(const MUUID *piface) return true;
}
-bool pluginEntry::checkAPI(wchar_t *plugin, int checkTypeAPI)
+bool pluginEntry::checkAPI(wchar_t *plugin)
{
SetErrorMode(SEM_FAILCRITICALERRORS); // disable error messages
HINSTANCE h = LoadLibrary(plugin);
@@ -222,20 +222,8 @@ LBL_Error: goto LBL_Error;
// basic API is present
- if (checkTypeAPI == CHECKAPI_NONE) {
- bHasBasicApi = true;
- return true;
- }
-
- // check clist?
- if (checkTypeAPI == CHECKAPI_CLIST) {
- m_pClistlink = (CList_Initialise)GetProcAddress(h, "CListInitialise");
- if ((pInfo.flags & UNICODE_AWARE) && m_pClistlink) {
- bHasBasicApi = true;
- return true;
- }
- }
- goto LBL_Error;
+ bHasBasicApi = true;
+ return true;
}
// perform any API related tasks to freeing
@@ -368,7 +356,7 @@ pluginEntry* OpenPlugin(wchar_t *tszFileName, wchar_t *dir, wchar_t *path) // plugin declared that it's a database or a cryptor. load it asap!
bool bIsDb = hasMuuid(pIds, MIID_DATABASE);
if (bIsDb || hasMuuid(pIds, MIID_CRYPTO)) {
- if (p->checkAPI(tszFullPath, CHECKAPI_NONE)) {
+ if (p->checkAPI(tszFullPath)) {
// plugin is valid
p->bIsLast = true;
if (bIsDb)
@@ -396,7 +384,7 @@ pluginEntry* OpenPlugin(wchar_t *tszFileName, wchar_t *dir, wchar_t *path) // plugin declared that it's a service mode plugin.
// load it for a profile manager's window
else if (hasMuuid(pIds, MIID_SERVICEMODE)) {
- if (p->checkAPI(tszFullPath, CHECKAPI_NONE)) {
+ if (p->checkAPI(tszFullPath)) {
if (hasMuuid(pIds, MIID_SERVICEMODE)) {
p->bIsService = true;
servicePlugins.insert(p);
@@ -449,7 +437,7 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) *slice = 0;
mir_snwprintf(tszFullPath, L"%s\\%s\\%s", exe, (p->bIsCore) ? L"Core" : L"Plugins", p->pluginname);
- if (!p->checkAPI(tszFullPath, CHECKAPI_NONE))
+ if (!p->checkAPI(tszFullPath))
return false;
}
@@ -536,7 +524,7 @@ static bool loadClistModule(wchar_t *exe, pluginEntry *p) {
g_bReadyToInitClist = true;
- if (p->checkAPI(exe, CHECKAPI_CLIST)) {
+ if (p->checkAPI(exe)) {
p->bIsLast = true;
hCListImages = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 13, 0);
@@ -550,7 +538,7 @@ static bool loadClistModule(wchar_t *exe, pluginEntry *p) ImageList_AddIcon_IconLibLoaded(hCListImages, SKINICON_OTHER_GROUPOPEN);
ImageList_AddIcon_IconLibLoaded(hCListImages, SKINICON_OTHER_GROUPSHUT);
- if (p->m_pClistlink() == 0) {
+ if (p->load() == 0) {
p->bLoaded = true;
pluginDefault[0].pImpl = p;
@@ -687,7 +675,7 @@ int LoadProtocolPlugins(void) wchar_t tszFullPath[MAX_PATH];
mir_snwprintf(tszFullPath, L"%s\\%s\\%s", exe, L"Plugins", p->pluginname);
- p->checkAPI(tszFullPath, CHECKAPI_NONE);
+ p->checkAPI(tszFullPath);
}
return 0;
diff --git a/src/mir_app/src/plugins.h b/src/mir_app/src/plugins.h index 143ee44de5..b88005f8df 100644 --- a/src/mir_app/src/plugins.h +++ b/src/mir_app/src/plugins.h @@ -1,9 +1,5 @@ #pragma once
-// returns true if the API exports were good, otherwise, passed in data is returned
-#define CHECKAPI_NONE 0
-#define CHECKAPI_CLIST 1
-
// block these plugins
#define DEFMOD_REMOVED_UIPLUGINOPTS 21
#define DEFMOD_REMOVED_PROTOCOLNETLIB 22
@@ -12,9 +8,6 @@ typedef int(__cdecl *Miranda_Plugin_Load) (void);
typedef int(__cdecl *Miranda_Plugin_Unload) (void);
-// prototype for clists
-typedef int(__cdecl *CList_Initialise) (void);
-
struct pluginEntry
{
wchar_t pluginname[64];
@@ -48,9 +41,8 @@ struct pluginEntry MUUID* m_pInterfaces; // array of supported interfaces or NULL
CMPluginBase* m_pPlugin; // pointer to a plugin's instance
- CList_Initialise m_pClistlink; // link to a clist plugin
- bool checkAPI(wchar_t *plugin, int checkTypeAPI);
+ bool checkAPI(wchar_t *plugin);
int load()
{ return (pfnLoad == nullptr) ? m_pPlugin->Load() : pfnLoad();
|