diff options
-rw-r--r-- | src/mir_core/miranda.cpp | 7 | ||||
-rw-r--r-- | src/mir_core/modules.cpp | 14 |
2 files changed, 7 insertions, 14 deletions
diff --git a/src/mir_core/miranda.cpp b/src/mir_core/miranda.cpp index 856a7394eb..73c5c9d0be 100644 --- a/src/mir_core/miranda.cpp +++ b/src/mir_core/miranda.cpp @@ -40,7 +40,12 @@ DWORD mir_tls = 0; static LRESULT CALLBACK APCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- if (msg == WM_NULL) SleepEx(0, TRUE);
+ if (msg == WM_USER+1) {
+ PAPCFUNC pFunc = (PAPCFUNC)wParam;
+ pFunc((ULONG_PTR)lParam);
+ return 0;
+ }
+
if (msg == WM_TIMECHANGE && RecalculateTime)
RecalculateTime();
return DefWindowProc(hwnd, msg, wParam, lParam);
diff --git a/src/mir_core/modules.cpp b/src/mir_core/modules.cpp index 93913c26e5..0644fb3414 100644 --- a/src/mir_core/modules.cpp +++ b/src/mir_core/modules.cpp @@ -76,9 +76,6 @@ static BOOL bServiceMode = FALSE; static CRITICAL_SECTION csHooks, csServices;
static DWORD mainThreadId;
static int hookId = 1;
-static HANDLE hMainThread;
-static HANDLE hMissingService;
-static THook *pLastHook = NULL;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -94,8 +91,7 @@ __forceinline HANDLE getThreadEvent() static int QueueMainThread(PAPCFUNC pFunc, void* pParam, HANDLE hDoneEvent)
{
- int result = QueueUserAPC(pFunc, hMainThread, (ULONG_PTR)pParam);
- PostMessage(hAPCWindow, WM_NULL, 0, 0); // let this get processed in its own time
+ int result = PostMessage(hAPCWindow, WM_USER+1, (WPARAM)pFunc, (LPARAM)pParam); // let this get processed in its own time
if (hDoneEvent)
WaitForSingleObject(hDoneEvent, INFINITE);
@@ -130,9 +126,6 @@ MIR_CORE_DLL(HANDLE) CreateHookableEvent(const char *name) MIR_CORE_DLL(int) DestroyHookableEvent(HANDLE hEvent)
{
- if (pLastHook == (THook*)hEvent)
- pLastHook = NULL;
-
mir_cslock lck(csHooks);
int idx;
@@ -649,9 +642,6 @@ int InitialiseModularEngine(void) InitializeCriticalSection(&csServices);
mainThreadId = GetCurrentThreadId();
- DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
-
- hMissingService = CreateHookableEvent(ME_SYSTEM_MISSINGSERVICE);
return 0;
}
@@ -666,6 +656,4 @@ void DestroyModularEngine(void) DeleteCriticalSection(&csServices);
pluginListAddr.destroy();
-
- CloseHandle(hMainThread);
}
|