Commit bcc1bb2b authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Apply the SendMessage recursion counter to DispatchMessage too.

parent ac29a3d8
...@@ -52,7 +52,6 @@ WINE_DECLARE_DEBUG_CHANNEL(key); ...@@ -52,7 +52,6 @@ WINE_DECLARE_DEBUG_CHANNEL(key);
#define WM_NCMOUSELAST (WM_NCMOUSEFIRST+(WM_MOUSELAST-WM_MOUSEFIRST)) #define WM_NCMOUSELAST (WM_NCMOUSEFIRST+(WM_MOUSELAST-WM_MOUSEFIRST))
#define MAX_PACK_COUNT 4 #define MAX_PACK_COUNT 4
#define MAX_SENDMSG_RECURSION 64
#define SYS_TIMER_RATE 55 /* min. timer rate in ms (actually 54.925)*/ #define SYS_TIMER_RATE 55 /* min. timer rate in ms (actually 54.925)*/
...@@ -1613,14 +1612,10 @@ static BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM ...@@ -1613,14 +1612,10 @@ 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, static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
BOOL unicode, BOOL same_thread, enum wm_char_mapping mapping ) BOOL unicode, BOOL same_thread, enum wm_char_mapping mapping )
{ {
struct user_thread_info *thread_info = get_user_thread_info();
LRESULT result = 0; LRESULT result = 0;
CWPSTRUCT cwp; CWPSTRUCT cwp;
CWPRETSTRUCT cwpret; CWPRETSTRUCT cwpret;
if (thread_info->recursion_count > MAX_SENDMSG_RECURSION) return 0;
thread_info->recursion_count++;
if (msg & 0x80000000) if (msg & 0x80000000)
{ {
result = handle_internal_message( hwnd, msg, wparam, lparam ); result = handle_internal_message( hwnd, msg, wparam, lparam );
...@@ -1646,7 +1641,6 @@ static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar ...@@ -1646,7 +1641,6 @@ static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar
cwpret.hwnd = hwnd; cwpret.hwnd = hwnd;
HOOK_CallHooks( WH_CALLWNDPROCRET, HC_ACTION, same_thread, (LPARAM)&cwpret, unicode ); HOOK_CallHooks( WH_CALLWNDPROCRET, HC_ACTION, same_thread, (LPARAM)&cwpret, unicode );
done: done:
thread_info->recursion_count--;
return result; return result;
} }
......
...@@ -53,6 +53,7 @@ typedef struct tagWINDOWPROC ...@@ -53,6 +53,7 @@ typedef struct tagWINDOWPROC
#define WINPROC_HANDLE (~0UL >> 16) #define WINPROC_HANDLE (~0UL >> 16)
#define MAX_WINPROCS 8192 #define MAX_WINPROCS 8192
#define BUILTIN_WINPROCS 9 /* first BUILTIN_WINPROCS entries are reserved for builtin procs */ #define BUILTIN_WINPROCS 9 /* first BUILTIN_WINPROCS entries are reserved for builtin procs */
#define MAX_WINPROC_RECURSION 64
WNDPROC EDIT_winproc_handle = 0; WNDPROC EDIT_winproc_handle = 0;
...@@ -2177,6 +2178,7 @@ LRESULT WINPROC_CallProc32ATo16( winproc_callback16_t callback, HWND hwnd, UINT ...@@ -2177,6 +2178,7 @@ LRESULT WINPROC_CallProc32ATo16( winproc_callback16_t callback, HWND hwnd, UINT
BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
LRESULT *result, BOOL unicode, enum wm_char_mapping mapping ) LRESULT *result, BOOL unicode, enum wm_char_mapping mapping )
{ {
struct user_thread_info *thread_info = get_user_thread_info();
WND *wndPtr; WND *wndPtr;
WINDOWPROC *proc; WINDOWPROC *proc;
...@@ -2192,6 +2194,9 @@ BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, ...@@ -2192,6 +2194,9 @@ BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
if (!proc) return TRUE; if (!proc) return TRUE;
if (thread_info->recursion_count > MAX_WINPROC_RECURSION) return FALSE;
thread_info->recursion_count++;
if (unicode) if (unicode)
{ {
if (proc->procW) if (proc->procW)
...@@ -2210,6 +2215,7 @@ BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, ...@@ -2210,6 +2215,7 @@ BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
else else
WINPROC_CallProc32ATo16( call_window_proc16, hwnd, msg, wParam, lParam, result, proc->proc16 ); WINPROC_CallProc32ATo16( call_window_proc16, hwnd, msg, wParam, lParam, result, proc->proc16 );
} }
thread_info->recursion_count--;
return TRUE; return TRUE;
} }
......
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