Jacek Caban : win32u: Move init_win_proc_params implementation from user32.
Alexandre Julliard
julliard at winehq.org
Wed Mar 23 17:03:55 CDT 2022
Module: wine
Branch: master
Commit: c1a9b0b6a98faddf5b64ac99f3fed759b0199f46
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c1a9b0b6a98faddf5b64ac99f3fed759b0199f46
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Mar 23 14:00:56 2022 +0100
win32u: Move init_win_proc_params 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/winproc.c | 46 ++++++++------------------------------------
dlls/win32u/class.c | 21 +++++++++++++++++++-
dlls/win32u/message.c | 22 +++++++++++++++++++++
dlls/win32u/ntuser_private.h | 1 +
include/ntuser.h | 1 +
5 files changed, 52 insertions(+), 39 deletions(-)
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c
index c46cd373b4e..f3d5d913ac5 100644
--- a/dlls/user32/winproc.c
+++ b/dlls/user32/winproc.c
@@ -851,40 +851,6 @@ BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
}
-static void init_win_proc_params( struct win_proc_params *info, WNDPROC func, HWND hwnd, UINT msg,
- WPARAM wparam, LPARAM lparam, LRESULT *result, BOOL ansi )
-{
- WINDOWPROC *proc;
-
- USER_CheckNotLock();
-
- info->hwnd = WIN_GetFullHandle( hwnd );
- info->msg = msg;
- info->wparam = wparam;
- info->lparam = lparam;
- info->result = result;
- info->ansi = info->ansi_dst = ansi;
- info->is_dialog = FALSE;
- info->mapping = WMCHAR_MAP_CALLWINDOWPROC;
- info->dpi_awareness = GetWindowDpiAwarenessContext( info->hwnd );
- info->func = func;
-
- if (!(proc = handle_to_proc( func )))
- {
- info->procW = info->procA = NULL;
- }
- else if (proc == WINPROC_PROC16)
- {
- info->procW = info->procA = WINPROC_PROC16;
- }
- else
- {
- info->procA = proc->procA;
- info->procW = proc->procW;
- }
-}
-
-
/**********************************************************************
* CallWindowProcA (USER32.@)
*
@@ -914,8 +880,10 @@ LRESULT WINAPI CallWindowProcA( WNDPROC func, HWND hwnd, UINT msg, WPARAM wParam
struct win_proc_params params;
LRESULT result;
- if (!func) return 0;
- init_win_proc_params( ¶ms, func, hwnd, msg, wParam, lParam, &result, TRUE );
+ params.func = func;
+ params.result = &result;
+ if (!NtUserMessageCall( hwnd, msg, wParam, lParam, (ULONG_PTR)¶ms, FNID_CALLWNDPROC, TRUE ))
+ return 0;
dispatch_win_proc_params( ¶ms );
return result;
}
@@ -931,8 +899,10 @@ LRESULT WINAPI CallWindowProcW( WNDPROC func, HWND hwnd, UINT msg, WPARAM wParam
struct win_proc_params params;
LRESULT result;
- if (!func) return 0;
- init_win_proc_params( ¶ms, func, hwnd, msg, wParam, lParam, &result, FALSE );
+ params.func = func;
+ params.result = &result;
+ if (!NtUserMessageCall( hwnd, msg, wParam, lParam, (ULONG_PTR)¶ms, FNID_CALLWNDPROC, FALSE ))
+ return 0;
dispatch_win_proc_params( ¶ms );
return result;
}
diff --git a/dlls/win32u/class.c b/dlls/win32u/class.c
index 9ac402025b0..a030f5d6c0d 100644
--- a/dlls/win32u/class.c
+++ b/dlls/win32u/class.c
@@ -37,7 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(class);
WINE_DECLARE_DEBUG_CHANNEL(win);
#define MAX_WINPROCS 4096
-#define WINPROC_PROC16 ((WINDOWPROC *)1) /* placeholder for 16-bit window procs */
+#define WINPROC_PROC16 ((void *)1) /* placeholder for 16-bit window procs */
typedef struct tagCLASS
{
@@ -184,6 +184,25 @@ BOOL is_winproc_unicode( WNDPROC proc, BOOL def_val )
return ptr->procW != NULL;
}
+void get_winproc_params( struct win_proc_params *params )
+{
+ WINDOWPROC *proc = get_winproc_ptr( params->func );
+
+ if (!proc)
+ {
+ params->procW = params->procA = NULL;
+ }
+ else if (proc == WINPROC_PROC16)
+ {
+ params->procW = params->procA = WINPROC_PROC16;
+ }
+ else
+ {
+ params->procA = proc->procA;
+ params->procW = proc->procW;
+ }
+}
+
/***********************************************************************
* NtUserInitializeClientPfnArrays (win32u.@)
*/
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c
index 7730de22fef..b9f9f22378e 100644
--- a/dlls/win32u/message.c
+++ b/dlls/win32u/message.c
@@ -32,6 +32,25 @@
WINE_DEFAULT_DEBUG_CHANNEL(msg);
+static BOOL init_win_proc_params( struct win_proc_params *params, HWND hwnd, UINT msg,
+ WPARAM wparam, LPARAM lparam, BOOL ansi )
+{
+ if (!params->func) return FALSE;
+
+ user_check_not_lock();
+
+ params->hwnd = get_full_window_handle( hwnd );
+ params->msg = msg;
+ params->wparam = wparam;
+ params->lparam = lparam;
+ params->ansi = params->ansi_dst = ansi;
+ params->is_dialog = FALSE;
+ params->mapping = WMCHAR_MAP_CALLWINDOWPROC;
+ params->dpi_awareness = get_window_dpi_awareness_context( params->hwnd );
+ get_winproc_params( params );
+ return TRUE;
+}
+
/***********************************************************************
* handle_internal_message
*
@@ -269,6 +288,9 @@ BOOL WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam
{
switch (type)
{
+ case FNID_CALLWNDPROC:
+ return init_win_proc_params( (struct win_proc_params *)result_info, hwnd, msg,
+ wparam, lparam, ansi );
case FNID_SENDMESSAGE:
return send_window_message( hwnd, msg, wparam, lparam, (LRESULT *)result_info, ansi );
case FNID_SENDNOTIFYMESSAGE:
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h
index 14bd98a307b..7c03474286d 100644
--- a/dlls/win32u/ntuser_private.h
+++ b/dlls/win32u/ntuser_private.h
@@ -243,6 +243,7 @@ ULONG_PTR get_class_long_ptr( HWND hwnd, INT offset, BOOL ansi ) DECLSPEC_HIDDEN
WORD get_class_word( HWND hwnd, INT offset ) DECLSPEC_HIDDEN;
ATOM get_int_atom_value( UNICODE_STRING *name ) DECLSPEC_HIDDEN;
WNDPROC get_winproc( WNDPROC proc, BOOL ansi ) DECLSPEC_HIDDEN;
+void get_winproc_params( struct win_proc_params *params ) DECLSPEC_HIDDEN;
struct dce *get_class_dce( struct tagCLASS *class ) DECLSPEC_HIDDEN;
struct dce *set_class_dce( struct tagCLASS *class, struct dce *dce ) DECLSPEC_HIDDEN;
diff --git a/include/ntuser.h b/include/ntuser.h
index 12e9b5b3025..e50dcf078ad 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -220,6 +220,7 @@ enum
/* NtUserMessageCall codes */
enum
{
+ FNID_CALLWNDPROC = 0x02ab,
FNID_SENDMESSAGE = 0x02b1,
FNID_SENDNOTIFYMESSAGE = 0x02b7,
/* Wine-specific exports */
More information about the wine-cvs
mailing list