ReactOS 0.4.16-dev-320-g3bd9ddc
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 "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

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" )
static HANDLE hDplayxSema
Definition: dplayx_global.c:54
#define INFINITE
Definition: serial.h:102
#define TRACE(s)
Definition: solgame.cpp:4

Definition at line 62 of file dplayx_global.c.

◆ DPLAYX_ReleaseSemaphore

#define DPLAYX_ReleaseSemaphore ( )
Value:
TRACE( "DPLAYX Semaphore released\n" ) /* FIXME: Is this correct? */
#define NULL
Definition: types.h:112
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:542

Definition at line 66 of file dplayx_global.c.

◆ dwBlockSize

#define dwBlockSize   512

Definition at line 80 of file dplayx_global.c.

◆ dwDynamicSharedSize

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

Definition at line 72 of file dplayx_global.c.

◆ dwMaxBlock

Definition at line 81 of file dplayx_global.c.

◆ dwStaticSharedSize

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

Definition at line 71 of file dplayx_global.c.

◆ dwTotalSharedSize

#define dwTotalSharedSize   ( dwStaticSharedSize + dwDynamicSharedSize )

Definition at line 73 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 145 of file dplayx_global.c.

@ numSupportedSessions
@ numSupportedLobbies

Function Documentation

◆ C_ASSERT()

