ReactOS  0.4.14-dev-55-g2da92ac
dplayx_global.c File Reference
#include <stdarg.h>
#include <string.h>
#include "wine/debug.h"
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/unicode.h"
#include "wingdi.h"
#include "winuser.h"
#include "dplayx_global.h"
#include "dplayx_messages.h"
Include dependency graph for dplayx_global.c:

Go to the source code of this file.

Classes

struct  DPLAYX_MEM_SLICE
 
struct  tagDPLAYX_LOBBYDATA
 

Macros

#define NONAMELESSUNION
 
#define DPLAYX_AcquireSemaphore()
 
#define DPLAYX_ReleaseSemaphore()
 
#define dwStaticSharedSize   (128 * 1024) /* 128 KBytes */
 
#define dwDynamicSharedSize   (512 * 1024) /* 512 KBytes */
 
#define dwTotalSharedSize   ( dwStaticSharedSize + dwDynamicSharedSize )
 
#define dwBlockSize   512
 
#define dwMaxBlock   (dwDynamicSharedSize/dwBlockSize)
 

Typedefs

typedef struct tagDPLAYX_LOBBYDATA DPLAYX_LOBBYDATA
 
typedef struct tagDPLAYX_LOBBYDATALPDPLAYX_LOBBYDATA
 

Enumerations

enum  { numSupportedLobbies = 32, numSupportedSessions = 32 }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (dplay)
 
 C_ASSERT (sizeof(DPLAYX_MEM_SLICE)==dwBlockSize)
 
static void DPLAYX_PrivHeapFree (LPVOID addr)
 
static LPVOID DPLAYX_PrivHeapAlloc (DWORD flags, DWORD size)
 
static void DPLAYX_InitializeLobbyDataEntry (LPDPLAYX_LOBBYDATA lpData)
 
static BOOL DPLAYX_IsAppIdLobbied (DWORD dwAppID, LPDPLAYX_LOBBYDATA *lplpDplData)
 
BOOL DPLAYX_CreateLobbyApplication (DWORD dwAppID)
 
BOOL DPLAYX_SetLobbyHandles (DWORD dwAppID, HANDLE hStart, HANDLE hDeath, HANDLE hConnRead)
 
static BOOL DPLAYX_GetThisLobbyHandles (LPHANDLE lphStart, LPHANDLE lphDeath, LPHANDLE lphConnRead, BOOL bClearSetHandles)
 
BOOL DPLAYX_ConstructData (void)
 
BOOL DPLAYX_DestructData (void)
 
static void DPLAYX_CopyConnStructA (LPDPLCONNECTION dest, const DPLCONNECTION *src)
 
static void DPLAYX_CopyConnStructW (LPDPLCONNECTION dest, const DPLCONNECTION *src)
 
static DWORD DPLAYX_SizeOfLobbyDataA (const DPLCONNECTION *lpConn)
 
static DWORD DPLAYX_SizeOfLobbyDataW (const DPLCONNECTION *lpConn)
 
HRESULT DPLAYX_GetConnectionSettingsA (DWORD dwAppID, LPVOID lpData, LPDWORD lpdwDataSize)
 
HRESULT DPLAYX_GetConnectionSettingsW (DWORD dwAppID, LPVOID lpData, LPDWORD lpdwDataSize)
 
HRESULT DPLAYX_SetConnectionSettingsA (DWORD dwFlags, DWORD dwAppID, const DPLCONNECTION *lpConn)
 
HRESULT DPLAYX_SetConnectionSettingsW (DWORD dwFlags, DWORD dwAppID, const DPLCONNECTION *lpConn)
 
BOOL DPLAYX_WaitForConnectionSettings (BOOL bWait)
 
BOOL DPLAYX_AnyLobbiesWaitingForConnSettings (void)
 
BOOL DPLAYX_SetLobbyMsgThreadId (DWORD dwAppId, DWORD dwThreadId)
 
LPCSTR DPLAYX_HresultToString (HRESULT hr)
 

Variables

typedef helpstring
 
static const char lpszDplayxSemaName [] = "WINE_DPLAYX_SM"
 
static HANDLE hDplayxSema
 
static const char lpszDplayxFileMapping [] = "WINE_DPLAYX_FM"
 
static HANDLE hDplayxSharedMem
 
static LPVOID lpSharedStaticData = NULL
 
static DPLAYX_MEM_SLICElpMemArea
 
static DPLAYX_LOBBYDATAlobbyData = NULL
 
static DPSESSIONDESC2sessionData = NULL
 

Macro Definition Documentation

◆ DPLAYX_AcquireSemaphore

#define DPLAYX_AcquireSemaphore ( )
Value:
TRACE( "Waiting for DPLAYX semaphore\n" ); \
WaitForSingleObject( hDplayxSema, INFINITE );\
TRACE( "Through wait\n" )
#define TRACE(s)
Definition: solgame.cpp:4
static HANDLE hDplayxSema
Definition: dplayx_global.c:55
#define INFINITE
Definition: serial.h:102

Definition at line 63 of file dplayx_global.c.

◆ DPLAYX_ReleaseSemaphore

#define DPLAYX_ReleaseSemaphore ( )
Value:
TRACE( "DPLAYX Semaphore released\n" ) /* FIXME: Is this correct? */
smooth NULL
Definition: ftsmooth.c:416
static HANDLE hDplayxSema
Definition: dplayx_global.c:55
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:542

Definition at line 67 of file dplayx_global.c.

◆ dwBlockSize

#define dwBlockSize   512

Definition at line 81 of file dplayx_global.c.

◆ dwDynamicSharedSize

#define dwDynamicSharedSize   (512 * 1024) /* 512 KBytes */

Definition at line 73 of file dplayx_global.c.

◆ dwMaxBlock

Definition at line 82 of file dplayx_global.c.

◆ dwStaticSharedSize

#define dwStaticSharedSize   (128 * 1024) /* 128 KBytes */

Definition at line 72 of file dplayx_global.c.

◆ dwTotalSharedSize

#define dwTotalSharedSize   ( dwStaticSharedSize + dwDynamicSharedSize )

Definition at line 74 of file dplayx_global.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 35 of file dplayx_global.c.

Typedef Documentation

◆ DPLAYX_LOBBYDATA

◆ LPDPLAYX_LOBBYDATA

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
numSupportedLobbies 
numSupportedSessions 

Definition at line 146 of file dplayx_global.c.

Function Documentation

◆ C_ASSERT()

