From: Anton Baskanov <baskanov(a)gmail.com> --- dlls/dplayx/dplay.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 854c266aa4f..60d978a6000 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -2474,12 +2474,21 @@ static HRESULT WINAPI IDirectPlay4Impl_EnumSessions( IDirectPlay4 *iface, DPSESS return hr; } - if ( flags & DPENUMSESSIONS_ASYNC ) + if ( !(flags & DPENUMSESSIONS_ASYNC) ) { - /* Enumerate everything presently in the local session cache */ - DP_InvokeEnumSessionCallbacks( enumsessioncb, This->dp2->lpNameServerData, timeout, - context ); + /* Invalidate the session cache for the interface */ + NS_InvalidateSessionCache( This->dp2->lpNameServerData ); + /* Send the broadcast for session enumeration */ + hr = NS_SendSessionRequestBroadcast( &sdesc->guidApplication, flags, &This->dp2->spData ); + if ( FAILED( hr ) ) + return hr; + SleepEx( timeout, FALSE ); + } + DP_InvokeEnumSessionCallbacks( enumsessioncb, This->dp2->lpNameServerData, timeout, context ); + + if ( flags & DPENUMSESSIONS_ASYNC ) + { if ( This->dp2->dwEnumSessionLock ) return DPERR_CONNECTING; @@ -2517,16 +2526,6 @@ static HRESULT WINAPI IDirectPlay4Impl_EnumSessions( IDirectPlay4 *iface, DPSESS This->dp2->dwEnumSessionLock--; } } - else - { - /* Invalidate the session cache for the interface */ - NS_InvalidateSessionCache( This->dp2->lpNameServerData ); - /* Send the broadcast for session enumeration */ - hr = NS_SendSessionRequestBroadcast( &sdesc->guidApplication, flags, &This->dp2->spData ); - SleepEx( timeout, FALSE ); - DP_InvokeEnumSessionCallbacks( enumsessioncb, This->dp2->lpNameServerData, timeout, - context ); - } return hr; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6516