dplayx: Merge the IDirectPlay4_SendEx helper.
This commit is contained in:
parent
31065c62d4
commit
7964f42327
|
@ -113,10 +113,6 @@ static HRESULT DP_SecureOpen
|
||||||
( IDirectPlay2Impl* This, LPCDPSESSIONDESC2 lpsd, DWORD dwFlags,
|
( IDirectPlay2Impl* This, LPCDPSESSIONDESC2 lpsd, DWORD dwFlags,
|
||||||
LPCDPSECURITYDESC lpSecurity, LPCDPCREDENTIALS lpCredentials,
|
LPCDPSECURITYDESC lpSecurity, LPCDPCREDENTIALS lpCredentials,
|
||||||
BOOL bAnsi );
|
BOOL bAnsi );
|
||||||
static HRESULT DP_SendEx
|
|
||||||
( IDirectPlay2Impl* This, DPID idFrom, DPID idTo, DWORD dwFlags,
|
|
||||||
LPVOID lpData, DWORD dwDataSize, DWORD dwPriority, DWORD dwTimeout,
|
|
||||||
LPVOID lpContext, LPDWORD lpdwMsgID, BOOL bAnsi );
|
|
||||||
static HRESULT DP_IF_Receive
|
static HRESULT DP_IF_Receive
|
||||||
( IDirectPlay2Impl* This, LPDPID lpidFrom, LPDPID lpidTo,
|
( IDirectPlay2Impl* This, LPDPID lpidFrom, LPDPID lpidTo,
|
||||||
DWORD dwFlags, LPVOID lpData, LPDWORD lpdwDataSize, BOOL bAnsi );
|
DWORD dwFlags, LPVOID lpData, LPDWORD lpdwDataSize, BOOL bAnsi );
|
||||||
|
@ -844,8 +840,8 @@ static HRESULT DP_IF_CreateGroup
|
||||||
/* FIXME: Correct to just use send effectively? */
|
/* FIXME: Correct to just use send effectively? */
|
||||||
/* FIXME: Should size include data w/ message or just message "header" */
|
/* FIXME: Should size include data w/ message or just message "header" */
|
||||||
/* FIXME: Check return code */
|
/* FIXME: Check return code */
|
||||||
DP_SendEx( This, DPID_SERVERPLAYER, DPID_ALLPLAYERS, 0, &msg, sizeof( msg ),
|
IDirectPlayX_SendEx( &This->IDirectPlay4_iface, DPID_SERVERPLAYER, DPID_ALLPLAYERS, 0, &msg,
|
||||||
0, 0, NULL, NULL, bAnsi );
|
sizeof( msg ), 0, 0, NULL, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
return DP_OK;
|
return DP_OK;
|
||||||
|
@ -1325,8 +1321,8 @@ static HRESULT DP_IF_CreatePlayer
|
||||||
/* FIXME: Correct to just use send effectively? */
|
/* FIXME: Correct to just use send effectively? */
|
||||||
/* FIXME: Should size include data w/ message or just message "header" */
|
/* FIXME: Should size include data w/ message or just message "header" */
|
||||||
/* FIXME: Check return code */
|
/* FIXME: Check return code */
|
||||||
hr = DP_SendEx( This, DPID_SERVERPLAYER, DPID_ALLPLAYERS, 0, &msg,
|
hr = IDirectPlayX_SendEx( &This->IDirectPlay4_iface, DPID_SERVERPLAYER, DPID_ALLPLAYERS, 0,
|
||||||
sizeof( msg ), 0, 0, NULL, NULL, bAnsi );
|
&msg, sizeof( msg ), 0, 0, NULL, NULL );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3004,9 +3000,8 @@ static HRESULT DP_IF_CreateGroupInGroup
|
||||||
/* FIXME: Correct to just use send effectively? */
|
/* FIXME: Correct to just use send effectively? */
|
||||||
/* FIXME: Should size include data w/ message or just message "header" */
|
/* FIXME: Should size include data w/ message or just message "header" */
|
||||||
/* FIXME: Check return code */
|
/* FIXME: Check return code */
|
||||||
DP_SendEx( (IDirectPlay2Impl*)This,
|
IDirectPlayX_SendEx( &This->IDirectPlay4_iface, DPID_SERVERPLAYER, DPID_ALLPLAYERS, 0, &msg,
|
||||||
DPID_SERVERPLAYER, DPID_ALLPLAYERS, 0, &msg, sizeof( msg ),
|
sizeof( msg ), 0, 0, NULL, NULL );
|
||||||
0, 0, NULL, NULL, bAnsi );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return DP_OK;
|
return DP_OK;
|
||||||
|
@ -3890,141 +3885,78 @@ static HRESULT WINAPI IDirectPlay4Impl_SetGroupOwner( IDirectPlay4 *iface, DPID
|
||||||
return DP_OK;
|
return DP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT DP_SendEx
|
static HRESULT WINAPI IDirectPlay4AImpl_SendEx( IDirectPlay4A *iface, DPID from, DPID to,
|
||||||
( IDirectPlay2Impl* This, DPID idFrom, DPID idTo, DWORD dwFlags,
|
DWORD flags, void *data, DWORD size, DWORD priority, DWORD timeout, void *context,
|
||||||
LPVOID lpData, DWORD dwDataSize, DWORD dwPriority, DWORD dwTimeout,
|
DWORD *msgid )
|
||||||
LPVOID lpContext, LPDWORD lpdwMsgID, BOOL bAnsi )
|
|
||||||
{
|
{
|
||||||
BOOL bValidDestination = FALSE;
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
||||||
|
return IDirectPlayX_SendEx( &This->IDirectPlay4_iface, from, to, flags, data, size, priority,
|
||||||
|
timeout, context, msgid );
|
||||||
|
}
|
||||||
|
|
||||||
FIXME( "(%p)->(0x%08x,0x%08x,0x%08x,%p,0x%08x,0x%08x,0x%08x,%p,%p,%u)"
|
static HRESULT WINAPI IDirectPlay4Impl_SendEx( IDirectPlay4 *iface, DPID from, DPID to,
|
||||||
": stub\n",
|
DWORD flags, void *data, DWORD size, DWORD priority, DWORD timeout, void *context,
|
||||||
This, idFrom, idTo, dwFlags, lpData, dwDataSize, dwPriority,
|
DWORD *msgid )
|
||||||
dwTimeout, lpContext, lpdwMsgID, bAnsi );
|
{
|
||||||
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
||||||
|
|
||||||
if( This->dp2->connectionInitialized == NO_PROVIDER )
|
FIXME( "(%p)->(0x%08x,0x%08x,0x%08x,%p,0x%08x,0x%08x,0x%08x,%p,%p): semi-stub\n",
|
||||||
{
|
This, from, to, flags, data, size, priority, timeout, context, msgid );
|
||||||
return DPERR_UNINITIALIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: Add parameter checking */
|
if ( This->dp2->connectionInitialized == NO_PROVIDER )
|
||||||
/* FIXME: First call to this needs to acquire a message id which will be
|
return DPERR_UNINITIALIZED;
|
||||||
* used for multiple sends
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* NOTE: Can't send messages to yourself - this will be trapped in receive */
|
/* FIXME: Add parameter checking */
|
||||||
|
/* FIXME: First call to this needs to acquire a message id which will be
|
||||||
|
* used for multiple sends
|
||||||
|
*/
|
||||||
|
|
||||||
/* Verify that the message is being sent from a valid local player. The
|
/* NOTE: Can't send messages to yourself - this will be trapped in receive */
|
||||||
* from player may be anonymous DPID_UNKNOWN
|
|
||||||
*/
|
/* Verify that the message is being sent from a valid local player. The
|
||||||
if( idFrom != DPID_UNKNOWN )
|
* from player may be anonymous DPID_UNKNOWN
|
||||||
{
|
*/
|
||||||
if( DP_FindPlayer( This, idFrom ) == NULL )
|
if ( from != DPID_UNKNOWN && !DP_FindPlayer( This, from ) )
|
||||||
{
|
{
|
||||||
WARN( "INFO: Invalid from player 0x%08x\n", idFrom );
|
WARN( "INFO: Invalid from player 0x%08x\n", from );
|
||||||
return DPERR_INVALIDPLAYER;
|
return DPERR_INVALIDPLAYER;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Verify that the message is being sent to a valid player, group or to
|
|
||||||
* everyone. If it's valid, send it to those players.
|
|
||||||
*/
|
|
||||||
if( idTo == DPID_ALLPLAYERS )
|
|
||||||
{
|
|
||||||
bValidDestination = TRUE;
|
|
||||||
|
|
||||||
/* See if SP has the ability to multicast. If so, use it */
|
|
||||||
if( This->dp2->spData.lpCB->SendToGroupEx )
|
|
||||||
{
|
|
||||||
FIXME( "Use group sendex to group 0\n" );
|
|
||||||
}
|
|
||||||
else if( This->dp2->spData.lpCB->SendToGroup ) /* obsolete interface */
|
|
||||||
{
|
|
||||||
FIXME( "Use obsolete group send to group 0\n" );
|
|
||||||
}
|
|
||||||
else /* No multicast, multiplicate */
|
|
||||||
{
|
|
||||||
/* Send to all players we know about */
|
|
||||||
FIXME( "Send to all players using EnumPlayersInGroup\n" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ( !bValidDestination ) &&
|
|
||||||
( DP_FindPlayer( This, idTo ) != NULL )
|
|
||||||
)
|
|
||||||
{
|
|
||||||
/* Have the service provider send this message */
|
|
||||||
/* FIXME: Could optimize for local interface sends */
|
|
||||||
return DP_SP_SendEx( This, dwFlags, lpData, dwDataSize, dwPriority,
|
|
||||||
dwTimeout, lpContext, lpdwMsgID );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ( !bValidDestination ) &&
|
|
||||||
( DP_FindAnyGroup( This, idTo ) != NULL )
|
|
||||||
)
|
|
||||||
{
|
|
||||||
bValidDestination = TRUE;
|
|
||||||
|
|
||||||
/* See if SP has the ability to multicast. If so, use it */
|
|
||||||
if( This->dp2->spData.lpCB->SendToGroupEx )
|
|
||||||
{
|
|
||||||
FIXME( "Use group sendex\n" );
|
|
||||||
}
|
|
||||||
else if( This->dp2->spData.lpCB->SendToGroup ) /* obsolete interface */
|
|
||||||
{
|
|
||||||
FIXME( "Use obsolete group send to group\n" );
|
|
||||||
}
|
|
||||||
else /* No multicast, multiplicate */
|
|
||||||
{
|
|
||||||
FIXME( "Send to all players using EnumPlayersInGroup\n" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
/* Verify that the message is being sent to a valid player, group or to
|
||||||
if( bExpectReply )
|
* everyone. If it's valid, send it to those players.
|
||||||
|
*/
|
||||||
|
if ( to == DPID_ALLPLAYERS )
|
||||||
{
|
{
|
||||||
DWORD dwWaitReturn;
|
/* See if SP has the ability to multicast. If so, use it */
|
||||||
|
if ( This->dp2->spData.lpCB->SendToGroupEx )
|
||||||
This->dp2->hReplyEvent = CreateEventW( NULL, FALSE, FALSE, NULL );
|
FIXME( "Use group sendex to group 0\n" );
|
||||||
|
else if ( This->dp2->spData.lpCB->SendToGroup ) /* obsolete interface */
|
||||||
dwWaitReturn = WaitForSingleObject( hReplyEvent, dwTimeout );
|
FIXME( "Use obsolete group send to group 0\n" );
|
||||||
if( dwWaitReturn != WAIT_OBJECT_0 )
|
else /* No multicast, multiplicate */
|
||||||
{
|
FIXME( "Send to all players using EnumPlayersInGroup\n" );
|
||||||
ERR( "Wait failed 0x%08lx\n", dwWaitReturn );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
else if ( DP_FindPlayer( This, to ) )
|
||||||
}
|
{
|
||||||
|
/* Have the service provider send this message */
|
||||||
|
/* FIXME: Could optimize for local interface sends */
|
||||||
|
return DP_SP_SendEx( This, flags, data, size, priority, timeout, context, msgid );
|
||||||
|
}
|
||||||
|
else if ( DP_FindAnyGroup( This, to ) )
|
||||||
|
{
|
||||||
|
/* See if SP has the ability to multicast. If so, use it */
|
||||||
|
if ( This->dp2->spData.lpCB->SendToGroupEx )
|
||||||
|
FIXME( "Use group sendex\n" );
|
||||||
|
else if ( This->dp2->spData.lpCB->SendToGroup ) /* obsolete interface */
|
||||||
|
FIXME( "Use obsolete group send to group\n" );
|
||||||
|
else /* No multicast, multiplicate */
|
||||||
|
FIXME( "Send to all players using EnumPlayersInGroup\n" );
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return DPERR_INVALIDPLAYER;
|
||||||
|
|
||||||
if( !bValidDestination )
|
|
||||||
{
|
|
||||||
return DPERR_INVALIDPLAYER;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* FIXME: Should return what the send returned */
|
/* FIXME: Should return what the send returned */
|
||||||
return DP_OK;
|
return DP_OK;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static HRESULT WINAPI DirectPlay4AImpl_SendEx
|
|
||||||
( LPDIRECTPLAY4A iface, DPID idFrom, DPID idTo, DWORD dwFlags,
|
|
||||||
LPVOID lpData, DWORD dwDataSize, DWORD dwPriority, DWORD dwTimeout,
|
|
||||||
LPVOID lpContext, LPDWORD lpdwMsgID )
|
|
||||||
{
|
|
||||||
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
||||||
return DP_SendEx( This, idFrom, idTo, dwFlags, lpData, dwDataSize,
|
|
||||||
dwPriority, dwTimeout, lpContext, lpdwMsgID, TRUE );
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI DirectPlay4WImpl_SendEx
|
|
||||||
( LPDIRECTPLAY4 iface, DPID idFrom, DPID idTo, DWORD dwFlags,
|
|
||||||
LPVOID lpData, DWORD dwDataSize, DWORD dwPriority, DWORD dwTimeout,
|
|
||||||
LPVOID lpContext, LPDWORD lpdwMsgID )
|
|
||||||
{
|
|
||||||
IDirectPlay2Impl *This = (IDirectPlay2Impl *)iface; /* yes downcast to 2 */
|
|
||||||
return DP_SendEx( This, idFrom, idTo, dwFlags, lpData, dwDataSize,
|
|
||||||
dwPriority, dwTimeout, lpContext, lpdwMsgID, FALSE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT DP_SP_SendEx
|
static HRESULT DP_SP_SendEx
|
||||||
|
@ -4257,7 +4189,7 @@ static const IDirectPlay4Vtbl dp4_vt =
|
||||||
IDirectPlay4Impl_GetPlayerFlags,
|
IDirectPlay4Impl_GetPlayerFlags,
|
||||||
IDirectPlay4Impl_GetGroupOwner,
|
IDirectPlay4Impl_GetGroupOwner,
|
||||||
IDirectPlay4Impl_SetGroupOwner,
|
IDirectPlay4Impl_SetGroupOwner,
|
||||||
DirectPlay4WImpl_SendEx,
|
IDirectPlay4Impl_SendEx,
|
||||||
DirectPlay4WImpl_GetMessageQueue,
|
DirectPlay4WImpl_GetMessageQueue,
|
||||||
DirectPlay4WImpl_CancelMessage,
|
DirectPlay4WImpl_CancelMessage,
|
||||||
DirectPlay4WImpl_CancelPriority
|
DirectPlay4WImpl_CancelPriority
|
||||||
|
@ -4316,7 +4248,7 @@ static const IDirectPlay4Vtbl dp4A_vt =
|
||||||
|
|
||||||
DirectPlay4AImpl_GetGroupOwner,
|
DirectPlay4AImpl_GetGroupOwner,
|
||||||
DirectPlay4AImpl_SetGroupOwner,
|
DirectPlay4AImpl_SetGroupOwner,
|
||||||
DirectPlay4AImpl_SendEx,
|
IDirectPlay4AImpl_SendEx,
|
||||||
DirectPlay4AImpl_GetMessageQueue,
|
DirectPlay4AImpl_GetMessageQueue,
|
||||||
DirectPlay4AImpl_CancelMessage,
|
DirectPlay4AImpl_CancelMessage,
|
||||||
DirectPlay4AImpl_CancelPriority
|
DirectPlay4AImpl_CancelPriority
|
||||||
|
|
Loading…
Reference in New Issue