C_ASSERT ( sizeof(DPLAYX_MEM_SLICE = =dwBlockSize)

◆ DPLAYX_AnyLobbiesWaitingForConnSettings()

BOOL DPLAYX_AnyLobbiesWaitingForConnSettings ( void  )

Definition at line 1018 of file dplayx_global.c.

1019 {
1020  UINT i;
1021  BOOL bFound = FALSE;
1022 
1024 
1025  for( i=0; i < numSupportedLobbies; i++ )
1026  {
1027  if( ( lobbyData[ i ].dwAppID != 0 ) && /* lobby initialized */
1028  ( lobbyData[ i ].bWaitForConnectionSettings ) /* Waiting */
1029  )
1030  {
1031  bFound = TRUE;
1032  break;
1033  }
1034  }
1035 
1037 
1038  return bFound;
1039 }
#define TRUE
Definition: types.h:120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DPLAYX_ReleaseSemaphore()
Definition: dplayx_global.c:67
#define DPLAYX_AcquireSemaphore()
Definition: dplayx_global.c:63
unsigned int UINT
Definition: ndis.h:50
static DPLAYX_LOBBYDATA * lobbyData

Referenced by IDirectPlayLobby3AImpl_RunApplication().

◆ DPLAYX_ConstructData()

BOOL DPLAYX_ConstructData ( void  )

Definition at line 358 of file dplayx_global.c.

359 {
360  SECURITY_ATTRIBUTES s_attrib;
361  BOOL bInitializeSharedMemory = FALSE;
362  LPVOID lpDesiredMemoryMapStart = (LPVOID)0x50000000;
363  HANDLE hInformOnStart;
364 
365  TRACE( "DPLAYX dll loaded - construct called\n" );
366 
367  /* Create a semaphore to block access to DPLAYX global data structs */
368 
369  s_attrib.bInheritHandle = TRUE;
370  s_attrib.lpSecurityDescriptor = NULL;
371  s_attrib.nLength = sizeof(s_attrib);
372 
373  hDplayxSema = CreateSemaphoreA( &s_attrib, 0, 1, lpszDplayxSemaName );
374 
375  /* First instance creates the semaphore. Others just use it */
376  if( GetLastError() == ERROR_SUCCESS )
377  {
378  TRACE( "Semaphore %p created\n", hDplayxSema );
379 
380  /* The semaphore creator will also build the shared memory */
381  bInitializeSharedMemory = TRUE;
382  }
383  else if ( GetLastError() == ERROR_ALREADY_EXISTS )
384  {
385  TRACE( "Found semaphore handle %p\n", hDplayxSema );
387  }
388  else
389  {
390  ERR( ": semaphore error %d\n", GetLastError() );
391  return FALSE;
392  }
393 
395 
397  &s_attrib,
399  0,
402 
403  if( GetLastError() == ERROR_SUCCESS )
404  {
405  TRACE( "File mapped %p created\n", hDplayxSharedMem );
406  }
407  else if ( GetLastError() == ERROR_ALREADY_EXISTS )
408  {
409  TRACE( "Found FileMapping handle %p\n", hDplayxSharedMem );
410  }
411  else
412  {
413  ERR( ": unable to create shared memory (%d)\n", GetLastError() );
415  return FALSE;
416  }
417 
420  0, 0, 0, lpDesiredMemoryMapStart );
421 
422  if( lpSharedStaticData == NULL )
423  {
424  ERR( ": unable to map static data into process memory space (%d)\n",
425  GetLastError() );
427  return FALSE;
428  }
429  else
430  {
431  if( lpDesiredMemoryMapStart == lpSharedStaticData )
432  {
433  TRACE( "File mapped to %p\n", lpSharedStaticData );
434  }
435  else
436  {
437  /* Presently the shared data structures use pointers. If the
438  * files are not mapped into the same area, the pointers will no
439  * longer make any sense :(
440  * FIXME: In the future make the shared data structures have some
441  * sort of fixup to make them independent between data spaces.
442  * This will also require a rework of the session data stuff.
443  */
444  ERR( "File mapped to %p (not %p). Expect failure\n",
445  lpSharedStaticData, lpDesiredMemoryMapStart );
446  }
447  }
448 
449  /* Dynamic area starts just after the static area */
451 
452  /* FIXME: Crude hack */
455 
456  /* Initialize shared data segments. */
457  if( bInitializeSharedMemory )
458  {
459  UINT i;
460 
461  TRACE( "Initializing shared memory\n" );
462 
463  /* Set all lobbies to be "empty" */
464  for( i=0; i < numSupportedLobbies; i++ )
465  {
467  }
468 
469  /* Set all sessions to be "empty" */
470  for( i=0; i < numSupportedSessions; i++ )
471  {
472  sessionData[i].dwSize = 0;
473  }
474 
475  /* Zero out the dynamic area */
477 
478  /* Just for fun sync the whole data area */
480  }
481 
483 
484  /* Everything was created correctly. Signal the lobby client that
485  * we started up correctly
486  */
487  if( DPLAYX_GetThisLobbyHandles( &hInformOnStart, NULL, NULL, FALSE ) &&
488  hInformOnStart
489  )
490  {
491  BOOL bSuccess;
492  bSuccess = SetEvent( hInformOnStart );
493  TRACE( "Signalling lobby app start event %p %s\n",
494  hInformOnStart, bSuccess ? "succeed" : "failed" );
495 
496  /* Close out handle */
497  DPLAYX_GetThisLobbyHandles( &hInformOnStart, NULL, NULL, TRUE );
498  }
499 
500  return TRUE;
501 }
LPVOID NTAPI MapViewOfFileEx(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress)
Definition: filemap.c:162
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:430
static DPLAYX_MEM_SLICE * lpMemArea
Definition: dplayx_global.c:91
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
static BOOLEAN bSuccess
Definition: drive.cpp:417
DWORD dwSize
Definition: dplay.h:232
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SEC_COMMIT
Definition: mmtypes.h:99
unsigned int BOOL
Definition: ntddk_ex.h:94
static DPSESSIONDESC2 * sessionData
smooth NULL
Definition: ftsmooth.c:416
#define dwDynamicSharedSize
Definition: dplayx_global.c:73
#define TRACE(s)
Definition: solgame.cpp:4
static LPVOID lpSharedStaticData
Definition: dplayx_global.c:60
#define FILE_MAP_WRITE
Definition: winbase.h:154
static HANDLE hDplayxSema
Definition: dplayx_global.c:55
#define dwTotalSharedSize
Definition: dplayx_global.c:74
#define SetLastError(x)
Definition: compat.h:409
static const char lpszDplayxSemaName[]
Definition: dplayx_global.c:54
#define LPVOID
Definition: nt_native.h:45
static HANDLE hDplayxSharedMem
Definition: dplayx_global.c:58
#define dwStaticSharedSize
Definition: dplayx_global.c:72
unsigned char BYTE
Definition: mem.h:68
#define DPLAYX_ReleaseSemaphore()
Definition: dplayx_global.c:67
#define ERR(fmt,...)
Definition: debug.h:109
static const char lpszDplayxFileMapping[]
Definition: dplayx_global.c:57
LPVOID lpSecurityDescriptor
Definition: compat.h:181
BOOL NTAPI FlushViewOfFile(IN LPCVOID lpBaseAddress, IN SIZE_T dwNumberOfBytesToFlush)
Definition: filemap.c:352
#define DPLAYX_AcquireSemaphore()
Definition: dplayx_global.c:63
unsigned int UINT
Definition: ndis.h:50
static DPLAYX_LOBBYDATA * lobbyData
static void DPLAYX_InitializeLobbyDataEntry(LPDPLAYX_LOBBYDATA lpData)
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
static BOOL DPLAYX_GetThisLobbyHandles(LPHANDLE lphStart, LPHANDLE lphDeath, LPHANDLE lphConnRead, BOOL bClearSetHandles)
HANDLE NTAPI CreateFileMappingA(IN HANDLE hFile, IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes, IN DWORD flProtect, IN DWORD dwMaximumSizeHigh, IN DWORD dwMaximumSizeLow, IN LPCSTR lpName)
Definition: filemap.c:23
#define PAGE_READWRITE
Definition: nt_native.h:1304

Referenced by DllMain().

◆ DPLAYX_CopyConnStructA()

static void DPLAYX_CopyConnStructA ( LPDPLCONNECTION  dest,
const DPLCONNECTION src 
)
static

Definition at line 541 of file dplayx_global.c.