C_ASSERT ( sizeof(DPLAYX_MEM_SLICE = =dwBlockSize)

◆ DPLAYX_AnyLobbiesWaitingForConnSettings()

BOOL DPLAYX_AnyLobbiesWaitingForConnSettings ( void  )

Definition at line 1017 of file dplayx_global.c.

1018{
1019 UINT i;
1020 BOOL bFound = FALSE;
1021
1023
1024 for( i=0; i < numSupportedLobbies; i++ )
1025 {
1026 if( ( lobbyData[ i ].dwAppID != 0 ) && /* lobby initialized */
1027 ( lobbyData[ i ].bWaitForConnectionSettings ) /* Waiting */
1028 )
1029 {
1030 bFound = TRUE;
1031 break;
1032 }
1033 }
1034
1036
1037 return bFound;
1038}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define DPLAYX_ReleaseSemaphore()
Definition: dplayx_global.c:66
static DPLAYX_LOBBYDATA * lobbyData
#define DPLAYX_AcquireSemaphore()
Definition: dplayx_global.c:62
unsigned int BOOL
Definition: ntddk_ex.h:94
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 UINT
Definition: ndis.h:50

Referenced by IDirectPlayLobby3AImpl_RunApplication().

◆ DPLAYX_ConstructData()

BOOL DPLAYX_ConstructData ( void  )

Definition at line 357 of file dplayx_global.c.

358{
359 SECURITY_ATTRIBUTES s_attrib;
360 BOOL bInitializeSharedMemory = FALSE;
361 LPVOID lpDesiredMemoryMapStart = (LPVOID)0x50000000;
362 HANDLE hInformOnStart;
363
364 TRACE( "DPLAYX dll loaded - construct called\n" );
365
366 /* Create a semaphore to block access to DPLAYX global data structs */
367
368 s_attrib.bInheritHandle = TRUE;
369 s_attrib.lpSecurityDescriptor = NULL;
370 s_attrib.nLength = sizeof(s_attrib);
371
372 hDplayxSema = CreateSemaphoreA( &s_attrib, 0, 1, lpszDplayxSemaName );
373
374 /* First instance creates the semaphore. Others just use it */
375 if( GetLastError() == ERROR_SUCCESS )
376 {
377 TRACE( "Semaphore %p created\n", hDplayxSema );
378
379 /* The semaphore creator will also build the shared memory */
380 bInitializeSharedMemory = TRUE;
381 }
382 else if ( GetLastError() == ERROR_ALREADY_EXISTS )
383 {
384 TRACE( "Found semaphore handle %p\n", hDplayxSema );
386 }
387 else
388 {
389 ERR( ": semaphore error %d\n", GetLastError() );
390 return FALSE;
391 }
392
394
396 &s_attrib,
398 0,
401
402 if( GetLastError() == ERROR_SUCCESS )
403 {
404 TRACE( "File mapped %p created\n", hDplayxSharedMem );
405 }
406 else if ( GetLastError() == ERROR_ALREADY_EXISTS )
407 {
408 TRACE( "Found FileMapping handle %p\n", hDplayxSharedMem );
409 }
410 else
411 {
412 ERR( ": unable to create shared memory (%d)\n", GetLastError() );
414 return FALSE;
415 }
416
419 0, 0, 0, lpDesiredMemoryMapStart );
420
421 if( lpSharedStaticData == NULL )
422 {
423 ERR( ": unable to map static data into process memory space (%d)\n",
424 GetLastError() );
426 return FALSE;
427 }
428 else
429 {
430 if( lpDesiredMemoryMapStart == lpSharedStaticData )
431 {
432 TRACE( "File mapped to %p\n", lpSharedStaticData );
433 }
434 else
435 {
436 /* Presently the shared data structures use pointers. If the
437 * files are not mapped into the same area, the pointers will no
438 * longer make any sense :(
439 * FIXME: In the future make the shared data structures have some
440 * sort of fixup to make them independent between data spaces.
441 * This will also require a rework of the session data stuff.
442 */
443 ERR( "File mapped to %p (not %p). Expect failure\n",
444 lpSharedStaticData, lpDesiredMemoryMapStart );
445 }
446 }
447
448 /* Dynamic area starts just after the static area */
450
451 /* FIXME: Crude hack */
454
455 /* Initialize shared data segments. */
456 if( bInitializeSharedMemory )
457 {
458 UINT i;
459
460 TRACE( "Initializing shared memory\n" );
461
462 /* Set all lobbies to be "empty" */
463 for( i=0; i < numSupportedLobbies; i++ )
464 {
466 }
467
468 /* Set all sessions to be "empty" */
469 for( i=0; i < numSupportedSessions; i++ )
470 {
471 sessionData[i].dwSize = 0;
472 }
473
474 /* Zero out the dynamic area */
476
477 /* Just for fun sync the whole data area */
479 }
480
482
483 /* Everything was created correctly. Signal the lobby client that
484 * we started up correctly
485 */
486 if( DPLAYX_GetThisLobbyHandles( &hInformOnStart, NULL, NULL, FALSE ) &&
487 hInformOnStart
488 )
489 {
491 bSuccess = SetEvent( hInformOnStart );
492 TRACE( "Signalling lobby app start event %p %s\n",
493 hInformOnStart, bSuccess ? "succeed" : "failed" );
494
495 /* Close out handle */
496 DPLAYX_GetThisLobbyHandles( &hInformOnStart, NULL, NULL, TRUE );
497 }
498
499 return TRUE;
500}
#define ERR(fmt,...)
Definition: precomp.h:57
#define ERROR_SUCCESS
Definition: deptool.c:10
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
static const char lpszDplayxSemaName[]
Definition: dplayx_global.c:53
static BOOL DPLAYX_GetThisLobbyHandles(LPHANDLE lphStart, LPHANDLE lphDeath, LPHANDLE lphConnRead, BOOL bClearSetHandles)
static DPSESSIONDESC2 * sessionData
#define dwDynamicSharedSize
Definition: dplayx_global.c:72
static DPLAYX_MEM_SLICE * lpMemArea
Definition: dplayx_global.c:90
#define dwTotalSharedSize
Definition: dplayx_global.c:73
static void DPLAYX_InitializeLobbyDataEntry(LPDPLAYX_LOBBYDATA lpData)
static const char lpszDplayxFileMapping[]
Definition: dplayx_global.c:56
static LPVOID lpSharedStaticData
Definition: dplayx_global.c:59
static HANDLE hDplayxSharedMem
Definition: dplayx_global.c:57
#define dwStaticSharedSize
Definition: dplayx_global.c:71
static BOOLEAN bSuccess
Definition: drive.cpp:355
LPVOID NTAPI MapViewOfFileEx(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress)
Definition: filemap.c:162
BOOL NTAPI FlushViewOfFile(IN LPCVOID lpBaseAddress, IN SIZE_T dwNumberOfBytesToFlush)
Definition: filemap.c:352
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 ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define SEC_COMMIT
Definition: mmtypes.h:100
#define PAGE_READWRITE
Definition: nt_native.h:1304
#define LPVOID
Definition: nt_native.h:45
LPVOID lpSecurityDescriptor
Definition: compat.h:193
DWORD dwSize
Definition: dplay.h:232
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:430
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define ZeroMemory
Definition: winbase.h:1737
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define FILE_MAP_WRITE
Definition: winbase.h:155
unsigned char BYTE
Definition: xxhash.c:193

