From 65adc24f14d87bbaefe8cfa51e6060096b394e4a Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Fri, 31 May 2002 18:25:53 +0000
Subject: [PATCH] Fixed next_user_handle to also work on deleted handles.

---
 server/user.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/server/user.c b/server/user.c
index c4a16cc6d3d..b4f3e0e571c 100644
--- a/server/user.c
+++ b/server/user.c
@@ -146,8 +146,9 @@ void *next_user_handle( user_handle_t *handle, enum user_object type )
     if (!*handle) entry = handles;
     else
     {
-        if (!(entry = handle_to_entry( *handle ))) return NULL;
-        entry++;  /* start from the next one */
+        int index = (*handle & 0xffff) - FIRST_USER_HANDLE;
+        if (index < 0 || index >= nb_handles) return NULL;
+        entry = handles + index + 1;  /* start from the next one */
     }
     while (entry < handles + nb_handles)
     {
-- 
GitLab