dplayx: Send ADDPLAYERTOGROUP in AddPlayerToGroup().

This commit is contained in:
Anton Baskanov 2024-11-17 19:38:34 +07:00 committed by Alexandre Julliard
parent 28581f00d6
commit e72bd3a7a0
Notes: Alexandre Julliard 2024-11-19 23:21:50 +01:00
Approved-by: Alistair Leslie-Hughes (@alesliehughes)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6844
4 changed files with 61 additions and 16 deletions

View file

@ -1231,20 +1231,11 @@ static HRESULT WINAPI IDirectPlay4Impl_AddPlayerToGroup( IDirectPlay4 *iface, DP
* Also, if this event was the result of another machine sending it to us, * Also, if this event was the result of another machine sending it to us,
* don't bother rebroadcasting it. * don't bother rebroadcasting it.
*/ */
if ( This->dp2->lpSessionDesc && hr = DP_MSG_SendAddPlayerToGroup( This, DPID_ALLPLAYERS, player, group );
( This->dp2->lpSessionDesc->dwFlags & DPSESSION_MULTICASTSERVER ) ) if( FAILED( hr ) )
{ {
DPMSG_ADDPLAYERTOGROUP msg; LeaveCriticalSection( &This->lock );
msg.dwType = DPSYS_ADDPLAYERTOGROUP; return hr;
msg.dpIdGroup = group;
msg.dpIdPlayer = player;
/* FIXME: Correct to just use send effectively? */
/* FIXME: Should size include data w/ message or just message "header" */
/* FIXME: Check return code */
IDirectPlayX_SendEx( iface, DPID_SERVERPLAYER, DPID_ALLPLAYERS, 0, &msg, sizeof( msg ),
0, 0, NULL, NULL );
} }
LeaveCriticalSection( &This->lock ); LeaveCriticalSection( &This->lock );

View file

@ -831,6 +831,49 @@ HRESULT DP_MSG_SendCreatePlayer( IDirectPlayImpl *This, DPID toId, DPID id, DWOR
return DP_OK; return DP_OK;
} }
HRESULT DP_MSG_SendAddPlayerToGroup( IDirectPlayImpl *This, DPID toId, DPID playerId, DPID groupId )
{
DPSP_SENDTOGROUPEXDATA sendData;
DPSP_MSG_ADDPLAYERTOGROUP msg;
SGBUFFER buffers[ 2 ] = { 0 };
HRESULT hr;
msg.envelope.dwMagic = DPMSGMAGIC_DPLAYMSG;
msg.envelope.wCommandId = DPMSGCMD_ADDPLAYERTOGROUP;
msg.envelope.wVersion = DPMSGVER_DP6;
msg.toId = 0;
msg.playerId = playerId;
msg.groupId = groupId;
msg.createOffset = 0;
msg.passwordOffset = 0;
buffers[ 0 ].len = This->dp2->spData.dwSPHeaderSize;
buffers[ 0 ].pData = NULL;
buffers[ 1 ].len = sizeof( msg );
buffers[ 1 ].pData = (UCHAR *)&msg;
sendData.lpISP = This->dp2->spData.lpISP;
sendData.dwFlags = DPSEND_GUARANTEED;
sendData.idGroupTo = toId;
sendData.idPlayerFrom = This->dp2->systemPlayerId;
sendData.lpSendBuffers = buffers;
sendData.cBuffers = ARRAYSIZE( buffers );
sendData.dwMessageSize = DP_MSG_ComputeMessageSize( sendData.lpSendBuffers, sendData.cBuffers );
sendData.dwPriority = 0;
sendData.dwTimeout = 0;
sendData.lpDPContext = NULL;
sendData.lpdwSPMsgID = NULL;
hr = (*This->dp2->spData.lpCB->SendToGroupEx)( &sendData );
if( FAILED( hr ) )
{
ERR( "SendToGroupEx failed: %s\n", DPLAYX_HresultToString( hr ) );
return hr;
}
return DP_OK;
}
HRESULT DP_MSG_SendPingReply( IDirectPlayImpl *This, DPID toId, DPID fromId, DWORD tickCount ) HRESULT DP_MSG_SendPingReply( IDirectPlayImpl *This, DPID toId, DPID fromId, DWORD tickCount )
{ {
SGBUFFER buffers[ 2 ] = { 0 }; SGBUFFER buffers[ 2 ] = { 0 };

View file

@ -57,6 +57,8 @@ HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlayImpl *This, DPID dpidServer, WC
HRESULT DP_MSG_SendCreatePlayer( IDirectPlayImpl *This, DPID toId, DPID id, DWORD flags, HRESULT DP_MSG_SendCreatePlayer( IDirectPlayImpl *This, DPID toId, DPID id, DWORD flags,
DPNAME *name, void *playerData, DWORD playerDataSize, DPNAME *name, void *playerData, DWORD playerDataSize,
DPID systemPlayerId ); DPID systemPlayerId );
HRESULT DP_MSG_SendAddPlayerToGroup( IDirectPlayImpl *This, DPID toId, DPID playerId,
DPID groupId );
HRESULT DP_MSG_SendPingReply( IDirectPlayImpl *This, DPID toId, DPID fromId, DWORD tickCount ); HRESULT DP_MSG_SendPingReply( IDirectPlayImpl *This, DPID toId, DPID fromId, DWORD tickCount );
HRESULT DP_MSG_SendAddForwardAck( IDirectPlayImpl *This, DPID id ); HRESULT DP_MSG_SendAddForwardAck( IDirectPlayImpl *This, DPID id );
@ -103,6 +105,7 @@ typedef struct
#define DPMSGCMD_SYSTEMMESSAGE 10 #define DPMSGCMD_SYSTEMMESSAGE 10
#define DPMSGCMD_DELETEPLAYER 11 #define DPMSGCMD_DELETEPLAYER 11
#define DPMSGCMD_DELETEGROUP 12 #define DPMSGCMD_DELETEGROUP 12
#define DPMSGCMD_ADDPLAYERTOGROUP 13
#define DPMSGCMD_ENUMGROUPS 17 #define DPMSGCMD_ENUMGROUPS 17
@ -231,6 +234,16 @@ typedef struct tagDPMSG_NEWPLAYERIDREPLY
} DPMSG_NEWPLAYERIDREPLY, *LPDPMSG_NEWPLAYERIDREPLY; } DPMSG_NEWPLAYERIDREPLY, *LPDPMSG_NEWPLAYERIDREPLY;
typedef const DPMSG_NEWPLAYERIDREPLY* LPCDPMSG_NEWPLAYERIDREPLY; typedef const DPMSG_NEWPLAYERIDREPLY* LPCDPMSG_NEWPLAYERIDREPLY;
typedef struct
{
DPMSG_SENDENVELOPE envelope;
DPID toId;
DPID playerId;
DPID groupId;
DWORD createOffset;
DWORD passwordOffset;
} DPSP_MSG_ADDPLAYERTOGROUP;
typedef struct tagDPMSG_FORWARDADDPLAYER typedef struct tagDPMSG_FORWARDADDPLAYER
{ {
DPMSG_SENDENVELOPE envelope; DPMSG_SENDENVELOPE envelope;

View file

@ -2193,9 +2193,7 @@ static unsigned short receiveAddPlayerToGroup_( int line, SOCKET sock, DPID expe
int wsResult; int wsResult;
wsResult = receiveMessage_( line, sock, &request, sizeof( request ) ); wsResult = receiveMessage_( line, sock, &request, sizeof( request ) );
todo_wine ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult ); ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
if ( wsResult == SOCKET_ERROR )
return 0;
port = checkSpHeader_( line, &request.spHeader, sizeof( request ) ); port = checkSpHeader_( line, &request.spHeader, sizeof( request ) );
checkMessageHeader_( line, &request.request.header, 13 ); checkMessageHeader_( line, &request.request.header, 13 );