Referenced by DllMain().

◆ DPLAYX_CopyConnStructA()

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

Definition at line 540 of file dplayx_global.c.

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

Referenced by DPLAYX_GetConnectionSettingsA(), and DPLAYX_SetConnectionSettingsA().

◆ DPLAYX_CopyConnStructW()

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

Definition at line 608 of file dplayx_global.c.

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

Referenced by DPLAYX_GetConnectionSettingsW(), and DPLAYX_SetConnectionSettingsW().

◆ DPLAYX_CreateLobbyApplication()

BOOL DPLAYX_CreateLobbyApplication ( DWORD  dwAppID)

Definition at line 214 of file dplayx_global.c.

215{
216 UINT i;
217
218 /* 0 is the marker for unused application data slots */
219 if( dwAppID == 0 )
220 {
221 return FALSE;
222 }
223
225
226 /* Find an empty space in the list and insert the data */
227 for( i=0; i < numSupportedLobbies; i++ )
228 {
229 if( lobbyData[ i ].dwAppID == 0 )
230 {
231 /* This process is now lobbied */
232 TRACE( "Setting lobbyData[%u] for (0x%08x,0x%08x)\n",
233 i, dwAppID, GetCurrentProcessId() );
234
235 lobbyData[ i ].dwAppID = dwAppID;
237
238 /* FIXME: Where is the best place for this? In interface or here? */
242
244 return TRUE;
245 }
246 }
247
248 ERR( "No empty lobbies\n" );
249
251 return FALSE;
252}
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 506 of file dplayx_global.c.

507{
508 HANDLE hInformOnDeath;
509
510 TRACE( "DPLAYX dll unloaded - destruct called\n" );
511
512 /* If required, inform that this app is dying */
513 if( DPLAYX_GetThisLobbyHandles( NULL, &hInformOnDeath, NULL, FALSE ) &&
514 hInformOnDeath
515 )
516 {
518 bSuccess = SetEvent( hInformOnDeath );
519 TRACE( "Signalling lobby app death event %p %s\n",
520 hInformOnDeath, bSuccess ? "succeed" : "failed" );
521
522 /* Close out handle */
523 DPLAYX_GetThisLobbyHandles( NULL, &hInformOnDeath, NULL, TRUE );
524 }
525
526 /* DO CLEAN UP (LAST) */
527
528 /* Delete the semaphore */
530
531 /* Delete shared memory file mapping */
534
535 return FALSE;
536}
#define CloseHandle
Definition: compat.h:739
#define UnmapViewOfFile
Definition: compat.h:746

Referenced by DllMain().

◆ DPLAYX_GetConnectionSettingsA()

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

Definition at line 774 of file dplayx_global.c.

778{
779 LPDPLAYX_LOBBYDATA lpDplData;
780 DWORD dwRequiredDataSize = 0;
781 HANDLE hInformOnSettingRead;
782
784
785 if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
786 {
788
789 TRACE( "Application 0x%08x is not lobbied\n", dwAppID );
790 return DPERR_NOTLOBBIED;
791 }
792
793 dwRequiredDataSize = DPLAYX_SizeOfLobbyDataA( lpDplData->lpConn );
794
795 /* Do they want to know the required buffer size or is the provided buffer
796 * big enough?
797 */
798 if ( ( lpData == NULL ) ||
799 ( *lpdwDataSize < dwRequiredDataSize )
800 )
801 {
803
804 *lpdwDataSize = DPLAYX_SizeOfLobbyDataA( lpDplData->lpConn );
805
807 }
808
809 DPLAYX_CopyConnStructA( lpData, lpDplData->lpConn );
810
812
813 /* They have gotten the information - signal the event if required */
814 if( DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, FALSE ) &&
815 hInformOnSettingRead
816 )
817 {
819 bSuccess = SetEvent( hInformOnSettingRead );
820 TRACE( "Signalling setting read event %p %s\n",
821 hInformOnSettingRead, bSuccess ? "succeed" : "failed" );
822
823 /* Close out handle */
824 DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, TRUE );
825 }
826
827 return DP_OK;
828}
#define DPERR_BUFFERTOOSMALL
Definition: dplay.h:92
#define DP_OK
Definition: dplay.h:88
#define DPERR_NOTLOBBIED
Definition: dplay.h:142
static BOOL DPLAYX_IsAppIdLobbied(DWORD dwAppID, LPDPLAYX_LOBBYDATA *lplpDplData)
static DWORD DPLAYX_SizeOfLobbyDataA(const DPLCONNECTION *lpConn)
static void DPLAYX_CopyConnStructA(LPDPLCONNECTION dest, const DPLCONNECTION *src)
unsigned long DWORD
Definition: ntddk_ex.h:95
LPDPLCONNECTION lpConn

