Commit 0cfc7c44 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

user32: Merge WINPROC_call_window into call_window_proc.

parent 9ced5b05
......@@ -53,6 +53,8 @@ WINE_DECLARE_DEBUG_CHANNEL(key);
#define MAX_PACK_COUNT 4
#define MAX_WINPROC_RECURSION 64
/* the various structures that can be sent in messages, in platform-independent layout */
struct packed_CREATESTRUCTW
{
......@@ -2162,6 +2164,38 @@ static BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM
return TRUE;
}
static BOOL init_window_call_params( struct win_proc_params *params, HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lParam, LRESULT *result, BOOL ansi,
enum wm_char_mapping mapping )
{
WND *win;
USER_CheckNotLock();
if (!(win = WIN_GetPtr( hwnd ))) return FALSE;
if (win == WND_OTHER_PROCESS || win == WND_DESKTOP) return FALSE;
if (win->tid != GetCurrentThreadId())
{
WIN_ReleasePtr( win );
return FALSE;
}
params->func = win->winproc;
params->ansi_dst = !(win->flags & WIN_ISUNICODE);
params->is_dialog = win->dlgInfo != NULL;
WIN_ReleasePtr( win );
params->hwnd = WIN_GetFullHandle( hwnd );
get_winproc_params( params );
params->msg = msg;
params->wparam = wParam;
params->lparam = lParam;
params->result = result;
params->ansi = ansi;
params->mapping = mapping;
params->dpi_awareness = GetWindowDpiAwarenessContext( params->hwnd );
return TRUE;
}
/***********************************************************************
* call_window_proc
*
......@@ -2170,35 +2204,43 @@ static BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM
static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
BOOL unicode, BOOL same_thread, enum wm_char_mapping mapping )
{
struct user_thread_info *thread_info = get_user_thread_info();
struct win_proc_params params;
LRESULT result = 0;
CWPSTRUCT cwp;
CWPRETSTRUCT cwpret;
if (msg & 0x80000000)
{
result = handle_internal_message( hwnd, msg, wparam, lparam );
goto done;
}
return handle_internal_message( hwnd, msg, wparam, lparam );
if (!WIN_IsCurrentThread( hwnd )) return 0;
if (!init_window_call_params( &params, hwnd, msg, wparam, lparam, &result, !unicode, mapping ))
return 0;
/* first the WH_CALLWNDPROC hook */
hwnd = WIN_GetFullHandle( hwnd );
cwp.lParam = lparam;
cwp.wParam = wparam;
cwp.message = msg;
cwp.hwnd = hwnd;
cwp.hwnd = params.hwnd;
HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, same_thread, (LPARAM)&cwp, unicode );
/* now call the window procedure */
if (!WINPROC_call_window( hwnd, msg, wparam, lparam, &result, unicode, mapping )) goto done;
if (thread_info->recursion_count <= MAX_WINPROC_RECURSION)
{
thread_info->recursion_count++;
/* now call the window procedure */
User32CallWindowProc( &params, sizeof(params) );
thread_info->recursion_count--;
}
/* and finally the WH_CALLWNDPROCRET hook */
cwpret.lResult = result;
cwpret.lParam = lparam;
cwpret.wParam = wparam;
cwpret.message = msg;
cwpret.hwnd = hwnd;
cwpret.hwnd = params.hwnd;
HOOK_CallHooks( WH_CALLWNDPROCRET, HC_ACTION, same_thread, (LPARAM)&cwpret, unicode );
done:
return result;
}
......
......@@ -115,9 +115,8 @@ extern LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UIN
extern INT_PTR WINPROC_CallDlgProcA( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
extern INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
extern BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
LRESULT *result, BOOL unicode, enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
extern void winproc_init(void) DECLSPEC_HIDDEN;
extern void get_winproc_params( struct win_proc_params *params ) DECLSPEC_HIDDEN;
extern ATOM get_class_info( HINSTANCE instance, const WCHAR *name, WNDCLASSEXW *info,
UNICODE_STRING *name_str, BOOL ansi ) DECLSPEC_HIDDEN;
......
......@@ -36,7 +36,6 @@
WINE_DECLARE_DEBUG_CHANNEL(msg);
WINE_DECLARE_DEBUG_CHANNEL(relay);
#define MAX_WINPROC_RECURSION 64
#define WINPROC_PROC16 ((void *)1) /* placeholder for 16-bit window procs */
static inline void *get_buffer( void *static_buffer, size_t size, size_t need )
......@@ -795,67 +794,25 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
return TRUE;
}
/**********************************************************************
* WINPROC_call_window
*
* Call the window procedure of the specified window.
*/
BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
LRESULT *result, BOOL unicode, enum wm_char_mapping mapping )
void get_winproc_params( struct win_proc_params *params )
{
struct user_thread_info *thread_info = get_user_thread_info();
struct win_proc_params params;
WINDOWPROC *proc;
WND *wndPtr;
USER_CheckNotLock();
if (!(wndPtr = WIN_GetPtr( hwnd ))) return FALSE;
if (wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return FALSE;
if (wndPtr->tid != GetCurrentThreadId())
{
WIN_ReleasePtr( wndPtr );
return FALSE;
}
params.func = wndPtr->winproc;
proc = handle_to_proc( wndPtr->winproc );
params.ansi_dst = !(wndPtr->flags & WIN_ISUNICODE);
params.is_dialog = wndPtr->dlgInfo != NULL;
WIN_ReleasePtr( wndPtr );
params.hwnd = WIN_GetFullHandle( hwnd );
params.msg = msg;
params.wparam = wParam;
params.lparam = lParam;
params.result = result;
params.ansi = !unicode;
params.mapping = mapping;
params.dpi_awareness = GetWindowDpiAwarenessContext( params.hwnd );
WINDOWPROC *proc = handle_to_proc( params->func );
if (!proc)
{
params.procW = params.procA = NULL;
params->procW = params->procA = NULL;
}
else if (proc == WINPROC_PROC16)
{
params.procW = params.procA = WINPROC_PROC16;
params->procW = params->procA = WINPROC_PROC16;
}
else
{
params.procA = proc->procA;
params.procW = proc->procW;
params->procA = proc->procA;
params->procW = proc->procW;
}
if (thread_info->recursion_count > MAX_WINPROC_RECURSION) return FALSE;
thread_info->recursion_count++;
dispatch_win_proc_params( &params );
thread_info->recursion_count--;
return TRUE;
}
/**********************************************************************
* CallWindowProcA (USER32.@)
*
......
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