Jinoh Kang (@iamahuman) commented about dlls/win32u/winstation.c:
+ BOOL valid = TRUE; + + TRACE( "tid %04x, type %u\n", tid, type ); + + memset( info, 0, sizeof(*info) ); + info->index = -1; + + while ((session = get_shared_session( !valid ))) + { + info->session_id = session->id; + if ((info->index = get_thread_session_object_index( tid, type, &info->id )) == -1) break; + if ((valid = info->index < session->object_capacity)) break; + shared_session_release( session ); + } + + if (valid && info->index == -1) My previous suggestion was wrong:
```suggestion:-0+0 if (!valid || info->index == -1) ``` But this is hard to understand too. Instead of `break;`-ing out of the loop on failure, I wonder if we can just put success logic (`...; return TRUE`) inside the loop. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3103#note_64970