From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplayx_messages.c | 105 ++++++++++++---------------------- dlls/dplayx/dplayx_messages.h | 40 +++++++------ dlls/dplayx/name_server.c | 8 --- dlls/dplayx/name_server.h | 1 - 4 files changed, 58 insertions(+), 96 deletions(-)
diff --git a/dlls/dplayx/dplayx_messages.c b/dlls/dplayx/dplayx_messages.c index 2b673e49441..8fe2d6c3010 100644 --- a/dlls/dplayx/dplayx_messages.c +++ b/dlls/dplayx/dplayx_messages.c @@ -297,87 +297,56 @@ HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlayImpl *This, DPID dpidServer ) LPVOID lpMsg; DPMSG_FORWARDADDPLAYER msgBody; DWORD dwMsgSize; - HRESULT hr = DP_OK; + DPLAYI_PACKEDPLAYER playerInfo; + void *spPlayerData; + DWORD spPlayerDataSize; + const WCHAR *password = L""; + HRESULT hr; + + hr = IDirectPlaySP_GetSPPlayerData( This->dp2->spData.lpISP, dpidServer, + &spPlayerData, &spPlayerDataSize, DPSET_REMOTE ); + if( FAILED( hr ) ) + return hr;
- /* Compose dplay message envelope */ msgBody.envelope.dwMagic = DPMSGMAGIC_DPLAYMSG; msgBody.envelope.wCommandId = DPMSGCMD_FORWARDADDPLAYER; msgBody.envelope.wVersion = DPMSGVER_DP6; - -#if 0 - { - LPBYTE lpPData; - DWORD dwDataSize; - - /* SP Player remote data needs to be propagated at some point - is this the point? */ - IDirectPlaySP_GetSPPlayerData( This->dp2->spData.lpISP, 0, &lpPData, &dwDataSize, DPSET_REMOTE ); - - ERR( "Player Data size is 0x%08lx\n" - "[%02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x]\n" - "[%02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x]\n", - - dwDataSize, - lpPData[0], lpPData[1], lpPData[2], lpPData[3], lpPData[4], - lpPData[5], lpPData[6], lpPData[7], lpPData[8], lpPData[9], - lpPData[10], lpPData[11], lpPData[12], lpPData[13], lpPData[14], - lpPData[15], lpPData[16], lpPData[17], lpPData[18], lpPData[19], - lpPData[20], lpPData[21], lpPData[22], lpPData[23], lpPData[24], - lpPData[25], lpPData[26], lpPData[27], lpPData[28], lpPData[29], - lpPData[30], lpPData[31] - ); - DebugBreak(); - } -#endif - - /* Compose body of message */ - msgBody.unknown = 0; - msgBody.dpidAppServer = dpidServer; - msgBody.unknown2[0] = 0x0; - msgBody.unknown2[1] = 0x1c; - msgBody.unknown2[2] = 0x6c; - msgBody.unknown2[3] = 0x50; - msgBody.unknown2[4] = 0x9; - - msgBody.dpidAppServer2 = dpidServer; - msgBody.unknown3[0] = 0x0; - msgBody.unknown3[1] = 0x0; - msgBody.unknown3[2] = 0x20; - msgBody.unknown3[3] = 0x0; - msgBody.unknown3[4] = 0x0; - - msgBody.dpidAppServer3 = dpidServer; - msgBody.unknown4[0] = 0x30; - msgBody.unknown4[1] = 0xb; - msgBody.unknown4[2] = 0x0; - - msgBody.unknown4[3] = NS_GetNsMagic( This->dp2->lpNameServerData ) - - 0x02000000; - TRACE( "Setting first magic to 0x%08lx\n", msgBody.unknown4[3] ); - - msgBody.unknown4[4] = 0x0; - msgBody.unknown4[5] = 0x0; - msgBody.unknown4[6] = 0x0; - - msgBody.unknown4[7] = NS_GetNsMagic( This->dp2->lpNameServerData ); - TRACE( "Setting second magic to 0x%08lx\n", msgBody.unknown4[7] ); - - msgBody.unknown4[8] = 0x0; - msgBody.unknown4[9] = 0x0; - msgBody.unknown4[10] = 0x0; - msgBody.unknown4[11] = 0x0; - - msgBody.unknown5[0] = 0x0; - msgBody.unknown5[1] = 0x0; + msgBody.toId = 0; + msgBody.playerId = dpidServer; + msgBody.groupId = 0; + msgBody.createOffset = sizeof( msgBody ); + msgBody.passwordOffset = sizeof( msgBody ) + sizeof( playerInfo ) + spPlayerDataSize; + + playerInfo.size = sizeof( playerInfo ) + spPlayerDataSize; + playerInfo.flags = DPLAYI_PLAYER_SYSPLAYER | DPLAYI_PLAYER_PLAYERLOCAL; + playerInfo.id = dpidServer; + playerInfo.shortNameLength = 0; + playerInfo.longNameLength = 0; + playerInfo.spDataLength = spPlayerDataSize; + playerInfo.playerDataLength = 0; + playerInfo.playerCount = 0; + playerInfo.systemPlayerId = dpidServer; + playerInfo.fixedSize = sizeof( playerInfo ); + playerInfo.version = DPMSGVER_DP6; + playerInfo.parentId = 0;
/* Send the message */ { WORD replyCommands[] = { DPMSGCMD_GETNAMETABLEREPLY, DPMSGCMD_SUPERENUMPLAYERSREPLY }; - SGBUFFER buffers[ 2 ] = { 0 }; + SGBUFFER buffers[ 6 ] = { 0 }; DPSP_SENDEXDATA data = { 0 };
buffers[ 0 ].len = This->dp2->spData.dwSPHeaderSize; buffers[ 1 ].len = sizeof( msgBody ); buffers[ 1 ].pData = (UCHAR *) &msgBody; + buffers[ 2 ].len = sizeof( playerInfo ); + buffers[ 2 ].pData = (UCHAR *) &playerInfo; + buffers[ 3 ].len = spPlayerDataSize; + buffers[ 3 ].pData = (UCHAR *) spPlayerData; + buffers[ 4 ].len = (lstrlenW( password ) + 1) * sizeof( WCHAR ); + buffers[ 4 ].pData = (UCHAR *) password; + buffers[ 5 ].len = sizeof( This->dp2->lpSessionDesc->dwReserved1 ); + buffers[ 5 ].pData = (UCHAR *) &This->dp2->lpSessionDesc->dwReserved1;
data.lpISP = This->dp2->spData.lpISP; data.dwFlags = DPSEND_GUARANTEED; diff --git a/dlls/dplayx/dplayx_messages.h b/dlls/dplayx/dplayx_messages.h index 6c2a210cb1d..f14ed1f4371 100644 --- a/dlls/dplayx/dplayx_messages.h +++ b/dlls/dplayx/dplayx_messages.h @@ -50,6 +50,22 @@ void DP_MSG_ToSelf( IDirectPlayImpl *This, DPID dpidSelf ); /* Message types etc. */ #include "pshpack1.h"
+typedef struct +{ + DWORD size; + DWORD flags; + DPID id; + DWORD shortNameLength; + DWORD longNameLength; + DWORD spDataLength; + DWORD playerDataLength; + DWORD playerCount; + DPID systemPlayerId; + DWORD fixedSize; + DWORD version; + DPID parentId; +} DPLAYI_PACKEDPLAYER; + /* Non provided messages for DPLAY - guess work which may be wrong :( */ #define DPMSGCMD_ENUMSESSIONSREPLY 1 #define DPMSGCMD_ENUMSESSIONSREQUEST 2 @@ -186,25 +202,11 @@ typedef struct tagDPMSG_FORWARDADDPLAYER { DPMSG_SENDENVELOPE envelope;
- DWORD unknown; /* 0 */ - - DPID dpidAppServer; /* Remote application server id */ - DWORD unknown2[5]; /* 0x0, 0x1c, 0x6c, 0x50, 0x9 */ - - DPID dpidAppServer2; /* Remote application server id again !? */ - DWORD unknown3[5]; /* 0x0, 0x0, 0x20, 0x0, 0x0 */ - - DPID dpidAppServer3; /* Remote application server id again !? */ - - DWORD unknown4[12]; /* ??? - Is this a clump of 5 and then 8? */ - /* NOTE: 1 byte in front of the two 0x??090002 entries changes! - * Is it a timestamp of some sort? 1st always smaller than - * other... - */ -#define FORWARDADDPLAYER_UNKNOWN4_INIT { 0x30, 0xb, 0x0, 0x1e090002, 0x0, 0x0, 0x0, 0x32090002, 0x0, 0x0, 0x0, 0x0 } - - BYTE unknown5[2]; /* 2 bytes at the end. This may be a part of something! ( 0x0, 0x0) */ - + DPID toId; + DPID playerId; + DPID groupId; + DWORD createOffset; + DWORD passwordOffset; } DPMSG_FORWARDADDPLAYER, *LPDPMSG_FORWARDADDPLAYER; typedef const DPMSG_FORWARDADDPLAYER* LPCDPMSG_FORWARDADDPLAYER;
diff --git a/dlls/dplayx/name_server.c b/dlls/dplayx/name_server.c index 1342cb7b962..44af9a8d566 100644 --- a/dlls/dplayx/name_server.c +++ b/dlls/dplayx/name_server.c @@ -184,14 +184,6 @@ LPVOID NS_GetNSAddr( LPVOID lpNSInfo ) #endif }
-/* Get the magic number associated with the Name Server */ -DWORD NS_GetNsMagic( LPVOID lpNSInfo ) -{ - LPDWORD lpHdrInfo = NS_GetNSAddr( lpNSInfo ); - - return lpHdrInfo[1]; -} - void NS_SetLocalAddr( LPVOID lpNSInfo, LPCVOID lpHdr, DWORD dwHdrSize ) { lpNSCache lpCache = (lpNSCache)lpNSInfo; diff --git a/dlls/dplayx/name_server.h b/dlls/dplayx/name_server.h index b946e9e1fd9..e4fb11db22e 100644 --- a/dlls/dplayx/name_server.h +++ b/dlls/dplayx/name_server.h @@ -35,7 +35,6 @@ void NS_AddRemoteComputerAsNameServer( LPCVOID lpNSAddrHdr, DWORD msgSize, LPVOID lpNSInfo ); LPVOID NS_GetNSAddr( LPVOID lpNSInfo ); -DWORD NS_GetNsMagic( LPVOID lpNSInfo ); void NS_SetLocalAddr( LPVOID lpNSInfo, LPCVOID lpHdr, DWORD dwHdrSize );
void NS_ReplyToEnumSessionsRequest( LPCVOID lpcMsg,