From a7eef3943d842af99e53d240f321b1467df7ea21 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 29 Mar 2018 11:35:36 +0300 Subject: CMPlugin doesn't work in ICQCorp because of the clutch with dll name --- protocols/ICQCorp/src/corp.cpp | 44 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/protocols/ICQCorp/src/corp.cpp b/protocols/ICQCorp/src/corp.cpp index 2ea3819966..de702c3217 100644 --- a/protocols/ICQCorp/src/corp.cpp +++ b/protocols/ICQCorp/src/corp.cpp @@ -37,13 +37,34 @@ PLUGININFOEX pluginInfo = UNICODE_AWARE }; +////////////////////////////////////////////////////////////////////////// +// Interface information + +extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST }; + /////////////////////////////////////////////////////////////////////////////// BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD reason, LPVOID) { hInstance = hModule; - if (reason == DLL_PROCESS_ATTACH) + if (reason == DLL_PROCESS_ATTACH) { + char fileName[MAX_PATH]; + GetModuleFileNameA(hInstance, fileName, MAX_PATH); + + WIN32_FIND_DATAA findData; + FindClose(FindFirstFileA(fileName, &findData)); + findData.cFileName[strlen(findData.cFileName) - 4] = 0; + strncpy_s(protoName, findData.cFileName, _TRUNCATE); + + PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE }; + pd.szName = protoName; + pd.type = PROTOTYPE_PROTOCOL; + Proto_RegisterModule(&pd); + + Proto_SetUniqueId(protoName, "UIN"); + DisableThreadLibraryCalls(hModule); + } return TRUE; } @@ -72,27 +93,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) return &pluginInfo; } -///////////////////////////////////////////////////////////////////////////////////////// - -struct CMPlugin : public CMPluginBase -{ - CMPlugin() : - CMPluginBase(protoName) - { - char fileName[MAX_PATH]; - GetModuleFileNameA(hInstance, fileName, MAX_PATH); - - WIN32_FIND_DATAA findData; - FindClose(FindFirstFileA(fileName, &findData)); - findData.cFileName[strlen(findData.cFileName) - 4] = 0; - strncpy_s(protoName, findData.cFileName, _TRUNCATE); - - RegisterProtocol(PROTOTYPE_PROTOCOL); - SetUniqueId("UIN"); - } -} - g_plugin; - /////////////////////////////////////////////////////////////////////////////// #ifdef _DEBUG -- cgit v1.2.3