Commit b150f9ad authored by Alexandre Julliard's avatar Alexandre Julliard

dplayx/tests: Use nameless unions/structs.

parent 6fe18646
......@@ -1205,12 +1205,12 @@ static BOOL CALLBACK EnumSessions_cb2( LPCDPSESSIONDESC2 lpThisSD,
if ( lpThisSD->dwFlags & DPSESSION_PASSWORDREQUIRED )
{
/* Incorrect password */
U2(dpsd).lpszPasswordA = (LPSTR) "sonic boom";
dpsd.lpszPasswordA = (LPSTR) "sonic boom";
hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN );
checkHR( DPERR_INVALIDPASSWORD, hr );
/* Correct password */
U2(dpsd).lpszPasswordA = (LPSTR) "hadouken";
dpsd.lpszPasswordA = (LPSTR) "hadouken";
hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN );
checkHR( DP_OK, hr );
}
......@@ -1342,7 +1342,7 @@ static void test_Open(void)
/* Join to protected session */
IDirectPlayX_Close( pDP_server );
U2(dpsd_server).lpszPasswordA = (LPSTR) "hadouken";
dpsd_server.lpszPasswordA = (LPSTR) "hadouken";
hr = IDirectPlayX_Open( pDP_server, &dpsd_server, DPOPEN_CREATE );
todo_wine checkHR( DP_OK, hr );
......@@ -1373,7 +1373,7 @@ static BOOL CALLBACK EnumSessions_cb( LPCDPSESSIONDESC2 lpThisSD,
check( FALSE, lpThisSD == NULL );
if ( U2(*lpThisSD).lpszPasswordA != NULL )
if ( lpThisSD->lpszPasswordA != NULL )
{
check( TRUE, (lpThisSD->dwFlags & DPSESSION_PASSWORDREQUIRED) != 0 );
}
......@@ -1384,7 +1384,7 @@ static BOOL CALLBACK EnumSessions_cb( LPCDPSESSIONDESC2 lpThisSD,
}
check( sizeof(*lpThisSD), lpThisSD->dwSize );
checkLP( NULL, U2(*lpThisSD).lpszPasswordA );
checkLP( NULL, lpThisSD->lpszPasswordA );
return TRUE;
}
......@@ -1411,7 +1411,7 @@ static IDirectPlay4 *create_session(DPSESSIONDESC2 *lpdpsd)
{
ZeroMemory( &name, sizeof(DPNAME) );
name.dwSize = sizeof(DPNAME);
U1(name).lpszShortNameA = (LPSTR) "bofh";
name.lpszShortNameA = (LPSTR) "bofh";
hr = IDirectPlayX_CreatePlayer( pDP, &dpid, &name, NULL, NULL,
0, DPPLAYER_SERVERPLAYER );
......@@ -1484,41 +1484,41 @@ static void test_EnumSessions(void)
memcpy( &dpsd_server[i], &dpsd, sizeof(DPSESSIONDESC2) );
}
U1(dpsd_server[0]).lpszSessionNameA = (LPSTR) "normal";
dpsd_server[0].lpszSessionNameA = (LPSTR) "normal";
dpsd_server[0].dwFlags = ( DPSESSION_CLIENTSERVER |
DPSESSION_DIRECTPLAYPROTOCOL );
dpsd_server[0].dwMaxPlayers = 10;
U1(dpsd_server[1]).lpszSessionNameA = (LPSTR) "full";
dpsd_server[1].lpszSessionNameA = (LPSTR) "full";
dpsd_server[1].dwFlags = ( DPSESSION_CLIENTSERVER |
DPSESSION_DIRECTPLAYPROTOCOL );
dpsd_server[1].dwMaxPlayers = 1;
U1(dpsd_server[2]).lpszSessionNameA = (LPSTR) "no new";
dpsd_server[2].lpszSessionNameA = (LPSTR) "no new";
dpsd_server[2].dwFlags = ( DPSESSION_CLIENTSERVER |
DPSESSION_DIRECTPLAYPROTOCOL |
DPSESSION_NEWPLAYERSDISABLED );
dpsd_server[2].dwMaxPlayers = 10;
U1(dpsd_server[3]).lpszSessionNameA = (LPSTR) "no join";
dpsd_server[3].lpszSessionNameA = (LPSTR) "no join";
dpsd_server[3].dwFlags = ( DPSESSION_CLIENTSERVER |
DPSESSION_DIRECTPLAYPROTOCOL |
DPSESSION_JOINDISABLED );
dpsd_server[3].dwMaxPlayers = 10;
U1(dpsd_server[4]).lpszSessionNameA = (LPSTR) "private";
dpsd_server[4].lpszSessionNameA = (LPSTR) "private";
dpsd_server[4].dwFlags = ( DPSESSION_CLIENTSERVER |
DPSESSION_DIRECTPLAYPROTOCOL |
DPSESSION_PRIVATE );
dpsd_server[4].dwMaxPlayers = 10;
U2(dpsd_server[4]).lpszPasswordA = (LPSTR) "password";
dpsd_server[4].lpszPasswordA = (LPSTR) "password";
U1(dpsd_server[5]).lpszSessionNameA = (LPSTR) "protected";
dpsd_server[5].lpszSessionNameA = (LPSTR) "protected";
dpsd_server[5].dwFlags = ( DPSESSION_CLIENTSERVER |
DPSESSION_DIRECTPLAYPROTOCOL |
DPSESSION_PASSWORDREQUIRED );
dpsd_server[5].dwMaxPlayers = 10;
U2(dpsd_server[5]).lpszPasswordA = (LPSTR) "password";
dpsd_server[5].lpszPasswordA = (LPSTR) "password";
for (i=0; i<N_SESSIONS; i++)
......@@ -1634,7 +1634,7 @@ static void test_EnumSessions(void)
/* - Only session password set */
for (i=4;i<=5;i++)
{
U2(dpsd_server[i]).lpszPasswordA = (LPSTR) "password";
dpsd_server[i].lpszPasswordA = (LPSTR) "password";
dpsd_server[i].dwFlags = 0;
pDPserver[i] = create_session( &dpsd_server[i] );
}
......@@ -1658,7 +1658,7 @@ static void test_EnumSessions(void)
for (i=4; i<=5; i++)
{
IDirectPlayX_Release( pDPserver[i] );
U2(dpsd_server[i]).lpszPasswordA = NULL;
dpsd_server[i].lpszPasswordA = NULL;
}
dpsd_server[4].dwFlags = DPSESSION_PRIVATE;
dpsd_server[5].dwFlags = DPSESSION_PASSWORDREQUIRED;
......@@ -1679,7 +1679,7 @@ static void test_EnumSessions(void)
for (i=4; i<=5; i++)
{
IDirectPlayX_Release( pDPserver[i] );
U2(dpsd_server[i]).lpszPasswordA = (LPSTR) "password";
dpsd_server[i].lpszPasswordA = (LPSTR) "password";
}
dpsd_server[4].dwFlags = DPSESSION_PRIVATE;
dpsd_server[5].dwFlags = DPSESSION_PASSWORDREQUIRED;
......@@ -1703,7 +1703,7 @@ static void test_EnumSessions(void)
check( 1, callbackData.dwCounter1 );
/* - Listing with incorrect password */
U2(dpsd).lpszPasswordA = (LPSTR) "bad_password";
dpsd.lpszPasswordA = (LPSTR) "bad_password";
callbackData.dwFlags = 0;
callbackData.dwCounter1 = -1;
hr = IDirectPlayX_EnumSessions( pDP, &dpsd, 0, EnumSessions_cb,
......@@ -1719,7 +1719,7 @@ static void test_EnumSessions(void)
check( 1, callbackData.dwCounter1 );
/* - Listing with correct password */
U2(dpsd).lpszPasswordA = (LPSTR) "password";
dpsd.lpszPasswordA = (LPSTR) "password";
callbackData.dwCounter1 = -1;
hr = IDirectPlayX_EnumSessions( pDP, &dpsd, 0, EnumSessions_cb,
&callbackData, callbackData.dwFlags );
......@@ -1727,7 +1727,7 @@ static void test_EnumSessions(void)
check( 2, callbackData.dwCounter1 );
U2(dpsd).lpszPasswordA = NULL;
dpsd.lpszPasswordA = NULL;
callbackData.dwFlags = DPENUMSESSIONS_ASYNC;
callbackData.dwCounter1 = -1;
hr = IDirectPlayX_EnumSessions( pDP, &dpsd, 0, EnumSessions_cb,
......@@ -1745,12 +1745,12 @@ static void test_EnumSessions(void)
IDirectPlayX_Release( pDPserver[i] );
dpsd_server[i].dwFlags = ( DPSESSION_CLIENTSERVER |
DPSESSION_DIRECTPLAYPROTOCOL );
U2(dpsd_server[i]).lpszPasswordA = NULL;
dpsd_server[i].lpszPasswordA = NULL;
dpsd_server[i].dwMaxPlayers = 10;
}
U1(dpsd_server[4]).lpszSessionNameA = (LPSTR) "normal1";
dpsd_server[4].lpszSessionNameA = (LPSTR) "normal1";
dpsd_server[4].guidApplication = appGuid;
U1(dpsd_server[5]).lpszSessionNameA = (LPSTR) "normal2";
dpsd_server[5].lpszSessionNameA = (LPSTR) "normal2";
dpsd_server[5].guidApplication = appGuid2;
for (i=4; i<=5; i++)
{
......@@ -1910,14 +1910,14 @@ if(0)
checkGuid( &lpData[0]->guidInstance, &lpData[1]->guidInstance );
/* Set: Regular operation */
U1(dpsd).lpszSessionNameA = (LPSTR) "Wahaa";
dpsd.lpszSessionNameA = (LPSTR) "Wahaa";
hr = IDirectPlayX_SetSessionDesc( pDP[0], &dpsd, 0 );
checkHR( DP_OK, hr );
dwDataSize = 1024;
hr = IDirectPlayX_GetSessionDesc( pDP[1], lpData[1], &dwDataSize );
checkHR( DP_OK, hr );
checkStr( U1(dpsd).lpszSessionNameA, U1(*lpData[1]).lpszSessionNameA );
checkStr( dpsd.lpszSessionNameA, lpData[1]->lpszSessionNameA );
/* Set: Failing to modify a remote session */
......@@ -2037,8 +2037,8 @@ static void test_CreatePlayer(void)
name.dwSize = sizeof(DPNAME);
U1(name).lpszShortNameA = (LPSTR) "test";
U2(name).lpszLongNameA = NULL;
name.lpszShortNameA = (LPSTR) "test";
name.lpszLongNameA = NULL;
hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, &name, NULL, NULL,
......@@ -2657,8 +2657,8 @@ static void test_PlayerName(void)
playerName.dwSize = sizeof(DPNAME);
U1(playerName).lpszShortNameA = (LPSTR) "player_name";
U2(playerName).lpszLongNameA = (LPSTR) "player_long_name";
playerName.lpszShortNameA = (LPSTR) "player_name";
playerName.lpszLongNameA = (LPSTR) "player_long_name";
/* Invalid parameters */
......@@ -2698,8 +2698,8 @@ if(0)
hr = IDirectPlayX_GetPlayerName( pDP[0], dpid[0], lpData, &dwDataSize );
checkHR( DP_OK, hr );
check( 45, dwDataSize );
checkStr( U1(playerName).lpszShortNameA, U1(*(LPDPNAME)lpData).lpszShortNameA );
checkStr( U2(playerName).lpszLongNameA, U2(*(LPDPNAME)lpData).lpszLongNameA );
checkStr( playerName.lpszShortNameA, ((LPDPNAME)lpData)->lpszShortNameA );
checkStr( playerName.lpszLongNameA, ((LPDPNAME)lpData)->lpszLongNameA );
check( 0, ((LPDPNAME)lpData)->dwFlags );
hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[0], NULL, 0 );
......@@ -2708,8 +2708,8 @@ if(0)
hr = IDirectPlayX_GetPlayerName( pDP[0], dpid[0], lpData, &dwDataSize );
checkHR( DP_OK, hr );
check( 16, dwDataSize );
checkLP( NULL, U1(*(LPDPNAME)lpData).lpszShortNameA );
checkLP( NULL, U2(*(LPDPNAME)lpData).lpszLongNameA );
checkLP( NULL, ((LPDPNAME)lpData)->lpszShortNameA );
checkLP( NULL, ((LPDPNAME)lpData)->lpszLongNameA );
check( 0, ((LPDPNAME)lpData)->dwFlags );
......@@ -2727,8 +2727,8 @@ if(0)
hr = IDirectPlayX_GetPlayerName( pDP[0], dpid[0], lpData, &dwDataSize );
checkHR( DP_OK, hr );
check( 16, dwDataSize );
checkLP( NULL, U1(*(LPDPNAME)lpData).lpszShortNameA );
checkLP( NULL, U2(*(LPDPNAME)lpData).lpszLongNameA );
checkLP( NULL, ((LPDPNAME)lpData)->lpszShortNameA );
checkLP( NULL, ((LPDPNAME)lpData)->lpszLongNameA );
check( 0, ((LPDPNAME)lpData)->dwFlags );
......@@ -2740,12 +2740,12 @@ if(0)
hr = IDirectPlayX_GetPlayerName( pDP[0], dpid[0], lpData, &dwDataSize );
checkHR( DP_OK, hr );
check( 45, dwDataSize );
checkStr( U1(playerName).lpszShortNameA, U1(*(LPDPNAME)lpData).lpszShortNameA );
checkStr( U2(playerName).lpszLongNameA, U2(*(LPDPNAME)lpData).lpszLongNameA );
checkStr( playerName.lpszShortNameA, ((LPDPNAME)lpData)->lpszShortNameA );
checkStr( playerName.lpszLongNameA, ((LPDPNAME)lpData)->lpszLongNameA );
check( 0, ((LPDPNAME)lpData)->dwFlags );
/* - Local (no propagation) */
U1(playerName).lpszShortNameA = (LPSTR) "no_propagation";
playerName.lpszShortNameA = (LPSTR) "no_propagation";
hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[0], &playerName,
DPSET_LOCAL );
checkHR( DP_OK, hr );
......@@ -2755,18 +2755,18 @@ if(0)
lpData, &dwDataSize ); /* Local fetch */
checkHR( DP_OK, hr );
check( 48, dwDataSize );
checkStr( "no_propagation", U1(*(LPDPNAME)lpData).lpszShortNameA );
checkStr( "no_propagation", ((LPDPNAME)lpData)->lpszShortNameA );
dwDataSize = 1024;
hr = IDirectPlayX_GetPlayerName( pDP[1], dpid[0],
lpData, &dwDataSize ); /* Remote fetch */
checkHR( DP_OK, hr );
check( 45, dwDataSize );
checkStr( "player_name", U1(*(LPDPNAME)lpData).lpszShortNameA );
checkStr( "player_name", ((LPDPNAME)lpData)->lpszShortNameA );
/* -- 2 */
U1(playerName).lpszShortNameA = (LPSTR) "no_propagation_2";
playerName.lpszShortNameA = (LPSTR) "no_propagation_2";
hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[0], &playerName,
DPSET_LOCAL | DPSET_REMOTE );
checkHR( DP_OK, hr );
......@@ -2776,17 +2776,17 @@ if(0)
lpData, &dwDataSize ); /* Local fetch */
checkHR( DP_OK, hr );
check( 50, dwDataSize );
checkStr( "no_propagation_2", U1(*(LPDPNAME)lpData).lpszShortNameA );
checkStr( "no_propagation_2", ((LPDPNAME)lpData)->lpszShortNameA );
dwDataSize = 1024;
hr = IDirectPlayX_GetPlayerName( pDP[1], dpid[0],
lpData, &dwDataSize ); /* Remote fetch */
checkHR( DP_OK, hr );
check( 45, dwDataSize );
checkStr( "player_name", U1(*(LPDPNAME)lpData).lpszShortNameA );
checkStr( "player_name", ((LPDPNAME)lpData)->lpszShortNameA );
/* - Remote (propagation, default) */
U1(playerName).lpszShortNameA = (LPSTR) "propagation";
playerName.lpszShortNameA = (LPSTR) "propagation";
hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[0], &playerName,
DPSET_REMOTE );
checkHR( DP_OK, hr );
......@@ -2796,10 +2796,10 @@ if(0)
lpData, &dwDataSize ); /* Remote fetch */
checkHR( DP_OK, hr );
check( 45, dwDataSize );
checkStr( "propagation", U1(*(LPDPNAME)lpData).lpszShortNameA );
checkStr( "propagation", ((LPDPNAME)lpData)->lpszShortNameA );
/* -- 2 */
U1(playerName).lpszShortNameA = (LPSTR) "propagation_2";
playerName.lpszShortNameA = (LPSTR) "propagation_2";
hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[0], &playerName,
0 );
checkHR( DP_OK, hr );
......@@ -2809,7 +2809,7 @@ if(0)
lpData, &dwDataSize ); /* Remote fetch */
checkHR( DP_OK, hr );
check( 47, dwDataSize );
checkStr( "propagation_2", U1(*(LPDPNAME)lpData).lpszShortNameA );
checkStr( "propagation_2", ((LPDPNAME)lpData)->lpszShortNameA );
/* Checking system messages */
......@@ -2853,8 +2853,8 @@ static BOOL CALLBACK EnumSessions_cb_join_secure( LPCDPSESSIONDESC2 lpThisSD,
ZeroMemory( &dpCredentials, sizeof(DPCREDENTIALS) );
dpCredentials.dwSize = sizeof(DPCREDENTIALS);
U1(dpCredentials).lpszUsernameA = (LPSTR) "user";
U2(dpCredentials).lpszPasswordA = (LPSTR) "pass";
dpCredentials.lpszUsernameA = (LPSTR) "user";
dpCredentials.lpszPasswordA = (LPSTR) "pass";
hr = IDirectPlayX_SecureOpen( pDP, &dpsd, DPOPEN_JOIN,
NULL, &dpCredentials );
checkHR( DPERR_LOGONDENIED, hr ); /* TODO: Make this work */
......@@ -3382,7 +3382,7 @@ static void test_CreateGroup(void)
groupName.dwSize = sizeof(DPNAME);
U1(groupName).lpszShortNameA = (LPSTR) lpData;
groupName.lpszShortNameA = (LPSTR) lpData;
hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
......@@ -3401,14 +3401,14 @@ static void test_CreateGroup(void)
hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0, lpDataGet,
&dwDataSizeGet );
checkHR( DP_OK, hr );
if ( NULL == U1(lpDataGet->dpnName).lpszShortNameA )
if ( NULL == lpDataGet->dpnName.lpszShortNameA )
{
check( 48, dwDataSizeGet );
}
else
{
check( 48 + dwDataSize, dwDataSizeGet );
checkStr( lpData, U1(lpDataGet->dpnName).lpszShortNameA );
checkStr( lpData, lpDataGet->dpnName.lpszShortNameA );
}
check( DPID_SYSMSG, idFrom );
checkConv( DPSYS_CREATEPLAYERORGROUP, lpDataGet->dwType, dpMsgType2str );
......@@ -5490,7 +5490,7 @@ static void test_Receive(void)
check( DPPLAYERTYPE_PLAYER, lpDataCreate->dwPlayerType );
checkLP( NULL, lpDataCreate->lpData );
check( 0, lpDataCreate->dwDataSize );
checkLP( NULL, U1(lpDataCreate->dpnName).lpszShortNameA );
checkLP( NULL, lpDataCreate->dpnName.lpszShortNameA );
check( 0, lpDataCreate->dpIdParent );
}
else /* Player destruction */
......@@ -5504,7 +5504,7 @@ static void test_Receive(void)
check( 0, lpDataDestroy->dwLocalDataSize );
checkLP( NULL, lpDataDestroy->lpRemoteData );
check( 0, lpDataDestroy->dwRemoteDataSize );
checkLP( NULL, U1(lpDataDestroy->dpnName).lpszShortNameA );
checkLP( NULL, lpDataDestroy->dpnName.lpszShortNameA );
check( 0, lpDataDestroy->dpIdParent );
}
......@@ -6521,7 +6521,7 @@ static void test_host_migration(void)
check( 0, lpData->dwLocalDataSize );
checkLP( NULL, lpData->lpRemoteData );
check( 0, lpData->dwRemoteDataSize );
checkLP( NULL, U1(lpData->dpnName).lpszShortNameA );
checkLP( NULL, lpData->dpnName.lpszShortNameA );
check( 0, lpData->dpIdParent );
checkFlags( 0, lpData->dwFlags,
FLAGS_DPPLAYER | FLAGS_DPGROUP );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment