From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 18 ++++++++++++------ dlls/dplayx/dplay_global.h | 2 ++ dlls/dplayx/tests/dplayx.c | 5 ++--- 3 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 20611b283fd..baeab4ac45a 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -322,7 +322,7 @@ static void *DP_DuplicateString( void *src, BOOL dstAnsi, BOOL srcAnsi ) return dst; }
-static HRESULT DP_QueuePlayerMessage( IDirectPlayImpl *This, struct PlayerData *player, +static HRESULT DP_QueuePlayerMessage( IDirectPlayImpl *This, DPID fromId, struct PlayerData *player, DPID excludeId, void *msg, DWORD msgSize ) { struct DPMSG *elem; @@ -346,6 +346,9 @@ static HRESULT DP_QueuePlayerMessage( IDirectPlayImpl *This, struct PlayerData * } memcpy( elem->msg, msg, msgSize );
+ elem->fromId = fromId; + elem->toId = player->dpid; + DPQ_INSERT_IN_TAIL( This->dp2->receiveMsgs, elem, msgs );
if( player->hEvent ) @@ -354,8 +357,8 @@ static HRESULT DP_QueuePlayerMessage( IDirectPlayImpl *This, struct PlayerData * return DP_OK; }
-static HRESULT DP_QueueMessage( IDirectPlayImpl *This, DPID toId, DPID excludeId, void *msg, - DWORD msgSize ) +static HRESULT DP_QueueMessage( IDirectPlayImpl *This, DPID fromId, DPID toId, DPID excludeId, + void *msg, DWORD msgSize ) { struct PlayerList *plist; struct GroupData *group; @@ -363,14 +366,14 @@ static HRESULT DP_QueueMessage( IDirectPlayImpl *This, DPID toId, DPID excludeId
plist = DP_FindPlayer( This, toId ); if ( plist ) - return DP_QueuePlayerMessage( This, plist->lpPData, excludeId, msg, msgSize ); + return DP_QueuePlayerMessage( This, fromId, plist->lpPData, excludeId, msg, msgSize );
group = DP_FindAnyGroup( This, toId ); if( group ) { for( plist = DPQ_FIRST( group->players ); plist; plist = DPQ_NEXT( plist->players ) ) { - hr = DP_QueuePlayerMessage( This, plist->lpPData, excludeId, msg, msgSize ); + hr = DP_QueuePlayerMessage( This, fromId, plist->lpPData, excludeId, msg, msgSize ); if ( FAILED( hr ) ) return hr; } @@ -1690,7 +1693,7 @@ HRESULT DP_CreatePlayer( IDirectPlayImpl *This, void *msgHeader, DPID *lpid, DPN msg.dpIdParent = 0; msg.dwFlags = dwFlags;
- hr = DP_QueueMessage( This, DPID_ALLPLAYERS, *lpid, &msg, sizeof( msg ) ); + hr = DP_QueueMessage( This, DPID_SYSMSG, DPID_ALLPLAYERS, *lpid, &msg, sizeof( msg ) ); if ( FAILED( hr ) ) { DP_DeleteSPPlayer( This, *lpid ); @@ -3757,6 +3760,9 @@ static HRESULT DP_IF_Receive( IDirectPlayImpl *This, DPID *lpidFrom, DPID *lpidT return DPERR_NOMESSAGES; }
+ *lpidFrom = lpMsg->fromId; + *lpidTo = lpMsg->toId; + /* Copy into the provided buffer */ if (lpData) CopyMemory( lpData, lpMsg->msg, *lpdwDataSize );
diff --git a/dlls/dplayx/dplay_global.h b/dlls/dplayx/dplay_global.h index ebdb81f0a98..7c9b1c11a3a 100644 --- a/dlls/dplayx/dplay_global.h +++ b/dlls/dplayx/dplay_global.h @@ -134,6 +134,8 @@ typedef struct GroupList* lpGroupList; struct DPMSG { DPQ_ENTRY( DPMSG ) msgs; + DPID fromId; + DPID toId; DPMSG_GENERIC* msg; }; typedef struct DPMSG* LPDPMSG; diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c index 7df429e6b27..3bab15cac42 100644 --- a/dlls/dplayx/tests/dplayx.c +++ b/dlls/dplayx/tests/dplayx.c @@ -4078,7 +4078,7 @@ static DPID checkCreatePlayerOrGroupMessage_( int line, IDirectPlay4 *dp, DWORD toId = 0xdeadbeef; hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize ); ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr ); - todo_wine ok_( __FILE__, line )( fromId == DPID_SYSMSG, "got source id %#lx.\n", fromId ); + ok_( __FILE__, line )( fromId == DPID_SYSMSG, "got source id %#lx.\n", fromId );
msg = (DPMSG_CREATEPLAYERORGROUP *) msgData; ok_( __FILE__, line )( msg->dwType == DPSYS_CREATEPLAYERORGROUP, "got message type %#lx.\n", msg->dwType ); @@ -4200,8 +4200,7 @@ static void checkCreatePlayerOrGroupMessages_( int line, IDirectPlay4 *dp, DWORD break; } } - todo_wine ok_( __FILE__, line )( dpid && dpid != expectedDpid && j < data.idCount, "got destination id %#lx.\n", - dpid ); + ok_( __FILE__, line )( dpid && dpid != expectedDpid && j < data.idCount, "got destination id %#lx.\n", dpid ); } }