[PATCH 2/2] user32: Limit broadcast messages to system and registered ones
Nikolay Sivov
nsivov at codeweavers.com
Thu Apr 7 09:46:18 CDT 2016
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/user32/message.c | 10 ++++++++--
dlls/user32/tests/msg.c | 4 ----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 9e0ce05..94d7a84 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -3232,6 +3232,10 @@ static LRESULT send_inter_thread_callback( HWND hwnd, UINT msg, WPARAM wp, LPARA
return send_inter_thread_message( info, result );
}
+static BOOL is_message_broadcastable(UINT msg)
+{
+ return msg < WM_USER || msg >= 0xc000;
+}
/***********************************************************************
* send_message
@@ -3246,7 +3250,8 @@ static BOOL send_message( struct send_message_info *info, DWORD_PTR *res_ptr, BO
if (is_broadcast(info->hwnd))
{
- EnumWindows( broadcast_message_callback, (LPARAM)info );
+ if (is_message_broadcastable( info->msg ))
+ EnumWindows( broadcast_message_callback, (LPARAM)info );
if (res_ptr) *res_ptr = 1;
return TRUE;
}
@@ -3659,7 +3664,8 @@ BOOL WINAPI PostMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
if (is_broadcast(hwnd))
{
- EnumWindows( broadcast_message_callback, (LPARAM)&info );
+ if (is_message_broadcastable( info.msg ))
+ EnumWindows( broadcast_message_callback, (LPARAM)&info );
return TRUE;
}
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 1b5d456..f7e55af 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -14047,7 +14047,6 @@ static void test_broadcast(void)
}
else
{
- todo_wine
ok(!ret, "%d: message %04x, got %d, error %d\n", i, messages[i], ret, GetLastError());
}
@@ -14064,7 +14063,6 @@ static void test_broadcast(void)
}
else
{
- todo_wine
ok(!ret, "%d: got %d, error %d\n", i, ret, GetLastError());
}
@@ -14082,7 +14080,6 @@ static void test_broadcast(void)
}
else
{
- todo_wine
ok(g_broadcast_lparam == 0xdead, "%d: message %04x, got %#lx, error %d\n", i, messages[i],
g_broadcast_lparam, GetLastError());
}
@@ -14102,7 +14099,6 @@ static void test_broadcast(void)
}
else
{
- todo_wine
ok(g_broadcast_lparam == 0xdead, "%d: message %04x, got %#lx, error %d\n", i, messages[i],
g_broadcast_lparam, GetLastError());
}
--
2.8.0.rc3
More information about the wine-patches
mailing list