ReactOS 0.4.15-dev-8241-g63935f8
dplay_global.h File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wine/dplaysp.h"
#include "lobbysp.h"
#include "dplayx_queue.h"
Include dependency graph for dplay_global.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagEnumSessionAsyncCallbackData
 
struct  tagDP_MSG_REPLY_STRUCT
 
struct  tagDP_MSG_REPLY_STRUCT_LIST
 
struct  PlayerData
 
struct  PlayerList
 
struct  GroupData
 
struct  GroupList
 
struct  DPMSG
 
struct  tagDirectPlay2Data
 
struct  IDirectPlayImpl
 

Typedefs

typedef struct tagEnumSessionAsyncCallbackData EnumSessionAsyncCallbackData
 
typedef struct tagDP_MSG_REPLY_STRUCT DP_MSG_REPLY_STRUCT
 
typedef struct tagDP_MSG_REPLY_STRUCTLPDP_MSG_REPLY_STRUCT
 
typedef struct tagDP_MSG_REPLY_STRUCT_LIST DP_MSG_REPLY_STRUCT_LIST
 
typedef struct tagDP_MSG_REPLY_STRUCT_LISTLPDP_MSG_REPLY_STRUCT_LIST
 
typedef struct PlayerDatalpPlayerData
 
typedef struct PlayerListlpPlayerList
 
typedef struct GroupData GroupData
 
typedef struct GroupDatalpGroupData
 
typedef struct GroupListlpGroupList
 
typedef struct DPMSGLPDPMSG
 
typedef struct tagDirectPlay2Data DirectPlay2Data
 
typedef struct IDirectPlayImpl IDirectPlayImpl
 

Enumerations

enum  SPSTATE { NO_PROVIDER = 0 , DP_SERVICE_PROVIDER = 1 , DP_LOBBY_PROVIDER = 2 }
 

Functions

HRESULT DPL_EnumAddress (LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress, DWORD dwAddressSize, LPVOID lpContext) DECLSPEC_HIDDEN
 
HRESULT DP_HandleMessage (IDirectPlayImpl *This, const void *lpMessageBody, DWORD dwMessageBodySize, const void *lpMessageHeader, WORD wCommandId, WORD wVersion, void **lplpReply, DWORD *lpdwMsgSize) DECLSPEC_HIDDEN
 
HRESULT DP_GetSPPlayerData (IDirectPlayImpl *lpDP, DPID idPlayer, void **lplpData) DECLSPEC_HIDDEN
 
HRESULT DP_SetSPPlayerData (IDirectPlayImpl *lpDP, DPID idPlayer, void *lpData) DECLSPEC_HIDDEN
 
LPVOID DPSP_CreateSPPlayerData (void) DECLSPEC_HIDDEN
 
HRESULT dplay_create (REFIID riid, void **ppv) DECLSPEC_HIDDEN
 
HRESULT dplobby_create (REFIID riid, void **ppv) DECLSPEC_HIDDEN
 
HRESULT dplaysp_create (REFIID riid, void **ppv, IDirectPlayImpl *dp) DECLSPEC_HIDDEN
 
HRESULT dplobbysp_create (REFIID riid, void **ppv, IDirectPlayImpl *dp) DECLSPEC_HIDDEN
 

Typedef Documentation

◆ DirectPlay2Data

◆ DP_MSG_REPLY_STRUCT

◆ DP_MSG_REPLY_STRUCT_LIST

◆ EnumSessionAsyncCallbackData

◆ GroupData

Definition at line 116 of file dplay_global.h.

◆ IDirectPlayImpl

◆ LPDP_MSG_REPLY_STRUCT

◆ LPDP_MSG_REPLY_STRUCT_LIST

◆ LPDPMSG

typedef struct DPMSG* LPDPMSG

Definition at line 132 of file dplay_global.h.

◆ lpGroupData

Definition at line 117 of file dplay_global.h.

◆ lpGroupList

Definition at line 125 of file dplay_global.h.

◆ lpPlayerData

Definition at line 81 of file dplay_global.h.

◆ lpPlayerList

Definition at line 89 of file dplay_global.h.

Enumeration Type Documentation

◆ SPSTATE

Enumerator
NO_PROVIDER 
DP_SERVICE_PROVIDER 
DP_LOBBY_PROVIDER 

Definition at line 134 of file dplay_global.h.

