This is the first of the 3 remaining MRs required for GTA 2 multiplayer to work.
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/tests/dplayx.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c index da3a9b533c2..cb3dd75912a 100644 --- a/dlls/dplayx/tests/dplayx.c +++ b/dlls/dplayx/tests/dplayx.c @@ -1224,12 +1224,14 @@ static void checkGameMessage_( int line, GameMessage *message, DPID expectedFrom static unsigned short receiveEnumSessionsRequest_( int line, SOCKET sock, const GUID *expectedAppGuid, const WCHAR *expectedPassword, DWORD expectedFlags ) { +#include "pshpack1.h" struct { SpHeader spHeader; EnumSessionsRequest request; WCHAR password[ 256 ]; } request; +#include "poppack.h" DWORD expectedPasswordSize; unsigned short port; DWORD expectedSize; @@ -1267,6 +1269,7 @@ static unsigned short receiveEnumSessionsRequest_( int line, SOCKET sock, const #define sendEnumSessionsReply( sock, port, dpsd ) sendEnumSessionsReply_( __LINE__, sock, port, dpsd ) static void sendEnumSessionsReply_( int line, SOCKET sock, unsigned short port, const DPSESSIONDESC2 *dpsd ) { +#include "pshpack1.h" struct { SpHeader spHeader; @@ -1295,6 +1298,7 @@ static void sendEnumSessionsReply_( int line, SOCKET sock, unsigned short port, .nameOffset = sizeof( reply.reply ), }, }; +#include "poppack.h" DWORD passwordSize; int wsResult; DWORD size; @@ -1314,11 +1318,13 @@ static void sendEnumSessionsReply_( int line, SOCKET sock, unsigned short port, #define receiveRequestPlayerId( sock, expectedFlags, flagsTodo ) receiveRequestPlayerId_( __LINE__, sock, expectedFlags, flagsTodo ) static unsigned short receiveRequestPlayerId_( int line, SOCKET sock, DWORD expectedFlags ) { +#include "pshpack1.h" struct { SpHeader spHeader; RequestPlayerId request; } request; +#include "poppack.h" unsigned short port; int wsResult;
@@ -1335,6 +1341,7 @@ static unsigned short receiveRequestPlayerId_( int line, SOCKET sock, DWORD expe #define sendRequestPlayerReply( sock, port, id, result ) sendRequestPlayerReply_( __LINE__, sock, port, id, result ) static void sendRequestPlayerReply_( int line, SOCKET sock, unsigned short port, DPID id, HRESULT result ) { +#include "pshpack1.h" struct { SpHeader spHeader; @@ -1362,6 +1369,7 @@ static void sendRequestPlayerReply_( int line, SOCKET sock, unsigned short port, .result = result, }, }; +#include "poppack.h" int wsResult;
wsResult = send( sock, (char *) &reply, sizeof( reply ), 0 ); @@ -1374,11 +1382,13 @@ static unsigned short receiveAddForwardRequest_( int line, SOCKET sock, DPID exp const WCHAR *expectedPassword, DWORD expectedTickCount, unsigned short *udpPort ) { +#include "pshpack1.h" struct { SpHeader spHeader; AddForwardRequest request; } request; +#include "poppack.h" DWORD expectedPasswordSize; WCHAR password[ 256 ]; unsigned short port; @@ -1427,6 +1437,7 @@ static void sendSuperEnumPlayersReply_( int line, SOCKET sock, unsigned short tc { #define SHORT_NAME L"short name" #define LONG_NAME L"long name" +#include "pshpack1.h" struct { SpHeader spHeader; @@ -1545,6 +1556,7 @@ static void sendSuperEnumPlayersReply_( int line, SOCKET sock, unsigned short tc }, }, }; +#include "poppack.h" #undef LONG_NAME #undef SHORT_NAME int wsResult; @@ -1561,6 +1573,7 @@ static void sendSuperEnumPlayersReply_( int line, SOCKET sock, unsigned short tc #define sendAddForwardReply( sock, port, result ) sendAddForwardReply_( __LINE__, sock, port, result ) static void sendAddForwardReply_( int line, SOCKET sock, unsigned short port, HRESULT result ) { +#include "pshpack1.h" struct { SpHeader spHeader; @@ -1587,6 +1600,7 @@ static void sendAddForwardReply_( int line, SOCKET sock, unsigned short port, HR .result = result, }, }; +#include "poppack.h" int wsResult;
wsResult = send( sock, (char *) &reply, sizeof( reply ), 0 ); @@ -1596,6 +1610,7 @@ static void sendAddForwardReply_( int line, SOCKET sock, unsigned short port, HR #define sendAddForward( sock, port, tcpPort, udpPort ) sendAddForward_( __LINE__, sock, port, tcpPort, udpPort ) static void sendAddForward_( int line, SOCKET sock, unsigned short port, unsigned short tcpPort, unsigned short udpPort ) { +#include "pshpack1.h" struct { SpHeader spHeader; @@ -1653,6 +1668,7 @@ static void sendAddForward_( int line, SOCKET sock, unsigned short port, unsigne }, }, }; +#include "poppack.h"
int wsResult;
@@ -1663,11 +1679,13 @@ static void sendAddForward_( int line, SOCKET sock, unsigned short port, unsigne #define receiveAddForwardAck( sock, expectedPlayerId ) receiveAddForwardAck_( __LINE__, sock, expectedPlayerId ) static unsigned short receiveAddForwardAck_( int line, SOCKET sock, DPID expectedPlayerId ) { +#include "pshpack1.h" struct { SpHeader spHeader; AddForwardAck request; } request; +#include "poppack.h" unsigned short port; int wsResult;
@@ -1688,11 +1706,13 @@ static unsigned short receiveCreatePlayer_( int line, SOCKET sock, DPID expected const WCHAR *expectedShortName, const WCHAR *expectedLongName, void *expectedPlayerData, DWORD expectedPlayerDataSize ) { +#include "pshpack1.h" struct { SpHeader spHeader; CreatePlayer request; } request; +#include "poppack.h" DWORD expectedShortNameSize; DWORD expectedLongNameSize; WCHAR shortName[ 256 ]; @@ -1775,6 +1795,7 @@ static unsigned short receiveCreatePlayer_( int line, SOCKET sock, DPID expected static void sendCreatePlayer_( int line, SOCKET sock, unsigned short tcpPort, unsigned short udpPort, const WCHAR *shortName, const WCHAR *longName, void *playerData, DWORD playerDataSize ) { +#include "pshpack1.h" struct { SpHeader spHeader; @@ -1820,6 +1841,7 @@ static void sendCreatePlayer_( int line, SOCKET sock, unsigned short tcpPort, un }, }, }; +#include "poppack.h" SpData spData = { .tcpAddr.sin_family = AF_INET, .tcpAddr.sin_port = htons( tcpPort ), @@ -1877,12 +1899,14 @@ static void sendCreatePlayer_( int line, SOCKET sock, unsigned short tcpPort, un static unsigned short receiveGuaranteedGameMessage_( int line, SOCKET sock, DPID expectedFromId, DPID expectedToId, void *expectedData, DWORD expectedDataSize ) { +#include "pshpack1.h" struct { SpHeader spHeader; GameMessage request; BYTE data[ 256 ]; } request; +#include "poppack.h" unsigned short port; int wsResult;
@@ -1903,11 +1927,13 @@ static unsigned short receiveGuaranteedGameMessage_( int line, SOCKET sock, DPID static void receiveGameMessage_( int line, SOCKET sock, DPID expectedFromId, DPID expectedToId, void *expectedData, DWORD expectedDataSize ) { +#include "pshpack1.h" struct { GameMessage request; BYTE data[ 256 ]; } request; +#include "poppack.h" int wsResult;
DWORD expectedSize = sizeof( request.request ) + expectedDataSize; @@ -1924,6 +1950,7 @@ static void receiveGameMessage_( int line, SOCKET sock, DPID expectedFromId, DPI static void sendGuaranteedGameMessage_( int line, SOCKET sock, unsigned short port, DPID fromId, DPID toId, void *data, DWORD dataSize ) { +#include "pshpack1.h" struct { SpHeader spHeader; @@ -1945,6 +1972,7 @@ static void sendGuaranteedGameMessage_( int line, SOCKET sock, unsigned short po .toId = toId, } }; +#include "poppack.h" int wsResult;
wsResult = send( sock, (char *) &request, sizeof( request ), 0 ); @@ -1958,6 +1986,7 @@ static void sendGuaranteedGameMessage_( int line, SOCKET sock, unsigned short po sendGameMessage_( __LINE__, sock, fromId, toId, data, dataSize ) static void sendGameMessage_( int line, SOCKET sock, DPID fromId, DPID toId, void *data, DWORD dataSize ) { +#include "pshpack1.h" struct { GameMessage request; @@ -1970,6 +1999,7 @@ static void sendGameMessage_( int line, SOCKET sock, DPID fromId, DPID toId, voi .toId = toId, } }; +#include "poppack.h" int wsResult; DWORD size;
@@ -1985,6 +2015,7 @@ static void sendGameMessage_( int line, SOCKET sock, DPID fromId, DPID toId, voi sendPing_( __LINE__, sock, port, fromId, tickCount ) static void sendPing_( int line, SOCKET sock, unsigned short port, DPID fromId, DWORD tickCount ) { +#include "pshpack1.h" struct { SpHeader spHeader; @@ -2012,6 +2043,7 @@ static void sendPing_( int line, SOCKET sock, unsigned short port, DPID fromId, .tickCount = tickCount, } }; +#include "poppack.h" int wsResult;
wsResult = send( sock, (char *) &request, sizeof( request ), 0 ); @@ -2022,11 +2054,13 @@ static void sendPing_( int line, SOCKET sock, unsigned short port, DPID fromId, receivePingReply_( __LINE__, sock, expectedFromId, expectedTickCount ) static unsigned short receivePingReply_( int line, SOCKET sock, DPID expectedFromId, DWORD expectedTickCount ) { +#include "pshpack1.h" struct { SpHeader spHeader; Ping request; } request; +#include "poppack.h" unsigned short port; int wsResult;
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/tests/dplayx.c | 321 ++++++++++++++++++++++++++++--------- 1 file changed, 246 insertions(+), 75 deletions(-)
diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c index cb3dd75912a..6f65f9271c2 100644 --- a/dlls/dplayx/tests/dplayx.c +++ b/dlls/dplayx/tests/dplayx.c @@ -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,75 +1512,140 @@ static void sendSuperEnumPlayersReply_( int line, SOCKET sock, unsigned short tc .passwordOffset = 0, }, .dpsd = *dpsd, - .superPackedPlayer0 = - { - .size = 16, - .flags = 0x5, - .id = 0x12345678, - .infoMask = 0x4, - .versionOrSystemPlayerId = 14, - }, - .spDataLength0 = sizeof( SpData ), - .spData0 = + .player0 = { - .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, + .superPackedPlayer = + { + .size = 16, + .flags = 0xf, + .id = 0x51573, + .infoMask = 0x4, + .versionOrSystemPlayerId = 14, + }, + .spDataLength = sizeof( SpData ), + .spData = + { + .tcpAddr = + { + .sin_family = AF_INET, + .sin_port = htons( tcpPort ), + }, + .udpAddr = + { + .sin_family = AF_INET, + .sin_port = htons( udpPort ), + }, + }, }, - .spDataLength1 = sizeof( SpData ), - .spData1 = + .player2 = { - .tcpAddr = + .superPackedPlayer = { - .sin_family = AF_INET, - .sin_port = htons( tcpPort ), + .size = 16, + .flags = 0x8, + .id = 0x1337, + .infoMask = 0x17, + .versionOrSystemPlayerId = 0x51573, }, - .udpAddr = + .shortName = SHORT_NAME, + .longName = LONG_NAME, + .playerDataLength = 4, + .playerData = { 1, 2, 3, 4, }, + .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 = + .player3 = { - .size = 16, - .flags = 0x8, - .id = 0x1337, - .infoMask = 0x17, - .versionOrSystemPlayerId = 0x51573, + .superPackedPlayer = + { + .size = 16, + .flags = 0x8, + .id = 0xd00de, + .infoMask = 0x4, + .versionOrSystemPlayerId = 0x51573, + }, + .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 = + .group0 = { - .tcpAddr = + .superPackedPlayer = { - .sin_family = AF_INET, - .sin_port = htons( tcpPort ), + .size = 16, + .flags = 0x48, + .id = 0x5e7, + .infoMask = 0x57, + .versionOrSystemPlayerId = 0x51573, }, - .udpAddr = + .shortName = SHORT_NAME, + .longName = LONG_NAME, + .playerDataLength = 4, + .playerData = { 1, 2, 3, 4, }, + .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 ), + }, }, + .playerCount = 1, + .playerIds = { 0xd00de, }, }, }; #include "poppack.h" @@ -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 ) );
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 75 ++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 41 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index d1b56afa5c2..4f740ca3e90 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -1284,8 +1284,17 @@ static HRESULT WINAPI IDirectPlay4Impl_Close( IDirectPlay4 *iface ) static lpGroupData DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, const DPNAME *lpName, DWORD dwFlags, DPID idParent, BOOL bAnsi ) { + struct GroupList *groupList = NULL; + struct GroupData *parent = NULL; lpGroupData lpGData;
+ if( DPID_SYSTEM_GROUP != *lpid ) + { + parent = DP_FindAnyGroup( This, idParent ); + if( !parent ) + return NULL; + } + /* Allocate the new space and add to end of high level group list */ lpGData = calloc( 1, sizeof( *lpGData ) );
@@ -1315,8 +1324,7 @@ static lpGroupData DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, cons return NULL; }
- /* FIXME: Should we check that the parent exists? */ - lpGData->parent = idParent; + lpGData->parent = idParent;
/* FIXME: Should we validate the dwFlags? */ lpGData->dwFlags = dwFlags; @@ -1331,6 +1339,30 @@ static lpGroupData DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, cons return NULL; }
+ if( DPID_SYSTEM_GROUP == *lpid ) + { + This->dp2->lpSysGroup = lpGData; + TRACE( "Inserting system group\n" ); + } + else + { + /* Insert into the parent group */ + groupList = calloc( 1, sizeof( *groupList ) ); + if( !groupList ) + { + free( lpGData->nameA ); + free( lpGData->name ); + free( lpGData ); + return NULL; + } + groupList->lpGData = lpGData; + + DPQ_INSERT( parent->groups, groupList, groups ); + } + + /* Something is now referencing this data */ + lpGData->uRef++; + TRACE( "Created group id 0x%08lx\n", *lpid );
return lpGData; @@ -1429,23 +1461,6 @@ static HRESULT DP_IF_CreateGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID *l return DPERR_CANTADDPLAYER; /* yes player not group */ }
- if( DPID_SYSTEM_GROUP == *lpidGroup ) - { - This->dp2->lpSysGroup = lpGData; - TRACE( "Inserting system group\n" ); - } - else - { - /* Insert into the system group */ - lpGroupList lpGroup = calloc( 1, sizeof( *lpGroup ) ); - lpGroup->lpGData = lpGData; - - DPQ_INSERT( This->dp2->lpSysGroup->groups, lpGroup, groups ); - } - - /* Something is now referencing this data */ - lpGData->uRef++; - /* Set all the important stuff for the group */ DP_SetGroupData( lpGData, DPSET_REMOTE, lpData, dwDataSize );
@@ -4458,8 +4473,6 @@ static HRESULT DP_IF_CreateGroupInGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID *lpidGroup, DPNAME *lpGroupName, void *lpData, DWORD dwDataSize, DWORD dwFlags, BOOL bAnsi ) { - lpGroupData lpGParentData; - lpGroupList lpGList; lpGroupData lpGData;
TRACE( "(%p)->(0x%08lx,%p,%p,%p,0x%08lx,0x%08lx,%u)\n", @@ -4471,10 +4484,6 @@ static HRESULT DP_IF_CreateGroupInGroup( IDirectPlayImpl *This, void *lpMsgHdr, return DPERR_UNINITIALIZED; }
- /* Verify that the specified parent is valid */ - if( ( lpGParentData = DP_FindAnyGroup(This, idParentGroup ) ) == NULL ) - return DPERR_INVALIDGROUP; - lpGData = DP_CreateGroup(This, lpidGroup, lpGroupName, dwFlags, idParentGroup, bAnsi );
if( lpGData == NULL ) @@ -4482,24 +4491,8 @@ static HRESULT DP_IF_CreateGroupInGroup( IDirectPlayImpl *This, void *lpMsgHdr, return DPERR_CANTADDPLAYER; /* yes player not group */ }
- /* Something else is referencing this data */ - lpGData->uRef++; - DP_SetGroupData( lpGData, DPSET_REMOTE, lpData, dwDataSize );
- /* The list has now been inserted into the interface group list. We now - need to put a "shortcut" to this group in the parent group */ - lpGList = calloc( 1, sizeof( *lpGList ) ); - if( lpGList == NULL ) - { - FIXME( "Memory leak\n" ); - return DPERR_CANTADDPLAYER; /* yes player not group */ - } - - lpGList->lpGData = lpGData; - - DPQ_INSERT( lpGParentData->groups, lpGList, groups ); - /* Let the SP know that we've created this group */ if( This->dp2->spData.lpCB->CreateGroup ) {
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 4f740ca3e90..4bc4b9cf224 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -1282,7 +1282,7 @@ static HRESULT WINAPI IDirectPlay4Impl_Close( IDirectPlay4 *iface ) }
static lpGroupData DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, const DPNAME *lpName, - DWORD dwFlags, DPID idParent, BOOL bAnsi ) + void *data, DWORD dataSize, DWORD dwFlags, DPID idParent, BOOL bAnsi ) { struct GroupList *groupList = NULL; struct GroupData *parent = NULL; @@ -1363,6 +1363,8 @@ static lpGroupData DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, cons /* Something is now referencing this data */ lpGData->uRef++;
+ DP_SetGroupData( lpGData, DPSET_REMOTE, data, dataSize ); + TRACE( "Created group id 0x%08lx\n", *lpid );
return lpGData; @@ -1453,7 +1455,7 @@ static HRESULT DP_IF_CreateGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID *l } }
- lpGData = DP_CreateGroup( This, lpidGroup, lpGroupName, dwFlags, + lpGData = DP_CreateGroup( This, lpidGroup, lpGroupName, lpData, dwDataSize, dwFlags, DPID_NOPARENT_GROUP, bAnsi );
if( lpGData == NULL ) @@ -1461,9 +1463,6 @@ static HRESULT DP_IF_CreateGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID *l return DPERR_CANTADDPLAYER; /* yes player not group */ }
- /* Set all the important stuff for the group */ - DP_SetGroupData( lpGData, DPSET_REMOTE, lpData, dwDataSize ); - /* FIXME: We should only create the system group if GetCaps returns * DPCAPS_GROUPOPTIMIZED. */ @@ -4484,15 +4483,14 @@ static HRESULT DP_IF_CreateGroupInGroup( IDirectPlayImpl *This, void *lpMsgHdr, return DPERR_UNINITIALIZED; }
- lpGData = DP_CreateGroup(This, lpidGroup, lpGroupName, dwFlags, idParentGroup, bAnsi ); + lpGData = DP_CreateGroup(This, lpidGroup, lpGroupName, lpData, dwDataSize, dwFlags, idParentGroup, + bAnsi );
if( lpGData == NULL ) { return DPERR_CANTADDPLAYER; /* yes player not group */ }
- DP_SetGroupData( lpGData, DPSET_REMOTE, lpData, dwDataSize ); - /* Let the SP know that we've created this group */ if( This->dp2->spData.lpCB->CreateGroup ) {
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 4bc4b9cf224..dbe8ef54cb5 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -1281,7 +1281,7 @@ static HRESULT WINAPI IDirectPlay4Impl_Close( IDirectPlay4 *iface ) return hr; }
-static lpGroupData DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, const DPNAME *lpName, +static HRESULT DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, const DPNAME *lpName, void *data, DWORD dataSize, DWORD dwFlags, DPID idParent, BOOL bAnsi ) { struct GroupList *groupList = NULL; @@ -1292,7 +1292,7 @@ static lpGroupData DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, cons { parent = DP_FindAnyGroup( This, idParent ); if( !parent ) - return NULL; + return DPERR_INVALIDGROUP; }
/* Allocate the new space and add to end of high level group list */ @@ -1300,7 +1300,7 @@ static lpGroupData DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, cons
if( lpGData == NULL ) { - return NULL; + return DPERR_OUTOFMEMORY; }
DPQ_INIT(lpGData->groups); @@ -1313,7 +1313,7 @@ static lpGroupData DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, cons if ( !lpGData->name ) { free( lpGData ); - return NULL; + return DPERR_OUTOFMEMORY; }
lpGData->nameA = DP_DuplicateName( lpName, TRUE, bAnsi ); @@ -1321,7 +1321,7 @@ static lpGroupData DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, cons { free( lpGData->name ); free( lpGData ); - return NULL; + return DPERR_OUTOFMEMORY; }
lpGData->parent = idParent; @@ -1336,7 +1336,7 @@ static lpGroupData DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, cons free( lpGData->nameA ); free( lpGData->name ); free( lpGData ); - return NULL; + return DPERR_OUTOFMEMORY; }
if( DPID_SYSTEM_GROUP == *lpid ) @@ -1353,7 +1353,7 @@ static lpGroupData DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, cons free( lpGData->nameA ); free( lpGData->name ); free( lpGData ); - return NULL; + return DPERR_OUTOFMEMORY; } groupList->lpGData = lpGData;
@@ -1367,7 +1367,7 @@ static lpGroupData DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, cons
TRACE( "Created group id 0x%08lx\n", *lpid );
- return lpGData; + return DP_OK; }
/* This method assumes that all links to it are already deleted */ @@ -1428,7 +1428,7 @@ static lpGroupData DP_FindAnyGroup( IDirectPlayImpl *This, DPID dpid ) static HRESULT DP_IF_CreateGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID *lpidGroup, DPNAME *lpGroupName, void *lpData, DWORD dwDataSize, DWORD dwFlags, BOOL bAnsi ) { - lpGroupData lpGData; + HRESULT hr;
TRACE( "(%p)->(%p,%p,%p,%p,0x%08lx,0x%08lx,%u)\n", This, lpMsgHdr, lpidGroup, lpGroupName, lpData, dwDataSize, @@ -1455,12 +1455,12 @@ static HRESULT DP_IF_CreateGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID *l } }
- lpGData = DP_CreateGroup( This, lpidGroup, lpGroupName, lpData, dwDataSize, dwFlags, - DPID_NOPARENT_GROUP, bAnsi ); + hr = DP_CreateGroup( This, lpidGroup, lpGroupName, lpData, dwDataSize, dwFlags, + DPID_NOPARENT_GROUP, bAnsi );
- if( lpGData == NULL ) + if( FAILED( hr ) ) { - return DPERR_CANTADDPLAYER; /* yes player not group */ + return hr; }
/* FIXME: We should only create the system group if GetCaps returns @@ -4472,7 +4472,7 @@ static HRESULT DP_IF_CreateGroupInGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID *lpidGroup, DPNAME *lpGroupName, void *lpData, DWORD dwDataSize, DWORD dwFlags, BOOL bAnsi ) { - lpGroupData lpGData; + HRESULT hr;
TRACE( "(%p)->(0x%08lx,%p,%p,%p,0x%08lx,0x%08lx,%u)\n", This, idParentGroup, lpidGroup, lpGroupName, lpData, @@ -4483,12 +4483,12 @@ static HRESULT DP_IF_CreateGroupInGroup( IDirectPlayImpl *This, void *lpMsgHdr, return DPERR_UNINITIALIZED; }
- lpGData = DP_CreateGroup(This, lpidGroup, lpGroupName, lpData, dwDataSize, dwFlags, idParentGroup, - bAnsi ); + hr = DP_CreateGroup(This, lpidGroup, lpGroupName, lpData, dwDataSize, dwFlags, idParentGroup, + bAnsi );
- if( lpGData == NULL ) + if( FAILED( hr ) ) { - return DPERR_CANTADDPLAYER; /* yes player not group */ + return hr; }
/* Let the SP know that we've created this group */
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 101 +++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 49 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index dbe8ef54cb5..0581b0c8cdf 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -1281,12 +1281,14 @@ static HRESULT WINAPI IDirectPlay4Impl_Close( IDirectPlay4 *iface ) return hr; }
-static HRESULT DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, const DPNAME *lpName, - void *data, DWORD dataSize, DWORD dwFlags, DPID idParent, BOOL bAnsi ) +static HRESULT DP_CreateGroup( IDirectPlayImpl *This, void *msgHeader, const DPID *lpid, + const DPNAME *lpName, void *data, DWORD dataSize, DWORD dwFlags, DPID idParent, + BOOL bAnsi ) { struct GroupList *groupList = NULL; struct GroupData *parent = NULL; lpGroupData lpGData; + HRESULT hr;
if( DPID_SYSTEM_GROUP != *lpid ) { @@ -1365,6 +1367,51 @@ static HRESULT DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, const DP
DP_SetGroupData( lpGData, DPSET_REMOTE, data, dataSize );
+ /* FIXME: We should only create the system group if GetCaps returns + * DPCAPS_GROUPOPTIMIZED. + */ + + /* Let the SP know that we've created this group */ + if( This->dp2->spData.lpCB->CreateGroup ) + { + DPSP_CREATEGROUPDATA data; + DWORD dwCreateFlags = 0; + + TRACE( "Calling SP CreateGroup\n" ); + + if( !parent ) + dwCreateFlags |= DPLAYI_GROUP_SYSGROUP; + + if( !msgHeader ) + dwCreateFlags |= DPLAYI_PLAYER_PLAYERLOCAL; + + if( dwFlags & DPGROUP_HIDDEN ) + dwCreateFlags |= DPLAYI_GROUP_HIDDEN; + + data.idGroup = *lpid; + data.dwFlags = dwCreateFlags; + data.lpSPMessageHeader = msgHeader; + data.lpISP = This->dp2->spData.lpISP; + + hr = (*This->dp2->spData.lpCB->CreateGroup)( &data ); + if( FAILED( hr ) ) + { + if( groupList ) + { + DPQ_REMOVE( parent->groups, groupList, groups ); + free( groupList ); + } + else + { + This->dp2->lpSysGroup = NULL; + } + free( lpGData->nameA ); + free( lpGData->name ); + free( lpGData ); + return hr; + } + } + TRACE( "Created group id 0x%08lx\n", *lpid );
return DP_OK; @@ -1455,7 +1502,7 @@ static HRESULT DP_IF_CreateGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID *l } }
- hr = DP_CreateGroup( This, lpidGroup, lpGroupName, lpData, dwDataSize, dwFlags, + hr = DP_CreateGroup( This, lpMsgHdr, lpidGroup, lpGroupName, lpData, dwDataSize, dwFlags, DPID_NOPARENT_GROUP, bAnsi );
if( FAILED( hr ) ) @@ -1463,35 +1510,6 @@ static HRESULT DP_IF_CreateGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID *l return hr; }
- /* FIXME: We should only create the system group if GetCaps returns - * DPCAPS_GROUPOPTIMIZED. - */ - - /* Let the SP know that we've created this group */ - if( This->dp2->spData.lpCB->CreateGroup ) - { - DPSP_CREATEGROUPDATA data; - DWORD dwCreateFlags = 0; - - TRACE( "Calling SP CreateGroup\n" ); - - if( *lpidGroup == DPID_NOPARENT_GROUP ) - dwCreateFlags |= DPLAYI_GROUP_SYSGROUP; - - if( lpMsgHdr == NULL ) - dwCreateFlags |= DPLAYI_PLAYER_PLAYERLOCAL; - - if( dwFlags & DPGROUP_HIDDEN ) - dwCreateFlags |= DPLAYI_GROUP_HIDDEN; - - data.idGroup = *lpidGroup; - data.dwFlags = dwCreateFlags; - data.lpSPMessageHeader = lpMsgHdr; - data.lpISP = This->dp2->spData.lpISP; - - (*This->dp2->spData.lpCB->CreateGroup)( &data ); - } - /* Inform all other peers of the creation of a new group. If there are * no peers keep this event quiet. * Also if this message was sent to us, don't rebroadcast. @@ -4483,29 +4501,14 @@ static HRESULT DP_IF_CreateGroupInGroup( IDirectPlayImpl *This, void *lpMsgHdr, return DPERR_UNINITIALIZED; }
- hr = DP_CreateGroup(This, lpidGroup, lpGroupName, lpData, dwDataSize, dwFlags, idParentGroup, - bAnsi ); + hr = DP_CreateGroup(This, lpMsgHdr, lpidGroup, lpGroupName, lpData, dwDataSize, dwFlags, + idParentGroup, bAnsi );
if( FAILED( hr ) ) { return hr; }
- /* Let the SP know that we've created this group */ - if( This->dp2->spData.lpCB->CreateGroup ) - { - DPSP_CREATEGROUPDATA data; - - TRACE( "Calling SP CreateGroup\n" ); - - data.idGroup = *lpidGroup; - data.dwFlags = dwFlags; - data.lpSPMessageHeader = lpMsgHdr; - data.lpISP = This->dp2->spData.lpISP; - - (*This->dp2->spData.lpCB->CreateGroup)( &data ); - } - /* Inform all other peers of the creation of a new group. If there are * no peers keep this quiet. */
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 2 +- dlls/dplayx/dplay_global.h | 3 +++ dlls/dplayx/dplayx_messages.c | 24 ++++++++++++++++++++++++ dlls/dplayx/tests/dplayx.c | 14 ++++++++------ 4 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 0581b0c8cdf..32fbd35df50 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -1281,7 +1281,7 @@ static HRESULT WINAPI IDirectPlay4Impl_Close( IDirectPlay4 *iface ) return hr; }
-static HRESULT DP_CreateGroup( IDirectPlayImpl *This, void *msgHeader, const DPID *lpid, +HRESULT DP_CreateGroup( IDirectPlayImpl *This, void *msgHeader, const DPID *lpid, const DPNAME *lpName, void *data, DWORD dataSize, DWORD dwFlags, DPID idParent, BOOL bAnsi ) { diff --git a/dlls/dplayx/dplay_global.h b/dlls/dplayx/dplay_global.h index 902396f52c4..392e0d3232d 100644 --- a/dlls/dplayx/dplay_global.h +++ b/dlls/dplayx/dplay_global.h @@ -218,6 +218,9 @@ HRESULT DP_HandleGameMessage( IDirectPlayImpl *This, void *messageBody, DWORD me HRESULT DP_CreatePlayer( IDirectPlayImpl *This, void *msgHeader, DPID *lpid, DPNAME *lpName, void *data, DWORD dataSize, void *spData, DWORD spDataSize, DWORD dwFlags, HANDLE hEvent, struct PlayerData **playerData, BOOL bAnsi ); +HRESULT DP_CreateGroup( IDirectPlayImpl *This, void *msgHeader, const DPID *lpid, + const DPNAME *lpName, void *data, DWORD dataSize, DWORD dwFlags, + DPID idParent, BOOL bAnsi );
/* 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 3eeb8c23508..93a80283b69 100644 --- a/dlls/dplayx/dplayx_messages.c +++ b/dlls/dplayx/dplayx_messages.c @@ -676,6 +676,30 @@ HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlayImpl *This, DPID dpidServer, WC return hr; } } + for( i = 0; i < enumPlayersReply->groupCount; ++i ) + { + DPPLAYERINFO playerInfo; + + hr = DP_MSG_ReadSuperPackedPlayer( (char *) enumPlayersReply, &offset, dwMsgSize, + &playerInfo ); + if( FAILED( hr ) ) + { + free( msgHeader ); + free( lpMsg ); + return hr; + } + + hr = DP_CreateGroup( This, msgHeader, &playerInfo.id, &playerInfo.name, + playerInfo.playerData, playerInfo.playerDataLength, + playerInfo.flags & ~DPLAYI_PLAYER_PLAYERLOCAL, playerInfo.parentId, + FALSE ); + 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 6f65f9271c2..c589ab4e8b7 100644 --- a/dlls/dplayx/tests/dplayx.c +++ b/dlls/dplayx/tests/dplayx.c @@ -2830,7 +2830,7 @@ static BOOL CALLBACK checkPlayerListCallback( DPID dpid, DWORD playerType, const HRESULT hr;
if ( player->actualCount ) - ok_( __FILE__, data->line )( 0, "duplicate player dpid %#lx.\n", dpid ); + todo_wine ok_( __FILE__, data->line )( 0, "duplicate player dpid %#lx.\n", dpid ); ok_( __FILE__, data->line )( playerType == player->expectedPlayerType, "got player type %lu.\n", playerType ); if ( player->expectedShortName ) @@ -2853,7 +2853,8 @@ static BOOL CALLBACK checkPlayerListCallback( DPID dpid, DWORD playerType, const ok_( __FILE__, data->line )( !name->lpszLongNameA, "got long name %s.\n", wine_dbgstr_a( name->lpszLongNameA ) ); } - ok_( __FILE__, data->line )( flags == player->expectedFlags, "got flags %#lx.\n", flags ); + todo_wine_if( playerType == DPPLAYERTYPE_GROUP && flags == DPENUMPLAYERS_LOCAL ) + ok_( __FILE__, data->line )( flags == player->expectedFlags, "got flags %#lx.\n", flags );
memset( &playerData, 0xcc, sizeof( playerData ) ); playerDataSize = sizeof( playerData ); @@ -2862,8 +2863,9 @@ static BOOL CALLBACK checkPlayerListCallback( DPID dpid, DWORD playerType, const 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 ); + todo_wine_if( playerType == DPPLAYERTYPE_GROUP ) + ok_( __FILE__, data->line )( playerDataSize == player->expectedPlayerDataSize, + "got player data size %lu.\n", playerDataSize ); ok_( __FILE__, data->line )( !memcmp( playerData, player->expectedPlayerData, player->expectedPlayerDataSize ), "player data doesn't match.\n" );
@@ -2964,10 +2966,10 @@ static void checkGroupPlayerList_( int line, DPID group, IDirectPlay4 *dp, Expec 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 ); + 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 ); + 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 );
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=149719
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
dplayx: dplayx.c:3987: Test failed: recv() returned 52. dplayx.c:4005: Test failed: recv() returned 52. dplayx.c:3293: Test failed: got flags 0.
=== debian11b (64 bit WoW report) ===
user32: win.c:4073: Test succeeded inside todo block: Expected active window 000000000335016A, got 000000000335016A. win.c:4074: Test succeeded inside todo block: Expected focus window 000000000335016A, got 000000000335016A.
I assume `dplayx` has the complete changes for testing, right?
On Mon Nov 18 10:18:07 2024 +0000, Aida Jonikienė wrote:
I assume `dplayx` has the complete changes for testing, right?
Right.
This merge request was approved by Alistair Leslie-Hughes.