dplayx: Merge the IDirectPlay4_InitializeConnection helper.
This commit is contained in:
parent
c3df4764cf
commit
03464daa3d
|
@ -140,8 +140,6 @@ static HRESULT DP_IF_EnumSessions
|
||||||
( IDirectPlay2Impl* This, LPDPSESSIONDESC2 lpsd, DWORD dwTimeout,
|
( IDirectPlay2Impl* This, LPDPSESSIONDESC2 lpsd, DWORD dwTimeout,
|
||||||
LPDPENUMSESSIONSCALLBACK2 lpEnumSessionsCallback2,
|
LPDPENUMSESSIONSCALLBACK2 lpEnumSessionsCallback2,
|
||||||
LPVOID lpContext, DWORD dwFlags, BOOL bAnsi );
|
LPVOID lpContext, DWORD dwFlags, BOOL bAnsi );
|
||||||
static HRESULT DP_IF_InitializeConnection
|
|
||||||
( IDirectPlay3Impl* This, LPVOID lpConnection, DWORD dwFlags, BOOL bAnsi );
|
|
||||||
static BOOL CALLBACK cbDPCreateEnumConnections( LPCGUID lpguidSP,
|
static BOOL CALLBACK cbDPCreateEnumConnections( LPCGUID lpguidSP,
|
||||||
LPVOID lpConnection, DWORD dwConnectionSize, LPCDPNAME lpName,
|
LPVOID lpConnection, DWORD dwConnectionSize, LPCDPNAME lpName,
|
||||||
DWORD dwFlags, LPVOID lpContext );
|
DWORD dwFlags, LPVOID lpContext );
|
||||||
|
@ -1896,8 +1894,7 @@ static HRESULT DP_IF_EnumSessions
|
||||||
return DPERR_GENERIC;
|
return DPERR_GENERIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = DP_IF_InitializeConnection( (IDirectPlay3Impl*)This, lpConnection,
|
hr = IDirectPlayX_InitializeConnection( &This->IDirectPlay4_iface, lpConnection, 0 );
|
||||||
0, bAnsi );
|
|
||||||
if( FAILED(hr) )
|
if( FAILED(hr) )
|
||||||
{
|
{
|
||||||
return hr;
|
return hr;
|
||||||
|
@ -3735,35 +3732,36 @@ HRESULT DP_InitializeDPLSP( IDirectPlay3Impl* This, HMODULE hLobbyProvider )
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT DP_IF_InitializeConnection
|
static HRESULT WINAPI IDirectPlay4AImpl_InitializeConnection( IDirectPlay4A *iface,
|
||||||
( IDirectPlay3Impl* This, LPVOID lpConnection, DWORD dwFlags, BOOL bAnsi )
|
void *connection, DWORD flags )
|
||||||
{
|
{
|
||||||
HMODULE hServiceProvider;
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
||||||
|
return IDirectPlayX_InitializeConnection( &This->IDirectPlay4_iface, connection, flags );
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI IDirectPlay4Impl_InitializeConnection( IDirectPlay4 *iface,
|
||||||
|
void *connection, DWORD flags )
|
||||||
|
{
|
||||||
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
||||||
|
HMODULE servprov;
|
||||||
|
GUID sp;
|
||||||
|
const DWORD size = 80; /* FIXME: Need to calculate it correctly */
|
||||||
|
BOOL is_dp_sp; /* TRUE if Direct Play SP, FALSE if Direct Play Lobby SP */
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
GUID guidSP;
|
|
||||||
const DWORD dwAddrSize = 80; /* FIXME: Need to calculate it correctly */
|
|
||||||
BOOL bIsDpSp; /* TRUE if Direct Play SP, FALSE if Direct Play Lobby SP */
|
|
||||||
|
|
||||||
TRACE("(%p)->(%p,0x%08x,%u)\n", This, lpConnection, dwFlags, bAnsi );
|
TRACE( "(%p)->(%p,0x%08x)\n", This, connection, flags );
|
||||||
|
|
||||||
if ( lpConnection == NULL )
|
if ( !connection )
|
||||||
{
|
|
||||||
return DPERR_INVALIDPARAMS;
|
return DPERR_INVALIDPARAMS;
|
||||||
}
|
|
||||||
|
|
||||||
if( dwFlags != 0 )
|
if ( flags )
|
||||||
{
|
|
||||||
return DPERR_INVALIDFLAGS;
|
return DPERR_INVALIDFLAGS;
|
||||||
}
|
|
||||||
|
|
||||||
if ( This->dp2->connectionInitialized != NO_PROVIDER )
|
if ( This->dp2->connectionInitialized != NO_PROVIDER )
|
||||||
{
|
|
||||||
return DPERR_ALREADYINITIALIZED;
|
return DPERR_ALREADYINITIALIZED;
|
||||||
}
|
|
||||||
|
|
||||||
/* Find out what the requested SP is and how large this buffer is */
|
/* Find out what the requested SP is and how large this buffer is */
|
||||||
hr = DPL_EnumAddress( DP_GetSpLpGuidFromCompoundAddress, lpConnection,
|
hr = DPL_EnumAddress( DP_GetSpLpGuidFromCompoundAddress, connection, size, &sp );
|
||||||
dwAddrSize, &guidSP );
|
|
||||||
|
|
||||||
if ( FAILED(hr) )
|
if ( FAILED(hr) )
|
||||||
{
|
{
|
||||||
|
@ -3772,68 +3770,36 @@ static HRESULT DP_IF_InitializeConnection
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load the service provider */
|
/* Load the service provider */
|
||||||
hServiceProvider = DP_LoadSP( &guidSP, &This->dp2->spData, &bIsDpSp );
|
servprov = DP_LoadSP( &sp, &This->dp2->spData, &is_dp_sp );
|
||||||
|
|
||||||
if( hServiceProvider == 0 )
|
if ( !servprov )
|
||||||
{
|
{
|
||||||
ERR( "Unable to load service provider %s\n", debugstr_guid(&guidSP) );
|
ERR( "Unable to load service provider %s\n", debugstr_guid(&sp) );
|
||||||
return DPERR_UNAVAILABLE;
|
return DPERR_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( bIsDpSp )
|
if ( is_dp_sp )
|
||||||
{
|
{
|
||||||
/* Fill in what we can of the Service Provider required information.
|
/* Fill in what we can of the Service Provider required information.
|
||||||
* The rest was be done in DP_LoadSP
|
* The rest was be done in DP_LoadSP
|
||||||
*/
|
*/
|
||||||
This->dp2->spData.lpAddress = lpConnection;
|
This->dp2->spData.lpAddress = connection;
|
||||||
This->dp2->spData.dwAddressSize = dwAddrSize;
|
This->dp2->spData.dwAddressSize = size;
|
||||||
This->dp2->spData.lpGuid = &guidSP;
|
This->dp2->spData.lpGuid = &sp;
|
||||||
|
hr = DP_InitializeDPSP( This, servprov );
|
||||||
hr = DP_InitializeDPSP( This, hServiceProvider );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
This->dp2->dplspData.lpAddress = lpConnection;
|
This->dp2->dplspData.lpAddress = connection;
|
||||||
|
hr = DP_InitializeDPLSP( This, servprov );
|
||||||
hr = DP_InitializeDPLSP( This, hServiceProvider );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FAILED(hr) )
|
if ( FAILED(hr) )
|
||||||
{
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
|
||||||
|
|
||||||
return DP_OK;
|
return DP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectPlay4AImpl_InitializeConnection( IDirectPlay4A *iface,
|
|
||||||
void *lpConnection, DWORD dwFlags )
|
|
||||||
{
|
|
||||||
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
||||||
|
|
||||||
/* This may not be externally invoked once either an SP or LP is initialized */
|
|
||||||
if( This->dp2->connectionInitialized != NO_PROVIDER )
|
|
||||||
{
|
|
||||||
return DPERR_ALREADYINITIALIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DP_IF_InitializeConnection( This, lpConnection, dwFlags, TRUE );
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI DirectPlay3WImpl_InitializeConnection
|
|
||||||
( LPDIRECTPLAY3 iface, LPVOID lpConnection, DWORD dwFlags )
|
|
||||||
{
|
|
||||||
IDirectPlay3Impl *This = (IDirectPlay3Impl *)iface;
|
|
||||||
|
|
||||||
/* This may not be externally invoked once either an SP or LP is initialized */
|
|
||||||
if( This->dp2->connectionInitialized != NO_PROVIDER )
|
|
||||||
{
|
|
||||||
return DPERR_ALREADYINITIALIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DP_IF_InitializeConnection( This, lpConnection, dwFlags, FALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectPlay4AImpl_SecureOpen( IDirectPlay4A *iface,
|
static HRESULT WINAPI IDirectPlay4AImpl_SecureOpen( IDirectPlay4A *iface,
|
||||||
const DPSESSIONDESC2 *lpsd, DWORD dwFlags, const DPSECURITYDESC *lpSecurity,
|
const DPSESSIONDESC2 *lpsd, DWORD dwFlags, const DPSECURITYDESC *lpSecurity,
|
||||||
const DPCREDENTIALS *lpCredentials )
|
const DPCREDENTIALS *lpCredentials )
|
||||||
|
@ -4365,7 +4331,7 @@ static const IDirectPlay4Vtbl dp4_vt =
|
||||||
IDirectPlay4Impl_EnumConnections,
|
IDirectPlay4Impl_EnumConnections,
|
||||||
IDirectPlay4Impl_EnumGroupsInGroup,
|
IDirectPlay4Impl_EnumGroupsInGroup,
|
||||||
IDirectPlay4Impl_GetGroupConnectionSettings,
|
IDirectPlay4Impl_GetGroupConnectionSettings,
|
||||||
XCAST(InitializeConnection)DirectPlay3WImpl_InitializeConnection,
|
IDirectPlay4Impl_InitializeConnection,
|
||||||
XCAST(SecureOpen)DirectPlay3WImpl_SecureOpen,
|
XCAST(SecureOpen)DirectPlay3WImpl_SecureOpen,
|
||||||
IDirectPlay4Impl_SendChatMessage,
|
IDirectPlay4Impl_SendChatMessage,
|
||||||
IDirectPlay4Impl_SetGroupConnectionSettings,
|
IDirectPlay4Impl_SetGroupConnectionSettings,
|
||||||
|
|
Loading…
Reference in New Issue