542 {
543  BYTE* lpStartOfFreeSpace;
544 
545  *dest = *src;
546 
547  lpStartOfFreeSpace = ((BYTE*)dest) + sizeof( DPLCONNECTION );
548 
549  /* Copy the LPDPSESSIONDESC2 structure if it exists */
550  if( src->lpSessionDesc )
551  {
552  dest->lpSessionDesc = (LPDPSESSIONDESC2)lpStartOfFreeSpace;
553  lpStartOfFreeSpace += sizeof( DPSESSIONDESC2 );
554  *dest->lpSessionDesc = *src->lpSessionDesc;
555 
556  /* Session names may or may not exist */
557  if( src->lpSessionDesc->u1.lpszSessionNameA )
558  {
559  strcpy( (LPSTR)lpStartOfFreeSpace, src->lpSessionDesc->u1.lpszSessionNameA );
560  dest->lpSessionDesc->u1.lpszSessionNameA = (LPSTR)lpStartOfFreeSpace;
561  lpStartOfFreeSpace +=
562  strlen( dest->lpSessionDesc->u1.lpszSessionNameA ) + 1;
563  }
564 
565  if( src->lpSessionDesc->u2.lpszPasswordA )
566  {
567  strcpy( (LPSTR)lpStartOfFreeSpace, src->lpSessionDesc->u2.lpszPasswordA );
568  dest->lpSessionDesc->u2.lpszPasswordA = (LPSTR)lpStartOfFreeSpace;
569  lpStartOfFreeSpace +=
570  strlen( dest->lpSessionDesc->u2.lpszPasswordA ) + 1;
571  }
572  }
573 
574  /* DPNAME structure is optional */
575  if( src->lpPlayerName )
576  {
577  dest->lpPlayerName = (LPDPNAME)lpStartOfFreeSpace;
578  lpStartOfFreeSpace += sizeof( DPNAME );
579  *dest->lpPlayerName = *src->lpPlayerName;
580 
581  if( src->lpPlayerName->u1.lpszShortNameA )
582  {
583  strcpy( (LPSTR)lpStartOfFreeSpace, src->lpPlayerName->u1.lpszShortNameA );
584  dest->lpPlayerName->u1.lpszShortNameA = (LPSTR)lpStartOfFreeSpace;
585  lpStartOfFreeSpace +=
586  strlen( dest->lpPlayerName->u1.lpszShortNameA ) + 1;
587  }
588 
589  if( src->lpPlayerName->u2.lpszLongNameA )
590  {
591  strcpy( (LPSTR)lpStartOfFreeSpace, src->lpPlayerName->u2.lpszLongNameA );
592  dest->lpPlayerName->u2.lpszLongNameA = (LPSTR)lpStartOfFreeSpace;
593  lpStartOfFreeSpace +=
594  strlen( (LPSTR)dest->lpPlayerName->u2.lpszLongName ) + 1 ;
595  }
596 
597  }
598 
599  /* Copy address if it exists */
600  if( src->lpAddress )
601  {
602  dest->lpAddress = lpStartOfFreeSpace;
603  CopyMemory( lpStartOfFreeSpace, src->lpAddress, src->dwAddressSize );
604  /* No need to advance lpStartOfFreeSpace as there is no more "dynamic" data */
605  }
606 }
struct tagDPLCONNECTION DPLCONNECTION
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
struct tagDPSESSIONDESC2 * LPDPSESSIONDESC2
char * LPSTR
Definition: xmlstorage.h:182
struct tagDPNAME * LPDPNAME
struct tagDPNAME DPNAME
#define CopyMemory
Definition: winbase.h:1633
unsigned char BYTE
Definition: mem.h:68
GLenum src
Definition: glext.h:6340
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static char * dest
Definition: rtl.c:135
struct tagDPSESSIONDESC2 DPSESSIONDESC2

Referenced by DPLAYX_GetConnectionSettingsA(), and DPLAYX_SetConnectionSettingsA().

◆ DPLAYX_CopyConnStructW()

static void DPLAYX_CopyConnStructW ( LPDPLCONNECTION  dest,
const DPLCONNECTION src 
)
static

Definition at line 609 of file dplayx_global.c.

610 {
611  BYTE* lpStartOfFreeSpace;
612 
613  *dest = *src;
614 
615  lpStartOfFreeSpace = ( (BYTE*)dest) + sizeof( DPLCONNECTION );
616 
617  /* Copy the LPDPSESSIONDESC2 structure if it exists */
618  if( src->lpSessionDesc )
619  {
620  dest->lpSessionDesc = (LPDPSESSIONDESC2)lpStartOfFreeSpace;
621  lpStartOfFreeSpace += sizeof( DPSESSIONDESC2 );
622  *dest->lpSessionDesc = *src->lpSessionDesc;
623 
624  /* Session names may or may not exist */
625  if( src->lpSessionDesc->u1.lpszSessionName )
626  {
627  strcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpSessionDesc->u1.lpszSessionName );
628  dest->lpSessionDesc->u1.lpszSessionName = (LPWSTR)lpStartOfFreeSpace;
629  lpStartOfFreeSpace += sizeof(WCHAR) *
630  ( strlenW( dest->lpSessionDesc->u1.lpszSessionName ) + 1 );
631  }
632 
633  if( src->lpSessionDesc->u2.lpszPassword )
634  {
635  strcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpSessionDesc->u2.lpszPassword );
636  dest->lpSessionDesc->u2.lpszPassword = (LPWSTR)lpStartOfFreeSpace;
637  lpStartOfFreeSpace += sizeof(WCHAR) *
638  ( strlenW( dest->lpSessionDesc->u2.lpszPassword ) + 1 );
639  }
640  }
641 
642  /* DPNAME structure is optional */
643  if( src->lpPlayerName )
644  {
645  dest->lpPlayerName = (LPDPNAME)lpStartOfFreeSpace;
646  lpStartOfFreeSpace += sizeof( DPNAME );
647  *dest->lpPlayerName = *src->lpPlayerName;
648 
649  if( src->lpPlayerName->u1.lpszShortName )
650  {
651  strcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpPlayerName->u1.lpszShortName );
652  dest->lpPlayerName->u1.lpszShortName = (LPWSTR)lpStartOfFreeSpace;
653  lpStartOfFreeSpace += sizeof(WCHAR) *
654  ( strlenW( dest->lpPlayerName->u1.lpszShortName ) + 1 );
655  }
656 
657  if( src->lpPlayerName->u2.lpszLongName )
658  {
659  strcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpPlayerName->u2.lpszLongName );
660  dest->lpPlayerName->u2.lpszLongName = (LPWSTR)lpStartOfFreeSpace;
661  lpStartOfFreeSpace += sizeof(WCHAR) *
662  ( strlenW( dest->lpPlayerName->u2.lpszLongName ) + 1 );
663  }
664 
665  }
666 
667  /* Copy address if it exists */
668  if( src->lpAddress )
669  {
670  dest->lpAddress = lpStartOfFreeSpace;
671  CopyMemory( lpStartOfFreeSpace, src->lpAddress, src->dwAddressSize );
672  /* No need to advance lpStartOfFreeSpace as there is no more "dynamic" data */
673  }
674 
675 }
struct tagDPLCONNECTION DPLCONNECTION
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
struct tagDPSESSIONDESC2 * LPDPSESSIONDESC2
struct tagDPNAME * LPDPNAME
struct tagDPNAME DPNAME
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CopyMemory
Definition: winbase.h:1633
unsigned char BYTE
Definition: mem.h:68
GLenum src
Definition: glext.h:6340
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
static char * dest
Definition: rtl.c:135
struct tagDPSESSIONDESC2 DPSESSIONDESC2
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by DPLAYX_GetConnectionSettingsW(), and DPLAYX_SetConnectionSettingsW().

◆ DPLAYX_CreateLobbyApplication()

BOOL DPLAYX_CreateLobbyApplication ( DWORD  dwAppID)

Definition at line 215 of file dplayx_global.c.

216 {
217  UINT i;
218 
219  /* 0 is the marker for unused application data slots */
220  if( dwAppID == 0 )
221  {
222  return FALSE;
223  }
224 
226 
227  /* Find an empty space in the list and insert the data */
228  for( i=0; i < numSupportedLobbies; i++ )
229  {
230  if( lobbyData[ i ].dwAppID == 0 )
231  {
232  /* This process is now lobbied */
233  TRACE( "Setting lobbyData[%u] for (0x%08x,0x%08x)\n",
234  i, dwAppID, GetCurrentProcessId() );
235 
236  lobbyData[ i ].dwAppID = dwAppID;
238 
239  /* FIXME: Where is the best place for this? In interface or here? */
243 
245  return TRUE;
246  }
247  }
248 
249  ERR( "No empty lobbies\n" );
250 
252  return FALSE;
253 }
#define TRUE
Definition: types.h:120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TRACE(s)
Definition: solgame.cpp:4
#define DPLAYX_ReleaseSemaphore()
Definition: dplayx_global.c:67
#define ERR(fmt,...)
Definition: debug.h:109
#define DPLAYX_AcquireSemaphore()
Definition: dplayx_global.c:63
unsigned int UINT
Definition: ndis.h:50
static DPLAYX_LOBBYDATA * lobbyData
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158

Referenced by IDirectPlayLobby3AImpl_RunApplication(), IDirectPlayLobby3AImpl_SetConnectionSettings(), and IDirectPlayLobby3Impl_SetConnectionSettings().

◆ DPLAYX_DestructData()

BOOL DPLAYX_DestructData ( void  )

Definition at line 507 of file dplayx_global.c.

