dplayx: Merge the IDirectPlay4_SetGroupData helper.

This commit is contained in:
Michael Stefaniuc 2013-03-29 16:56:47 +01:00 committed by Alexandre Julliard
parent 0dd3f041f4
commit 1d43acf5f9
1 changed files with 34 additions and 54 deletions

View File

@ -137,9 +137,6 @@ static HRESULT DP_SP_SendEx
( IDirectPlay2Impl* This, DWORD dwFlags, ( IDirectPlay2Impl* This, DWORD dwFlags,
LPVOID lpData, DWORD dwDataSize, DWORD dwPriority, DWORD dwTimeout, LPVOID lpData, DWORD dwDataSize, DWORD dwPriority, DWORD dwTimeout,
LPVOID lpContext, LPDWORD lpdwMsgID ); LPVOID lpContext, LPDWORD lpdwMsgID );
static HRESULT DP_IF_SetGroupData
( IDirectPlay2Impl* This, DPID idGroup, LPVOID lpData,
DWORD dwDataSize, DWORD dwFlags, BOOL bAnsi );
static HRESULT DP_IF_CancelMessage static HRESULT DP_IF_CancelMessage
( IDirectPlay4Impl* This, DWORD dwMsgID, DWORD dwFlags, ( IDirectPlay4Impl* This, DWORD dwMsgID, DWORD dwFlags,
DWORD dwMinPriority, DWORD dwMaxPriority, BOOL bAnsi ); DWORD dwMinPriority, DWORD dwMaxPriority, BOOL bAnsi );
@ -2648,63 +2645,46 @@ static HRESULT WINAPI IDirectPlay4Impl_Send( IDirectPlay4 *iface, DPID from, DPI
return IDirectPlayX_SendEx( iface, from, to, flags, data, size, 0, 0, NULL, NULL ); return IDirectPlayX_SendEx( iface, from, to, flags, data, size, 0, 0, NULL, NULL );
} }
static HRESULT DP_IF_SetGroupData static HRESULT WINAPI IDirectPlay4AImpl_SetGroupData( IDirectPlay4A *iface, DPID group, void *data,
( IDirectPlay2Impl* This, DPID idGroup, LPVOID lpData, DWORD size, DWORD flags )
DWORD dwDataSize, DWORD dwFlags, BOOL bAnsi )
{ {
lpGroupData lpGData; IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
return IDirectPlayX_SetGroupData( &This->IDirectPlay4_iface, group, data, size, flags );
}
TRACE( "(%p)->(0x%08x,%p,0x%08x,0x%08x,%u)\n", static HRESULT WINAPI IDirectPlay4Impl_SetGroupData( IDirectPlay4 *iface, DPID group, void *data,
This, idGroup, lpData, dwDataSize, dwFlags, bAnsi ); DWORD size, DWORD flags )
{
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
lpGroupData gdata;
/* Parameter check */ TRACE( "(%p)->(0x%08x,%p,0x%08x,0x%08x)\n", This, group, data, size, flags );
if( ( lpData == NULL ) &&
( dwDataSize != 0 )
)
{
return DPERR_INVALIDPARAMS;
}
/* Find the pointer to the data for this player */ /* Parameter check */
if( ( lpGData = DP_FindAnyGroup( This, idGroup ) ) == NULL ) if ( !data && size )
{ return DPERR_INVALIDPARAMS;
return DPERR_INVALIDOBJECT;
}
if( !(dwFlags & DPSET_LOCAL) ) /* Find the pointer to the data for this player */
{ if ( ( gdata = DP_FindAnyGroup( This, group ) ) == NULL )
FIXME( "Was this group created by this interface?\n" ); return DPERR_INVALIDOBJECT;
/* FIXME: If this is a remote update need to allow it but not
* send a message. if ( !(flags & DPSET_LOCAL) )
{
FIXME( "Was this group created by this interface?\n" );
/* FIXME: If this is a remote update need to allow it but not
* send a message.
*/
}
DP_SetGroupData( gdata, flags, data, size );
/* FIXME: Only send a message if this group is local to the session otherwise
* it will have been rejected above
*/ */
} if ( !(flags & DPSET_LOCAL) )
FIXME( "Send msg?\n" );
DP_SetGroupData( lpGData, dwFlags, lpData, dwDataSize ); return DP_OK;
/* FIXME: Only send a message if this group is local to the session otherwise
* it will have been rejected above
*/
if( !(dwFlags & DPSET_LOCAL) )
{
FIXME( "Send msg?\n" );
}
return DP_OK;
}
static HRESULT WINAPI IDirectPlay4AImpl_SetGroupData( IDirectPlay4A *iface, DPID idGroup,
void *lpData, DWORD dwDataSize, DWORD dwFlags )
{
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
return DP_IF_SetGroupData( This, idGroup, lpData, dwDataSize, dwFlags, TRUE );
}
static HRESULT WINAPI DirectPlay2WImpl_SetGroupData
( LPDIRECTPLAY2 iface, DPID idGroup, LPVOID lpData,
DWORD dwDataSize, DWORD dwFlags )
{
IDirectPlay2Impl *This = (IDirectPlay2Impl *)iface;
return DP_IF_SetGroupData( This, idGroup, lpData, dwDataSize, dwFlags, FALSE );
} }
static HRESULT DP_IF_SetGroupName static HRESULT DP_IF_SetGroupName
@ -4475,7 +4455,7 @@ static const IDirectPlay4Vtbl dp4_vt =
IDirectPlay4Impl_Open, IDirectPlay4Impl_Open,
XCAST(Receive)DirectPlay2WImpl_Receive, XCAST(Receive)DirectPlay2WImpl_Receive,
IDirectPlay4Impl_Send, IDirectPlay4Impl_Send,
XCAST(SetGroupData)DirectPlay2WImpl_SetGroupData, IDirectPlay4Impl_SetGroupData,
XCAST(SetGroupName)DirectPlay2WImpl_SetGroupName, XCAST(SetGroupName)DirectPlay2WImpl_SetGroupName,
XCAST(SetPlayerData)DirectPlay2WImpl_SetPlayerData, XCAST(SetPlayerData)DirectPlay2WImpl_SetPlayerData,
XCAST(SetPlayerName)DirectPlay2WImpl_SetPlayerName, XCAST(SetPlayerName)DirectPlay2WImpl_SetPlayerName,