Module: wine
Branch: master
Commit: a676f094f624a4d32e0a0552c462ad9e79ceb876
URL: https://gitlab.winehq.org/wine/wine/-/commit/a676f094f624a4d32e0a0552c462ad…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com>
Date: Thu Dec 14 15:02:37 2023 +0800
win32u: Avoid calling WH_KEYBOARD and WH_CBT HCBT_KEYSKIPPED hooks recursively.
Previously, accept_hardware_message() is called after WH_KEYBOARD and WH_CBT HCBT_KEYSKIPPED hooks.
So when PeekMessage() gets called in WH_KEYBOARD and WH_CBT HCBT_KEYSKIPPED hooks, the hooks will be
called recursively because the message is still in the server message queue.
Fix Toad for Oracle F3 find next function not working properly because its WH_KEYBOARD hook gets
called too many times.
---
dlls/user32/tests/msg.c | 2 --
dlls/win32u/message.c | 6 ++++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 075535141da..b0b2295bb5d 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -12584,7 +12584,6 @@ static void test_recursive_hook(void)
flush_events();
/* Expect the WH_KEYBOARD hook not gets called recursively */
- todo_wine
ok(max_hook_depth == 1, "Got expected %d.\n", max_hook_depth);
/* Test a possible recursive WH_CBT HCBT_KEYSKIPPED hook condition */
@@ -12600,7 +12599,6 @@ static void test_recursive_hook(void)
while (PeekMessageA(&msg, hook_hwnd, WM_KEYFIRST, WM_KEYLAST, 0)) DispatchMessageA(&msg);
/* Expect the WH_CBT HCBT_KEYSKIPPED hook not gets called recursively */
- todo_wine
ok(max_hook_depth == 1, "Got expected %d.\n", max_hook_depth);
UnhookWindowsHookEx(cbt_hook);
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c
index 91f836a60bd..376af30554e 100644
--- a/dlls/win32u/message.c
+++ b/dlls/win32u/message.c
@@ -2384,15 +2384,17 @@ static BOOL process_keyboard_message( MSG *msg, UINT hw_id, HWND hwnd_filter,
}
}
+ /* if remove is TRUE, remove message first before calling hooks to avoid recursive hook calls */
+ if (remove) accept_hardware_message( hw_id );
if (call_hooks( WH_KEYBOARD, remove ? HC_ACTION : HC_NOREMOVE,
LOWORD(msg->wParam), msg->lParam, 0 ))
{
+ /* if the message has not been removed, remove it */
+ if (!remove) accept_hardware_message( hw_id );
/* skip this message */
call_hooks( WH_CBT, HCBT_KEYSKIPPED, LOWORD(msg->wParam), msg->lParam, 0 );
- accept_hardware_message( hw_id );
return FALSE;
}
- if (remove) accept_hardware_message( hw_id );
msg->pt = point_phys_to_win_dpi( msg->hwnd, msg->pt );
if (remove && msg->message == WM_KEYDOWN)
Module: wine
Branch: master
Commit: 3fbdd4129717c9292d994fb9d8c76e9728b5c635
URL: https://gitlab.winehq.org/wine/wine/-/commit/3fbdd4129717c9292d994fb9d8c76e…
Author: Alex Henrie <alexhenrie24(a)gmail.com>
Date: Mon Jan 8 00:11:11 2024 -0700
include: Add mgmtapi.h and LPSNMP_MGR_SESSION.
---
include/Makefile.in | 1 +
include/mgmtapi.h | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/include/Makefile.in b/include/Makefile.in
index d4a166e265c..bd72fe86975 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -440,6 +440,7 @@ SOURCES = \
mfplay.idl \
mfreadwrite.idl \
mftransform.idl \
+ mgmtapi.h \
midles.h \
mimeinfo.idl \
mimeole.idl \
diff --git a/include/mgmtapi.h b/include/mgmtapi.h
new file mode 100644
index 00000000000..0d22a7aceac
--- /dev/null
+++ b/include/mgmtapi.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2024 Alex Henrie
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _INC_MGMTAPI
+#define _INC_MGMTAPI
+
+typedef void *LPSNMP_MGR_SESSION;
+
+#endif /* _INC_MGMTAPI */