Referenced by IDirectPlayLobby3AImpl_GetConnectionSettings().

◆ DPLAYX_GetConnectionSettingsW()

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

Definition at line 830 of file dplayx_global.c.

834{
835 LPDPLAYX_LOBBYDATA lpDplData;
836 DWORD dwRequiredDataSize = 0;
837 HANDLE hInformOnSettingRead;
838
840
841 if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
842 {
844 return DPERR_NOTLOBBIED;
845 }
846
847 dwRequiredDataSize = DPLAYX_SizeOfLobbyDataW( lpDplData->lpConn );
848
849 /* Do they want to know the required buffer size or is the provided buffer
850 * big enough?
851 */
852 if ( ( lpData == NULL ) ||
853 ( *lpdwDataSize < dwRequiredDataSize )
854 )
855 {
857
858 *lpdwDataSize = DPLAYX_SizeOfLobbyDataW( lpDplData->lpConn );
859
861 }
862
863 DPLAYX_CopyConnStructW( lpData, lpDplData->lpConn );
864
866
867 /* They have gotten the information - signal the event if required */
868 if( DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, FALSE ) &&
869 hInformOnSettingRead
870 )
871 {
873 bSuccess = SetEvent( hInformOnSettingRead );
874 TRACE( "Signalling setting read event %p %s\n",
875 hInformOnSettingRead, bSuccess ? "succeed" : "failed" );
876
877 /* Close out handle */
878 DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, TRUE );
879 }
880
881 return DP_OK;
882}
static DWORD DPLAYX_SizeOfLobbyDataW(const DPLCONNECTION *lpConn)
static void DPLAYX_CopyConnStructW(LPDPLCONNECTION dest, const DPLCONNECTION *src)

Referenced by IDirectPlayLobby3Impl_GetConnectionSettings().

◆ DPLAYX_GetThisLobbyHandles()

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

Definition at line 282 of file dplayx_global.c.

286{
287 LPDPLAYX_LOBBYDATA lpLData;
288
290
291 if( !DPLAYX_IsAppIdLobbied( 0, &lpLData ) )
292 {
294 return FALSE;
295 }
296
297 if( lphStart != NULL )
298 {
299 if( lpLData->hInformOnAppStart == 0 )
300 {
302 return FALSE;
303 }
304
305 *lphStart = lpLData->hInformOnAppStart;
306
307 if( bClearSetHandles )
308 {
309 CloseHandle( lpLData->hInformOnAppStart );
310 lpLData->hInformOnAppStart = 0;
311 }
312 }
313
314 if( lphDeath != NULL )
315 {
316 if( lpLData->hInformOnAppDeath == 0 )
317 {
319 return FALSE;
320 }
321
322 *lphDeath = lpLData->hInformOnAppDeath;
323
324 if( bClearSetHandles )
325 {
326 CloseHandle( lpLData->hInformOnAppDeath );
327 lpLData->hInformOnAppDeath = 0;
328 }
329 }
330
331 if( lphConnRead != NULL )
332 {
333 if( lpLData->hInformOnSettingRead == 0 )
334 {
336 return FALSE;
337 }
338
339 *lphConnRead = lpLData->hInformOnSettingRead;
340
341 if( bClearSetHandles )
342 {
344 lpLData->hInformOnSettingRead = 0;
345 }
346 }
347
349
350 return TRUE;
351}

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

◆ DPLAYX_HresultToString()

LPCSTR DPLAYX_HresultToString ( HRESULT  hr)

Definition at line 1063 of file dplayx_global.c.

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

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 178 of file dplayx_global.c.

179{
180 ZeroMemory( lpData, sizeof( *lpData ) );
181}

