From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 14 +++++++++++--- dlls/dplayx/name_server.c | 30 ++++-------------------------- dlls/dplayx/name_server.h | 3 +-- 3 files changed, 16 insertions(+), 31 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 125d50c5524..d77a6375748 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -2344,7 +2344,7 @@ static BOOL DP_InvokeEnumSessionCallbacks
/* Enumerate all sessions */ /* FIXME: Need to indicate ANSI */ - while( (lpSessionDesc = NS_WalkSessions( lpNSInfo ) ) != NULL ) + while( (lpSessionDesc = NS_WalkSessions( lpNSInfo, NULL ) ) != NULL ) { TRACE( "EnumSessionsCallback2 invoked\n" ); if( !lpEnumSessionsCallback2( lpSessionDesc, timeout, 0, lpContext ) ) @@ -3328,8 +3328,16 @@ static HRESULT DP_SecureOpen( IDirectPlayImpl *This, const DPSESSIONDESC2 *lpsd, } else { - spMessageHeader = NS_GetNSAddr( This->dp2->lpNameServerData ); - if ( !spMessageHeader ) + DPSESSIONDESC2 *sessionDesc; + + EnterCriticalSection( &This->lock ); + + NS_ResetSessionEnumeration( This->dp2->lpNameServerData ); + + LeaveCriticalSection( &This->lock ); + + sessionDesc = NS_WalkSessions( This->dp2->lpNameServerData, &spMessageHeader ); + if ( !sessionDesc ) return DPERR_NOSESSIONS; }
diff --git a/dlls/dplayx/name_server.c b/dlls/dplayx/name_server.c index 3ea895c269d..755288a4e57 100644 --- a/dlls/dplayx/name_server.c +++ b/dlls/dplayx/name_server.c @@ -155,31 +155,6 @@ void NS_AddRemoteComputerAsNameServer( LPCVOID lpcNSAddrHdr NS_PruneSessionCache( lpNSInfo ); }
-LPVOID NS_GetNSAddr( LPVOID lpNSInfo ) -{ - lpNSCache lpCache = (lpNSCache)lpNSInfo; - - FIXME( ":quick stub\n" ); - - /* Ok. Cheat and don't search for the correct stuff just take the first. - * FIXME: In the future how are we to know what is _THE_ enum we used? - * This is going to have to go into dplay somehow. Perhaps it - * comes back with app server id for the join command! Oh... that - * must be it. That would make this method obsolete once that's - * in place. - */ -#if 1 - if ( lpCache->walkFirst.lpQHFirst ) - return lpCache->walkFirst.lpQHFirst->lpNSAddrHdr; - - return NULL; -#else - /* FIXME: Should convert over to this */ - return lpCache->bNsIsLocal ? lpCache->lpLocalAddrHdr - : lpCache->lpRemoteAddrHdr; -#endif -} - void NS_SetLocalAddr( LPVOID lpNSInfo, LPCVOID lpHdr, DWORD dwHdrSize ) { lpNSCache lpCache = (lpNSCache)lpNSInfo; @@ -305,7 +280,7 @@ void NS_ResetSessionEnumeration( LPVOID lpNSInfo ) ((lpNSCache)lpNSInfo)->present = ((lpNSCache)lpNSInfo)->walkFirst.lpQHFirst; }
-LPDPSESSIONDESC2 NS_WalkSessions( LPVOID lpNSInfo ) +LPDPSESSIONDESC2 NS_WalkSessions( LPVOID lpNSInfo, void **spMessageHeader ) { LPDPSESSIONDESC2 lpSessionDesc; lpNSCache lpCache = (lpNSCache)lpNSInfo; @@ -318,6 +293,9 @@ LPDPSESSIONDESC2 NS_WalkSessions( LPVOID lpNSInfo )
lpSessionDesc = lpCache->present->data;
+ if( spMessageHeader ) + *spMessageHeader = lpCache->present->lpNSAddrHdr; + /* Advance tracking pointer */ lpCache->present = lpCache->present->walkNext.lpQNext;
diff --git a/dlls/dplayx/name_server.h b/dlls/dplayx/name_server.h index e4fb11db22e..ad51a550b9c 100644 --- a/dlls/dplayx/name_server.h +++ b/dlls/dplayx/name_server.h @@ -34,7 +34,6 @@ void NS_AddRemoteComputerAsNameServer( LPCVOID lpNSAddrHdr, LPCDPMSG_ENUMSESSIONSREPLY lpcMsg, DWORD msgSize, LPVOID lpNSInfo ); -LPVOID NS_GetNSAddr( LPVOID lpNSInfo ); void NS_SetLocalAddr( LPVOID lpNSInfo, LPCVOID lpHdr, DWORD dwHdrSize );
void NS_ReplyToEnumSessionsRequest( LPCVOID lpcMsg, @@ -54,7 +53,7 @@ void NS_InvalidateSessionCache( LPVOID lpNSInfo );
void NS_ResetSessionEnumeration( LPVOID lpNSInfo ); -LPDPSESSIONDESC2 NS_WalkSessions( LPVOID lpNSInfo ); +LPDPSESSIONDESC2 NS_WalkSessions( LPVOID lpNSInfo, void **spMessageHeader ); void NS_PruneSessionCache( LPVOID lpNSInfo );
#endif /* __WINE_DPLAYX_NAMESERVER */