diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-23 16:11:59 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-23 16:11:59 +0300 |
commit | a7d5cce8e2cea97d52a35a1769d0e87e84e5502a (patch) | |
tree | 328aa85baa74ea929faa4c09b5e4c49b0cada896 /plugins/CrashDumper/src | |
parent | 7249e4f451c89d778ce0f211eb0730e6fa3adc04 (diff) |
we don't need MirandaPluginInfoEx() anymore. farewell, my lovely
Diffstat (limited to 'plugins/CrashDumper/src')
-rw-r--r-- | plugins/CrashDumper/src/crshdmp.cpp | 7 | ||||
-rw-r--r-- | plugins/CrashDumper/src/dumper.cpp | 25 | ||||
-rw-r--r-- | plugins/CrashDumper/src/stdafx.h | 3 | ||||
-rw-r--r-- | plugins/CrashDumper/src/utils.cpp | 11 |
4 files changed, 6 insertions, 40 deletions
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index d17f6d5c19..effb082fc8 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. CMPlugin g_plugin;
-DWORD mirandaVersion;
LCID packlcid;
//HANDLE hCrashLogFolder, hVerInfoFolder;
HANDLE hVerInfoFolder;
@@ -55,12 +54,6 @@ CMPlugin::CMPlugin() : PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
{}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirVersion)
-{
- ::mirandaVersion = mirVersion;
- return (PLUGININFOEX*)&pluginInfoEx;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// MirandaInterfaces - returns the protocol interface to the core
diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 41af5b4721..498a5026e1 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -125,27 +125,6 @@ void GetLinkedModulesInfo(wchar_t *moduleName, CMStringW &buffer) importData++; //go to next record
}
}
-
- bool found = false;
- PIMAGE_EXPORT_DIRECTORY exportData = (PIMAGE_EXPORT_DIRECTORY)ImageDirectoryEntryToData(dllAddr, FALSE,
- IMAGE_DIRECTORY_ENTRY_EXPORT, &tableSize);
- if (exportData) {
- ULONG *funcAddr = (ULONG*)ImageRvaToVa(nthdrs, dllAddr, exportData->AddressOfNames, nullptr);
- for (unsigned i = 0; i < exportData->NumberOfNames; ++i) {
- char *funcName = (char*)ImageRvaToVa(nthdrs, dllAddr, funcAddr[i], nullptr);
- if (mir_strcmp(funcName, "DatabasePluginInfo") == 0) {
- buffer.Append(L" This dll is a Miranda database plugin, another database is active right now\r\n");
- found = true;
- break;
- }
- else if (mir_strcmp(funcName, "MirandaPluginInfoEx") == 0) {
- found = true;
- break;
- }
- }
- }
- if (!found)
- buffer.Append(L" This dll is not a Miranda plugin and should be removed from plugins directory\r\n");
}
__except (EXCEPTION_EXECUTE_HANDLER) {}
@@ -208,7 +187,7 @@ static void GetPluginsString(CMStringW &buffer, unsigned &flags) continue;
}
- PLUGININFOEX *pi = GetMirInfo(hModule);
+ const PLUGININFOEX *pi = GetMirInfo(hModule);
if (pi != nullptr) {
wchar_t timebuf[30] = L"";
GetLastWriteTime(&FindFileData.ftLastWriteTime, timebuf, 30);
@@ -603,7 +582,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wcha if (crashpos != 0) {
HMODULE hModule = (HMODULE)Module.BaseOfImage;
- PLUGININFOEX *pi = GetMirInfo(hModule);
+ const PLUGININFOEX *pi = GetMirInfo(hModule);
if (pi != nullptr) {
if (pi->shortName) {
CMStringW crashcause;
diff --git a/plugins/CrashDumper/src/stdafx.h b/plugins/CrashDumper/src/stdafx.h index 5abffe7fb9..7b1bd36867 100644 --- a/plugins/CrashDumper/src/stdafx.h +++ b/plugins/CrashDumper/src/stdafx.h @@ -94,7 +94,6 @@ struct VerTrnsfr bool autot;
};
-extern DWORD mirandaVersion;
extern LCID packlcid;
extern bool servicemode, clsdates, dtsubfldr, catchcrashes, needrestart;
@@ -128,7 +127,7 @@ void StoreStringToClip(CMStringW& buffer); void ShowMessage(int type, const wchar_t* format, ...);
bool IsPluginEnabled(wchar_t* filename);
-PLUGININFOEX* GetMirInfo(HMODULE hModule);
+const PLUGININFOEX* GetMirInfo(HMODULE hModule);
void CreateMiniDump(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr);
void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wchar_t* msg);
diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index b86fa072f6..9d0bb2cbd4 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -89,15 +89,10 @@ void GetLastWriteTime(LPCTSTR fileName, LPTSTR lpszString, DWORD dwSize) GetLastWriteTime(&FindFileData.ftLastWriteTime, lpszString, dwSize);
}
-typedef PLUGININFOEX * (__cdecl * Miranda_Plugin_Info) (DWORD mirandaVersion);
-
-PLUGININFOEX* GetMirInfo(HMODULE hModule)
+const PLUGININFOEX* GetMirInfo(HMODULE hModule)
{
- Miranda_Plugin_Info bpi = (Miranda_Plugin_Info)GetProcAddress(hModule, "MirandaPluginInfoEx");
- if (bpi == nullptr)
- return nullptr;
-
- return bpi(mirandaVersion);
+ CMPluginBase &pPlugin = GetPluginByInstance(hModule);
+ return (pPlugin.getInst() == hModule) ? &pPlugin.getInfo() : nullptr;
}
void GetInternetExplorerVersion(CMStringW &buffer)
|