OSDN Git Service

use boost_1_56_0 and build by VS2013
[yamy/yamy.git] / hook.cpp
index 5e69394..98b585d 100644 (file)
--- a/hook.cpp
+++ b/hook.cpp
@@ -100,6 +100,7 @@ static void notifyLog(_TCHAR *i_msg);
 static bool mapHookData(bool i_isYamy);\r
 static void unmapHookData();\r
 static bool initialize(bool i_isYamy);\r
+static bool notify(void *i_data, size_t i_dataSize);\r
 \r
 \r
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
@@ -160,6 +161,12 @@ bool initialize(bool i_isYamy)
        g.m_WM_MAYU_MESSAGE =\r
                RegisterWindowMessage(addSessionId(WM_MAYU_MESSAGE_NAME).c_str());\r
        g.m_hwndTaskTray = g_hookData->m_hwndTaskTray;\r
+       if (!i_isYamy) {\r
+               NotifyThreadAttach ntd;\r
+               ntd.m_type = Notify::Type_threadAttach;\r
+               ntd.m_threadId = GetCurrentThreadId();\r
+               notify(&ntd, sizeof(ntd));\r
+       }\r
        g.m_isInitialized = true;\r
        return true;\r
 }\r
@@ -252,7 +259,7 @@ static void unmapHookData()
 \r
 \r
 /// notify\r
-DllExport bool notify(void *i_data, size_t i_dataSize)\r
+bool notify(void *i_data, size_t i_dataSize)\r
 {\r
        COPYDATASTRUCT cd;\r
 #ifdef MAYU64\r
@@ -427,17 +434,20 @@ static void notifyThreadDetach()
 static void notifyCommand(\r
        HWND i_hwnd, UINT i_message, WPARAM i_wParam, LPARAM i_lParam)\r
 {\r
-#ifndef _WIN64\r
        if (g_hookData->m_doesNotifyCommand) {\r
-               NotifyCommand ntc;\r
-               ntc.m_type = Notify::Type_command;\r
+#ifdef _WIN64\r
+               NotifyCommand64 ntc;\r
+               ntc.m_type = Notify::Type_command64;\r
+#else // !_WIN64\r
+               NotifyCommand32 ntc;\r
+               ntc.m_type = Notify::Type_command32;\r
+#endif // !_WIN64\r
                ntc.m_hwnd = i_hwnd;\r
                ntc.m_message = i_message;\r
                ntc.m_wParam = i_wParam;\r
                ntc.m_lParam = i_lParam;\r
                notify(&ntc, sizeof(ntc));\r
        }\r
-#endif\r
 }\r
 \r
 \r