user32: Add a WoW wrapper for message waiting to allow releasing the Win16 lock in the 16-bit code.

This commit is contained in:
Alexandre Julliard 2009-12-24 12:02:10 +01:00
parent 2ea73fd709
commit b33c5f163a
4 changed files with 28 additions and 17 deletions

View File

@ -96,6 +96,7 @@ struct wow_handlers16
LRESULT (*mdiclient_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
LRESULT (*static_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
DWORD (*wait_message)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
HWND (*create_window)(CREATESTRUCTW*,LPCWSTR,HINSTANCE,BOOL);
LRESULT (*call_window_proc)(HWND,UINT,WPARAM,LPARAM,LRESULT*,void*);
LRESULT (*call_dialog_proc)(HWND,UINT,WPARAM,LPARAM,LRESULT*,void*);
@ -114,6 +115,7 @@ struct wow_handlers32
LRESULT (*mdiclient_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
LRESULT (*static_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
DWORD (*wait_message)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
HWND (*create_window)(CREATESTRUCTW*,LPCWSTR,HINSTANCE,BOOL);
HWND (*get_win_handle)(HWND);
WNDPROC (*alloc_winproc)(WNDPROC,BOOL);

View File

@ -2266,7 +2266,6 @@ static void wait_message_reply( UINT flags )
for (;;)
{
unsigned int wake_bits = 0;
DWORD dwlc, res;
SERVER_START_REQ( set_queue_mask )
{
@ -2286,12 +2285,7 @@ static void wait_message_reply( UINT flags )
continue;
}
/* now wait for it */
ReleaseThunkLock( &dwlc );
res = USER_Driver->pMsgWaitForMultipleObjectsEx( 1, &server_queue,
INFINITE, QS_SENDMESSAGE, 0 );
if (dwlc) RestoreThunkLock( dwlc );
wow_handlers.wait_message( 1, &server_queue, INFINITE, QS_SENDMESSAGE, 0 );
}
}
@ -2955,11 +2949,7 @@ BOOL WINAPI GetMessageW( MSG *msg, HWND hwnd, UINT first, UINT last )
while (!peek_message( msg, hwnd, first, last, PM_REMOVE | (mask << 16), mask ))
{
DWORD dwlc;
ReleaseThunkLock( &dwlc );
USER_Driver->pMsgWaitForMultipleObjectsEx( 1, &server_queue, INFINITE, mask, 0 );
if (dwlc) RestoreThunkLock( dwlc );
wow_handlers.wait_message( 1, &server_queue, INFINITE, mask, 0 );
}
return (msg->message != WM_QUIT);
@ -3269,7 +3259,7 @@ DWORD WINAPI MsgWaitForMultipleObjectsEx( DWORD count, CONST HANDLE *pHandles,
DWORD timeout, DWORD mask, DWORD flags )
{
HANDLE handles[MAXIMUM_WAIT_OBJECTS];
DWORD i, ret, lock;
DWORD i;
if (count > MAXIMUM_WAIT_OBJECTS-1)
{
@ -3291,10 +3281,7 @@ DWORD WINAPI MsgWaitForMultipleObjectsEx( DWORD count, CONST HANDLE *pHandles,
for (i = 0; i < count; i++) handles[i] = pHandles[i];
handles[count] = get_server_queue_handle();
ReleaseThunkLock( &lock );
ret = USER_Driver->pMsgWaitForMultipleObjectsEx( count+1, handles, timeout, mask, flags );
if (lock) RestoreThunkLock( lock );
return ret;
return wow_handlers.wait_message( count+1, handles, timeout, mask, flags );
}

View File

@ -2568,6 +2568,20 @@ static LRESULT static_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
}
/***********************************************************************
* wait_message16
*/
static DWORD wait_message16( DWORD count, CONST HANDLE *handles, DWORD timeout, DWORD mask, DWORD flags )
{
DWORD lock, ret;
ReleaseThunkLock( &lock );
ret = wow_handlers32.wait_message( count, handles, timeout, mask, flags );
RestoreThunkLock( lock );
return ret;
}
/***********************************************************************
* create_window16
*/
@ -2619,6 +2633,7 @@ void register_wow_handlers(void)
mdiclient_proc16,
scrollbar_proc16,
static_proc16,
wait_message16,
create_window16,
call_window_proc_Ato16,
call_dialog_proc_Ato16,

View File

@ -1121,6 +1121,11 @@ static LRESULT WINAPI StaticWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM
return wow_handlers.static_proc( hwnd, msg, wParam, lParam, TRUE );
}
static DWORD wait_message( DWORD count, CONST HANDLE *handles, DWORD timeout, DWORD mask, DWORD flags )
{
return USER_Driver->pMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags );
}
static HICON alloc_icon_handle( unsigned int size )
{
struct user_object *obj = HeapAlloc( GetProcessHeap(), 0, sizeof(*obj) + size );
@ -1167,6 +1172,7 @@ void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new, struct wo
orig->mdiclient_proc = MDIClientWndProc_common;
orig->scrollbar_proc = ScrollBarWndProc_common;
orig->static_proc = StaticWndProc_common;
orig->wait_message = wait_message;
orig->create_window = WIN_CreateWindowEx;
orig->get_win_handle = WIN_GetFullHandle;
orig->alloc_winproc = WINPROC_AllocProc;
@ -1185,6 +1191,7 @@ struct wow_handlers16 wow_handlers =
MDIClientWndProc_common,
ScrollBarWndProc_common,
StaticWndProc_common,
wait_message,
WIN_CreateWindowEx,
NULL, /* call_window_proc */
NULL, /* call_dialog_proc */