mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-19 17:06:04 -07:00
dplayx/tests: Check that groups from SUPERENUMPLAYERSREPLY are added to the session.
This commit is contained in:
parent
696ef034db
commit
46b79b1856
Notes:
Alexandre Julliard
2024-11-18 23:18:20 +01:00
Approved-by: Alistair Leslie-Hughes (@alesliehughes) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6829
1 changed files with 248 additions and 77 deletions
|
@ -1444,19 +1444,46 @@ static void sendSuperEnumPlayersReply_( int line, SOCKET sock, unsigned short tc
|
|||
SuperEnumPlayersReply reply;
|
||||
DPSESSIONDESC2 dpsd;
|
||||
WCHAR sessionName[ 256 ];
|
||||
SuperPackedPlayer superPackedPlayer0;
|
||||
BYTE spDataLength0;
|
||||
SpData spData0;
|
||||
SuperPackedPlayer superPackedPlayer1;
|
||||
BYTE spDataLength1;
|
||||
SpData spData1;
|
||||
SuperPackedPlayer superPackedPlayer2;
|
||||
WCHAR shortName[ ARRAYSIZE( SHORT_NAME ) ];
|
||||
WCHAR longName[ ARRAYSIZE( LONG_NAME ) ];
|
||||
BYTE playerDataLength2;
|
||||
BYTE playerData[ 4 ];
|
||||
BYTE spDataLength2;
|
||||
SpData spData2;
|
||||
struct
|
||||
{
|
||||
SuperPackedPlayer superPackedPlayer;
|
||||
BYTE spDataLength;
|
||||
SpData spData;
|
||||
} player0;
|
||||
struct
|
||||
{
|
||||
SuperPackedPlayer superPackedPlayer;
|
||||
BYTE spDataLength;
|
||||
SpData spData;
|
||||
} player1;
|
||||
struct
|
||||
{
|
||||
SuperPackedPlayer superPackedPlayer;
|
||||
WCHAR shortName[ ARRAYSIZE( SHORT_NAME ) ];
|
||||
WCHAR longName[ ARRAYSIZE( LONG_NAME ) ];
|
||||
BYTE playerDataLength;
|
||||
BYTE playerData[ 4 ];
|
||||
BYTE spDataLength;
|
||||
SpData spData;
|
||||
} player2;
|
||||
struct
|
||||
{
|
||||
SuperPackedPlayer superPackedPlayer;
|
||||
BYTE spDataLength;
|
||||
SpData spData;
|
||||
} player3;
|
||||
struct
|
||||
{
|
||||
SuperPackedPlayer superPackedPlayer;
|
||||
WCHAR shortName[ ARRAYSIZE( SHORT_NAME ) ];
|
||||
WCHAR longName[ ARRAYSIZE( LONG_NAME ) ];
|
||||
BYTE playerDataLength;
|
||||
BYTE playerData[ 4 ];
|
||||
BYTE spDataLength;
|
||||
SpData spData;
|
||||
BYTE playerCount;
|
||||
DPID playerIds[ 1 ];
|
||||
} group0;
|
||||
} reply =
|
||||
{
|
||||
.spHeader =
|
||||
|
@ -1476,8 +1503,8 @@ static void sendSuperEnumPlayersReply_( int line, SOCKET sock, unsigned short tc
|
|||
.command = 41,
|
||||
.version = 14,
|
||||
},
|
||||
.playerCount = 3,
|
||||
.groupCount = 0,
|
||||
.playerCount = 4,
|
||||
.groupCount = 1,
|
||||
.packedOffset = sizeof( reply.reply ) + sizeof( reply.dpsd ) + sizeof( reply.sessionName ),
|
||||
.shortcutCount = 0,
|
||||
.descriptionOffset = sizeof( reply.reply ),
|
||||
|
@ -1485,76 +1512,141 @@ static void sendSuperEnumPlayersReply_( int line, SOCKET sock, unsigned short tc
|
|||
.passwordOffset = 0,
|
||||
},
|
||||
.dpsd = *dpsd,
|
||||
.superPackedPlayer0 =
|
||||
.player0 =
|
||||
{
|
||||
.size = 16,
|
||||
.flags = 0x5,
|
||||
.id = 0x12345678,
|
||||
.infoMask = 0x4,
|
||||
.versionOrSystemPlayerId = 14,
|
||||
},
|
||||
.spDataLength0 = sizeof( SpData ),
|
||||
.spData0 =
|
||||
{
|
||||
.tcpAddr =
|
||||
.superPackedPlayer =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( tcpPort ),
|
||||
.size = 16,
|
||||
.flags = 0x5,
|
||||
.id = 0x12345678,
|
||||
.infoMask = 0x4,
|
||||
.versionOrSystemPlayerId = 14,
|
||||
},
|
||||
.udpAddr =
|
||||
.spDataLength = sizeof( SpData ),
|
||||
.spData =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( udpPort ),
|
||||
.tcpAddr =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( tcpPort ),
|
||||
},
|
||||
.udpAddr =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( udpPort ),
|
||||
},
|
||||
},
|
||||
},
|
||||
.superPackedPlayer1 =
|
||||
.player1 =
|
||||
{
|
||||
.size = 16,
|
||||
.flags = 0xf,
|
||||
.id = 0x51573,
|
||||
.infoMask = 0x4,
|
||||
.versionOrSystemPlayerId = 14,
|
||||
},
|
||||
.spDataLength1 = sizeof( SpData ),
|
||||
.spData1 =
|
||||
{
|
||||
.tcpAddr =
|
||||
.superPackedPlayer =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( tcpPort ),
|
||||
.size = 16,
|
||||
.flags = 0xf,
|
||||
.id = 0x51573,
|
||||
.infoMask = 0x4,
|
||||
.versionOrSystemPlayerId = 14,
|
||||
},
|
||||
.udpAddr =
|
||||
.spDataLength = sizeof( SpData ),
|
||||
.spData =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( udpPort ),
|
||||
.tcpAddr =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( tcpPort ),
|
||||
},
|
||||
.udpAddr =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( udpPort ),
|
||||
},
|
||||
},
|
||||
},
|
||||
.superPackedPlayer2 =
|
||||
.player2 =
|
||||
{
|
||||
.size = 16,
|
||||
.flags = 0x8,
|
||||
.id = 0x1337,
|
||||
.infoMask = 0x17,
|
||||
.versionOrSystemPlayerId = 0x51573,
|
||||
.superPackedPlayer =
|
||||
{
|
||||
.size = 16,
|
||||
.flags = 0x8,
|
||||
.id = 0x1337,
|
||||
.infoMask = 0x17,
|
||||
.versionOrSystemPlayerId = 0x51573,
|
||||
},
|
||||
.shortName = SHORT_NAME,
|
||||
.longName = LONG_NAME,
|
||||
.playerDataLength = 4,
|
||||
.playerData = { 1, 2, 3, 4, },
|
||||
.spDataLength = sizeof( SpData ),
|
||||
.spData =
|
||||
{
|
||||
.tcpAddr =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( tcpPort ),
|
||||
},
|
||||
.udpAddr =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( udpPort ),
|
||||
},
|
||||
},
|
||||
},
|
||||
.shortName = SHORT_NAME,
|
||||
.longName = LONG_NAME,
|
||||
.playerDataLength2 = 4,
|
||||
.playerData = { 1, 2, 3, 4, },
|
||||
.spDataLength2 = sizeof( SpData ),
|
||||
.spData2 =
|
||||
.player3 =
|
||||
{
|
||||
.tcpAddr =
|
||||
.superPackedPlayer =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( tcpPort ),
|
||||
.size = 16,
|
||||
.flags = 0x8,
|
||||
.id = 0xd00de,
|
||||
.infoMask = 0x4,
|
||||
.versionOrSystemPlayerId = 0x51573,
|
||||
},
|
||||
.udpAddr =
|
||||
.spDataLength = sizeof( SpData ),
|
||||
.spData =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( udpPort ),
|
||||
.tcpAddr =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( tcpPort ),
|
||||
},
|
||||
.udpAddr =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( udpPort ),
|
||||
},
|
||||
},
|
||||
},
|
||||
.group0 =
|
||||
{
|
||||
.superPackedPlayer =
|
||||
{
|
||||
.size = 16,
|
||||
.flags = 0x48,
|
||||
.id = 0x5e7,
|
||||
.infoMask = 0x57,
|
||||
.versionOrSystemPlayerId = 0x51573,
|
||||
},
|
||||
.shortName = SHORT_NAME,
|
||||
.longName = LONG_NAME,
|
||||
.playerDataLength = 4,
|
||||
.playerData = { 1, 2, 3, 4, },
|
||||
.spDataLength = sizeof( SpData ),
|
||||
.spData =
|
||||
{
|
||||
.tcpAddr =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( tcpPort ),
|
||||
},
|
||||
.udpAddr =
|
||||
{
|
||||
.sin_family = AF_INET,
|
||||
.sin_port = htons( udpPort ),
|
||||
},
|
||||
},
|
||||
.playerCount = 1,
|
||||
.playerIds = { 0xd00de, },
|
||||
},
|
||||
};
|
||||
#include "poppack.h"
|
||||
#undef LONG_NAME
|
||||
|
@ -2765,7 +2857,10 @@ static BOOL CALLBACK checkPlayerListCallback( DPID dpid, DWORD playerType, const
|
|||
|
||||
memset( &playerData, 0xcc, sizeof( playerData ) );
|
||||
playerDataSize = sizeof( playerData );
|
||||
hr = IDirectPlayX_GetPlayerData( data->dp, dpid, playerData, &playerDataSize, DPGET_REMOTE );
|
||||
if ( playerType == DPPLAYERTYPE_PLAYER )
|
||||
hr = IDirectPlayX_GetPlayerData( data->dp, dpid, playerData, &playerDataSize, DPGET_REMOTE );
|
||||
else
|
||||
hr = IDirectPlayX_GetGroupData( data->dp, dpid, playerData, &playerDataSize, DPGET_REMOTE );
|
||||
ok_( __FILE__, data->line )( hr == DP_OK, "GetPlayerData() returned %#lx.\n", hr );
|
||||
ok_( __FILE__, data->line )( playerDataSize == player->expectedPlayerDataSize,
|
||||
"got player data size %lu.\n", playerDataSize );
|
||||
|
@ -2774,7 +2869,10 @@ static BOOL CALLBACK checkPlayerListCallback( DPID dpid, DWORD playerType, const
|
|||
|
||||
memset( &nameData, 0xcc, sizeof( nameData ) );
|
||||
nameDataSize = sizeof( nameData );
|
||||
hr = IDirectPlayX_GetPlayerName( data->dp, dpid, &nameData, &nameDataSize );
|
||||
if ( playerType == DPPLAYERTYPE_PLAYER )
|
||||
hr = IDirectPlayX_GetPlayerName( data->dp, dpid, &nameData, &nameDataSize );
|
||||
else
|
||||
hr = IDirectPlayX_GetGroupName( data->dp, dpid, &nameData, &nameDataSize );
|
||||
ok_( __FILE__, data->line )( hr == DP_OK, "GetPlayerName() returned %#lx.\n", hr );
|
||||
ok_( __FILE__, data->line )( ((DPNAME *) nameData)->dwSize == sizeof( DPNAME ),
|
||||
"got name size %lu.\n", ((DPNAME *) nameData)->dwSize );
|
||||
|
@ -2830,7 +2928,8 @@ static BOOL CALLBACK checkPlayerListCallback( DPID dpid, DWORD playerType, const
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#define checkPlayerList( dp, expectedPlayers, expectedPlayerCount ) checkPlayerList_( __LINE__, dp, expectedPlayers, expectedPlayerCount )
|
||||
#define checkPlayerList( dp, expectedPlayers, expectedPlayerCount ) \
|
||||
checkPlayerList_( __LINE__, dp, expectedPlayers, expectedPlayerCount )
|
||||
static void checkPlayerList_( int line, IDirectPlay4 *dp, ExpectedPlayer *expectedPlayers, int expectedPlayerCount )
|
||||
{
|
||||
CheckPlayerListCallbackData data = {
|
||||
|
@ -2851,6 +2950,51 @@ static void checkPlayerList_( int line, IDirectPlay4 *dp, ExpectedPlayer *expect
|
|||
data.actualPlayerCount );
|
||||
}
|
||||
|
||||
#define checkGroupPlayerList( dp, group, expectedPlayers, expectedPlayerCount ) \
|
||||
checkGroupPlayerList_( __LINE__, dp, group, expectedPlayers, expectedPlayerCount )
|
||||
static void checkGroupPlayerList_( int line, DPID group, IDirectPlay4 *dp, ExpectedPlayer *expectedPlayers,
|
||||
int expectedPlayerCount )
|
||||
{
|
||||
CheckPlayerListCallbackData data = {
|
||||
.line = line,
|
||||
.dp = dp,
|
||||
.expectedPlayers = expectedPlayers,
|
||||
.expectedPlayerCount = expectedPlayerCount,
|
||||
};
|
||||
HRESULT hr;
|
||||
|
||||
hr = IDirectPlayX_EnumGroupPlayers( dp, group, NULL, checkPlayerListCallback, &data, DPENUMPLAYERS_LOCAL );
|
||||
todo_wine ok_( __FILE__, line )( hr == DP_OK, "EnumGroupPlayers() returned %#lx.\n", hr );
|
||||
|
||||
hr = IDirectPlayX_EnumGroupPlayers( dp, group, NULL, checkPlayerListCallback, &data, DPENUMPLAYERS_REMOTE );
|
||||
todo_wine 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 );
|
||||
}
|
||||
|
||||
#define checkGroupList( dp, expectedGroups, expectedGroupCount ) \
|
||||
checkGroupList_( __LINE__, dp, expectedGroups, expectedGroupCount )
|
||||
static void checkGroupList_( int line, IDirectPlay4 *dp, ExpectedPlayer *expectedGroups, int expectedGroupCount )
|
||||
{
|
||||
CheckPlayerListCallbackData data = {
|
||||
.line = line,
|
||||
.dp = dp,
|
||||
.expectedPlayers = expectedGroups,
|
||||
.expectedPlayerCount = expectedGroupCount,
|
||||
};
|
||||
HRESULT hr;
|
||||
|
||||
hr = IDirectPlayX_EnumGroups( dp, NULL, checkPlayerListCallback, &data, DPENUMGROUPS_LOCAL );
|
||||
ok_( __FILE__, line )( hr == DP_OK, "EnumGroups() returned %#lx.\n", hr );
|
||||
|
||||
hr = IDirectPlayX_EnumGroups( dp, NULL, checkPlayerListCallback, &data, DPENUMGROUPS_REMOTE );
|
||||
ok_( __FILE__, line )( hr == DP_OK, "EnumGroups() returned %#lx.\n", hr );
|
||||
|
||||
todo_wine ok_( __FILE__, line )( data.actualPlayerCount == data.expectedPlayerCount, "got group count %d.\n",
|
||||
data.actualPlayerCount );
|
||||
}
|
||||
|
||||
#define checkPlayerExists( dp, expectedDpid, expectedPlayerType, expectedShortName, expectedLongName, expectedFlags, \
|
||||
expectedPlayerData, expectedPlayerDataSize ) \
|
||||
checkPlayerExists_( __LINE__, dp, expectedDpid, expectedPlayerType, expectedShortName, expectedLongName, \
|
||||
|
@ -2952,9 +3096,36 @@ static void check_Open_( int line, IDirectPlay4A *dp, DPSESSIONDESC2 *dpsd, cons
|
|||
.expectedPlayerData = expectedPlayerData,
|
||||
.expectedPlayerDataSize = sizeof( expectedPlayerData ),
|
||||
},
|
||||
{
|
||||
.expectedDpid = 0xd00de,
|
||||
.expectedPlayerType = DPPLAYERTYPE_PLAYER,
|
||||
.expectedFlags = DPENUMPLAYERS_REMOTE,
|
||||
},
|
||||
};
|
||||
ExpectedPlayer expectedGroups[] =
|
||||
{
|
||||
{
|
||||
.expectedDpid = 0x5e7,
|
||||
.expectedPlayerType = DPPLAYERTYPE_GROUP,
|
||||
.expectedShortName = "short name",
|
||||
.expectedLongName = "long name",
|
||||
.expectedFlags = DPENUMPLAYERS_REMOTE,
|
||||
.expectedPlayerData = expectedPlayerData,
|
||||
.expectedPlayerDataSize = sizeof( expectedPlayerData ),
|
||||
},
|
||||
};
|
||||
ExpectedPlayer expectedGroupPlayers[] =
|
||||
{
|
||||
{
|
||||
.expectedDpid = 0xd00de,
|
||||
.expectedPlayerType = DPPLAYERTYPE_PLAYER,
|
||||
.expectedFlags = DPENUMPLAYERS_REMOTE,
|
||||
},
|
||||
};
|
||||
|
||||
checkPlayerList_( line, dp, expectedPlayers, ARRAYSIZE( expectedPlayers ) );
|
||||
checkGroupList_( line, dp, expectedGroups, ARRAYSIZE( expectedGroups ) );
|
||||
checkGroupPlayerList_( line, 0x5e7, dp, expectedGroupPlayers, ARRAYSIZE( expectedGroupPlayers ) );
|
||||
|
||||
hr = IDirectPlayX_Close( dp );
|
||||
checkHR( DP_OK, hr );
|
||||
|
@ -4682,20 +4853,20 @@ static void test_CreatePlayer(void)
|
|||
|
||||
/* Player name */
|
||||
dpid = 0xdeadbeef;
|
||||
check_CreatePlayer( dp, &dpid, NULL, 0, DP_OK, 2, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 1 );
|
||||
check_CreatePlayer( dp, &dpid, NULL, 0, DP_OK, 2, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 2 );
|
||||
|
||||
dpid = 0xdeadbeef;
|
||||
check_CreatePlayer( dp, &dpid, &fullName, 0, DP_OK, 3, recvSock, TRUE, 0x8, L"short player name",
|
||||
"short player name", L"long player name", "long player name", 2 );
|
||||
"short player name", L"long player name", "long player name", 3 );
|
||||
|
||||
name = fullName;
|
||||
name.dwSize = 1;
|
||||
dpid = 0xdeadbeef;
|
||||
check_CreatePlayer( dp, &dpid, &name, 0, DP_OK, 4, recvSock, TRUE, 0x8, L"short player name", "short player name",
|
||||
L"long player name", "long player name", 3 );
|
||||
L"long player name", "long player name", 4 );
|
||||
|
||||
dpid = 0xdeadbeef;
|
||||
check_CreatePlayer( dp, &dpid, &nullName, 0, DP_OK, 5, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 4 );
|
||||
check_CreatePlayer( dp, &dpid, &nullName, 0, DP_OK, 5, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 5 );
|
||||
|
||||
/* Null dpid */
|
||||
dpid = 0xdeadbeef;
|
||||
|
@ -4703,11 +4874,11 @@ static void test_CreatePlayer(void)
|
|||
|
||||
/* Flags */
|
||||
dpid = 0xdeadbeef;
|
||||
check_CreatePlayer( dp, &dpid, NULL, 0, DP_OK, 6, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 5 );
|
||||
check_CreatePlayer( dp, &dpid, NULL, 0, DP_OK, 6, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 6 );
|
||||
|
||||
dpid = 0xdeadbeef;
|
||||
check_CreatePlayer( dp, &dpid, NULL, DPPLAYER_SPECTATOR, DP_OK, 7, recvSock, TRUE, 0x208, NULL, NULL, NULL, NULL,
|
||||
6 );
|
||||
7 );
|
||||
|
||||
closesocket( recvSock );
|
||||
closesocket( sendSock );
|
||||
|
@ -4954,7 +5125,7 @@ static void test_CREATEPLAYER(void)
|
|||
checkPlayerExists( dp, 0x07734, DPPLAYERTYPE_PLAYER, "new player short name", "new player long name",
|
||||
DPENUMPLAYERS_REMOTE, playerData, sizeof( playerData ) );
|
||||
|
||||
dpid = checkCreatePlayerOrGroupMessage( dp, DPPLAYERTYPE_PLAYER, 0x07734, 3, playerData, sizeof( playerData ),
|
||||
dpid = checkCreatePlayerOrGroupMessage( dp, DPPLAYERTYPE_PLAYER, 0x07734, 4, playerData, sizeof( playerData ),
|
||||
"new player short name", "new player long name", 0, 0 );
|
||||
ok( dpid == 0x11223344, "got destination id %#lx.\n", dpid );
|
||||
|
||||
|
@ -7886,7 +8057,7 @@ static void test_Send(void)
|
|||
createPlayer( dp, 0x07734, NULL, NULL, 0, 0, sendSock, recvSock );
|
||||
createPlayer( dp, 0x14, NULL, NULL, 0, 0, sendSock, recvSock );
|
||||
|
||||
checkCreatePlayerOrGroupMessage( dp, DPPLAYERTYPE_PLAYER, 0x14, 2, NULL, 0, NULL, NULL, 0, DPPLAYER_LOCAL );
|
||||
checkCreatePlayerOrGroupMessage( dp, DPPLAYERTYPE_PLAYER, 0x14, 3, NULL, 0, NULL, NULL, 0, DPPLAYER_LOCAL );
|
||||
|
||||
hr = IDirectPlayX_Send( dp, 0x07734, 0xdeadbeef, DPSEND_GUARANTEED, data, sizeof( data ) );
|
||||
todo_wine ok( hr == DPERR_INVALIDPARAM, "got hr %#lx.\n", hr );
|
||||
|
@ -8323,7 +8494,7 @@ static void test_Receive(void)
|
|||
waitResult = WaitForSingleObject( event0, 2000 );
|
||||
ok( waitResult == WAIT_OBJECT_0, "message wait returned %lu\n", waitResult );
|
||||
|
||||
checkCreatePlayerOrGroupMessage( dp, DPPLAYERTYPE_PLAYER, 0x14, 2, NULL, 0, NULL, NULL, 0, DPPLAYER_LOCAL );
|
||||
checkCreatePlayerOrGroupMessage( dp, DPPLAYERTYPE_PLAYER, 0x14, 3, NULL, 0, NULL, NULL, 0, DPPLAYER_LOCAL );
|
||||
|
||||
sendGuaranteedGameMessage( sendSock, 2349, 0x1337, 0x07734, data0, sizeof( data0 ) );
|
||||
sendGuaranteedGameMessage( sendSock, 2349, 0x1337, 0x14, data1, sizeof( data1 ) );
|
||||
|
|
Loading…
Reference in a new issue