Referenced by DPLAYX_ConstructData().

◆ DPLAYX_IsAppIdLobbied()

static BOOL DPLAYX_IsAppIdLobbied ( DWORD  dwAppID,
LPDPLAYX_LOBBYDATA lplpDplData 
)
static

Definition at line 187 of file dplayx_global.c.

188{
189 UINT i;
190
191 *lplpDplData = NULL;
192
193 if( dwAppID == 0 )
194 {
195 dwAppID = GetCurrentProcessId();
196 TRACE( "Translated dwAppID == 0 into 0x%08x\n", dwAppID );
197 }
198
199 for( i=0; i < numSupportedLobbies; i++ )
200 {
201 if( lobbyData[ i ].dwAppID == dwAppID )
202 {
203 /* This process is lobbied */
204 TRACE( "Found 0x%08x @ %u\n", dwAppID, i );
205 *lplpDplData = &lobbyData[ i ];
206 return TRUE;
207 }
208 }
209
210 return FALSE;
211}

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 109 of file dplayx_global.c.

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

Referenced by DPLAYX_SetConnectionSettingsA(), and DPLAYX_SetConnectionSettingsW().

◆ DPLAYX_PrivHeapFree()

static void DPLAYX_PrivHeapFree ( LPVOID  addr)
static

Definition at line 92 of file dplayx_global.c.

93{
94 LPVOID lpAddrStart;
95 DWORD dwBlockUsed;
96
97 /* Handle getting passed a NULL */
98 if( addr == NULL )
99 {
100 return;
101 }
102
103 lpAddrStart = CONTAINING_RECORD(addr, DPLAYX_MEM_SLICE, data); /* Find block header */
104 dwBlockUsed = ((BYTE*)lpAddrStart - (BYTE*)lpMemArea)/dwBlockSize;
105
106 lpMemArea[ dwBlockUsed ].used = FALSE;
107}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum const GLvoid * addr
Definition: glext.h:9621
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by DPLAYX_SetConnectionSettingsA(), and DPLAYX_SetConnectionSettingsW().

◆ DPLAYX_SetConnectionSettingsA()

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

Definition at line 888 of file dplayx_global.c.

892{
893 LPDPLAYX_LOBBYDATA lpDplData;
894
895 /* Parameter check */
896 if( dwFlags || !lpConn )
897 {
898 ERR("invalid parameters.\n");
899 return DPERR_INVALIDPARAMS;
900 }
901
902 /* Store information */
903 if( lpConn->dwSize != sizeof(DPLCONNECTION) )
904 {
905 ERR(": old/new DPLCONNECTION type? Size=%08x\n", lpConn->dwSize );
906
907 return DPERR_INVALIDPARAMS;
908 }
909
911
912 if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
913 {
915
916 return DPERR_NOTLOBBIED;
917 }
918
919 if( (!lpConn->lpSessionDesc ) ||
920 ( lpConn->lpSessionDesc->dwSize != sizeof( DPSESSIONDESC2 ) )
921 )
922 {
924
925 ERR("DPSESSIONDESC passed in? Size=%u\n",
926 lpConn->lpSessionDesc?lpConn->lpSessionDesc->dwSize:0 );
927
928 return DPERR_INVALIDPARAMS;
929 }
930
931 /* Free the existing memory */
932 DPLAYX_PrivHeapFree( lpDplData->lpConn );
933
935 DPLAYX_SizeOfLobbyDataA( lpConn ) );
936
937 DPLAYX_CopyConnStructA( lpDplData->lpConn, lpConn );
938
939
941
942 /* FIXME: Send a message - I think */
943
944 return DP_OK;
945}
static void DPLAYX_PrivHeapFree(LPVOID addr)
Definition: dplayx_global.c:92
static LPVOID DPLAYX_PrivHeapAlloc(DWORD flags, DWORD size)
LPDPSESSIONDESC2 lpSessionDesc
Definition: dplay.h:286
DWORD dwSize
Definition: dplay.h:284
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by IDirectPlayLobby3AImpl_SetConnectionSettings().

◆ DPLAYX_SetConnectionSettingsW()

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

Definition at line 951 of file dplayx_global.c.

