From 7ec576a7bd8535ee764165a968f928802fc00a97 Mon Sep 17 00:00:00 2001 From: Anton Baskanov Date: Sun, 17 Nov 2024 18:39:32 +0700 Subject: [PATCH] dplayx: Add group players from SUPERENUMPLAYERSREPLY to the group. --- dlls/dplayx/dplay.c | 2 +- dlls/dplayx/dplay_global.h | 1 + dlls/dplayx/dplayx_messages.c | 12 ++++++++++++ dlls/dplayx/tests/dplayx.c | 4 ++-- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 9b3b69d0a70..4a4fe8d2619 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -1132,7 +1132,7 @@ static HRESULT WINAPI IDirectPlay4AImpl_AddPlayerToGroup( IDirectPlay4A *iface, return IDirectPlayX_AddPlayerToGroup( &This->IDirectPlay4_iface, group, player ); } -static HRESULT DP_AddPlayerToGroup( IDirectPlayImpl *This, DPID group, DPID player ) +HRESULT DP_AddPlayerToGroup( IDirectPlayImpl *This, DPID group, DPID player ) { lpGroupData gdata; lpPlayerList plist; diff --git a/dlls/dplayx/dplay_global.h b/dlls/dplayx/dplay_global.h index 392e0d3232d..8883a2b43ad 100644 --- a/dlls/dplayx/dplay_global.h +++ b/dlls/dplayx/dplay_global.h @@ -221,6 +221,7 @@ HRESULT DP_CreatePlayer( IDirectPlayImpl *This, void *msgHeader, DPID *lpid, DPN HRESULT DP_CreateGroup( IDirectPlayImpl *This, void *msgHeader, const DPID *lpid, const DPNAME *lpName, void *data, DWORD dataSize, DWORD dwFlags, DPID idParent, BOOL bAnsi ); +HRESULT DP_AddPlayerToGroup( IDirectPlayImpl *This, DPID group, DPID player ); /* DP SP external interfaces into DirectPlay */ extern HRESULT DP_GetSPPlayerData( IDirectPlayImpl *lpDP, DPID idPlayer, void **lplpData ); diff --git a/dlls/dplayx/dplayx_messages.c b/dlls/dplayx/dplayx_messages.c index 93a80283b69..d81e29a7e0b 100644 --- a/dlls/dplayx/dplayx_messages.c +++ b/dlls/dplayx/dplayx_messages.c @@ -679,6 +679,7 @@ HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlayImpl *This, DPID dpidServer, WC for( i = 0; i < enumPlayersReply->groupCount; ++i ) { DPPLAYERINFO playerInfo; + int j; hr = DP_MSG_ReadSuperPackedPlayer( (char *) enumPlayersReply, &offset, dwMsgSize, &playerInfo ); @@ -699,6 +700,17 @@ HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlayImpl *This, DPID dpidServer, WC free( lpMsg ); return hr; } + + for( j = 0; j < playerInfo.playerCount; ++j ) + { + hr = DP_AddPlayerToGroup( This, playerInfo.id, playerInfo.playerIds[ j ] ); + if( FAILED( hr ) ) + { + free( msgHeader ); + free( lpMsg ); + return hr; + } + } } } else if( envelope->wCommandId == DPMSGCMD_GETNAMETABLEREPLY ) diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c index 00b5aad6708..d8869b58a40 100644 --- a/dlls/dplayx/tests/dplayx.c +++ b/dlls/dplayx/tests/dplayx.c @@ -2969,8 +2969,8 @@ static void checkGroupPlayerList_( int line, DPID group, IDirectPlay4 *dp, Expec hr = IDirectPlayX_EnumGroupPlayers( dp, group, NULL, checkPlayerListCallback, &data, DPENUMPLAYERS_REMOTE ); ok_( __FILE__, line )( hr == DP_OK, "EnumGroupPlayers() returned %#lx.\n", hr ); - todo_wine ok_( __FILE__, line )( data.actualPlayerCount == data.expectedPlayerCount, "got player count %d.\n", - data.actualPlayerCount ); + ok_( __FILE__, line )( data.actualPlayerCount == data.expectedPlayerCount, "got player count %d.\n", + data.actualPlayerCount ); } #define checkGroupList( dp, expectedGroups, expectedGroupCount ) \