ReactOS  0.4.14-dev-593-g1793dcc
dplaysp.c File Reference
#include <string.h>
#include "winerror.h"
#include "wine/debug.h"
#include "wine/dplaysp.h"
#include "dplay_global.h"
#include "name_server.h"
#include "dplayx_messages.h"
#include "dplayx_global.h"
Include dependency graph for dplaysp.c:

Go to the source code of this file.

Classes

struct  IDirectPlaySPImpl
 
struct  tagDP_SPPLAYERDATA
 

Typedefs

typedef struct IDirectPlaySPImpl IDirectPlaySPImpl
 
typedef struct tagDP_SPPLAYERDATA DP_SPPLAYERDATA
 
typedef struct tagDP_SPPLAYERDATALPDP_SPPLAYERDATA
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (dplay)
 
static IDirectPlaySPImplimpl_from_IDirectPlaySP (IDirectPlaySP *iface)
 
static HRESULT WINAPI IDirectPlaySPImpl_QueryInterface (IDirectPlaySP *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI IDirectPlaySPImpl_AddRef (IDirectPlaySP *iface)
 
static ULONG WINAPI IDirectPlaySPImpl_Release (IDirectPlaySP *iface)
 
static HRESULT WINAPI IDirectPlaySPImpl_AddMRUEntry (IDirectPlaySP *iface, LPCWSTR lpSection, LPCWSTR lpKey, const void *lpData, DWORD dwDataSize, DWORD dwMaxEntries)
 
static HRESULT WINAPI IDirectPlaySPImpl_CreateAddress (IDirectPlaySP *iface, REFGUID guidSP, REFGUID guidDataType, const void *lpData, DWORD dwDataSize, void *lpAddress, DWORD *lpdwAddressSize)
 
static HRESULT WINAPI IDirectPlaySPImpl_EnumAddress (IDirectPlaySP *iface, LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, const void *lpAddress, DWORD dwAddressSize, void *lpContext)
 
static HRESULT WINAPI IDirectPlaySPImpl_EnumMRUEntries (IDirectPlaySP *iface, LPCWSTR lpSection, LPCWSTR lpKey, LPENUMMRUCALLBACK lpEnumMRUCallback, void *lpContext)
 
static HRESULT WINAPI IDirectPlaySPImpl_GetPlayerFlags (IDirectPlaySP *iface, DPID idPlayer, DWORD *lpdwPlayerFlags)
 
static HRESULT WINAPI IDirectPlaySPImpl_GetSPPlayerData (IDirectPlaySP *iface, DPID idPlayer, void **lplpData, DWORD *lpdwDataSize, DWORD dwFlags)
 
static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage (IDirectPlaySP *iface, void *lpMessageBody, DWORD dwMessageBodySize, void *lpMessageHeader)
 
static HRESULT WINAPI IDirectPlaySPImpl_SetSPPlayerData (IDirectPlaySP *iface, DPID idPlayer, void *lpData, DWORD dwDataSize, DWORD dwFlags)
 
static HRESULT WINAPI IDirectPlaySPImpl_CreateCompoundAddress (IDirectPlaySP *iface, const DPCOMPOUNDADDRESSELEMENT *lpElements, DWORD dwElementCount, void *lpAddress, DWORD *lpdwAddressSize)
 
static HRESULT WINAPI IDirectPlaySPImpl_GetSPData (IDirectPlaySP *iface, void **lplpData, DWORD *lpdwDataSize, DWORD dwFlags)
 
static HRESULT WINAPI IDirectPlaySPImpl_SetSPData (IDirectPlaySP *iface, void *lpData, DWORD dwDataSize, DWORD dwFlags)
 
static void WINAPI IDirectPlaySPImpl_SendComplete (IDirectPlaySP *iface, void *unknownA, DWORD unknownB)
 
HRESULT dplaysp_create (REFIID riid, void **ppv, IDirectPlayImpl *dp)
 
LPVOID DPSP_CreateSPPlayerData (void)
 

Variables

static const IDirectPlaySPVtbl directPlaySPVT
 

Typedef Documentation

◆ DP_SPPLAYERDATA

◆ IDirectPlaySPImpl

◆ LPDP_SPPLAYERDATA

Function Documentation

◆ 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 }
HRESULT hr
Definition: shlfolder.c:183
#define IDirectPlaySP_QueryInterface(p, a, b)
Definition: dplaysp.h:95
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define DPERR_OUTOFMEMORY
Definition: dplay.h:109
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
#define IDirectPlaySP_Release(p)
Definition: dplaysp.h:97
static const IDirectPlaySPVtbl directPlaySPVT
Definition: dplaysp.c:667
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

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 }
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

Referenced by DP_CreatePlayer().

◆ IDirectPlaySPImpl_AddMRUEntry()

static HRESULT WINAPI IDirectPlaySPImpl_AddMRUEntry ( IDirectPlaySP *  iface,
LPCWSTR  lpSection,
LPCWSTR  lpKey,
const void lpData,
DWORD  dwDataSize,
DWORD  dwMaxEntries 
)
static

Definition at line 107 of file dplaysp.c.