135{
136 NO_PROVIDER = 0,
139};
@ DP_LOBBY_PROVIDER
Definition: dplay_global.h:138
@ NO_PROVIDER
Definition: dplay_global.h:136
@ DP_SERVICE_PROVIDER
Definition: dplay_global.h:137

Function Documentation

◆ DP_GetSPPlayerData()

HRESULT DP_GetSPPlayerData ( IDirectPlayImpl lpDP,
DPID  idPlayer,
void **  lplpData 
)

Definition at line 5717 of file dplay.c.

5719{
5720 lpPlayerList lpPlayer = DP_FindPlayer( lpDP, idPlayer );
5721
5722 if( lpPlayer == NULL )
5723 {
5724 return DPERR_INVALIDPLAYER;
5725 }
5726
5727 *lplpData = lpPlayer->lpPData->lpSPPlayerData;
5728
5729 return DP_OK;
#define NULL
Definition: types.h:112
static lpPlayerList DP_FindPlayer(IDirectPlayImpl *This, DPID dpid)
Definition: dplay.c:1383
#define DP_OK
Definition: dplay.h:88
#define DPERR_INVALIDPLAYER
Definition: dplay.h:104
LPVOID lpSPPlayerData
Definition: dplay_global.h:77
lpPlayerData lpPData
Definition: dplay_global.h:87

Referenced by IDirectPlaySPImpl_GetSPPlayerData(), and IDirectPlaySPImpl_SetSPPlayerData().

◆ DP_HandleMessage()

HRESULT DP_HandleMessage ( IDirectPlayImpl This,
const void lpMessageBody,
DWORD  dwMessageBodySize,
const void lpMessageHeader,
WORD  wCommandId,
WORD  wVersion,
void **  lplpReply,
DWORD lpdwMsgSize 
)

Definition at line 269 of file dplay.c.

273{
274 TRACE( "(%p)->(%p,0x%08x,%p,%u,%u)\n",
275 This, lpcMessageBody, dwMessageBodySize, lpcMessageHeader, wCommandId,
276 wVersion );
277
278 switch( wCommandId )
279 {
280 /* Name server needs to handle this request */
282 /* Reply expected */
283 NS_ReplyToEnumSessionsRequest( lpcMessageBody, lplpReply, lpdwMsgSize, This );
284 break;
285
286 /* Name server needs to handle this request */
288 /* No reply expected */
289 NS_AddRemoteComputerAsNameServer( lpcMessageHeader,
290 This->dp2->spData.dwSPHeaderSize,
291 lpcMessageBody,
292 This->dp2->lpNameServerData );
293 break;
294
296 {
297 LPCDPMSG_REQUESTNEWPLAYERID lpcMsg = lpcMessageBody;
298
300
301 *lpdwMsgSize = This->dp2->spData.dwSPHeaderSize + sizeof( *lpReply );
302
303 *lplpReply = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, *lpdwMsgSize );
304
305 FIXME( "Ignoring dwFlags 0x%08x in request msg\n",
306 lpcMsg->dwFlags );
307
308 /* Setup the reply */
309 lpReply = (LPDPMSG_NEWPLAYERIDREPLY)( (BYTE*)(*lplpReply) +
310 This->dp2->spData.dwSPHeaderSize );
311
314 lpReply->envelope.wVersion = DPMSGVER_DP6;
315
316 lpReply->dpidNewPlayerId = DP_NextObjectId();
317
318 TRACE( "Allocating new playerid 0x%08x from remote request\n",
319 lpReply->dpidNewPlayerId );
320 break;
321 }
322
325 DP_MSG_ReplyReceived( This, wCommandId, lpcMessageBody, dwMessageBodySize );
326 break;
327
329 TRACE( "GOT THE SELF MESSAGE: %p -> 0x%08x\n", lpcMessageHeader, ((const DWORD *)lpcMessageHeader)[1] );
330 NS_SetLocalAddr( This->dp2->lpNameServerData, lpcMessageHeader, 20 );
331 DP_MSG_ReplyReceived( This, wCommandId, lpcMessageBody, dwMessageBodySize );
332
334 TRACE( "Sending message to self to get my addr\n" );
335 DP_MSG_ToSelf( This, 1 ); /* This is a hack right now */
336 break;
337
339 DP_MSG_ErrorReceived( This, wCommandId, lpcMessageBody, dwMessageBodySize );
340 break;
341
342 default:
343 FIXME( "Unknown wCommandId %u. Ignoring message\n", wCommandId );
344 DebugBreak();
345 break;
346 }
347
348 /* FIXME: There is code in dplaysp.c to handle dplay commands. Move to here. */
349
350 return DP_OK;
#define FIXME(fmt,...)
Definition: debug.h:114
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static DPID DP_NextObjectId(void)
Definition: dplay.c:263
void DP_MSG_ErrorReceived(IDirectPlayImpl *This, WORD wCommandId, const void *lpMsgBody, DWORD dwMsgBodySize)
void DP_MSG_ReplyReceived(IDirectPlayImpl *This, WORD wCommandId, const void *lpcMsgBody, DWORD dwMsgBodySize)
void DP_MSG_ToSelf(IDirectPlayImpl *This, DPID dpidSelf)
#define DPMSGVER_DP6
#define DPMSGCMD_ENUMSESSIONSREQUEST
#define DPMSGCMD_GETNAMETABLEREPLY
#define DPMSGCMD_FORWARDADDPLAYER
#define DPMSGCMD_ENUMSESSIONSREPLY
#define DPMSGCMD_REQUESTNEWPLAYERID
#define DPMSGCMD_NEWPLAYERIDREPLY
#define DPMSGCMD_JUSTENVELOPE
#define DPMSGCMD_FORWARDADDPLAYERNACK
struct tagDPMSG_NEWPLAYERIDREPLY * LPDPMSG_NEWPLAYERIDREPLY
#define DPMSGMAGIC_DPLAYMSG
unsigned long DWORD
Definition: ntddk_ex.h:95
void NS_AddRemoteComputerAsNameServer(LPCVOID lpcNSAddrHdr, DWORD dwHdrSize, LPCDPMSG_ENUMSESSIONSREPLY lpcMsg, LPVOID lpNSInfo)
Definition: name_server.c:87
void NS_ReplyToEnumSessionsRequest(const void *lpcMsg, void **lplpReplyData, DWORD *lpdwReplySize, IDirectPlayImpl *lpDP)
Definition: name_server.c:358
void NS_SetLocalAddr(LPVOID lpNSInfo, LPCVOID lpHdr, DWORD dwHdrSize)
Definition: name_server.c:184
#define TRACE(s)
Definition: solgame.cpp:4
DPMSG_SENDENVELOPE envelope
void WINAPI DebugBreak(void)
unsigned char BYTE
Definition: xxhash.c:193

Referenced by IDirectPlaySPImpl_HandleMessage().

◆ DP_SetSPPlayerData()

HRESULT DP_SetSPPlayerData ( IDirectPlayImpl lpDP,
DPID  idPlayer,
void lpData 
)

Definition at line 5731 of file dplay.c.

5733{
5734 lpPlayerList lpPlayer = DP_FindPlayer( lpDP, idPlayer );
5735
5736 if( lpPlayer == NULL )
5737 {
5738 return DPERR_INVALIDPLAYER;
5739 }
5740
5741 lpPlayer->lpPData->lpSPPlayerData = lpData;
5742
5743 return DP_OK;

Referenced by IDirectPlaySPImpl_SetSPPlayerData().

◆ DPL_EnumAddress()

HRESULT DPL_EnumAddress ( LPDPENUMADDRESSCALLBACK  lpEnumAddressCallback,
LPCVOID  lpAddress,
DWORD  dwAddressSize,
LPVOID  lpContext 
)

Definition at line 644 of file dplobby.c.

646{
647 DWORD dwTotalSizeEnumerated = 0;
648
649 /* FIXME: First chunk is always the total size chunk - Should we report it? */
650
651 while ( dwTotalSizeEnumerated < dwAddressSize )
652 {
653 const DPADDRESS* lpElements = lpAddress;
654 DWORD dwSizeThisEnumeration;
655
656 /* Invoke the enum method. If false is returned, stop enumeration */
657 if ( !lpEnumAddressCallback( &lpElements->guidDataType,
658 lpElements->dwDataSize,
659 (const BYTE *)lpElements + sizeof( DPADDRESS ),
660 lpContext ) )
661 {
662 break;
663 }
664
665 dwSizeThisEnumeration = sizeof( DPADDRESS ) + lpElements->dwDataSize;
666 lpAddress = (const BYTE*) lpAddress + dwSizeThisEnumeration;
667 dwTotalSizeEnumerated += dwSizeThisEnumeration;
668 }
669
670 return DP_OK;
671}
struct tagDPADDRESS DPADDRESS
GUID guidDataType
Definition: dplobby.h:252
DWORD dwDataSize
Definition: dplobby.h:253

Referenced by IDirectPlay4Impl_InitializeConnection(), IDirectPlayLobby3AImpl_EnumAddress(), IDirectPlayLobby3Impl_EnumAddress(), and IDirectPlaySPImpl_EnumAddress().

◆ dplay_create()

HRESULT dplay_create ( REFIID  riid,
void **  ppv 
)

Definition at line 5676 of file dplay.c.

5678{
5680 HRESULT hr;
5681
5682 TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv );
5683
5684 *ppv = NULL;
5685 obj = HeapAlloc( GetProcessHeap(), 0, sizeof( *obj ) );
5686 if ( !obj )
5687 return DPERR_OUTOFMEMORY;
5688
5689 obj->IDirectPlay_iface.lpVtbl = &dp_vt;
5690 obj->IDirectPlay2A_iface.lpVtbl = &dp2A_vt;
5691 obj->IDirectPlay2_iface.lpVtbl = &dp2_vt;
5692 obj->IDirectPlay3A_iface.lpVtbl = &dp3A_vt;
5693 obj->IDirectPlay3_iface.lpVtbl = &dp3_vt;
5694 obj->IDirectPlay4A_iface.lpVtbl = &dp4A_vt;
5695 obj->IDirectPlay4_iface.lpVtbl = &dp4_vt;
5696 obj->numIfaces = 1;
5697 obj->ref = 0;
5698 obj->ref2A = 0;
5699 obj->ref2 = 0;
5700 obj->ref3A = 0;
5701 obj->ref3 = 0;
5702 obj->ref4A = 0;
5703 obj->ref4 = 1;
5704
5706 obj->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IDirectPlayImpl.lock");
5707
5708 if ( DP_CreateDirectPlay2( obj ) )
5709 hr = IDirectPlayX_QueryInterface( &obj->IDirectPlay4_iface, riid, ppv );
5710 else
5712 IDirectPlayX_Release( &obj->IDirectPlay4_iface );
5713
5714 return hr;
static BOOL DP_CreateDirectPlay2(LPVOID lpDP)
Definition: dplay.c:125
static const IDirectPlay4Vtbl dp4_vt
Definition: dplay.c:5562
static const IDirectPlay2Vtbl dp2_vt
Definition: dplay.c:5388
static const IDirectPlay3Vtbl dp3_vt
Definition: dplay.c:5460
static const IDirectPlay2Vtbl dp2A_vt
Definition: dplay.c:5424
static const IDirectPlay3Vtbl dp3A_vt
Definition: dplay.c:5511
static const IDirectPlayVtbl dp_vt
Definition: dplay.c:556
static const IDirectPlay4Vtbl dp4A_vt
Definition: dplay.c:5619
#define IDirectPlayX_Release(p)
Definition: dplay.h:866
#define IDirectPlayX_QueryInterface(p, a, b)
Definition: dplay.h:864
#define DPERR_NOMEMORY
Definition: dplay.h:108
#define DPERR_OUTOFMEMORY
Definition: dplay.h:109
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
HRESULT hr
Definition: shlfolder.c:183
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define DWORD_PTR
Definition: treelist.c:76

Referenced by DirectPlayCreate(), and DPL_ConnectEx().

◆ dplaysp_create()

HRESULT dplaysp_create ( REFIID  riid,
void **  ppv,
IDirectPlayImpl dp 
)

Definition at line 686 of file dplaysp.c.

687{
689 HRESULT hr;
690
691 TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv );
692
693 *ppv = NULL;
694 obj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *obj ) );
695 if ( !obj )
696 return DPERR_OUTOFMEMORY;
697
698 obj->IDirectPlaySP_iface.lpVtbl = &directPlaySPVT;
699 obj->ref = 1;
700 obj->dplay = dp;
701
702 hr = IDirectPlaySP_QueryInterface( &obj->IDirectPlaySP_iface, riid, ppv );
703 IDirectPlaySP_Release( &obj->IDirectPlaySP_iface );
704
705 return hr;
706}
static const IDirectPlaySPVtbl directPlaySPVT
Definition: dplaysp.c:667
#define IDirectPlaySP_QueryInterface(p, a, b)
Definition: dplaysp.h:95
#define IDirectPlaySP_Release(p)
Definition: dplaysp.h:97

