summaryrefslogtreecommitdiff
path: root/plugins/StatusPlugins/commonstatus.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-07-29 16:41:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-07-29 16:41:17 +0000
commit451c98173d83ee1618d7923890e803dd7067de40 (patch)
treeb747494401925ec184b45a6d22d24683d8b3e38f /plugins/StatusPlugins/commonstatus.cpp
parent82637f50c80f6b9b7dad3d3d49535bab277596aa (diff)
resource clearance moved to ME_SYSTEM_PRESHUTDOWN instead of ME_SYSTEM_OKTOEXIT
git-svn-id: http://svn.miranda-ng.org/main/trunk@5527 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StatusPlugins/commonstatus.cpp')
-rw-r--r--plugins/StatusPlugins/commonstatus.cpp40
1 files changed, 14 insertions, 26 deletions
diff --git a/plugins/StatusPlugins/commonstatus.cpp b/plugins/StatusPlugins/commonstatus.cpp
index 11b0699bbd..fdc9ddb6e6 100644
--- a/plugins/StatusPlugins/commonstatus.cpp
+++ b/plugins/StatusPlugins/commonstatus.cpp
@@ -21,11 +21,7 @@
#include "commonstatus.h"
// handles for hooks and other Miranda thingies
-static HANDLE hShutdownHook;
-static HANDLE hCSSetStatusExService;
-static HANDLE hCSShowConfirmDlgExService;
static HANDLE hCSStatusChangedExEvent;
-static HANDLE hCSGetProtoCountService;
OBJLIST<PROTOCOLSETTINGEX>* protoList;
@@ -34,10 +30,8 @@ char *StatusModeToDbSetting(int status,const char *suffix);
DWORD StatusModeToProtoFlag(int status);
INT_PTR SetStatusEx(WPARAM wParam, LPARAM lParam);
int InitCommonStatus();
-static int ModulesLoaded(WPARAM wParam, LPARAM lParam);
-static int CreateServices();
int GetProtoCount();
-static int Exit(WPARAM wParam, LPARAM lParam);
+
// extern
extern INT_PTR ShowConfirmDialogEx(WPARAM wParam, LPARAM lParam);
@@ -337,35 +331,29 @@ int GetProtoCount()
return pCount;
}
-int InitCommonStatus()
-{
- if (!CreateServices())
- hShutdownHook = HookEvent(ME_SYSTEM_OKTOEXIT, Exit);
-
- return 0;
-}
-
static int CreateServices()
{
if (ServiceExists(MS_CS_SETSTATUSEX))
return -1;
- hCSSetStatusExService = CreateServiceFunction(MS_CS_SETSTATUSEX, SetStatusEx);
- hCSShowConfirmDlgExService = CreateServiceFunction(MS_CS_SHOWCONFIRMDLGEX, ShowConfirmDialogEx);
hCSStatusChangedExEvent = CreateHookableEvent(ME_CS_STATUSCHANGEEX);
- hCSGetProtoCountService = CreateServiceFunction(MS_CS_GETPROTOCOUNT, GetProtocolCountService);
+
+ CreateServiceFunction(MS_CS_SETSTATUSEX, SetStatusEx);
+ CreateServiceFunction(MS_CS_SHOWCONFIRMDLGEX, ShowConfirmDialogEx);
+ CreateServiceFunction(MS_CS_GETPROTOCOUNT, GetProtocolCountService);
return 0;
}
-static int Exit(WPARAM wParam, LPARAM lParam) {
+static int onShutdown(WPARAM wParam, LPARAM lParam)
+{
+ DestroyHookableEvent(hCSStatusChangedExEvent);
+ return 0;
+}
- UnhookEvent(hShutdownHook);
- if (hCSSetStatusExService != 0) {
- DestroyHookableEvent(hCSStatusChangedExEvent);
- DestroyServiceFunction(hCSSetStatusExService);
- DestroyServiceFunction(hCSShowConfirmDlgExService);
- DestroyServiceFunction(hCSGetProtoCountService);
- }
+int InitCommonStatus()
+{
+ if (!CreateServices())
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, onShutdown);
return 0;
}