Module: wine Branch: master Commit: ad7cb436571ec66ae7a5687568fca2f5318c7e76 URL: http://source.winehq.org/git/wine.git/?a=commit;h=ad7cb436571ec66ae7a5687568...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Thu Apr 7 17:46:18 2016 +0300
user32: Limit broadcast messages to system and registered ones.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 3c5914e..d2059a8 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()); }