109 {
111 
112  /* Should be able to call the comctl32 undocumented MRU routines.
113  I suspect that the interface works appropriately */
114  FIXME( "(%p)->(%p,%p%p,0x%08x,0x%08x): stub\n",
115  This, lpSection, lpKey, lpData, dwDataSize, dwMaxEntries );
116 
117  return DP_OK;
118 }
static IDirectPlaySPImpl * impl_from_IDirectPlaySP(IDirectPlaySP *iface)
Definition: dplaysp.c:58
#define DP_OK
Definition: dplay.h:88
#define FIXME(fmt,...)
Definition: debug.h:110
static LPCTSTR lpKey
Definition: virtmem.c:13

◆ IDirectPlaySPImpl_AddRef()

static ULONG WINAPI IDirectPlaySPImpl_AddRef ( IDirectPlaySP *  iface)
static

Definition at line 80 of file dplaysp.c.

81 {
84 
85  TRACE( "(%p) ref=%d\n", This, ref );
86 
87  return ref;
88 }
static IDirectPlaySPImpl * impl_from_IDirectPlaySP(IDirectPlaySP *iface)
Definition: dplaysp.c:58
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ IDirectPlaySPImpl_CreateAddress()

static HRESULT WINAPI IDirectPlaySPImpl_CreateAddress ( IDirectPlaySP *  iface,
REFGUID  guidSP,
REFGUID  guidDataType,
const void lpData,
DWORD  dwDataSize,
void lpAddress,
DWORD lpdwAddressSize 
)
static

Definition at line 120 of file dplaysp.c.

123 {
125 
126  FIXME( "(%p)->(%s,%s,%p,0x%08x,%p,%p): stub\n",
127  This, debugstr_guid(guidSP), debugstr_guid(guidDataType),
128  lpData, dwDataSize, lpAddress, lpdwAddressSize );
129 
130  return DP_OK;
131 }
static IDirectPlaySPImpl * impl_from_IDirectPlaySP(IDirectPlaySP *iface)
Definition: dplaysp.c:58
#define DP_OK
Definition: dplay.h:88
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35

◆ IDirectPlaySPImpl_CreateCompoundAddress()

static HRESULT WINAPI IDirectPlaySPImpl_CreateCompoundAddress ( IDirectPlaySP *  iface,
const DPCOMPOUNDADDRESSELEMENT lpElements,
DWORD  dwElementCount,
void lpAddress,
DWORD lpdwAddressSize 
)
static

Definition at line 553 of file dplaysp.c.

556 {
558 
559  FIXME( "(%p)->(%p,0x%08x,%p,%p): stub\n",
560  This, lpElements, dwElementCount, lpAddress, lpdwAddressSize );
561 
562  return DP_OK;
563 }
static IDirectPlaySPImpl * impl_from_IDirectPlaySP(IDirectPlaySP *iface)
Definition: dplaysp.c:58
#define DP_OK
Definition: dplay.h:88
#define FIXME(fmt,...)
Definition: debug.h:110

◆ IDirectPlaySPImpl_EnumAddress()

static HRESULT WINAPI IDirectPlaySPImpl_EnumAddress ( IDirectPlaySP *  iface,
LPDPENUMADDRESSCALLBACK  lpEnumAddressCallback,
const void lpAddress,
DWORD  dwAddressSize,
void lpContext 
)
static

Definition at line 133 of file dplaysp.c.

136 {
138 
139  TRACE( "(%p)->(%p,%p,0x%08x,%p)\n",
140  This, lpEnumAddressCallback, lpAddress, dwAddressSize, lpContext );
141 
142  DPL_EnumAddress( lpEnumAddressCallback, lpAddress, dwAddressSize, lpContext );
143 
144  return DP_OK;
145 }
static IDirectPlaySPImpl * impl_from_IDirectPlaySP(IDirectPlaySP *iface)
Definition: dplaysp.c:58
#define DP_OK
Definition: dplay.h:88
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT DPL_EnumAddress(LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress, DWORD dwAddressSize, LPVOID lpContext) DECLSPEC_HIDDEN
Definition: dplobby.c:644

◆ IDirectPlaySPImpl_EnumMRUEntries()

static HRESULT WINAPI IDirectPlaySPImpl_EnumMRUEntries ( IDirectPlaySP *  iface,
LPCWSTR  lpSection,
LPCWSTR  lpKey,
LPENUMMRUCALLBACK  lpEnumMRUCallback,
void lpContext 
)
static

Definition at line 147 of file dplaysp.c.

149 {
151 
152  /* Should be able to call the comctl32 undocumented MRU routines.
153  I suspect that the interface works appropriately */
154  FIXME( "(%p)->(%p,%p,%p,%p): stub\n",
155  This, lpSection, lpKey, lpEnumMRUCallback, lpContext );
156 
157  return DP_OK;
158 }
static IDirectPlaySPImpl * impl_from_IDirectPlaySP(IDirectPlaySP *iface)
Definition: dplaysp.c:58
#define DP_OK
Definition: dplay.h:88
#define FIXME(fmt,...)
Definition: debug.h:110
static LPCTSTR lpKey
Definition: virtmem.c:13

◆ IDirectPlaySPImpl_GetPlayerFlags()

static HRESULT WINAPI IDirectPlaySPImpl_GetPlayerFlags ( IDirectPlaySP *  iface,
DPID  idPlayer,
DWORD lpdwPlayerFlags 
)
static

Definition at line 160 of file dplaysp.c.

162 {
164 
165  FIXME( "(%p)->(0x%08x,%p): stub\n",
166  This, idPlayer, lpdwPlayerFlags );
167 
168  return DP_OK;
169 }
static IDirectPlaySPImpl * impl_from_IDirectPlaySP(IDirectPlaySP *iface)
Definition: dplaysp.c:58
#define DP_OK
Definition: dplay.h:88
#define FIXME(fmt,...)
Definition: debug.h:110

◆ IDirectPlaySPImpl_GetSPData()

static HRESULT WINAPI IDirectPlaySPImpl_GetSPData ( IDirectPlaySP *  iface,
void **  lplpData,
DWORD lpdwDataSize,
DWORD  dwFlags 
)
static

Definition at line 565 of file dplaysp.c.

567 {
569  HRESULT hr = DP_OK;
570 
571  TRACE( "(%p)->(%p,%p,0x%08x)\n", This, lplpData, lpdwDataSize, dwFlags );
572 
573 #if 0
574  /* This is what the documentation says... */
575  if( dwFlags != DPSET_REMOTE )
576  {
577  return DPERR_INVALIDPARAMS;
578  }
579 #else
580  /* ... but most service providers call this with 1 */
581  /* Guess that this is using a DPSET_LOCAL or DPSET_REMOTE type of
582  * thing?
583  */
584  if( dwFlags != DPSET_REMOTE )
585  {
586  TRACE( "Undocumented dwFlags 0x%08x used\n", dwFlags );
587  }
588 #endif
589 
590  /* FIXME: What to do in the case where this isn't initialized yet? */
591 
592  /* Yes, we're supposed to return a pointer to the memory we have stored! */
593  if( dwFlags == DPSET_REMOTE )
594  {
595  *lpdwDataSize = This->remote_data_size;
596  *lplpData = This->remote_data;
597 
598  if( !This->remote_data )
599  hr = DPERR_GENERIC;
600  }
601  else if( dwFlags == DPSET_LOCAL )
602  {
603  *lpdwDataSize = This->local_data_size;
604  *lplpData = This->local_data;
605 
606  if( !This->local_data )
607  hr = DPERR_GENERIC;
608  }
609 
610  return hr;
611 }
#define DPSET_REMOTE
Definition: dplay.h:1056
HRESULT hr
Definition: shlfolder.c:183
#define DPERR_INVALIDPARAMS
Definition: dplay.h:103
#define DPSET_LOCAL
Definition: dplay.h:1057
static IDirectPlaySPImpl * impl_from_IDirectPlaySP(IDirectPlaySP *iface)
Definition: dplaysp.c:58
#define DP_OK
Definition: dplay.h:88
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define DPERR_GENERIC
Definition: dplay.h:99
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ IDirectPlaySPImpl_GetSPPlayerData()

static HRESULT WINAPI IDirectPlaySPImpl_GetSPPlayerData ( IDirectPlaySP *  iface,
DPID  idPlayer,
void **  lplpData,
DWORD lpdwDataSize,
DWORD  dwFlags 
)
static

Definition at line 171 of file dplaysp.c.

173 {
175  HRESULT hr;
177 
178  TRACE( "(%p)->(0x%08x,%p,%p,0x%08x)\n",
179  This, idPlayer, lplpData, lpdwDataSize, dwFlags );
180 
181  hr = DP_GetSPPlayerData( This->dplay, idPlayer, (void**)&lpPlayerData );
182 
183  if( FAILED(hr) )
184  {
185  TRACE( "Couldn't get player data: %s\n", DPLAYX_HresultToString(hr) );
186  return DPERR_INVALIDPLAYER;
187  }
188 
189  /* What to do in the case where there is nothing set yet? */
190  if( dwFlags == DPSET_LOCAL )
191  {
192  *lplpData = lpPlayerData->lpPlayerLocalData;
193  *lpdwDataSize = lpPlayerData->dwPlayerLocalDataSize;
194  }
195  else if( dwFlags == DPSET_REMOTE )
196  {
197  *lplpData = lpPlayerData->lpPlayerRemoteData;
198  *lpdwDataSize = lpPlayerData->dwPlayerRemoteDataSize;
199  }
200 
201  if( *lplpData == NULL )
202  {
203  hr = DPERR_GENERIC;
204  }
205 
206  return hr;
207 }
#define DPSET_REMOTE
Definition: dplay.h:1056
#define DPERR_INVALIDPLAYER
Definition: dplay.h:104
HRESULT hr
Definition: shlfolder.c:183
LPCSTR DPLAYX_HresultToString(HRESULT hr)
#define DPSET_LOCAL
Definition: dplay.h:1057
static IDirectPlaySPImpl * impl_from_IDirectPlaySP(IDirectPlaySP *iface)
Definition: dplaysp.c:58
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
struct PlayerData * lpPlayerData
Definition: dplay_global.h:81
#define DPERR_GENERIC
Definition: dplay.h:99
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
HRESULT DP_GetSPPlayerData(IDirectPlayImpl *lpDP, DPID idPlayer, void **lplpData)
Definition: dplay.c:5718

◆ IDirectPlaySPImpl_HandleMessage()

static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage ( IDirectPlaySP *  iface,
void lpMessageBody,
DWORD  dwMessageBodySize,
void lpMessageHeader 
)
static

Definition at line 209 of file dplaysp.c.

211 {
213  LPDPMSG_SENDENVELOPE lpMsg = lpMessageBody;
215  WORD wCommandId;
216  WORD wVersion;
218 
219  FIXME( "(%p)->(%p,0x%08x,%p): mostly stub\n",
220  This, lpMessageBody, dwMessageBodySize, lpMessageHeader );
221 
222  wCommandId = lpMsg->wCommandId;
223  wVersion = lpMsg->wVersion;
224 
225  TRACE( "Incoming message has envelope of 0x%08x, %u, %u\n",
226  lpMsg->dwMagic, wCommandId, wVersion );
227 
228  if( lpMsg->dwMagic != DPMSGMAGIC_DPLAYMSG )
229  {
230  ERR( "Unknown magic 0x%08x!\n", lpMsg->dwMagic );
231  return DPERR_GENERIC;
232  }
233 
234 #if 0
235  {
236  const LPDWORD lpcHeader = lpMessageHeader;
237 
238  TRACE( "lpMessageHeader = [0x%08lx] [0x%08lx] [0x%08lx] [0x%08lx] [0x%08lx]\n",
239  lpcHeader[0], lpcHeader[1], lpcHeader[2], lpcHeader[3], lpcHeader[4] );
240  }
241 #endif
242 
243  /* Pass everything else to Direct Play */
244  data.lpMessage = NULL;
245  data.dwMessageSize = 0;
246 
247  /* Pass this message to the dplay interface to handle */
248  hr = DP_HandleMessage( This->dplay, lpMessageBody, dwMessageBodySize, lpMessageHeader,
249  wCommandId, wVersion, &data.lpMessage, &data.dwMessageSize );
250 
251  if( FAILED(hr) )
252  {
253  ERR( "Command processing failed %s\n", DPLAYX_HresultToString(hr) );
254  }
255 
256  /* Do we want a reply? */
257  if( data.lpMessage != NULL )
258  {
259  data.lpSPMessageHeader = lpMessageHeader;
260  data.idNameServer = 0;
261  data.lpISP = iface;
262 
263  hr = This->dplay->dp2->spData.lpCB->Reply( &data );
264 
265  if( FAILED(hr) )
266  {
267  ERR( "Reply failed %s\n", DPLAYX_HresultToString(hr) );
268  }
269  }
270 
271  return hr;
272 
273 #if 0
274  HRESULT hr = DP_OK;
275  HANDLE hReceiveEvent = 0;
276  /* FIXME: Acquire some sort of interface lock */
277  /* FIXME: Need some sort of context for this callback. Need to determine
278  * how this is actually done with the SP
279  */
280  /* FIXME: Who needs to delete the message when done? */
281  switch( lpMsg->dwType )
282  {
284  {
286 
287  if( msg->dwPlayerType == DPPLAYERTYPE_PLAYER )
288  {
289  hr = DP_IF_CreatePlayer( This, lpMessageHeader, msg->dpId,
290  &msg->dpnName, 0, msg->lpData,
291  msg->dwDataSize, msg->dwFlags, ... );
292  }
293  else if( msg->dwPlayerType == DPPLAYERTYPE_GROUP )
294  {
295  /* Group in group situation? */
296  if( msg->dpIdParent == DPID_NOPARENT_GROUP )
297  {
298  hr = DP_IF_CreateGroup( This, lpMessageHeader, msg->dpId,
299  &msg->dpnName, 0, msg->lpData,
300  msg->dwDataSize, msg->dwFlags, ... );
301  }
302  else /* Group in Group */
303  {
304  hr = DP_IF_CreateGroupInGroup( This, lpMessageHeader, msg->dpIdParent,
305  &msg->dpnName, 0, msg->lpData,
306  msg->dwDataSize, msg->dwFlags, ... );
307  }
308  }
309  else /* Hmmm? */
310  {
311  ERR( "Corrupt msg->dwPlayerType for DPSYS_CREATEPLAYERORGROUP\n" );
312  return;
313  }
314 
315  break;
316  }
317 
319  {
321 
322  if( msg->dwPlayerType == DPPLAYERTYPE_PLAYER )
323  {
324  hr = DP_IF_DestroyPlayer( This, msg->dpId, ... );
325  }
326  else if( msg->dwPlayerType == DPPLAYERTYPE_GROUP )
327  {
328  hr = DP_IF_DestroyGroup( This, msg->dpId, ... );
329  }
330  else /* Hmmm? */
331  {
332  ERR( "Corrupt msg->dwPlayerType for DPSYS_DESTROYPLAYERORGROUP\n" );
333  return;
334  }
335 
336  break;
337  }
338 
340  {
342 
343  hr = DP_IF_AddPlayerToGroup( This, msg->dpIdGroup, msg->dpIdPlayer, ... );
344  break;
345  }
346 
348  {
350 
351  hr = DP_IF_DeletePlayerFromGroup( This, msg->dpIdGroup, msg->dpIdPlayer,
352  ... );
353 
354  break;
355  }
356 
357  case DPSYS_SESSIONLOST:
358  {
359  LPDPMSG_SESSIONLOST msg = lpMsg;
360 
361  FIXME( "DPSYS_SESSIONLOST not handled\n" );
362 
363  break;
364  }
365 
366  case DPSYS_HOST:
367  {
368  LPDPMSG_HOST msg = lpMsg;
369 
370  FIXME( "DPSYS_HOST not handled\n" );
371 
372  break;
373  }
374 
376  {
378 
379  if( msg->dwPlayerType == DPPLAYERTYPE_PLAYER )
380  {
381  hr = DP_IF_SetPlayerData( This, msg->dpId, msg->lpData, msg->dwDataSize, DPSET_REMOTE, ... );
382  }
383  else if( msg->dwPlayerType == DPPLAYERTYPE_GROUP )
384  {
385  hr = DP_IF_SetGroupData( This, msg->dpId, msg->lpData, msg->dwDataSize,
386  DPSET_REMOTE, ... );
387  }
388  else /* Hmmm? */
389  {
390  ERR( "Corrupt msg->dwPlayerType for LPDPMSG_SETPLAYERORGROUPDATA\n" );
391  return;
392  }
393 
394  break;
395  }
396 
398  {
400 
401  if( msg->dwPlayerType == DPPLAYERTYPE_PLAYER )
402  {
403  hr = DP_IF_SetPlayerName( This, msg->dpId, msg->dpnName, ... );
404  }
405  else if( msg->dwPlayerType == DPPLAYERTYPE_GROUP )
406  {
407  hr = DP_IF_SetGroupName( This, msg->dpId, msg->dpnName, ... );
408  }
409  else /* Hmmm? */
410  {
411  ERR( "Corrupt msg->dwPlayerType for LPDPMSG_SETPLAYERORGROUPDATA\n" );
412  return;
413  }
414 
415  break;
416  }
417 
419  {
420  LPDPMSG_SETSESSIONDESC msg = lpMsg;
421 
422  hr = DP_IF_SetSessionDesc( This, &msg->dpDesc );
423 
424  break;
425  }
426 
428  {
430 
431  hr = DP_IF_AddGroupToGroup( This, msg->dpIdParentGroup, msg->dpIdGroup,
432  ... );
433 
434  break;
435  }
436 
438  {
440 
441  hr = DP_IF_DeleteGroupFromGroup( This, msg->dpIdParentGroup,
442  msg->dpIdGroup, ... );
443 
444  break;
445  }
446 
447  case DPSYS_SECUREMESSAGE:
448  {
449  LPDPMSG_SECUREMESSAGE msg = lpMsg;
450 
451  FIXME( "DPSYS_SECUREMESSAGE not implemented\n" );
452 
453  break;
454  }
455 
456  case DPSYS_STARTSESSION:
457  {
458  LPDPMSG_STARTSESSION msg = lpMsg;
459 
460  FIXME( "DPSYS_STARTSESSION not implemented\n" );
461 
462  break;
463  }
464 
465  case DPSYS_CHAT:
466  {
467  LPDPMSG_CHAT msg = lpMsg;
468 
469  FIXME( "DPSYS_CHAT not implemented\n" );
470 
471  break;
472  }
473 
474  case DPSYS_SETGROUPOWNER:
475  {
476  LPDPMSG_SETGROUPOWNER msg = lpMsg;
477 
478  FIXME( "DPSYS_SETGROUPOWNER not implemented\n" );
479 
480  break;
481  }
482 
483  case DPSYS_SENDCOMPLETE:
484  {
485  LPDPMSG_SENDCOMPLETE msg = lpMsg;
486 
487  FIXME( "DPSYS_SENDCOMPLETE not implemented\n" );
488 
489  break;
490  }
491 
492  default:
493  {
494  /* NOTE: This should be a user defined type. There is nothing that we
495  * need to do with it except queue it.
496  */
497  TRACE( "Received user message type(?) 0x%08lx through SP.\n",
498  lpMsg->dwType );
499  break;
500  }
501  }
502 
503  FIXME( "Queue message in the receive queue. Need some context data!\n" );
504 
505  if( FAILED(hr) )
506  {
507  ERR( "Unable to perform action for msg type 0x%08lx\n", lpMsg->dwType );
508  }
509  /* If a receive event was registered for this player, invoke it */
510  if( hReceiveEvent )
511  {
512  SetEvent( hReceiveEvent );
513  }
514 #endif
515 }
#define DPSET_REMOTE
Definition: dplay.h:1056
static HRESULT DP_IF_CreatePlayer(IDirectPlayImpl *This, void *lpMsgHdr, DPID *lpidPlayer, DPNAME *lpPlayerName, HANDLE hEvent, void *lpData, DWORD dwDataSize, DWORD dwFlags, BOOL bAnsi)
Definition: dplay.c:1498
HRESULT hr
Definition: shlfolder.c:183
#define DPSYS_SETSESSIONDESC
Definition: dplay.h:1109
#define DPSYS_SETPLAYERORGROUPNAME
Definition: dplay.h:1106
#define DPSYS_HOST
Definition: dplay.h:1100
#define DPSYS_DESTROYPLAYERORGROUP
Definition: dplay.h:1088
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
static HRESULT DP_IF_DestroyGroup(IDirectPlayImpl *This, void *lpMsgHdr, DPID idGroup, BOOL bAnsi)
Definition: dplay.c:1905
LPCSTR DPLAYX_HresultToString(HRESULT hr)
static IDirectPlaySPImpl * impl_from_IDirectPlaySP(IDirectPlaySP *iface)
Definition: dplaysp.c:58
#define DPSYS_SECUREMESSAGE
Definition: dplay.h:1118
#define DPSYS_CHAT
Definition: dplay.h:1124
static HRESULT DP_IF_CreateGroupInGroup(IDirectPlayImpl *This, void *lpMsgHdr, DPID idParentGroup, DPID *lpidGroup, DPNAME *lpGroupName, void *lpData, DWORD dwDataSize, DWORD dwFlags, BOOL bAnsi)
Definition: dplay.c:4020
#define DP_OK
Definition: dplay.h:88
#define DPSYS_CREATEPLAYERORGROUP
Definition: dplay.h:1085
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define DPSYS_ADDPLAYERTOGROUP
Definition: dplay.h:1091
#define DPSYS_SETPLAYERORGROUPDATA
Definition: dplay.h:1103
#define DPSYS_SESSIONLOST
Definition: dplay.h:1097
#define DPSYS_SETGROUPOWNER
Definition: dplay.h:1127
#define DPPLAYERTYPE_GROUP
Definition: dplay.h:1134
#define DPSYS_DELETEGROUPFROMGROUP
Definition: dplay.h:1115
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT DP_IF_SetPlayerName(IDirectPlayImpl *This, DPID idPlayer, DPNAME *lpPlayerName, DWORD dwFlags, BOOL bAnsi)
Definition: dplay.c:3698
LONG HRESULT
Definition: typedefs.h:77
#define DPSYS_ADDGROUPTOGROUP
Definition: dplay.h:1112
unsigned short WORD
Definition: ntddk_ex.h:93
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define DPMSGMAGIC_DPLAYMSG
static HRESULT DP_IF_CreateGroup(IDirectPlayImpl *This, void *lpMsgHdr, DPID *lpidGroup, DPNAME *lpGroupName, void *lpData, DWORD dwDataSize, DWORD dwFlags, BOOL bAnsi)
Definition: dplay.c:1084
#define DPERR_GENERIC
Definition: dplay.h:99
HRESULT DP_HandleMessage(IDirectPlayImpl *This, const void *lpcMessageBody, DWORD dwMessageBodySize, const void *lpcMessageHeader, WORD wCommandId, WORD wVersion, void **lplpReply, DWORD *lpdwMsgSize)
Definition: dplay.c:270
#define DPPLAYERTYPE_PLAYER
Definition: dplay.h:1135
static HRESULT DP_IF_DestroyPlayer(IDirectPlayImpl *This, void *lpMsgHdr, DPID idPlayer, BOOL bAnsi)
Definition: dplay.c:2000
#define ERR(fmt,...)
Definition: debug.h:109
#define DPID_NOPARENT_GROUP
Definition: dplay.c:77
#define DPSYS_SENDCOMPLETE
Definition: dplay.h:1130
static HRESULT DP_IF_SetGroupName(IDirectPlayImpl *This, DPID idGroup, DPNAME *lpGroupName, DWORD dwFlags, BOOL bAnsi)
Definition: dplay.c:3565
#define msg(x)
Definition: auth_time.c:54
uint32_t * LPDWORD
Definition: typedefs.h:57
#define DPSYS_DELETEPLAYERFROMGROUP
Definition: dplay.h:1094
#define DPSYS_STARTSESSION
Definition: dplay.h:1121

◆ IDirectPlaySPImpl_QueryInterface()

static HRESULT WINAPI IDirectPlaySPImpl_QueryInterface ( IDirectPlaySP *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 63 of file dplaysp.c.

65 {
66  TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid( riid ), ppv );
67 
68  if ( IsEqualGUID( &IID_IUnknown, riid ) || IsEqualGUID( &IID_IDirectPlaySP, riid ) )
69  {
70  *ppv = iface;
71  IDirectPlaySP_AddRef( iface );
72  return S_OK;
73  }
74 
75  FIXME( "Unsupported interface %s\n", debugstr_guid( riid ) );
76  *ppv = NULL;
77  return E_NOINTERFACE;
78 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IDirectPlaySP_AddRef(p)
Definition: dplaysp.h:96
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ IDirectPlaySPImpl_Release()

static ULONG WINAPI IDirectPlaySPImpl_Release ( IDirectPlaySP *  iface)
static

Definition at line 90 of file dplaysp.c.

91 {
94 
95  TRACE( "(%p) ref=%d\n", This, ref );
96 
97  if( !ref )
98  {
99  HeapFree( GetProcessHeap(), 0, This->remote_data );
100  HeapFree( GetProcessHeap(), 0, This->local_data );
101  HeapFree( GetProcessHeap(), 0, This );
102  }
103 
104  return ref;
105 }
static IDirectPlaySPImpl * impl_from_IDirectPlaySP(IDirectPlaySP *iface)
Definition: dplaysp.c:58
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ IDirectPlaySPImpl_SendComplete()

static void WINAPI IDirectPlaySPImpl_SendComplete ( IDirectPlaySP *  iface,
void unknownA,
DWORD  unknownB 
)
static

Definition at line 658 of file dplaysp.c.

660 {
662 
663  FIXME( "(%p)->(%p,0x%08x): stub\n",
664  This, unknownA, unknownB );
665 }
static IDirectPlaySPImpl * impl_from_IDirectPlaySP(IDirectPlaySP *iface)
Definition: dplaysp.c:58
#define FIXME(fmt,...)
Definition: debug.h:110

◆ IDirectPlaySPImpl_SetSPData()

static HRESULT WINAPI IDirectPlaySPImpl_SetSPData ( IDirectPlaySP *  iface,
void lpData,
DWORD  dwDataSize,
DWORD  dwFlags 
)
static

Definition at line 613 of file dplaysp.c.

615 {
617  LPVOID lpSpData;
618 
619  TRACE( "(%p)->(%p,0x%08x,0x%08x)\n", This, lpData, dwDataSize, dwFlags );
620 
621 #if 0
622  /* This is what the documentation says... */
623  if( dwFlags != DPSET_REMOTE )
624  {
625  return DPERR_INVALIDPARAMS;
626  }
627 #else
628  /* ... but most service providers call this with 1 */
629  /* Guess that this is using a DPSET_LOCAL or DPSET_REMOTE type of
630  * thing?
631  */
632  if( dwFlags != DPSET_REMOTE )
633  {
634  TRACE( "Undocumented dwFlags 0x%08x used\n", dwFlags );
635  }
636 #endif
637 
638  lpSpData = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwDataSize );
639  CopyMemory( lpSpData, lpData, dwDataSize );
640 
641  /* If we have data already allocated, free it and replace it */
642  if( dwFlags == DPSET_REMOTE )
643  {
644  HeapFree( GetProcessHeap(), 0, This->remote_data );
645  This->remote_data_size = dwDataSize;
646  This->remote_data = lpSpData;
647  }
648  else if ( dwFlags == DPSET_LOCAL )
649  {
650  HeapFree( GetProcessHeap(), 0, This->local_data );
651  This->local_data = lpSpData;
652  This->local_data_size = dwDataSize;
653  }
654 
655  return DP_OK;
656 }
#define DPSET_REMOTE
Definition: dplay.h:1056
#define DPERR_INVALIDPARAMS
Definition: dplay.h:103
#define DPSET_LOCAL
Definition: dplay.h:1057
static IDirectPlaySPImpl * impl_from_IDirectPlaySP(IDirectPlaySP *iface)
Definition: dplaysp.c:58
#define DP_OK
Definition: dplay.h:88
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define CopyMemory
Definition: winbase.h:1640
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ IDirectPlaySPImpl_SetSPPlayerData()

static HRESULT WINAPI IDirectPlaySPImpl_SetSPPlayerData ( IDirectPlaySP *  iface,
DPID  idPlayer,
void lpData,
DWORD  dwDataSize,
DWORD  dwFlags 
)
static

Definition at line 517 of file dplaysp.c.

519 {
521  HRESULT hr;
522  LPDP_SPPLAYERDATA lpPlayerEntry;
524 
525  TRACE( "(%p)->(0x%08x,%p,0x%08x,0x%08x)\n", This, idPlayer, lpData, dwDataSize, dwFlags );
526 
527  hr = DP_GetSPPlayerData( This->dplay, idPlayer, (void**)&lpPlayerEntry );
528  if( FAILED(hr) )
529  {
530  /* Player must not exist */
531  return DPERR_INVALIDPLAYER;
532  }
533 
535  CopyMemory( lpPlayerData, lpData, dwDataSize );
536 
537  if( dwFlags == DPSET_LOCAL )
538  {
539  lpPlayerEntry->lpPlayerLocalData = lpPlayerData;
540  lpPlayerEntry->dwPlayerLocalDataSize = dwDataSize;
541  }
542  else if( dwFlags == DPSET_REMOTE )
543  {
544  lpPlayerEntry->lpPlayerRemoteData = lpPlayerData;
545  lpPlayerEntry->dwPlayerRemoteDataSize = dwDataSize;
546  }
547 
548  hr = DP_SetSPPlayerData( This->dplay, idPlayer, lpPlayerEntry );
549 
550  return hr;
551 }
#define DPSET_REMOTE
Definition: dplay.h:1056
LPVOID lpPlayerRemoteData
Definition: dplaysp.c:53
#define DPERR_INVALIDPLAYER
Definition: dplay.h:104
HRESULT hr
Definition: shlfolder.c:183
#define DPSET_LOCAL
Definition: dplay.h:1057
static IDirectPlaySPImpl * impl_from_IDirectPlaySP(IDirectPlaySP *iface)
Definition: dplaysp.c:58
DWORD dwPlayerRemoteDataSize
Definition: dplaysp.c:54
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HRESULT DP_SetSPPlayerData(IDirectPlayImpl *lpDP, DPID idPlayer, void *lpData)
Definition: dplay.c:5732
LONG HRESULT
Definition: typedefs.h:77
struct PlayerData * lpPlayerData
Definition: dplay_global.h:81
#define CopyMemory
Definition: winbase.h:1640
LPVOID lpPlayerLocalData
Definition: dplaysp.c:50
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
HRESULT DP_GetSPPlayerData(IDirectPlayImpl *lpDP, DPID idPlayer, void **lplpData)
Definition: dplay.c:5718
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
DWORD dwPlayerLocalDataSize
Definition: dplaysp.c:51

◆ impl_from_IDirectPlaySP()

static IDirectPlaySPImpl* impl_from_IDirectPlaySP ( IDirectPlaySP *  iface)
inlinestatic

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( dplay  )

Variable Documentation

◆ directPlaySPVT

const IDirectPlaySPVtbl directPlaySPVT
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectPlaySPImpl_CreateCompoundAddress(IDirectPlaySP *iface, const DPCOMPOUNDADDRESSELEMENT *lpElements, DWORD dwElementCount, void *lpAddress, DWORD *lpdwAddressSize)
Definition: dplaysp.c:553
static HRESULT WINAPI IDirectPlaySPImpl_GetSPPlayerData(IDirectPlaySP *iface, DPID idPlayer, void **lplpData, DWORD *lpdwDataSize, DWORD dwFlags)
Definition: dplaysp.c:171
static HRESULT WINAPI IDirectPlaySPImpl_GetSPData(IDirectPlaySP *iface, void **lplpData, DWORD *lpdwDataSize, DWORD dwFlags)
Definition: dplaysp.c:565
static HRESULT WINAPI IDirectPlaySPImpl_AddMRUEntry(IDirectPlaySP *iface, LPCWSTR lpSection, LPCWSTR lpKey, const void *lpData, DWORD dwDataSize, DWORD dwMaxEntries)
Definition: dplaysp.c:107
static HRESULT WINAPI IDirectPlaySPImpl_EnumAddress(IDirectPlaySP *iface, LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, const void *lpAddress, DWORD dwAddressSize, void *lpContext)
Definition: dplaysp.c:133
static ULONG WINAPI IDirectPlaySPImpl_AddRef(IDirectPlaySP *iface)
Definition: dplaysp.c:80
static ULONG WINAPI IDirectPlaySPImpl_Release(IDirectPlaySP *iface)
Definition: dplaysp.c:90
static HRESULT WINAPI IDirectPlaySPImpl_SetSPPlayerData(IDirectPlaySP *iface, DPID idPlayer, void *lpData, DWORD dwDataSize, DWORD dwFlags)
Definition: dplaysp.c:517
static HRESULT WINAPI IDirectPlaySPImpl_SetSPData(IDirectPlaySP *iface, void *lpData, DWORD dwDataSize, DWORD dwFlags)
Definition: dplaysp.c:613
static void WINAPI IDirectPlaySPImpl_SendComplete(IDirectPlaySP *iface, void *unknownA, DWORD unknownB)
Definition: dplaysp.c:658
static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage(IDirectPlaySP *iface, void *lpMessageBody, DWORD dwMessageBodySize, void *lpMessageHeader)
Definition: dplaysp.c:209
static HRESULT WINAPI IDirectPlaySPImpl_QueryInterface(IDirectPlaySP *iface, REFIID riid, void **ppv)
Definition: dplaysp.c:63
static HRESULT WINAPI IDirectPlaySPImpl_GetPlayerFlags(IDirectPlaySP *iface, DPID idPlayer, DWORD *lpdwPlayerFlags)
Definition: dplaysp.c:160
static HRESULT WINAPI IDirectPlaySPImpl_EnumMRUEntries(IDirectPlaySP *iface, LPCWSTR lpSection, LPCWSTR lpKey, LPENUMMRUCALLBACK lpEnumMRUCallback, void *lpContext)
Definition: dplaysp.c:147
static HRESULT WINAPI IDirectPlaySPImpl_CreateAddress(IDirectPlaySP *iface, REFGUID guidSP, REFGUID guidDataType, const void *lpData, DWORD dwDataSize, void *lpAddress, DWORD *lpdwAddressSize)
Definition: dplaysp.c:120

Definition at line 667 of file dplaysp.c.

Referenced by dplaysp_create().