Jacek Caban : win32u: Move SendNotifyMessageW implementation from user32.
Alexandre Julliard
julliard at winehq.org
Tue Apr 5 15:39:44 CDT 2022
Module: wine
Branch: master
Commit: 980de6afe48b4b51e4e8c0af25f54e16a4eb219d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=980de6afe48b4b51e4e8c0af25f54e16a4eb219d
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Apr 4 16:58:35 2022 +0200
win32u: Move SendNotifyMessageW implementation from user32.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/message.c | 17 +-------
dlls/user32/user_main.c | 1 -
dlls/win32u/message.c | 94 +++++++++++++++++++++++++++++++++++++++++++-
dlls/win32u/ntuser_private.h | 1 -
4 files changed, 94 insertions(+), 19 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index a67032ef917..220b0b94d4f 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -2271,22 +2271,7 @@ BOOL WINAPI SendNotifyMessageA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
*/
BOOL WINAPI SendNotifyMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
- struct send_message_info info;
-
- if (is_pointer_message( msg, wparam ))
- {
- SetLastError( ERROR_MESSAGE_SYNC_ONLY );
- return FALSE;
- }
-
- info.type = MSG_NOTIFY;
- info.hwnd = hwnd;
- info.msg = msg;
- info.wparam = wparam;
- info.lparam = lparam;
- info.flags = 0;
-
- return send_message( &info, NULL, TRUE );
+ return NtUserMessageCall( hwnd, msg, wparam, lparam, 0, FNID_SENDNOTIFYMESSAGE, FALSE );
}
diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c
index 3fd05ec3f01..1b3e67c6d61 100644
--- a/dlls/user32/user_main.c
+++ b/dlls/user32/user_main.c
@@ -165,7 +165,6 @@ static const struct user_callbacks user_funcs =
EndMenu,
HideCaret,
PostMessageW,
- SendNotifyMessageW,
SetSystemMenu,
ShowCaret,
free_menu_items,
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c
index 41d97e648a0..a8db3016358 100644
--- a/dlls/win32u/message.c
+++ b/dlls/win32u/message.c
@@ -111,6 +111,82 @@ struct send_message_info
static const INPUT_MESSAGE_SOURCE msg_source_unavailable = { IMDT_UNAVAILABLE, IMO_UNAVAILABLE };
+/* flag for messages that contain pointers */
+/* 32 messages per entry, messages 0..31 map to bits 0..31 */
+
+#define SET(msg) (1 << ((msg) & 31))
+
+static const unsigned int message_pointer_flags[] =
+{
+ /* 0x00 - 0x1f */
+ SET(WM_CREATE) | SET(WM_SETTEXT) | SET(WM_GETTEXT) |
+ SET(WM_WININICHANGE) | SET(WM_DEVMODECHANGE),
+ /* 0x20 - 0x3f */
+ SET(WM_GETMINMAXINFO) | SET(WM_DRAWITEM) | SET(WM_MEASUREITEM) | SET(WM_DELETEITEM) |
+ SET(WM_COMPAREITEM),
+ /* 0x40 - 0x5f */
+ SET(WM_WINDOWPOSCHANGING) | SET(WM_WINDOWPOSCHANGED) | SET(WM_COPYDATA) | SET(WM_HELP),
+ /* 0x60 - 0x7f */
+ SET(WM_STYLECHANGING) | SET(WM_STYLECHANGED),
+ /* 0x80 - 0x9f */
+ SET(WM_NCCREATE) | SET(WM_NCCALCSIZE) | SET(WM_GETDLGCODE),
+ /* 0xa0 - 0xbf */
+ SET(EM_GETSEL) | SET(EM_GETRECT) | SET(EM_SETRECT) | SET(EM_SETRECTNP),
+ /* 0xc0 - 0xdf */
+ SET(EM_REPLACESEL) | SET(EM_GETLINE) | SET(EM_SETTABSTOPS),
+ /* 0xe0 - 0xff */
+ SET(SBM_GETRANGE) | SET(SBM_SETSCROLLINFO) | SET(SBM_GETSCROLLINFO) | SET(SBM_GETSCROLLBARINFO),
+ /* 0x100 - 0x11f */
+ 0,
+ /* 0x120 - 0x13f */
+ 0,
+ /* 0x140 - 0x15f */
+ SET(CB_GETEDITSEL) | SET(CB_ADDSTRING) | SET(CB_DIR) | SET(CB_GETLBTEXT) |
+ SET(CB_INSERTSTRING) | SET(CB_FINDSTRING) | SET(CB_SELECTSTRING) |
+ SET(CB_GETDROPPEDCONTROLRECT) | SET(CB_FINDSTRINGEXACT),
+ /* 0x160 - 0x17f */
+ 0,
+ /* 0x180 - 0x19f */
+ SET(LB_ADDSTRING) | SET(LB_INSERTSTRING) | SET(LB_GETTEXT) | SET(LB_SELECTSTRING) |
+ SET(LB_DIR) | SET(LB_FINDSTRING) |
+ SET(LB_GETSELITEMS) | SET(LB_SETTABSTOPS) | SET(LB_ADDFILE) | SET(LB_GETITEMRECT),
+ /* 0x1a0 - 0x1bf */
+ SET(LB_FINDSTRINGEXACT),
+ /* 0x1c0 - 0x1df */
+ 0,
+ /* 0x1e0 - 0x1ff */
+ 0,
+ /* 0x200 - 0x21f */
+ SET(WM_NEXTMENU) | SET(WM_SIZING) | SET(WM_MOVING) | SET(WM_DEVICECHANGE),
+ /* 0x220 - 0x23f */
+ SET(WM_MDICREATE) | SET(WM_MDIGETACTIVE) | SET(WM_DROPOBJECT) |
+ SET(WM_QUERYDROPOBJECT) | SET(WM_DRAGLOOP) | SET(WM_DRAGSELECT) | SET(WM_DRAGMOVE),
+ /* 0x240 - 0x25f */
+ 0,
+ /* 0x260 - 0x27f */
+ 0,
+ /* 0x280 - 0x29f */
+ 0,
+ /* 0x2a0 - 0x2bf */
+ 0,
+ /* 0x2c0 - 0x2df */
+ 0,
+ /* 0x2e0 - 0x2ff */
+ 0,
+ /* 0x300 - 0x31f */
+ SET(WM_ASKCBFORMATNAME)
+};
+
+/* check whether a given message type includes pointers */
+static inline BOOL is_pointer_message( UINT message, WPARAM wparam )
+{
+ if (message >= 8*sizeof(message_pointer_flags)) return FALSE;
+ if (message == WM_DEVICECHANGE && !(wparam & 0x8000)) return FALSE;
+ return (message_pointer_flags[message / 32] & SET(message)) != 0;
+}
+
+#undef SET
+
static BOOL init_win_proc_params( struct win_proc_params *params, HWND hwnd, UINT msg,
WPARAM wparam, LPARAM lparam, BOOL ansi )
{
@@ -2277,7 +2353,23 @@ LRESULT send_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
/* see SendNotifyMessageW */
static BOOL send_notify_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi )
{
- return user_callbacks && user_callbacks->pSendNotifyMessageW( hwnd, msg, wparam, lparam );
+ struct send_message_info info;
+
+ if (is_pointer_message( msg, wparam ))
+ {
+ SetLastError( ERROR_MESSAGE_SYNC_ONLY );
+ return FALSE;
+ }
+
+ info.type = MSG_NOTIFY;
+ info.hwnd = hwnd;
+ info.msg = msg;
+ info.wparam = wparam;
+ info.lparam = lparam;
+ info.flags = 0;
+ info.wm_char = WMCHAR_MAP_SENDMESSAGETIMEOUT;
+
+ return process_message( &info, NULL, ansi );
}
/***********************************************************************
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h
index f9623446f6d..6afe3955787 100644
--- a/dlls/win32u/ntuser_private.h
+++ b/dlls/win32u/ntuser_private.h
@@ -38,7 +38,6 @@ struct user_callbacks
BOOL (WINAPI *pEndMenu)(void);
BOOL (WINAPI *pHideCaret)( HWND hwnd );
BOOL (WINAPI *pPostMessageW)( HWND, UINT, WPARAM, LPARAM );
- BOOL (WINAPI *pSendNotifyMessageW)( HWND, UINT, WPARAM, LPARAM );
BOOL (WINAPI *pSetSystemMenu)( HWND hwnd, HMENU menu );
BOOL (WINAPI *pShowCaret)( HWND hwnd );
void (CDECL *free_menu_items)( void *ptr );
More information about the wine-cvs
mailing list