Referenced by DP_CreateDirectPlay2().

◆ dplobby_create()

HRESULT dplobby_create ( REFIID  riid,
void **  ppv 
)

Definition at line 2026 of file dplobby.c.

2027{
2029 HRESULT hr;
2030
2031 TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv );
2032
2033 *ppv = NULL;
2034 obj = HeapAlloc( GetProcessHeap(), 0, sizeof( *obj ) );
2035 if ( !obj )
2036 return DPERR_OUTOFMEMORY;
2037
2038 obj->IDirectPlayLobby_iface.lpVtbl = &dpl_vt;
2039 obj->IDirectPlayLobbyA_iface.lpVtbl = &dplA_vt;
2040 obj->IDirectPlayLobby2_iface.lpVtbl = &dpl2_vt;
2041 obj->IDirectPlayLobby2A_iface.lpVtbl = &dpl2A_vt;
2042 obj->IDirectPlayLobby3_iface.lpVtbl = &dpl3_vt;
2043 obj->IDirectPlayLobby3A_iface.lpVtbl = &dpl3A_vt;
2044 obj->numIfaces = 1;
2045 obj->msgtid = 0;
2046 obj->ref = 0;
2047 obj->refA = 0;
2048 obj->ref2 = 0;
2049 obj->ref2A = 0;
2050 obj->ref3 = 1;
2051 obj->ref3A = 0;
2052
2054 obj->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IDirectPlayLobbyImpl.lock");
2055 DPQ_INIT( obj->msgs );
2056
2057 hr = IDirectPlayLobby_QueryInterface( &obj->IDirectPlayLobby3_iface, riid, ppv );
2058 IDirectPlayLobby_Release( &obj->IDirectPlayLobby3_iface );
2059
2060 return hr;
2061}
#define DPQ_INIT(head)
Definition: dplayx_queue.h:54
static const IDirectPlayLobby3Vtbl dpl3_vt
Definition: dplobby.c:2003
static const IDirectPlayLobby2Vtbl dpl2A_vt
Definition: dplobby.c:1942
static const IDirectPlayLobbyVtbl dplA_vt
Definition: dplobby.c:1906
static const IDirectPlayLobbyVtbl dpl_vt
Definition: dplobby.c:1924
static const IDirectPlayLobby2Vtbl dpl2_vt
Definition: dplobby.c:1961
static const IDirectPlayLobby3Vtbl dpl3A_vt
Definition: dplobby.c:1980
#define IDirectPlayLobby_Release(p)
Definition: dplobby.h:456
#define IDirectPlayLobby_QueryInterface(p, a, b)
Definition: dplobby.h:454