508 {
509  HANDLE hInformOnDeath;
510 
511  TRACE( "DPLAYX dll unloaded - destruct called\n" );
512 
513  /* If required, inform that this app is dying */
514  if( DPLAYX_GetThisLobbyHandles( NULL, &hInformOnDeath, NULL, FALSE ) &&
515  hInformOnDeath
516  )
517  {
518  BOOL bSuccess;
519  bSuccess = SetEvent( hInformOnDeath );
520  TRACE( "Signalling lobby app death event %p %s\n",
521  hInformOnDeath, bSuccess ? "succeed" : "failed" );
522 
523  /* Close out handle */
524  DPLAYX_GetThisLobbyHandles( NULL, &hInformOnDeath, NULL, TRUE );
525  }
526 
527  /* DO CLEAN UP (LAST) */
528 
529  /* Delete the semaphore */
531 
532  /* Delete shared memory file mapping */
535 
536  return FALSE;
537 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
static BOOLEAN bSuccess
Definition: drive.cpp:417
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static LPVOID lpSharedStaticData
Definition: dplayx_global.c:60
static HANDLE hDplayxSema
Definition: dplayx_global.c:55
static HANDLE hDplayxSharedMem
Definition: dplayx_global.c:58
#define UnmapViewOfFile
Definition: compat.h:403
static BOOL DPLAYX_GetThisLobbyHandles(LPHANDLE lphStart, LPHANDLE lphDeath, LPHANDLE lphConnRead, BOOL bClearSetHandles)

Referenced by DllMain().

◆ DPLAYX_GetConnectionSettingsA()

HRESULT DPLAYX_GetConnectionSettingsA ( DWORD  dwAppID,
LPVOID  lpData,
LPDWORD  lpdwDataSize 
)

Definition at line 776 of file dplayx_global.c.

779 {
780  LPDPLAYX_LOBBYDATA lpDplData;
781  DWORD dwRequiredDataSize = 0;
782  HANDLE hInformOnSettingRead;
783 
785 
786  if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
787  {
789 
790  TRACE( "Application 0x%08x is not lobbied\n", dwAppID );
791  return DPERR_NOTLOBBIED;
792  }
793 
794  dwRequiredDataSize = DPLAYX_SizeOfLobbyDataA( lpDplData->lpConn );
795 
796  /* Do they want to know the required buffer size or is the provided buffer
797  * big enough?
798  */
799  if ( ( lpData == NULL ) ||
800  ( *lpdwDataSize < dwRequiredDataSize )
801  )
802  {
804 
805  *lpdwDataSize = DPLAYX_SizeOfLobbyDataA( lpDplData->lpConn );
806 
807  return DPERR_BUFFERTOOSMALL;
808  }
809 
810  DPLAYX_CopyConnStructA( lpData, lpDplData->lpConn );
811 
813 
814  /* They have gotten the information - signal the event if required */
815  if( DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, FALSE ) &&
816  hInformOnSettingRead
817  )
818  {
819  BOOL bSuccess;
820  bSuccess = SetEvent( hInformOnSettingRead );
821  TRACE( "Signalling setting read event %p %s\n",
822  hInformOnSettingRead, bSuccess ? "succeed" : "failed" );
823 
824  /* Close out handle */
825  DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, TRUE );
826  }
827 
828  return DP_OK;
829 }
#define TRUE
Definition: types.h:120
#define DPERR_NOTLOBBIED
Definition: dplay.h:142
#define DPERR_BUFFERTOOSMALL
Definition: dplay.h:92
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
static BOOLEAN bSuccess
Definition: drive.cpp:417
LPDPLCONNECTION lpConn
static DWORD DPLAYX_SizeOfLobbyDataA(const DPLCONNECTION *lpConn)
#define DP_OK
Definition: dplay.h:88
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL DPLAYX_IsAppIdLobbied(DWORD dwAppID, LPDPLAYX_LOBBYDATA *lplpDplData)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
static void DPLAYX_CopyConnStructA(LPDPLCONNECTION dest, const DPLCONNECTION *src)
#define DPLAYX_ReleaseSemaphore()
Definition: dplayx_global.c:67
#define DPLAYX_AcquireSemaphore()
Definition: dplayx_global.c:63
static BOOL DPLAYX_GetThisLobbyHandles(LPHANDLE lphStart, LPHANDLE lphDeath, LPHANDLE lphConnRead, BOOL bClearSetHandles)

Referenced by IDirectPlayLobby3AImpl_GetConnectionSettings().

◆ DPLAYX_GetConnectionSettingsW()

HRESULT DPLAYX_GetConnectionSettingsW ( DWORD  dwAppID,
LPVOID  lpData,
LPDWORD  lpdwDataSize 
)

Definition at line 832 of file dplayx_global.c.

835 {
836  LPDPLAYX_LOBBYDATA lpDplData;
837  DWORD dwRequiredDataSize = 0;
838  HANDLE hInformOnSettingRead;
839 
841 
842  if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
843  {
845  return DPERR_NOTLOBBIED;
846  }
847 
848  dwRequiredDataSize = DPLAYX_SizeOfLobbyDataW( lpDplData->lpConn );
849 
850  /* Do they want to know the required buffer size or is the provided buffer
851  * big enough?
852  */
853  if ( ( lpData == NULL ) ||
854  ( *lpdwDataSize < dwRequiredDataSize )
855  )
856  {
858 
859  *lpdwDataSize = DPLAYX_SizeOfLobbyDataW( lpDplData->lpConn );
860 
861  return DPERR_BUFFERTOOSMALL;
862  }
863 
864  DPLAYX_CopyConnStructW( lpData, lpDplData->lpConn );
865 
867 
868  /* They have gotten the information - signal the event if required */
869  if( DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, FALSE ) &&
870  hInformOnSettingRead
871  )
872  {
873  BOOL bSuccess;
874  bSuccess = SetEvent( hInformOnSettingRead );
875  TRACE( "Signalling setting read event %p %s\n",
876  hInformOnSettingRead, bSuccess ? "succeed" : "failed" );
877 
878  /* Close out handle */
879  DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, TRUE );
880  }
881 
882  return DP_OK;
883 }
#define TRUE
Definition: types.h:120
#define DPERR_NOTLOBBIED
Definition: dplay.h:142
#define DPERR_BUFFERTOOSMALL
Definition: dplay.h:92
static void DPLAYX_CopyConnStructW(LPDPLCONNECTION dest, const DPLCONNECTION *src)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
static DWORD DPLAYX_SizeOfLobbyDataW(const DPLCONNECTION *lpConn)
static BOOLEAN bSuccess
Definition: drive.cpp:417
LPDPLCONNECTION lpConn
#define DP_OK
Definition: dplay.h:88
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL DPLAYX_IsAppIdLobbied(DWORD dwAppID, LPDPLAYX_LOBBYDATA *lplpDplData)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DPLAYX_ReleaseSemaphore()
Definition: dplayx_global.c:67
#define DPLAYX_AcquireSemaphore()
Definition: dplayx_global.c:63
static BOOL DPLAYX_GetThisLobbyHandles(LPHANDLE lphStart, LPHANDLE lphDeath, LPHANDLE lphConnRead, BOOL bClearSetHandles)

Referenced by IDirectPlayLobby3Impl_GetConnectionSettings().

◆ DPLAYX_GetThisLobbyHandles()

static BOOL DPLAYX_GetThisLobbyHandles ( LPHANDLE  lphStart,
LPHANDLE  lphDeath,
LPHANDLE  lphConnRead,
BOOL  bClearSetHandles 
)
static

Definition at line 283 of file dplayx_global.c.

287 {
288  LPDPLAYX_LOBBYDATA lpLData;
289 
291 
292  if( !DPLAYX_IsAppIdLobbied( 0, &lpLData ) )
293  {
295  return FALSE;
296  }
297 
298  if( lphStart != NULL )
299  {
300  if( lpLData->hInformOnAppStart == 0 )
301  {
303  return FALSE;
304  }
305 
306  *lphStart = lpLData->hInformOnAppStart;
307 
308  if( bClearSetHandles )
309  {
310  CloseHandle( lpLData->hInformOnAppStart );
311  lpLData->hInformOnAppStart = 0;
312  }
313  }
314 
315  if( lphDeath != NULL )
316  {
317  if( lpLData->hInformOnAppDeath == 0 )
318  {
320  return FALSE;
321  }
322 
323  *lphDeath = lpLData->hInformOnAppDeath;
324 
325  if( bClearSetHandles )
326  {
327  CloseHandle( lpLData->hInformOnAppDeath );
328  lpLData->hInformOnAppDeath = 0;
329  }
330  }
331 
332  if( lphConnRead != NULL )
333  {
334  if( lpLData->hInformOnSettingRead == 0 )
335  {
337  return FALSE;
338  }
339 
340  *lphConnRead = lpLData->hInformOnSettingRead;
341 
342  if( bClearSetHandles )
343  {
344  CloseHandle( lpLData->hInformOnSettingRead );
345  lpLData->hInformOnSettingRead = 0;
346  }
347  }
348 
350 
351  return TRUE;
352 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
static BOOL DPLAYX_IsAppIdLobbied(DWORD dwAppID, LPDPLAYX_LOBBYDATA *lplpDplData)
smooth NULL
Definition: ftsmooth.c:416
#define DPLAYX_ReleaseSemaphore()
Definition: dplayx_global.c:67
#define DPLAYX_AcquireSemaphore()
Definition: dplayx_global.c:63

Referenced by DPLAYX_ConstructData(), DPLAYX_DestructData(), DPLAYX_GetConnectionSettingsA(), and DPLAYX_GetConnectionSettingsW().

◆ DPLAYX_HresultToString()

LPCSTR DPLAYX_HresultToString ( HRESULT  hr)

Definition at line 1064 of file dplayx_global.c.

1065 {
1066  static char szTempStr[12];
1067 
1068  switch (hr)
1069  {
1070  case DP_OK:
1071  return "DP_OK";
1073  return "DPERR_ALREADYINITIALIZED";
1074  case DPERR_ACCESSDENIED:
1075  return "DPERR_ACCESSDENIED";
1076  case DPERR_ACTIVEPLAYERS:
1077  return "DPERR_ACTIVEPLAYERS";
1078  case DPERR_BUFFERTOOSMALL:
1079  return "DPERR_BUFFERTOOSMALL";
1080  case DPERR_CANTADDPLAYER:
1081  return "DPERR_CANTADDPLAYER";
1082  case DPERR_CANTCREATEGROUP:
1083  return "DPERR_CANTCREATEGROUP";
1085  return "DPERR_CANTCREATEPLAYER";
1087  return "DPERR_CANTCREATESESSION";
1089  return "DPERR_CAPSNOTAVAILABLEYET";
1090  case DPERR_EXCEPTION:
1091  return "DPERR_EXCEPTION";
1092  case DPERR_GENERIC:
1093  return "DPERR_GENERIC";
1094  case DPERR_INVALIDFLAGS:
1095  return "DPERR_INVALIDFLAGS";
1096  case DPERR_INVALIDOBJECT:
1097  return "DPERR_INVALIDOBJECT";
1098  case DPERR_INVALIDPARAMS:
1099  return "DPERR_INVALIDPARAMS";
1100  case DPERR_INVALIDPLAYER:
1101  return "DPERR_INVALIDPLAYER";
1102  case DPERR_INVALIDGROUP:
1103  return "DPERR_INVALIDGROUP";
1104  case DPERR_NOCAPS:
1105  return "DPERR_NOCAPS";
1106  case DPERR_NOCONNECTION:
1107  return "DPERR_NOCONNECTION";
1108  case DPERR_OUTOFMEMORY:
1109  return "DPERR_OUTOFMEMORY";
1110  case DPERR_NOMESSAGES:
1111  return "DPERR_NOMESSAGES";
1113  return "DPERR_NONAMESERVERFOUND";
1114  case DPERR_NOPLAYERS:
1115  return "DPERR_NOPLAYERS";
1116  case DPERR_NOSESSIONS:
1117  return "DPERR_NOSESSIONS";
1118  case DPERR_PENDING:
1119  return "DPERR_PENDING";
1120  case DPERR_SENDTOOBIG:
1121  return "DPERR_SENDTOOBIG";
1122  case DPERR_TIMEOUT:
1123  return "DPERR_TIMEOUT";
1124  case DPERR_UNAVAILABLE:
1125  return "DPERR_UNAVAILABLE";
1126  case DPERR_UNSUPPORTED:
1127  return "DPERR_UNSUPPORTED";
1128  case DPERR_BUSY:
1129  return "DPERR_BUSY";
1130  case DPERR_USERCANCEL:
1131  return "DPERR_USERCANCEL";
1132  case DPERR_NOINTERFACE:
1133  return "DPERR_NOINTERFACE";
1135  return "DPERR_CANNOTCREATESERVER";
1136  case DPERR_PLAYERLOST:
1137  return "DPERR_PLAYERLOST";
1138  case DPERR_SESSIONLOST:
1139  return "DPERR_SESSIONLOST";
1140  case DPERR_UNINITIALIZED:
1141  return "DPERR_UNINITIALIZED";
1142  case DPERR_NONEWPLAYERS:
1143  return "DPERR_NONEWPLAYERS";
1144  case DPERR_INVALIDPASSWORD:
1145  return "DPERR_INVALIDPASSWORD";
1146  case DPERR_CONNECTING:
1147  return "DPERR_CONNECTING";
1148  case DPERR_CONNECTIONLOST:
1149  return "DPERR_CONNECTIONLOST";
1150  case DPERR_UNKNOWNMESSAGE:
1151  return "DPERR_UNKNOWNMESSAGE";
1152  case DPERR_CANCELFAILED:
1153  return "DPERR_CANCELFAILED";
1154  case DPERR_INVALIDPRIORITY:
1155  return "DPERR_INVALIDPRIORITY";
1156  case DPERR_NOTHANDLED:
1157  return "DPERR_NOTHANDLED";
1158  case DPERR_CANCELLED:
1159  return "DPERR_CANCELLED";
1160  case DPERR_ABORTED:
1161  return "DPERR_ABORTED";
1162  case DPERR_BUFFERTOOLARGE:
1163  return "DPERR_BUFFERTOOLARGE";
1165  return "DPERR_CANTCREATEPROCESS";
1166  case DPERR_APPNOTSTARTED:
1167  return "DPERR_APPNOTSTARTED";
1169  return "DPERR_INVALIDINTERFACE";
1171  return "DPERR_NOSERVICEPROVIDER";
1173  return "DPERR_UNKNOWNAPPLICATION";
1174  case DPERR_NOTLOBBIED:
1175  return "DPERR_NOTLOBBIED";
1177  return "DPERR_SERVICEPROVIDERLOADED";
1179  return "DPERR_ALREADYREGISTERED";
1180  case DPERR_NOTREGISTERED:
1181  return "DPERR_NOTREGISTERED";
1183  return "DPERR_AUTHENTICATIONFAILED";
1184  case DPERR_CANTLOADSSPI:
1185  return "DPERR_CANTLOADSSPI";
1187  return "DPERR_ENCRYPTIONFAILED";
1188  case DPERR_SIGNFAILED:
1189  return "DPERR_SIGNFAILED";
1191  return "DPERR_CANTLOADSECURITYPACKAGE";
1193  return "DPERR_ENCRYPTIONNOTSUPPORTED";
1194  case DPERR_CANTLOADCAPI:
1195  return "DPERR_CANTLOADCAPI";
1196  case DPERR_NOTLOGGEDIN:
1197  return "DPERR_NOTLOGGEDIN";
1198  case DPERR_LOGONDENIED:
1199  return "DPERR_LOGONDENIED";
1200  default:
1201  /* For errors not in the list, return HRESULT as a string
1202  This part is not thread safe */
1203  WARN( "Unknown error 0x%08x\n", hr );
1204  wsprintfA( szTempStr, "0x%08x", hr );
1205  return szTempStr;
1206  }
1207 }
#define DPERR_NONEWPLAYERS
Definition: dplay.h:126
#define DPERR_UNINITIALIZED
Definition: dplay.h:125
#define DPERR_UNSUPPORTED
Definition: dplay.h:118
#define DPERR_CANTLOADCAPI
Definition: dplay.h:152
#define DPERR_INVALIDPLAYER
Definition: dplay.h:104
#define DPERR_USERCANCEL
Definition: dplay.h:120
#define DPERR_CANTCREATEPLAYER
Definition: dplay.h:95
HRESULT hr
Definition: shlfolder.c:183
#define DPERR_AUTHENTICATIONFAILED
Definition: dplay.h:146
#define DPERR_NOTLOBBIED
Definition: dplay.h:142
#define DPERR_BUFFERTOOSMALL
Definition: dplay.h:92
#define DPERR_CANTLOADSECURITYPACKAGE
Definition: dplay.h:150
#define DPERR_NOCONNECTION
Definition: dplay.h:107
#define DPERR_INVALIDGROUP
Definition: dplay.h:105
#define DPERR_INVALIDPARAMS
Definition: dplay.h:103
#define WARN(fmt,...)
Definition: debug.h:111
#define DPERR_SERVICEPROVIDERLOADED
Definition: dplay.h:143
#define DPERR_ACTIVEPLAYERS
Definition: dplay.h:91
#define DPERR_INVALIDPASSWORD
Definition: dplay.h:127
#define DPERR_OUTOFMEMORY
Definition: dplay.h:109
#define DPERR_CONNECTIONLOST
Definition: dplay.h:129
#define DPERR_CANTCREATEPROCESS
Definition: dplay.h:137
#define DPERR_INVALIDFLAGS
Definition: dplay.h:100
#define DPERR_NOMESSAGES
Definition: dplay.h:110
#define DPERR_NOCAPS
Definition: dplay.h:106
#define DPERR_INVALIDINTERFACE
Definition: dplay.h:139
#define DPERR_ENCRYPTIONNOTSUPPORTED
Definition: dplay.h:151
#define DPERR_SIGNFAILED
Definition: dplay.h:149
#define DPERR_PENDING
Definition: dplay.h:114
#define DP_OK
Definition: dplay.h:88
#define DPERR_NOPLAYERS
Definition: dplay.h:112
#define DPERR_NOTHANDLED
Definition: dplay.h:133
#define DPERR_BUSY
Definition: dplay.h:119
#define DPERR_EXCEPTION
Definition: dplay.h:98
#define DPERR_ALREADYREGISTERED
Definition: dplay.h:144
#define DPERR_LOGONDENIED
Definition: dplay.h:154
#define DPERR_TIMEOUT
Definition: dplay.h:116
#define DPERR_CANNOTCREATESERVER
Definition: dplay.h:122
#define DPERR_SENDTOOBIG
Definition: dplay.h:115
#define DPERR_SESSIONLOST
Definition: dplay.h:124
#define DPERR_INVALIDOBJECT
Definition: dplay.h:101
#define DPERR_NOINTERFACE
Definition: dplay.h:121
#define DPERR_APPNOTSTARTED
Definition: dplay.h:138
#define DPERR_NOSESSIONS
Definition: dplay.h:113
#define DPERR_CAPSNOTAVAILABLEYET
Definition: dplay.h:97
#define DPERR_BUFFERTOOLARGE
Definition: dplay.h:136
#define DPERR_INVALIDPRIORITY
Definition: dplay.h:132
#define DPERR_GENERIC
Definition: dplay.h:99
#define DPERR_UNKNOWNMESSAGE
Definition: dplay.h:130
#define DPERR_CONNECTING
Definition: dplay.h:128
#define DPERR_NONAMESERVERFOUND
Definition: dplay.h:111
#define DPERR_NOTREGISTERED
Definition: dplay.h:145
#define DPERR_NOTLOGGEDIN
Definition: dplay.h:153
#define DPERR_CANCELLED
Definition: dplay.h:134
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)
#define DPERR_NOSERVICEPROVIDER
Definition: dplay.h:140
#define DPERR_CANCELFAILED
Definition: dplay.h:131
#define DPERR_ENCRYPTIONFAILED
Definition: dplay.h:148
#define DPERR_UNAVAILABLE
Definition: dplay.h:117
#define DPERR_PLAYERLOST
Definition: dplay.h:123
#define DPERR_UNKNOWNAPPLICATION
Definition: dplay.h:141
#define DPERR_CANTCREATESESSION
Definition: dplay.h:96
#define DPERR_CANTADDPLAYER
Definition: dplay.h:93
#define DPERR_CANTCREATEGROUP
Definition: dplay.h:94
#define DPERR_ACCESSDENIED
Definition: dplay.h:90
#define DPERR_ALREADYINITIALIZED
Definition: dplay.h:89
#define DPERR_CANTLOADSSPI
Definition: dplay.h:147
#define DPERR_ABORTED
Definition: dplay.h:135

Referenced by DirectPlayCreate(), DP_BuildSPCompoundAddr(), DP_EnumSessionsSendAsyncRequestThread(), DP_IF_CreatePlayer(), DP_InitializeDPLSP(), DP_InitializeDPSP(), DP_MSG_ErrorReceived(), DP_MSG_ExpectReply(), DP_SecureOpen(), DPL_ConnectEx(), IDirectPlay4AImpl_EnumConnections(), IDirectPlayLobby3AImpl_RunApplication(), IDirectPlaySPImpl_GetSPPlayerData(), and IDirectPlaySPImpl_HandleMessage().

◆ DPLAYX_InitializeLobbyDataEntry()

static void DPLAYX_InitializeLobbyDataEntry ( LPDPLAYX_LOBBYDATA  lpData)
static

Definition at line 179 of file dplayx_global.c.

180 {
181  ZeroMemory( lpData, sizeof( *lpData ) );
182 }
#define ZeroMemory
Definition: winbase.h:1635

Referenced by DPLAYX_ConstructData().

◆ DPLAYX_IsAppIdLobbied()

static BOOL DPLAYX_IsAppIdLobbied ( DWORD  dwAppID,
LPDPLAYX_LOBBYDATA lplpDplData 
)
static

Definition at line 188 of file dplayx_global.c.

189 {
190  UINT i;
191 
192  *lplpDplData = NULL;
193 
194  if( dwAppID == 0 )
195  {
196  dwAppID = GetCurrentProcessId();
197  TRACE( "Translated dwAppID == 0 into 0x%08x\n", dwAppID );
198  }
199 
200  for( i=0; i < numSupportedLobbies; i++ )
201  {
202  if( lobbyData[ i ].dwAppID == dwAppID )
203  {
204  /* This process is lobbied */
205  TRACE( "Found 0x%08x @ %u\n", dwAppID, i );
206  *lplpDplData = &lobbyData[ i ];
207  return TRUE;
208  }
209  }
210 
211  return FALSE;
212 }
#define TRUE
Definition: types.h:120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int UINT
Definition: ndis.h:50
static DPLAYX_LOBBYDATA * lobbyData
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158

Referenced by DPLAYX_GetConnectionSettingsA(), DPLAYX_GetConnectionSettingsW(), DPLAYX_GetThisLobbyHandles(), DPLAYX_SetConnectionSettingsA(), DPLAYX_SetConnectionSettingsW(), DPLAYX_SetLobbyHandles(), DPLAYX_SetLobbyMsgThreadId(), and DPLAYX_WaitForConnectionSettings().

◆ DPLAYX_PrivHeapAlloc()

static LPVOID DPLAYX_PrivHeapAlloc ( DWORD  flags,
DWORD  size 
)
static

Definition at line 110 of file dplayx_global.c.

111 {
112  LPVOID lpvArea = NULL;
113  UINT uBlockUsed;
114 
115  if( size > (dwBlockSize - sizeof(BOOL)) )
116  {
117  FIXME( "Size exceeded. Request of 0x%08x\n", size );
118  size = dwBlockSize - sizeof(BOOL);
119  }
120 
121  /* Find blank area */
122  uBlockUsed = 0;
123  while( uBlockUsed < dwMaxBlock && lpMemArea[ uBlockUsed ].used ) { uBlockUsed++; }
124 
125  if( uBlockUsed < dwMaxBlock )
126  {
127  /* Set the area used */
128  lpMemArea[ uBlockUsed ].used = TRUE;
129  lpvArea = lpMemArea[ uBlockUsed ].data;
130  }
131  else
132  {
133  ERR( "No free block found\n" );
134  return NULL;
135  }
136 
137  if( flags & HEAP_ZERO_MEMORY )
138  {
139  ZeroMemory( lpvArea, size );
140  }
141 
142  return lpvArea;
143 }
#define TRUE
Definition: types.h:120
#define dwMaxBlock
Definition: dplayx_global.c:82
static DPLAYX_MEM_SLICE * lpMemArea
Definition: dplayx_global.c:91
#define ZeroMemory
Definition: winbase.h:1635
#define BOOL
Definition: nt_native.h:43
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
BYTE data[dwBlockSize - sizeof(BOOL)]
Definition: dplayx_global.c:87
smooth NULL
Definition: ftsmooth.c:416
c used
Definition: write.c:2877
GLsizeiptr size
Definition: glext.h:5919
GLbitfield flags
Definition: glext.h:7161
#define ERR(fmt,...)
Definition: debug.h:109
#define dwBlockSize
Definition: dplayx_global.c:81
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

Referenced by DPLAYX_SetConnectionSettingsA(), and DPLAYX_SetConnectionSettingsW().

◆ DPLAYX_PrivHeapFree()

static void DPLAYX_PrivHeapFree ( LPVOID  addr)
static

Definition at line 93 of file dplayx_global.c.

94 {
95  LPVOID lpAddrStart;
96  DWORD dwBlockUsed;
97 
98  /* Handle getting passed a NULL */
99  if( addr == NULL )
100  {
101  return;
102  }
103 
104  lpAddrStart = CONTAINING_RECORD(addr, DPLAYX_MEM_SLICE, data); /* Find block header */
105  dwBlockUsed = ((BYTE*)lpAddrStart - (BYTE*)lpMemArea)/dwBlockSize;
106 
107  lpMemArea[ dwBlockUsed ].used = FALSE;
108 }
static DPLAYX_MEM_SLICE * lpMemArea
Definition: dplayx_global.c:91
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned char BYTE
Definition: mem.h:68
#define dwBlockSize
Definition: dplayx_global.c:81

Referenced by DPLAYX_SetConnectionSettingsA(), and DPLAYX_SetConnectionSettingsW().

◆ DPLAYX_SetConnectionSettingsA()

HRESULT DPLAYX_SetConnectionSettingsA ( DWORD  dwFlags,
DWORD  dwAppID,
const DPLCONNECTION lpConn 
)

Definition at line 890 of file dplayx_global.c.

893 {
894  LPDPLAYX_LOBBYDATA lpDplData;
895 
896  /* Parameter check */
897  if( dwFlags || !lpConn )
898  {
899  ERR("invalid parameters.\n");
900  return DPERR_INVALIDPARAMS;
901  }
902 
903  /* Store information */
904  if( lpConn->dwSize != sizeof(DPLCONNECTION) )
905  {
906  ERR(": old/new DPLCONNECTION type? Size=%08x\n", lpConn->dwSize );
907 
908  return DPERR_INVALIDPARAMS;
909  }
910 
912 
913  if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
914  {
916 
917  return DPERR_NOTLOBBIED;
918  }
919 
920  if( (!lpConn->lpSessionDesc ) ||
921  ( lpConn->lpSessionDesc->dwSize != sizeof( DPSESSIONDESC2 ) )
922  )
923  {
925 
926  ERR("DPSESSIONDESC passed in? Size=%u\n",
927  lpConn->lpSessionDesc?lpConn->lpSessionDesc->dwSize:0 );
928 
929  return DPERR_INVALIDPARAMS;
930  }
931 
932  /* Free the existing memory */
933  DPLAYX_PrivHeapFree( lpDplData->lpConn );
934 
936  DPLAYX_SizeOfLobbyDataA( lpConn ) );
937 
938  DPLAYX_CopyConnStructA( lpDplData->lpConn, lpConn );
939 
940 
942 
943  /* FIXME: Send a message - I think */
944 
945  return DP_OK;
946 }
static void DPLAYX_PrivHeapFree(LPVOID addr)
Definition: dplayx_global.c:93
#define DPERR_NOTLOBBIED
Definition: dplay.h:142
#define DPERR_INVALIDPARAMS
Definition: dplay.h:103
DWORD dwSize
Definition: dplay.h:284
LPDPLCONNECTION lpConn
static DWORD DPLAYX_SizeOfLobbyDataA(const DPLCONNECTION *lpConn)
DWORD dwSize
Definition: dplay.h:232
#define DP_OK
Definition: dplay.h:88
static BOOL DPLAYX_IsAppIdLobbied(DWORD dwAppID, LPDPLAYX_LOBBYDATA *lplpDplData)
static LPVOID DPLAYX_PrivHeapAlloc(DWORD flags, DWORD size)
static void DPLAYX_CopyConnStructA(LPDPLCONNECTION dest, const DPLCONNECTION *src)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DPLAYX_ReleaseSemaphore()
Definition: dplayx_global.c:67
#define ERR(fmt,...)
Definition: debug.h:109
#define DPLAYX_AcquireSemaphore()
Definition: dplayx_global.c:63
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
LPDPSESSIONDESC2 lpSessionDesc
Definition: dplay.h:286

Referenced by IDirectPlayLobby3AImpl_SetConnectionSettings().

◆ DPLAYX_SetConnectionSettingsW()

HRESULT DPLAYX_SetConnectionSettingsW ( DWORD  dwFlags,
DWORD  dwAppID,
const DPLCONNECTION lpConn 
)

Definition at line 953 of file dplayx_global.c.

956 {
957  LPDPLAYX_LOBBYDATA lpDplData;
958 
959  /* Parameter check */
960  if( dwFlags || !lpConn )
961  {
962  ERR("invalid parameters.\n");
963  return DPERR_INVALIDPARAMS;
964  }
965 
966  /* Store information */
967  if( lpConn->dwSize != sizeof(DPLCONNECTION) )
968  {
969  ERR(": old/new DPLCONNECTION type? Size=%u\n", lpConn->dwSize );
970 
971  return DPERR_INVALIDPARAMS;
972  }
973 
975 
976  if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
977  {
979 
980  return DPERR_NOTLOBBIED;
981  }
982 
983  /* Free the existing memory */
984  DPLAYX_PrivHeapFree( lpDplData->lpConn );
985 
987  DPLAYX_SizeOfLobbyDataW( lpConn ) );
988 
989  DPLAYX_CopyConnStructW( lpDplData->lpConn, lpConn );
990 
991 
993 
994  /* FIXME: Send a message - I think */
995 
996  return DP_OK;
997 }
static void DPLAYX_PrivHeapFree(LPVOID addr)
Definition: dplayx_global.c:93
#define DPERR_NOTLOBBIED
Definition: dplay.h:142
#define DPERR_INVALIDPARAMS
Definition: dplay.h:103
static void DPLAYX_CopyConnStructW(LPDPLCONNECTION dest, const DPLCONNECTION *src)
DWORD dwSize
Definition: dplay.h:284
static DWORD DPLAYX_SizeOfLobbyDataW(const DPLCONNECTION *lpConn)
LPDPLCONNECTION lpConn
#define DP_OK
Definition: dplay.h:88
static BOOL DPLAYX_IsAppIdLobbied(DWORD dwAppID, LPDPLAYX_LOBBYDATA *lplpDplData)
static LPVOID DPLAYX_PrivHeapAlloc(DWORD flags, DWORD size)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DPLAYX_ReleaseSemaphore()
Definition: dplayx_global.c:67
#define ERR(fmt,...)
Definition: debug.h:109
#define DPLAYX_AcquireSemaphore()
Definition: dplayx_global.c:63
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

Referenced by IDirectPlayLobby3Impl_SetConnectionSettings().

◆ DPLAYX_SetLobbyHandles()

BOOL DPLAYX_SetLobbyHandles ( DWORD  dwAppID,
HANDLE  hStart,
HANDLE  hDeath,
HANDLE  hConnRead 
)

Definition at line 255 of file dplayx_global.c.

257 {
258  LPDPLAYX_LOBBYDATA lpLData;
259 
260  /* Need to explicitly give lobby application. Can't set for yourself */
261  if( dwAppID == 0 )
262  {
263  return FALSE;
264  }
265 
267 
268  if( !DPLAYX_IsAppIdLobbied( dwAppID, &lpLData ) )
269  {
271  return FALSE;
272  }
273 
274  lpLData->hInformOnAppStart = hStart;
275  lpLData->hInformOnAppDeath = hDeath;
276  lpLData->hInformOnSettingRead = hConnRead;
277 
279 
280  return TRUE;
281 }
#define TRUE
Definition: types.h:120
static BOOL DPLAYX_IsAppIdLobbied(DWORD dwAppID, LPDPLAYX_LOBBYDATA *lplpDplData)
#define DPLAYX_ReleaseSemaphore()
Definition: dplayx_global.c:67
#define DPLAYX_AcquireSemaphore()
Definition: dplayx_global.c:63

Referenced by DPL_CreateAndSetLobbyHandles().

◆ DPLAYX_SetLobbyMsgThreadId()

BOOL DPLAYX_SetLobbyMsgThreadId ( DWORD  dwAppId,
DWORD  dwThreadId 
)

Definition at line 1041 of file dplayx_global.c.

1042 {
1043  LPDPLAYX_LOBBYDATA lpLobbyData;
1044 
1046 
1047  if( !DPLAYX_IsAppIdLobbied( dwAppId, &lpLobbyData ) )
1048  {
1050  return FALSE;
1051  }
1052 
1053  lpLobbyData->dwLobbyMsgThreadId = dwThreadId;
1054 
1056 
1057  return TRUE;
1058 }
#define TRUE
Definition: types.h:120
static BOOL DPLAYX_IsAppIdLobbied(DWORD dwAppID, LPDPLAYX_LOBBYDATA *lplpDplData)
DWORD dwThreadId
Definition: fdebug.c:31
#define DPLAYX_ReleaseSemaphore()
Definition: dplayx_global.c:67
#define DPLAYX_AcquireSemaphore()
Definition: dplayx_global.c:63

Referenced by IDirectPlayLobby3AImpl_RunApplication().

◆ DPLAYX_SizeOfLobbyDataA()

static DWORD DPLAYX_SizeOfLobbyDataA ( const DPLCONNECTION lpConn)
static

Definition at line 677 of file dplayx_global.c.

678 {
679  DWORD dwTotalSize = sizeof( DPLCONNECTION );
680 
681  /* Just a safety check */
682  if( lpConn == NULL )
683  {
684  ERR( "lpConn is NULL\n" );
685  return 0;
686  }
687 
688  if( lpConn->lpSessionDesc != NULL )
689  {
690  dwTotalSize += sizeof( DPSESSIONDESC2 );
691 
692  if( lpConn->lpSessionDesc->u1.lpszSessionNameA )
693  {
694  dwTotalSize += strlen( lpConn->lpSessionDesc->u1.lpszSessionNameA ) + 1;
695  }
696 
697  if( lpConn->lpSessionDesc->u2.lpszPasswordA )
698  {
699  dwTotalSize += strlen( lpConn->lpSessionDesc->u2.lpszPasswordA ) + 1;
700  }
701  }
702 
703  if( lpConn->lpPlayerName != NULL )
704  {
705  dwTotalSize += sizeof( DPNAME );
706 
707  if( lpConn->lpPlayerName->u1.lpszShortNameA )
708  {
709  dwTotalSize += strlen( lpConn->lpPlayerName->u1.lpszShortNameA ) + 1;
710  }
711 
712  if( lpConn->lpPlayerName->u2.lpszLongNameA )
713  {
714  dwTotalSize += strlen( lpConn->lpPlayerName->u2.lpszLongNameA ) + 1;
715  }
716 
717  }
718 
719  dwTotalSize += lpConn->dwAddressSize;
720 
721  return dwTotalSize;
722 }
struct tagDPLCONNECTION DPLCONNECTION
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LPDPNAME lpPlayerName
Definition: dplay.h:287
LPSTR lpszLongNameA
Definition: dplay.h:200
LPSTR lpszSessionNameA
Definition: dplay.h:244
smooth NULL
Definition: ftsmooth.c:416
struct tagDPNAME DPNAME
LPSTR lpszShortNameA
Definition: dplay.h:194
DWORD dwAddressSize
Definition: dplay.h:290
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERR(fmt,...)
Definition: debug.h:109
LPSTR lpszPasswordA
Definition: dplay.h:250
LPDPSESSIONDESC2 lpSessionDesc
Definition: dplay.h:286
struct tagDPSESSIONDESC2 DPSESSIONDESC2

Referenced by DPLAYX_GetConnectionSettingsA(), and DPLAYX_SetConnectionSettingsA().

◆ DPLAYX_SizeOfLobbyDataW()

static DWORD DPLAYX_SizeOfLobbyDataW ( const DPLCONNECTION lpConn)
static

Definition at line 724 of file dplayx_global.c.

725 {
726  DWORD dwTotalSize = sizeof( DPLCONNECTION );
727 
728  /* Just a safety check */
729  if( lpConn == NULL )
730  {
731  ERR( "lpConn is NULL\n" );
732  return 0;
733  }
734 
735  if( lpConn->lpSessionDesc != NULL )
736  {
737  dwTotalSize += sizeof( DPSESSIONDESC2 );
738 
739  if( lpConn->lpSessionDesc->u1.lpszSessionName )
740  {
741  dwTotalSize += sizeof( WCHAR ) *
742  ( strlenW( lpConn->lpSessionDesc->u1.lpszSessionName ) + 1 );
743  }
744 
745  if( lpConn->lpSessionDesc->u2.lpszPassword )
746  {
747  dwTotalSize += sizeof( WCHAR ) *
748  ( strlenW( lpConn->lpSessionDesc->u2.lpszPassword ) + 1 );
749  }
750  }
751 
752  if( lpConn->lpPlayerName != NULL )
753  {
754  dwTotalSize += sizeof( DPNAME );
755 
756  if( lpConn->lpPlayerName->u1.lpszShortName )
757  {
758  dwTotalSize += sizeof( WCHAR ) *
759  ( strlenW( lpConn->lpPlayerName->u1.lpszShortName ) + 1 );
760  }
761 
762  if( lpConn->lpPlayerName->u2.lpszLongName )
763  {
764  dwTotalSize += sizeof( WCHAR ) *
765  ( strlenW( lpConn->lpPlayerName->u2.lpszLongName ) + 1 );
766  }
767 
768  }
769 
770  dwTotalSize += lpConn->dwAddressSize;
771 
772  return dwTotalSize;
773 }
struct tagDPLCONNECTION DPLCONNECTION
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
LPDPNAME lpPlayerName
Definition: dplay.h:287
LPWSTR lpszSessionName
Definition: dplay.h:243
smooth NULL
Definition: ftsmooth.c:416
struct tagDPNAME DPNAME
LPWSTR lpszLongName
Definition: dplay.h:199
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD dwAddressSize
Definition: dplay.h:290
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERR(fmt,...)
Definition: debug.h:109
LPWSTR lpszShortName
Definition: dplay.h:193
LPWSTR lpszPassword
Definition: dplay.h:249
LPDPSESSIONDESC2 lpSessionDesc
Definition: dplay.h:286
struct tagDPSESSIONDESC2 DPSESSIONDESC2

Referenced by DPLAYX_GetConnectionSettingsW(), and DPLAYX_SetConnectionSettingsW().

◆ DPLAYX_WaitForConnectionSettings()

BOOL DPLAYX_WaitForConnectionSettings ( BOOL  bWait)

Definition at line 999 of file dplayx_global.c.

1000 {
1001  LPDPLAYX_LOBBYDATA lpLobbyData;
1002 
1004 
1005  if( !DPLAYX_IsAppIdLobbied( 0, &lpLobbyData ) )
1006  {
1008  return FALSE;
1009  }
1010 
1011  lpLobbyData->bWaitForConnectionSettings = bWait;
1012 
1014 
1015  return TRUE;
1016 }
#define TRUE
Definition: types.h:120
static BOOL DPLAYX_IsAppIdLobbied(DWORD dwAppID, LPDPLAYX_LOBBYDATA *lplpDplData)
#define DPLAYX_ReleaseSemaphore()
Definition: dplayx_global.c:67
#define DPLAYX_AcquireSemaphore()
Definition: dplayx_global.c:63

Referenced by IDirectPlayLobby3AImpl_WaitForConnectionSettings(), and IDirectPlayLobby3Impl_WaitForConnectionSettings().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( dplay  )

Variable Documentation

◆ hDplayxSema

HANDLE hDplayxSema
static

Definition at line 55 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData(), and DPLAYX_DestructData().

◆ hDplayxSharedMem

HANDLE hDplayxSharedMem
static

Definition at line 58 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData(), and DPLAYX_DestructData().

◆ helpstring

typedef helpstring

◆ lobbyData

◆ lpMemArea

DPLAYX_MEM_SLICE* lpMemArea
static

Definition at line 91 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData(), DPLAYX_PrivHeapAlloc(), and DPLAYX_PrivHeapFree().

◆ lpSharedStaticData

LPVOID lpSharedStaticData = NULL
static

Definition at line 60 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData(), and DPLAYX_DestructData().

◆ lpszDplayxFileMapping

const char lpszDplayxFileMapping[] = "WINE_DPLAYX_FM"
static

Definition at line 57 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData().

◆ lpszDplayxSemaName

const char lpszDplayxSemaName[] = "WINE_DPLAYX_SM"
static

Definition at line 54 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData().

◆ sessionData

DPSESSIONDESC2* sessionData = NULL
static

Definition at line 175 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData().