server: Changed the get_next_hook request to allow retrieving the current hook too.
diff --git a/dlls/user/hook.c b/dlls/user/hook.c
index b8996aa..d016337 100644
--- a/dlls/user/hook.c
+++ b/dlls/user/hook.c
@@ -527,15 +527,16 @@
 
     ZeroMemory( &info, sizeof(info) - sizeof(info.module) );
 
-    SERVER_START_REQ( get_next_hook )
+    SERVER_START_REQ( get_hook_info )
     {
         req->handle = thread_info->hook;
+        req->get_next = 1;
         req->event = EVENT_MIN;
         wine_server_set_reply( req, info.module, sizeof(info.module)-sizeof(WCHAR) );
         if (!wine_server_call_err( req ))
         {
             info.module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
-            info.handle       = reply->next;
+            info.handle       = reply->handle;
             info.id           = reply->id;
             info.pid          = reply->pid;
             info.tid          = reply->tid;
@@ -718,9 +719,10 @@
 {
     BOOL ret;
 
-    SERVER_START_REQ( get_next_hook )
+    SERVER_START_REQ( get_hook_info )
     {
         req->handle = info->handle;
+        req->get_next = 1;
         req->event = event;
         req->window = hwnd;
         req->object_id = object_id;
@@ -730,7 +732,7 @@
         if (ret)
         {
             info->module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
-            info->handle    = reply->next;
+            info->handle    = reply->handle;
             info->proc      = reply->proc;
             info->tid       = reply->tid;
         }
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 84ad984..2f5394c 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -3375,19 +3375,20 @@
 
 
 
-struct get_next_hook_request
+struct get_hook_info_request
 {
     struct request_header __header;
     user_handle_t  handle;
+    int            get_next;
     int            event;
     user_handle_t  window;
     int            object_id;
     int            child_id;
 };
-struct get_next_hook_reply
+struct get_hook_info_reply
 {
     struct reply_header __header;
-    user_handle_t  next;
+    user_handle_t  handle;
     int            id;
     process_id_t   pid;
     thread_id_t    tid;
@@ -3961,7 +3962,7 @@
     REQ_remove_hook,
     REQ_start_hook_chain,
     REQ_finish_hook_chain,
-    REQ_get_next_hook,
+    REQ_get_hook_info,
     REQ_create_class,
     REQ_destroy_class,
     REQ_set_class_info,
@@ -4182,7 +4183,7 @@
     struct remove_hook_request remove_hook_request;
     struct start_hook_chain_request start_hook_chain_request;
     struct finish_hook_chain_request finish_hook_chain_request;
-    struct get_next_hook_request get_next_hook_request;
+    struct get_hook_info_request get_hook_info_request;
     struct create_class_request create_class_request;
     struct destroy_class_request destroy_class_request;
     struct set_class_info_request set_class_info_request;
@@ -4401,7 +4402,7 @@
     struct remove_hook_reply remove_hook_reply;
     struct start_hook_chain_reply start_hook_chain_reply;
     struct finish_hook_chain_reply finish_hook_chain_reply;
-    struct get_next_hook_reply get_next_hook_reply;
+    struct get_hook_info_reply get_hook_info_reply;
     struct create_class_reply create_class_reply;
     struct destroy_class_reply destroy_class_reply;
     struct set_class_info_reply set_class_info_reply;
@@ -4425,6 +4426,6 @@
     struct query_symlink_reply query_symlink_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 253
+#define SERVER_PROTOCOL_VERSION 254
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/hook.c b/server/hook.c
index 14ad968..e8a72a81 100644
--- a/server/hook.c
+++ b/server/hook.c
@@ -536,10 +536,10 @@
 }
 
 
-/* get the next hook to call */
-DECL_HANDLER(get_next_hook)
+/* get the hook information */
+DECL_HANDLER(get_hook_info)
 {
-    struct hook *hook, *next;
+    struct hook *hook;
 
     if (!(hook = get_user_object( req->handle, USER_HOOK ))) return;
     if (hook->thread && (hook->thread != current))
@@ -547,22 +547,23 @@
         set_error( STATUS_INVALID_HANDLE );
         return;
     }
-    if ((next = get_next_hook( current, hook, req->event, req->window, req->object_id, req->child_id )))
+    if (req->get_next && !(hook = get_next_hook( current, hook, req->event, req->window,
+                                                 req->object_id, req->child_id )))
+        return;
+
+    reply->handle  = hook->handle;
+    reply->id      = hook->index + WH_MINHOOK;
+    reply->unicode = hook->unicode;
+    if (hook->module) set_reply_data( hook->module, min(hook->module_size,get_reply_max_size()) );
+    if (run_hook_in_owner_thread( hook ))
     {
-        reply->next = next->handle;
-        reply->id   = next->index + WH_MINHOOK;
-        reply->unicode = next->unicode;
-        if (next->module) set_reply_data( next->module, next->module_size );
-        if (run_hook_in_owner_thread( next ))
-        {
-            reply->pid  = get_process_id( next->owner->process );
-            reply->tid  = get_thread_id( next->owner );
-        }
-        else
-        {
-            reply->pid  = 0;
-            reply->tid  = 0;
-        }
-        reply->proc = next->proc;
+        reply->pid  = get_process_id( hook->owner->process );
+        reply->tid  = get_thread_id( hook->owner );
     }
+    else
+    {
+        reply->pid  = 0;
+        reply->tid  = 0;
+    }
+    reply->proc = hook->proc;
 }
diff --git a/server/protocol.def b/server/protocol.def
index 583c757..285da96 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2369,19 +2369,20 @@
 @END
 
 
-/* Get the next hook to call */
-@REQ(get_next_hook)
+/* Get the hook information */
+@REQ(get_hook_info)
     user_handle_t  handle;         /* handle to the current hook */
+    int            get_next;       /* do we want info about current or next hook? */
     int            event;          /* signalled event */
     user_handle_t  window;         /* handle to the event window */
     int            object_id;      /* object id for out of context winevent */
     int            child_id;       /* child id for out of context winevent */
 @REPLY
-    user_handle_t  next;           /* handle to the next hook */
-    int            id;             /* id of the next hook */
+    user_handle_t  handle;         /* handle to the hook */
+    int            id;             /* id of the hook */
     process_id_t   pid;            /* process id for low-level keyboard/mouse hooks */
     thread_id_t    tid;            /* thread id for low-level keyboard/mouse hooks */
-    void*          proc;           /* next hook procedure */
+    void*          proc;           /* hook procedure */
     int            unicode;        /* is it a unicode hook? */
     VARARG(module,unicode_str);    /* module name */
 @END
diff --git a/server/request.h b/server/request.h
index aad0387..fd805e3 100644
--- a/server/request.h
+++ b/server/request.h
@@ -302,7 +302,7 @@
 DECL_HANDLER(remove_hook);
 DECL_HANDLER(start_hook_chain);
 DECL_HANDLER(finish_hook_chain);
-DECL_HANDLER(get_next_hook);
+DECL_HANDLER(get_hook_info);
 DECL_HANDLER(create_class);
 DECL_HANDLER(destroy_class);
 DECL_HANDLER(set_class_info);
@@ -522,7 +522,7 @@
     (req_handler)req_remove_hook,
     (req_handler)req_start_hook_chain,
     (req_handler)req_finish_hook_chain,
-    (req_handler)req_get_next_hook,
+    (req_handler)req_get_hook_info,
     (req_handler)req_create_class,
     (req_handler)req_destroy_class,
     (req_handler)req_set_class_info,
diff --git a/server/trace.c b/server/trace.c
index 2c5b3e0..6e05882 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -2951,18 +2951,19 @@
     fprintf( stderr, " id=%d", req->id );
 }
 
-static void dump_get_next_hook_request( const struct get_next_hook_request *req )
+static void dump_get_hook_info_request( const struct get_hook_info_request *req )
 {
     fprintf( stderr, " handle=%p,", req->handle );
+    fprintf( stderr, " get_next=%d,", req->get_next );
     fprintf( stderr, " event=%d,", req->event );
     fprintf( stderr, " window=%p,", req->window );
     fprintf( stderr, " object_id=%d,", req->object_id );
     fprintf( stderr, " child_id=%d", req->child_id );
 }
 
-static void dump_get_next_hook_reply( const struct get_next_hook_reply *req )
+static void dump_get_hook_info_reply( const struct get_hook_info_reply *req )
 {
-    fprintf( stderr, " next=%p,", req->next );
+    fprintf( stderr, " handle=%p,", req->handle );
     fprintf( stderr, " id=%d,", req->id );
     fprintf( stderr, " pid=%04x,", req->pid );
     fprintf( stderr, " tid=%04x,", req->tid );
@@ -3477,7 +3478,7 @@
     (dump_func)dump_remove_hook_request,
     (dump_func)dump_start_hook_chain_request,
     (dump_func)dump_finish_hook_chain_request,
-    (dump_func)dump_get_next_hook_request,
+    (dump_func)dump_get_hook_info_request,
     (dump_func)dump_create_class_request,
     (dump_func)dump_destroy_class_request,
     (dump_func)dump_set_class_info_request,
@@ -3694,7 +3695,7 @@
     (dump_func)dump_remove_hook_reply,
     (dump_func)dump_start_hook_chain_reply,
     (dump_func)0,
-    (dump_func)dump_get_next_hook_reply,
+    (dump_func)dump_get_hook_info_reply,
     (dump_func)0,
     (dump_func)dump_destroy_class_reply,
     (dump_func)dump_set_class_info_reply,
@@ -3911,7 +3912,7 @@
     "remove_hook",
     "start_hook_chain",
     "finish_hook_chain",
-    "get_next_hook",
+    "get_hook_info",
     "create_class",
     "destroy_class",
     "set_class_info",