mirror of
https://github.com/reactos/wine.git
synced 2024-11-26 13:10:28 +00:00
dplayx: Merge the IDirectPlay4_DeleteGroupFromGroup helper.
This commit is contained in:
parent
684a666d23
commit
db97f14f4b
@ -109,8 +109,6 @@ static HRESULT DP_IF_CreateGroupInGroup
|
||||
static HRESULT DP_IF_AddPlayerToGroup
|
||||
( IDirectPlay2Impl* This, LPVOID lpMsgHdr, DPID idGroup,
|
||||
DPID idPlayer, BOOL bAnsi );
|
||||
static HRESULT DP_IF_DeleteGroupFromGroup
|
||||
( IDirectPlay3Impl* This, DPID idParentGroup, DPID idGroup );
|
||||
static HRESULT DP_SetSessionDesc
|
||||
( IDirectPlay2Impl* This, LPCDPSESSIONDESC2 lpSessDesc,
|
||||
DWORD dwFlags, BOOL bInitial, BOOL bAnsi );
|
||||
@ -1500,14 +1498,9 @@ cbRemoveGroupOrPlayer(
|
||||
|
||||
if( dwPlayerType == DPPLAYERTYPE_GROUP )
|
||||
{
|
||||
if( FAILED( DP_IF_DeleteGroupFromGroup( lpCtxt->This, lpCtxt->idGroup,
|
||||
dpId )
|
||||
)
|
||||
)
|
||||
{
|
||||
ERR( "Unable to delete group 0x%08x from group 0x%08x\n",
|
||||
dpId, lpCtxt->idGroup );
|
||||
}
|
||||
if ( FAILED( IDirectPlayX_DeleteGroupFromGroup( &lpCtxt->This->IDirectPlay4_iface,
|
||||
lpCtxt->idGroup, dpId ) ) )
|
||||
ERR( "Unable to delete group 0x%08x from group 0x%08x\n", dpId, lpCtxt->idGroup );
|
||||
}
|
||||
else if ( FAILED( IDirectPlayX_DeletePlayerFromGroup( &lpCtxt->This->IDirectPlay4_iface,
|
||||
lpCtxt->idGroup, dpId ) ) )
|
||||
@ -1544,13 +1537,8 @@ static HRESULT DP_IF_DestroyGroup
|
||||
cbRemoveGroupOrPlayer, (LPVOID)&context, 0, bAnsi );
|
||||
|
||||
/* Remove this group from the parent group - if it has one */
|
||||
if( ( idGroup != DPID_SYSTEM_GROUP ) &&
|
||||
( lpGData->parent != DPID_SYSTEM_GROUP )
|
||||
)
|
||||
{
|
||||
DP_IF_DeleteGroupFromGroup( (IDirectPlay3Impl*)This, lpGData->parent,
|
||||
idGroup );
|
||||
}
|
||||
if( ( idGroup != DPID_SYSTEM_GROUP ) && ( lpGData->parent != DPID_SYSTEM_GROUP ) )
|
||||
IDirectPlayX_DeleteGroupFromGroup( &This->IDirectPlay4_iface, lpGData->parent, idGroup );
|
||||
|
||||
/* Now delete this group data and list from the system group */
|
||||
DP_DeleteGroup( This, idGroup );
|
||||
@ -3136,33 +3124,37 @@ static HRESULT WINAPI DirectPlay3WImpl_CreateGroupInGroup
|
||||
dwFlags, FALSE );
|
||||
}
|
||||
|
||||
static HRESULT DP_IF_DeleteGroupFromGroup
|
||||
( IDirectPlay3Impl* This, DPID idParentGroup, DPID idGroup )
|
||||
static HRESULT WINAPI IDirectPlay4AImpl_DeleteGroupFromGroup( IDirectPlay4A *iface, DPID parent,
|
||||
DPID group )
|
||||
{
|
||||
lpGroupList lpGList;
|
||||
lpGroupData lpGParentData;
|
||||
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
||||
return IDirectPlayX_DeleteGroupFromGroup( &This->IDirectPlay4_iface, parent, group );
|
||||
}
|
||||
|
||||
TRACE("(%p)->(0x%08x,0x%08x)\n", This, idParentGroup, idGroup );
|
||||
static HRESULT WINAPI IDirectPlay4Impl_DeleteGroupFromGroup( IDirectPlay4 *iface, DPID parent,
|
||||
DPID group )
|
||||
{
|
||||
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
||||
lpGroupList glist;
|
||||
lpGroupData parentdata;
|
||||
|
||||
TRACE("(%p)->(0x%08x,0x%08x)\n", This, parent, group );
|
||||
|
||||
/* Is the parent group valid? */
|
||||
if( ( lpGParentData = DP_FindAnyGroup( (IDirectPlay2AImpl*)This, idParentGroup ) ) == NULL )
|
||||
{
|
||||
if ( ( parentdata = DP_FindAnyGroup(This, parent ) ) == NULL )
|
||||
return DPERR_INVALIDGROUP;
|
||||
}
|
||||
|
||||
/* Remove the group from the parent group queue */
|
||||
DPQ_REMOVE_ENTRY( lpGParentData->groups, groups, lpGData->dpid, ==, idGroup, lpGList );
|
||||
DPQ_REMOVE_ENTRY( parentdata->groups, groups, lpGData->dpid, ==, group, glist );
|
||||
|
||||
if( lpGList == NULL )
|
||||
{
|
||||
if ( glist == NULL )
|
||||
return DPERR_INVALIDGROUP;
|
||||
}
|
||||
|
||||
/* Decrement the ref count */
|
||||
lpGList->lpGData->uRef--;
|
||||
glist->lpGData->uRef--;
|
||||
|
||||
/* Free up the list item */
|
||||
HeapFree( GetProcessHeap(), 0, lpGList );
|
||||
HeapFree( GetProcessHeap(), 0, glist );
|
||||
|
||||
/* Should send a DELETEGROUPFROMGROUP message */
|
||||
FIXME( "message not sent\n" );
|
||||
@ -3170,20 +3162,6 @@ static HRESULT DP_IF_DeleteGroupFromGroup
|
||||
return DP_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectPlay4AImpl_DeleteGroupFromGroup( IDirectPlay4A *iface,
|
||||
DPID idParentGroup, DPID idGroup )
|
||||
{
|
||||
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
||||
return DP_IF_DeleteGroupFromGroup( This, idParentGroup, idGroup );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DirectPlay3WImpl_DeleteGroupFromGroup
|
||||
( LPDIRECTPLAY3 iface, DPID idParentGroup, DPID idGroup )
|
||||
{
|
||||
IDirectPlay3Impl *This = (IDirectPlay3Impl *)iface;
|
||||
return DP_IF_DeleteGroupFromGroup( This, idParentGroup, idGroup );
|
||||
}
|
||||
|
||||
static BOOL DP_BuildSPCompoundAddr( LPGUID lpcSpGuid, LPVOID* lplpAddrBuf,
|
||||
LPDWORD lpdwBufSize )
|
||||
{
|
||||
@ -4421,7 +4399,7 @@ static const IDirectPlay4Vtbl dp4_vt =
|
||||
XCAST(SetSessionDesc)DirectPlay2WImpl_SetSessionDesc,
|
||||
IDirectPlay4Impl_AddGroupToGroup,
|
||||
XCAST(CreateGroupInGroup)DirectPlay3WImpl_CreateGroupInGroup,
|
||||
XCAST(DeleteGroupFromGroup)DirectPlay3WImpl_DeleteGroupFromGroup,
|
||||
IDirectPlay4Impl_DeleteGroupFromGroup,
|
||||
IDirectPlay4Impl_EnumConnections,
|
||||
XCAST(EnumGroupsInGroup)DirectPlay3WImpl_EnumGroupsInGroup,
|
||||
IDirectPlay4Impl_GetGroupConnectionSettings,
|
||||
|
Loading…
Reference in New Issue
Block a user