user32: Reimplement IsHungAppWindow.

This commit is contained in:
Dmitry Timoshkov 2007-12-28 10:59:13 +08:00 committed by Alexandre Julliard
parent 3c985a442a
commit e735e199ad
6 changed files with 65 additions and 3 deletions

View File

@ -3556,6 +3556,13 @@ BOOL WINAPI GetGUIThreadInfo( DWORD id, GUITHREADINFO *info )
*/
BOOL WINAPI IsHungAppWindow( HWND hWnd )
{
DWORD_PTR dwResult;
return !SendMessageTimeoutA(hWnd, WM_NULL, 0, 0, SMTO_ABORTIFHUNG, 5000, &dwResult);
BOOL ret;
SERVER_START_REQ( is_window_hung )
{
req->win = hWnd;
ret = !wine_server_call_err( req ) && reply->is_hung;
}
SERVER_END_REQ;
return ret;
}

View File

@ -2597,6 +2597,19 @@ struct kill_win_timer_reply
struct is_window_hung_request
{
struct request_header __header;
user_handle_t win;
};
struct is_window_hung_reply
{
struct reply_header __header;
int is_hung;
};
struct get_serial_info_request
{
struct request_header __header;
@ -4382,6 +4395,7 @@ enum request
REQ_get_message_reply,
REQ_set_win_timer,
REQ_kill_win_timer,
REQ_is_window_hung,
REQ_get_serial_info,
REQ_set_serial_info,
REQ_register_async,
@ -4620,6 +4634,7 @@ union generic_request
struct get_message_reply_request get_message_reply_request;
struct set_win_timer_request set_win_timer_request;
struct kill_win_timer_request kill_win_timer_request;
struct is_window_hung_request is_window_hung_request;
struct get_serial_info_request get_serial_info_request;
struct set_serial_info_request set_serial_info_request;
struct register_async_request register_async_request;
@ -4856,6 +4871,7 @@ union generic_reply
struct get_message_reply_reply get_message_reply_reply;
struct set_win_timer_reply set_win_timer_reply;
struct kill_win_timer_reply kill_win_timer_reply;
struct is_window_hung_reply is_window_hung_reply;
struct get_serial_info_reply get_serial_info_reply;
struct set_serial_info_reply set_serial_info_reply;
struct register_async_reply register_async_reply;
@ -4960,6 +4976,6 @@ union generic_reply
struct add_fd_completion_reply add_fd_completion_reply;
};
#define SERVER_PROTOCOL_VERSION 334
#define SERVER_PROTOCOL_VERSION 335
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -1925,6 +1925,14 @@ enum message_type
@END
/* check if the thread owning the window is hung */
@REQ(is_window_hung)
user_handle_t win; /* window handle */
@REPLY
int is_hung;
@END
/* Retrieve info about a serial port */
@REQ(get_serial_info)
obj_handle_t handle; /* handle to comm port */

View File

@ -1562,6 +1562,22 @@ void post_win_event( struct thread *thread, unsigned int event,
}
}
/* check if the thread owning the window is hung */
DECL_HANDLER(is_window_hung)
{
struct thread *thread;
thread = get_window_thread( req->win );
if (thread)
{
reply->is_hung = is_queue_hung( thread->queue );
release_object( thread );
}
else reply->is_hung = 0;
}
/* get the message queue of the current thread */
DECL_HANDLER(get_msg_queue)
{

View File

@ -239,6 +239,7 @@ DECL_HANDLER(accept_hardware_message);
DECL_HANDLER(get_message_reply);
DECL_HANDLER(set_win_timer);
DECL_HANDLER(kill_win_timer);
DECL_HANDLER(is_window_hung);
DECL_HANDLER(get_serial_info);
DECL_HANDLER(set_serial_info);
DECL_HANDLER(register_async);
@ -476,6 +477,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_get_message_reply,
(req_handler)req_set_win_timer,
(req_handler)req_kill_win_timer,
(req_handler)req_is_window_hung,
(req_handler)req_get_serial_info,
(req_handler)req_set_serial_info,
(req_handler)req_register_async,

View File

@ -2412,6 +2412,16 @@ static void dump_kill_win_timer_request( const struct kill_win_timer_request *re
fprintf( stderr, " id=%lx", req->id );
}
static void dump_is_window_hung_request( const struct is_window_hung_request *req )
{
fprintf( stderr, " win=%p", req->win );
}
static void dump_is_window_hung_reply( const struct is_window_hung_reply *req )
{
fprintf( stderr, " is_hung=%d", req->is_hung );
}
static void dump_get_serial_info_request( const struct get_serial_info_request *req )
{
fprintf( stderr, " handle=%p", req->handle );
@ -3878,6 +3888,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_get_message_reply_request,
(dump_func)dump_set_win_timer_request,
(dump_func)dump_kill_win_timer_request,
(dump_func)dump_is_window_hung_request,
(dump_func)dump_get_serial_info_request,
(dump_func)dump_set_serial_info_request,
(dump_func)dump_register_async_request,
@ -4112,6 +4123,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_get_message_reply_reply,
(dump_func)dump_set_win_timer_reply,
(dump_func)0,
(dump_func)dump_is_window_hung_reply,
(dump_func)dump_get_serial_info_reply,
(dump_func)0,
(dump_func)0,
@ -4346,6 +4358,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"get_message_reply",
"set_win_timer",
"kill_win_timer",
"is_window_hung",
"get_serial_info",
"set_serial_info",
"register_async",