diff options
-rw-r--r-- | include/m_system.h | 2 | ||||
-rw-r--r-- | libs/win32/mir_app.lib | bin | 173338 -> 173102 bytes | |||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 168414 -> 168200 bytes | |||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/miranda.cpp | 28 |
6 files changed, 29 insertions, 3 deletions
diff --git a/include/m_system.h b/include/m_system.h index cc3be9a6bf..fb06e5547c 100644 --- a/include/m_system.h +++ b/include/m_system.h @@ -92,8 +92,10 @@ EXTERN_C MIR_APP_DLL(void) Miranda_GetVersionText(char *pDest, size_t cbSize); // Adds an event to the list to be checked in the main message loop
// when a handle gets triggered, an appopriate stub gets called
typedef void (CALLBACK *MWaitableStub)(void);
+typedef void (CALLBACK *MWaitableStubEx)(void*);
EXTERN_C MIR_APP_DLL(void) Miranda_WaitOnHandle(MWaitableStub pFunc, HANDLE hEvent = nullptr);
+EXTERN_C MIR_APP_DLL(void) Miranda_WaitOnHandleEx(MWaitableStubEx pFunc, void *pInfo);
// wParam = 0 (ignored)
// lParam = 0 (ignored)
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 1c9d529885..4599d4306e 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex 64bd2e8693..3cb917428d 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 2e182da0aa..656bdab2ff 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -629,3 +629,4 @@ Netlib_SetUserSettingsByName @659 ?Backup@MDatabaseCommon@@UAGHPB_W@Z @660 NONAME
?addFrame@CMPluginBase@@QAEHPBUCLISTFrame@@@Z @661 NONAME
Menu_SetVisible @662
+Miranda_WaitOnHandleEx @663
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 4bfa9b9ce9..2a08500a71 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -629,3 +629,4 @@ Netlib_SetUserSettingsByName @659 ?Backup@MDatabaseCommon@@UEAAHPEB_W@Z @660 NONAME
?addFrame@CMPluginBase@@QEAAHPEBUCLISTFrame@@@Z @661 NONAME
Menu_SetVisible @662
+Miranda_WaitOnHandleEx @663
diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp index 29ca6bba52..cc7097eb4d 100644 --- a/src/mir_app/src/miranda.cpp +++ b/src/mir_app/src/miranda.cpp @@ -81,7 +81,8 @@ struct MWaitableObject MWaitableObject(MWaitableStub pFunc, HANDLE hEvent) :
m_bOwnsEvent(false),
m_hEvent(hEvent),
- m_pFunc(pFunc)
+ m_pFunc(pFunc),
+ m_pInfo(INVALID_HANDLE_VALUE)
{
if (hEvent == nullptr) {
m_hEvent = CreateEvent(nullptr, TRUE, TRUE, nullptr);
@@ -89,6 +90,13 @@ struct MWaitableObject }
}
+ MWaitableObject(MWaitableStubEx pFunc, void *pInfo) :
+ m_bOwnsEvent(true),
+ m_hEvent(CreateEvent(nullptr, TRUE, TRUE, nullptr)),
+ m_pFuncEx(pFunc),
+ m_pInfo(pInfo)
+ {}
+
~MWaitableObject()
{
if (m_bOwnsEvent)
@@ -96,7 +104,12 @@ struct MWaitableObject }
HANDLE m_hEvent;
- MWaitableStub m_pFunc;
+ union {
+ MWaitableStub m_pFunc;
+ MWaitableStubEx m_pFuncEx;
+ };
+ void *m_pInfo;
+
bool m_bOwnsEvent;
};
@@ -107,6 +120,11 @@ MIR_APP_DLL(void) Miranda_WaitOnHandle(MWaitableStub pFunc, HANDLE hEvent) arWaitableObjects.insert(new MWaitableObject(pFunc, hEvent));
}
+MIR_APP_DLL(void) Miranda_WaitOnHandleEx(MWaitableStubEx pFunc, void *pInfo)
+{
+ arWaitableObjects.insert(new MWaitableObject(pFunc, pInfo));
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// dll entry point
@@ -337,7 +355,11 @@ int WINAPI mir_main(LPTSTR cmdLine) DWORD rc = myWait();
if (rc < WAIT_OBJECT_0 + arWaitableObjects.getCount()) {
auto &pWait = arWaitableObjects[rc - WAIT_OBJECT_0];
- (*pWait.m_pFunc)();
+ if (pWait.m_pInfo == INVALID_HANDLE_VALUE)
+ (*pWait.m_pFunc)();
+ else
+ (*pWait.m_pFuncEx)(pWait.m_pInfo);
+
if (pWait.m_bOwnsEvent)
arWaitableObjects.remove(&pWait);
}
|