}\r
\r
\r
-// command notify\r
-void Engine::commandNotify(\r
- HWND i_hwnd, UINT i_message, WPARAM i_wParam, LPARAM i_lParam) {\r
- Acquire b(&m_log, 0);\r
- HWND hf = m_hwndFocus;\r
- if (!hf)\r
- return;\r
-\r
- if (GetWindowThreadProcessId(hf, NULL) ==\r
- GetWindowThreadProcessId(m_hwndAssocWindow, NULL))\r
- return; // inhibit the investigation of MADO TSUKAI NO YUUTSU\r
-\r
- const _TCHAR *target = NULL;\r
- int number_target = 0;\r
-\r
- if (i_hwnd == hf)\r
- target = _T("ToItself");\r
- else if (i_hwnd == GetParent(hf))\r
- target = _T("ToParentWindow");\r
- else {\r
- // Function::toMainWindow\r
- HWND h = hf;\r
- while (true) {\r
- HWND p = GetParent(h);\r
- if (!p)\r
- break;\r
- h = p;\r
- }\r
- if (i_hwnd == h)\r
- target = _T("ToMainWindow");\r
- else {\r
- // Function::toOverlappedWindow\r
- HWND h = hf;\r
- while (h) {\r
-#ifdef MAYU64\r
- LONG_PTR style = GetWindowLongPtr(h, GWL_STYLE);\r
-#else\r
- LONG style = GetWindowLong(h, GWL_STYLE);\r
-#endif\r
- if ((style & WS_CHILD) == 0)\r
- break;\r
- h = GetParent(h);\r
- }\r
- if (i_hwnd == h)\r
- target = _T("ToOverlappedWindow");\r
- else {\r
- // number\r
- HWND h = hf;\r
- for (number_target = 0; h; number_target ++, h = GetParent(h))\r
- if (i_hwnd == h)\r
- break;\r
- return;\r
- }\r
- }\r
- }\r
-\r
- m_log << _T("&PostMessage(");\r
- if (target)\r
- m_log << target;\r
- else\r
- m_log << number_target;\r
- m_log << _T(", ") << i_message\r
- << _T(", 0x") << std::hex << i_wParam\r
- << _T(", 0x") << i_lParam << _T(") # hwnd = ")\r
- << reinterpret_cast<int>(i_hwnd) << _T(", ")\r
- << _T("message = ") << std::dec;\r
- if (i_message == WM_COMMAND)\r
- m_log << _T("WM_COMMAND, ");\r
- else if (i_message == WM_SYSCOMMAND)\r
- m_log << _T("WM_SYSCOMMAND, ");\r
- else\r
- m_log << i_message << _T(", ");\r
- m_log << _T("wNotifyCode = ") << HIWORD(i_wParam) << _T(", ")\r
- << _T("wID = ") << LOWORD(i_wParam) << _T(", ")\r
- << _T("hwndCtrl = 0x") << std::hex << i_lParam << std::dec << std::endl;\r
-}\r
-\r
unsigned int WINAPI Engine::InputHandler::run(void *i_this)\r
{\r
reinterpret_cast<InputHandler*>(i_this)->run();\r
void getHelpMessages(tstring *o_helpMessage, tstring *o_helpTitle);\r
\r
/// command notify\r
- void commandNotify(HWND i_hwnd, UINT i_message, WPARAM i_wParam,\r
- LPARAM i_lParam);\r
+ template <typename WPARAM_T, typename LPARAM_T>\r
+ void commandNotify(HWND i_hwnd, UINT i_message, WPARAM_T i_wParam,\r
+ LPARAM_T i_lParam)\r
+ {\r
+ Acquire b(&m_log, 0);\r
+ HWND hf = m_hwndFocus;\r
+ if (!hf)\r
+ return;\r
+\r
+ if (GetWindowThreadProcessId(hf, NULL) ==\r
+ GetWindowThreadProcessId(m_hwndAssocWindow, NULL))\r
+ return; // inhibit the investigation of MADO TSUKAI NO YUUTSU\r
+\r
+ const _TCHAR *target = NULL;\r
+ int number_target = 0;\r
+\r
+ if (i_hwnd == hf)\r
+ target = _T("ToItself");\r
+ else if (i_hwnd == GetParent(hf))\r
+ target = _T("ToParentWindow");\r
+ else {\r
+ // Function::toMainWindow\r
+ HWND h = hf;\r
+ while (true) {\r
+ HWND p = GetParent(h);\r
+ if (!p)\r
+ break;\r
+ h = p;\r
+ }\r
+ if (i_hwnd == h)\r
+ target = _T("ToMainWindow");\r
+ else {\r
+ // Function::toOverlappedWindow\r
+ HWND h = hf;\r
+ while (h) {\r
+#ifdef MAYU64\r
+ LONG_PTR style = GetWindowLongPtr(h, GWL_STYLE);\r
+#else\r
+ LONG style = GetWindowLong(h, GWL_STYLE);\r
+#endif\r
+ if ((style & WS_CHILD) == 0)\r
+ break;\r
+ h = GetParent(h);\r
+ }\r
+ if (i_hwnd == h)\r
+ target = _T("ToOverlappedWindow");\r
+ else {\r
+ // number\r
+ HWND h = hf;\r
+ for (number_target = 0; h; number_target ++, h = GetParent(h))\r
+ if (i_hwnd == h)\r
+ break;\r
+ return;\r
+ }\r
+ }\r
+ }\r
+\r
+ m_log << _T("&PostMessage(");\r
+ if (target)\r
+ m_log << target;\r
+ else\r
+ m_log << number_target;\r
+ m_log << _T(", ") << i_message\r
+ << _T(", 0x") << std::hex << i_wParam\r
+ << _T(", 0x") << i_lParam << _T(") # hwnd = ")\r
+ << reinterpret_cast<int>(i_hwnd) << _T(", ")\r
+ << _T("message = ") << std::dec;\r
+ if (i_message == WM_COMMAND)\r
+ m_log << _T("WM_COMMAND, ");\r
+ else if (i_message == WM_SYSCOMMAND)\r
+ m_log << _T("WM_SYSCOMMAND, ");\r
+ else\r
+ m_log << i_message << _T(", ");\r
+ m_log << _T("wNotifyCode = ") << HIWORD(i_wParam) << _T(", ")\r
+ << _T("wID = ") << LOWORD(i_wParam) << _T(", ")\r
+ << _T("hwndCtrl = 0x") << std::hex << i_lParam << std::dec << std::endl;\r
+ }\r
\r
/// get current window class name\r
const tstringi &getCurrentWindowClassName() const {\r
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
Type_lockState, /// NotifyLockState\r
Type_sync, /// Notify\r
Type_threadDetach, /// NotifyThreadDetach\r
- Type_command, /// NotifyThreadDetach\r
+ Type_command64, /// NotifyCommand64\r
+ Type_command32, /// NotifyCommand32\r
Type_show, /// NotifyShow\r
Type_log, /// NotifyLog\r
};\r
\r
\r
///\r
-struct NotifyCommand : public Notify {\r
+struct NotifyCommand32 : public Notify {\r
HWND m_hwnd; ///\r
UINT m_message; ///\r
- WPARAM m_wParam; ///\r
- LPARAM m_lParam; ///\r
+ unsigned int m_wParam; ///\r
+ long m_lParam; ///\r
+};\r
+\r
+\r
+///\r
+struct NotifyCommand64 : public Notify {\r
+ HWND m_hwnd; ///\r
+ UINT m_message; ///\r
+ unsigned __int64 m_wParam; ///\r
+ __int64 m_lParam; ///\r
};\r
\r
\r
break;\r
}\r
\r
- case Notify::Type_command: {\r
- NotifyCommand *n = (NotifyCommand *)cd->lpData;\r
+ case Notify::Type_command64: {\r
+ NotifyCommand64 *n = (NotifyCommand64 *)cd->lpData;\r
+ m_engine.commandNotify(n->m_hwnd, n->m_message,\r
+ n->m_wParam, n->m_lParam);\r
+ break;\r
+ }\r
+\r
+ case Notify::Type_command32: {\r
+ NotifyCommand32 *n = (NotifyCommand32 *)cd->lpData;\r
m_engine.commandNotify(n->m_hwnd, n->m_message,\r
n->m_wParam, n->m_lParam);\r
break;\r