Module: wine Branch: master Commit: d142447c2696a9a997e5931cd019f04d1d0ea0ca URL: http://source.winehq.org/git/wine.git/?a=commit;h=d142447c2696a9a997e5931cd0...
Author: Ismael Barros razielmine@gmail.com Date: Thu Jul 31 20:17:32 2008 +0300
dplayx: Tests for InitializeConnection.
---
dlls/dplayx/dplay.c | 10 +++++++++ dlls/dplayx/tests/dplayx.c | 47 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 06b6155..91ba4d6 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -4227,11 +4227,21 @@ static HRESULT WINAPI DP_IF_InitializeConnection
TRACE("(%p)->(%p,0x%08x,%u)\n", This, lpConnection, dwFlags, bAnsi );
+ if ( lpConnection == NULL ) + { + return DPERR_INVALIDPARAMS; + } + if( dwFlags != 0 ) { return DPERR_INVALIDFLAGS; }
+ if( This->dp2->connectionInitialized != NO_PROVIDER ) + { + return DPERR_ALREADYINITIALIZED; + } + /* Find out what the requested SP is and how large this buffer is */ hr = DPL_EnumAddress( DP_GetSpLpGuidFromCompoundAddress, lpConnection, dwAddrSize, &guidSP ); diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c index 56e0f7e..3a442c9 100644 --- a/dlls/dplayx/tests/dplayx.c +++ b/dlls/dplayx/tests/dplayx.c @@ -707,6 +707,52 @@ static void test_EnumConnections(void) IDirectPlayX_Release( pDP ); }
+/* InitializeConnection */ + +static BOOL CALLBACK EnumConnections_cb2( LPCGUID lpguidSP, + LPVOID lpConnection, + DWORD dwConnectionSize, + LPCDPNAME lpName, + DWORD dwFlags, + LPVOID lpContext ) +{ + LPDIRECTPLAY4 pDP = (LPDIRECTPLAY4) lpContext; + HRESULT hr; + + /* Incorrect parameters */ + hr = IDirectPlayX_InitializeConnection( pDP, NULL, 1 ); + checkHR( DPERR_INVALIDPARAMS, hr ); + hr = IDirectPlayX_InitializeConnection( pDP, lpConnection, 1 ); + checkHR( DPERR_INVALIDFLAGS, hr ); + + /* Normal operation. + We're only interested in ensuring that the TCP/IP provider works */ + + if( IsEqualGUID(lpguidSP, &DPSPGUID_TCPIP) ) + { + hr = IDirectPlayX_InitializeConnection( pDP, lpConnection, 0 ); + todo_wine checkHR( DP_OK, hr ); + hr = IDirectPlayX_InitializeConnection( pDP, lpConnection, 0 ); + todo_wine checkHR( DPERR_ALREADYINITIALIZED, hr ); + } + + return TRUE; +} + +static void test_InitializeConnection(void) +{ + + LPDIRECTPLAY4 pDP; + + CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL, + &IID_IDirectPlay4A, (LPVOID*) &pDP ); + + IDirectPlayX_EnumConnections( pDP, &appGuid, EnumConnections_cb2, + (LPVOID) pDP, 0 ); + + IDirectPlayX_Release( pDP ); +} +
START_TEST(dplayx) { @@ -714,6 +760,7 @@ START_TEST(dplayx)
test_DirectPlayCreate(); test_EnumConnections(); + test_InitializeConnection();
CoUninitialize(); }