Referenced by DirectPlayLobbyCreateA(), and DirectPlayLobbyCreateW().

◆ dplobbysp_create()

HRESULT dplobbysp_create ( REFIID  riid,
void **  ppv,
IDirectPlayImpl dp 
)

Definition at line 230 of file lobbysp.c.

231{
233 HRESULT hr;
234
235 TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv );
236
237 *ppv = NULL;
238 obj = HeapAlloc( GetProcessHeap(), 0, sizeof( *obj ) );
239 if ( !obj )
240 return DPERR_OUTOFMEMORY;
241
242 obj->IDPLobbySP_iface.lpVtbl = &dpLobbySPVT;
243 obj->ref = 1;
244 obj->dplay = dp;
245
246 hr = IDPLobbySP_QueryInterface( &obj->IDPLobbySP_iface, riid, ppv );
247 IDPLobbySP_Release( &obj->IDPLobbySP_iface );
248
249 return hr;
250}
static const IDPLobbySPVtbl dpLobbySPVT
Definition: lobbysp.c:207
#define IDPLobbySP_QueryInterface(p, a, b)
Definition: lobbysp.h:492
#define IDPLobbySP_Release(p)
Definition: lobbysp.h:494

Referenced by DP_CreateDirectPlay2().

◆ DPSP_CreateSPPlayerData()

LPVOID DPSP_CreateSPPlayerData ( void  )

Definition at line 711 of file dplaysp.c.

712{
713 TRACE( "Creating SPPlayer data struct\n" );
715 sizeof( DP_SPPLAYERDATA ) );
716}

Referenced by DP_CreatePlayer().