diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 4a4fe8d2619..b355310f20d 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -1134,6 +1134,7 @@ static HRESULT WINAPI IDirectPlay4AImpl_AddPlayerToGroup( IDirectPlay4A *iface, HRESULT DP_AddPlayerToGroup( IDirectPlayImpl *This, DPID group, DPID player ) { + DPMSG_ADDPLAYERTOGROUP addPlayerToGroupMsg; lpGroupData gdata; lpPlayerList plist; lpPlayerList newplist; @@ -1180,6 +1181,28 @@ HRESULT DP_AddPlayerToGroup( IDirectPlayImpl *This, DPID group, DPID player ) } } + addPlayerToGroupMsg.dwType = DPSYS_ADDPLAYERTOGROUP; + addPlayerToGroupMsg.dpIdGroup = group; + addPlayerToGroupMsg.dpIdPlayer = player; + + hr = DP_QueueMessage( This, DPID_SYSMSG, DPID_ALLPLAYERS, 0, &addPlayerToGroupMsg, + DP_CopyGeneric, sizeof( DPMSG_ADDPLAYERTOGROUP ) ); + if ( FAILED( hr ) ) + { + if ( This->dp2->spData.lpCB->RemovePlayerFromGroup ) + { + DPSP_REMOVEPLAYERFROMGROUPDATA data; + data.idPlayer = player; + data.idGroup = group; + data.lpISP = This->dp2->spData.lpISP; + This->dp2->spData.lpCB->RemovePlayerFromGroup( &data ); + } + DPQ_REMOVE( gdata->players, newplist, players ); + --plist->lpPData->uRef; + free( newplist ); + return hr; + } + return DP_OK; } diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c index ffb66b538d0..cb61c946bf4 100644 --- a/dlls/dplayx/tests/dplayx.c +++ b/dlls/dplayx/tests/dplayx.c @@ -9058,9 +9058,7 @@ static DPID checkAddPlayerToGroupMessage_( int line, IDirectPlay4 *dp, DPID expe fromId = 0xdeadbeef; toId = 0xdeadbeef; hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize ); - todo_wine ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr ); - if ( FAILED( hr ) ) - return 0; + ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr ); ok_( __FILE__, line )( fromId == DPID_SYSMSG, "got source id %#lx.\n", fromId ); msg = (DPMSG_ADDPLAYERTOGROUP *) msgData; @@ -9112,7 +9110,7 @@ static void test_AddPlayerToGroup(void) ok( hr == DP_OK, "got hr %#lx.\n", hr ); dpid = checkAddPlayerToGroupMessage( dp, 0x5e7, 0x07734 ); - todo_wine ok( dpid == 0x07734, "got destination id %#lx.\n", dpid ); + ok( dpid == 0x07734, "got destination id %#lx.\n", dpid ); receiveAddPlayerToGroup( recvSock, 0x07734, 0x5e7 );