955{
956 LPDPLAYX_LOBBYDATA lpDplData;
957
958 /* Parameter check */
959 if( dwFlags || !lpConn )
960 {
961 ERR("invalid parameters.\n");
962 return DPERR_INVALIDPARAMS;
963 }
964
965 /* Store information */
966 if( lpConn->dwSize != sizeof(DPLCONNECTION) )
967 {
968 ERR(": old/new DPLCONNECTION type? Size=%u\n", lpConn->dwSize );
969
970 return DPERR_INVALIDPARAMS;
971 }
972
974
975 if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
976 {
978
979 return DPERR_NOTLOBBIED;
980 }
981
982 /* Free the existing memory */
983 DPLAYX_PrivHeapFree( lpDplData->lpConn );
984
986 DPLAYX_SizeOfLobbyDataW( lpConn ) );
987
988 DPLAYX_CopyConnStructW( lpDplData->lpConn, lpConn );
989
990
992
993 /* FIXME: Send a message - I think */
994
995 return DP_OK;
996}

Referenced by IDirectPlayLobby3Impl_SetConnectionSettings().

◆ DPLAYX_SetLobbyHandles()

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

Definition at line 254 of file dplayx_global.c.

256{
257 LPDPLAYX_LOBBYDATA lpLData;
258
259 /* Need to explicitly give lobby application. Can't set for yourself */
260 if( dwAppID == 0 )
261 {
262 return FALSE;
263 }
264
266
267 if( !DPLAYX_IsAppIdLobbied( dwAppID, &lpLData ) )
268 {
270 return FALSE;
271 }
272
273 lpLData->hInformOnAppStart = hStart;
274 lpLData->hInformOnAppDeath = hDeath;
275 lpLData->hInformOnSettingRead = hConnRead;
276
278
279 return TRUE;
280}

Referenced by DPL_CreateAndSetLobbyHandles().

◆ DPLAYX_SetLobbyMsgThreadId()

BOOL DPLAYX_SetLobbyMsgThreadId ( DWORD  dwAppId,
DWORD  dwThreadId 
)

Definition at line 1040 of file dplayx_global.c.

1041{
1042 LPDPLAYX_LOBBYDATA lpLobbyData;
1043
1045
1046 if( !DPLAYX_IsAppIdLobbied( dwAppId, &lpLobbyData ) )
1047 {
1049 return FALSE;
1050 }
1051
1052 lpLobbyData->dwLobbyMsgThreadId = dwThreadId;
1053
1055
1056 return TRUE;
1057}
DWORD dwThreadId
Definition: fdebug.c:31

Referenced by IDirectPlayLobby3AImpl_RunApplication().

◆ DPLAYX_SizeOfLobbyDataA()

static DWORD DPLAYX_SizeOfLobbyDataA ( const DPLCONNECTION lpConn)
static

Definition at line 676 of file dplayx_global.c.

677{
678 DWORD dwTotalSize = sizeof( DPLCONNECTION );
679
680 /* Just a safety check */
681 if( lpConn == NULL )
682 {
683 ERR( "lpConn is NULL\n" );
684 return 0;
685 }
686
687 if( lpConn->lpSessionDesc != NULL )
688 {
689 dwTotalSize += sizeof( DPSESSIONDESC2 );
690
691 if( lpConn->lpSessionDesc->u1.lpszSessionNameA )
692 {
693 dwTotalSize += strlen( lpConn->lpSessionDesc->u1.lpszSessionNameA ) + 1;
694 }
695
696 if( lpConn->lpSessionDesc->u2.lpszPasswordA )
697 {
698 dwTotalSize += strlen( lpConn->lpSessionDesc->u2.lpszPasswordA ) + 1;
699 }
700 }
701
702 if( lpConn->lpPlayerName != NULL )
703 {
704 dwTotalSize += sizeof( DPNAME );
705
706 if( lpConn->lpPlayerName->u1.lpszShortNameA )
707 {
708 dwTotalSize += strlen( lpConn->lpPlayerName->u1.lpszShortNameA ) + 1;
709 }
710
711 if( lpConn->lpPlayerName->u2.lpszLongNameA )
712 {
713 dwTotalSize += strlen( lpConn->lpPlayerName->u2.lpszLongNameA ) + 1;
714 }
715
716 }
717
718 dwTotalSize += lpConn->dwAddressSize;
719
720 return dwTotalSize;
721}
DWORD dwAddressSize
Definition: dplay.h:290
LPDPNAME lpPlayerName
Definition: dplay.h:287
LPSTR lpszShortNameA
Definition: dplay.h:194
LPSTR lpszLongNameA
Definition: dplay.h:200
LPSTR lpszSessionNameA
Definition: dplay.h:244
LPSTR lpszPasswordA
Definition: dplay.h:250

Referenced by DPLAYX_GetConnectionSettingsA(), and DPLAYX_SetConnectionSettingsA().

◆ DPLAYX_SizeOfLobbyDataW()

static DWORD DPLAYX_SizeOfLobbyDataW ( const DPLCONNECTION lpConn)
static

Definition at line 723 of file dplayx_global.c.

724{
725 DWORD dwTotalSize = sizeof( DPLCONNECTION );
726
727 /* Just a safety check */
728 if( lpConn == NULL )
729 {
730 ERR( "lpConn is NULL\n" );
731 return 0;
732 }
733
734 if( lpConn->lpSessionDesc != NULL )
735 {
736 dwTotalSize += sizeof( DPSESSIONDESC2 );
737
738 if( lpConn->lpSessionDesc->u1.lpszSessionName )
739 {
740 dwTotalSize += sizeof( WCHAR ) *
741 ( lstrlenW( lpConn->lpSessionDesc->u1.lpszSessionName ) + 1 );
742 }
743
744 if( lpConn->lpSessionDesc->u2.lpszPassword )
745 {
746 dwTotalSize += sizeof( WCHAR ) *
747 ( lstrlenW( lpConn->lpSessionDesc->u2.lpszPassword ) + 1 );
748 }
749 }
750
751 if( lpConn->lpPlayerName != NULL )
752 {
753 dwTotalSize += sizeof( DPNAME );
754
755 if( lpConn->lpPlayerName->u1.lpszShortName )
756 {
757 dwTotalSize += sizeof( WCHAR ) *
758 ( lstrlenW( lpConn->lpPlayerName->u1.lpszShortName ) + 1 );
759 }
760
761 if( lpConn->lpPlayerName->u2.lpszLongName )
762 {
763 dwTotalSize += sizeof( WCHAR ) *
764 ( lstrlenW( lpConn->lpPlayerName->u2.lpszLongName ) + 1 );
765 }
766
767 }
768
769 dwTotalSize += lpConn->dwAddressSize;
770
771 return dwTotalSize;
772}
LPWSTR lpszLongName
Definition: dplay.h:199
LPWSTR lpszShortName
Definition: dplay.h:193
LPWSTR lpszPassword
Definition: dplay.h:249
LPWSTR lpszSessionName
Definition: dplay.h:243

Referenced by DPLAYX_GetConnectionSettingsW(), and DPLAYX_SetConnectionSettingsW().

◆ DPLAYX_WaitForConnectionSettings()

BOOL DPLAYX_WaitForConnectionSettings ( BOOL  bWait)

Definition at line 998 of file dplayx_global.c.

999{
1000 LPDPLAYX_LOBBYDATA lpLobbyData;
1001
1003
1004 if( !DPLAYX_IsAppIdLobbied( 0, &lpLobbyData ) )
1005 {
1007 return FALSE;
1008 }
1009
1010 lpLobbyData->bWaitForConnectionSettings = bWait;
1011
1013
1014 return TRUE;
1015}

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 54 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData(), and DPLAYX_DestructData().

◆ hDplayxSharedMem

HANDLE hDplayxSharedMem
static

Definition at line 57 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData(), and DPLAYX_DestructData().

◆ lobbyData

◆ lpMemArea

DPLAYX_MEM_SLICE* lpMemArea
static

Definition at line 90 of file dplayx_global.c.

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

◆ lpSharedStaticData

LPVOID lpSharedStaticData = NULL
static

Definition at line 59 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData(), and DPLAYX_DestructData().

◆ lpszDplayxFileMapping

const char lpszDplayxFileMapping[] = "WINE_DPLAYX_FM"
static

Definition at line 56 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData().

◆ lpszDplayxSemaName

const char lpszDplayxSemaName[] = "WINE_DPLAYX_SM"
static

Definition at line 53 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData().

◆ sessionData

DPSESSIONDESC2* sessionData = NULL
static

Definition at line 174 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData().