Commit c1a9b0b6 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move init_win_proc_params implementation from user32.

parent b8a805e2
......@@ -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;
}
......
......@@ -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.@)
*/
......
......@@ -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:
......
......@@ -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;
......
......@@ -220,6 +220,7 @@ enum
/* NtUserMessageCall codes */
enum
{
FNID_CALLWNDPROC = 0x02ab,
FNID_SENDMESSAGE = 0x02b1,
FNID_SENDNOTIFYMESSAGE = 0x02b7,
/* Wine-specific exports */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment