1999-09-28 18:35:32 +02:00
|
|
|
/* Direct Play 2,3,4 Implementation
|
|
|
|
*
|
2001-04-12 23:10:54 +02:00
|
|
|
* Copyright 1998,1999,2000,2001 - Peter Hunnisett
|
1999-09-28 18:35:32 +02:00
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1999-09-28 18:35:32 +02:00
|
|
|
*/
|
2001-01-26 21:43:40 +01:00
|
|
|
|
2013-03-29 16:50:11 +01:00
|
|
|
#define COBJMACROS
|
2001-10-14 18:25:47 +02:00
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2001-10-14 18:25:47 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
2003-01-07 21:36:20 +01:00
|
|
|
#define NONAMELESSUNION
|
2015-03-11 11:30:00 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
#include "windef.h"
|
1999-09-28 18:35:32 +02:00
|
|
|
#include "winerror.h"
|
2000-03-12 21:18:33 +01:00
|
|
|
#include "winbase.h"
|
1999-09-28 18:35:32 +02:00
|
|
|
#include "winnt.h"
|
|
|
|
#include "winreg.h"
|
2000-11-16 01:28:52 +01:00
|
|
|
#include "winnls.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
#include "dplayx_global.h"
|
2000-03-12 21:18:33 +01:00
|
|
|
#include "name_server.h"
|
2000-05-30 22:08:32 +02:00
|
|
|
#include "dplayx_queue.h"
|
2008-07-22 21:23:05 +02:00
|
|
|
#include "wine/dplaysp.h"
|
2000-08-25 23:58:05 +02:00
|
|
|
#include "dplay_global.h"
|
1999-11-25 23:04:53 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dplay);
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* FIXME: Should this be externed? */
|
2002-06-01 01:06:46 +02:00
|
|
|
extern HRESULT DPL_CreateCompoundAddress
|
2000-08-25 23:58:05 +02:00
|
|
|
( LPCDPCOMPOUNDADDRESSELEMENT lpElements, DWORD dwElementCount,
|
|
|
|
LPVOID lpAddress, LPDWORD lpdwAddressSize, BOOL bAnsiInterface );
|
2000-03-12 21:18:33 +01:00
|
|
|
|
2000-05-30 22:08:32 +02:00
|
|
|
|
|
|
|
/* Local function prototypes */
|
2013-03-29 17:12:33 +01:00
|
|
|
static lpPlayerList DP_FindPlayer( IDirectPlayImpl *This, DPID dpid );
|
2007-04-26 23:45:27 +02:00
|
|
|
static BOOL DP_CopyDPNAMEStruct( LPDPNAME lpDst, const DPNAME *lpSrc, BOOL bAnsi );
|
2000-08-25 23:58:05 +02:00
|
|
|
static void DP_SetGroupData( lpGroupData lpGData, DWORD dwFlags,
|
|
|
|
LPVOID lpData, DWORD dwDataSize );
|
2000-06-07 05:44:36 +02:00
|
|
|
static void DP_DeleteDPNameStruct( LPDPNAME lpDPName );
|
2002-06-01 01:06:46 +02:00
|
|
|
static BOOL CALLBACK cbDeletePlayerFromAllGroups( DPID dpId,
|
|
|
|
DWORD dwPlayerType,
|
|
|
|
LPCDPNAME lpName,
|
|
|
|
DWORD dwFlags,
|
2000-08-30 01:55:06 +02:00
|
|
|
LPVOID lpContext );
|
2013-03-29 17:12:33 +01:00
|
|
|
static lpGroupData DP_FindAnyGroup( IDirectPlayImpl *This, DPID dpid );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Helper methods for player/group interfaces */
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_SetSessionDesc( IDirectPlayImpl *This, const DPSESSIONDESC2 *lpSessDesc,
|
|
|
|
DWORD dwFlags, BOOL bInitial, BOOL bAnsi );
|
|
|
|
static HRESULT DP_SP_SendEx( IDirectPlayImpl *This, DWORD dwFlags, void *lpData, DWORD dwDataSize,
|
|
|
|
DWORD dwPriority, DWORD dwTimeout, void *lpContext, DWORD *lpdwMsgID );
|
2008-11-28 15:19:48 +01:00
|
|
|
static BOOL DP_BuildSPCompoundAddr( LPGUID lpcSpGuid, LPVOID* lplpAddrBuf,
|
|
|
|
LPDWORD lpdwBufSize );
|
2000-08-30 01:55:06 +02:00
|
|
|
|
|
|
|
static DPID DP_GetRemoteNextObjectId(void);
|
|
|
|
|
2008-12-01 13:26:05 +01:00
|
|
|
static DWORD DP_CalcSessionDescSize( LPCDPSESSIONDESC2 lpSessDesc, BOOL bAnsi );
|
2002-06-01 01:06:46 +02:00
|
|
|
static void DP_CopySessionDesc( LPDPSESSIONDESC2 destSessionDesc,
|
2000-08-25 23:58:05 +02:00
|
|
|
LPCDPSESSIONDESC2 srcSessDesc, BOOL bAnsi );
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
#define DPID_NOPARENT_GROUP 0 /* Magic number to indicate no parent of group */
|
2002-06-01 01:06:46 +02:00
|
|
|
#define DPID_SYSTEM_GROUP DPID_NOPARENT_GROUP /* If system group is supported
|
2000-08-25 23:58:05 +02:00
|
|
|
we don't have to change much */
|
|
|
|
#define DPID_NAME_SERVER 0x19a9d65b /* Don't ask me why */
|
|
|
|
|
|
|
|
/* Strip out dwFlag values which cannot be sent in the CREATEGROUP msg */
|
|
|
|
#define DPMSG_CREATEGROUP_DWFLAGS(x) ( (x) & DPGROUP_HIDDEN )
|
|
|
|
|
|
|
|
/* Strip out all dwFlags values for CREATEPLAYER msg */
|
|
|
|
#define DPMSG_CREATEPLAYER_DWFLAGS(x) 0
|
|
|
|
|
2005-07-13 13:59:15 +02:00
|
|
|
static LONG kludgePlayerGroupId = 1000;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
|
|
|
|
2013-04-08 23:17:36 +02:00
|
|
|
static inline IDirectPlayImpl *impl_from_IDirectPlay( IDirectPlay *iface )
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD( iface, IDirectPlayImpl, IDirectPlay_iface );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static inline IDirectPlayImpl *impl_from_IDirectPlay2( IDirectPlay2 *iface )
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD( iface, IDirectPlayImpl, IDirectPlay2_iface );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static inline IDirectPlayImpl *impl_from_IDirectPlay2A( IDirectPlay2A *iface )
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD( iface, IDirectPlayImpl, IDirectPlay2A_iface );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static inline IDirectPlayImpl *impl_from_IDirectPlay3A( IDirectPlay3A *iface )
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD( iface, IDirectPlayImpl, IDirectPlay3A_iface );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static inline IDirectPlayImpl *impl_from_IDirectPlay3( IDirectPlay3 *iface )
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD( iface, IDirectPlayImpl, IDirectPlay3_iface );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:45:09 +01:00
|
|
|
static inline IDirectPlayImpl *impl_from_IDirectPlay4A( IDirectPlay4A *iface )
|
|
|
|
{
|
2013-03-29 16:46:40 +01:00
|
|
|
return CONTAINING_RECORD( iface, IDirectPlayImpl, IDirectPlay4A_iface );
|
2013-03-29 16:45:09 +01:00
|
|
|
}
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2013-03-29 16:46:02 +01:00
|
|
|
static inline IDirectPlayImpl *impl_from_IDirectPlay4( IDirectPlay4 *iface )
|
|
|
|
{
|
2013-03-29 16:46:40 +01:00
|
|
|
return CONTAINING_RECORD( iface, IDirectPlayImpl, IDirectPlay4_iface );
|
2013-03-29 16:46:02 +01:00
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
static BOOL DP_CreateDirectPlay2( LPVOID lpDP )
|
1999-11-25 23:04:53 +01:00
|
|
|
{
|
2013-03-29 17:12:33 +01:00
|
|
|
IDirectPlayImpl *This = lpDP;
|
1999-11-25 23:04:53 +01:00
|
|
|
|
2005-03-24 22:01:35 +01:00
|
|
|
This->dp2 = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->dp2) ) );
|
1999-11-25 23:04:53 +01:00
|
|
|
if ( This->dp2 == NULL )
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-03-12 21:18:33 +01:00
|
|
|
This->dp2->bConnectionOpen = FALSE;
|
|
|
|
|
|
|
|
This->dp2->hEnumSessionThread = INVALID_HANDLE_VALUE;
|
2007-03-30 15:00:06 +02:00
|
|
|
This->dp2->dwEnumSessionLock = 0;
|
2000-03-12 21:18:33 +01:00
|
|
|
|
2000-05-30 22:08:32 +02:00
|
|
|
This->dp2->bHostInterface = FALSE;
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
DPQ_INIT(This->dp2->receiveMsgs);
|
|
|
|
DPQ_INIT(This->dp2->sendMsgs);
|
2012-05-14 01:02:59 +02:00
|
|
|
DPQ_INIT(This->dp2->repliesExpected);
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-05-27 00:26:30 +02:00
|
|
|
if( !NS_InitializeSessionCache( &This->dp2->lpNameServerData ) )
|
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
/* FIXME: Memory leak */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Provide an initial session desc with nothing in it */
|
2005-03-24 22:01:35 +01:00
|
|
|
This->dp2->lpSessionDesc = HeapAlloc( GetProcessHeap(),
|
|
|
|
HEAP_ZERO_MEMORY,
|
|
|
|
sizeof( *This->dp2->lpSessionDesc ) );
|
2000-08-25 23:58:05 +02:00
|
|
|
if( This->dp2->lpSessionDesc == NULL )
|
|
|
|
{
|
|
|
|
/* FIXME: Memory leak */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
This->dp2->lpSessionDesc->dwSize = sizeof( *This->dp2->lpSessionDesc );
|
|
|
|
|
2005-03-23 14:15:18 +01:00
|
|
|
/* We are emulating a dp 6 implementation */
|
2000-08-25 23:58:05 +02:00
|
|
|
This->dp2->spData.dwSPVersion = DPSP_MAJORVERSION;
|
|
|
|
|
|
|
|
This->dp2->spData.lpCB = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
sizeof( *This->dp2->spData.lpCB ) );
|
|
|
|
This->dp2->spData.lpCB->dwSize = sizeof( *This->dp2->spData.lpCB );
|
|
|
|
This->dp2->spData.lpCB->dwVersion = DPSP_MAJORVERSION;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* This is the pointer to the service provider */
|
2013-09-05 00:01:20 +02:00
|
|
|
if ( FAILED( dplaysp_create( &IID_IDirectPlaySP, (void**)&This->dp2->spData.lpISP, This ) ) )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
|
|
|
/* FIXME: Memory leak */
|
2000-05-27 00:26:30 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
/* Setup lobby provider information */
|
|
|
|
This->dp2->dplspData.dwSPVersion = DPSP_MAJORVERSION;
|
|
|
|
This->dp2->dplspData.lpCB = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
sizeof( *This->dp2->dplspData.lpCB ) );
|
|
|
|
This->dp2->dplspData.lpCB->dwSize = sizeof( *This->dp2->dplspData.lpCB );
|
|
|
|
|
2013-09-03 23:24:58 +02:00
|
|
|
if( FAILED( dplobbysp_create( &IID_IDPLobbySP, (void**)&This->dp2->dplspData.lpISP, This ) )
|
2001-04-12 23:10:54 +02:00
|
|
|
)
|
|
|
|
{
|
|
|
|
/* FIXME: Memory leak */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Definition of the global function in dplayx_queue.h. #
|
|
|
|
* FIXME: Would it be better to have a dplayx_queue.c for this function? */
|
|
|
|
DPQ_DECL_DELETECB( cbDeleteElemFromHeap, LPVOID )
|
1999-11-25 23:04:53 +01:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, elem );
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL DP_DestroyDirectPlay2( LPVOID lpDP )
|
|
|
|
{
|
2013-03-29 17:12:33 +01:00
|
|
|
IDirectPlayImpl *This = lpDP;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-03-12 21:18:33 +01:00
|
|
|
if( This->dp2->hEnumSessionThread != INVALID_HANDLE_VALUE )
|
|
|
|
{
|
|
|
|
TerminateThread( This->dp2->hEnumSessionThread, 0 );
|
|
|
|
CloseHandle( This->dp2->hEnumSessionThread );
|
|
|
|
}
|
2000-05-27 00:26:30 +02:00
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
/* Finish with the SP - have it shutdown */
|
|
|
|
if( This->dp2->spData.lpCB->ShutdownEx )
|
|
|
|
{
|
|
|
|
DPSP_SHUTDOWNDATA data;
|
|
|
|
|
|
|
|
TRACE( "Calling SP ShutdownEx\n" );
|
|
|
|
|
|
|
|
data.lpISP = This->dp2->spData.lpISP;
|
|
|
|
|
|
|
|
(*This->dp2->spData.lpCB->ShutdownEx)( &data );
|
|
|
|
}
|
|
|
|
else if (This->dp2->spData.lpCB->Shutdown ) /* obsolete interface */
|
|
|
|
{
|
|
|
|
TRACE( "Calling obsolete SP Shutdown\n" );
|
|
|
|
(*This->dp2->spData.lpCB->Shutdown)();
|
|
|
|
}
|
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
/* Unload the SP (if it exists) */
|
2000-08-30 01:55:06 +02:00
|
|
|
if( This->dp2->hServiceProvider != 0 )
|
|
|
|
{
|
|
|
|
FreeLibrary( This->dp2->hServiceProvider );
|
|
|
|
}
|
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
/* Unload the Lobby Provider (if it exists) */
|
|
|
|
if( This->dp2->hDPLobbyProvider != 0 )
|
|
|
|
{
|
|
|
|
FreeLibrary( This->dp2->hDPLobbyProvider );
|
|
|
|
}
|
2000-08-30 01:55:06 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* FIXME: Need to delete receive and send msgs queue contents */
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-05-27 00:26:30 +02:00
|
|
|
NS_DeleteSessionCache( This->dp2->lpNameServerData );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2017-02-22 06:15:02 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, This->dp2->dplspData.lpCB);
|
2000-08-25 23:58:05 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, This->dp2->lpSessionDesc );
|
|
|
|
|
|
|
|
IDirectPlaySP_Release( This->dp2->spData.lpISP );
|
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
/* Delete the contents */
|
|
|
|
HeapFree( GetProcessHeap(), 0, This->dp2 );
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:49:30 +01:00
|
|
|
static void dplay_destroy(IDirectPlayImpl *obj)
|
|
|
|
{
|
|
|
|
DP_DestroyDirectPlay2( obj );
|
|
|
|
obj->lock.DebugInfo->Spare[0] = 0;
|
|
|
|
DeleteCriticalSection( &obj->lock );
|
|
|
|
HeapFree( GetProcessHeap(), 0, obj );
|
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
static inline DPID DP_NextObjectId(void)
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
return (DPID)InterlockedIncrement( &kludgePlayerGroupId );
|
|
|
|
}
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
/* *lplpReply will be non NULL iff there is something to reply */
|
2013-03-29 17:12:33 +01:00
|
|
|
HRESULT DP_HandleMessage( IDirectPlayImpl *This, const void *lpcMessageBody,
|
|
|
|
DWORD dwMessageBodySize, const void *lpcMessageHeader, WORD wCommandId, WORD wVersion,
|
|
|
|
void **lplpReply, DWORD *lpdwMsgSize )
|
2000-08-30 01:55:06 +02:00
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(%p,0x%08lx,%p,%u,%u)\n",
|
2002-06-01 01:06:46 +02:00
|
|
|
This, lpcMessageBody, dwMessageBodySize, lpcMessageHeader, wCommandId,
|
2000-08-30 01:55:06 +02:00
|
|
|
wVersion );
|
|
|
|
|
|
|
|
switch( wCommandId )
|
|
|
|
{
|
2001-04-12 23:10:54 +02:00
|
|
|
/* Name server needs to handle this request */
|
|
|
|
case DPMSGCMD_ENUMSESSIONSREQUEST:
|
|
|
|
/* Reply expected */
|
|
|
|
NS_ReplyToEnumSessionsRequest( lpcMessageBody, lplpReply, lpdwMsgSize, This );
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Name server needs to handle this request */
|
|
|
|
case DPMSGCMD_ENUMSESSIONSREPLY:
|
|
|
|
/* No reply expected */
|
|
|
|
NS_AddRemoteComputerAsNameServer( lpcMessageHeader,
|
|
|
|
This->dp2->spData.dwSPHeaderSize,
|
2006-09-10 01:14:23 +02:00
|
|
|
lpcMessageBody,
|
2001-04-12 23:10:54 +02:00
|
|
|
This->dp2->lpNameServerData );
|
|
|
|
break;
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
case DPMSGCMD_REQUESTNEWPLAYERID:
|
|
|
|
{
|
2009-01-16 09:53:59 +01:00
|
|
|
LPCDPMSG_REQUESTNEWPLAYERID lpcMsg = lpcMessageBody;
|
2000-10-19 22:20:58 +02:00
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
LPDPMSG_NEWPLAYERIDREPLY lpReply;
|
|
|
|
|
|
|
|
*lpdwMsgSize = This->dp2->spData.dwSPHeaderSize + sizeof( *lpReply );
|
|
|
|
|
2005-03-24 22:01:35 +01:00
|
|
|
*lplpReply = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, *lpdwMsgSize );
|
2000-08-30 01:55:06 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "Ignoring dwFlags 0x%08lx in request msg\n",
|
2000-10-19 22:20:58 +02:00
|
|
|
lpcMsg->dwFlags );
|
2000-08-30 01:55:06 +02:00
|
|
|
|
|
|
|
/* Setup the reply */
|
2002-06-01 01:06:46 +02:00
|
|
|
lpReply = (LPDPMSG_NEWPLAYERIDREPLY)( (BYTE*)(*lplpReply) +
|
2000-08-30 01:55:06 +02:00
|
|
|
This->dp2->spData.dwSPHeaderSize );
|
|
|
|
|
|
|
|
lpReply->envelope.dwMagic = DPMSGMAGIC_DPLAYMSG;
|
2002-06-01 01:06:46 +02:00
|
|
|
lpReply->envelope.wCommandId = DPMSGCMD_NEWPLAYERIDREPLY;
|
|
|
|
lpReply->envelope.wVersion = DPMSGVER_DP6;
|
2000-08-30 01:55:06 +02:00
|
|
|
|
|
|
|
lpReply->dpidNewPlayerId = DP_NextObjectId();
|
2000-09-27 01:11:48 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "Allocating new playerid 0x%08lx from remote request\n",
|
2000-09-27 01:11:48 +02:00
|
|
|
lpReply->dpidNewPlayerId );
|
2000-08-30 01:55:06 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2000-10-19 22:20:58 +02:00
|
|
|
case DPMSGCMD_GETNAMETABLEREPLY:
|
2000-08-30 01:55:06 +02:00
|
|
|
case DPMSGCMD_NEWPLAYERIDREPLY:
|
2000-10-19 22:20:58 +02:00
|
|
|
DP_MSG_ReplyReceived( This, wCommandId, lpcMessageBody, dwMessageBodySize );
|
2000-08-30 01:55:06 +02:00
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
case DPMSGCMD_JUSTENVELOPE:
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "GOT THE SELF MESSAGE: %p -> 0x%08lx\n", lpcMessageHeader, ((const DWORD *)lpcMessageHeader)[1] );
|
2001-04-12 23:10:54 +02:00
|
|
|
NS_SetLocalAddr( This->dp2->lpNameServerData, lpcMessageHeader, 20 );
|
|
|
|
DP_MSG_ReplyReceived( This, wCommandId, lpcMessageBody, dwMessageBodySize );
|
|
|
|
|
|
|
|
case DPMSGCMD_FORWARDADDPLAYER:
|
2011-11-05 21:53:31 +01:00
|
|
|
TRACE( "Sending message to self to get my addr\n" );
|
|
|
|
DP_MSG_ToSelf( This, 1 ); /* This is a hack right now */
|
2001-04-12 23:10:54 +02:00
|
|
|
break;
|
|
|
|
|
2000-10-19 22:20:58 +02:00
|
|
|
case DPMSGCMD_FORWARDADDPLAYERNACK:
|
|
|
|
DP_MSG_ErrorReceived( This, wCommandId, lpcMessageBody, dwMessageBodySize );
|
|
|
|
break;
|
2000-08-30 01:55:06 +02:00
|
|
|
|
|
|
|
default:
|
|
|
|
FIXME( "Unknown wCommandId %u. Ignoring message\n", wCommandId );
|
2000-10-19 22:20:58 +02:00
|
|
|
DebugBreak();
|
2000-08-30 01:55:06 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
/* FIXME: There is code in dplaysp.c to handle dplay commands. Move to here. */
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-04-08 23:17:36 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayImpl_QueryInterface( IDirectPlay *iface, REFIID riid, void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
|
|
|
return IDirectPlayX_QueryInterface( &This->IDirectPlay4_iface, riid, ppv );
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IDirectPlayImpl_AddRef( IDirectPlay *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
|
|
|
ULONG ref = InterlockedIncrement( &This->ref );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref=%ld\n", This, ref );
|
2013-04-08 23:17:36 +02:00
|
|
|
|
|
|
|
if ( ref == 1 )
|
|
|
|
InterlockedIncrement( &This->numIfaces );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IDirectPlayImpl_Release( IDirectPlay *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
|
|
|
ULONG ref = InterlockedDecrement( &This->ref );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref=%ld\n", This, ref );
|
2013-04-08 23:17:36 +02:00
|
|
|
|
|
|
|
if ( !ref && !InterlockedDecrement( &This->numIfaces ) )
|
|
|
|
dplay_destroy( This );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_AddPlayerToGroup( IDirectPlay *iface, DPID group,
|
|
|
|
DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,0x%08lx): stub\n", This, group, player );
|
2013-04-08 23:17:36 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_Close( IDirectPlay *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
|
|
|
FIXME( "(%p): stub\n", This );
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_CreatePlayer( IDirectPlay *iface, DPID *player,
|
|
|
|
LPSTR name, LPSTR fullname, HANDLE *event )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
|
|
|
FIXME( "(%p)->(%p,%s,%s,%p): stub\n", This, player, debugstr_a( name ), debugstr_a( fullname ),
|
|
|
|
event );
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_CreateGroup( IDirectPlay *iface, DPID *group, LPSTR name,
|
|
|
|
LPSTR fullname )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
|
|
|
FIXME( "(%p)->(%p,%s,%s): stub\n", This, group, debugstr_a( name ), debugstr_a( fullname ) );
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_DeletePlayerFromGroup( IDirectPlay *iface, DPID group,
|
|
|
|
DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,0x%08lx): stub\n", This, group, player );
|
2013-04-08 23:17:36 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_DestroyPlayer( IDirectPlay *iface, DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx): stub\n", This, player );
|
2013-04-08 23:17:36 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_DestroyGroup( IDirectPlay *iface, DPID group )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx): stub\n", This, group );
|
2013-04-08 23:17:36 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_EnableNewPlayers( IDirectPlay *iface, BOOL enable )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
|
|
|
FIXME( "(%p)->(%d): stub\n", This, enable );
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_EnumGroupPlayers( IDirectPlay *iface, DPID group,
|
|
|
|
LPDPENUMPLAYERSCALLBACK enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p,%p,0x%08lx): stub\n", This, group, enumplayercb, context, flags );
|
2013-04-08 23:17:36 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_EnumGroups( IDirectPlay *iface, DWORD session,
|
|
|
|
LPDPENUMPLAYERSCALLBACK enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p,%p,0x%08lx): stub\n", This, session, enumplayercb, context, flags );
|
2013-04-08 23:17:36 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_EnumPlayers( IDirectPlay *iface, DWORD session,
|
|
|
|
LPDPENUMPLAYERSCALLBACK enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p,%p,0x%08lx): stub\n", This, session, enumplayercb, context, flags );
|
2013-04-08 23:17:36 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_EnumSessions( IDirectPlay *iface, DPSESSIONDESC *sdesc,
|
|
|
|
DWORD timeout, LPDPENUMSESSIONSCALLBACK enumsessioncb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(%p,%lu,%p,%p,0x%08lx): stub\n", This, sdesc, timeout, enumsessioncb, context,
|
2013-04-08 23:17:36 +02:00
|
|
|
flags );
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_GetCaps( IDirectPlay *iface, DPCAPS *caps )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
|
|
|
FIXME( "(%p)->(%p): stub\n", This, caps );
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_GetMessageCount( IDirectPlay *iface, DPID player,
|
|
|
|
DWORD *count )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p): stub\n", This, player, count );
|
2013-04-08 23:17:36 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_GetPlayerCaps( IDirectPlay *iface, DPID player, DPCAPS *caps )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p): stub\n", This, player, caps );
|
2013-04-08 23:17:36 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_GetPlayerName( IDirectPlay *iface, DPID player, LPSTR name,
|
|
|
|
DWORD *size_name, LPSTR fullname, DWORD *size_fullname )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p,%p,%p,%p): stub\n", This, player, name, size_name, fullname,
|
2013-04-08 23:17:36 +02:00
|
|
|
size_fullname );
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_Initialize( IDirectPlay *iface, GUID *guid )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
|
|
|
FIXME( "(%p)->(%p): stub\n", This, guid );
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_Open( IDirectPlay *iface, DPSESSIONDESC *sdesc )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
|
|
|
FIXME( "(%p)->(%p): stub\n", This, sdesc );
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_Receive( IDirectPlay *iface, DPID *from, DPID *to,
|
|
|
|
DWORD flags, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(%p,%p,0x%08lx,%p,%p): stub\n", This, from, to, flags, data, size );
|
2013-04-08 23:17:36 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_SaveSession( IDirectPlay *iface, LPSTR reserved )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
|
|
|
FIXME( "(%p)->(%p): stub\n", This, reserved );
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_Send( IDirectPlay *iface, DPID from, DPID to, DWORD flags,
|
|
|
|
void *data, DWORD size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,0x%08lx,0x%08lx,%p,%lu): stub\n", This, from, to, flags, data, size );
|
2013-04-08 23:17:36 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayImpl_SetPlayerName( IDirectPlay *iface, DPID player, LPSTR name,
|
|
|
|
LPSTR fullname )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%s,%s): stub\n", This, player, debugstr_a( name ),
|
2013-04-08 23:17:36 +02:00
|
|
|
debugstr_a ( fullname ) );
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IDirectPlayVtbl dp_vt =
|
|
|
|
{
|
|
|
|
IDirectPlayImpl_QueryInterface,
|
|
|
|
IDirectPlayImpl_AddRef,
|
|
|
|
IDirectPlayImpl_Release,
|
|
|
|
IDirectPlayImpl_AddPlayerToGroup,
|
|
|
|
IDirectPlayImpl_Close,
|
|
|
|
IDirectPlayImpl_CreatePlayer,
|
|
|
|
IDirectPlayImpl_CreateGroup,
|
|
|
|
IDirectPlayImpl_DeletePlayerFromGroup,
|
|
|
|
IDirectPlayImpl_DestroyPlayer,
|
|
|
|
IDirectPlayImpl_DestroyGroup,
|
|
|
|
IDirectPlayImpl_EnableNewPlayers,
|
|
|
|
IDirectPlayImpl_EnumGroupPlayers,
|
|
|
|
IDirectPlayImpl_EnumGroups,
|
|
|
|
IDirectPlayImpl_EnumPlayers,
|
|
|
|
IDirectPlayImpl_EnumSessions,
|
|
|
|
IDirectPlayImpl_GetCaps,
|
|
|
|
IDirectPlayImpl_GetMessageCount,
|
|
|
|
IDirectPlayImpl_GetPlayerCaps,
|
|
|
|
IDirectPlayImpl_GetPlayerName,
|
|
|
|
IDirectPlayImpl_Initialize,
|
|
|
|
IDirectPlayImpl_Open,
|
|
|
|
IDirectPlayImpl_Receive,
|
|
|
|
IDirectPlayImpl_SaveSession,
|
|
|
|
IDirectPlayImpl_Send,
|
|
|
|
IDirectPlayImpl_SetPlayerName,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_QueryInterface( IDirectPlay2A *iface, REFIID riid,
|
|
|
|
void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
2013-04-08 23:20:24 +02:00
|
|
|
return IDirectPlayX_QueryInterface( &This->IDirectPlay4_iface, riid, ppv );
|
2013-03-29 17:13:11 +01:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_QueryInterface( IDirectPlay2 *iface, REFIID riid,
|
|
|
|
void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_QueryInterface( &This->IDirectPlay4_iface, riid, ppv );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_QueryInterface( IDirectPlay3A *iface, REFIID riid,
|
|
|
|
void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_QueryInterface( &This->IDirectPlay4_iface, riid, ppv );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_QueryInterface( IDirectPlay3 *iface, REFIID riid,
|
|
|
|
void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_QueryInterface( &This->IDirectPlay4_iface, riid, ppv );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:46:02 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_QueryInterface( IDirectPlay4A *iface, REFIID riid,
|
|
|
|
void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
2013-03-29 16:50:11 +01:00
|
|
|
return IDirectPlayX_QueryInterface( &This->IDirectPlay4_iface, riid, ppv );
|
2013-03-29 16:46:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_QueryInterface( IDirectPlay4 *iface, REFIID riid,
|
|
|
|
void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2013-03-29 16:50:11 +01:00
|
|
|
|
|
|
|
if ( IsEqualGUID( &IID_IUnknown, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IUnknown %p)\n", This, ppv );
|
2013-04-08 23:19:09 +02:00
|
|
|
*ppv = &This->IDirectPlay_iface;
|
2013-03-29 16:50:11 +01:00
|
|
|
}
|
2013-04-08 23:17:36 +02:00
|
|
|
else if ( IsEqualGUID( &IID_IDirectPlay, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IDirectPlay %p)\n", This, ppv );
|
|
|
|
*ppv = &This->IDirectPlay_iface;
|
|
|
|
}
|
2013-03-29 16:50:11 +01:00
|
|
|
else if ( IsEqualGUID( &IID_IDirectPlay2A, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IDirectPlay2A %p)\n", This, ppv );
|
2013-03-29 17:13:11 +01:00
|
|
|
*ppv = &This->IDirectPlay2A_iface;
|
2013-03-29 16:50:11 +01:00
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &IID_IDirectPlay2, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IDirectPlay2 %p)\n", This, ppv );
|
2013-03-29 17:14:07 +01:00
|
|
|
*ppv = &This->IDirectPlay2_iface;
|
2013-03-29 16:50:11 +01:00
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &IID_IDirectPlay3A, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IDirectPlay3A %p)\n", This, ppv );
|
2013-03-29 17:15:01 +01:00
|
|
|
*ppv = &This->IDirectPlay3A_iface;
|
2013-03-29 16:50:11 +01:00
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &IID_IDirectPlay3, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IDirectPlay3 %p)\n", This, ppv );
|
2013-03-29 17:15:57 +01:00
|
|
|
*ppv = &This->IDirectPlay3_iface;
|
2013-03-29 16:50:11 +01:00
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &IID_IDirectPlay4A, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IDirectPlay4A %p)\n", This, ppv );
|
|
|
|
*ppv = &This->IDirectPlay4A_iface;
|
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &IID_IDirectPlay4, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IDirectPlay4 %p)\n", This, ppv );
|
|
|
|
*ppv = &This->IDirectPlay4_iface;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
2013-03-29 16:46:02 +01:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static ULONG WINAPI IDirectPlay2AImpl_AddRef( IDirectPlay2A *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
ULONG ref = InterlockedIncrement( &This->ref2A );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref2A=%ld\n", This, ref );
|
2013-03-29 17:13:11 +01:00
|
|
|
|
|
|
|
if ( ref == 1 )
|
|
|
|
InterlockedIncrement( &This->numIfaces );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static ULONG WINAPI IDirectPlay2Impl_AddRef( IDirectPlay2 *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
ULONG ref = InterlockedIncrement( &This->ref2 );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref2=%ld\n", This, ref );
|
2013-03-29 17:14:07 +01:00
|
|
|
|
|
|
|
if ( ref == 1 )
|
|
|
|
InterlockedIncrement( &This->numIfaces );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static ULONG WINAPI IDirectPlay3AImpl_AddRef( IDirectPlay3A *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
ULONG ref = InterlockedIncrement( &This->ref3A );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref3A=%ld\n", This, ref );
|
2013-03-29 17:15:01 +01:00
|
|
|
|
|
|
|
if ( ref == 1 )
|
|
|
|
InterlockedIncrement( &This->numIfaces );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static ULONG WINAPI IDirectPlay3Impl_AddRef( IDirectPlay3 *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
ULONG ref = InterlockedIncrement( &This->ref3 );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref3=%ld\n", This, ref );
|
2013-03-29 17:15:57 +01:00
|
|
|
|
|
|
|
if ( ref == 1 )
|
|
|
|
InterlockedIncrement( &This->numIfaces );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:46:02 +01:00
|
|
|
static ULONG WINAPI IDirectPlay4AImpl_AddRef(IDirectPlay4A *iface)
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
2013-03-29 16:49:30 +01:00
|
|
|
ULONG ref = InterlockedIncrement( &This->ref4A );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref4A=%ld\n", This, ref );
|
2013-03-29 16:49:30 +01:00
|
|
|
|
|
|
|
if ( ref == 1 )
|
|
|
|
InterlockedIncrement( &This->numIfaces );
|
|
|
|
|
|
|
|
return ref;
|
2013-03-29 16:46:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IDirectPlay4Impl_AddRef(IDirectPlay4 *iface)
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2013-03-29 16:49:30 +01:00
|
|
|
ULONG ref = InterlockedIncrement( &This->ref4 );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref4=%ld\n", This, ref );
|
2013-03-29 16:49:30 +01:00
|
|
|
|
|
|
|
if ( ref == 1 )
|
|
|
|
InterlockedIncrement( &This->numIfaces );
|
|
|
|
|
|
|
|
return ref;
|
2013-03-29 16:46:02 +01:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static ULONG WINAPI IDirectPlay2AImpl_Release( IDirectPlay2A *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
ULONG ref = InterlockedDecrement( &This->ref2A );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref2A=%ld\n", This, ref );
|
2013-03-29 17:13:11 +01:00
|
|
|
|
|
|
|
if ( !ref && !InterlockedDecrement( &This->numIfaces ) )
|
|
|
|
dplay_destroy( This );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static ULONG WINAPI IDirectPlay2Impl_Release( IDirectPlay2 *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
ULONG ref = InterlockedDecrement( &This->ref2 );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref2=%ld\n", This, ref );
|
2013-03-29 17:14:07 +01:00
|
|
|
|
|
|
|
if ( !ref && !InterlockedDecrement( &This->numIfaces ) )
|
|
|
|
dplay_destroy( This );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static ULONG WINAPI IDirectPlay3AImpl_Release( IDirectPlay3A *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
ULONG ref = InterlockedDecrement( &This->ref3A );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref3A=%ld\n", This, ref );
|
2013-03-29 17:15:01 +01:00
|
|
|
|
|
|
|
if ( !ref && !InterlockedDecrement( &This->numIfaces ) )
|
|
|
|
dplay_destroy( This );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static ULONG WINAPI IDirectPlay3Impl_Release( IDirectPlay3 *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
ULONG ref = InterlockedDecrement( &This->ref3 );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref3=%ld\n", This, ref );
|
2013-03-29 17:15:57 +01:00
|
|
|
|
|
|
|
if ( !ref && !InterlockedDecrement( &This->numIfaces ) )
|
|
|
|
dplay_destroy( This );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:46:02 +01:00
|
|
|
static ULONG WINAPI IDirectPlay4AImpl_Release(IDirectPlay4A *iface)
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
2013-03-29 16:49:30 +01:00
|
|
|
ULONG ref = InterlockedDecrement( &This->ref4A );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref4A=%ld\n", This, ref );
|
2013-03-29 16:49:30 +01:00
|
|
|
|
|
|
|
if ( !ref && !InterlockedDecrement( &This->numIfaces ) )
|
|
|
|
dplay_destroy( This );
|
|
|
|
|
|
|
|
return ref;
|
2013-03-29 16:46:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IDirectPlay4Impl_Release(IDirectPlay4 *iface)
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2013-03-29 16:49:30 +01:00
|
|
|
ULONG ref = InterlockedDecrement( &This->ref4 );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref4=%ld\n", This, ref );
|
2013-03-29 16:49:30 +01:00
|
|
|
|
|
|
|
if ( !ref && !InterlockedDecrement( &This->numIfaces ) )
|
|
|
|
dplay_destroy( This );
|
|
|
|
|
|
|
|
return ref;
|
2013-03-29 16:46:02 +01:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_AddPlayerToGroup( IDirectPlay2A *iface, DPID group,
|
|
|
|
DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_AddPlayerToGroup( &This->IDirectPlay4A_iface, group, player );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_AddPlayerToGroup( IDirectPlay2 *iface, DPID group,
|
|
|
|
DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_AddPlayerToGroup( &This->IDirectPlay4_iface, group, player );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_AddPlayerToGroup( IDirectPlay3A *iface, DPID group,
|
|
|
|
DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_AddPlayerToGroup( &This->IDirectPlay4_iface, group, player );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_AddPlayerToGroup( IDirectPlay3 *iface, DPID group,
|
|
|
|
DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_AddPlayerToGroup( &This->IDirectPlay4_iface, group, player );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:03:51 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_AddPlayerToGroup( IDirectPlay4A *iface, DPID group,
|
|
|
|
DPID player )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 17:03:51 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_AddPlayerToGroup( &This->IDirectPlay4_iface, group, player );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:03:51 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_AddPlayerToGroup( IDirectPlay4 *iface, DPID group,
|
|
|
|
DPID player )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 17:03:51 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
lpGroupData gdata;
|
|
|
|
lpPlayerList plist;
|
|
|
|
lpPlayerList newplist;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx,0x%08lx)\n", This, group, player );
|
2013-03-29 17:03:51 +01:00
|
|
|
|
|
|
|
if ( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
return DPERR_UNINITIALIZED;
|
|
|
|
|
|
|
|
/* Find the group */
|
|
|
|
if ( ( gdata = DP_FindAnyGroup( This, group ) ) == NULL )
|
|
|
|
return DPERR_INVALIDGROUP;
|
|
|
|
|
|
|
|
/* Find the player */
|
|
|
|
if ( ( plist = DP_FindPlayer( This, player ) ) == NULL )
|
|
|
|
return DPERR_INVALIDPLAYER;
|
|
|
|
|
|
|
|
/* Create a player list (ie "shortcut" ) */
|
|
|
|
newplist = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *newplist ) );
|
|
|
|
if ( !newplist )
|
|
|
|
return DPERR_CANTADDPLAYER;
|
|
|
|
|
|
|
|
/* Add the shortcut */
|
|
|
|
plist->lpPData->uRef++;
|
|
|
|
newplist->lpPData = plist->lpPData;
|
|
|
|
|
|
|
|
/* Add the player to the list of players for this group */
|
|
|
|
DPQ_INSERT(gdata->players, newplist, players);
|
|
|
|
|
|
|
|
/* Let the SP know that we've added a player to the group */
|
|
|
|
if ( This->dp2->spData.lpCB->AddPlayerToGroup )
|
|
|
|
{
|
|
|
|
DPSP_ADDPLAYERTOGROUPDATA data;
|
|
|
|
|
|
|
|
TRACE( "Calling SP AddPlayerToGroup\n" );
|
|
|
|
|
|
|
|
data.idPlayer = player;
|
|
|
|
data.idGroup = group;
|
|
|
|
data.lpISP = This->dp2->spData.lpISP;
|
|
|
|
|
|
|
|
(*This->dp2->spData.lpCB->AddPlayerToGroup)( &data );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Inform all other peers of the addition of player to the group. If there are
|
|
|
|
* no peers keep this event quiet.
|
|
|
|
* Also, if this event was the result of another machine sending it to us,
|
|
|
|
* don't bother rebroadcasting it.
|
|
|
|
*/
|
|
|
|
if ( This->dp2->lpSessionDesc &&
|
|
|
|
( This->dp2->lpSessionDesc->dwFlags & DPSESSION_MULTICASTSERVER ) )
|
|
|
|
{
|
|
|
|
DPMSG_ADDPLAYERTOGROUP msg;
|
|
|
|
msg.dwType = DPSYS_ADDPLAYERTOGROUP;
|
|
|
|
|
|
|
|
msg.dpIdGroup = group;
|
|
|
|
msg.dpIdPlayer = player;
|
|
|
|
|
|
|
|
/* FIXME: Correct to just use send effectively? */
|
|
|
|
/* FIXME: Should size include data w/ message or just message "header" */
|
|
|
|
/* FIXME: Check return code */
|
|
|
|
IDirectPlayX_SendEx( iface, DPID_SERVERPLAYER, DPID_ALLPLAYERS, 0, &msg, sizeof( msg ),
|
|
|
|
0, 0, NULL, NULL );
|
|
|
|
}
|
|
|
|
|
|
|
|
return DP_OK;
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_Close( IDirectPlay2A *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_Close( &This->IDirectPlay4A_iface );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_Close( IDirectPlay2 *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_Close( &This->IDirectPlay4_iface );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_Close( IDirectPlay3A *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_Close( &This->IDirectPlay4_iface );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_Close( IDirectPlay3 *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_Close( &This->IDirectPlay4_iface );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:52:03 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_Close( IDirectPlay4A *iface )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 16:52:03 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_Close( &This->IDirectPlay4_iface);
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:52:03 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_Close( IDirectPlay4 *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
HRESULT hr = DP_OK;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2013-04-03 16:07:13 +02:00
|
|
|
TRACE( "(%p)\n", This );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2013-03-29 16:52:03 +01:00
|
|
|
/* FIXME: Need to find a new host I assume (how?) */
|
|
|
|
/* FIXME: Need to destroy all local groups */
|
|
|
|
/* FIXME: Need to migrate all remotely visible players to the new host */
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:52:03 +01:00
|
|
|
/* Invoke the SP callback to inform of session close */
|
|
|
|
if( This->dp2->spData.lpCB->CloseEx )
|
|
|
|
{
|
|
|
|
DPSP_CLOSEDATA data;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-03-29 16:52:03 +01:00
|
|
|
TRACE( "Calling SP CloseEx\n" );
|
|
|
|
data.lpISP = This->dp2->spData.lpISP;
|
|
|
|
hr = (*This->dp2->spData.lpCB->CloseEx)( &data );
|
|
|
|
}
|
|
|
|
else if ( This->dp2->spData.lpCB->Close ) /* Try obsolete version */
|
|
|
|
{
|
|
|
|
TRACE( "Calling SP Close (obsolete interface)\n" );
|
|
|
|
hr = (*This->dp2->spData.lpCB->Close)();
|
|
|
|
}
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-03-29 16:52:03 +01:00
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static lpGroupData DP_CreateGroup( IDirectPlayImpl *This, const DPID *lpid, const DPNAME *lpName,
|
|
|
|
DWORD dwFlags, DPID idParent, BOOL bAnsi )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
lpGroupData lpGData;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
/* Allocate the new space and add to end of high level group list */
|
2005-03-24 22:01:35 +01:00
|
|
|
lpGData = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpGData ) );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( lpGData == NULL )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
DPQ_INIT(lpGData->groups);
|
|
|
|
DPQ_INIT(lpGData->players);
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Set the desired player ID - no sanity checking to see if it exists */
|
|
|
|
lpGData->dpid = *lpid;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
DP_CopyDPNAMEStruct( &lpGData->name, lpName, bAnsi );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* FIXME: Should we check that the parent exists? */
|
|
|
|
lpGData->parent = idParent;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* FIXME: Should we validate the dwFlags? */
|
|
|
|
lpGData->dwFlags = dwFlags;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "Created group id 0x%08lx\n", *lpid );
|
2000-10-19 22:20:58 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
return lpGData;
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
/* This method assumes that all links to it are already deleted */
|
2013-03-29 17:12:33 +01:00
|
|
|
static void DP_DeleteGroup( IDirectPlayImpl *This, DPID dpid )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
|
|
|
lpGroupList lpGList;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx)\n", This, dpid );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
DPQ_REMOVE_ENTRY( This->dp2->lpSysGroup->groups, groups, lpGData->dpid, ==, dpid, lpGList );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
|
|
|
if( lpGList == NULL )
|
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
ERR( "DPID 0x%08lx not found\n", dpid );
|
2000-06-07 05:44:36 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
if( --(lpGList->lpGData->uRef) )
|
|
|
|
{
|
|
|
|
FIXME( "Why is this not the last reference to group?\n" );
|
|
|
|
DebugBreak();
|
|
|
|
}
|
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
/* Delete player */
|
|
|
|
DP_DeleteDPNameStruct( &lpGList->lpGData->name );
|
|
|
|
HeapFree( GetProcessHeap(), 0, lpGList->lpGData );
|
|
|
|
|
|
|
|
/* Remove and Delete Player List object */
|
|
|
|
HeapFree( GetProcessHeap(), 0, lpGList );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static lpGroupData DP_FindAnyGroup( IDirectPlayImpl *This, DPID dpid )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
|
|
|
lpGroupList lpGroups;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx)\n", This, dpid );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( dpid == DPID_SYSTEM_GROUP )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
return This->dp2->lpSysGroup;
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
DPQ_FIND_ENTRY( This->dp2->lpSysGroup->groups, groups, lpGData->dpid, ==, dpid, lpGroups );
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
if( lpGroups == NULL )
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
return lpGroups->lpGData;
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_IF_CreateGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID *lpidGroup,
|
|
|
|
DPNAME *lpGroupName, void *lpData, DWORD dwDataSize, DWORD dwFlags, BOOL bAnsi )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-05-30 22:08:32 +02:00
|
|
|
lpGroupData lpGData;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(%p,%p,%p,%p,0x%08lx,0x%08lx,%u)\n",
|
2002-06-01 01:06:46 +02:00
|
|
|
This, lpMsgHdr, lpidGroup, lpGroupName, lpData, dwDataSize,
|
2000-08-25 23:58:05 +02:00
|
|
|
dwFlags, bAnsi );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2008-08-05 03:56:37 +02:00
|
|
|
if( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
{
|
|
|
|
return DPERR_UNINITIALIZED;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* If the name is not specified, we must provide one */
|
|
|
|
if( DPID_UNKNOWN == *lpidGroup )
|
|
|
|
{
|
|
|
|
/* If we are the name server, we decide on the group ids. If not, we
|
|
|
|
* must ask for one before attempting a creation.
|
|
|
|
*/
|
|
|
|
if( This->dp2->bHostInterface )
|
|
|
|
{
|
|
|
|
*lpidGroup = DP_NextObjectId();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-08-30 01:55:06 +02:00
|
|
|
*lpidGroup = DP_GetRemoteNextObjectId();
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
lpGData = DP_CreateGroup( This, lpidGroup, lpGroupName, dwFlags,
|
|
|
|
DPID_NOPARENT_GROUP, bAnsi );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
|
|
|
if( lpGData == NULL )
|
|
|
|
{
|
|
|
|
return DPERR_CANTADDPLAYER; /* yes player not group */
|
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( DPID_SYSTEM_GROUP == *lpidGroup )
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
This->dp2->lpSysGroup = lpGData;
|
2000-10-19 22:20:58 +02:00
|
|
|
TRACE( "Inserting system group\n" );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Insert into the system group */
|
2005-03-24 22:01:35 +01:00
|
|
|
lpGroupList lpGroup = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpGroup ) );
|
2000-08-25 23:58:05 +02:00
|
|
|
lpGroup->lpGData = lpGData;
|
|
|
|
|
|
|
|
DPQ_INSERT( This->dp2->lpSysGroup->groups, lpGroup, groups );
|
|
|
|
}
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
/* Something is now referencing this data */
|
|
|
|
lpGData->uRef++;
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Set all the important stuff for the group */
|
|
|
|
DP_SetGroupData( lpGData, DPSET_REMOTE, lpData, dwDataSize );
|
|
|
|
|
|
|
|
/* FIXME: We should only create the system group if GetCaps returns
|
|
|
|
* DPCAPS_GROUPOPTIMIZED.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Let the SP know that we've created this group */
|
|
|
|
if( This->dp2->spData.lpCB->CreateGroup )
|
|
|
|
{
|
|
|
|
DPSP_CREATEGROUPDATA data;
|
|
|
|
DWORD dwCreateFlags = 0;
|
|
|
|
|
|
|
|
TRACE( "Calling SP CreateGroup\n" );
|
|
|
|
|
|
|
|
if( *lpidGroup == DPID_NOPARENT_GROUP )
|
|
|
|
dwCreateFlags |= DPLAYI_GROUP_SYSGROUP;
|
|
|
|
|
|
|
|
if( lpMsgHdr == NULL )
|
|
|
|
dwCreateFlags |= DPLAYI_PLAYER_PLAYERLOCAL;
|
|
|
|
|
|
|
|
if( dwFlags & DPGROUP_HIDDEN )
|
|
|
|
dwCreateFlags |= DPLAYI_GROUP_HIDDEN;
|
|
|
|
|
|
|
|
data.idGroup = *lpidGroup;
|
|
|
|
data.dwFlags = dwCreateFlags;
|
|
|
|
data.lpSPMessageHeader = lpMsgHdr;
|
|
|
|
data.lpISP = This->dp2->spData.lpISP;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
(*This->dp2->spData.lpCB->CreateGroup)( &data );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* Inform all other peers of the creation of a new group. If there are
|
|
|
|
* no peers keep this event quiet.
|
2000-08-25 23:58:05 +02:00
|
|
|
* Also if this message was sent to us, don't rebroadcast.
|
|
|
|
*/
|
|
|
|
if( ( lpMsgHdr == NULL ) &&
|
2002-06-01 01:06:46 +02:00
|
|
|
This->dp2->lpSessionDesc &&
|
2000-08-25 23:58:05 +02:00
|
|
|
( This->dp2->lpSessionDesc->dwFlags & DPSESSION_MULTICASTSERVER ) )
|
|
|
|
{
|
|
|
|
DPMSG_CREATEPLAYERORGROUP msg;
|
|
|
|
msg.dwType = DPSYS_CREATEPLAYERORGROUP;
|
|
|
|
|
|
|
|
msg.dwPlayerType = DPPLAYERTYPE_GROUP;
|
|
|
|
msg.dpId = *lpidGroup;
|
|
|
|
msg.dwCurrentPlayers = 0; /* FIXME: Incorrect? */
|
|
|
|
msg.lpData = lpData;
|
|
|
|
msg.dwDataSize = dwDataSize;
|
|
|
|
msg.dpnName = *lpGroupName;
|
|
|
|
msg.dpIdParent = DPID_NOPARENT_GROUP;
|
|
|
|
msg.dwFlags = DPMSG_CREATEGROUP_DWFLAGS( dwFlags );
|
|
|
|
|
|
|
|
/* FIXME: Correct to just use send effectively? */
|
|
|
|
/* FIXME: Should size include data w/ message or just message "header" */
|
|
|
|
/* FIXME: Check return code */
|
2013-03-29 17:05:50 +01:00
|
|
|
IDirectPlayX_SendEx( &This->IDirectPlay4_iface, DPID_SERVERPLAYER, DPID_ALLPLAYERS, 0, &msg,
|
|
|
|
sizeof( msg ), 0, 0, NULL, NULL );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
2000-05-30 22:08:32 +02:00
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_CreateGroup( IDirectPlay2A *iface, DPID *lpidGroup,
|
|
|
|
DPNAME *name, void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_CreateGroup( &This->IDirectPlay4A_iface, lpidGroup, name, data, size,
|
|
|
|
flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_CreateGroup( IDirectPlay2 *iface, DPID *lpidGroup,
|
|
|
|
DPNAME *name, void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_CreateGroup( &This->IDirectPlay4_iface, lpidGroup, name, data, size,
|
|
|
|
flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_CreateGroup( IDirectPlay3A *iface, DPID *group,
|
|
|
|
DPNAME *name, void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_CreateGroup( &This->IDirectPlay4_iface, group, name, data, size,
|
|
|
|
flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_CreateGroup( IDirectPlay3 *iface, DPID *lpidGroup,
|
|
|
|
DPNAME *name, void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_CreateGroup( &This->IDirectPlay4_iface, lpidGroup, name, data, size,
|
|
|
|
flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_CreateGroup( IDirectPlay4A *iface, DPID *lpidGroup,
|
|
|
|
DPNAME *lpGroupName, void *lpData, DWORD dwDataSize, DWORD dwFlags )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:45:09 +01:00
|
|
|
*lpidGroup = DPID_UNKNOWN;
|
|
|
|
|
|
|
|
return DP_IF_CreateGroup( This, NULL, lpidGroup, lpGroupName, lpData, dwDataSize, dwFlags,
|
|
|
|
TRUE );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_CreateGroup( IDirectPlay4 *iface, DPID *lpidGroup,
|
|
|
|
DPNAME *lpGroupName, void *lpData, DWORD dwDataSize, DWORD dwFlags )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
|
|
|
|
*lpidGroup = DPID_UNKNOWN;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
return DP_IF_CreateGroup( This, NULL, lpidGroup, lpGroupName, lpData, dwDataSize, dwFlags,
|
|
|
|
FALSE );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-30 22:08:32 +02:00
|
|
|
static void
|
2002-06-01 01:06:46 +02:00
|
|
|
DP_SetGroupData( lpGroupData lpGData, DWORD dwFlags,
|
2000-08-25 23:58:05 +02:00
|
|
|
LPVOID lpData, DWORD dwDataSize )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
|
|
|
/* Clear out the data with this player */
|
2005-04-19 11:48:09 +02:00
|
|
|
if( dwFlags & DPSET_LOCAL )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2005-04-19 11:48:09 +02:00
|
|
|
if ( lpGData->dwLocalDataSize != 0 )
|
|
|
|
{
|
|
|
|
HeapFree( GetProcessHeap(), 0, lpGData->lpLocalData );
|
|
|
|
lpGData->lpLocalData = NULL;
|
|
|
|
lpGData->dwLocalDataSize = 0;
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
2005-04-19 11:48:09 +02:00
|
|
|
else
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2005-04-19 11:48:09 +02:00
|
|
|
if( lpGData->dwRemoteDataSize != 0 )
|
|
|
|
{
|
|
|
|
HeapFree( GetProcessHeap(), 0, lpGData->lpRemoteData );
|
|
|
|
lpGData->lpRemoteData = NULL;
|
|
|
|
lpGData->dwRemoteDataSize = 0;
|
|
|
|
}
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Reallocate for new data */
|
2000-08-25 23:58:05 +02:00
|
|
|
if( lpData != NULL )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
if( dwFlags & DPSET_LOCAL )
|
|
|
|
{
|
|
|
|
lpGData->lpLocalData = lpData;
|
|
|
|
lpGData->dwLocalDataSize = dwDataSize;
|
|
|
|
}
|
2005-04-19 11:48:09 +02:00
|
|
|
else
|
|
|
|
{
|
2012-10-29 20:16:36 +01:00
|
|
|
lpGData->lpRemoteData = HeapAlloc( GetProcessHeap(), 0, dwDataSize );
|
|
|
|
CopyMemory( lpGData->lpRemoteData, lpData, dwDataSize );
|
2005-04-19 11:48:09 +02:00
|
|
|
lpGData->dwRemoteDataSize = dwDataSize;
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
2000-05-30 22:08:32 +02:00
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
/* This function will just create the storage for the new player. */
|
2013-03-29 17:12:33 +01:00
|
|
|
static lpPlayerData DP_CreatePlayer( IDirectPlayImpl *This, DPID *lpid, DPNAME *lpName,
|
|
|
|
DWORD dwFlags, HANDLE hEvent, BOOL bAnsi )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
lpPlayerData lpPData;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
|
|
|
TRACE( "(%p)->(%p,%p,%u)\n", This, lpid, lpName, bAnsi );
|
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
/* Allocate the storage for the player and associate it with list element */
|
2005-03-24 22:01:35 +01:00
|
|
|
lpPData = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpPData ) );
|
2000-08-25 23:58:05 +02:00
|
|
|
if( lpPData == NULL )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Set the desired player ID */
|
|
|
|
lpPData->dpid = *lpid;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
DP_CopyDPNAMEStruct( &lpPData->name, lpName, bAnsi );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
lpPData->dwFlags = dwFlags;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* If we were given an event handle, duplicate it */
|
|
|
|
if( hEvent != 0 )
|
|
|
|
{
|
|
|
|
if( !DuplicateHandle( GetCurrentProcess(), hEvent,
|
|
|
|
GetCurrentProcess(), &lpPData->hEvent,
|
|
|
|
0, FALSE, DUPLICATE_SAME_ACCESS )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
/* FIXME: Memory leak */
|
2002-10-24 00:20:46 +02:00
|
|
|
ERR( "Can't duplicate player msg handle %p\n", hEvent );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
}
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-10-19 22:20:58 +02:00
|
|
|
/* Initialize the SP data section */
|
|
|
|
lpPData->lpSPPlayerData = DPSP_CreateSPPlayerData();
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "Created player id 0x%08lx\n", *lpid );
|
2000-10-19 22:20:58 +02:00
|
|
|
|
2007-03-15 17:10:25 +01:00
|
|
|
if( ~dwFlags & DPLAYI_PLAYER_SYSPLAYER )
|
|
|
|
This->dp2->lpSessionDesc->dwCurrentPlayers++;
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
return lpPData;
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Delete the contents of the DPNAME struct */
|
|
|
|
static void
|
|
|
|
DP_DeleteDPNameStruct( LPDPNAME lpDPName )
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
HeapFree( GetProcessHeap(), HEAP_ZERO_MEMORY, lpDPName->u1.lpszShortNameA );
|
|
|
|
HeapFree( GetProcessHeap(), HEAP_ZERO_MEMORY, lpDPName->u2.lpszLongNameA );
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
/* This method assumes that all links to it are already deleted */
|
2013-03-29 17:12:33 +01:00
|
|
|
static void DP_DeletePlayer( IDirectPlayImpl *This, DPID dpid )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2000-08-30 01:55:06 +02:00
|
|
|
lpPlayerList lpPList;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx)\n", This, dpid );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
DPQ_REMOVE_ENTRY( This->dp2->lpSysGroup->players, players, lpPData->dpid, ==, dpid, lpPList );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
if( lpPList == NULL )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
ERR( "DPID 0x%08lx not found\n", dpid );
|
2000-06-07 05:44:36 +02:00
|
|
|
return;
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
2000-08-30 01:55:06 +02:00
|
|
|
|
|
|
|
/* Verify that this is the last reference to the data */
|
|
|
|
if( --(lpPList->lpPData->uRef) )
|
|
|
|
{
|
|
|
|
FIXME( "Why is this not the last reference to player?\n" );
|
2002-06-01 01:06:46 +02:00
|
|
|
DebugBreak();
|
2000-08-30 01:55:06 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
/* Delete player */
|
2000-08-30 01:55:06 +02:00
|
|
|
DP_DeleteDPNameStruct( &lpPList->lpPData->name );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
CloseHandle( lpPList->lpPData->hEvent );
|
|
|
|
HeapFree( GetProcessHeap(), 0, lpPList->lpPData );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
|
|
|
/* Delete Player List object */
|
2000-08-30 01:55:06 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, lpPList );
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static lpPlayerList DP_FindPlayer( IDirectPlayImpl *This, DPID dpid )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
|
|
|
lpPlayerList lpPlayers;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx)\n", This, dpid );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2007-03-21 12:14:47 +01:00
|
|
|
if(This->dp2->lpSysGroup == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
DPQ_FIND_ENTRY( This->dp2->lpSysGroup->players, players, lpPData->dpid, ==, dpid, lpPlayers );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
|
|
|
return lpPlayers;
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Basic area for Dst must already be allocated */
|
2007-04-26 23:45:27 +02:00
|
|
|
static BOOL DP_CopyDPNAMEStruct( LPDPNAME lpDst, const DPNAME *lpSrc, BOOL bAnsi )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
|
|
|
if( lpSrc == NULL )
|
|
|
|
{
|
|
|
|
ZeroMemory( lpDst, sizeof( *lpDst ) );
|
|
|
|
lpDst->dwSize = sizeof( *lpDst );
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if( lpSrc->dwSize != sizeof( *lpSrc) )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Delete any existing pointers */
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, lpDst->u1.lpszShortNameA );
|
|
|
|
HeapFree( GetProcessHeap(), 0, lpDst->u2.lpszLongNameA );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
|
|
|
/* Copy as required */
|
2002-06-01 01:06:46 +02:00
|
|
|
CopyMemory( lpDst, lpSrc, lpSrc->dwSize );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
|
|
|
if( bAnsi )
|
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpSrc->u1.lpszShortNameA )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
lpDst->u1.lpszShortNameA = HeapAlloc( GetProcessHeap(), 0,
|
|
|
|
strlen(lpSrc->u1.lpszShortNameA)+1 );
|
|
|
|
strcpy( lpDst->u1.lpszShortNameA, lpSrc->u1.lpszShortNameA );
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpSrc->u2.lpszLongNameA )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
lpDst->u2.lpszLongNameA = HeapAlloc( GetProcessHeap(), 0,
|
|
|
|
strlen(lpSrc->u2.lpszLongNameA)+1 );
|
|
|
|
strcpy( lpDst->u2.lpszLongNameA, lpSrc->u2.lpszLongNameA );
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpSrc->u1.lpszShortNameA )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
lpDst->u1.lpszShortName = HeapAlloc( GetProcessHeap(), 0,
|
2019-06-03 10:31:26 +02:00
|
|
|
(lstrlenW(lpSrc->u1.lpszShortName)+1)*sizeof(WCHAR) );
|
|
|
|
lstrcpyW( lpDst->u1.lpszShortName, lpSrc->u1.lpszShortName );
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpSrc->u2.lpszLongNameA )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
lpDst->u2.lpszLongName = HeapAlloc( GetProcessHeap(), 0,
|
2019-06-03 10:31:26 +02:00
|
|
|
(lstrlenW(lpSrc->u2.lpszLongName)+1)*sizeof(WCHAR) );
|
|
|
|
lstrcpyW( lpDst->u2.lpszLongName, lpSrc->u2.lpszLongName );
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
static void
|
|
|
|
DP_SetPlayerData( lpPlayerData lpPData, DWORD dwFlags,
|
2000-08-25 23:58:05 +02:00
|
|
|
LPVOID lpData, DWORD dwDataSize )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
|
|
|
/* Clear out the data with this player */
|
2005-04-19 11:48:09 +02:00
|
|
|
if( dwFlags & DPSET_LOCAL )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2005-04-19 11:48:09 +02:00
|
|
|
if ( lpPData->dwLocalDataSize != 0 )
|
|
|
|
{
|
|
|
|
HeapFree( GetProcessHeap(), 0, lpPData->lpLocalData );
|
|
|
|
lpPData->lpLocalData = NULL;
|
|
|
|
lpPData->dwLocalDataSize = 0;
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
2005-04-19 11:48:09 +02:00
|
|
|
else
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2005-04-19 11:48:09 +02:00
|
|
|
if( lpPData->dwRemoteDataSize != 0 )
|
|
|
|
{
|
|
|
|
HeapFree( GetProcessHeap(), 0, lpPData->lpRemoteData );
|
|
|
|
lpPData->lpRemoteData = NULL;
|
|
|
|
lpPData->dwRemoteDataSize = 0;
|
|
|
|
}
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Reallocate for new data */
|
2000-08-25 23:58:05 +02:00
|
|
|
if( lpData != NULL )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
if( dwFlags & DPSET_LOCAL )
|
|
|
|
{
|
|
|
|
lpPData->lpLocalData = lpData;
|
|
|
|
lpPData->dwLocalDataSize = dwDataSize;
|
|
|
|
}
|
2005-04-19 11:48:09 +02:00
|
|
|
else
|
|
|
|
{
|
2012-10-29 20:16:36 +01:00
|
|
|
lpPData->lpRemoteData = HeapAlloc( GetProcessHeap(), 0, dwDataSize );
|
|
|
|
CopyMemory( lpPData->lpRemoteData, lpData, dwDataSize );
|
2005-04-19 11:48:09 +02:00
|
|
|
lpPData->dwRemoteDataSize = dwDataSize;
|
|
|
|
}
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
/* Note: lpMsgHdr is NULL for local creation, non NULL for remote creation */
|
|
|
|
static HRESULT DP_IF_CreatePlayer( IDirectPlayImpl *This, void *lpMsgHdr, DPID *lpidPlayer,
|
|
|
|
DPNAME *lpPlayerName, HANDLE hEvent, void *lpData, DWORD dwDataSize, DWORD dwFlags,
|
|
|
|
BOOL bAnsi )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2002-10-24 00:20:46 +02:00
|
|
|
HRESULT hr = DP_OK;
|
2000-05-30 22:08:32 +02:00
|
|
|
lpPlayerData lpPData;
|
2000-08-25 23:58:05 +02:00
|
|
|
lpPlayerList lpPList;
|
2000-10-19 22:20:58 +02:00
|
|
|
DWORD dwCreateFlags = 0;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(%p,%p,%p,%p,0x%08lx,0x%08lx,%u)\n",
|
2002-06-01 01:06:46 +02:00
|
|
|
This, lpidPlayer, lpPlayerName, hEvent, lpData,
|
2000-07-10 15:19:28 +02:00
|
|
|
dwDataSize, dwFlags, bAnsi );
|
2008-08-02 21:51:59 +02:00
|
|
|
if( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
{
|
|
|
|
return DPERR_UNINITIALIZED;
|
|
|
|
}
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if( dwFlags == 0 )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
|
|
|
dwFlags = DPPLAYER_SPECTATOR;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( lpidPlayer == NULL )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
2000-10-19 22:20:58 +02:00
|
|
|
|
|
|
|
/* Determine the creation flags for the player. These will be passed
|
|
|
|
* to the name server if requesting a player id and to the SP when
|
|
|
|
* informing it of the player creation
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
if( dwFlags & DPPLAYER_SERVERPLAYER )
|
|
|
|
{
|
|
|
|
if( *lpidPlayer == DPID_SERVERPLAYER )
|
|
|
|
{
|
|
|
|
/* Server player for the host interface */
|
|
|
|
dwCreateFlags |= DPLAYI_PLAYER_APPSERVER;
|
|
|
|
}
|
|
|
|
else if( *lpidPlayer == DPID_NAME_SERVER )
|
|
|
|
{
|
|
|
|
/* Name server - master of everything */
|
|
|
|
dwCreateFlags |= (DPLAYI_PLAYER_NAMESRVR|DPLAYI_PLAYER_SYSPLAYER);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Server player for a non host interface */
|
|
|
|
dwCreateFlags |= DPLAYI_PLAYER_SYSPLAYER;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( lpMsgHdr == NULL )
|
|
|
|
dwCreateFlags |= DPLAYI_PLAYER_PLAYERLOCAL;
|
|
|
|
}
|
|
|
|
|
2000-05-30 22:08:32 +02:00
|
|
|
/* Verify we know how to handle all the flags */
|
|
|
|
if( !( ( dwFlags & DPPLAYER_SERVERPLAYER ) ||
|
|
|
|
( dwFlags & DPPLAYER_SPECTATOR )
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
/* Assume non fatal failure */
|
2022-02-03 10:43:50 +01:00
|
|
|
ERR( "unknown dwFlags = 0x%08lx\n", dwFlags );
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* If the name is not specified, we must provide one */
|
|
|
|
if( *lpidPlayer == DPID_UNKNOWN )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
/* If we are the session master, we dish out the group/player ids */
|
|
|
|
if( This->dp2->bHostInterface )
|
2000-05-30 22:08:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
*lpidPlayer = DP_NextObjectId();
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
else
|
|
|
|
{
|
2000-10-19 22:20:58 +02:00
|
|
|
hr = DP_MSG_SendRequestPlayerId( This, dwCreateFlags, lpidPlayer );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
if( FAILED(hr) )
|
|
|
|
{
|
|
|
|
ERR( "Request for ID failed: %s\n", DPLAYX_HresultToString( hr ) );
|
|
|
|
return hr;
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
/* FIXME: Would be nice to perhaps verify that we don't already have
|
|
|
|
* this player.
|
|
|
|
*/
|
2000-05-30 22:08:32 +02:00
|
|
|
}
|
|
|
|
|
2007-03-15 17:10:25 +01:00
|
|
|
/* We pass creation flags, so we can distinguish sysplayers and not count them in the current
|
|
|
|
player total */
|
|
|
|
lpPData = DP_CreatePlayer( This, lpidPlayer, lpPlayerName, dwCreateFlags,
|
2000-08-25 23:58:05 +02:00
|
|
|
hEvent, bAnsi );
|
|
|
|
/* Create the list object and link it in */
|
2005-03-24 22:01:35 +01:00
|
|
|
lpPList = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpPList ) );
|
2015-11-22 16:31:20 +01:00
|
|
|
if( !lpPData || !lpPList )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2015-11-22 16:31:20 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, lpPData );
|
|
|
|
HeapFree( GetProcessHeap(), 0, lpPList );
|
2000-08-25 23:58:05 +02:00
|
|
|
return DPERR_CANTADDPLAYER;
|
|
|
|
}
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
lpPData->uRef = 1;
|
2000-08-25 23:58:05 +02:00
|
|
|
lpPList->lpPData = lpPData;
|
2000-03-12 21:18:33 +01:00
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
/* Add the player to the system group */
|
2000-08-25 23:58:05 +02:00
|
|
|
DPQ_INSERT( This->dp2->lpSysGroup->players, lpPList, players );
|
2000-03-12 21:18:33 +01:00
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
/* Update the information and send it to all players in the session */
|
2002-06-01 01:06:46 +02:00
|
|
|
DP_SetPlayerData( lpPData, DPSET_REMOTE, lpData, dwDataSize );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
/* Let the SP know that we've created this player */
|
|
|
|
if( This->dp2->spData.lpCB->CreatePlayer )
|
|
|
|
{
|
|
|
|
DPSP_CREATEPLAYERDATA data;
|
|
|
|
|
|
|
|
data.idPlayer = *lpidPlayer;
|
|
|
|
data.dwFlags = dwCreateFlags;
|
|
|
|
data.lpSPMessageHeader = lpMsgHdr;
|
|
|
|
data.lpISP = This->dp2->spData.lpISP;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "Calling SP CreatePlayer 0x%08lx: dwFlags: 0x%08lx lpMsgHdr: %p\n",
|
2000-10-19 22:20:58 +02:00
|
|
|
*lpidPlayer, data.dwFlags, data.lpSPMessageHeader );
|
|
|
|
|
2000-09-27 01:11:48 +02:00
|
|
|
hr = (*This->dp2->spData.lpCB->CreatePlayer)( &data );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( FAILED(hr) )
|
|
|
|
{
|
|
|
|
ERR( "Failed to create player with sp: %s\n", DPLAYX_HresultToString(hr) );
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now let the SP know that this player is a member of the system group */
|
|
|
|
if( This->dp2->spData.lpCB->AddPlayerToGroup )
|
|
|
|
{
|
|
|
|
DPSP_ADDPLAYERTOGROUPDATA data;
|
|
|
|
|
|
|
|
data.idPlayer = *lpidPlayer;
|
2002-06-01 01:06:46 +02:00
|
|
|
data.idGroup = DPID_SYSTEM_GROUP;
|
2000-09-27 01:11:48 +02:00
|
|
|
data.lpISP = This->dp2->spData.lpISP;
|
|
|
|
|
|
|
|
TRACE( "Calling SP AddPlayerToGroup (sys group)\n" );
|
|
|
|
|
|
|
|
hr = (*This->dp2->spData.lpCB->AddPlayerToGroup)( &data );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( FAILED(hr) )
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
ERR( "Failed to add player to sys group with sp: %s\n",
|
2000-09-27 01:11:48 +02:00
|
|
|
DPLAYX_HresultToString(hr) );
|
|
|
|
return hr;
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2000-10-19 22:20:58 +02:00
|
|
|
#if 1
|
2014-02-27 00:21:02 +01:00
|
|
|
if( !This->dp2->bHostInterface )
|
2000-10-19 22:20:58 +02:00
|
|
|
{
|
|
|
|
/* Let the name server know about the creation of this player */
|
|
|
|
/* FIXME: Is this only to be done for the creation of a server player or
|
|
|
|
* is this used for regular players? If only for server players, move
|
|
|
|
* this call to DP_SecureOpen(...);
|
|
|
|
*/
|
2001-04-12 23:10:54 +02:00
|
|
|
#if 0
|
|
|
|
TRACE( "Sending message to self to get my addr\n" );
|
|
|
|
DP_MSG_ToSelf( This, *lpidPlayer ); /* This is a hack right now */
|
|
|
|
#endif
|
|
|
|
|
2000-10-19 22:20:58 +02:00
|
|
|
hr = DP_MSG_ForwardPlayerCreation( This, *lpidPlayer);
|
|
|
|
}
|
|
|
|
#else
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Inform all other peers of the creation of a new player. If there are
|
2002-06-01 01:06:46 +02:00
|
|
|
* no peers keep this quiet.
|
2000-08-25 23:58:05 +02:00
|
|
|
* Also, if this was a remote event, no need to rebroadcast it.
|
|
|
|
*/
|
|
|
|
if( ( lpMsgHdr == NULL ) &&
|
|
|
|
This->dp2->lpSessionDesc &&
|
|
|
|
( This->dp2->lpSessionDesc->dwFlags & DPSESSION_MULTICASTSERVER ) )
|
|
|
|
{
|
|
|
|
DPMSG_CREATEPLAYERORGROUP msg;
|
|
|
|
msg.dwType = DPSYS_CREATEPLAYERORGROUP;
|
|
|
|
|
|
|
|
msg.dwPlayerType = DPPLAYERTYPE_PLAYER;
|
|
|
|
msg.dpId = *lpidPlayer;
|
|
|
|
msg.dwCurrentPlayers = 0; /* FIXME: Incorrect */
|
|
|
|
msg.lpData = lpData;
|
|
|
|
msg.dwDataSize = dwDataSize;
|
|
|
|
msg.dpnName = *lpPlayerName;
|
|
|
|
msg.dpIdParent = DPID_NOPARENT_GROUP;
|
|
|
|
msg.dwFlags = DPMSG_CREATEPLAYER_DWFLAGS( dwFlags );
|
|
|
|
|
|
|
|
/* FIXME: Correct to just use send effectively? */
|
|
|
|
/* FIXME: Should size include data w/ message or just message "header" */
|
|
|
|
/* FIXME: Check return code */
|
2013-03-29 17:05:50 +01:00
|
|
|
hr = IDirectPlayX_SendEx( &This->IDirectPlay4_iface, DPID_SERVERPLAYER, DPID_ALLPLAYERS, 0,
|
|
|
|
&msg, sizeof( msg ), 0, 0, NULL, NULL );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
2000-10-19 22:20:58 +02:00
|
|
|
#endif
|
2000-03-12 21:18:33 +01:00
|
|
|
|
2000-09-27 01:11:48 +02:00
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_CreatePlayer( IDirectPlay2A *iface, DPID *lpidPlayer,
|
|
|
|
DPNAME *name, HANDLE event, void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_CreatePlayer( &This->IDirectPlay4A_iface, lpidPlayer, name, event, data,
|
|
|
|
size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_CreatePlayer( IDirectPlay2 *iface, DPID *lpidPlayer,
|
|
|
|
DPNAME *name, HANDLE event, void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_CreatePlayer( &This->IDirectPlay4_iface, lpidPlayer, name, event, data,
|
|
|
|
size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_CreatePlayer( IDirectPlay3A *iface, DPID *lpidPlayer,
|
|
|
|
DPNAME *name, HANDLE event, void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_CreatePlayer( &This->IDirectPlay4_iface, lpidPlayer, name, event, data,
|
|
|
|
size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_CreatePlayer( IDirectPlay3 *iface, DPID *lpidPlayer,
|
|
|
|
DPNAME *name, HANDLE event, void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_CreatePlayer( &This->IDirectPlay4_iface, lpidPlayer, name, event, data,
|
|
|
|
size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_CreatePlayer( IDirectPlay4A *iface, DPID *lpidPlayer,
|
|
|
|
DPNAME *lpPlayerName, HANDLE hEvent, void *lpData, DWORD dwDataSize, DWORD dwFlags )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2008-08-03 13:22:40 +02:00
|
|
|
if( lpidPlayer == NULL )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( dwFlags & DPPLAYER_SERVERPLAYER )
|
|
|
|
{
|
|
|
|
*lpidPlayer = DPID_SERVERPLAYER;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*lpidPlayer = DPID_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
return DP_IF_CreatePlayer( This, NULL, lpidPlayer, lpPlayerName, hEvent,
|
2000-07-10 15:19:28 +02:00
|
|
|
lpData, dwDataSize, dwFlags, TRUE );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_CreatePlayer( IDirectPlay4 *iface, DPID *lpidPlayer,
|
|
|
|
DPNAME *lpPlayerName, HANDLE hEvent, void *lpData, DWORD dwDataSize, DWORD dwFlags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2008-08-03 13:22:40 +02:00
|
|
|
if( lpidPlayer == NULL )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( dwFlags & DPPLAYER_SERVERPLAYER )
|
|
|
|
{
|
|
|
|
*lpidPlayer = DPID_SERVERPLAYER;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*lpidPlayer = DPID_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
return DP_IF_CreatePlayer( This, NULL, lpidPlayer, lpPlayerName, hEvent,
|
2000-07-10 15:19:28 +02:00
|
|
|
lpData, dwDataSize, dwFlags, FALSE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
static DPID DP_GetRemoteNextObjectId(void)
|
|
|
|
{
|
|
|
|
FIXME( ":stub\n" );
|
|
|
|
|
|
|
|
/* Hack solution */
|
|
|
|
return DP_NextObjectId();
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_DeletePlayerFromGroup( IDirectPlay2A *iface, DPID group,
|
|
|
|
DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_DeletePlayerFromGroup( &This->IDirectPlay4A_iface, group, player );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_DeletePlayerFromGroup( IDirectPlay2 *iface, DPID group,
|
|
|
|
DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_DeletePlayerFromGroup( &This->IDirectPlay4_iface, group, player );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_DeletePlayerFromGroup( IDirectPlay3A *iface, DPID group,
|
|
|
|
DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_DeletePlayerFromGroup( &This->IDirectPlay4_iface, group, player );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_DeletePlayerFromGroup( IDirectPlay3 *iface, DPID group,
|
|
|
|
DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_DeletePlayerFromGroup( &This->IDirectPlay4_iface, group, player );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:52:30 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_DeletePlayerFromGroup( IDirectPlay4A *iface, DPID group,
|
|
|
|
DPID player )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:52:30 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_DeletePlayerFromGroup( &This->IDirectPlay4_iface, group, player );
|
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:52:30 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_DeletePlayerFromGroup( IDirectPlay4 *iface, DPID group,
|
|
|
|
DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
HRESULT hr = DP_OK;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:52:30 +01:00
|
|
|
lpGroupData gdata;
|
|
|
|
lpPlayerList plist;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx,0x%08lx)\n", This, group, player );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:52:30 +01:00
|
|
|
/* Find the group */
|
|
|
|
if ( ( gdata = DP_FindAnyGroup( This, group ) ) == NULL )
|
|
|
|
return DPERR_INVALIDGROUP;
|
2000-08-30 01:55:06 +02:00
|
|
|
|
2013-03-29 16:52:30 +01:00
|
|
|
/* Find the player */
|
2013-04-19 22:47:58 +02:00
|
|
|
if ( DP_FindPlayer( This, player ) == NULL )
|
2013-03-29 16:52:30 +01:00
|
|
|
return DPERR_INVALIDPLAYER;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:52:30 +01:00
|
|
|
/* Remove the player shortcut from the group */
|
|
|
|
DPQ_REMOVE_ENTRY( gdata->players, players, lpPData->dpid, ==, player, plist );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:52:30 +01:00
|
|
|
if ( !plist )
|
|
|
|
return DPERR_INVALIDPLAYER;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:52:30 +01:00
|
|
|
/* One less reference */
|
|
|
|
plist->lpPData->uRef--;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:52:30 +01:00
|
|
|
/* Delete the Player List element */
|
|
|
|
HeapFree( GetProcessHeap(), 0, plist );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:52:30 +01:00
|
|
|
/* Inform the SP if they care */
|
|
|
|
if ( This->dp2->spData.lpCB->RemovePlayerFromGroup )
|
|
|
|
{
|
|
|
|
DPSP_REMOVEPLAYERFROMGROUPDATA data;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:52:30 +01:00
|
|
|
TRACE( "Calling SP RemovePlayerFromGroup\n" );
|
|
|
|
data.idPlayer = player;
|
|
|
|
data.idGroup = group;
|
|
|
|
data.lpISP = This->dp2->spData.lpISP;
|
|
|
|
hr = (*This->dp2->spData.lpCB->RemovePlayerFromGroup)( &data );
|
|
|
|
}
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-03-29 16:52:30 +01:00
|
|
|
/* Need to send a DELETEPLAYERFROMGROUP message */
|
|
|
|
FIXME( "Need to send a message\n" );
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2013-03-29 16:52:30 +01:00
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
typedef struct _DPRGOPContext
|
|
|
|
{
|
2013-03-29 17:12:33 +01:00
|
|
|
IDirectPlayImpl *This;
|
2000-08-30 01:55:06 +02:00
|
|
|
BOOL bAnsi;
|
|
|
|
DPID idGroup;
|
2000-06-07 05:44:36 +02:00
|
|
|
} DPRGOPContext, *lpDPRGOPContext;
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
static BOOL CALLBACK
|
2000-06-07 05:44:36 +02:00
|
|
|
cbRemoveGroupOrPlayer(
|
|
|
|
DPID dpId,
|
|
|
|
DWORD dwPlayerType,
|
|
|
|
LPCDPNAME lpName,
|
|
|
|
DWORD dwFlags,
|
|
|
|
LPVOID lpContext )
|
|
|
|
{
|
|
|
|
lpDPRGOPContext lpCtxt = (lpDPRGOPContext)lpContext;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "Removing element:0x%08lx (type:0x%08lx) from element:0x%08lx\n",
|
2000-06-07 05:44:36 +02:00
|
|
|
dpId, dwPlayerType, lpCtxt->idGroup );
|
|
|
|
|
|
|
|
if( dwPlayerType == DPPLAYERTYPE_GROUP )
|
|
|
|
{
|
2013-03-29 17:00:34 +01:00
|
|
|
if ( FAILED( IDirectPlayX_DeleteGroupFromGroup( &lpCtxt->This->IDirectPlay4_iface,
|
|
|
|
lpCtxt->idGroup, dpId ) ) )
|
2022-02-03 10:43:50 +01:00
|
|
|
ERR( "Unable to delete group 0x%08lx from group 0x%08lx\n", dpId, lpCtxt->idGroup );
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
2013-03-29 16:52:30 +01:00
|
|
|
else if ( FAILED( IDirectPlayX_DeletePlayerFromGroup( &lpCtxt->This->IDirectPlay4_iface,
|
|
|
|
lpCtxt->idGroup, dpId ) ) )
|
2022-02-03 10:43:50 +01:00
|
|
|
ERR( "Unable to delete player 0x%08lx from grp 0x%08lx\n", dpId, lpCtxt->idGroup );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
return TRUE; /* Continue enumeration */
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_IF_DestroyGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID idGroup, BOOL bAnsi )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
lpGroupData lpGData;
|
2000-06-07 05:44:36 +02:00
|
|
|
DPRGOPContext context;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(%p,0x%08lx,%u): semi stub\n",
|
2000-08-25 23:58:05 +02:00
|
|
|
This, lpMsgHdr, idGroup, bAnsi );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
|
|
|
/* Find the group */
|
2000-08-25 23:58:05 +02:00
|
|
|
if( ( lpGData = DP_FindAnyGroup( This, idGroup ) ) == NULL )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
|
|
|
return DPERR_INVALIDPLAYER; /* yes player */
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:09:40 +01:00
|
|
|
context.This = This;
|
2000-07-10 15:19:28 +02:00
|
|
|
context.bAnsi = bAnsi;
|
2000-06-07 05:44:36 +02:00
|
|
|
context.idGroup = idGroup;
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
/* Remove all players that this group has */
|
2013-03-29 16:53:07 +01:00
|
|
|
IDirectPlayX_EnumGroupPlayers( &This->IDirectPlay4_iface, idGroup, NULL, cbRemoveGroupOrPlayer,
|
|
|
|
&context, 0 );
|
2000-08-30 01:55:06 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Remove all links to groups that this group has since this is dp3 */
|
2013-03-29 17:01:34 +01:00
|
|
|
IDirectPlayX_EnumGroupsInGroup( &This->IDirectPlay4_iface, idGroup, NULL, cbRemoveGroupOrPlayer,
|
|
|
|
(void*)&context, 0 );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
/* Remove this group from the parent group - if it has one */
|
2013-03-29 17:00:34 +01:00
|
|
|
if( ( idGroup != DPID_SYSTEM_GROUP ) && ( lpGData->parent != DPID_SYSTEM_GROUP ) )
|
|
|
|
IDirectPlayX_DeleteGroupFromGroup( &This->IDirectPlay4_iface, lpGData->parent, idGroup );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
/* Now delete this group data and list from the system group */
|
2002-06-01 01:06:46 +02:00
|
|
|
DP_DeleteGroup( This, idGroup );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Let the SP know that we've destroyed this group */
|
|
|
|
if( This->dp2->spData.lpCB->DeleteGroup )
|
|
|
|
{
|
|
|
|
DPSP_DELETEGROUPDATA data;
|
|
|
|
|
|
|
|
FIXME( "data.dwFlags is incorrect\n" );
|
|
|
|
|
|
|
|
data.idGroup = idGroup;
|
2002-06-01 01:06:46 +02:00
|
|
|
data.dwFlags = 0;
|
2000-08-25 23:58:05 +02:00
|
|
|
data.lpISP = This->dp2->spData.lpISP;
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
(*This->dp2->spData.lpCB->DeleteGroup)( &data );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
FIXME( "Send out a DESTORYPLAYERORGROUP message\n" );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_DestroyGroup( IDirectPlay2A *iface, DPID group )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_DestroyGroup( &This->IDirectPlay4A_iface, group );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_DestroyGroup( IDirectPlay2 *iface, DPID group )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_DestroyGroup( &This->IDirectPlay4_iface, group );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_DestroyGroup( IDirectPlay3A *iface, DPID group )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_DestroyGroup( &This->IDirectPlay4_iface, group );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_DestroyGroup( IDirectPlay3 *iface, DPID group )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_DestroyGroup( &This->IDirectPlay4_iface, group );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_DestroyGroup( IDirectPlay4A *iface, DPID idGroup )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return DP_IF_DestroyGroup( This, NULL, idGroup, TRUE );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_DestroyGroup( IDirectPlay4 *iface, DPID idGroup )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
return DP_IF_DestroyGroup( This, NULL, idGroup, FALSE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
typedef struct _DPFAGContext
|
|
|
|
{
|
2013-03-29 17:12:33 +01:00
|
|
|
IDirectPlayImpl *This;
|
2000-08-30 01:55:06 +02:00
|
|
|
DPID idPlayer;
|
|
|
|
BOOL bAnsi;
|
2000-06-07 05:44:36 +02:00
|
|
|
} DPFAGContext, *lpDPFAGContext;
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_IF_DestroyPlayer( IDirectPlayImpl *This, void *lpMsgHdr, DPID idPlayer,
|
|
|
|
BOOL bAnsi )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-06-07 05:44:36 +02:00
|
|
|
DPFAGContext cbContext;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(%p,0x%08lx,%u): semi stub\n",
|
2000-08-25 23:58:05 +02:00
|
|
|
This, lpMsgHdr, idPlayer, bAnsi );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2003-12-30 22:50:56 +01:00
|
|
|
if( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
{
|
|
|
|
return DPERR_UNINITIALIZED;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( DP_FindPlayer( This, idPlayer ) == NULL )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
|
|
|
return DPERR_INVALIDPLAYER;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: If the player is remote, we must be the host to delete this */
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
cbContext.This = This;
|
2000-06-07 05:44:36 +02:00
|
|
|
cbContext.idPlayer = idPlayer;
|
2000-08-30 01:55:06 +02:00
|
|
|
cbContext.bAnsi = bAnsi;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
|
|
|
/* Find each group and call DeletePlayerFromGroup if the player is a
|
|
|
|
member of the group */
|
2013-03-29 16:46:40 +01:00
|
|
|
IDirectPlayX_EnumGroups( &This->IDirectPlay4_iface, NULL, cbDeletePlayerFromAllGroups, &cbContext,
|
2013-03-29 16:43:37 +01:00
|
|
|
DPENUMGROUPS_ALL );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
/* Now delete player and player list from the sys group */
|
2000-06-07 05:44:36 +02:00
|
|
|
DP_DeletePlayer( This, idPlayer );
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Let the SP know that we've destroyed this group */
|
|
|
|
if( This->dp2->spData.lpCB->DeletePlayer )
|
|
|
|
{
|
|
|
|
DPSP_DELETEPLAYERDATA data;
|
|
|
|
|
|
|
|
FIXME( "data.dwFlags is incorrect\n" );
|
|
|
|
|
|
|
|
data.idPlayer = idPlayer;
|
2002-06-01 01:06:46 +02:00
|
|
|
data.dwFlags = 0;
|
2000-08-25 23:58:05 +02:00
|
|
|
data.lpISP = This->dp2->spData.lpISP;
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
(*This->dp2->spData.lpCB->DeletePlayer)( &data );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
FIXME( "Send a DELETEPLAYERORGROUP msg\n" );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
static BOOL CALLBACK
|
2000-06-07 05:44:36 +02:00
|
|
|
cbDeletePlayerFromAllGroups(
|
|
|
|
DPID dpId,
|
|
|
|
DWORD dwPlayerType,
|
|
|
|
LPCDPNAME lpName,
|
|
|
|
DWORD dwFlags,
|
|
|
|
LPVOID lpContext )
|
|
|
|
{
|
|
|
|
lpDPFAGContext lpCtxt = (lpDPFAGContext)lpContext;
|
|
|
|
|
|
|
|
if( dwPlayerType == DPPLAYERTYPE_GROUP )
|
|
|
|
{
|
2013-03-29 16:52:30 +01:00
|
|
|
IDirectPlayX_DeletePlayerFromGroup( &lpCtxt->This->IDirectPlay4_iface, dpId, lpCtxt->idPlayer );
|
2000-08-30 01:55:06 +02:00
|
|
|
|
|
|
|
/* Enumerate all groups in this group since this will normally only
|
|
|
|
* be called for top level groups
|
|
|
|
*/
|
2013-03-29 17:01:34 +01:00
|
|
|
IDirectPlayX_EnumGroupsInGroup( &lpCtxt->This->IDirectPlay4_iface, dpId, NULL,
|
|
|
|
cbDeletePlayerFromAllGroups, lpContext, DPENUMGROUPS_ALL);
|
2000-06-07 05:44:36 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
ERR( "Group callback has dwPlayerType = 0x%08lx\n", dwPlayerType );
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_DestroyPlayer( IDirectPlay2A *iface, DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_DestroyPlayer( &This->IDirectPlay4A_iface, player );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_DestroyPlayer( IDirectPlay2 *iface, DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_DestroyPlayer( &This->IDirectPlay4_iface, player );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_DestroyPlayer( IDirectPlay3A *iface, DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_DestroyPlayer( &This->IDirectPlay4_iface, player );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_DestroyPlayer( IDirectPlay3 *iface, DPID player )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_DestroyPlayer( &This->IDirectPlay4_iface, player );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_DestroyPlayer( IDirectPlay4A *iface, DPID idPlayer )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return DP_IF_DestroyPlayer( This, NULL, idPlayer, TRUE );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_DestroyPlayer( IDirectPlay4 *iface, DPID idPlayer )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
return DP_IF_DestroyPlayer( This, NULL, idPlayer, FALSE );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_EnumGroupPlayers( IDirectPlay2A *iface, DPID group,
|
|
|
|
GUID *instance, LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_EnumGroupPlayers( &This->IDirectPlay4A_iface, group, instance,
|
|
|
|
enumplayercb, context, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_EnumGroupPlayers( IDirectPlay2 *iface, DPID group,
|
|
|
|
GUID *instance, LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_EnumGroupPlayers( &This->IDirectPlay4_iface, group, instance,
|
|
|
|
enumplayercb, context, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_EnumGroupPlayers( IDirectPlay3A *iface, DPID group,
|
|
|
|
GUID *instance, LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_EnumGroupPlayers( &This->IDirectPlay4_iface, group, instance,
|
|
|
|
enumplayercb, context, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_EnumGroupPlayers( IDirectPlay3 *iface, DPID group,
|
|
|
|
GUID *instance, LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_EnumGroupPlayers( &This->IDirectPlay4_iface, group, instance,
|
|
|
|
enumplayercb, context, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:53:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_EnumGroupPlayers( IDirectPlay4A *iface, DPID group,
|
|
|
|
GUID *instance, LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 16:53:07 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_EnumGroupPlayers( &This->IDirectPlay4_iface, group, instance, enumplayercb,
|
|
|
|
context, flags );
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:53:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_EnumGroupPlayers( IDirectPlay4 *iface, DPID group,
|
|
|
|
GUID *instance, LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
lpGroupData gdata;
|
|
|
|
lpPlayerList plist;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p,%p,%p,0x%08lx): semi stub\n", This, group, instance, enumplayercb,
|
2013-03-29 16:53:07 +01:00
|
|
|
context, flags );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:53:07 +01:00
|
|
|
if ( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
return DPERR_UNINITIALIZED;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:53:07 +01:00
|
|
|
/* Find the group */
|
|
|
|
if ( ( gdata = DP_FindAnyGroup( This, group ) ) == NULL )
|
|
|
|
return DPERR_INVALIDGROUP;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:53:07 +01:00
|
|
|
if ( DPQ_IS_EMPTY( gdata->players ) )
|
2000-08-25 23:58:05 +02:00
|
|
|
return DP_OK;
|
|
|
|
|
2013-03-29 16:53:07 +01:00
|
|
|
/* Walk the players in this group */
|
|
|
|
for( plist = DPQ_FIRST( gdata->players ); ; plist = DPQ_NEXT( plist->players ) )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 16:53:07 +01:00
|
|
|
/* We do not enum the name server or app server as they are of no
|
|
|
|
* consequence to the end user.
|
|
|
|
*/
|
|
|
|
if ( ( plist->lpPData->dpid != DPID_NAME_SERVER ) &&
|
|
|
|
( plist->lpPData->dpid != DPID_SERVERPLAYER ) )
|
|
|
|
{
|
|
|
|
/* FIXME: Need to add stuff for flags checking */
|
|
|
|
if ( !enumplayercb( plist->lpPData->dpid, DPPLAYERTYPE_PLAYER,
|
|
|
|
&plist->lpPData->name, plist->lpPData->dwFlags, context ) )
|
|
|
|
/* User requested break */
|
|
|
|
return DP_OK;
|
|
|
|
}
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-03-29 16:53:07 +01:00
|
|
|
if ( DPQ_IS_ENDOFLIST( plist->players ) )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
/* NOTE: This only enumerates top level groups (created with CreateGroup) */
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_EnumGroups( IDirectPlay2A *iface, GUID *instance,
|
|
|
|
LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_EnumGroups( &This->IDirectPlay4A_iface, instance, enumplayercb, context,
|
|
|
|
flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_EnumGroups( IDirectPlay2 *iface, GUID *instance,
|
|
|
|
LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_EnumGroups( &This->IDirectPlay4_iface, instance, enumplayercb, context,
|
|
|
|
flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_EnumGroups( IDirectPlay3A *iface, GUID *instance,
|
|
|
|
LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_EnumGroups( &This->IDirectPlay4_iface, instance, enumplayercb, context,
|
|
|
|
flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_EnumGroups( IDirectPlay3 *iface, GUID *instance,
|
|
|
|
LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_EnumGroups( &This->IDirectPlay4_iface, instance, enumplayercb, context,
|
|
|
|
flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:43:37 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_EnumGroups( IDirectPlay4A *iface, GUID *instance,
|
|
|
|
LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:43:37 +01:00
|
|
|
return IDirectPlayX_EnumGroupsInGroup( iface, DPID_SYSTEM_GROUP, instance, enumplayercb,
|
|
|
|
context, flags );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:43:37 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_EnumGroups ( IDirectPlay4 *iface, GUID *instance,
|
|
|
|
LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:43:37 +01:00
|
|
|
return IDirectPlayX_EnumGroupsInGroup( iface, DPID_SYSTEM_GROUP, instance, enumplayercb,
|
|
|
|
context, flags );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_EnumPlayers( IDirectPlay2A *iface, GUID *instance,
|
|
|
|
LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_EnumPlayers( &This->IDirectPlay4A_iface, instance, enumplayercb, context,
|
|
|
|
flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_EnumPlayers( IDirectPlay2 *iface, GUID *instance,
|
|
|
|
LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_EnumPlayers( &This->IDirectPlay4_iface, instance, enumplayercb, context,
|
|
|
|
flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_EnumPlayers( IDirectPlay3A *iface, GUID *instance,
|
|
|
|
LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_EnumPlayers( &This->IDirectPlay4_iface, instance, enumplayercb, context,
|
|
|
|
flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_EnumPlayers( IDirectPlay3 *iface, GUID *instance,
|
|
|
|
LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_EnumPlayers( &This->IDirectPlay4_iface, instance, enumplayercb, context,
|
|
|
|
flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:43:08 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_EnumPlayers( IDirectPlay4A *iface, GUID *instance,
|
|
|
|
LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2013-03-29 16:43:08 +01:00
|
|
|
return IDirectPlayX_EnumGroupPlayers( iface, DPID_SYSTEM_GROUP, instance, enumplayercb,
|
|
|
|
context, flags );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:43:08 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_EnumPlayers( IDirectPlay4 *iface, GUID *instance,
|
|
|
|
LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2013-03-29 16:43:08 +01:00
|
|
|
return IDirectPlayX_EnumGroupPlayers( iface, DPID_SYSTEM_GROUP, instance, enumplayercb,
|
|
|
|
context, flags );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2000-05-23 03:16:36 +02:00
|
|
|
/* This function should call the registered callback function that the user
|
2000-05-27 00:26:30 +02:00
|
|
|
passed into EnumSessions for each entry available.
|
2000-05-23 03:16:36 +02:00
|
|
|
*/
|
2000-08-30 01:55:06 +02:00
|
|
|
static void DP_InvokeEnumSessionCallbacks
|
|
|
|
( LPDPENUMSESSIONSCALLBACK2 lpEnumSessionsCallback2,
|
|
|
|
LPVOID lpNSInfo,
|
|
|
|
DWORD dwTimeout,
|
|
|
|
LPVOID lpContext )
|
2000-03-12 21:18:33 +01:00
|
|
|
{
|
2000-05-27 00:26:30 +02:00
|
|
|
LPDPSESSIONDESC2 lpSessionDesc;
|
|
|
|
|
|
|
|
FIXME( ": not checking for conditions\n" );
|
|
|
|
|
2000-09-27 01:11:48 +02:00
|
|
|
/* Not sure if this should be pruning but it's convenient */
|
|
|
|
NS_PruneSessionCache( lpNSInfo );
|
|
|
|
|
2000-05-27 00:26:30 +02:00
|
|
|
NS_ResetSessionEnumeration( lpNSInfo );
|
|
|
|
|
|
|
|
/* Enumerate all sessions */
|
2000-08-25 23:58:05 +02:00
|
|
|
/* FIXME: Need to indicate ANSI */
|
2000-05-27 00:26:30 +02:00
|
|
|
while( (lpSessionDesc = NS_WalkSessions( lpNSInfo ) ) != NULL )
|
|
|
|
{
|
|
|
|
TRACE( "EnumSessionsCallback2 invoked\n" );
|
|
|
|
if( !lpEnumSessionsCallback2( lpSessionDesc, &dwTimeout, 0, lpContext ) )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Invoke one last time to indicate that there is no more to come */
|
|
|
|
lpEnumSessionsCallback2( NULL, &dwTimeout, DPESC_TIMEDOUT, lpContext );
|
2000-03-12 21:18:33 +01:00
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
static DWORD CALLBACK DP_EnumSessionsSendAsyncRequestThread( LPVOID lpContext )
|
|
|
|
{
|
2009-01-16 09:53:59 +01:00
|
|
|
EnumSessionAsyncCallbackData* data = lpContext;
|
2000-08-25 23:58:05 +02:00
|
|
|
HANDLE hSuicideRequest = data->hSuicideRequest;
|
|
|
|
DWORD dwTimeout = data->dwTimeout;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "Thread started with timeout = 0x%08lx\n", dwTimeout );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
for( ;; )
|
|
|
|
{
|
2000-08-30 01:55:06 +02:00
|
|
|
HRESULT hr;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
/* Sleep up to dwTimeout waiting for request to terminate thread */
|
|
|
|
if( WaitForSingleObject( hSuicideRequest, dwTimeout ) == WAIT_OBJECT_0 )
|
2000-05-27 00:26:30 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
TRACE( "Thread terminating on terminate request\n" );
|
|
|
|
break;
|
2000-05-27 00:26:30 +02:00
|
|
|
}
|
2000-08-30 01:55:06 +02:00
|
|
|
|
|
|
|
/* Now resend the enum request */
|
|
|
|
hr = NS_SendSessionRequestBroadcast( &data->requestGuid,
|
|
|
|
data->dwEnumSessionFlags,
|
|
|
|
data->lpSpData );
|
|
|
|
|
|
|
|
if( FAILED(hr) )
|
|
|
|
{
|
|
|
|
ERR( "Enum broadcase request failed: %s\n", DPLAYX_HresultToString(hr) );
|
|
|
|
/* FIXME: Should we kill this thread? How to inform the main thread? */
|
|
|
|
}
|
|
|
|
|
2000-03-12 21:18:33 +01:00
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
TRACE( "Thread terminating\n" );
|
|
|
|
|
|
|
|
/* Clean up the thread data */
|
|
|
|
CloseHandle( hSuicideRequest );
|
|
|
|
HeapFree( GetProcessHeap(), 0, lpContext );
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
/* FIXME: Need to have some notification to main app thread that this is
|
|
|
|
* dead. It would serve two purposes. 1) allow sync on termination
|
|
|
|
* so that we don't actually send something to ourselves when we
|
|
|
|
* become name server (race condition) and 2) so that if we die
|
|
|
|
* abnormally something else will be able to tell.
|
|
|
|
*/
|
|
|
|
|
2000-05-27 00:26:30 +02:00
|
|
|
return 1;
|
2000-03-12 21:18:33 +01:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static void DP_KillEnumSessionThread( IDirectPlayImpl *This )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
|
|
|
/* Does a thread exist? If so we were doing an async enum session */
|
|
|
|
if( This->dp2->hEnumSessionThread != INVALID_HANDLE_VALUE )
|
|
|
|
{
|
2002-10-24 00:20:46 +02:00
|
|
|
TRACE( "Killing EnumSession thread %p\n",
|
2000-10-19 22:20:58 +02:00
|
|
|
This->dp2->hEnumSessionThread );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
/* Request that the thread kill itself nicely */
|
|
|
|
SetEvent( This->dp2->hKillEnumSessionThreadEvent );
|
|
|
|
CloseHandle( This->dp2->hKillEnumSessionThreadEvent );
|
|
|
|
|
|
|
|
/* We no longer need to know about the thread */
|
|
|
|
CloseHandle( This->dp2->hEnumSessionThread );
|
|
|
|
|
|
|
|
This->dp2->hEnumSessionThread = INVALID_HANDLE_VALUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_EnumSessions( IDirectPlay2A *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD timeout, LPDPENUMSESSIONSCALLBACK2 enumsessioncb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_EnumSessions( &This->IDirectPlay4A_iface, sdesc, timeout, enumsessioncb,
|
|
|
|
context, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_EnumSessions( IDirectPlay2 *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD timeout, LPDPENUMSESSIONSCALLBACK2 enumsessioncb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_EnumSessions( &This->IDirectPlay4_iface, sdesc, timeout, enumsessioncb,
|
|
|
|
context, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_EnumSessions( IDirectPlay3A *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD timeout, LPDPENUMSESSIONSCALLBACK2 enumsessioncb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_EnumSessions( &This->IDirectPlay4_iface, sdesc, timeout, enumsessioncb,
|
|
|
|
context, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_EnumSessions( IDirectPlay3 *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD timeout, LPDPENUMSESSIONSCALLBACK2 enumsessioncb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_EnumSessions( &This->IDirectPlay4_iface, sdesc, timeout, enumsessioncb,
|
|
|
|
context, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:04:20 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_EnumSessions( IDirectPlay4A *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD timeout, LPDPENUMSESSIONSCALLBACK2 enumsessioncb, void *context, DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:04:20 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_EnumSessions( &This->IDirectPlay4_iface, sdesc, timeout, enumsessioncb,
|
|
|
|
context, flags );
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:04:20 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_EnumSessions( IDirectPlay4 *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD timeout, LPDPENUMSESSIONSCALLBACK2 enumsessioncb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
void *connection;
|
|
|
|
DWORD size;
|
|
|
|
HRESULT hr = DP_OK;
|
2000-03-12 21:18:33 +01:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(%p,0x%08lx,%p,%p,0x%08lx)\n", This, sdesc, timeout, enumsessioncb,
|
2013-03-29 17:04:20 +01:00
|
|
|
context, flags );
|
2000-03-12 21:18:33 +01:00
|
|
|
|
2013-03-29 17:04:20 +01:00
|
|
|
if ( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
return DPERR_UNINITIALIZED;
|
2000-03-12 21:18:33 +01:00
|
|
|
|
2013-03-29 17:04:20 +01:00
|
|
|
/* Can't enumerate if the interface is already open */
|
|
|
|
if ( This->dp2->bConnectionOpen )
|
|
|
|
return DPERR_GENERIC;
|
2000-03-12 21:18:33 +01:00
|
|
|
|
2013-03-29 17:04:20 +01:00
|
|
|
/* The loading of a lobby provider _seems_ to require a backdoor loading
|
|
|
|
* of the service provider to also associate with this DP object. This is
|
|
|
|
* because the app doesn't seem to have to call EnumConnections and
|
|
|
|
* InitializeConnection for the SP before calling this method. As such
|
|
|
|
* we'll do their dirty work for them with a quick hack so as to always
|
|
|
|
* load the TCP/IP service provider.
|
|
|
|
*
|
|
|
|
* The correct solution would seem to involve creating a dialog box which
|
|
|
|
* contains the possible SPs. These dialog boxes most likely follow SDK
|
|
|
|
* examples.
|
|
|
|
*/
|
|
|
|
if ( This->dp2->bDPLSPInitialized && !This->dp2->bSPInitialized )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 17:04:20 +01:00
|
|
|
WARN( "Hack providing TCP/IP SP for lobby provider activated\n" );
|
2000-08-30 01:55:06 +02:00
|
|
|
|
2013-03-29 17:04:20 +01:00
|
|
|
if ( !DP_BuildSPCompoundAddr( (GUID*)&DPSPGUID_TCPIP, &connection, &size ) )
|
2000-08-30 01:55:06 +02:00
|
|
|
{
|
2013-03-29 17:04:20 +01:00
|
|
|
ERR( "Can't build compound addr\n" );
|
|
|
|
return DPERR_GENERIC;
|
2000-08-30 01:55:06 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2013-03-29 17:04:20 +01:00
|
|
|
hr = IDirectPlayX_InitializeConnection( &This->IDirectPlay4_iface, connection, 0 );
|
|
|
|
if ( FAILED(hr) )
|
|
|
|
return hr;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2013-03-29 17:04:20 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, connection );
|
|
|
|
This->dp2->bSPInitialized = TRUE;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
|
2013-03-29 17:04:20 +01:00
|
|
|
/* Use the service provider default? */
|
|
|
|
if ( !timeout )
|
|
|
|
{
|
|
|
|
DPCAPS caps;
|
|
|
|
caps.dwSize = sizeof( caps );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:04:20 +01:00
|
|
|
IDirectPlayX_GetCaps( &This->IDirectPlay4_iface, &caps, 0 );
|
|
|
|
timeout = caps.dwTimeout;
|
|
|
|
if ( !timeout )
|
|
|
|
timeout = DPMSG_WAIT_5_SECS; /* Provide the TCP/IP default */
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:04:20 +01:00
|
|
|
if ( flags & DPENUMSESSIONS_STOPASYNC )
|
|
|
|
{
|
|
|
|
DP_KillEnumSessionThread( This );
|
|
|
|
return hr;
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:04:20 +01:00
|
|
|
if ( flags & DPENUMSESSIONS_ASYNC )
|
|
|
|
{
|
|
|
|
/* Enumerate everything presently in the local session cache */
|
|
|
|
DP_InvokeEnumSessionCallbacks( enumsessioncb, This->dp2->lpNameServerData, timeout,
|
|
|
|
context );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:04:20 +01:00
|
|
|
if ( This->dp2->dwEnumSessionLock )
|
|
|
|
return DPERR_CONNECTING;
|
2000-08-30 01:55:06 +02:00
|
|
|
|
2013-03-29 17:04:20 +01:00
|
|
|
/* See if we've already created a thread to service this interface */
|
|
|
|
if ( This->dp2->hEnumSessionThread == INVALID_HANDLE_VALUE )
|
|
|
|
{
|
|
|
|
DWORD tid;
|
|
|
|
This->dp2->dwEnumSessionLock++;
|
|
|
|
|
|
|
|
/* Send the first enum request inline since the user may cancel a dialog
|
|
|
|
* if one is presented. Also, may also have a connecting return code.
|
|
|
|
*/
|
|
|
|
hr = NS_SendSessionRequestBroadcast( &sdesc->guidApplication, flags,
|
|
|
|
&This->dp2->spData );
|
|
|
|
|
|
|
|
if ( SUCCEEDED(hr) )
|
|
|
|
{
|
|
|
|
EnumSessionAsyncCallbackData* data = HeapAlloc( GetProcessHeap(),
|
|
|
|
HEAP_ZERO_MEMORY, sizeof( *data ) );
|
|
|
|
/* FIXME: need to kill the thread on object deletion */
|
|
|
|
data->lpSpData = &This->dp2->spData;
|
|
|
|
data->requestGuid = sdesc->guidApplication;
|
|
|
|
data->dwEnumSessionFlags = flags;
|
|
|
|
data->dwTimeout = timeout;
|
|
|
|
|
|
|
|
This->dp2->hKillEnumSessionThreadEvent = CreateEventW( NULL, TRUE, FALSE, NULL );
|
|
|
|
if ( !DuplicateHandle( GetCurrentProcess(), This->dp2->hKillEnumSessionThreadEvent,
|
|
|
|
GetCurrentProcess(), &data->hSuicideRequest, 0, FALSE,
|
|
|
|
DUPLICATE_SAME_ACCESS ) )
|
|
|
|
ERR( "Can't duplicate thread killing handle\n" );
|
|
|
|
|
|
|
|
TRACE( ": creating EnumSessionsRequest thread\n" );
|
|
|
|
This->dp2->hEnumSessionThread = CreateThread( NULL, 0,
|
|
|
|
DP_EnumSessionsSendAsyncRequestThread, data, 0, &tid );
|
|
|
|
}
|
|
|
|
This->dp2->dwEnumSessionLock--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Invalidate the session cache for the interface */
|
|
|
|
NS_InvalidateSessionCache( This->dp2->lpNameServerData );
|
|
|
|
/* Send the broadcast for session enumeration */
|
|
|
|
hr = NS_SendSessionRequestBroadcast( &sdesc->guidApplication, flags, &This->dp2->spData );
|
|
|
|
SleepEx( timeout, FALSE );
|
|
|
|
DP_InvokeEnumSessionCallbacks( enumsessioncb, This->dp2->lpNameServerData, timeout,
|
|
|
|
context );
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_GetCaps( IDirectPlay2A *iface, DPCAPS *caps, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_GetCaps( &This->IDirectPlay4A_iface, caps, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_GetCaps( IDirectPlay2 *iface, DPCAPS *caps, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_GetCaps( &This->IDirectPlay4_iface, caps, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_GetCaps( IDirectPlay3A *iface, DPCAPS *caps, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_GetCaps( &This->IDirectPlay4_iface, caps, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_GetCaps( IDirectPlay3 *iface, DPCAPS *caps, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_GetCaps( &This->IDirectPlay4_iface, caps, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:54:37 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetCaps( IDirectPlay4A *iface, DPCAPS *caps, DWORD flags )
|
2000-08-30 01:55:06 +02:00
|
|
|
{
|
2013-03-29 16:54:37 +01:00
|
|
|
return IDirectPlayX_GetPlayerCaps( iface, DPID_ALLPLAYERS, caps, flags );
|
2000-08-30 01:55:06 +02:00
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:54:37 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetCaps( IDirectPlay4 *iface, DPCAPS *caps, DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:54:37 +01:00
|
|
|
return IDirectPlayX_GetPlayerCaps( iface, DPID_ALLPLAYERS, caps, flags );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_GetGroupData( IDirectPlay2A *iface, DPID group, void *data,
|
|
|
|
DWORD *size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_GetGroupData( &This->IDirectPlay4A_iface, group, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_GetGroupData( IDirectPlay2 *iface, DPID group, void *data,
|
|
|
|
DWORD *size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_GetGroupData( &This->IDirectPlay4_iface, group, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_GetGroupData( IDirectPlay3A *iface, DPID group, void *data,
|
|
|
|
DWORD *size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_GetGroupData( &This->IDirectPlay4_iface, group, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_GetGroupData( IDirectPlay3 *iface, DPID group, void *data,
|
|
|
|
DWORD *size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_GetGroupData( &This->IDirectPlay4_iface, group, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:54:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetGroupData( IDirectPlay4A *iface, DPID group,
|
|
|
|
void *data, DWORD *size, DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:54:00 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_GetGroupData( &This->IDirectPlay4_iface, group, data, size, flags );
|
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:54:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetGroupData( IDirectPlay4 *iface, DPID group,
|
|
|
|
void *data, DWORD *size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
lpGroupData gdata;
|
|
|
|
DWORD bufsize;
|
|
|
|
void *src;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx,%p,%p,0x%08lx)\n", This, group, data, size, flags );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:54:00 +01:00
|
|
|
if ( ( gdata = DP_FindAnyGroup( This, group ) ) == NULL )
|
|
|
|
return DPERR_INVALIDGROUP;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:54:00 +01:00
|
|
|
/* How much buffer is required? */
|
|
|
|
if ( flags & DPSET_LOCAL )
|
|
|
|
{
|
|
|
|
bufsize = gdata->dwLocalDataSize;
|
|
|
|
src = gdata->lpLocalData;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bufsize = gdata->dwRemoteDataSize;
|
|
|
|
src = gdata->lpRemoteData;
|
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:54:00 +01:00
|
|
|
/* Is the user requesting to know how big a buffer is required? */
|
|
|
|
if ( !data || *size < bufsize )
|
|
|
|
{
|
|
|
|
*size = bufsize;
|
|
|
|
return DPERR_BUFFERTOOSMALL;
|
|
|
|
}
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-03-29 16:54:00 +01:00
|
|
|
CopyMemory( data, src, bufsize );
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2013-03-29 16:54:00 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_IF_GetGroupName( IDirectPlayImpl *This, DPID idGroup, void *lpData,
|
|
|
|
DWORD *lpdwDataSize, BOOL bAnsi )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
lpGroupData lpGData;
|
2009-01-16 09:53:59 +01:00
|
|
|
LPDPNAME lpName = lpData;
|
2000-06-07 05:44:36 +02:00
|
|
|
DWORD dwRequiredDataSize;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME("(%p)->(0x%08lx,%p,%p,%u) ANSI ignored\n",
|
2000-07-10 15:19:28 +02:00
|
|
|
This, idGroup, lpData, lpdwDataSize, bAnsi );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( ( lpGData = DP_FindAnyGroup( This, idGroup ) ) == NULL )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
|
|
|
return DPERR_INVALIDGROUP;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
dwRequiredDataSize = lpGData->name.dwSize;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpGData->name.u1.lpszShortNameA )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
dwRequiredDataSize += strlen( lpGData->name.u1.lpszShortNameA ) + 1;
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpGData->name.u2.lpszLongNameA )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
dwRequiredDataSize += strlen( lpGData->name.u2.lpszLongNameA ) + 1;
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
if( ( lpData == NULL ) ||
|
|
|
|
( *lpdwDataSize < dwRequiredDataSize )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
*lpdwDataSize = dwRequiredDataSize;
|
|
|
|
return DPERR_BUFFERTOOSMALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy the structure */
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( lpName, &lpGData->name, lpGData->name.dwSize );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpGData->name.u1.lpszShortNameA )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
2005-08-30 10:56:35 +02:00
|
|
|
strcpy( ((char*)lpName)+lpGData->name.dwSize,
|
2000-12-03 04:16:05 +01:00
|
|
|
lpGData->name.u1.lpszShortNameA );
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
lpName->u1.lpszShortNameA = NULL;
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpGData->name.u1.lpszShortNameA )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
2005-08-30 10:56:35 +02:00
|
|
|
strcpy( ((char*)lpName)+lpGData->name.dwSize,
|
2019-10-20 12:26:56 +02:00
|
|
|
lpGData->name.u1.lpszShortNameA );
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
lpName->u2.lpszLongNameA = NULL;
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_GetGroupName( IDirectPlay2A *iface, DPID group, void *data,
|
|
|
|
DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_GetGroupName( &This->IDirectPlay4A_iface, group, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_GetGroupName( IDirectPlay2 *iface, DPID group, void *data,
|
|
|
|
DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_GetGroupName( &This->IDirectPlay4_iface, group, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_GetGroupName( IDirectPlay3A *iface, DPID group, void *data,
|
|
|
|
DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_GetGroupName( &This->IDirectPlay4_iface, group, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_GetGroupName( IDirectPlay3 *iface, DPID group, void *data,
|
|
|
|
DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_GetGroupName( &This->IDirectPlay4_iface, group, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetGroupName( IDirectPlay4A *iface, DPID idGroup,
|
|
|
|
void *lpData, DWORD *lpdwDataSize )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return DP_IF_GetGroupName( This, idGroup, lpData, lpdwDataSize, TRUE );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetGroupName( IDirectPlay4 *iface, DPID idGroup,
|
|
|
|
void *lpData, DWORD *lpdwDataSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
return DP_IF_GetGroupName( This, idGroup, lpData, lpdwDataSize, FALSE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_GetMessageCount( IDirectPlay2A *iface, DPID player,
|
|
|
|
DWORD *count )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_GetMessageCount( &This->IDirectPlay4A_iface, player, count );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_GetMessageCount( IDirectPlay2 *iface, DPID player,
|
|
|
|
DWORD *count )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_GetMessageCount( &This->IDirectPlay4_iface, player, count );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_GetMessageCount( IDirectPlay3A *iface, DPID player,
|
|
|
|
DWORD *count )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_GetMessageCount( &This->IDirectPlay4_iface, player, count );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_GetMessageCount( IDirectPlay3 *iface, DPID player,
|
|
|
|
DWORD *count )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_GetMessageCount( &This->IDirectPlay4_iface, player, count );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:41:22 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetMessageCount( IDirectPlay4A *iface, DPID player,
|
|
|
|
DWORD *count )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 16:41:22 +01:00
|
|
|
return IDirectPlayX_GetMessageQueue( iface, 0, player, DPMESSAGEQUEUE_RECEIVE, count, NULL );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:41:22 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetMessageCount( IDirectPlay4 *iface, DPID player,
|
|
|
|
DWORD *count )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:41:22 +01:00
|
|
|
return IDirectPlayX_GetMessageQueue( iface, 0, player, DPMESSAGEQUEUE_RECEIVE, count, NULL );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_GetPlayerAddress( IDirectPlay2A *iface, DPID player,
|
|
|
|
void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_GetPlayerAddress( &This->IDirectPlay4A_iface, player, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_GetPlayerAddress( IDirectPlay2 *iface, DPID player,
|
|
|
|
void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_GetPlayerAddress( &This->IDirectPlay4_iface, player, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_GetPlayerAddress( IDirectPlay3A *iface, DPID player,
|
|
|
|
void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_GetPlayerAddress( &This->IDirectPlay4_iface, player, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_GetPlayerAddress( IDirectPlay3 *iface, DPID player,
|
|
|
|
void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_GetPlayerAddress( &This->IDirectPlay4_iface, player, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetPlayerAddress( IDirectPlay4A *iface, DPID player,
|
|
|
|
void *data, DWORD *size )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME("(%p)->(0x%08lx,%p,%p): stub\n", This, player, data, size );
|
2013-03-29 16:44:15 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:51:46 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetPlayerAddress( IDirectPlay4 *iface, DPID player,
|
|
|
|
void *data, DWORD *size )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p,%p): stub\n", This, player, data, size );
|
2013-03-29 16:51:46 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_GetPlayerCaps( IDirectPlay2A *iface, DPID player,
|
|
|
|
DPCAPS *caps, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_GetPlayerCaps( &This->IDirectPlay4A_iface, player, caps, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_GetPlayerCaps( IDirectPlay2 *iface, DPID player,
|
|
|
|
DPCAPS *caps, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_GetPlayerCaps( &This->IDirectPlay4_iface, player, caps, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_GetPlayerCaps( IDirectPlay3A *iface, DPID player,
|
|
|
|
DPCAPS *caps, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_GetPlayerCaps( &This->IDirectPlay4_iface, player, caps, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_GetPlayerCaps( IDirectPlay3 *iface, DPID player,
|
|
|
|
DPCAPS *caps, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_GetPlayerCaps( &This->IDirectPlay4_iface, player, caps, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:55:04 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetPlayerCaps( IDirectPlay4A *iface, DPID player,
|
|
|
|
DPCAPS *caps, DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:55:04 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_GetPlayerCaps( &This->IDirectPlay4_iface, player, caps, flags );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:55:04 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetPlayerCaps( IDirectPlay4 *iface, DPID player,
|
|
|
|
DPCAPS *caps, DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:55:04 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
DPSP_GETCAPSDATA data;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx,%p,0x%08lx)\n", This, player, caps, flags);
|
2013-03-29 16:55:04 +01:00
|
|
|
|
2017-03-01 00:17:17 +01:00
|
|
|
if ( !caps )
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
|
2013-03-29 16:55:04 +01:00
|
|
|
if ( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
return DPERR_UNINITIALIZED;
|
|
|
|
|
2017-03-01 00:17:17 +01:00
|
|
|
if( caps->dwSize != sizeof(DPCAPS) )
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
|
2013-03-29 16:55:04 +01:00
|
|
|
/* Query the service provider */
|
|
|
|
data.idPlayer = player;
|
|
|
|
data.dwFlags = flags;
|
|
|
|
data.lpCaps = caps;
|
|
|
|
data.lpISP = This->dp2->spData.lpISP;
|
|
|
|
|
|
|
|
return (*This->dp2->spData.lpCB->GetCaps)( &data );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_GetPlayerData( IDirectPlay2A *iface, DPID player,
|
|
|
|
void *data, DWORD *size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_GetPlayerData( &This->IDirectPlay4A_iface, player, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_GetPlayerData( IDirectPlay2 *iface, DPID player,
|
|
|
|
void *data, DWORD *size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_GetPlayerData( &This->IDirectPlay4_iface, player, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_GetPlayerData( IDirectPlay3A *iface, DPID player,
|
|
|
|
void *data, DWORD *size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_GetPlayerData( &This->IDirectPlay4_iface, player, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_GetPlayerData( IDirectPlay3 *iface, DPID player,
|
|
|
|
void *data, DWORD *size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_GetPlayerData( &This->IDirectPlay4_iface, player, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:55:48 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetPlayerData( IDirectPlay4A *iface, DPID player,
|
|
|
|
void *data, DWORD *size, DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:55:48 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_GetPlayerData( &This->IDirectPlay4_iface, player, data, size, flags );
|
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:55:48 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetPlayerData( IDirectPlay4 *iface, DPID player,
|
|
|
|
void *data, DWORD *size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
lpPlayerList plist;
|
|
|
|
DWORD bufsize;
|
|
|
|
void *src;
|
2003-12-30 22:50:56 +01:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx,%p,%p,0x%08lx)\n", This, player, data, size, flags );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:55:48 +01:00
|
|
|
if ( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
return DPERR_UNINITIALIZED;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:55:48 +01:00
|
|
|
if ( ( plist = DP_FindPlayer( This, player ) ) == NULL )
|
|
|
|
return DPERR_INVALIDPLAYER;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:55:48 +01:00
|
|
|
if ( flags & DPSET_LOCAL )
|
|
|
|
{
|
|
|
|
bufsize = plist->lpPData->dwLocalDataSize;
|
|
|
|
src = plist->lpPData->lpLocalData;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bufsize = plist->lpPData->dwRemoteDataSize;
|
|
|
|
src = plist->lpPData->lpRemoteData;
|
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:55:48 +01:00
|
|
|
/* Is the user requesting to know how big a buffer is required? */
|
|
|
|
if ( !data || *size < bufsize )
|
|
|
|
{
|
|
|
|
*size = bufsize;
|
|
|
|
return DPERR_BUFFERTOOSMALL;
|
|
|
|
}
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-03-29 16:55:48 +01:00
|
|
|
CopyMemory( data, src, bufsize );
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2013-03-29 16:55:48 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_IF_GetPlayerName( IDirectPlayImpl *This, DPID idPlayer, void *lpData,
|
|
|
|
DWORD *lpdwDataSize, BOOL bAnsi )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-06-07 05:44:36 +02:00
|
|
|
lpPlayerList lpPList;
|
2009-01-16 09:53:59 +01:00
|
|
|
LPDPNAME lpName = lpData;
|
2000-06-07 05:44:36 +02:00
|
|
|
DWORD dwRequiredDataSize;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p,%p,%u): ANSI\n",
|
2000-07-10 15:19:28 +02:00
|
|
|
This, idPlayer, lpData, lpdwDataSize, bAnsi );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2008-08-02 21:52:12 +02:00
|
|
|
if( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
{
|
|
|
|
return DPERR_UNINITIALIZED;
|
|
|
|
}
|
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
if( ( lpPList = DP_FindPlayer( This, idPlayer ) ) == NULL )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPLAYER;
|
|
|
|
}
|
|
|
|
|
|
|
|
dwRequiredDataSize = lpPList->lpPData->name.dwSize;
|
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpPList->lpPData->name.u1.lpszShortNameA )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
dwRequiredDataSize += strlen( lpPList->lpPData->name.u1.lpszShortNameA ) + 1;
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpPList->lpPData->name.u2.lpszLongNameA )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
dwRequiredDataSize += strlen( lpPList->lpPData->name.u2.lpszLongNameA ) + 1;
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if( ( lpData == NULL ) ||
|
|
|
|
( *lpdwDataSize < dwRequiredDataSize )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
*lpdwDataSize = dwRequiredDataSize;
|
|
|
|
return DPERR_BUFFERTOOSMALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy the structure */
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( lpName, &lpPList->lpPData->name, lpPList->lpPData->name.dwSize );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpPList->lpPData->name.u1.lpszShortNameA )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
2005-08-30 10:56:35 +02:00
|
|
|
strcpy( ((char*)lpName)+lpPList->lpPData->name.dwSize,
|
2000-12-03 04:16:05 +01:00
|
|
|
lpPList->lpPData->name.u1.lpszShortNameA );
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
lpName->u1.lpszShortNameA = NULL;
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpPList->lpPData->name.u1.lpszShortNameA )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
2005-08-30 10:56:35 +02:00
|
|
|
strcpy( ((char*)lpName)+lpPList->lpPData->name.dwSize,
|
2000-12-03 04:16:05 +01:00
|
|
|
lpPList->lpPData->name.u2.lpszLongNameA );
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
lpName->u2.lpszLongNameA = NULL;
|
2000-06-07 05:44:36 +02:00
|
|
|
}
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_GetPlayerName( IDirectPlay2A *iface, DPID player,
|
|
|
|
void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_GetPlayerName( &This->IDirectPlay4A_iface, player, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_GetPlayerName( IDirectPlay2 *iface, DPID player,
|
|
|
|
void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_GetPlayerName( &This->IDirectPlay4_iface, player, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_GetPlayerName( IDirectPlay3A *iface, DPID player,
|
|
|
|
void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_GetPlayerName( &This->IDirectPlay4_iface, player, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_GetPlayerName( IDirectPlay3 *iface, DPID player,
|
|
|
|
void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_GetPlayerName( &This->IDirectPlay4_iface, player, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetPlayerName( IDirectPlay4A *iface, DPID idPlayer,
|
|
|
|
void *lpData, DWORD *lpdwDataSize )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return DP_IF_GetPlayerName( This, idPlayer, lpData, lpdwDataSize, TRUE );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetPlayerName( IDirectPlay4 *iface, DPID idPlayer,
|
|
|
|
void *lpData, DWORD *lpdwDataSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
return DP_IF_GetPlayerName( This, idPlayer, lpData, lpdwDataSize, FALSE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_GetSessionDesc( IDirectPlayImpl *This, void *lpData, DWORD *lpdwDataSize,
|
|
|
|
BOOL bAnsi )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
|
|
|
DWORD dwRequiredSize;
|
|
|
|
|
|
|
|
TRACE( "(%p)->(%p,%p,%u)\n", This, lpData, lpdwDataSize, bAnsi );
|
|
|
|
|
2003-12-30 22:50:56 +01:00
|
|
|
if( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
{
|
|
|
|
return DPERR_UNINITIALIZED;
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if( ( lpData == NULL ) && ( lpdwDataSize == NULL ) )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Get from This->dp2->lpSessionDesc */
|
|
|
|
dwRequiredSize = DP_CalcSessionDescSize( This->dp2->lpSessionDesc, bAnsi );
|
|
|
|
|
|
|
|
if ( ( lpData == NULL ) ||
|
|
|
|
( *lpdwDataSize < dwRequiredSize )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
*lpdwDataSize = dwRequiredSize;
|
|
|
|
return DPERR_BUFFERTOOSMALL;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
DP_CopySessionDesc( lpData, This->dp2->lpSessionDesc, bAnsi );
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
return DP_OK;
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_GetSessionDesc( IDirectPlay2A *iface, void *data,
|
|
|
|
DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_GetSessionDesc( &This->IDirectPlay4A_iface, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_GetSessionDesc( IDirectPlay2 *iface, void *data,
|
|
|
|
DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_GetSessionDesc( &This->IDirectPlay4_iface, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_GetSessionDesc( IDirectPlay3A *iface, void *data,
|
|
|
|
DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_GetSessionDesc( &This->IDirectPlay4_iface, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_GetSessionDesc( IDirectPlay3 *iface, void *data,
|
|
|
|
DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_GetSessionDesc( &This->IDirectPlay4_iface, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetSessionDesc( IDirectPlay4A *iface, void *lpData,
|
|
|
|
DWORD *lpdwDataSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return DP_GetSessionDesc( This, lpData, lpdwDataSize, TRUE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetSessionDesc( IDirectPlay4 *iface, void *lpData,
|
|
|
|
DWORD *lpdwDataSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
return DP_GetSessionDesc( This, lpData, lpdwDataSize, TRUE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_Initialize( IDirectPlay2A *iface, GUID *guid )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_Initialize( &This->IDirectPlay4A_iface, guid );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_Initialize( IDirectPlay2 *iface, GUID *guid )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_Initialize( &This->IDirectPlay4_iface, guid );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_Initialize( IDirectPlay3A *iface, GUID *guid )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_Initialize( &This->IDirectPlay4_iface, guid );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_Initialize( IDirectPlay3 *iface, GUID *guid )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_Initialize( &This->IDirectPlay4_iface, guid );
|
|
|
|
}
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
/* Intended only for COM compatibility. Always returns an error. */
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_Initialize( IDirectPlay4A *iface, GUID *guid )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
2013-03-29 16:44:15 +01:00
|
|
|
TRACE("(%p)->(%p): no-op\n", This, guid );
|
|
|
|
return DPERR_ALREADYINITIALIZED;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:51:46 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_Initialize( IDirectPlay4 *iface, GUID *guid )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
TRACE( "(%p)->(%p): no-op\n", This, guid );
|
|
|
|
return DPERR_ALREADYINITIALIZED;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_SecureOpen( IDirectPlayImpl *This, const DPSESSIONDESC2 *lpsd, DWORD dwFlags,
|
|
|
|
const DPSECURITYDESC *lpSecurity, const DPCREDENTIALS *lpCredentials, BOOL bAnsi )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
HRESULT hr = DP_OK;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(%p,0x%08lx,%p,%p): partial stub\n",
|
2000-07-10 15:19:28 +02:00
|
|
|
This, lpsd, dwFlags, lpSecurity, lpCredentials );
|
2000-03-12 21:18:33 +01:00
|
|
|
|
2008-08-02 21:52:10 +02:00
|
|
|
if( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
{
|
|
|
|
return DPERR_UNINITIALIZED;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( lpsd->dwSize != sizeof(DPSESSIONDESC2) )
|
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( ": rejecting invalid dpsd size (%ld).\n", lpsd->dwSize );
|
2008-08-02 21:52:10 +02:00
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
2000-03-12 21:18:33 +01:00
|
|
|
if( This->dp2->bConnectionOpen )
|
|
|
|
{
|
|
|
|
TRACE( ": rejecting already open connection.\n" );
|
|
|
|
return DPERR_ALREADYINITIALIZED;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* If we're enumerating, kill the thread */
|
|
|
|
DP_KillEnumSessionThread( This );
|
2000-03-12 21:18:33 +01:00
|
|
|
|
|
|
|
if( dwFlags & DPOPEN_CREATE )
|
|
|
|
{
|
|
|
|
/* Rightoo - this computer is the host and the local computer needs to be
|
|
|
|
the name server so that others can join this session */
|
2001-04-12 23:10:54 +02:00
|
|
|
NS_SetLocalComputerAsNameServer( lpsd, This->dp2->lpNameServerData );
|
2000-03-12 21:18:33 +01:00
|
|
|
|
2000-05-30 22:08:32 +02:00
|
|
|
This->dp2->bHostInterface = TRUE;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
hr = DP_SetSessionDesc( This, lpsd, 0, TRUE, bAnsi );
|
|
|
|
if( FAILED( hr ) )
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
ERR( "Unable to set session desc: %s\n", DPLAYX_HresultToString( hr ) );
|
2000-08-25 23:58:05 +02:00
|
|
|
return hr;
|
|
|
|
}
|
2000-03-12 21:18:33 +01:00
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Invoke the conditional callback for the service provider */
|
|
|
|
if( This->dp2->spData.lpCB->Open )
|
|
|
|
{
|
|
|
|
DPSP_OPENDATA data;
|
|
|
|
|
|
|
|
FIXME( "Not all data fields are correct. Need new parameter\n" );
|
|
|
|
|
2012-08-27 13:23:37 +02:00
|
|
|
data.bCreate = (dwFlags & DPOPEN_CREATE ) != 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
data.lpSPMessageHeader = (dwFlags & DPOPEN_CREATE ) ? NULL
|
2000-08-25 23:58:05 +02:00
|
|
|
: NS_GetNSAddr( This->dp2->lpNameServerData );
|
|
|
|
data.lpISP = This->dp2->spData.lpISP;
|
2012-08-27 13:23:37 +02:00
|
|
|
data.bReturnStatus = (dwFlags & DPOPEN_RETURNSTATUS) != 0;
|
2000-08-25 23:58:05 +02:00
|
|
|
data.dwOpenFlags = dwFlags;
|
|
|
|
data.dwSessionFlags = This->dp2->lpSessionDesc->dwFlags;
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
hr = (*This->dp2->spData.lpCB->Open)(&data);
|
|
|
|
if( FAILED( hr ) )
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
ERR( "Unable to open session: %s\n", DPLAYX_HresultToString( hr ) );
|
2000-08-30 01:55:06 +02:00
|
|
|
return hr;
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
2000-08-30 01:55:06 +02:00
|
|
|
|
2000-03-12 21:18:33 +01:00
|
|
|
{
|
2000-08-30 01:55:06 +02:00
|
|
|
/* Create the system group of which everything is a part of */
|
2000-08-25 23:58:05 +02:00
|
|
|
DPID systemGroup = DPID_SYSTEM_GROUP;
|
|
|
|
|
|
|
|
hr = DP_IF_CreateGroup( This, NULL, &systemGroup, NULL,
|
|
|
|
NULL, 0, 0, TRUE );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-03-12 21:18:33 +01:00
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( dwFlags & DPOPEN_JOIN )
|
|
|
|
{
|
2000-09-27 01:11:48 +02:00
|
|
|
DPID dpidServerId = DPID_UNKNOWN;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Create the server player for this interface. This way we can receive
|
|
|
|
* messages for this session.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
/* FIXME: I suppose that we should be setting an event for a receive
|
2000-08-25 23:58:05 +02:00
|
|
|
* type of thing. That way the messaging thread could know to wake
|
|
|
|
* up. DPlay would then trigger the hEvent for the player the
|
|
|
|
* message is directed to.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
hr = DP_IF_CreatePlayer( This, NULL, &dpidServerId, NULL, 0, NULL,
|
|
|
|
0,
|
2000-08-30 01:55:06 +02:00
|
|
|
DPPLAYER_SERVERPLAYER | DPPLAYER_LOCAL , bAnsi );
|
2000-10-19 22:20:58 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
else if( dwFlags & DPOPEN_CREATE )
|
|
|
|
{
|
|
|
|
DPID dpidNameServerId = DPID_NAME_SERVER;
|
|
|
|
|
|
|
|
hr = DP_IF_CreatePlayer( This, NULL, &dpidNameServerId, NULL, 0, NULL,
|
|
|
|
0, DPPLAYER_SERVERPLAYER, bAnsi );
|
|
|
|
}
|
|
|
|
|
2000-09-27 01:11:48 +02:00
|
|
|
if( FAILED(hr) )
|
|
|
|
{
|
|
|
|
ERR( "Couldn't create name server/system player: %s\n",
|
|
|
|
DPLAYX_HresultToString(hr) );
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_Open( IDirectPlay2A *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_Open( &This->IDirectPlay4A_iface, sdesc, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_Open( IDirectPlay2 *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_Open( &This->IDirectPlay4_iface, sdesc, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_Open( IDirectPlay3A *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_Open( &This->IDirectPlay4_iface, sdesc, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_Open( IDirectPlay3 *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_Open( &This->IDirectPlay4_iface, sdesc, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:40:40 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_Open( IDirectPlay4A *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD flags )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2013-03-29 16:40:40 +01:00
|
|
|
return IDirectPlayX_SecureOpen( iface, sdesc, flags, NULL, NULL );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:40:40 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_Open( IDirectPlay4 *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:40:40 +01:00
|
|
|
return IDirectPlayX_SecureOpen( iface, sdesc, flags, NULL, NULL );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_IF_Receive( IDirectPlayImpl *This, DPID *lpidFrom, DPID *lpidTo, DWORD dwFlags,
|
|
|
|
void *lpData, DWORD *lpdwDataSize, BOOL bAnsi )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
|
|
|
LPDPMSG lpMsg = NULL;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(%p,%p,0x%08lx,%p,%p,%u): stub\n",
|
2000-08-25 23:58:05 +02:00
|
|
|
This, lpidFrom, lpidTo, dwFlags, lpData, lpdwDataSize, bAnsi );
|
|
|
|
|
2003-12-30 22:50:56 +01:00
|
|
|
if( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
{
|
|
|
|
return DPERR_UNINITIALIZED;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( dwFlags == 0 )
|
|
|
|
{
|
|
|
|
dwFlags = DPRECEIVE_ALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If the lpData is NULL, we must be peeking the message */
|
|
|
|
if( ( lpData == NULL ) &&
|
|
|
|
!( dwFlags & DPRECEIVE_PEEK )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( dwFlags & DPRECEIVE_ALL )
|
|
|
|
{
|
|
|
|
lpMsg = This->dp2->receiveMsgs.lpQHFirst;
|
|
|
|
|
|
|
|
if( !( dwFlags & DPRECEIVE_PEEK ) )
|
|
|
|
{
|
|
|
|
FIXME( "Remove from queue\n" );
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
else if( ( dwFlags & DPRECEIVE_TOPLAYER ) ||
|
|
|
|
( dwFlags & DPRECEIVE_FROMPLAYER )
|
|
|
|
)
|
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "Find matching message 0x%08lx\n", dwFlags );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
ERR( "Hmmm..dwFlags 0x%08lx\n", dwFlags );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if( lpMsg == NULL )
|
|
|
|
{
|
|
|
|
return DPERR_NOMESSAGES;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy into the provided buffer */
|
2008-09-10 11:20:09 +02:00
|
|
|
if (lpData) CopyMemory( lpData, lpMsg->msg, *lpdwDataSize );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_Receive( IDirectPlay2A *iface, DPID *from, DPID *to,
|
|
|
|
DWORD flags, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_Receive( &This->IDirectPlay4A_iface, from, to, flags, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_Receive( IDirectPlay2 *iface, DPID *from, DPID *to,
|
|
|
|
DWORD flags, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_Receive( &This->IDirectPlay4_iface, from, to, flags, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_Receive( IDirectPlay3A *iface, DPID *from, DPID *to,
|
|
|
|
DWORD flags, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_Receive( &This->IDirectPlay4_iface, from, to, flags, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_Receive( IDirectPlay3 *iface, DPID *from, DPID *to,
|
|
|
|
DWORD flags, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_Receive( &This->IDirectPlay4_iface, from, to, flags, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_Receive( IDirectPlay4A *iface, DPID *lpidFrom,
|
|
|
|
DPID *lpidTo, DWORD dwFlags, void *lpData, DWORD *lpdwDataSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return DP_IF_Receive( This, lpidFrom, lpidTo, dwFlags, lpData, lpdwDataSize, TRUE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_Receive( IDirectPlay4 *iface, DPID *lpidFrom,
|
|
|
|
DPID *lpidTo, DWORD dwFlags, void *lpData, DWORD *lpdwDataSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
return DP_IF_Receive( This, lpidFrom, lpidTo, dwFlags, lpData, lpdwDataSize, FALSE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_Send( IDirectPlay2A *iface, DPID from, DPID to,
|
|
|
|
DWORD flags, void *data, DWORD size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_Send( &This->IDirectPlay4A_iface, from, to, flags, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_Send( IDirectPlay2 *iface, DPID from, DPID to,
|
|
|
|
DWORD flags, void *data, DWORD size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_Send( &This->IDirectPlay4_iface, from, to, flags, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_Send( IDirectPlay3A *iface, DPID from, DPID to,
|
|
|
|
DWORD flags, void *data, DWORD size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_Send( &This->IDirectPlay4_iface, from, to, flags, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_Send( IDirectPlay3 *iface, DPID from, DPID to,
|
|
|
|
DWORD flags, void *data, DWORD size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_Send( &This->IDirectPlay4_iface, from, to, flags, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:41:53 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_Send( IDirectPlay4A *iface, DPID from, DPID to,
|
|
|
|
DWORD flags, void *data, DWORD size )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:41:53 +01:00
|
|
|
return IDirectPlayX_SendEx( iface, from, to, flags, data, size, 0, 0, NULL, NULL );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:41:53 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_Send( IDirectPlay4 *iface, DPID from, DPID to,
|
|
|
|
DWORD flags, void *data, DWORD size )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:41:53 +01:00
|
|
|
return IDirectPlayX_SendEx( iface, from, to, flags, data, size, 0, 0, NULL, NULL );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_SetGroupData( IDirectPlay2A *iface, DPID group, void *data,
|
|
|
|
DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_SetGroupData( &This->IDirectPlay4A_iface, group, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_SetGroupData( IDirectPlay2 *iface, DPID group, void *data,
|
|
|
|
DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_SetGroupData( &This->IDirectPlay4_iface, group, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_SetGroupData( IDirectPlay3A *iface, DPID group, void *data,
|
|
|
|
DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_SetGroupData( &This->IDirectPlay4_iface, group, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_SetGroupData( IDirectPlay3 *iface, DPID group, void *data,
|
|
|
|
DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_SetGroupData( &This->IDirectPlay4_iface, group, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:56:47 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_SetGroupData( IDirectPlay4A *iface, DPID group, void *data,
|
|
|
|
DWORD size, DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:56:47 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_SetGroupData( &This->IDirectPlay4_iface, group, data, size, flags );
|
|
|
|
}
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2013-03-29 16:56:47 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_SetGroupData( IDirectPlay4 *iface, DPID group, void *data,
|
|
|
|
DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
lpGroupData gdata;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx,%p,0x%08lx,0x%08lx)\n", This, group, data, size, flags );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2013-03-29 16:56:47 +01:00
|
|
|
/* Parameter check */
|
|
|
|
if ( !data && size )
|
|
|
|
return DPERR_INVALIDPARAMS;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2013-03-29 16:56:47 +01:00
|
|
|
/* Find the pointer to the data for this player */
|
|
|
|
if ( ( gdata = DP_FindAnyGroup( This, group ) ) == NULL )
|
|
|
|
return DPERR_INVALIDOBJECT;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:56:47 +01:00
|
|
|
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.
|
|
|
|
*/
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:56:47 +01:00
|
|
|
DP_SetGroupData( gdata, flags, data, size );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2013-03-29 16:56:47 +01:00
|
|
|
/* 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" );
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2013-03-29 16:56:47 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_IF_SetGroupName( IDirectPlayImpl *This, DPID idGroup, DPNAME *lpGroupName,
|
|
|
|
DWORD dwFlags, BOOL bAnsi )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
lpGroupData lpGData;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx,%p,0x%08lx,%u)\n", This, idGroup,
|
2000-07-10 15:19:28 +02:00
|
|
|
lpGroupName, dwFlags, bAnsi );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( ( lpGData = DP_FindAnyGroup( This, idGroup ) ) == NULL )
|
2000-06-07 05:44:36 +02:00
|
|
|
{
|
|
|
|
return DPERR_INVALIDGROUP;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
DP_CopyDPNAMEStruct( &lpGData->name, lpGroupName, bAnsi );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
|
|
|
/* Should send a DPMSG_SETPLAYERORGROUPNAME message */
|
|
|
|
FIXME( "Message not sent and dwFlags ignored\n" );
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_SetGroupName( IDirectPlay2A *iface, DPID group,
|
|
|
|
DPNAME *name, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_SetGroupName( &This->IDirectPlay4A_iface, group, name, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_SetGroupName( IDirectPlay2 *iface, DPID group,
|
|
|
|
DPNAME *name, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_SetGroupName( &This->IDirectPlay4_iface, group, name, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_SetGroupName( IDirectPlay3A *iface, DPID group,
|
|
|
|
DPNAME *name, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_SetGroupName( &This->IDirectPlay4_iface, group, name, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_SetGroupName( IDirectPlay3 *iface, DPID group,
|
|
|
|
DPNAME *name, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_SetGroupName( &This->IDirectPlay4_iface, group, name, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_SetGroupName( IDirectPlay4A *iface, DPID idGroup,
|
|
|
|
DPNAME *lpGroupName, DWORD dwFlags )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return DP_IF_SetGroupName( This, idGroup, lpGroupName, dwFlags, TRUE );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_SetGroupName( IDirectPlay4 *iface, DPID idGroup,
|
|
|
|
DPNAME *lpGroupName, DWORD dwFlags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
return DP_IF_SetGroupName( This, idGroup, lpGroupName, dwFlags, FALSE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_SetPlayerData( IDirectPlay2A *iface, DPID player,
|
|
|
|
void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_SetPlayerData( &This->IDirectPlay4A_iface, player, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_SetPlayerData( IDirectPlay2 *iface, DPID player,
|
|
|
|
void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_SetPlayerData( &This->IDirectPlay4_iface, player, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_SetPlayerData( IDirectPlay3A *iface, DPID player,
|
|
|
|
void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_SetPlayerData( &This->IDirectPlay4_iface, player, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_SetPlayerData( IDirectPlay3 *iface, DPID player,
|
|
|
|
void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_SetPlayerData( &This->IDirectPlay4_iface, player, data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:57:33 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_SetPlayerData( IDirectPlay4A *iface, DPID player,
|
|
|
|
void *data, DWORD size, DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:57:33 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_SetPlayerData( &This->IDirectPlay4_iface, player, data, size, flags );
|
|
|
|
}
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2013-03-29 16:57:33 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_SetPlayerData( IDirectPlay4 *iface, DPID player,
|
|
|
|
void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
lpPlayerList plist;
|
2008-08-02 21:51:56 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx,%p,0x%08lx,0x%08lx)\n", This, player, data, size, flags );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2013-03-29 16:57:33 +01:00
|
|
|
if ( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
return DPERR_UNINITIALIZED;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2013-03-29 16:57:33 +01:00
|
|
|
/* Parameter check */
|
|
|
|
if ( !data && size )
|
|
|
|
return DPERR_INVALIDPARAMS;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:57:33 +01:00
|
|
|
/* Find the pointer to the data for this player */
|
|
|
|
if ( (plist = DP_FindPlayer( This, player )) == NULL )
|
|
|
|
return DPERR_INVALIDPLAYER;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2013-03-29 16:57:33 +01:00
|
|
|
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.
|
|
|
|
*/
|
|
|
|
}
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2013-03-29 16:57:33 +01:00
|
|
|
DP_SetPlayerData( plist->lpPData, flags, data, size );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-03-29 16:57:33 +01:00
|
|
|
if ( !(flags & DPSET_LOCAL) )
|
|
|
|
FIXME( "Send msg?\n" );
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2013-03-29 16:57:33 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_IF_SetPlayerName( IDirectPlayImpl *This, DPID idPlayer, DPNAME *lpPlayerName,
|
|
|
|
DWORD dwFlags, BOOL bAnsi )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-06-07 05:44:36 +02:00
|
|
|
lpPlayerList lpPList;
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx,%p,0x%08lx,%u)\n",
|
2000-07-10 15:19:28 +02:00
|
|
|
This, idPlayer, lpPlayerName, dwFlags, bAnsi );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2008-08-02 21:52:12 +02:00
|
|
|
if( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
{
|
|
|
|
return DPERR_UNINITIALIZED;
|
|
|
|
}
|
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
if( ( lpPList = DP_FindPlayer( This, idPlayer ) ) == NULL )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDGROUP;
|
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
DP_CopyDPNAMEStruct( &lpPList->lpPData->name, lpPlayerName, bAnsi );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
|
|
|
/* Should send a DPMSG_SETPLAYERORGROUPNAME message */
|
|
|
|
FIXME( "Message not sent and dwFlags ignored\n" );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_SetPlayerName( IDirectPlay2A *iface, DPID player,
|
|
|
|
DPNAME *name, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_SetPlayerName( &This->IDirectPlay4A_iface, player, name, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_SetPlayerName( IDirectPlay2 *iface, DPID player,
|
|
|
|
DPNAME *name, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_SetPlayerName( &This->IDirectPlay4_iface, player, name, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_SetPlayerName( IDirectPlay3A *iface, DPID player,
|
|
|
|
DPNAME *name, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_SetPlayerName( &This->IDirectPlay4_iface, player, name, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_SetPlayerName( IDirectPlay3 *iface, DPID player,
|
|
|
|
DPNAME *name, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_SetPlayerName( &This->IDirectPlay4_iface, player, name, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_SetPlayerName( IDirectPlay4A *iface, DPID idPlayer,
|
|
|
|
DPNAME *lpPlayerName, DWORD dwFlags )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return DP_IF_SetPlayerName( This, idPlayer, lpPlayerName, dwFlags, TRUE );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_SetPlayerName( IDirectPlay4 *iface, DPID idPlayer,
|
|
|
|
DPNAME *lpPlayerName, DWORD dwFlags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
return DP_IF_SetPlayerName( This, idPlayer, lpPlayerName, dwFlags, FALSE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_SetSessionDesc( IDirectPlayImpl *This, const DPSESSIONDESC2 *lpSessDesc,
|
|
|
|
DWORD dwFlags, BOOL bInitial, BOOL bAnsi )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
|
|
|
DWORD dwRequiredSize;
|
|
|
|
LPDPSESSIONDESC2 lpTempSessDesc;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(%p,0x%08lx,%u,%u)\n",
|
2000-08-25 23:58:05 +02:00
|
|
|
This, lpSessDesc, dwFlags, bInitial, bAnsi );
|
|
|
|
|
2003-12-30 22:50:56 +01:00
|
|
|
if( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
{
|
|
|
|
return DPERR_UNINITIALIZED;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( dwFlags )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Only the host is allowed to update the session desc */
|
|
|
|
if( !This->dp2->bHostInterface )
|
|
|
|
{
|
|
|
|
return DPERR_ACCESSDENIED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Copy into This->dp2->lpSessionDesc */
|
|
|
|
dwRequiredSize = DP_CalcSessionDescSize( lpSessDesc, bAnsi );
|
2005-03-24 22:01:35 +01:00
|
|
|
lpTempSessDesc = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
if( lpTempSessDesc == NULL )
|
|
|
|
{
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free the old */
|
|
|
|
HeapFree( GetProcessHeap(), 0, This->dp2->lpSessionDesc );
|
|
|
|
|
|
|
|
This->dp2->lpSessionDesc = lpTempSessDesc;
|
2007-03-25 04:02:00 +02:00
|
|
|
/* Set the new */
|
|
|
|
DP_CopySessionDesc( This->dp2->lpSessionDesc, lpSessDesc, bAnsi );
|
2007-02-27 17:27:43 +01:00
|
|
|
if( bInitial )
|
|
|
|
{
|
|
|
|
/*Initializing session GUID*/
|
|
|
|
CoCreateGuid( &(This->dp2->lpSessionDesc->guidInstance) );
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
/* If this is an external invocation of the interface, we should be
|
2000-08-25 23:58:05 +02:00
|
|
|
* letting everyone know that things have changed. Otherwise this is
|
|
|
|
* just an initialization and it doesn't need to be propagated.
|
|
|
|
*/
|
|
|
|
if( !bInitial )
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
FIXME( "Need to send a DPMSG_SETSESSIONDESC msg to everyone\n" );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2AImpl_SetSessionDesc( IDirectPlay2A *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface );
|
|
|
|
return IDirectPlayX_SetSessionDesc( &This->IDirectPlay4A_iface, sdesc, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay2Impl_SetSessionDesc( IDirectPlay2 *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay2( iface );
|
|
|
|
return IDirectPlayX_SetSessionDesc( &This->IDirectPlay4_iface, sdesc, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_SetSessionDesc( IDirectPlay3A *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_SetSessionDesc( &This->IDirectPlay4_iface, sdesc, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_SetSessionDesc( IDirectPlay3 *iface, DPSESSIONDESC2 *sdesc,
|
|
|
|
DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_SetSessionDesc( &This->IDirectPlay4_iface, sdesc, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_SetSessionDesc( IDirectPlay4A *iface,
|
|
|
|
DPSESSIONDESC2 *lpSessDesc, DWORD dwFlags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return DP_SetSessionDesc( This, lpSessDesc, dwFlags, FALSE, TRUE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_SetSessionDesc( IDirectPlay4 *iface,
|
|
|
|
DPSESSIONDESC2 *lpSessDesc, DWORD dwFlags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
return DP_SetSessionDesc( This, lpSessDesc, dwFlags, FALSE, TRUE );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: See about merging some of this stuff with dplayx_global.c stuff */
|
2008-12-01 13:26:05 +01:00
|
|
|
static DWORD DP_CalcSessionDescSize( LPCDPSESSIONDESC2 lpSessDesc, BOOL bAnsi )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
|
|
|
DWORD dwSize = 0;
|
|
|
|
|
|
|
|
if( lpSessDesc == NULL )
|
|
|
|
{
|
|
|
|
/* Hmmm..don't need any size? */
|
|
|
|
ERR( "NULL lpSessDesc\n" );
|
|
|
|
return dwSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
dwSize += sizeof( *lpSessDesc );
|
|
|
|
|
|
|
|
if( bAnsi )
|
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpSessDesc->u1.lpszSessionNameA )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
dwSize += lstrlenA( lpSessDesc->u1.lpszSessionNameA ) + 1;
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpSessDesc->u2.lpszPasswordA )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
dwSize += lstrlenA( lpSessDesc->u2.lpszPasswordA ) + 1;
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else /* UNICODE */
|
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpSessDesc->u1.lpszSessionName )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
|
|
|
dwSize += sizeof( WCHAR ) *
|
2000-12-03 04:16:05 +01:00
|
|
|
( lstrlenW( lpSessDesc->u1.lpszSessionName ) + 1 );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpSessDesc->u2.lpszPassword )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
|
|
|
dwSize += sizeof( WCHAR ) *
|
2000-12-03 04:16:05 +01:00
|
|
|
( lstrlenW( lpSessDesc->u2.lpszPassword ) + 1 );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return dwSize;
|
|
|
|
}
|
|
|
|
|
2008-04-02 22:10:47 +02:00
|
|
|
/* Assumes that contiguous buffers are already allocated. */
|
2002-06-01 01:06:46 +02:00
|
|
|
static void DP_CopySessionDesc( LPDPSESSIONDESC2 lpSessionDest,
|
2000-08-25 23:58:05 +02:00
|
|
|
LPCDPSESSIONDESC2 lpSessionSrc, BOOL bAnsi )
|
|
|
|
{
|
|
|
|
BYTE* lpStartOfFreeSpace;
|
|
|
|
|
|
|
|
if( lpSessionDest == NULL )
|
|
|
|
{
|
|
|
|
ERR( "NULL lpSessionDest\n" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CopyMemory( lpSessionDest, lpSessionSrc, sizeof( *lpSessionSrc ) );
|
|
|
|
|
|
|
|
lpStartOfFreeSpace = ((BYTE*)lpSessionDest) + sizeof( *lpSessionSrc );
|
|
|
|
|
|
|
|
if( bAnsi )
|
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpSessionSrc->u1.lpszSessionNameA )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
lstrcpyA( (LPSTR)lpStartOfFreeSpace,
|
2000-12-03 04:16:05 +01:00
|
|
|
lpSessionDest->u1.lpszSessionNameA );
|
|
|
|
lpSessionDest->u1.lpszSessionNameA = (LPSTR)lpStartOfFreeSpace;
|
2002-06-01 01:06:46 +02:00
|
|
|
lpStartOfFreeSpace +=
|
2007-12-10 23:03:28 +01:00
|
|
|
lstrlenA( lpSessionDest->u1.lpszSessionNameA ) + 1;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpSessionSrc->u2.lpszPasswordA )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
lstrcpyA( (LPSTR)lpStartOfFreeSpace,
|
2000-12-03 04:16:05 +01:00
|
|
|
lpSessionDest->u2.lpszPasswordA );
|
|
|
|
lpSessionDest->u2.lpszPasswordA = (LPSTR)lpStartOfFreeSpace;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
else /* UNICODE */
|
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpSessionSrc->u1.lpszSessionName )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
|
|
|
lstrcpyW( (LPWSTR)lpStartOfFreeSpace,
|
2000-12-03 04:16:05 +01:00
|
|
|
lpSessionDest->u1.lpszSessionName );
|
|
|
|
lpSessionDest->u1.lpszSessionName = (LPWSTR)lpStartOfFreeSpace;
|
2000-08-25 23:58:05 +02:00
|
|
|
lpStartOfFreeSpace += sizeof(WCHAR) *
|
2007-12-10 23:03:28 +01:00
|
|
|
( lstrlenW( lpSessionDest->u1.lpszSessionName ) + 1 );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpSessionSrc->u2.lpszPassword )
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
|
|
|
lstrcpyW( (LPWSTR)lpStartOfFreeSpace,
|
2000-12-03 04:16:05 +01:00
|
|
|
lpSessionDest->u2.lpszPassword );
|
|
|
|
lpSessionDest->u2.lpszPassword = (LPWSTR)lpStartOfFreeSpace;
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_AddGroupToGroup( IDirectPlay3A *iface, DPID parent,
|
|
|
|
DPID group )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_AddGroupToGroup( &This->IDirectPlay4A_iface, parent, group );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_AddGroupToGroup( IDirectPlay3 *iface, DPID parent,
|
|
|
|
DPID group )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_AddGroupToGroup( &This->IDirectPlay4_iface, parent, group );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:58:20 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_AddGroupToGroup( IDirectPlay4A *iface, DPID parent,
|
|
|
|
DPID group )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:58:20 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_AddGroupToGroup( &This->IDirectPlay4_iface, parent, group );
|
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:58:20 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_AddGroupToGroup( IDirectPlay4 *iface, DPID parent,
|
|
|
|
DPID group )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
lpGroupData gdata;
|
|
|
|
lpGroupList glist;
|
2008-08-05 03:56:30 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx,0x%08lx)\n", This, parent, group );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:58:20 +01:00
|
|
|
if ( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
return DPERR_UNINITIALIZED;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2013-03-29 16:58:20 +01:00
|
|
|
if ( !DP_FindAnyGroup(This, parent ) )
|
|
|
|
return DPERR_INVALIDGROUP;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:58:20 +01:00
|
|
|
if ( ( gdata = DP_FindAnyGroup(This, group ) ) == NULL )
|
|
|
|
return DPERR_INVALIDGROUP;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:58:20 +01:00
|
|
|
/* Create a player list (ie "shortcut" ) */
|
|
|
|
glist = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *glist ) );
|
|
|
|
if ( !glist )
|
|
|
|
return DPERR_CANTADDPLAYER;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 16:58:20 +01:00
|
|
|
/* Add the shortcut */
|
|
|
|
gdata->uRef++;
|
|
|
|
glist->lpGData = gdata;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2013-03-29 16:58:20 +01:00
|
|
|
/* Add the player to the list of players for this group */
|
|
|
|
DPQ_INSERT( gdata->groups, glist, groups );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-03-29 16:58:20 +01:00
|
|
|
/* Send a ADDGROUPTOGROUP message */
|
|
|
|
FIXME( "Not sending message\n" );
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2013-03-29 16:58:20 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_IF_CreateGroupInGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID idParentGroup,
|
|
|
|
DPID *lpidGroup, DPNAME *lpGroupName, void *lpData, DWORD dwDataSize, DWORD dwFlags,
|
|
|
|
BOOL bAnsi )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
lpGroupData lpGParentData;
|
2000-06-07 05:44:36 +02:00
|
|
|
lpGroupList lpGList;
|
|
|
|
lpGroupData lpGData;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx,%p,%p,%p,0x%08lx,0x%08lx,%u)\n",
|
2002-06-01 01:06:46 +02:00
|
|
|
This, idParentGroup, lpidGroup, lpGroupName, lpData,
|
2000-08-25 23:58:05 +02:00
|
|
|
dwDataSize, dwFlags, bAnsi );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2008-08-05 03:56:37 +02:00
|
|
|
if( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
{
|
|
|
|
return DPERR_UNINITIALIZED;
|
|
|
|
}
|
|
|
|
|
2000-06-07 05:44:36 +02:00
|
|
|
/* Verify that the specified parent is valid */
|
2013-03-29 17:09:40 +01:00
|
|
|
if( ( lpGParentData = DP_FindAnyGroup(This, idParentGroup ) ) == NULL )
|
2000-06-07 05:44:36 +02:00
|
|
|
return DPERR_INVALIDGROUP;
|
|
|
|
|
2013-03-29 17:09:40 +01:00
|
|
|
lpGData = DP_CreateGroup(This, lpidGroup, lpGroupName, dwFlags, idParentGroup, bAnsi );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
|
|
|
if( lpGData == NULL )
|
|
|
|
{
|
|
|
|
return DPERR_CANTADDPLAYER; /* yes player not group */
|
|
|
|
}
|
2000-08-30 01:55:06 +02:00
|
|
|
|
|
|
|
/* Something else is referencing this data */
|
|
|
|
lpGData->uRef++;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
DP_SetGroupData( lpGData, DPSET_REMOTE, lpData, dwDataSize );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
|
|
|
/* The list has now been inserted into the interface group list. We now
|
|
|
|
need to put a "shortcut" to this group in the parent group */
|
2005-03-24 22:01:35 +01:00
|
|
|
lpGList = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpGList ) );
|
2000-06-07 05:44:36 +02:00
|
|
|
if( lpGList == NULL )
|
|
|
|
{
|
|
|
|
FIXME( "Memory leak\n" );
|
|
|
|
return DPERR_CANTADDPLAYER; /* yes player not group */
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
lpGList->lpGData = lpGData;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
DPQ_INSERT( lpGParentData->groups, lpGList, groups );
|
|
|
|
|
|
|
|
/* Let the SP know that we've created this group */
|
|
|
|
if( This->dp2->spData.lpCB->CreateGroup )
|
|
|
|
{
|
|
|
|
DPSP_CREATEGROUPDATA data;
|
|
|
|
|
|
|
|
TRACE( "Calling SP CreateGroup\n" );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
data.idGroup = *lpidGroup;
|
|
|
|
data.dwFlags = dwFlags;
|
|
|
|
data.lpSPMessageHeader = lpMsgHdr;
|
|
|
|
data.lpISP = This->dp2->spData.lpISP;
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
(*This->dp2->spData.lpCB->CreateGroup)( &data );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* Inform all other peers of the creation of a new group. If there are
|
|
|
|
* no peers keep this quiet.
|
2000-08-25 23:58:05 +02:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
if( This->dp2->lpSessionDesc &&
|
2000-08-25 23:58:05 +02:00
|
|
|
( This->dp2->lpSessionDesc->dwFlags & DPSESSION_MULTICASTSERVER ) )
|
|
|
|
{
|
|
|
|
DPMSG_CREATEPLAYERORGROUP msg;
|
|
|
|
|
|
|
|
msg.dwType = DPSYS_CREATEPLAYERORGROUP;
|
|
|
|
msg.dwPlayerType = DPPLAYERTYPE_GROUP;
|
|
|
|
msg.dpId = *lpidGroup;
|
|
|
|
msg.dwCurrentPlayers = idParentGroup; /* FIXME: Incorrect? */
|
|
|
|
msg.lpData = lpData;
|
|
|
|
msg.dwDataSize = dwDataSize;
|
|
|
|
msg.dpnName = *lpGroupName;
|
|
|
|
|
|
|
|
/* FIXME: Correct to just use send effectively? */
|
|
|
|
/* FIXME: Should size include data w/ message or just message "header" */
|
|
|
|
/* FIXME: Check return code */
|
2013-03-29 17:05:50 +01:00
|
|
|
IDirectPlayX_SendEx( &This->IDirectPlay4_iface, DPID_SERVERPLAYER, DPID_ALLPLAYERS, 0, &msg,
|
|
|
|
sizeof( msg ), 0, 0, NULL, NULL );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
|
|
|
return DP_OK;
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_CreateGroupInGroup( IDirectPlay3A *iface, DPID parent,
|
|
|
|
DPID *group, DPNAME *name, void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_CreateGroupInGroup( &This->IDirectPlay4A_iface, parent, group, name,
|
|
|
|
data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_CreateGroupInGroup( IDirectPlay3 *iface, DPID parent,
|
|
|
|
DPID *group, DPNAME *name, void *data, DWORD size, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_CreateGroupInGroup( &This->IDirectPlay4_iface, parent, group, name,
|
|
|
|
data, size, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_CreateGroupInGroup( IDirectPlay4A *iface,
|
|
|
|
DPID idParentGroup, DPID *lpidGroup, DPNAME *lpGroupName, void *lpData, DWORD dwDataSize,
|
|
|
|
DWORD dwFlags )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:45:09 +01:00
|
|
|
*lpidGroup = DPID_UNKNOWN;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 16:45:09 +01:00
|
|
|
return DP_IF_CreateGroupInGroup( This, NULL, idParentGroup, lpidGroup, lpGroupName, lpData,
|
|
|
|
dwDataSize, dwFlags, TRUE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_CreateGroupInGroup( IDirectPlay4 *iface, DPID idParentGroup,
|
|
|
|
DPID *lpidGroup, DPNAME *lpGroupName, void *lpData, DWORD dwDataSize, DWORD dwFlags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
*lpidGroup = DPID_UNKNOWN;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
return DP_IF_CreateGroupInGroup( This, NULL, idParentGroup, lpidGroup, lpGroupName, lpData,
|
|
|
|
dwDataSize, dwFlags, FALSE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_DeleteGroupFromGroup( IDirectPlay3A *iface, DPID parent,
|
|
|
|
DPID group )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_DeleteGroupFromGroup( &This->IDirectPlay4A_iface, parent, group );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_DeleteGroupFromGroup( IDirectPlay3 *iface, DPID parent,
|
|
|
|
DPID group )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_DeleteGroupFromGroup( &This->IDirectPlay4_iface, parent, group );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:00:34 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_DeleteGroupFromGroup( IDirectPlay4A *iface, DPID parent,
|
|
|
|
DPID group )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:00:34 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_DeleteGroupFromGroup( &This->IDirectPlay4_iface, parent, group );
|
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 17:00:34 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_DeleteGroupFromGroup( IDirectPlay4 *iface, DPID parent,
|
|
|
|
DPID group )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
lpGroupList glist;
|
|
|
|
lpGroupData parentdata;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE("(%p)->(0x%08lx,0x%08lx)\n", This, parent, group );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 17:00:34 +01:00
|
|
|
/* Is the parent group valid? */
|
|
|
|
if ( ( parentdata = DP_FindAnyGroup(This, parent ) ) == NULL )
|
|
|
|
return DPERR_INVALIDGROUP;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 17:00:34 +01:00
|
|
|
/* Remove the group from the parent group queue */
|
|
|
|
DPQ_REMOVE_ENTRY( parentdata->groups, groups, lpGData->dpid, ==, group, glist );
|
2000-08-30 01:55:06 +02:00
|
|
|
|
2013-03-29 17:00:34 +01:00
|
|
|
if ( glist == NULL )
|
|
|
|
return DPERR_INVALIDGROUP;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 17:00:34 +01:00
|
|
|
/* Decrement the ref count */
|
|
|
|
glist->lpGData->uRef--;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 17:00:34 +01:00
|
|
|
/* Free up the list item */
|
|
|
|
HeapFree( GetProcessHeap(), 0, glist );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-03-29 17:00:34 +01:00
|
|
|
/* Should send a DELETEGROUPFROMGROUP message */
|
|
|
|
FIXME( "message not sent\n" );
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2013-03-29 17:00:34 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2008-11-28 15:19:48 +01:00
|
|
|
static BOOL DP_BuildSPCompoundAddr( LPGUID lpcSpGuid, LPVOID* lplpAddrBuf,
|
2001-04-12 23:10:54 +02:00
|
|
|
LPDWORD lpdwBufSize )
|
|
|
|
{
|
|
|
|
DPCOMPOUNDADDRESSELEMENT dpCompoundAddress;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
dpCompoundAddress.dwDataSize = sizeof( GUID );
|
2008-02-26 21:20:06 +01:00
|
|
|
dpCompoundAddress.guidDataType = DPAID_ServiceProvider;
|
2001-04-12 23:10:54 +02:00
|
|
|
dpCompoundAddress.lpData = lpcSpGuid;
|
|
|
|
|
|
|
|
*lplpAddrBuf = NULL;
|
|
|
|
*lpdwBufSize = 0;
|
|
|
|
|
|
|
|
hr = DPL_CreateCompoundAddress( &dpCompoundAddress, 1, *lplpAddrBuf,
|
|
|
|
lpdwBufSize, TRUE );
|
|
|
|
|
|
|
|
if( hr != DPERR_BUFFERTOOSMALL )
|
|
|
|
{
|
|
|
|
ERR( "can't get buffer size: %s\n", DPLAYX_HresultToString( hr ) );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now allocate the buffer */
|
|
|
|
*lplpAddrBuf = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
*lpdwBufSize );
|
|
|
|
|
|
|
|
hr = DPL_CreateCompoundAddress( &dpCompoundAddress, 1, *lplpAddrBuf,
|
|
|
|
lpdwBufSize, TRUE );
|
|
|
|
if( FAILED(hr) )
|
|
|
|
{
|
|
|
|
ERR( "can't create address: %s\n", DPLAYX_HresultToString( hr ) );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_EnumConnections( IDirectPlay3A *iface,
|
|
|
|
const GUID *application, LPDPENUMCONNECTIONSCALLBACK enumcb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_EnumConnections( &This->IDirectPlay4A_iface, application, enumcb, context,
|
|
|
|
flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_EnumConnections( IDirectPlay3 *iface,
|
|
|
|
const GUID *application, LPDPENUMCONNECTIONSCALLBACK enumcb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_EnumConnections( &This->IDirectPlay4_iface, application, enumcb, context,
|
|
|
|
flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_EnumConnections( IDirectPlay4A *iface,
|
|
|
|
const GUID *lpguidApplication, LPDPENUMCONNECTIONSCALLBACK lpEnumCallback, void *lpContext,
|
|
|
|
DWORD dwFlags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE("(%p)->(%p,%p,%p,0x%08lx)\n", This, lpguidApplication, lpEnumCallback, lpContext, dwFlags );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
/* A default dwFlags (0) is backwards compatible -- DPCONNECTION_DIRECTPLAY */
|
|
|
|
if( dwFlags == 0 )
|
|
|
|
{
|
|
|
|
dwFlags = DPCONNECTION_DIRECTPLAY;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( ! ( ( dwFlags & DPCONNECTION_DIRECTPLAY ) ||
|
|
|
|
( dwFlags & DPCONNECTION_DIRECTPLAYLOBBY ) )
|
2002-06-01 01:06:46 +02:00
|
|
|
)
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
return DPERR_INVALIDFLAGS;
|
|
|
|
}
|
|
|
|
|
2008-02-21 17:44:29 +01:00
|
|
|
if( !lpEnumCallback )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
return DPERR_INVALIDPARAMS;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Enumerate DirectPlay service providers */
|
|
|
|
if( dwFlags & DPCONNECTION_DIRECTPLAY )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
HKEY hkResult;
|
|
|
|
LPCSTR searchSubKey = "SOFTWARE\\Microsoft\\DirectPlay\\Service Providers";
|
2003-10-07 05:30:47 +02:00
|
|
|
LPCSTR guidDataSubKey = "Guid";
|
2002-06-01 01:06:46 +02:00
|
|
|
char subKeyName[51];
|
2000-03-12 21:18:33 +01:00
|
|
|
DWORD dwIndex, sizeOfSubKeyName=50;
|
|
|
|
FILETIME filetime;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
/* Need to loop over the service providers in the registry */
|
|
|
|
if( RegOpenKeyExA( HKEY_LOCAL_MACHINE, searchSubKey,
|
2000-03-12 21:18:33 +01:00
|
|
|
0, KEY_READ, &hkResult ) != ERROR_SUCCESS )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
/* Hmmm. Does this mean that there are no service providers? */
|
|
|
|
ERR(": no service providers?\n");
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Traverse all the service providers we have available */
|
|
|
|
for( dwIndex=0;
|
2002-06-01 01:06:46 +02:00
|
|
|
RegEnumKeyExA( hkResult, dwIndex, subKeyName, &sizeOfSubKeyName,
|
2000-03-12 21:18:33 +01:00
|
|
|
NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS;
|
|
|
|
++dwIndex, sizeOfSubKeyName=51 )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
HKEY hkServiceProvider;
|
|
|
|
GUID serviceProviderGUID;
|
|
|
|
DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
|
|
|
|
char returnBuffer[51];
|
2000-11-16 01:28:52 +01:00
|
|
|
WCHAR buff[51];
|
1999-11-04 03:17:03 +01:00
|
|
|
DPNAME dpName;
|
2001-04-12 23:10:54 +02:00
|
|
|
BOOL bBuildPass;
|
1999-11-25 23:04:53 +01:00
|
|
|
|
|
|
|
LPVOID lpAddressBuffer = NULL;
|
|
|
|
DWORD dwAddressBufferSize = 0;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
TRACE(" this time through: %s\n", subKeyName );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
/* Get a handle for this particular service provider */
|
2000-03-12 21:18:33 +01:00
|
|
|
if( RegOpenKeyExA( hkResult, subKeyName, 0, KEY_READ,
|
1999-11-04 03:17:03 +01:00
|
|
|
&hkServiceProvider ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR(": what the heck is going on?\n" );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( RegQueryValueExA( hkServiceProvider, guidDataSubKey,
|
2005-07-07 14:08:42 +02:00
|
|
|
NULL, &returnTypeGUID, (LPBYTE)returnBuffer,
|
1999-11-04 03:17:03 +01:00
|
|
|
&sizeOfReturnBuffer ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR(": missing GUID registry data members\n" );
|
2007-09-22 16:40:15 +02:00
|
|
|
RegCloseKey(hkServiceProvider);
|
1999-11-04 03:17:03 +01:00
|
|
|
continue;
|
|
|
|
}
|
2007-09-22 16:40:15 +02:00
|
|
|
RegCloseKey(hkServiceProvider);
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
/* FIXME: Check return types to ensure we're interpreting data right */
|
2018-09-10 22:49:38 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, ARRAY_SIZE( buff ));
|
2004-01-23 21:57:26 +01:00
|
|
|
CLSIDFromString( buff, &serviceProviderGUID );
|
1999-11-04 03:17:03 +01:00
|
|
|
/* FIXME: Have I got a memory leak on the serviceProviderGUID? */
|
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
/* Fill in the DPNAME struct for the service provider */
|
1999-11-04 03:17:03 +01:00
|
|
|
dpName.dwSize = sizeof( dpName );
|
|
|
|
dpName.dwFlags = 0;
|
2000-12-03 04:16:05 +01:00
|
|
|
dpName.u1.lpszShortNameA = subKeyName;
|
|
|
|
dpName.u2.lpszLongNameA = NULL;
|
1999-11-25 23:04:53 +01:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* Create the compound address for the service provider.
|
2002-05-20 20:01:44 +02:00
|
|
|
* NOTE: This is a gruesome architectural scar right now. DP
|
|
|
|
* uses DPL and DPL uses DP. Nasty stuff. This may be why the
|
|
|
|
* native dll just gets around this little bit by allocating an
|
|
|
|
* 80 byte buffer which isn't even filled with a valid compound
|
|
|
|
* address. Oh well. Creating a proper compound address is the
|
|
|
|
* way to go anyways despite this method taking slightly more
|
|
|
|
* heap space and realtime :) */
|
2001-04-12 23:10:54 +02:00
|
|
|
|
|
|
|
bBuildPass = DP_BuildSPCompoundAddr( &serviceProviderGUID,
|
|
|
|
&lpAddressBuffer,
|
|
|
|
&dwAddressBufferSize );
|
|
|
|
if( !bBuildPass )
|
1999-11-25 23:04:53 +01:00
|
|
|
{
|
2001-04-12 23:10:54 +02:00
|
|
|
ERR( "Can't build compound addr\n" );
|
|
|
|
return DPERR_GENERIC;
|
1999-11-25 23:04:53 +01:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
/* The enumeration will return FALSE if we are not to continue */
|
2002-06-01 01:06:46 +02:00
|
|
|
if( !lpEnumCallback( &serviceProviderGUID, lpAddressBuffer, dwAddressBufferSize,
|
2008-07-31 19:17:34 +02:00
|
|
|
&dpName, dwFlags, lpContext ) )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2017-02-22 06:15:02 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, lpAddressBuffer );
|
1999-11-25 23:04:53 +01:00
|
|
|
return DP_OK;
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
2017-02-22 06:15:02 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, lpAddressBuffer );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Enumerate DirectPlayLobby service providers */
|
|
|
|
if( dwFlags & DPCONNECTION_DIRECTPLAYLOBBY )
|
|
|
|
{
|
2000-05-23 03:16:36 +02:00
|
|
|
HKEY hkResult;
|
|
|
|
LPCSTR searchSubKey = "SOFTWARE\\Microsoft\\DirectPlay\\Lobby Providers";
|
2003-10-07 05:30:47 +02:00
|
|
|
LPCSTR guidDataSubKey = "Guid";
|
2002-06-01 01:06:46 +02:00
|
|
|
char subKeyName[51];
|
2000-05-23 03:16:36 +02:00
|
|
|
DWORD dwIndex, sizeOfSubKeyName=50;
|
|
|
|
FILETIME filetime;
|
|
|
|
|
|
|
|
/* Need to loop over the service providers in the registry */
|
|
|
|
if( RegOpenKeyExA( HKEY_LOCAL_MACHINE, searchSubKey,
|
|
|
|
0, KEY_READ, &hkResult ) != ERROR_SUCCESS )
|
|
|
|
{
|
2017-02-17 07:42:49 +01:00
|
|
|
TRACE("No Lobby Providers have been registered.\n");
|
2000-05-23 03:16:36 +02:00
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Traverse all the lobby providers we have available */
|
2000-05-23 03:16:36 +02:00
|
|
|
for( dwIndex=0;
|
2002-06-01 01:06:46 +02:00
|
|
|
RegEnumKeyExA( hkResult, dwIndex, subKeyName, &sizeOfSubKeyName,
|
2000-05-23 03:16:36 +02:00
|
|
|
NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS;
|
|
|
|
++dwIndex, sizeOfSubKeyName=51 )
|
|
|
|
{
|
|
|
|
|
|
|
|
HKEY hkServiceProvider;
|
|
|
|
GUID serviceProviderGUID;
|
|
|
|
DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
|
|
|
|
char returnBuffer[51];
|
2000-11-16 01:28:52 +01:00
|
|
|
WCHAR buff[51];
|
2000-05-23 03:16:36 +02:00
|
|
|
DPNAME dpName;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
DPCOMPOUNDADDRESSELEMENT dpCompoundAddress;
|
|
|
|
LPVOID lpAddressBuffer = NULL;
|
|
|
|
DWORD dwAddressBufferSize = 0;
|
|
|
|
|
|
|
|
TRACE(" this time through: %s\n", subKeyName );
|
|
|
|
|
|
|
|
/* Get a handle for this particular service provider */
|
|
|
|
if( RegOpenKeyExA( hkResult, subKeyName, 0, KEY_READ,
|
|
|
|
&hkServiceProvider ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR(": what the heck is going on?\n" );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( RegQueryValueExA( hkServiceProvider, guidDataSubKey,
|
2005-07-07 14:08:42 +02:00
|
|
|
NULL, &returnTypeGUID, (LPBYTE)returnBuffer,
|
2000-05-23 03:16:36 +02:00
|
|
|
&sizeOfReturnBuffer ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR(": missing GUID registry data members\n" );
|
2007-09-22 16:40:15 +02:00
|
|
|
RegCloseKey(hkServiceProvider);
|
2000-05-23 03:16:36 +02:00
|
|
|
continue;
|
|
|
|
}
|
2007-09-22 16:40:15 +02:00
|
|
|
RegCloseKey(hkServiceProvider);
|
2000-05-23 03:16:36 +02:00
|
|
|
|
|
|
|
/* FIXME: Check return types to ensure we're interpreting data right */
|
2018-09-10 22:49:38 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, ARRAY_SIZE( buff ));
|
2004-01-23 21:57:26 +01:00
|
|
|
CLSIDFromString( buff, &serviceProviderGUID );
|
2000-05-23 03:16:36 +02:00
|
|
|
/* FIXME: Have I got a memory leak on the serviceProviderGUID? */
|
|
|
|
|
|
|
|
/* Fill in the DPNAME struct for the service provider */
|
|
|
|
dpName.dwSize = sizeof( dpName );
|
|
|
|
dpName.dwFlags = 0;
|
2000-12-03 04:16:05 +01:00
|
|
|
dpName.u1.lpszShortNameA = subKeyName;
|
|
|
|
dpName.u2.lpszLongNameA = NULL;
|
2000-05-23 03:16:36 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* Create the compound address for the service provider.
|
2001-04-12 23:10:54 +02:00
|
|
|
NOTE: This is a gruesome architectural scar right now. DP uses DPL and DPL uses DP
|
|
|
|
nast stuff. This may be why the native dll just gets around this little bit by
|
|
|
|
allocating an 80 byte buffer which isn't even a filled with a valid compound
|
|
|
|
address. Oh well. Creating a proper compound address is the way to go anyways
|
2000-05-23 03:16:36 +02:00
|
|
|
despite this method taking slightly more heap space and realtime :) */
|
2001-04-12 23:10:54 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
dpCompoundAddress.guidDataType = DPAID_LobbyProvider;
|
2000-05-23 03:16:36 +02:00
|
|
|
dpCompoundAddress.dwDataSize = sizeof( GUID );
|
2002-06-01 01:06:46 +02:00
|
|
|
dpCompoundAddress.lpData = &serviceProviderGUID;
|
2000-05-23 03:16:36 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if( ( hr = DPL_CreateCompoundAddress( &dpCompoundAddress, 1, lpAddressBuffer,
|
2000-05-23 03:16:36 +02:00
|
|
|
&dwAddressBufferSize, TRUE ) ) != DPERR_BUFFERTOOSMALL )
|
|
|
|
{
|
|
|
|
ERR( "can't get buffer size: %s\n", DPLAYX_HresultToString( hr ) );
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Now allocate the buffer */
|
|
|
|
lpAddressBuffer = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwAddressBufferSize );
|
|
|
|
|
|
|
|
if( ( hr = DPL_CreateCompoundAddress( &dpCompoundAddress, 1, lpAddressBuffer,
|
|
|
|
&dwAddressBufferSize, TRUE ) ) != DP_OK )
|
|
|
|
{
|
|
|
|
ERR( "can't create address: %s\n", DPLAYX_HresultToString( hr ) );
|
2007-09-22 16:40:15 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, lpAddressBuffer );
|
2000-08-25 23:58:05 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The enumeration will return FALSE if we are not to continue */
|
|
|
|
if( !lpEnumCallback( &serviceProviderGUID, lpAddressBuffer, dwAddressBufferSize,
|
2008-07-31 19:17:34 +02:00
|
|
|
&dpName, dwFlags, lpContext ) )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2007-09-22 16:40:15 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, lpAddressBuffer );
|
2000-08-25 23:58:05 +02:00
|
|
|
return DP_OK;
|
|
|
|
}
|
2007-09-22 16:40:15 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, lpAddressBuffer );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:51:46 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_EnumConnections( IDirectPlay4 *iface,
|
|
|
|
const GUID *application, LPDPENUMCONNECTIONSCALLBACK enumcb, void *context, DWORD flags )
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2017-06-08 07:37:40 +02:00
|
|
|
return IDirectPlayX_EnumConnections( &This->IDirectPlay4A_iface, application, enumcb, context,
|
|
|
|
flags );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_EnumGroupsInGroup( IDirectPlay3A *iface, DPID group,
|
|
|
|
GUID *instance, LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_EnumGroupsInGroup( &This->IDirectPlay4A_iface, group, instance,
|
|
|
|
enumplayercb, context, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_EnumGroupsInGroup( IDirectPlay3 *iface, DPID group,
|
|
|
|
GUID *instance, LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_EnumGroupsInGroup( &This->IDirectPlay4_iface, group, instance,
|
|
|
|
enumplayercb, context, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:01:34 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_EnumGroupsInGroup( IDirectPlay4A *iface, DPID group,
|
|
|
|
GUID *instance, LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 17:01:34 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_EnumGroupsInGroup( &This->IDirectPlay4_iface, group, instance,
|
|
|
|
enumplayercb, context, flags );
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:01:34 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_EnumGroupsInGroup( IDirectPlay4 *iface, DPID group,
|
|
|
|
GUID *instance, LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
lpGroupList glist;
|
|
|
|
lpGroupData gdata;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p,%p,%p,0x%08lx): semi stub\n", This, group, instance, enumplayercb,
|
2013-03-29 17:01:34 +01:00
|
|
|
context, flags );
|
2008-08-05 03:56:30 +02:00
|
|
|
|
2013-03-29 17:01:34 +01:00
|
|
|
if ( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
return DPERR_UNINITIALIZED;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:01:34 +01:00
|
|
|
if ( ( gdata = DP_FindAnyGroup(This, group ) ) == NULL )
|
|
|
|
return DPERR_INVALIDGROUP;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:01:34 +01:00
|
|
|
if ( DPQ_IS_EMPTY( gdata->groups ) )
|
|
|
|
return DP_OK;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
|
2013-03-29 17:01:34 +01:00
|
|
|
for( glist = DPQ_FIRST( gdata->groups ); ; glist = DPQ_NEXT( glist->groups ) )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 17:01:34 +01:00
|
|
|
/* FIXME: Should check flags for match here */
|
|
|
|
if ( !(*enumplayercb)( glist->lpGData->dpid, DPPLAYERTYPE_GROUP, &glist->lpGData->name,
|
|
|
|
flags, context ) )
|
|
|
|
return DP_OK; /* User requested break */
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:01:34 +01:00
|
|
|
if ( DPQ_IS_ENDOFLIST( glist->groups ) )
|
|
|
|
break;
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:01:34 +01:00
|
|
|
return DP_OK;
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_GetGroupConnectionSettings( IDirectPlay3A *iface,
|
|
|
|
DWORD flags, DPID group, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_GetGroupConnectionSettings( &This->IDirectPlay4A_iface, flags, group,
|
|
|
|
data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_GetGroupConnectionSettings( IDirectPlay3 *iface,
|
|
|
|
DWORD flags, DPID group, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_GetGroupConnectionSettings( &This->IDirectPlay4_iface, flags, group,
|
|
|
|
data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetGroupConnectionSettings( IDirectPlay4A *iface,
|
|
|
|
DWORD flags, DPID group, void *data, DWORD *size )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME("(%p)->(0x%08lx,0x%08lx,%p,%p): stub\n", This, flags, group, data, size );
|
2013-03-29 16:44:15 +01:00
|
|
|
return DP_OK;
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:51:46 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetGroupConnectionSettings( IDirectPlay4 *iface, DWORD flags,
|
|
|
|
DPID group, void *data, DWORD *size )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,0x%08lx,%p,%p): stub\n", This, flags, group, data, size );
|
2013-03-29 16:51:46 +01:00
|
|
|
return DP_OK;
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2005-07-05 14:49:14 +02:00
|
|
|
static BOOL CALLBACK DP_GetSpLpGuidFromCompoundAddress(
|
2000-08-25 23:58:05 +02:00
|
|
|
REFGUID guidDataType,
|
|
|
|
DWORD dwDataSize,
|
|
|
|
LPCVOID lpData,
|
|
|
|
LPVOID lpContext )
|
|
|
|
{
|
|
|
|
/* Looking for the GUID of the provider to load */
|
|
|
|
if( ( IsEqualGUID( guidDataType, &DPAID_ServiceProvider ) ) ||
|
|
|
|
( IsEqualGUID( guidDataType, &DPAID_LobbyProvider ) )
|
|
|
|
)
|
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "Found SP/LP (%s) %s (data size = 0x%08lx)\n",
|
2000-08-25 23:58:05 +02:00
|
|
|
debugstr_guid( guidDataType ), debugstr_guid( lpData ), dwDataSize );
|
|
|
|
|
|
|
|
if( dwDataSize != sizeof( GUID ) )
|
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
ERR( "Invalid sp/lp guid size 0x%08lx\n", dwDataSize );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
memcpy( lpContext, lpData, dwDataSize );
|
|
|
|
|
|
|
|
/* There shouldn't be more than 1 GUID/compound address */
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Still waiting for what we want */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Find and perform a LoadLibrary on the requested SP or LP GUID */
|
2000-10-19 22:20:58 +02:00
|
|
|
static HMODULE DP_LoadSP( LPCGUID lpcGuid, LPSPINITDATA lpSpData, LPBOOL lpbIsDpSp )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
UINT i;
|
2000-08-25 23:58:05 +02:00
|
|
|
LPCSTR spSubKey = "SOFTWARE\\Microsoft\\DirectPlay\\Service Providers";
|
2002-06-01 01:06:46 +02:00
|
|
|
LPCSTR lpSubKey = "SOFTWARE\\Microsoft\\DirectPlay\\Lobby Providers";
|
2000-08-25 23:58:05 +02:00
|
|
|
LPCSTR guidDataSubKey = "Guid";
|
|
|
|
LPCSTR majVerDataSubKey = "dwReserved1";
|
|
|
|
LPCSTR minVerDataSubKey = "dwReserved2";
|
|
|
|
LPCSTR pathSubKey = "Path";
|
|
|
|
|
|
|
|
TRACE( " request to load %s\n", debugstr_guid( lpcGuid ) );
|
|
|
|
|
|
|
|
/* FIXME: Cloned code with a quick hack. */
|
|
|
|
for( i=0; i<2; i++ )
|
|
|
|
{
|
|
|
|
HKEY hkResult;
|
|
|
|
LPCSTR searchSubKey;
|
|
|
|
char subKeyName[51];
|
|
|
|
DWORD dwIndex, sizeOfSubKeyName=50;
|
|
|
|
FILETIME filetime;
|
|
|
|
|
|
|
|
(i == 0) ? (searchSubKey = spSubKey ) : (searchSubKey = lpSubKey );
|
2014-01-12 10:44:32 +01:00
|
|
|
*lpbIsDpSp = (i == 0);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
/* Need to loop over the service providers in the registry */
|
|
|
|
if( RegOpenKeyExA( HKEY_LOCAL_MACHINE, searchSubKey,
|
|
|
|
0, KEY_READ, &hkResult ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
/* Hmmm. Does this mean that there are no service providers? */
|
|
|
|
ERR(": no service providers?\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Traverse all the service providers we have available */
|
|
|
|
for( dwIndex=0;
|
|
|
|
RegEnumKeyExA( hkResult, dwIndex, subKeyName, &sizeOfSubKeyName,
|
|
|
|
NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS;
|
|
|
|
++dwIndex, sizeOfSubKeyName=51 )
|
|
|
|
{
|
|
|
|
|
|
|
|
HKEY hkServiceProvider;
|
|
|
|
GUID serviceProviderGUID;
|
|
|
|
DWORD returnType, sizeOfReturnBuffer = 255;
|
|
|
|
char returnBuffer[256];
|
2000-11-16 01:28:52 +01:00
|
|
|
WCHAR buff[51];
|
|
|
|
DWORD dwTemp, len;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
TRACE(" this time through: %s\n", subKeyName );
|
2000-05-23 03:16:36 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Get a handle for this particular service provider */
|
|
|
|
if( RegOpenKeyExA( hkResult, subKeyName, 0, KEY_READ,
|
|
|
|
&hkServiceProvider ) != ERROR_SUCCESS )
|
2000-05-23 03:16:36 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ERR(": what the heck is going on?\n" );
|
|
|
|
continue;
|
2000-05-23 03:16:36 +02:00
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( RegQueryValueExA( hkServiceProvider, guidDataSubKey,
|
2005-07-07 14:08:42 +02:00
|
|
|
NULL, &returnType, (LPBYTE)returnBuffer,
|
2000-08-25 23:58:05 +02:00
|
|
|
&sizeOfReturnBuffer ) != ERROR_SUCCESS )
|
2000-05-23 03:16:36 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ERR(": missing GUID registry data members\n" );
|
|
|
|
continue;
|
2000-05-23 03:16:36 +02:00
|
|
|
}
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* FIXME: Check return types to ensure we're interpreting data right */
|
2018-09-10 22:49:38 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, ARRAY_SIZE( buff ));
|
2004-01-23 21:57:26 +01:00
|
|
|
CLSIDFromString( buff, &serviceProviderGUID );
|
2000-08-25 23:58:05 +02:00
|
|
|
/* FIXME: Have I got a memory leak on the serviceProviderGUID? */
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Determine if this is the Service Provider that the user asked for */
|
|
|
|
if( !IsEqualGUID( &serviceProviderGUID, lpcGuid ) )
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
if( i == 0 ) /* DP SP */
|
|
|
|
{
|
|
|
|
len = MultiByteToWideChar( CP_ACP, 0, subKeyName, -1, NULL, 0 );
|
|
|
|
lpSpData->lpszName = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, subKeyName, -1, lpSpData->lpszName, len );
|
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
sizeOfReturnBuffer = 255;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Get dwReserved1 */
|
|
|
|
if( RegQueryValueExA( hkServiceProvider, majVerDataSubKey,
|
2005-07-07 14:08:42 +02:00
|
|
|
NULL, &returnType, (LPBYTE)returnBuffer,
|
2000-08-25 23:58:05 +02:00
|
|
|
&sizeOfReturnBuffer ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR(": missing dwReserved1 registry data members\n") ;
|
|
|
|
continue;
|
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
if( i == 0 )
|
2002-05-23 04:53:10 +02:00
|
|
|
memcpy( &lpSpData->dwReserved1, returnBuffer, sizeof(lpSpData->dwReserved1) );
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
sizeOfReturnBuffer = 255;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Get dwReserved2 */
|
|
|
|
if( RegQueryValueExA( hkServiceProvider, minVerDataSubKey,
|
2005-07-07 14:08:42 +02:00
|
|
|
NULL, &returnType, (LPBYTE)returnBuffer,
|
2000-08-25 23:58:05 +02:00
|
|
|
&sizeOfReturnBuffer ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR(": missing dwReserved1 registry data members\n") ;
|
|
|
|
continue;
|
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
if( i == 0 )
|
2002-05-23 04:53:10 +02:00
|
|
|
memcpy( &lpSpData->dwReserved2, returnBuffer, sizeof(lpSpData->dwReserved2) );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
sizeOfReturnBuffer = 255;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Get the path for this service provider */
|
|
|
|
if( ( dwTemp = RegQueryValueExA( hkServiceProvider, pathSubKey,
|
2005-07-07 14:08:42 +02:00
|
|
|
NULL, NULL, (LPBYTE)returnBuffer,
|
2000-08-25 23:58:05 +02:00
|
|
|
&sizeOfReturnBuffer ) ) != ERROR_SUCCESS )
|
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
ERR(": missing PATH registry data members: 0x%08lx\n", dwTemp );
|
2000-08-25 23:58:05 +02:00
|
|
|
continue;
|
|
|
|
}
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
TRACE( "Loading %s\n", returnBuffer );
|
2000-08-25 23:58:05 +02:00
|
|
|
return LoadLibraryA( returnBuffer );
|
|
|
|
}
|
|
|
|
}
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
return 0;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_InitializeDPSP( IDirectPlayImpl *This, HMODULE hServiceProvider )
|
2001-04-12 23:10:54 +02:00
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
LPDPSP_SPINIT SPInit;
|
|
|
|
|
|
|
|
/* Initialize the service provider by calling SPInit */
|
|
|
|
SPInit = (LPDPSP_SPINIT)GetProcAddress( hServiceProvider, "SPInit" );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
if( SPInit == NULL )
|
|
|
|
{
|
|
|
|
ERR( "Service provider doesn't provide SPInit interface?\n" );
|
|
|
|
FreeLibrary( hServiceProvider );
|
|
|
|
return DPERR_UNAVAILABLE;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2001-04-12 23:10:54 +02:00
|
|
|
|
|
|
|
TRACE( "Calling SPInit (DP SP entry point)\n" );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
hr = (*SPInit)( &This->dp2->spData );
|
|
|
|
|
|
|
|
if( FAILED(hr) )
|
|
|
|
{
|
|
|
|
ERR( "DP SP Initialization failed: %s\n", DPLAYX_HresultToString(hr) );
|
|
|
|
FreeLibrary( hServiceProvider );
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Need to verify the sanity of the returned callback table
|
|
|
|
* using IsBadCodePtr */
|
|
|
|
This->dp2->bSPInitialized = TRUE;
|
|
|
|
|
|
|
|
/* This interface is now initialized as a DP object */
|
|
|
|
This->dp2->connectionInitialized = DP_SERVICE_PROVIDER;
|
|
|
|
|
|
|
|
/* Store the handle of the module so that we can unload it later */
|
|
|
|
This->dp2->hServiceProvider = hServiceProvider;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_InitializeDPLSP( IDirectPlayImpl *This, HMODULE hLobbyProvider )
|
2001-04-12 23:10:54 +02:00
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
LPSP_INIT DPLSPInit;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
/* Initialize the service provider by calling SPInit */
|
|
|
|
DPLSPInit = (LPSP_INIT)GetProcAddress( hLobbyProvider, "DPLSPInit" );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
if( DPLSPInit == NULL )
|
|
|
|
{
|
|
|
|
ERR( "Service provider doesn't provide DPLSPInit interface?\n" );
|
|
|
|
FreeLibrary( hLobbyProvider );
|
|
|
|
return DPERR_UNAVAILABLE;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2001-04-12 23:10:54 +02:00
|
|
|
|
|
|
|
TRACE( "Calling DPLSPInit (DPL SP entry point)\n" );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
hr = (*DPLSPInit)( &This->dp2->dplspData );
|
|
|
|
|
|
|
|
if( FAILED(hr) )
|
|
|
|
{
|
|
|
|
ERR( "DPL SP Initialization failed: %s\n", DPLAYX_HresultToString(hr) );
|
|
|
|
FreeLibrary( hLobbyProvider );
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Need to verify the sanity of the returned callback table
|
|
|
|
* using IsBadCodePtr */
|
|
|
|
|
|
|
|
This->dp2->bDPLSPInitialized = TRUE;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
/* This interface is now initialized as a lobby object */
|
|
|
|
This->dp2->connectionInitialized = DP_LOBBY_PROVIDER;
|
|
|
|
|
|
|
|
/* Store the handle of the module so that we can unload it later */
|
|
|
|
This->dp2->hDPLobbyProvider = hLobbyProvider;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-12 23:10:54 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_InitializeConnection( IDirectPlay3A *iface,
|
|
|
|
void *connection, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_InitializeConnection( &This->IDirectPlay4A_iface, connection, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_InitializeConnection( IDirectPlay3 *iface,
|
|
|
|
void *connection, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_InitializeConnection( &This->IDirectPlay4_iface, connection, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:02:30 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_InitializeConnection( IDirectPlay4A *iface,
|
|
|
|
void *connection, DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:02:30 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_InitializeConnection( &This->IDirectPlay4_iface, connection, flags );
|
|
|
|
}
|
1999-11-25 23:04:53 +01:00
|
|
|
|
2013-03-29 17:02:30 +01:00
|
|
|
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;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(%p,0x%08lx)\n", This, connection, flags );
|
2001-04-12 23:10:54 +02:00
|
|
|
|
2013-03-29 17:02:30 +01:00
|
|
|
if ( !connection )
|
|
|
|
return DPERR_INVALIDPARAMS;
|
1999-11-25 23:04:53 +01:00
|
|
|
|
2013-03-29 17:02:30 +01:00
|
|
|
if ( flags )
|
|
|
|
return DPERR_INVALIDFLAGS;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2013-03-29 17:02:30 +01:00
|
|
|
if ( This->dp2->connectionInitialized != NO_PROVIDER )
|
|
|
|
return DPERR_ALREADYINITIALIZED;
|
1999-11-25 23:04:53 +01:00
|
|
|
|
2013-03-29 17:02:30 +01:00
|
|
|
/* Find out what the requested SP is and how large this buffer is */
|
|
|
|
hr = DPL_EnumAddress( DP_GetSpLpGuidFromCompoundAddress, connection, size, &sp );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-03-29 17:02:30 +01:00
|
|
|
if ( FAILED(hr) )
|
|
|
|
{
|
|
|
|
ERR( "Invalid compound address?\n" );
|
|
|
|
return DPERR_UNAVAILABLE;
|
|
|
|
}
|
2001-04-12 23:10:54 +02:00
|
|
|
|
2013-03-29 17:02:30 +01:00
|
|
|
/* Load the service provider */
|
|
|
|
servprov = DP_LoadSP( &sp, &This->dp2->spData, &is_dp_sp );
|
2001-04-12 23:10:54 +02:00
|
|
|
|
2013-03-29 17:02:30 +01:00
|
|
|
if ( !servprov )
|
|
|
|
{
|
|
|
|
ERR( "Unable to load service provider %s\n", debugstr_guid(&sp) );
|
|
|
|
return DPERR_UNAVAILABLE;
|
|
|
|
}
|
2000-10-19 22:20:58 +02:00
|
|
|
|
2013-03-29 17:02:30 +01:00
|
|
|
if ( is_dp_sp )
|
|
|
|
{
|
|
|
|
/* Fill in what we can of the Service Provider required information.
|
|
|
|
* The rest was be done in DP_LoadSP
|
|
|
|
*/
|
|
|
|
This->dp2->spData.lpAddress = connection;
|
|
|
|
This->dp2->spData.dwAddressSize = size;
|
|
|
|
This->dp2->spData.lpGuid = &sp;
|
|
|
|
hr = DP_InitializeDPSP( This, servprov );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
This->dp2->dplspData.lpAddress = connection;
|
|
|
|
hr = DP_InitializeDPLSP( This, servprov );
|
|
|
|
}
|
2001-04-12 23:10:54 +02:00
|
|
|
|
2013-03-29 17:02:30 +01:00
|
|
|
if ( FAILED(hr) )
|
|
|
|
return hr;
|
2001-04-12 23:10:54 +02:00
|
|
|
|
2013-03-29 17:02:30 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_SecureOpen( IDirectPlay3A *iface,
|
|
|
|
const DPSESSIONDESC2 *sdesc, DWORD flags, const DPSECURITYDESC *security,
|
|
|
|
const DPCREDENTIALS *credentials )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_SecureOpen( &This->IDirectPlay4A_iface, sdesc, flags, security,
|
|
|
|
credentials );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_SecureOpen( IDirectPlay3 *iface,
|
|
|
|
const DPSESSIONDESC2 *sdesc, DWORD flags, const DPSECURITYDESC *security,
|
|
|
|
const DPCREDENTIALS *credentials )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_SecureOpen( &This->IDirectPlay4_iface, sdesc, flags, security,
|
|
|
|
credentials );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_SecureOpen( IDirectPlay4A *iface,
|
|
|
|
const DPSESSIONDESC2 *lpsd, DWORD dwFlags, const DPSECURITYDESC *lpSecurity,
|
|
|
|
const DPCREDENTIALS *lpCredentials )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return DP_SecureOpen( This, lpsd, dwFlags, lpSecurity, lpCredentials, TRUE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:00 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_SecureOpen( IDirectPlay4 *iface,
|
|
|
|
const DPSESSIONDESC2 *lpsd, DWORD dwFlags, const DPSECURITYDESC *lpSecurity,
|
|
|
|
const DPCREDENTIALS *lpCredentials )
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
return DP_SecureOpen( This, lpsd, dwFlags, lpSecurity, lpCredentials, FALSE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_SendChatMessage( IDirectPlay3A *iface, DPID from, DPID to,
|
|
|
|
DWORD flags, DPCHAT *chatmsg )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_SendChatMessage( &This->IDirectPlay4A_iface, from, to, flags, chatmsg );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_SendChatMessage( IDirectPlay3 *iface, DPID from, DPID to,
|
|
|
|
DWORD flags, DPCHAT *chatmsg )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_SendChatMessage( &This->IDirectPlay4_iface, from, to, flags, chatmsg );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_SendChatMessage( IDirectPlay4A *iface, DPID from,
|
|
|
|
DPID to, DWORD flags, DPCHAT *chatmsg )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME("(%p)->(0x%08lx,0x%08lx,0x%08lx,%p): stub\n", This, from, to, flags, chatmsg );
|
2013-03-29 16:44:15 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:51:46 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_SendChatMessage( IDirectPlay4 *iface, DPID from, DPID to,
|
|
|
|
DWORD flags, DPCHAT *chatmsg )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,0x%08lx,0x%08lx,%p): stub\n", This, from, to, flags, chatmsg );
|
2013-03-29 16:51:46 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_SetGroupConnectionSettings( IDirectPlay3A *iface,
|
|
|
|
DWORD flags, DPID group, DPLCONNECTION *connection )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_SetGroupConnectionSettings( &This->IDirectPlay4A_iface, flags, group,
|
|
|
|
connection );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_SetGroupConnectionSettings( IDirectPlay3 *iface,
|
|
|
|
DWORD flags, DPID group, DPLCONNECTION *connection )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_SetGroupConnectionSettings( &This->IDirectPlay4_iface, flags, group,
|
|
|
|
connection );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_SetGroupConnectionSettings( IDirectPlay4A *iface,
|
|
|
|
DWORD flags, DPID group, DPLCONNECTION *connection )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME("(%p)->(0x%08lx,0x%08lx,%p): stub\n", This, flags, group, connection );
|
2013-03-29 16:44:15 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:51:46 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_SetGroupConnectionSettings( IDirectPlay4 *iface, DWORD flags,
|
|
|
|
DPID group, DPLCONNECTION *connection )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,0x%08lx,%p): stub\n", This, flags, group, connection );
|
2013-03-29 16:51:46 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_StartSession( IDirectPlay3A *iface, DWORD flags,
|
|
|
|
DPID group )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_StartSession( &This->IDirectPlay4A_iface, flags, group );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_StartSession( IDirectPlay3 *iface, DWORD flags,
|
|
|
|
DPID group )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_StartSession( &This->IDirectPlay4_iface, flags, group );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:49 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_StartSession( IDirectPlay4A *iface, DWORD flags,
|
|
|
|
DPID group )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:49 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_StartSession( &This->IDirectPlay4_iface, flags, group );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:51:46 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_StartSession( IDirectPlay4 *iface, DWORD flags, DPID group )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,0x%08lx): stub\n", This, flags, group );
|
2013-03-29 16:51:46 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_GetGroupFlags( IDirectPlay3A *iface, DPID group,
|
|
|
|
DWORD *flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_GetGroupFlags( &This->IDirectPlay4A_iface, group, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_GetGroupFlags( IDirectPlay3 *iface, DPID group,
|
|
|
|
DWORD *flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_GetGroupFlags( &This->IDirectPlay4_iface, group, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:49 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetGroupFlags( IDirectPlay4A *iface, DPID group,
|
|
|
|
DWORD *flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:49 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_GetGroupFlags( &This->IDirectPlay4_iface, group, flags );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:51:46 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetGroupFlags( IDirectPlay4 *iface, DPID group,
|
|
|
|
DWORD *flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p): stub\n", This, group, flags );
|
2013-03-29 16:51:46 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_GetGroupParent( IDirectPlay3A *iface, DPID group,
|
|
|
|
DPID *parent )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_GetGroupParent( &This->IDirectPlay4A_iface, group, parent );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_GetGroupParent( IDirectPlay3 *iface, DPID group,
|
|
|
|
DPID *parent )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_GetGroupParent( &This->IDirectPlay4_iface, group, parent );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:03:19 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetGroupParent( IDirectPlay4A *iface, DPID group,
|
|
|
|
DPID *parent )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:03:19 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_GetGroupParent( &This->IDirectPlay4_iface, group, parent );
|
|
|
|
}
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 17:03:19 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetGroupParent( IDirectPlay4 *iface, DPID group,
|
|
|
|
DPID *parent )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
lpGroupData gdata;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx,%p)\n", This, group, parent );
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 17:03:19 +01:00
|
|
|
if ( ( gdata = DP_FindAnyGroup( This, group ) ) == NULL )
|
|
|
|
return DPERR_INVALIDGROUP;
|
2000-06-07 05:44:36 +02:00
|
|
|
|
2013-03-29 17:03:19 +01:00
|
|
|
*parent = gdata->dpid;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-03-29 17:03:19 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_GetPlayerAccount( IDirectPlay3A *iface, DPID player,
|
|
|
|
DWORD flags, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_GetPlayerAccount( &This->IDirectPlay4A_iface, player, flags, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_GetPlayerAccount( IDirectPlay3 *iface, DPID player,
|
|
|
|
DWORD flags, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_GetPlayerAccount( &This->IDirectPlay4_iface, player, flags, data, size );
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:44:15 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetPlayerAccount( IDirectPlay4A *iface, DPID player,
|
|
|
|
DWORD flags, void *data, DWORD *size )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:45:09 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME("(%p)->(0x%08lx,0x%08lx,%p,%p): stub\n", This, player, flags, data, size );
|
2013-03-29 16:44:15 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:51:46 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetPlayerAccount( IDirectPlay4 *iface, DPID player,
|
|
|
|
DWORD flags, void *data, DWORD *size )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,0x%08lx,%p,%p): stub\n", This, player, flags, data, size );
|
2013-03-29 16:51:46 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3AImpl_GetPlayerFlags( IDirectPlay3A *iface, DPID player,
|
|
|
|
DWORD *flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface );
|
|
|
|
return IDirectPlayX_GetPlayerFlags( &This->IDirectPlay4A_iface, player, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay3Impl_GetPlayerFlags( IDirectPlay3 *iface, DPID player,
|
|
|
|
DWORD *flags )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay3( iface );
|
|
|
|
return IDirectPlayX_GetPlayerFlags( &This->IDirectPlay4_iface, player, flags );
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:49 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetPlayerFlags( IDirectPlay4A *iface, DPID player,
|
|
|
|
DWORD *flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:49 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_GetPlayerFlags( &This->IDirectPlay4_iface, player, flags );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:51:46 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetPlayerFlags( IDirectPlay4 *iface, DPID player,
|
|
|
|
DWORD *flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p): stub\n", This, player, flags );
|
2013-03-29 16:51:46 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:49 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetGroupOwner( IDirectPlay4A *iface, DPID group,
|
|
|
|
DPID *owner )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:49 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_GetGroupOwner( &This->IDirectPlay4_iface, group, owner );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:51:46 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetGroupOwner( IDirectPlay4 *iface, DPID group,
|
|
|
|
DPID *owner )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p): stub\n", This, group, owner );
|
2013-03-29 16:51:46 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:08:49 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_SetGroupOwner( IDirectPlay4A *iface, DPID group,
|
|
|
|
DPID owner )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:08:49 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_SetGroupOwner( &This->IDirectPlay4_iface, group, owner );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 16:51:46 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_SetGroupOwner( IDirectPlay4 *iface, DPID group ,
|
|
|
|
DPID owner )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,0x%08lx): stub\n", This, group, owner );
|
2013-03-29 16:51:46 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:05:50 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_SendEx( IDirectPlay4A *iface, DPID from, DPID to,
|
|
|
|
DWORD flags, void *data, DWORD size, DWORD priority, DWORD timeout, void *context,
|
|
|
|
DWORD *msgid )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 17:05:50 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_SendEx( &This->IDirectPlay4_iface, from, to, flags, data, size, priority,
|
|
|
|
timeout, context, msgid );
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:05:50 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_SendEx( IDirectPlay4 *iface, DPID from, DPID to,
|
|
|
|
DWORD flags, void *data, DWORD size, DWORD priority, DWORD timeout, void *context,
|
|
|
|
DWORD *msgid )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2008-08-05 03:56:22 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,0x%08lx,0x%08lx,%p,0x%08lx,0x%08lx,0x%08lx,%p,%p): semi-stub\n",
|
2013-03-29 17:05:50 +01:00
|
|
|
This, from, to, flags, data, size, priority, timeout, context, msgid );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:05:50 +01:00
|
|
|
if ( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
|
|
return DPERR_UNINITIALIZED;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:05:50 +01:00
|
|
|
/* FIXME: Add parameter checking */
|
|
|
|
/* FIXME: First call to this needs to acquire a message id which will be
|
|
|
|
* used for multiple sends
|
|
|
|
*/
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:05:50 +01:00
|
|
|
/* NOTE: Can't send messages to yourself - this will be trapped in receive */
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:05:50 +01:00
|
|
|
/* Verify that the message is being sent from a valid local player. The
|
|
|
|
* from player may be anonymous DPID_UNKNOWN
|
|
|
|
*/
|
|
|
|
if ( from != DPID_UNKNOWN && !DP_FindPlayer( This, from ) )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
WARN( "INFO: Invalid from player 0x%08lx\n", from );
|
2013-03-29 17:05:50 +01:00
|
|
|
return DPERR_INVALIDPLAYER;
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:05:50 +01:00
|
|
|
/* 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 ( to == DPID_ALLPLAYERS )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 17:05:50 +01:00
|
|
|
/* 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 */
|
|
|
|
FIXME( "Send to all players using EnumPlayersInGroup\n" );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
2013-03-29 17:05:50 +01:00
|
|
|
else if ( DP_FindPlayer( This, to ) )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 17:05:50 +01:00
|
|
|
/* 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 );
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
2013-03-29 17:05:50 +01:00
|
|
|
else if ( DP_FindAnyGroup( This, to ) )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 17:05:50 +01:00
|
|
|
/* 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" );
|
2000-08-30 01:55:06 +02:00
|
|
|
|
|
|
|
}
|
2013-03-29 17:05:50 +01:00
|
|
|
else
|
|
|
|
return DPERR_INVALIDPLAYER;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
/* FIXME: Should return what the send returned */
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
static HRESULT DP_SP_SendEx( IDirectPlayImpl *This, DWORD dwFlags, void *lpData, DWORD dwDataSize,
|
|
|
|
DWORD dwPriority, DWORD dwTimeout, void *lpContext, DWORD *lpdwMsgID )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
|
|
|
LPDPMSG lpMElem;
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
FIXME( ": stub\n" );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
/* FIXME: This queuing should only be for async messages */
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2005-03-24 22:01:35 +01:00
|
|
|
lpMElem = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpMElem ) );
|
|
|
|
lpMElem->msg = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwDataSize );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
CopyMemory( lpMElem->msg, lpData, dwDataSize );
|
|
|
|
|
2000-08-30 01:55:06 +02:00
|
|
|
/* FIXME: Need to queue based on priority */
|
2002-06-01 01:06:46 +02:00
|
|
|
DPQ_INSERT( This->dp2->sendMsgs, lpMElem, msgs );
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:06:39 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_GetMessageQueue( IDirectPlay4A *iface, DPID from, DPID to,
|
|
|
|
DWORD flags, DWORD *msgs, DWORD *bytes )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 17:06:39 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_GetMessageQueue( &This->IDirectPlay4_iface, from, to, flags, msgs, bytes );
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:06:39 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_GetMessageQueue( IDirectPlay4 *iface, DPID from, DPID to,
|
|
|
|
DWORD flags, DWORD *msgs, DWORD *bytes )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
|
|
|
HRESULT hr = DP_OK;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,0x%08lx,0x%08lx,%p,%p): semi-stub\n", This, from, to, flags, msgs, bytes );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:06:39 +01:00
|
|
|
/* FIXME: Do we need to do from and to sanity checking here? */
|
|
|
|
/* FIXME: What about sends which are not immediate? */
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:06:39 +01:00
|
|
|
if ( This->dp2->spData.lpCB->GetMessageQueue )
|
|
|
|
{
|
|
|
|
DPSP_GETMESSAGEQUEUEDATA data;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2013-03-29 17:06:39 +01:00
|
|
|
FIXME( "Calling SP GetMessageQueue - is it right?\n" );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:06:39 +01:00
|
|
|
/* FIXME: None of this is documented :( */
|
|
|
|
data.lpISP = This->dp2->spData.lpISP;
|
|
|
|
data.dwFlags = flags;
|
|
|
|
data.idFrom = from;
|
|
|
|
data.idTo = to;
|
|
|
|
data.lpdwNumMsgs = msgs;
|
|
|
|
data.lpdwNumBytes = bytes;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:06:39 +01:00
|
|
|
hr = (*This->dp2->spData.lpCB->GetMessageQueue)( &data );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
FIXME( "No SP for GetMessageQueue - fake some data\n" );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-03-29 17:06:39 +01:00
|
|
|
return hr;
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
static HRESULT dplay_cancelmsg ( IDirectPlayImpl* This, DWORD msgid, DWORD flags, DWORD minprio,
|
|
|
|
DWORD maxprio )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
2013-03-29 17:07:24 +01:00
|
|
|
HRESULT hr = DP_OK;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,0x%08lx): semi stub\n", This, msgid, flags );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
if ( This->dp2->spData.lpCB->Cancel )
|
|
|
|
{
|
|
|
|
DPSP_CANCELDATA data;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
TRACE( "Calling SP Cancel\n" );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
/* FIXME: Undocumented callback */
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
data.lpISP = This->dp2->spData.lpISP;
|
|
|
|
data.dwFlags = flags;
|
|
|
|
data.lprglpvSPMsgID = NULL;
|
|
|
|
data.cSPMsgID = msgid;
|
|
|
|
data.dwMinPriority = minprio;
|
|
|
|
data.dwMaxPriority = maxprio;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
hr = (*This->dp2->spData.lpCB->Cancel)( &data );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
FIXME( "SP doesn't implement Cancel\n" );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_CancelMessage( IDirectPlay4A *iface, DWORD msgid,
|
|
|
|
DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:07:24 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_CancelMessage( &This->IDirectPlay4_iface, msgid, flags );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_CancelMessage( IDirectPlay4 *iface, DWORD msgid,
|
|
|
|
DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:07:24 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
if ( flags != 0 )
|
|
|
|
return DPERR_INVALIDFLAGS;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
if ( msgid == 0 )
|
|
|
|
flags |= DPCANCELSEND_ALL;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
return dplay_cancelmsg( This, msgid, flags, 0, 0 );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4AImpl_CancelPriority( IDirectPlay4A *iface, DWORD minprio,
|
|
|
|
DWORD maxprio, DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:07:24 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
|
|
|
return IDirectPlayX_CancelPriority( &This->IDirectPlay4_iface, minprio, maxprio, flags );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
static HRESULT WINAPI IDirectPlay4Impl_CancelPriority( IDirectPlay4 *iface, DWORD minprio,
|
|
|
|
DWORD maxprio, DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 17:07:24 +01:00
|
|
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
if ( flags != 0 )
|
|
|
|
return DPERR_INVALIDFLAGS;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-03-29 17:07:24 +01:00
|
|
|
return dplay_cancelmsg( This, 0, DPCANCELSEND_PRIORITY, minprio, maxprio );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-03-29 17:14:07 +01:00
|
|
|
static const IDirectPlay2Vtbl dp2_vt =
|
|
|
|
{
|
|
|
|
IDirectPlay2Impl_QueryInterface,
|
|
|
|
IDirectPlay2Impl_AddRef,
|
|
|
|
IDirectPlay2Impl_Release,
|
|
|
|
IDirectPlay2Impl_AddPlayerToGroup,
|
|
|
|
IDirectPlay2Impl_Close,
|
|
|
|
IDirectPlay2Impl_CreateGroup,
|
|
|
|
IDirectPlay2Impl_CreatePlayer,
|
|
|
|
IDirectPlay2Impl_DeletePlayerFromGroup,
|
|
|
|
IDirectPlay2Impl_DestroyGroup,
|
|
|
|
IDirectPlay2Impl_DestroyPlayer,
|
|
|
|
IDirectPlay2Impl_EnumGroupPlayers,
|
|
|
|
IDirectPlay2Impl_EnumGroups,
|
|
|
|
IDirectPlay2Impl_EnumPlayers,
|
|
|
|
IDirectPlay2Impl_EnumSessions,
|
|
|
|
IDirectPlay2Impl_GetCaps,
|
|
|
|
IDirectPlay2Impl_GetGroupData,
|
|
|
|
IDirectPlay2Impl_GetGroupName,
|
|
|
|
IDirectPlay2Impl_GetMessageCount,
|
|
|
|
IDirectPlay2Impl_GetPlayerAddress,
|
|
|
|
IDirectPlay2Impl_GetPlayerCaps,
|
|
|
|
IDirectPlay2Impl_GetPlayerData,
|
|
|
|
IDirectPlay2Impl_GetPlayerName,
|
|
|
|
IDirectPlay2Impl_GetSessionDesc,
|
|
|
|
IDirectPlay2Impl_Initialize,
|
|
|
|
IDirectPlay2Impl_Open,
|
|
|
|
IDirectPlay2Impl_Receive,
|
|
|
|
IDirectPlay2Impl_Send,
|
|
|
|
IDirectPlay2Impl_SetGroupData,
|
|
|
|
IDirectPlay2Impl_SetGroupName,
|
|
|
|
IDirectPlay2Impl_SetPlayerData,
|
|
|
|
IDirectPlay2Impl_SetPlayerName,
|
|
|
|
IDirectPlay2Impl_SetSessionDesc
|
|
|
|
};
|
|
|
|
|
2013-03-29 17:13:11 +01:00
|
|
|
static const IDirectPlay2Vtbl dp2A_vt =
|
|
|
|
{
|
|
|
|
IDirectPlay2AImpl_QueryInterface,
|
|
|
|
IDirectPlay2AImpl_AddRef,
|
|
|
|
IDirectPlay2AImpl_Release,
|
|
|
|
IDirectPlay2AImpl_AddPlayerToGroup,
|
|
|
|
IDirectPlay2AImpl_Close,
|
|
|
|
IDirectPlay2AImpl_CreateGroup,
|
|
|
|
IDirectPlay2AImpl_CreatePlayer,
|
|
|
|
IDirectPlay2AImpl_DeletePlayerFromGroup,
|
|
|
|
IDirectPlay2AImpl_DestroyGroup,
|
|
|
|
IDirectPlay2AImpl_DestroyPlayer,
|
|
|
|
IDirectPlay2AImpl_EnumGroupPlayers,
|
|
|
|
IDirectPlay2AImpl_EnumGroups,
|
|
|
|
IDirectPlay2AImpl_EnumPlayers,
|
|
|
|
IDirectPlay2AImpl_EnumSessions,
|
|
|
|
IDirectPlay2AImpl_GetCaps,
|
|
|
|
IDirectPlay2AImpl_GetGroupData,
|
|
|
|
IDirectPlay2AImpl_GetGroupName,
|
|
|
|
IDirectPlay2AImpl_GetMessageCount,
|
|
|
|
IDirectPlay2AImpl_GetPlayerAddress,
|
|
|
|
IDirectPlay2AImpl_GetPlayerCaps,
|
|
|
|
IDirectPlay2AImpl_GetPlayerData,
|
|
|
|
IDirectPlay2AImpl_GetPlayerName,
|
|
|
|
IDirectPlay2AImpl_GetSessionDesc,
|
|
|
|
IDirectPlay2AImpl_Initialize,
|
|
|
|
IDirectPlay2AImpl_Open,
|
|
|
|
IDirectPlay2AImpl_Receive,
|
|
|
|
IDirectPlay2AImpl_Send,
|
|
|
|
IDirectPlay2AImpl_SetGroupData,
|
|
|
|
IDirectPlay2AImpl_SetGroupName,
|
|
|
|
IDirectPlay2AImpl_SetPlayerData,
|
|
|
|
IDirectPlay2AImpl_SetPlayerName,
|
|
|
|
IDirectPlay2AImpl_SetSessionDesc
|
|
|
|
};
|
|
|
|
|
2013-03-29 17:15:57 +01:00
|
|
|
static const IDirectPlay3Vtbl dp3_vt =
|
|
|
|
{
|
|
|
|
IDirectPlay3Impl_QueryInterface,
|
|
|
|
IDirectPlay3Impl_AddRef,
|
|
|
|
IDirectPlay3Impl_Release,
|
|
|
|
IDirectPlay3Impl_AddPlayerToGroup,
|
|
|
|
IDirectPlay3Impl_Close,
|
|
|
|
IDirectPlay3Impl_CreateGroup,
|
|
|
|
IDirectPlay3Impl_CreatePlayer,
|
|
|
|
IDirectPlay3Impl_DeletePlayerFromGroup,
|
|
|
|
IDirectPlay3Impl_DestroyGroup,
|
|
|
|
IDirectPlay3Impl_DestroyPlayer,
|
|
|
|
IDirectPlay3Impl_EnumGroupPlayers,
|
|
|
|
IDirectPlay3Impl_EnumGroups,
|
|
|
|
IDirectPlay3Impl_EnumPlayers,
|
|
|
|
IDirectPlay3Impl_EnumSessions,
|
|
|
|
IDirectPlay3Impl_GetCaps,
|
|
|
|
IDirectPlay3Impl_GetGroupData,
|
|
|
|
IDirectPlay3Impl_GetGroupName,
|
|
|
|
IDirectPlay3Impl_GetMessageCount,
|
|
|
|
IDirectPlay3Impl_GetPlayerAddress,
|
|
|
|
IDirectPlay3Impl_GetPlayerCaps,
|
|
|
|
IDirectPlay3Impl_GetPlayerData,
|
|
|
|
IDirectPlay3Impl_GetPlayerName,
|
|
|
|
IDirectPlay3Impl_GetSessionDesc,
|
|
|
|
IDirectPlay3Impl_Initialize,
|
|
|
|
IDirectPlay3Impl_Open,
|
|
|
|
IDirectPlay3Impl_Receive,
|
|
|
|
IDirectPlay3Impl_Send,
|
|
|
|
IDirectPlay3Impl_SetGroupData,
|
|
|
|
IDirectPlay3Impl_SetGroupName,
|
|
|
|
IDirectPlay3Impl_SetPlayerData,
|
|
|
|
IDirectPlay3Impl_SetPlayerName,
|
|
|
|
IDirectPlay3Impl_SetSessionDesc,
|
|
|
|
IDirectPlay3Impl_AddGroupToGroup,
|
|
|
|
IDirectPlay3Impl_CreateGroupInGroup,
|
|
|
|
IDirectPlay3Impl_DeleteGroupFromGroup,
|
|
|
|
IDirectPlay3Impl_EnumConnections,
|
|
|
|
IDirectPlay3Impl_EnumGroupsInGroup,
|
|
|
|
IDirectPlay3Impl_GetGroupConnectionSettings,
|
|
|
|
IDirectPlay3Impl_InitializeConnection,
|
|
|
|
IDirectPlay3Impl_SecureOpen,
|
|
|
|
IDirectPlay3Impl_SendChatMessage,
|
|
|
|
IDirectPlay3Impl_SetGroupConnectionSettings,
|
|
|
|
IDirectPlay3Impl_StartSession,
|
|
|
|
IDirectPlay3Impl_GetGroupFlags,
|
|
|
|
IDirectPlay3Impl_GetGroupParent,
|
|
|
|
IDirectPlay3Impl_GetPlayerAccount,
|
|
|
|
IDirectPlay3Impl_GetPlayerFlags
|
|
|
|
};
|
|
|
|
|
2013-03-29 17:15:01 +01:00
|
|
|
static const IDirectPlay3Vtbl dp3A_vt =
|
|
|
|
{
|
|
|
|
IDirectPlay3AImpl_QueryInterface,
|
|
|
|
IDirectPlay3AImpl_AddRef,
|
|
|
|
IDirectPlay3AImpl_Release,
|
|
|
|
IDirectPlay3AImpl_AddPlayerToGroup,
|
|
|
|
IDirectPlay3AImpl_Close,
|
|
|
|
IDirectPlay3AImpl_CreateGroup,
|
|
|
|
IDirectPlay3AImpl_CreatePlayer,
|
|
|
|
IDirectPlay3AImpl_DeletePlayerFromGroup,
|
|
|
|
IDirectPlay3AImpl_DestroyGroup,
|
|
|
|
IDirectPlay3AImpl_DestroyPlayer,
|
|
|
|
IDirectPlay3AImpl_EnumGroupPlayers,
|
|
|
|
IDirectPlay3AImpl_EnumGroups,
|
|
|
|
IDirectPlay3AImpl_EnumPlayers,
|
|
|
|
IDirectPlay3AImpl_EnumSessions,
|
|
|
|
IDirectPlay3AImpl_GetCaps,
|
|
|
|
IDirectPlay3AImpl_GetGroupData,
|
|
|
|
IDirectPlay3AImpl_GetGroupName,
|
|
|
|
IDirectPlay3AImpl_GetMessageCount,
|
|
|
|
IDirectPlay3AImpl_GetPlayerAddress,
|
|
|
|
IDirectPlay3AImpl_GetPlayerCaps,
|
|
|
|
IDirectPlay3AImpl_GetPlayerData,
|
|
|
|
IDirectPlay3AImpl_GetPlayerName,
|
|
|
|
IDirectPlay3AImpl_GetSessionDesc,
|
|
|
|
IDirectPlay3AImpl_Initialize,
|
|
|
|
IDirectPlay3AImpl_Open,
|
|
|
|
IDirectPlay3AImpl_Receive,
|
|
|
|
IDirectPlay3AImpl_Send,
|
|
|
|
IDirectPlay3AImpl_SetGroupData,
|
|
|
|
IDirectPlay3AImpl_SetGroupName,
|
|
|
|
IDirectPlay3AImpl_SetPlayerData,
|
|
|
|
IDirectPlay3AImpl_SetPlayerName,
|
|
|
|
IDirectPlay3AImpl_SetSessionDesc,
|
|
|
|
IDirectPlay3AImpl_AddGroupToGroup,
|
|
|
|
IDirectPlay3AImpl_CreateGroupInGroup,
|
|
|
|
IDirectPlay3AImpl_DeleteGroupFromGroup,
|
|
|
|
IDirectPlay3AImpl_EnumConnections,
|
|
|
|
IDirectPlay3AImpl_EnumGroupsInGroup,
|
|
|
|
IDirectPlay3AImpl_GetGroupConnectionSettings,
|
|
|
|
IDirectPlay3AImpl_InitializeConnection,
|
|
|
|
IDirectPlay3AImpl_SecureOpen,
|
|
|
|
IDirectPlay3AImpl_SendChatMessage,
|
|
|
|
IDirectPlay3AImpl_SetGroupConnectionSettings,
|
|
|
|
IDirectPlay3AImpl_StartSession,
|
|
|
|
IDirectPlay3AImpl_GetGroupFlags,
|
|
|
|
IDirectPlay3AImpl_GetGroupParent,
|
|
|
|
IDirectPlay3AImpl_GetPlayerAccount,
|
|
|
|
IDirectPlay3AImpl_GetPlayerFlags
|
|
|
|
};
|
|
|
|
|
2013-03-29 16:48:57 +01:00
|
|
|
static const IDirectPlay4Vtbl dp4_vt =
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:46:02 +01:00
|
|
|
IDirectPlay4Impl_QueryInterface,
|
|
|
|
IDirectPlay4Impl_AddRef,
|
|
|
|
IDirectPlay4Impl_Release,
|
2013-03-29 17:03:51 +01:00
|
|
|
IDirectPlay4Impl_AddPlayerToGroup,
|
2013-03-29 16:52:03 +01:00
|
|
|
IDirectPlay4Impl_Close,
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlay4Impl_CreateGroup,
|
|
|
|
IDirectPlay4Impl_CreatePlayer,
|
2013-03-29 16:52:30 +01:00
|
|
|
IDirectPlay4Impl_DeletePlayerFromGroup,
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlay4Impl_DestroyGroup,
|
|
|
|
IDirectPlay4Impl_DestroyPlayer,
|
2013-03-29 16:53:07 +01:00
|
|
|
IDirectPlay4Impl_EnumGroupPlayers,
|
2013-03-29 16:43:37 +01:00
|
|
|
IDirectPlay4Impl_EnumGroups,
|
2013-03-29 16:43:08 +01:00
|
|
|
IDirectPlay4Impl_EnumPlayers,
|
2013-03-29 17:04:20 +01:00
|
|
|
IDirectPlay4Impl_EnumSessions,
|
2013-03-29 16:54:37 +01:00
|
|
|
IDirectPlay4Impl_GetCaps,
|
2013-03-29 16:54:00 +01:00
|
|
|
IDirectPlay4Impl_GetGroupData,
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlay4Impl_GetGroupName,
|
2013-03-29 16:41:22 +01:00
|
|
|
IDirectPlay4Impl_GetMessageCount,
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlay4Impl_GetPlayerAddress,
|
2013-03-29 16:55:04 +01:00
|
|
|
IDirectPlay4Impl_GetPlayerCaps,
|
2013-03-29 16:55:48 +01:00
|
|
|
IDirectPlay4Impl_GetPlayerData,
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlay4Impl_GetPlayerName,
|
|
|
|
IDirectPlay4Impl_GetSessionDesc,
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlay4Impl_Initialize,
|
2013-03-29 16:40:40 +01:00
|
|
|
IDirectPlay4Impl_Open,
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlay4Impl_Receive,
|
2013-03-29 16:41:53 +01:00
|
|
|
IDirectPlay4Impl_Send,
|
2013-03-29 16:56:47 +01:00
|
|
|
IDirectPlay4Impl_SetGroupData,
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlay4Impl_SetGroupName,
|
2013-03-29 16:57:33 +01:00
|
|
|
IDirectPlay4Impl_SetPlayerData,
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlay4Impl_SetPlayerName,
|
|
|
|
IDirectPlay4Impl_SetSessionDesc,
|
2013-03-29 16:58:20 +01:00
|
|
|
IDirectPlay4Impl_AddGroupToGroup,
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlay4Impl_CreateGroupInGroup,
|
2013-03-29 17:00:34 +01:00
|
|
|
IDirectPlay4Impl_DeleteGroupFromGroup,
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlay4Impl_EnumConnections,
|
2013-03-29 17:01:34 +01:00
|
|
|
IDirectPlay4Impl_EnumGroupsInGroup,
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlay4Impl_GetGroupConnectionSettings,
|
2013-03-29 17:02:30 +01:00
|
|
|
IDirectPlay4Impl_InitializeConnection,
|
2013-03-29 17:08:00 +01:00
|
|
|
IDirectPlay4Impl_SecureOpen,
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlay4Impl_SendChatMessage,
|
|
|
|
IDirectPlay4Impl_SetGroupConnectionSettings,
|
|
|
|
IDirectPlay4Impl_StartSession,
|
|
|
|
IDirectPlay4Impl_GetGroupFlags,
|
2013-03-29 17:03:19 +01:00
|
|
|
IDirectPlay4Impl_GetGroupParent,
|
2013-03-29 16:51:46 +01:00
|
|
|
IDirectPlay4Impl_GetPlayerAccount,
|
|
|
|
IDirectPlay4Impl_GetPlayerFlags,
|
|
|
|
IDirectPlay4Impl_GetGroupOwner,
|
|
|
|
IDirectPlay4Impl_SetGroupOwner,
|
2013-03-29 17:05:50 +01:00
|
|
|
IDirectPlay4Impl_SendEx,
|
2013-03-29 17:06:39 +01:00
|
|
|
IDirectPlay4Impl_GetMessageQueue,
|
2013-03-29 17:07:24 +01:00
|
|
|
IDirectPlay4Impl_CancelMessage,
|
|
|
|
IDirectPlay4Impl_CancelPriority
|
1999-09-28 18:35:32 +02:00
|
|
|
};
|
|
|
|
|
2013-03-29 16:48:57 +01:00
|
|
|
static const IDirectPlay4Vtbl dp4A_vt =
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-03-29 16:46:02 +01:00
|
|
|
IDirectPlay4AImpl_QueryInterface,
|
|
|
|
IDirectPlay4AImpl_AddRef,
|
|
|
|
IDirectPlay4AImpl_Release,
|
2013-03-29 16:44:15 +01:00
|
|
|
IDirectPlay4AImpl_AddPlayerToGroup,
|
|
|
|
IDirectPlay4AImpl_Close,
|
|
|
|
IDirectPlay4AImpl_CreateGroup,
|
|
|
|
IDirectPlay4AImpl_CreatePlayer,
|
|
|
|
IDirectPlay4AImpl_DeletePlayerFromGroup,
|
|
|
|
IDirectPlay4AImpl_DestroyGroup,
|
|
|
|
IDirectPlay4AImpl_DestroyPlayer,
|
|
|
|
IDirectPlay4AImpl_EnumGroupPlayers,
|
2013-03-29 16:43:37 +01:00
|
|
|
IDirectPlay4AImpl_EnumGroups,
|
2013-03-29 16:43:08 +01:00
|
|
|
IDirectPlay4AImpl_EnumPlayers,
|
2013-03-29 16:44:15 +01:00
|
|
|
IDirectPlay4AImpl_EnumSessions,
|
|
|
|
IDirectPlay4AImpl_GetCaps,
|
|
|
|
IDirectPlay4AImpl_GetGroupData,
|
|
|
|
IDirectPlay4AImpl_GetGroupName,
|
2013-03-29 16:41:22 +01:00
|
|
|
IDirectPlay4AImpl_GetMessageCount,
|
2013-03-29 16:44:15 +01:00
|
|
|
IDirectPlay4AImpl_GetPlayerAddress,
|
|
|
|
IDirectPlay4AImpl_GetPlayerCaps,
|
|
|
|
IDirectPlay4AImpl_GetPlayerData,
|
|
|
|
IDirectPlay4AImpl_GetPlayerName,
|
|
|
|
IDirectPlay4AImpl_GetSessionDesc,
|
|
|
|
IDirectPlay4AImpl_Initialize,
|
2013-03-29 16:40:40 +01:00
|
|
|
IDirectPlay4AImpl_Open,
|
2013-03-29 16:44:15 +01:00
|
|
|
IDirectPlay4AImpl_Receive,
|
2013-03-29 16:41:53 +01:00
|
|
|
IDirectPlay4AImpl_Send,
|
2013-03-29 16:44:15 +01:00
|
|
|
IDirectPlay4AImpl_SetGroupData,
|
|
|
|
IDirectPlay4AImpl_SetGroupName,
|
|
|
|
IDirectPlay4AImpl_SetPlayerData,
|
|
|
|
IDirectPlay4AImpl_SetPlayerName,
|
|
|
|
IDirectPlay4AImpl_SetSessionDesc,
|
|
|
|
IDirectPlay4AImpl_AddGroupToGroup,
|
|
|
|
IDirectPlay4AImpl_CreateGroupInGroup,
|
|
|
|
IDirectPlay4AImpl_DeleteGroupFromGroup,
|
|
|
|
IDirectPlay4AImpl_EnumConnections,
|
|
|
|
IDirectPlay4AImpl_EnumGroupsInGroup,
|
|
|
|
IDirectPlay4AImpl_GetGroupConnectionSettings,
|
|
|
|
IDirectPlay4AImpl_InitializeConnection,
|
|
|
|
IDirectPlay4AImpl_SecureOpen,
|
|
|
|
IDirectPlay4AImpl_SendChatMessage,
|
|
|
|
IDirectPlay4AImpl_SetGroupConnectionSettings,
|
|
|
|
IDirectPlay4AImpl_StartSession,
|
|
|
|
IDirectPlay4AImpl_GetGroupFlags,
|
|
|
|
IDirectPlay4AImpl_GetGroupParent,
|
|
|
|
IDirectPlay4AImpl_GetPlayerAccount,
|
|
|
|
IDirectPlay4AImpl_GetPlayerFlags,
|
2013-03-29 17:08:49 +01:00
|
|
|
IDirectPlay4AImpl_GetGroupOwner,
|
|
|
|
IDirectPlay4AImpl_SetGroupOwner,
|
2013-03-29 17:05:50 +01:00
|
|
|
IDirectPlay4AImpl_SendEx,
|
2013-03-29 17:06:39 +01:00
|
|
|
IDirectPlay4AImpl_GetMessageQueue,
|
2013-03-29 17:07:24 +01:00
|
|
|
IDirectPlay4AImpl_CancelMessage,
|
|
|
|
IDirectPlay4AImpl_CancelPriority
|
1999-09-28 18:35:32 +02:00
|
|
|
};
|
|
|
|
|
2013-03-29 16:48:57 +01:00
|
|
|
HRESULT dplay_create( REFIID riid, void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayImpl *obj;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv );
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
obj = HeapAlloc( GetProcessHeap(), 0, sizeof( *obj ) );
|
|
|
|
if ( !obj )
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
|
2013-04-08 23:17:36 +02:00
|
|
|
obj->IDirectPlay_iface.lpVtbl = &dp_vt;
|
2013-03-29 17:13:11 +01:00
|
|
|
obj->IDirectPlay2A_iface.lpVtbl = &dp2A_vt;
|
2013-03-29 17:14:07 +01:00
|
|
|
obj->IDirectPlay2_iface.lpVtbl = &dp2_vt;
|
2013-03-29 17:15:01 +01:00
|
|
|
obj->IDirectPlay3A_iface.lpVtbl = &dp3A_vt;
|
2013-03-29 17:15:57 +01:00
|
|
|
obj->IDirectPlay3_iface.lpVtbl = &dp3_vt;
|
2013-03-29 16:48:57 +01:00
|
|
|
obj->IDirectPlay4A_iface.lpVtbl = &dp4A_vt;
|
|
|
|
obj->IDirectPlay4_iface.lpVtbl = &dp4_vt;
|
2013-03-29 16:49:30 +01:00
|
|
|
obj->numIfaces = 1;
|
2013-04-08 23:17:36 +02:00
|
|
|
obj->ref = 0;
|
2013-03-29 17:13:11 +01:00
|
|
|
obj->ref2A = 0;
|
2013-03-29 17:14:07 +01:00
|
|
|
obj->ref2 = 0;
|
2013-03-29 17:15:01 +01:00
|
|
|
obj->ref3A = 0;
|
2013-03-29 17:15:57 +01:00
|
|
|
obj->ref3 = 0;
|
2013-04-08 23:20:24 +02:00
|
|
|
obj->ref4A = 0;
|
|
|
|
obj->ref4 = 1;
|
2013-03-29 16:48:57 +01:00
|
|
|
|
|
|
|
InitializeCriticalSection( &obj->lock );
|
|
|
|
obj->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IDirectPlayImpl.lock");
|
|
|
|
|
|
|
|
if ( DP_CreateDirectPlay2( obj ) )
|
2013-04-08 23:20:24 +02:00
|
|
|
hr = IDirectPlayX_QueryInterface( &obj->IDirectPlay4_iface, riid, ppv );
|
2013-03-29 16:48:57 +01:00
|
|
|
else
|
|
|
|
hr = DPERR_NOMEMORY;
|
2013-04-08 23:20:24 +02:00
|
|
|
IDirectPlayX_Release( &obj->IDirectPlay4_iface );
|
2013-03-29 16:48:57 +01:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
HRESULT DP_GetSPPlayerData( IDirectPlayImpl *lpDP, DPID idPlayer, void **lplpData )
|
2000-10-19 22:20:58 +02:00
|
|
|
{
|
|
|
|
lpPlayerList lpPlayer = DP_FindPlayer( lpDP, idPlayer );
|
|
|
|
|
|
|
|
if( lpPlayer == NULL )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPLAYER;
|
|
|
|
}
|
|
|
|
|
|
|
|
*lplpData = lpPlayer->lpPData->lpSPPlayerData;
|
|
|
|
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-03-29 17:12:33 +01:00
|
|
|
HRESULT DP_SetSPPlayerData( IDirectPlayImpl *lpDP, DPID idPlayer, void *lpData )
|
2000-10-19 22:20:58 +02:00
|
|
|
{
|
|
|
|
lpPlayerList lpPlayer = DP_FindPlayer( lpDP, idPlayer );
|
|
|
|
|
|
|
|
if( lpPlayer == NULL )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPLAYER;
|
|
|
|
}
|
|
|
|
|
|
|
|
lpPlayer->lpPData->lpSPPlayerData = lpData;
|
|
|
|
|
|
|
|
return DP_OK;
|
|
|
|
}
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
/***************************************************************************
|
2005-05-23 13:49:36 +02:00
|
|
|
* DirectPlayEnumerateAW
|
1999-09-28 18:35:32 +02:00
|
|
|
*
|
2002-06-01 01:06:46 +02:00
|
|
|
* The pointer to the structure lpContext will be filled with the
|
1999-09-28 18:35:32 +02:00
|
|
|
* appropriate data for each service offered by the OS. These services are
|
|
|
|
* not necessarily available on this particular machine but are defined
|
|
|
|
* as simple service providers under the "Service Providers" registry key.
|
2002-06-01 01:06:46 +02:00
|
|
|
* This structure is then passed to lpEnumCallback for each of the different
|
|
|
|
* services.
|
1999-09-28 18:35:32 +02:00
|
|
|
*
|
|
|
|
* This API is useful only for applications written using DirectX3 or
|
2003-07-09 04:52:57 +02:00
|
|
|
* worse. It is superseded by IDirectPlay3::EnumConnections which also
|
1999-09-28 18:35:32 +02:00
|
|
|
* gives information on the actual connections.
|
|
|
|
*
|
|
|
|
* defn of a service provider:
|
2002-06-01 01:06:46 +02:00
|
|
|
* A dynamic-link library used by DirectPlay to communicate over a network.
|
1999-09-28 18:35:32 +02:00
|
|
|
* The service provider contains all the network-specific code required
|
|
|
|
* to send and receive messages. Online services and network operators can
|
|
|
|
* supply service providers to use specialized hardware, protocols, communications
|
2002-06-01 01:06:46 +02:00
|
|
|
* media, and network resources.
|
1999-09-28 18:35:32 +02:00
|
|
|
*
|
|
|
|
*/
|
2005-05-23 13:49:36 +02:00
|
|
|
static HRESULT DirectPlayEnumerateAW(LPDPENUMDPCALLBACKA lpEnumCallbackA,
|
|
|
|
LPDPENUMDPCALLBACKW lpEnumCallbackW,
|
|
|
|
LPVOID lpContext)
|
|
|
|
{
|
|
|
|
HKEY hkResult;
|
|
|
|
DWORD dwIndex;
|
|
|
|
FILETIME filetime;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2005-05-23 13:49:36 +02:00
|
|
|
char *descriptionA = NULL;
|
|
|
|
DWORD max_sizeOfDescriptionA = 0;
|
|
|
|
WCHAR *descriptionW = NULL;
|
|
|
|
DWORD max_sizeOfDescriptionW = 0;
|
2015-01-15 00:09:49 +01:00
|
|
|
DWORD sizeOfSubKeyName;
|
|
|
|
WCHAR subKeyName[255]; /* 255 is the maximum key size according to MSDN */
|
|
|
|
LONG ret_value;
|
|
|
|
static GUID *guid_cache;
|
|
|
|
static int cache_count;
|
2005-05-23 13:49:36 +02:00
|
|
|
|
|
|
|
if (!lpEnumCallbackA && !lpEnumCallbackW)
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2005-05-23 13:49:36 +02:00
|
|
|
return DPERR_INVALIDPARAMS;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
2005-05-23 13:49:36 +02:00
|
|
|
|
|
|
|
/* Need to loop over the service providers in the registry */
|
2020-09-30 23:14:56 +02:00
|
|
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\DirectPlay\\Service Providers",
|
2005-05-23 13:49:36 +02:00
|
|
|
0, KEY_READ, &hkResult) != ERROR_SUCCESS)
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2005-05-23 13:49:36 +02:00
|
|
|
/* Hmmm. Does this mean that there are no service providers? */
|
|
|
|
ERR(": no service provider key in the registry - check your Wine installation !!!\n");
|
|
|
|
return DPERR_GENERIC;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
2015-01-15 00:09:49 +01:00
|
|
|
|
|
|
|
dwIndex = 0;
|
|
|
|
do
|
|
|
|
{
|
2018-09-10 22:49:38 +02:00
|
|
|
sizeOfSubKeyName = ARRAY_SIZE(subKeyName);
|
2015-01-15 00:09:49 +01:00
|
|
|
ret_value = RegEnumKeyW(hkResult, dwIndex, subKeyName, sizeOfSubKeyName);
|
|
|
|
dwIndex++;
|
|
|
|
}
|
|
|
|
while (ret_value == ERROR_SUCCESS);
|
|
|
|
/* The game Swing from bug 37185 expects GUID values to persist after
|
|
|
|
* the end of the enumeration. */
|
|
|
|
if (cache_count < dwIndex)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, guid_cache);
|
|
|
|
guid_cache = HeapAlloc(GetProcessHeap(), 0, sizeof(GUID) * dwIndex);
|
|
|
|
if (!guid_cache)
|
|
|
|
{
|
2015-08-31 12:24:53 +02:00
|
|
|
ERR(": failed to allocate required memory.\n");
|
2015-01-15 00:09:49 +01:00
|
|
|
return DPERR_EXCEPTION;
|
|
|
|
}
|
|
|
|
cache_count = dwIndex;
|
|
|
|
}
|
2005-05-23 13:49:36 +02:00
|
|
|
/* Traverse all the service providers we have available */
|
|
|
|
dwIndex = 0;
|
|
|
|
while (1)
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2005-05-23 13:49:36 +02:00
|
|
|
HKEY hkServiceProvider;
|
|
|
|
WCHAR guidKeyContent[(2 * 16) + 1 + 6 /* This corresponds to '{....-..-..-..-......}' */ ];
|
|
|
|
DWORD sizeOfGuidKeyContent = sizeof(guidKeyContent);
|
2018-09-10 22:49:38 +02:00
|
|
|
|
|
|
|
sizeOfSubKeyName = ARRAY_SIZE(subKeyName);
|
2005-05-23 13:49:36 +02:00
|
|
|
ret_value = RegEnumKeyExW(hkResult, dwIndex, subKeyName, &sizeOfSubKeyName,
|
|
|
|
NULL, NULL, NULL, &filetime);
|
|
|
|
if (ret_value == ERROR_NO_MORE_ITEMS)
|
|
|
|
break;
|
|
|
|
else if (ret_value != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ERR(": could not enumerate on service provider key.\n");
|
|
|
|
return DPERR_EXCEPTION;
|
|
|
|
}
|
|
|
|
TRACE(" this time through sub-key %s.\n", debugstr_w(subKeyName));
|
|
|
|
|
|
|
|
/* Open the key for this service provider */
|
|
|
|
if (RegOpenKeyExW(hkResult, subKeyName, 0, KEY_READ, &hkServiceProvider) != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ERR(": could not open registry key for service provider %s.\n", debugstr_w(subKeyName));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the GUID from the registry */
|
2020-09-30 23:14:56 +02:00
|
|
|
if (RegQueryValueExW(hkServiceProvider, L"Guid",
|
2005-05-23 13:49:36 +02:00
|
|
|
NULL, NULL, (LPBYTE) guidKeyContent, &sizeOfGuidKeyContent) != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ERR(": missing GUID registry data member for service provider %s.\n", debugstr_w(subKeyName));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (sizeOfGuidKeyContent != sizeof(guidKeyContent))
|
|
|
|
{
|
|
|
|
ERR(": invalid format for the GUID registry data member for service provider %s (%s).\n", debugstr_w(subKeyName), debugstr_w(guidKeyContent));
|
|
|
|
continue;
|
|
|
|
}
|
2015-01-15 00:09:49 +01:00
|
|
|
CLSIDFromString(guidKeyContent, &guid_cache[dwIndex]);
|
2005-05-23 13:49:36 +02:00
|
|
|
|
|
|
|
/* The enumeration will return FALSE if we are not to continue.
|
|
|
|
*
|
|
|
|
* Note: on my windows box, major / minor version is 6 / 0 for all service providers
|
2007-10-23 15:30:30 +02:00
|
|
|
* and have no relation to any of the two dwReserved1 and dwReserved2 keys.
|
2005-05-23 13:49:36 +02:00
|
|
|
* I think that it simply means that they are in-line with DirectX 6.0
|
|
|
|
*/
|
|
|
|
if (lpEnumCallbackA)
|
|
|
|
{
|
|
|
|
DWORD sizeOfDescription = 0;
|
|
|
|
|
2007-10-23 15:30:30 +02:00
|
|
|
/* Note that this is the A case of this function, so use the A variant to get the description string */
|
2005-05-23 13:49:36 +02:00
|
|
|
if (RegQueryValueExA(hkServiceProvider, "DescriptionA",
|
|
|
|
NULL, NULL, NULL, &sizeOfDescription) != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ERR(": missing 'DescriptionA' registry data member for service provider %s.\n", debugstr_w(subKeyName));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (sizeOfDescription > max_sizeOfDescriptionA)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, descriptionA);
|
|
|
|
max_sizeOfDescriptionA = sizeOfDescription;
|
|
|
|
}
|
|
|
|
descriptionA = HeapAlloc(GetProcessHeap(), 0, sizeOfDescription);
|
|
|
|
RegQueryValueExA(hkServiceProvider, "DescriptionA",
|
|
|
|
NULL, NULL, (LPBYTE) descriptionA, &sizeOfDescription);
|
|
|
|
|
2015-01-15 00:09:49 +01:00
|
|
|
if (!lpEnumCallbackA(&guid_cache[dwIndex], descriptionA, 6, 0, lpContext))
|
2005-05-23 13:49:36 +02:00
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DWORD sizeOfDescription = 0;
|
2020-09-30 23:14:56 +02:00
|
|
|
|
|
|
|
if (RegQueryValueExW(hkServiceProvider, L"DescriptionW",
|
2005-05-23 13:49:36 +02:00
|
|
|
NULL, NULL, NULL, &sizeOfDescription) != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ERR(": missing 'DescriptionW' registry data member for service provider %s.\n", debugstr_w(subKeyName));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (sizeOfDescription > max_sizeOfDescriptionW)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, descriptionW);
|
|
|
|
max_sizeOfDescriptionW = sizeOfDescription;
|
|
|
|
}
|
|
|
|
descriptionW = HeapAlloc(GetProcessHeap(), 0, sizeOfDescription);
|
2020-09-30 23:14:56 +02:00
|
|
|
RegQueryValueExW(hkServiceProvider, L"DescriptionW",
|
2005-05-23 13:49:36 +02:00
|
|
|
NULL, NULL, (LPBYTE) descriptionW, &sizeOfDescription);
|
|
|
|
|
2015-01-15 00:09:49 +01:00
|
|
|
if (!lpEnumCallbackW(&guid_cache[dwIndex], descriptionW, 6, 0, lpContext))
|
2005-05-23 13:49:36 +02:00
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
|
|
|
dwIndex++;
|
|
|
|
}
|
|
|
|
|
|
|
|
end:
|
|
|
|
HeapFree(GetProcessHeap(), 0, descriptionA);
|
|
|
|
HeapFree(GetProcessHeap(), 0, descriptionW);
|
|
|
|
|
|
|
|
return DP_OK;
|
|
|
|
}
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2005-05-23 13:49:36 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* DirectPlayEnumerate [DPLAYX.9]
|
|
|
|
* DirectPlayEnumerateA [DPLAYX.2]
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DirectPlayEnumerateA(LPDPENUMDPCALLBACKA lpEnumCallback, LPVOID lpContext )
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p)\n", lpEnumCallback, lpContext);
|
|
|
|
|
|
|
|
return DirectPlayEnumerateAW(lpEnumCallback, NULL, lpContext);
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************
|
2000-10-19 22:20:58 +02:00
|
|
|
* DirectPlayEnumerateW [DPLAYX.3]
|
1999-09-28 18:35:32 +02:00
|
|
|
*/
|
2005-05-23 13:49:36 +02:00
|
|
|
HRESULT WINAPI DirectPlayEnumerateW(LPDPENUMDPCALLBACKW lpEnumCallback, LPVOID lpContext )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2005-05-23 13:49:36 +02:00
|
|
|
TRACE("(%p,%p)\n", lpEnumCallback, lpContext);
|
|
|
|
|
|
|
|
return DirectPlayEnumerateAW(NULL, lpEnumCallback, lpContext);
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
typedef struct tagCreateEnum
|
|
|
|
{
|
|
|
|
LPVOID lpConn;
|
2002-06-01 01:06:46 +02:00
|
|
|
LPCGUID lpGuid;
|
2000-08-25 23:58:05 +02:00
|
|
|
} CreateEnumData, *lpCreateEnumData;
|
|
|
|
|
|
|
|
/* Find and copy the matching connection for the SP guid */
|
2002-06-01 01:06:46 +02:00
|
|
|
static BOOL CALLBACK cbDPCreateEnumConnections(
|
2000-08-25 23:58:05 +02:00
|
|
|
LPCGUID lpguidSP,
|
|
|
|
LPVOID lpConnection,
|
|
|
|
DWORD dwConnectionSize,
|
|
|
|
LPCDPNAME lpName,
|
|
|
|
DWORD dwFlags,
|
|
|
|
LPVOID lpContext)
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
lpCreateEnumData lpData = (lpCreateEnumData)lpContext;
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
if( IsEqualGUID( lpguidSP, lpData->lpGuid ) )
|
|
|
|
{
|
|
|
|
TRACE( "Found SP entry with guid %s\n", debugstr_guid(lpData->lpGuid) );
|
|
|
|
|
|
|
|
lpData->lpConn = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
dwConnectionSize );
|
|
|
|
CopyMemory( lpData->lpConn, lpConnection, dwConnectionSize );
|
|
|
|
|
|
|
|
/* Found the record that we were looking for */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Haven't found what were looking for yet */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
/***************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* DirectPlayCreate [DPLAYX.1]
|
1999-09-28 18:35:32 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DirectPlayCreate
|
2008-07-31 19:17:25 +02:00
|
|
|
( LPGUID lpGUID, LPDIRECTPLAY *lplpDP, IUnknown *pUnk )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
HRESULT hr;
|
|
|
|
LPDIRECTPLAY3A lpDP3A;
|
|
|
|
CreateEnumData cbData;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-01-18 06:09:49 +01:00
|
|
|
TRACE( "lpGUID=%s lplpDP=%p pUnk=%p\n", debugstr_guid(lpGUID), lplpDP, pUnk );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
if( pUnk != NULL )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
return CLASS_E_NOAGGREGATION;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2008-07-31 19:17:30 +02:00
|
|
|
if( (lplpDP == NULL) || (lpGUID == NULL) )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
2013-04-08 23:21:28 +02:00
|
|
|
if ( dplay_create( &IID_IDirectPlay, (void**)lplpDP ) != DP_OK )
|
1999-11-04 03:17:03 +01:00
|
|
|
return DPERR_UNAVAILABLE;
|
|
|
|
|
2000-01-12 05:56:13 +01:00
|
|
|
if( IsEqualGUID( &GUID_NULL, lpGUID ) )
|
|
|
|
{
|
|
|
|
/* The GUID_NULL means don't bind a service provider. Just return the
|
2002-06-01 01:06:46 +02:00
|
|
|
interface as is */
|
2000-01-12 05:56:13 +01:00
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Bind the desired service provider since lpGUID is non NULL */
|
|
|
|
TRACE( "Service Provider binding for %s\n", debugstr_guid(lpGUID) );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* We're going to use a DP3 interface */
|
2002-06-01 01:06:46 +02:00
|
|
|
hr = IDirectPlayX_QueryInterface( *lplpDP, &IID_IDirectPlay3A,
|
2000-08-25 23:58:05 +02:00
|
|
|
(LPVOID*)&lpDP3A );
|
|
|
|
if( FAILED(hr) )
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
ERR( "Failed to get DP3 interface: %s\n", DPLAYX_HresultToString(hr) );
|
2000-08-25 23:58:05 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
cbData.lpConn = NULL;
|
|
|
|
cbData.lpGuid = lpGUID;
|
|
|
|
|
|
|
|
/* We were given a service provider, find info about it... */
|
2002-06-01 01:06:46 +02:00
|
|
|
hr = IDirectPlayX_EnumConnections( lpDP3A, NULL, cbDPCreateEnumConnections,
|
2000-08-25 23:58:05 +02:00
|
|
|
&cbData, DPCONNECTION_DIRECTPLAY );
|
|
|
|
if( ( FAILED(hr) ) ||
|
2002-06-01 01:06:46 +02:00
|
|
|
( cbData.lpConn == NULL )
|
2000-01-12 05:56:13 +01:00
|
|
|
)
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
ERR( "Failed to get Enum for SP: %s\n", DPLAYX_HresultToString(hr) );
|
2000-08-25 23:58:05 +02:00
|
|
|
IDirectPlayX_Release( lpDP3A );
|
|
|
|
return DPERR_UNAVAILABLE;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Initialize the service provider */
|
|
|
|
hr = IDirectPlayX_InitializeConnection( lpDP3A, cbData.lpConn, 0 );
|
2002-06-01 01:06:46 +02:00
|
|
|
if( FAILED(hr) )
|
2000-08-25 23:58:05 +02:00
|
|
|
{
|
|
|
|
ERR( "Failed to Initialize SP: %s\n", DPLAYX_HresultToString(hr) );
|
|
|
|
HeapFree( GetProcessHeap(), 0, cbData.lpConn );
|
|
|
|
IDirectPlayX_Release( lpDP3A );
|
|
|
|
return hr;
|
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Release our version of the interface now that we're done with it */
|
|
|
|
IDirectPlayX_Release( lpDP3A );
|
|
|
|
HeapFree( GetProcessHeap(), 0, cbData.lpConn );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|