diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-30 07:16:51 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-30 07:16:51 +0000 |
commit | 8db272850a6e89689424eb3058e833511ee64232 (patch) | |
tree | 4c094008f8f1ac93e07cf10fb6747e78dce89ff7 | |
parent | 8df61eefd63a9816aa25e3b567a82e74f5acc3d0 (diff) |
service plugin's launcher in Profile Manager always launches DbChecker
git-svn-id: http://svn.miranda-ng.org/main/trunk@1270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/DbChecker/src/main.cpp | 4 | ||||
-rw-r--r-- | src/modules/database/profilemanager.cpp | 5 | ||||
-rw-r--r-- | src/modules/plugins/newplugins.cpp | 20 |
3 files changed, 20 insertions, 9 deletions
diff --git a/plugins/DbChecker/src/main.cpp b/plugins/DbChecker/src/main.cpp index a36f74f340..dcf8a59075 100644 --- a/plugins/DbChecker/src/main.cpp +++ b/plugins/DbChecker/src/main.cpp @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HINSTANCE hInst;
int hLangpack = 0;
bool bServiceMode, bLaunchMiranda, bShortMode;
+HANDLE hService;
DbToolOptions opts = {0};
@@ -81,11 +82,12 @@ extern "C" __declspec(dllexport) int Load(void) mir_getLP(&pluginInfoEx);
CreateServiceFunction(MS_DB_CHECKPROFILE, CheckProfile);
- CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceMode);
+ hService = CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceMode);
return 0;
}
extern "C" __declspec(dllexport) int Unload(void)
{
+ DestroyServiceFunction(hService);
return 0;
}
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index 3238f14e87..e85b64a578 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "profilemanager.h"
#include <sys/stat.h>
-void EnsureCheckerLoaded(void);
+void EnsureCheckerLoaded(bool);
#define WM_INPUTCHANGED (WM_USER + 0x3000)
#define WM_FOCUSTEXTBOX (WM_USER + 0x3001)
@@ -344,7 +344,7 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam, switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- EnsureCheckerLoaded();
+ EnsureCheckerLoaded(true);
{
dat = (DlgProfData*) lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
@@ -724,6 +724,7 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, break;
case WM_DESTROY:
+ EnsureCheckerLoaded(false); // unload dbchecker
{
LRESULT curSel = SendDlgItemMessage(hwndDlg, IDC_SM_COMBO, CB_GETCURSEL, 0, 0);
if (curSel != CB_ERR) {
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index f583b2aa09..359b2705e3 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -632,18 +632,26 @@ int LoadServiceModePlugin() return (serviceModePlugin == NULL) ? SERVICE_CONTINUE : LaunchServicePlugin(serviceModePlugin);
}
-void EnsureCheckerLoaded(void)
+void EnsureCheckerLoaded(bool bEnable)
{
for (int i=0; i < servicePlugins.getCount(); i++) {
pluginEntry* p = servicePlugins[i];
if ( _tcsicmp(p->pluginname, _T("dbchecker.dll")))
continue;
- if ( !(p->pclass & PCLASS_LOADED)) {
- if (p->bpi.Load() != ERROR_SUCCESS)
- Plugin_Uninit(p);
- else
- p->pclass |= PCLASS_LOADED;
+ if (bEnable) {
+ if ( !(p->pclass & PCLASS_LOADED)) {
+ if (p->bpi.Load() != ERROR_SUCCESS)
+ Plugin_Uninit(p);
+ else
+ p->pclass |= PCLASS_LOADED;
+ }
+ }
+ else {
+ if (p->pclass & PCLASS_LOADED) {
+ p->bpi.Unload();
+ p->pclass &= ~PCLASS_LOADED;
+ }
}
break;
}
|