user32: Reimplement IsHungAppWindow.
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index d3f4a3a..67bf10e 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -3556,6 +3556,13 @@
*/
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;
}
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index fea45f8..798fda5 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -2597,6 +2597,19 @@
+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 @@
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 @@
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 @@
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 @@
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 */
diff --git a/server/protocol.def b/server/protocol.def
index aa10f89..bfd7242 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -1925,6 +1925,14 @@
@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 */
diff --git a/server/queue.c b/server/queue.c
index d837e84..a32bd7e 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1562,6 +1562,22 @@
}
}
+
+/* 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)
{
diff --git a/server/request.h b/server/request.h
index cc1d3d1..6c5f146 100644
--- a/server/request.h
+++ b/server/request.h
@@ -239,6 +239,7 @@
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 @@
(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,
diff --git a/server/trace.c b/server/trace.c
index 4bcd545..47e059e 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -2412,6 +2412,16 @@
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 @@
(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 @@
(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 @@
"get_message_reply",
"set_win_timer",
"kill_win_timer",
+ "is_window_hung",
"get_serial_info",
"set_serial_info",
"register_async",