dplayx: Queue DPSYS_ADDPLAYERTOGROUP in DP_AddPlayerToGroup().

This commit is contained in:
Anton Baskanov 2024-11-17 19:33:21 +07:00 committed by Alexandre Julliard
parent f37853f532
commit 28581f00d6
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
2 changed files with 25 additions and 4 deletions

View file

@ -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;
}

View file

@ -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 );