summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-09-21 12:40:53 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-09-21 12:40:53 +0000
commit4ba2fd611622ac3cd8680ed48d3fb3412bea282a (patch)
treea84cb00dd37494a1f2538233cae071eff679b1d8
parent27f193cad956ff5238a6abbe2bed797b971a9ffa (diff)
how not to load CrashDumper twice
fixes ticket:39 git-svn-id: http://svn.miranda-ng.org/main/trunk@1621 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/CrashDumper/src/exhndlr.cpp6
-rw-r--r--src/modules/plugins/newplugins.cpp42
2 files changed, 26 insertions, 22 deletions
diff --git a/plugins/CrashDumper/src/exhndlr.cpp b/plugins/CrashDumper/src/exhndlr.cpp
index 93406efaa8..45b87f1a54 100644
--- a/plugins/CrashDumper/src/exhndlr.cpp
+++ b/plugins/CrashDumper/src/exhndlr.cpp
@@ -13,9 +13,9 @@ tRtlCaptureContext pRtlCaptureContext = (tRtlCaptureContext)GetProcAddress(hKern
void SetExceptionHandler(void)
{
- // if (pAddVectoredExceptionHandler && !exchndlrv)
- // exchndlrv = pAddVectoredExceptionHandler(0, myfilterv);
- /*exchndlr = */ SetUnhandledExceptionFilter(myfilter);
+ if (pAddVectoredExceptionHandler && !exchndlrv)
+ exchndlrv = pAddVectoredExceptionHandler(0, myfilterv);
+ exchndlr = SetUnhandledExceptionFilter(myfilter);
}
void RemoveExceptionHandler(void)
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp
index 74b1e00830..6a7dafcf0b 100644
--- a/src/modules/plugins/newplugins.cpp
+++ b/src/modules/plugins/newplugins.cpp
@@ -319,15 +319,18 @@ void Plugin_Uninit(pluginEntry* p)
p->bpi.Unload();
// release the library
- if (p->bpi.hInst != NULL) {
+ HINSTANCE hInst = p->bpi.hInst;
+ if (hInst != NULL) {
// we need to kill all resources which belong to that DLL before calling FreeLibrary
- KillModuleEventHooks(p->bpi.hInst);
- KillModuleServices(p->bpi.hInst);
+ KillModuleEventHooks(hInst);
+ KillModuleServices(hInst);
- FreeLibrary(p->bpi.hInst);
+ FreeLibrary(hInst);
ZeroMemory(&p->bpi, sizeof(p->bpi));
}
- UnregisterModule(p->bpi.hInst);
+ UnregisterModule(hInst);
+ if (p == pluginList_crshdmp)
+ pluginList_crshdmp = NULL;
pluginList.remove(p);
}
@@ -500,18 +503,20 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic)
if ( !bDynamic && !isPluginOnWhiteList(p->pluginname))
return false;
- BASIC_PLUGIN_INFO bpi;
- mir_sntprintf(slice, &exe[SIZEOF(exe)] - slice, _T("\\%s\\%s"), (p->pclass & PCLASS_CORE) ? _T("Core") : _T("Plugins"), p->pluginname);
- if ( !checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_NONE)) {
- p->pclass |= PCLASS_FAILED;
- return false;
- }
+ if ( !(p->pclass & PCLASS_BASICAPI)) {
+ BASIC_PLUGIN_INFO bpi;
+ mir_sntprintf(slice, &exe[SIZEOF(exe)] - slice, _T("\\%s\\%s"), (p->pclass & PCLASS_CORE) ? _T("Core") : _T("Plugins"), p->pluginname);
+ if ( !checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_NONE)) {
+ p->pclass |= PCLASS_FAILED;
+ return false;
+ }
- p->bpi = bpi;
- p->pclass |= PCLASS_OK | PCLASS_BASICAPI;
+ p->bpi = bpi;
+ p->pclass |= PCLASS_OK | PCLASS_BASICAPI;
+ }
if (p->bpi.Interfaces) {
- MUUID *piface = bpi.Interfaces;
+ MUUID *piface = p->bpi.Interfaces;
for (int i=0; !equalUUID(miid_last, piface[i]); i++) {
int idx = getDefaultPluginIdx( piface[i] );
if (idx != -1 && pluginDefault[idx].pImpl) {
@@ -527,12 +532,12 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic)
} } } }
RegisterModule(p->bpi.hInst);
- if (bpi.Load() != 0)
+ if (p->bpi.Load() != 0)
return false;
p->pclass |= PCLASS_LOADED;
if (p->bpi.Interfaces) {
- MUUID *piface = bpi.Interfaces;
+ MUUID *piface = p->bpi.Interfaces;
for (int i=0; !equalUUID(miid_last, piface[i]); i++) {
int idx = getDefaultPluginIdx( piface[i] );
if (idx != -1)
@@ -742,10 +747,9 @@ int LoadNewPluginsModule(void)
askAboutIgnoredPlugins = (UINT) GetPrivateProfileInt(_T("PluginLoader"), _T("AskAboutIgnoredPlugins"), 0, mirandabootini);
// if Crash Dumper is present, load it to provide Crash Reports
- if (pluginList_crshdmp != NULL && isPluginOnWhiteList(pluginList_crshdmp->pluginname)) {
+ if (pluginList_crshdmp != NULL && isPluginOnWhiteList(pluginList_crshdmp->pluginname))
if ( !TryLoadPlugin(pluginList_crshdmp, false))
Plugin_Uninit(pluginList_crshdmp);
- }
// if freeimage is present, load it to provide the basic core functions
if (pluginList_freeimg != NULL) {
@@ -803,7 +807,7 @@ static BOOL scanPluginsDir(WIN32_FIND_DATA *fd, TCHAR *path, WPARAM, LPARAM)
if (pluginList_freeimg == NULL && lstrcmpi(fd->cFileName, _T("advaimg.dll")) == 0)
pluginList_freeimg = p;
- if (pluginList_crshdmp == NULL && lstrcmpi(fd->cFileName, _T("svc_crshdmp.dll")) == 0) {
+ if (pluginList_crshdmp == NULL && lstrcmpi(fd->cFileName, _T("crashdumper.dll")) == 0) {
pluginList_crshdmp = p;
p->pclass |= PCLASS_LAST;
}