win32u: Move init_win_proc_params implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-03-23 14:00:56 +01:00 committed by Alexandre Julliard
parent b8a805e2f2
commit c1a9b0b6a9
5 changed files with 52 additions and 39 deletions

View File

@ -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( &params, func, hwnd, msg, wParam, lParam, &result, TRUE );
params.func = func;
params.result = &result;
if (!NtUserMessageCall( hwnd, msg, wParam, lParam, (ULONG_PTR)&params, FNID_CALLWNDPROC, TRUE ))
return 0;
dispatch_win_proc_params( &params );
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( &params, func, hwnd, msg, wParam, lParam, &result, FALSE );
params.func = func;
params.result = &result;
if (!NtUserMessageCall( hwnd, msg, wParam, lParam, (ULONG_PTR)&params, FNID_CALLWNDPROC, FALSE ))
return 0;
dispatch_win_proc_params( &params );
return result;
}

View File

@ -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.@)
*/

View File

@ -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:

View File

@ -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;

View File

@ -220,6 +220,7 @@ enum
/* NtUserMessageCall codes */
enum
{
FNID_CALLWNDPROC = 0x02ab,
FNID_SENDMESSAGE = 0x02b1,
FNID_SENDNOTIFYMESSAGE = 0x02b7,
/* Wine-specific exports */