From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 57 ++++---------------------------------- dlls/dplayx/tests/dplayx.c | 36 +++++++++++------------- 2 files changed, 21 insertions(+), 72 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index f02226544ea..ecdb4d9a2df 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -1758,28 +1758,10 @@ static HRESULT DP_IF_CreatePlayer( IDirectPlayImpl *This, DPID *lpidPlayer, * to the name server if requesting a player id and to the SP when * informing it of the player creation */ - { - if( dwFlags & DPPLAYER_SERVERPLAYER ) - { - if( *lpidPlayer == DPID_SERVERPLAYER ) - { - /* Server player for the host interface */ - dwCreateFlags |= DPLAYI_PLAYER_APPSERVER; - } - else if( *lpidPlayer == DPID_NAME_SERVER ) - { - /* Name server - master of everything */ - dwCreateFlags |= (DPLAYI_PLAYER_NAMESRVR|DPLAYI_PLAYER_SYSPLAYER); - } - else - { - /* Server player for a non host interface */ - dwCreateFlags |= DPLAYI_PLAYER_SYSPLAYER; - } - } + if( dwFlags & DPPLAYER_SERVERPLAYER ) + dwCreateFlags |= DPLAYI_PLAYER_APPSERVER;
- dwCreateFlags |= DPLAYI_PLAYER_PLAYERLOCAL; - } + dwCreateFlags |= DPLAYI_PLAYER_PLAYERLOCAL;
/* Verify we know how to handle all the flags */ if( !( ( dwFlags & DPPLAYER_SERVERPLAYER ) || @@ -1792,7 +1774,7 @@ static HRESULT DP_IF_CreatePlayer( IDirectPlayImpl *This, DPID *lpidPlayer, }
/* If the name is not specified, we must provide one */ - if( *lpidPlayer == DPID_UNKNOWN ) + if( !(dwFlags & DPPLAYER_SERVERPLAYER) ) { /* If we are the session master, we dish out the group/player ids */ if( This->dp2->bHostInterface ) @@ -1815,6 +1797,7 @@ static HRESULT DP_IF_CreatePlayer( IDirectPlayImpl *This, DPID *lpidPlayer, /* FIXME: Would be nice to perhaps verify that we don't already have * this player. */ + *lpidPlayer = DPID_SERVERPLAYER; }
EnterCriticalSection( &This->lock ); @@ -1912,21 +1895,6 @@ static HRESULT WINAPI IDirectPlay4AImpl_CreatePlayer( IDirectPlay4A *iface, DPID DPNAME *lpPlayerName, HANDLE hEvent, void *lpData, DWORD dwDataSize, DWORD dwFlags ) { IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface ); - - if( lpidPlayer == NULL ) - { - return DPERR_INVALIDPARAMS; - } - - if( dwFlags & DPPLAYER_SERVERPLAYER ) - { - *lpidPlayer = DPID_SERVERPLAYER; - } - else - { - *lpidPlayer = DPID_UNKNOWN; - } - return DP_IF_CreatePlayer( This, lpidPlayer, lpPlayerName, hEvent, lpData, dwDataSize, dwFlags, TRUE ); } @@ -1935,21 +1903,6 @@ static HRESULT WINAPI IDirectPlay4Impl_CreatePlayer( IDirectPlay4 *iface, DPID * DPNAME *lpPlayerName, HANDLE hEvent, void *lpData, DWORD dwDataSize, DWORD dwFlags ) { IDirectPlayImpl *This = impl_from_IDirectPlay4( iface ); - - if( lpidPlayer == NULL ) - { - return DPERR_INVALIDPARAMS; - } - - if( dwFlags & DPPLAYER_SERVERPLAYER ) - { - *lpidPlayer = DPID_SERVERPLAYER; - } - else - { - *lpidPlayer = DPID_UNKNOWN; - } - return DP_IF_CreatePlayer( This, lpidPlayer, lpPlayerName, hEvent, lpData, dwDataSize, dwFlags, FALSE ); } diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c index d1ed9368511..c92de4cfcdc 100644 --- a/dlls/dplayx/tests/dplayx.c +++ b/dlls/dplayx/tests/dplayx.c @@ -4214,16 +4214,15 @@ static void checkCreatePlayerOrGroupMessages_( int line, IDirectPlay4 *dp, DWORD
#define check_CreatePlayer( dp, dpid, name, flags, expectedHr, expectedDpid, recvSock, requestExpected, \ expectedFlags, expectedShortName, expectedShortNameA, expectedLongName, expectedLongNameA, \ - expectedCurrentPlayers, hrTodo, dpidTodo, flagsTodo, nameTodo ) \ + expectedCurrentPlayers, flagsTodo, nameTodo ) \ check_CreatePlayer_( __LINE__, dp, dpid, name, flags, expectedHr, expectedDpid, recvSock, requestExpected, \ expectedFlags, expectedShortName, expectedShortNameA, expectedLongName, expectedLongNameA, \ - expectedCurrentPlayers, hrTodo, dpidTodo, flagsTodo, nameTodo ) + expectedCurrentPlayers, flagsTodo, nameTodo ) static void check_CreatePlayer_( int line, IDirectPlay4 *dp, DPID *dpid, DPNAME *name, DWORD flags, HRESULT expectedHr, DPID expectedDpid, SOCKET recvSock, BOOL requestExpected, DWORD expectedFlags, const WCHAR *expectedShortName, const char *expectedShortNameA, const WCHAR *expectedLongName, const char *expectedLongNameA, - DWORD expectedCurrentPlayers, BOOL hrTodo, BOOL dpidTodo, BOOL flagsTodo, - BOOL nameTodo ) + DWORD expectedCurrentPlayers, BOOL flagsTodo, BOOL nameTodo ) { BYTE playerData[] = { 1, 2, 3, 4, 5, 6, 7, 8, }; CreatePlayerParam *param; @@ -4250,9 +4249,9 @@ static void check_CreatePlayer_( int line, IDirectPlay4 *dp, DPID *dpid, DPNAME sendSuperEnumPlayersReply_( line, sendSock, 2349, 2399, &dpsd, L"" );
hr = createPlayerAsyncWait( param, 2000 ); - todo_wine_if( hrTodo ) ok_( __FILE__, line )( hr == expectedHr, "CreatePlayer() returned %#lx.\n", hr ); + ok_( __FILE__, line )( hr == expectedHr, "CreatePlayer() returned %#lx.\n", hr ); if ( dpid ) - todo_wine_if( dpidTodo ) ok_( __FILE__, line )( *dpid == expectedDpid, "got dpid %#lx.\n", *dpid ); + ok_( __FILE__, line )( *dpid == expectedDpid, "got dpid %#lx.\n", *dpid );
checkPlayerExists_( line, dp, expectedDpid, DPPLAYERTYPE_PLAYER, expectedShortNameA, expectedLongNameA, expectedFlags, playerData, sizeof( playerData ), flagsTodo ); @@ -4269,9 +4268,9 @@ static void check_CreatePlayer_( int line, IDirectPlay4 *dp, DPID *dpid, DPNAME else { hr = createPlayerAsyncWait( param, 2000 ); - todo_wine_if( hrTodo ) ok_( __FILE__, line )( hr == expectedHr, "CreatePlayer() returned %#lx.\n", hr ); + ok_( __FILE__, line )( hr == expectedHr, "CreatePlayer() returned %#lx.\n", hr ); if ( dpid ) - todo_wine_if( dpidTodo ) ok_( __FILE__, line )( *dpid == expectedDpid, "got dpid %#lx.\n", *dpid ); + ok_( __FILE__, line )( *dpid == expectedDpid, "got dpid %#lx.\n", *dpid ); }
if ( recvSock != INVALID_SOCKET ) @@ -4317,50 +4316,47 @@ static void test_CreatePlayer(void) /* Connection not initialized */ dpid = 0xdeadbeef; check_CreatePlayer( dp, &dpid, NULL, 0, DPERR_UNINITIALIZED, 0xdeadbeef, INVALID_SOCKET, FALSE, 0, NULL, NULL, - NULL, NULL, 0, FALSE, TRUE, FALSE, FALSE ); + NULL, NULL, 0, FALSE, FALSE );
init_TCPIP_provider( dp, "127.0.0.1", 0 );
/* Session not open */ dpid = 0xdeadbeef; check_CreatePlayer( dp, &dpid, NULL, 0, DPERR_INVALIDPARAMS, 0xdeadbeef, INVALID_SOCKET, FALSE, 0, NULL, NULL, - NULL, NULL, 0, FALSE, TRUE, FALSE, FALSE ); + NULL, NULL, 0, FALSE, FALSE );
/* Join to normal session */ joinSession( dp, &appGuidDpsd, &serverDpsd, &sendSock, &recvSock );
/* Player name */ dpid = 0xdeadbeef; - check_CreatePlayer( dp, &dpid, NULL, 0, DP_OK, 2, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 1, FALSE, FALSE, - FALSE, FALSE ); + check_CreatePlayer( dp, &dpid, NULL, 0, DP_OK, 2, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 1, FALSE, FALSE );
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, FALSE, FALSE, FALSE, TRUE ); + "short player name", L"long player name", "long player name", 2, FALSE, TRUE );
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, FALSE, FALSE, FALSE, TRUE ); + L"long player name", "long player name", 3, FALSE, TRUE );
dpid = 0xdeadbeef; - check_CreatePlayer( dp, &dpid, &nullName, 0, DP_OK, 5, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 4, FALSE, FALSE, - FALSE, FALSE ); + check_CreatePlayer( dp, &dpid, &nullName, 0, DP_OK, 5, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 4, FALSE, FALSE );
/* Null dpid */ dpid = 0xdeadbeef; check_CreatePlayer( dp, NULL, NULL, 0, DPERR_INVALIDPARAMS, 0, recvSock, FALSE, 0, NULL, NULL, NULL, NULL, 0, FALSE, - FALSE, FALSE, FALSE ); + FALSE );
/* Flags */ dpid = 0xdeadbeef; - check_CreatePlayer( dp, &dpid, NULL, 0, DP_OK, 6, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 5, FALSE, FALSE, - FALSE, FALSE ); + check_CreatePlayer( dp, &dpid, NULL, 0, DP_OK, 6, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 5, FALSE, FALSE );
dpid = 0xdeadbeef; check_CreatePlayer( dp, &dpid, NULL, DPPLAYER_SPECTATOR, DP_OK, 7, recvSock, TRUE, 0x208, NULL, NULL, NULL, NULL, 6, - FALSE, FALSE, TRUE, FALSE ); + TRUE, FALSE );
closesocket( recvSock ); closesocket( sendSock );