summaryrefslogtreecommitdiff
path: root/plugins/StatusPlugins/AdvancedAutoAway/main.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-18 14:45:04 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-18 14:45:04 +0000
commita3385262c10d49a477e1e071a44ebdfd8e4b7d24 (patch)
tree5f5bdfc4b4cefd0cd71ce692e9ffa83d1b26b816 /plugins/StatusPlugins/AdvancedAutoAway/main.cpp
parent0da1d99c8ecda784b14ade348897096dc43a65b4 (diff)
fix: AAA crashes another programs when global hooks are active
git-svn-id: http://svn.miranda-ng.org/main/trunk@2355 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StatusPlugins/AdvancedAutoAway/main.cpp')
-rw-r--r--plugins/StatusPlugins/AdvancedAutoAway/main.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/main.cpp b/plugins/StatusPlugins/AdvancedAutoAway/main.cpp
index f640369607..4cd6e31f4d 100644
--- a/plugins/StatusPlugins/AdvancedAutoAway/main.cpp
+++ b/plugins/StatusPlugins/AdvancedAutoAway/main.cpp
@@ -27,9 +27,7 @@
// {F0FDF73A-753D-499d-8DBA-336DB79CDD41}
#define MIID_ADVAUTOAWAY { 0xf0fdf73a, 0x753d, 0x499d, { 0x8d, 0xba, 0x33, 0x6d, 0xb7, 0x9c, 0xdd, 0x41 } }
-HINSTANCE hInst;
-
-
+HINSTANCE hInst, hCore = NULL;
HANDLE hCSModuleLoadedHook;
HANDLE hStateChangedEvent;
@@ -42,7 +40,10 @@ int CSModuleLoaded(WPARAM wParam, LPARAM lParam);
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
- hInst = hinstDLL;
+ if (fdwReason == DLL_PROCESS_ATTACH) {
+ hInst = hinstDLL;
+ hCore = GetModuleHandleA("mir_core.dll");
+ }
return TRUE;
}
@@ -72,9 +73,10 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
extern "C" __declspec(dllexport) int Load(void)
{
-
mir_getLP( &pluginInfoEx );
+ autoAwaySettings = new OBJLIST<TAAAProtoSetting>(10, CompareSettings);
+
InitCommonStatus();
hCSModuleLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, CSModuleLoaded);
hStateChangedEvent = CreateHookableEvent(ME_AAA_STATECHANGED);
@@ -87,5 +89,6 @@ extern "C" __declspec(dllexport) int Load(void)
extern "C" __declspec(dllexport) int Unload(void)
{
DestroyHookableEvent( hStateChangedEvent );
+ delete autoAwaySettings;
return 0;
}