ReactOS 0.4.17-dev-966-gf06eace
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 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_LOBBYDATA * LPDPLAYX_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_SLICE * lpMemArea
 
static DPLAYX_LOBBYDATA * lobbyData = NULL
 
static DPSESSIONDESC2 * sessionData = 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:52
#define INFINITE
Definition: serial.h:102
#define TRACE(s)
Definition: solgame.cpp:4

Definition at line 60 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:491

Definition at line 64 of file dplayx_global.c.

◆ dwBlockSize

#define dwBlockSize   512

Definition at line 78 of file dplayx_global.c.

◆ dwDynamicSharedSize

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

Definition at line 70 of file dplayx_global.c.

◆ dwMaxBlock

Definition at line 79 of file dplayx_global.c.

◆ dwStaticSharedSize

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

Definition at line 69 of file dplayx_global.c.

◆ dwTotalSharedSize

#define dwTotalSharedSize   ( dwStaticSharedSize + dwDynamicSharedSize )

Definition at line 71 of file dplayx_global.c.

Typedef Documentation

◆ DPLAYX_LOBBYDATA

◆ LPDPLAYX_LOBBYDATA

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
numSupportedLobbies 
numSupportedSessions 

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

1025{
1026 UINT i;
1027 BOOL bFound = FALSE;
1028
1030
1031 for( i=0; i < numSupportedLobbies; i++ )
1032 {
1033 if( ( lobbyData[ i ].dwAppID != 0 ) && /* lobby initialized */
1034 ( lobbyData[ i ].bWaitForConnectionSettings ) /* Waiting */
1035 )
1036 {
1037 bFound = TRUE;
1038 break;
1039 }
1040 }
1041
1043
1044 return bFound;
1045}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define DPLAYX_ReleaseSemaphore()
Definition: dplayx_global.c:64
static DPLAYX_LOBBYDATA * lobbyData
#define DPLAYX_AcquireSemaphore()
Definition: dplayx_global.c:60
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: sysinfo.c:13

Referenced by IDirectPlayLobby3AImpl_RunApplication().

◆ DPLAYX_ConstructData()

BOOL DPLAYX_ConstructData ( void  )

Definition at line 355 of file dplayx_global.c.

356{
357 SECURITY_ATTRIBUTES s_attrib;
358 BOOL bInitializeSharedMemory = FALSE;
359 LPVOID lpDesiredMemoryMapStart = (LPVOID)0x50000000;
360 HANDLE hInformOnStart;
361
362 TRACE( "DPLAYX dll loaded - construct called\n" );
363
364 /* Create a semaphore to block access to DPLAYX global data structs */
365
366 s_attrib.bInheritHandle = TRUE;
367 s_attrib.lpSecurityDescriptor = NULL;
368 s_attrib.nLength = sizeof(s_attrib);
369
370 hDplayxSema = CreateSemaphoreA( &s_attrib, 0, 1, lpszDplayxSemaName );
371
372 /* First instance creates the semaphore. Others just use it */
373 if( GetLastError() == ERROR_SUCCESS )
374 {
375 TRACE( "Semaphore %p created\n", hDplayxSema );
376
377 /* The semaphore creator will also build the shared memory */
378 bInitializeSharedMemory = TRUE;
379 }
380 else if ( GetLastError() == ERROR_ALREADY_EXISTS )
381 {
382 TRACE( "Found semaphore handle %p\n", hDplayxSema );
384 }
385 else
386 {
387 ERR( ": semaphore error %ld\n", GetLastError() );
388 return FALSE;
389 }
390
392
394 &s_attrib,
396 0,
399
400 if( GetLastError() == ERROR_SUCCESS )
401 {
402 TRACE( "File mapped %p created\n", hDplayxSharedMem );
403 }
404 else if ( GetLastError() == ERROR_ALREADY_EXISTS )
405 {
406 TRACE( "Found FileMapping handle %p\n", hDplayxSharedMem );
407 }
408 else
409 {
410 ERR( ": unable to create shared memory (%ld)\n", GetLastError() );
412 return FALSE;
413 }
414
417 0, 0, 0, lpDesiredMemoryMapStart );
418
420 {
421 /* We couldn't map the data where we wanted. Try again, allowing any
422 * location. */
425 0, 0, 0 );
426 }
427
428 if( lpSharedStaticData == NULL )
429 {
430 ERR( ": unable to map static data into process memory space (%ld)\n",
431 GetLastError() );
433 return FALSE;
434 }
435 else
436 {
437 if( lpDesiredMemoryMapStart == lpSharedStaticData )
438 {
439 TRACE( "File mapped to %p\n", lpSharedStaticData );
440 }
441 else
442 {
443 /* Presently the shared data structures use pointers. If the
444 * files are not mapped into the same area, the pointers will no
445 * longer make any sense :(
446 * FIXME: In the future make the shared data structures have some
447 * sort of fixup to make them independent between data spaces.
448 * This will also require a rework of the session data stuff.
449 */
450 ERR( "File mapped to %p (not %p). Expect failure\n",
451 lpSharedStaticData, lpDesiredMemoryMapStart );
452 }
453 }
454
455 /* Dynamic area starts just after the static area */
457
458 /* FIXME: Crude hack */
461
462 /* Initialize shared data segments. */
463 if( bInitializeSharedMemory )
464 {
465 UINT i;
466
467 TRACE( "Initializing shared memory\n" );
468
469 /* Set all lobbies to be "empty" */
470 for( i=0; i < numSupportedLobbies; i++ )
471 {
473 }
474
475 /* Set all sessions to be "empty" */
476 for( i=0; i < numSupportedSessions; i++ )
477 {
478 sessionData[i].dwSize = 0;
479 }
480
481 /* Zero out the dynamic area */
483
484 /* Just for fun sync the whole data area */
486 }
487
489
490 /* Everything was created correctly. Signal the lobby client that
491 * we started up correctly
492 */
493 if( DPLAYX_GetThisLobbyHandles( &hInformOnStart, NULL, NULL, FALSE ) &&
494 hInformOnStart
495 )
496 {
497 BOOL bSuccess;
498 bSuccess = SetEvent( hInformOnStart );
499 TRACE( "Signalling lobby app start event %p %s\n",
500 hInformOnStart, bSuccess ? "succeed" : "failed" );
501
502 /* Close out handle */
503 DPLAYX_GetThisLobbyHandles( &hInformOnStart, NULL, NULL, TRUE );
504 }
505
506 return TRUE;
507}
#define ERR(fmt,...)
Definition: precomp.h:57
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_ADDRESS
Definition: compat.h:106
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MapViewOfFile
Definition: compat.h:745
static const char lpszDplayxSemaName[]
Definition: dplayx_global.c:51
static BOOL DPLAYX_GetThisLobbyHandles(LPHANDLE lphStart, LPHANDLE lphDeath, LPHANDLE lphConnRead, BOOL bClearSetHandles)
static DPSESSIONDESC2 * sessionData
#define dwDynamicSharedSize
Definition: dplayx_global.c:70
static DPLAYX_MEM_SLICE * lpMemArea
Definition: dplayx_global.c:88
#define dwTotalSharedSize
Definition: dplayx_global.c:71
static void DPLAYX_InitializeLobbyDataEntry(LPDPLAYX_LOBBYDATA lpData)
static const char lpszDplayxFileMapping[]
Definition: dplayx_global.c:54
static LPVOID lpSharedStaticData
Definition: dplayx_global.c:57
static HANDLE hDplayxSharedMem
Definition: dplayx_global.c:55
#define dwStaticSharedSize
Definition: dplayx_global.c:69
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 ZeroMemory
Definition: minwinbase.h:31
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define SEC_COMMIT
Definition: mmtypes.h:100
#define PAGE_READWRITE
Definition: nt_native.h:1307
#define LPVOID
Definition: nt_native.h:45
LPVOID lpSecurityDescriptor
Definition: compat.h:193
DWORD dwSize
Definition: dplay.h:232
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:669
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCSTR lpName OPTIONAL)
Definition: synchansi.c:44
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define FILE_MAP_WRITE
Definition: winbase.h:157
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 547 of file dplayx_global.c.

548{
549 BYTE* lpStartOfFreeSpace;
550
551 *dest = *src;
552
553 lpStartOfFreeSpace = ((BYTE*)dest) + sizeof( DPLCONNECTION );
554
555 /* Copy the LPDPSESSIONDESC2 structure if it exists */
556 if( src->lpSessionDesc )
557 {
558 dest->lpSessionDesc = (LPDPSESSIONDESC2)lpStartOfFreeSpace;
559 lpStartOfFreeSpace += sizeof( DPSESSIONDESC2 );
560 *dest->lpSessionDesc = *src->lpSessionDesc;
561
562 /* Session names may or may not exist */
563 if( src->lpSessionDesc->lpszSessionNameA )
564 {
565 strcpy( (LPSTR)lpStartOfFreeSpace, src->lpSessionDesc->lpszSessionNameA );
566 dest->lpSessionDesc->lpszSessionNameA = (LPSTR)lpStartOfFreeSpace;
567 lpStartOfFreeSpace +=
568 strlen( dest->lpSessionDesc->lpszSessionNameA ) + 1;
569 }
570
571 if( src->lpSessionDesc->lpszPasswordA )
572 {
573 strcpy( (LPSTR)lpStartOfFreeSpace, src->lpSessionDesc->lpszPasswordA );
574 dest->lpSessionDesc->lpszPasswordA = (LPSTR)lpStartOfFreeSpace;
575 lpStartOfFreeSpace +=
576 strlen( dest->lpSessionDesc->lpszPasswordA ) + 1;
577 }
578 }
579
580 /* DPNAME structure is optional */
581 if( src->lpPlayerName )
582 {
583 dest->lpPlayerName = (LPDPNAME)lpStartOfFreeSpace;
584 lpStartOfFreeSpace += sizeof( DPNAME );
585 *dest->lpPlayerName = *src->lpPlayerName;
586
587 if( src->lpPlayerName->lpszShortNameA )
588 {
589 strcpy( (LPSTR)lpStartOfFreeSpace, src->lpPlayerName->lpszShortNameA );
590 dest->lpPlayerName->lpszShortNameA = (LPSTR)lpStartOfFreeSpace;
591 lpStartOfFreeSpace +=
592 strlen( dest->lpPlayerName->lpszShortNameA ) + 1;
593 }
594
595 if( src->lpPlayerName->lpszLongNameA )
596 {
597 strcpy( (LPSTR)lpStartOfFreeSpace, src->lpPlayerName->lpszLongNameA );
598 dest->lpPlayerName->lpszLongNameA = (LPSTR)lpStartOfFreeSpace;
599 lpStartOfFreeSpace +=
600 strlen( (LPSTR)dest->lpPlayerName->lpszLongName ) + 1 ;
601 }
602
603 }
604
605 /* Copy address if it exists */
606 if( src->lpAddress )
607 {
608 dest->lpAddress = lpStartOfFreeSpace;
609 CopyMemory( lpStartOfFreeSpace, src->lpAddress, src->dwAddressSize );
610 /* No need to advance lpStartOfFreeSpace as there is no more "dynamic" data */
611 }
612}
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
struct tagDPNAME * LPDPNAME
struct tagDPNAME DPNAME
struct tagDPLCONNECTION DPLCONNECTION
struct tagDPSESSIONDESC2 * LPDPSESSIONDESC2
struct tagDPSESSIONDESC2 DPSESSIONDESC2
GLenum src
Definition: glext.h:6340
#define CopyMemory
Definition: minwinbase.h:29
static char * dest
Definition: rtl.c:149
strcpy
Definition: string.h:131
char * LPSTR
Definition: typedefs.h:51

Referenced by DPLAYX_GetConnectionSettingsA(), and DPLAYX_SetConnectionSettingsA().

◆ DPLAYX_CopyConnStructW()

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

Definition at line 615 of file dplayx_global.c.

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

Referenced by DPLAYX_GetConnectionSettingsW(), and DPLAYX_SetConnectionSettingsW().

◆ DPLAYX_CreateLobbyApplication()

BOOL DPLAYX_CreateLobbyApplication ( DWORD  dwAppID)

Definition at line 212 of file dplayx_global.c.

213{
214 UINT i;
215
216 /* 0 is the marker for unused application data slots */
217 if( dwAppID == 0 )
218 {
219 return FALSE;
220 }
221
223
224 /* Find an empty space in the list and insert the data */
225 for( i=0; i < numSupportedLobbies; i++ )
226 {
227 if( lobbyData[ i ].dwAppID == 0 )
228 {
229 /* This process is now lobbied */
230 TRACE( "Setting lobbyData[%u] for (0x%08lx,0x%08lx)\n",
231 i, dwAppID, GetCurrentProcessId() );
232
233 lobbyData[ i ].dwAppID = dwAppID;
235
236 /* FIXME: Where is the best place for this? In interface or here? */
240
242 return TRUE;
243 }
244 }
245
246 ERR( "No empty lobbies\n" );
247
249 return FALSE;
250}
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1205

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

◆ DPLAYX_DestructData()

BOOL DPLAYX_DestructData ( void  )

Definition at line 513 of file dplayx_global.c.

514{
515 HANDLE hInformOnDeath;
516
517 TRACE( "DPLAYX dll unloaded - destruct called\n" );
518
519 /* If required, inform that this app is dying */
520 if( DPLAYX_GetThisLobbyHandles( NULL, &hInformOnDeath, NULL, FALSE ) &&
521 hInformOnDeath
522 )
523 {
524 BOOL bSuccess;
525 bSuccess = SetEvent( hInformOnDeath );
526 TRACE( "Signalling lobby app death event %p %s\n",
527 hInformOnDeath, bSuccess ? "succeed" : "failed" );
528
529 /* Close out handle */
530 DPLAYX_GetThisLobbyHandles( NULL, &hInformOnDeath, NULL, TRUE );
531 }
532
533 /* DO CLEAN UP (LAST) */
534
535 /* Delete the semaphore */
537
538 /* Delete shared memory file mapping */
541
542 return FALSE;
543}
#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 781 of file dplayx_global.c.

785{
786 LPDPLAYX_LOBBYDATA lpDplData;
787 DWORD dwRequiredDataSize = 0;
788 HANDLE hInformOnSettingRead;
789
791
792 if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
793 {
795
796 TRACE( "Application 0x%08lx is not lobbied\n", dwAppID );
797 return DPERR_NOTLOBBIED;
798 }
799
800 dwRequiredDataSize = DPLAYX_SizeOfLobbyDataA( lpDplData->lpConn );
801
802 /* Do they want to know the required buffer size or is the provided buffer
803 * big enough?
804 */
805 if ( ( lpData == NULL ) ||
806 ( *lpdwDataSize < dwRequiredDataSize )
807 )
808 {
810
811 *lpdwDataSize = DPLAYX_SizeOfLobbyDataA( lpDplData->lpConn );
812
814 }
815
816 DPLAYX_CopyConnStructA( lpData, lpDplData->lpConn );
817
819
820 /* They have gotten the information - signal the event if required */
821 if( DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, FALSE ) &&
822 hInformOnSettingRead
823 )
824 {
825 BOOL bSuccess;
826 bSuccess = SetEvent( hInformOnSettingRead );
827 TRACE( "Signalling setting read event %p %s\n",
828 hInformOnSettingRead, bSuccess ? "succeed" : "failed" );
829
830 /* Close out handle */
831 DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, TRUE );
832 }
833
834 return DP_OK;
835}
#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 837 of file dplayx_global.c.

841{
842 LPDPLAYX_LOBBYDATA lpDplData;
843 DWORD dwRequiredDataSize = 0;
844 HANDLE hInformOnSettingRead;
845
847
848 if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
849 {
851 return DPERR_NOTLOBBIED;
852 }
853
854 dwRequiredDataSize = DPLAYX_SizeOfLobbyDataW( lpDplData->lpConn );
855
856 /* Do they want to know the required buffer size or is the provided buffer
857 * big enough?
858 */
859 if ( ( lpData == NULL ) ||
860 ( *lpdwDataSize < dwRequiredDataSize )
861 )
862 {
864
865 *lpdwDataSize = DPLAYX_SizeOfLobbyDataW( lpDplData->lpConn );
866
868 }
869
870 DPLAYX_CopyConnStructW( lpData, lpDplData->lpConn );
871
873
874 /* They have gotten the information - signal the event if required */
875 if( DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, FALSE ) &&
876 hInformOnSettingRead
877 )
878 {
879 BOOL bSuccess;
880 bSuccess = SetEvent( hInformOnSettingRead );
881 TRACE( "Signalling setting read event %p %s\n",
882 hInformOnSettingRead, bSuccess ? "succeed" : "failed" );
883
884 /* Close out handle */
885 DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, TRUE );
886 }
887
888 return DP_OK;
889}
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 280 of file dplayx_global.c.

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

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

◆ DPLAYX_HresultToString()

LPCSTR DPLAYX_HresultToString ( HRESULT  hr)

Definition at line 1070 of file dplayx_global.c.

1071{
1072 static char szTempStr[12];
1073
1074 switch (hr)
1075 {
1076 case DP_OK:
1077 return "DP_OK";
1079 return "DPERR_ALREADYINITIALIZED";
1080 case DPERR_ACCESSDENIED:
1081 return "DPERR_ACCESSDENIED";
1083 return "DPERR_ACTIVEPLAYERS";
1085 return "DPERR_BUFFERTOOSMALL";
1087 return "DPERR_CANTADDPLAYER";
1089 return "DPERR_CANTCREATEGROUP";
1091 return "DPERR_CANTCREATEPLAYER";
1093 return "DPERR_CANTCREATESESSION";
1095 return "DPERR_CAPSNOTAVAILABLEYET";
1096 case DPERR_EXCEPTION:
1097 return "DPERR_EXCEPTION";
1098 case DPERR_GENERIC:
1099 return "DPERR_GENERIC";
1100 case DPERR_INVALIDFLAGS:
1101 return "DPERR_INVALIDFLAGS";
1103 return "DPERR_INVALIDOBJECT";
1105 return "DPERR_INVALIDPARAMS";
1107 return "DPERR_INVALIDPLAYER";
1108 case DPERR_INVALIDGROUP:
1109 return "DPERR_INVALIDGROUP";
1110 case DPERR_NOCAPS:
1111 return "DPERR_NOCAPS";
1112 case DPERR_NOCONNECTION:
1113 return "DPERR_NOCONNECTION";
1114 case DPERR_OUTOFMEMORY:
1115 return "DPERR_OUTOFMEMORY";
1116 case DPERR_NOMESSAGES:
1117 return "DPERR_NOMESSAGES";
1119 return "DPERR_NONAMESERVERFOUND";
1120 case DPERR_NOPLAYERS:
1121 return "DPERR_NOPLAYERS";
1122 case DPERR_NOSESSIONS:
1123 return "DPERR_NOSESSIONS";
1124 case DPERR_PENDING:
1125 return "DPERR_PENDING";
1126 case DPERR_SENDTOOBIG:
1127 return "DPERR_SENDTOOBIG";
1128 case DPERR_TIMEOUT:
1129 return "DPERR_TIMEOUT";
1130 case DPERR_UNAVAILABLE:
1131 return "DPERR_UNAVAILABLE";
1132 case DPERR_UNSUPPORTED:
1133 return "DPERR_UNSUPPORTED";
1134 case DPERR_BUSY:
1135 return "DPERR_BUSY";
1136 case DPERR_USERCANCEL:
1137 return "DPERR_USERCANCEL";
1138 case DPERR_NOINTERFACE:
1139 return "DPERR_NOINTERFACE";
1141 return "DPERR_CANNOTCREATESERVER";
1142 case DPERR_PLAYERLOST:
1143 return "DPERR_PLAYERLOST";
1144 case DPERR_SESSIONLOST:
1145 return "DPERR_SESSIONLOST";
1147 return "DPERR_UNINITIALIZED";
1148 case DPERR_NONEWPLAYERS:
1149 return "DPERR_NONEWPLAYERS";
1151 return "DPERR_INVALIDPASSWORD";
1152 case DPERR_CONNECTING:
1153 return "DPERR_CONNECTING";
1155 return "DPERR_CONNECTIONLOST";
1157 return "DPERR_UNKNOWNMESSAGE";
1158 case DPERR_CANCELFAILED:
1159 return "DPERR_CANCELFAILED";
1161 return "DPERR_INVALIDPRIORITY";
1162 case DPERR_NOTHANDLED:
1163 return "DPERR_NOTHANDLED";
1164 case DPERR_CANCELLED:
1165 return "DPERR_CANCELLED";
1166 case DPERR_ABORTED:
1167 return "DPERR_ABORTED";
1169 return "DPERR_BUFFERTOOLARGE";
1171 return "DPERR_CANTCREATEPROCESS";
1173 return "DPERR_APPNOTSTARTED";
1175 return "DPERR_INVALIDINTERFACE";
1177 return "DPERR_NOSERVICEPROVIDER";
1179 return "DPERR_UNKNOWNAPPLICATION";
1180 case DPERR_NOTLOBBIED:
1181 return "DPERR_NOTLOBBIED";
1183 return "DPERR_SERVICEPROVIDERLOADED";
1185 return "DPERR_ALREADYREGISTERED";
1187 return "DPERR_NOTREGISTERED";
1189 return "DPERR_AUTHENTICATIONFAILED";
1190 case DPERR_CANTLOADSSPI:
1191 return "DPERR_CANTLOADSSPI";
1193 return "DPERR_ENCRYPTIONFAILED";
1194 case DPERR_SIGNFAILED:
1195 return "DPERR_SIGNFAILED";
1197 return "DPERR_CANTLOADSECURITYPACKAGE";
1199 return "DPERR_ENCRYPTIONNOTSUPPORTED";
1200 case DPERR_CANTLOADCAPI:
1201 return "DPERR_CANTLOADCAPI";
1202 case DPERR_NOTLOGGEDIN:
1203 return "DPERR_NOTLOGGEDIN";
1204 case DPERR_LOGONDENIED:
1205 return "DPERR_LOGONDENIED";
1206 default:
1207 /* For errors not in the list, return HRESULT as a string
1208 This part is not thread safe */
1209 WARN( "Unknown error 0x%08lx\n", hr );
1210 wsprintfA( szTempStr, "0x%08x", hr );
1211 return szTempStr;
1212 }
1213}
#define WARN(fmt,...)
Definition: precomp.h:61
HRESULT hr
Definition: delayimp.cpp:582
#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
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)

Referenced by DirectPlayCreate(), DP_BuildSPCompoundAddr(), DP_CreateSPPlayer(), DP_EnumSessionsSendAsyncRequestThread(), DP_IF_CreatePlayer(), DP_InitializeDPLSP(), DP_InitializeDPSP(), DP_MSG_ExpectReply(), DP_MSG_SendAddForwardAck(), DP_MSG_SendAddPlayerToGroup(), DP_MSG_SendCreatePlayer(), DP_MSG_SendPingReply(), DP_ReadConnections(), DP_SecureOpen(), DPL_ConnectEx(), IDirectPlayLobby3AImpl_RunApplication(), IDirectPlaySPImpl_GetSPPlayerData(), and IDirectPlaySPImpl_HandleMessage().

◆ DPLAYX_InitializeLobbyDataEntry()

static void DPLAYX_InitializeLobbyDataEntry ( LPDPLAYX_LOBBYDATA  lpData)
static

Definition at line 176 of file dplayx_global.c.

177{
178 ZeroMemory( lpData, sizeof( *lpData ) );
179}

Referenced by DPLAYX_ConstructData().

◆ DPLAYX_IsAppIdLobbied()

static BOOL DPLAYX_IsAppIdLobbied ( DWORD  dwAppID,
LPDPLAYX_LOBBYDATA *  lplpDplData 
)
static

Definition at line 185 of file dplayx_global.c.

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

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

108{
109 LPVOID lpvArea = NULL;
110 UINT uBlockUsed;
111
112 if( size > (dwBlockSize - sizeof(BOOL)) )
113 {
114 FIXME( "Size exceeded. Request of 0x%08lx\n", size );
115 size = dwBlockSize - sizeof(BOOL);
116 }
117
118 /* Find blank area */
119 uBlockUsed = 0;
120 while( uBlockUsed < dwMaxBlock && lpMemArea[ uBlockUsed ].used ) { uBlockUsed++; }
121
122 if( uBlockUsed < dwMaxBlock )
123 {
124 /* Set the area used */
125 lpMemArea[ uBlockUsed ].used = TRUE;
126 lpvArea = lpMemArea[ uBlockUsed ].data;
127 }
128 else
129 {
130 ERR( "No free block found\n" );
131 return NULL;
132 }
133
134 if( flags & HEAP_ZERO_MEMORY )
135 {
136 ZeroMemory( lpvArea, size );
137 }
138
139 return lpvArea;
140}
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:79
#define dwBlockSize
Definition: dplayx_global.c:78
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:84

Referenced by DPLAYX_SetConnectionSettingsA(), and DPLAYX_SetConnectionSettingsW().

◆ DPLAYX_PrivHeapFree()

static void DPLAYX_PrivHeapFree ( LPVOID  addr)
static

Definition at line 90 of file dplayx_global.c.

91{
92 LPVOID lpAddrStart;
93 DWORD dwBlockUsed;
94
95 /* Handle getting passed a NULL */
96 if( addr == NULL )
97 {
98 return;
99 }
100
101 lpAddrStart = CONTAINING_RECORD(addr, DPLAYX_MEM_SLICE, data); /* Find block header */
102 dwBlockUsed = ((BYTE*)lpAddrStart - (BYTE*)lpMemArea)/dwBlockSize;
103
104 lpMemArea[ dwBlockUsed ].used = FALSE;
105}
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 895 of file dplayx_global.c.

899{
900 LPDPLAYX_LOBBYDATA lpDplData;
901
902 /* Parameter check */
903 if( dwFlags || !lpConn )
904 {
905 ERR("invalid parameters.\n");
906 return DPERR_INVALIDPARAMS;
907 }
908
909 /* Store information */
910 if( lpConn->dwSize != sizeof(DPLCONNECTION) )
911 {
912 ERR(": old/new DPLCONNECTION type? Size=%08lx\n", lpConn->dwSize );
913
914 return DPERR_INVALIDPARAMS;
915 }
916
918
919 if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
920 {
922
923 return DPERR_NOTLOBBIED;
924 }
925
926 if( (!lpConn->lpSessionDesc ) ||
927 ( lpConn->lpSessionDesc->dwSize != sizeof( DPSESSIONDESC2 ) )
928 )
929 {
931
932 ERR("DPSESSIONDESC passed in? Size=%lu\n",
933 lpConn->lpSessionDesc?lpConn->lpSessionDesc->dwSize:0 );
934
935 return DPERR_INVALIDPARAMS;
936 }
937
938 /* Free the existing memory */
939 DPLAYX_PrivHeapFree( lpDplData->lpConn );
940
942 DPLAYX_SizeOfLobbyDataA( lpConn ) );
943
944 DPLAYX_CopyConnStructA( lpDplData->lpConn, lpConn );
945
946
948
949 /* FIXME: Send a message - I think */
950
951 return DP_OK;
952}
static void DPLAYX_PrivHeapFree(LPVOID addr)
Definition: dplayx_global.c:90
static LPVOID DPLAYX_PrivHeapAlloc(DWORD flags, DWORD size)
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
LPDPSESSIONDESC2 lpSessionDesc
Definition: dplay.h:286
DWORD dwSize
Definition: dplay.h:284

Referenced by IDirectPlayLobby3AImpl_SetConnectionSettings().

◆ DPLAYX_SetConnectionSettingsW()

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

Definition at line 958 of file dplayx_global.c.

962{
963 LPDPLAYX_LOBBYDATA lpDplData;
964
965 /* Parameter check */
966 if( dwFlags || !lpConn )
967 {
968 ERR("invalid parameters.\n");
969 return DPERR_INVALIDPARAMS;
970 }
971
972 /* Store information */
973 if( lpConn->dwSize != sizeof(DPLCONNECTION) )
974 {
975 ERR(": old/new DPLCONNECTION type? Size=%lu\n", lpConn->dwSize );
976
977 return DPERR_INVALIDPARAMS;
978 }
979
981
982 if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
983 {
985
986 return DPERR_NOTLOBBIED;
987 }
988
989 /* Free the existing memory */
990 DPLAYX_PrivHeapFree( lpDplData->lpConn );
991
993 DPLAYX_SizeOfLobbyDataW( lpConn ) );
994
995 DPLAYX_CopyConnStructW( lpDplData->lpConn, lpConn );
996
997
999
1000 /* FIXME: Send a message - I think */
1001
1002 return DP_OK;
1003}

Referenced by IDirectPlayLobby3Impl_SetConnectionSettings().

◆ DPLAYX_SetLobbyHandles()

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

Definition at line 252 of file dplayx_global.c.

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

Referenced by DPL_CreateAndSetLobbyHandles().

◆ DPLAYX_SetLobbyMsgThreadId()

BOOL DPLAYX_SetLobbyMsgThreadId ( DWORD  dwAppId,
DWORD  dwThreadId 
)

Definition at line 1047 of file dplayx_global.c.

1048{
1049 LPDPLAYX_LOBBYDATA lpLobbyData;
1050
1052
1053 if( !DPLAYX_IsAppIdLobbied( dwAppId, &lpLobbyData ) )
1054 {
1056 return FALSE;
1057 }
1058
1059 lpLobbyData->dwLobbyMsgThreadId = dwThreadId;
1060
1062
1063 return TRUE;
1064}
DWORD dwThreadId
Definition: fdebug.c:31

Referenced by IDirectPlayLobby3AImpl_RunApplication().

◆ DPLAYX_SizeOfLobbyDataA()

static DWORD DPLAYX_SizeOfLobbyDataA ( const DPLCONNECTION *  lpConn)
static

Definition at line 683 of file dplayx_global.c.

684{
685 DWORD dwTotalSize = sizeof( DPLCONNECTION );
686
687 /* Just a safety check */
688 if( lpConn == NULL )
689 {
690 ERR( "lpConn is NULL\n" );
691 return 0;
692 }
693
694 if( lpConn->lpSessionDesc != NULL )
695 {
696 dwTotalSize += sizeof( DPSESSIONDESC2 );
697
698 if( lpConn->lpSessionDesc->lpszSessionNameA )
699 {
700 dwTotalSize += strlen( lpConn->lpSessionDesc->lpszSessionNameA ) + 1;
701 }
702
703 if( lpConn->lpSessionDesc->lpszPasswordA )
704 {
705 dwTotalSize += strlen( lpConn->lpSessionDesc->lpszPasswordA ) + 1;
706 }
707 }
708
709 if( lpConn->lpPlayerName != NULL )
710 {
711 dwTotalSize += sizeof( DPNAME );
712
713 if( lpConn->lpPlayerName->lpszShortNameA )
714 {
715 dwTotalSize += strlen( lpConn->lpPlayerName->lpszShortNameA ) + 1;
716 }
717
718 if( lpConn->lpPlayerName->lpszLongNameA )
719 {
720 dwTotalSize += strlen( lpConn->lpPlayerName->lpszLongNameA ) + 1;
721 }
722
723 }
724
725 dwTotalSize += lpConn->dwAddressSize;
726
727 return dwTotalSize;
728}
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 730 of file dplayx_global.c.

731{
732 DWORD dwTotalSize = sizeof( DPLCONNECTION );
733
734 /* Just a safety check */
735 if( lpConn == NULL )
736 {
737 ERR( "lpConn is NULL\n" );
738 return 0;
739 }
740
741 if( lpConn->lpSessionDesc != NULL )
742 {
743 dwTotalSize += sizeof( DPSESSIONDESC2 );
744
745 if( lpConn->lpSessionDesc->lpszSessionName )
746 {
747 dwTotalSize += sizeof( WCHAR ) *
748 ( lstrlenW( lpConn->lpSessionDesc->lpszSessionName ) + 1 );
749 }
750
751 if( lpConn->lpSessionDesc->lpszPassword )
752 {
753 dwTotalSize += sizeof( WCHAR ) *
754 ( lstrlenW( lpConn->lpSessionDesc->lpszPassword ) + 1 );
755 }
756 }
757
758 if( lpConn->lpPlayerName != NULL )
759 {
760 dwTotalSize += sizeof( DPNAME );
761
762 if( lpConn->lpPlayerName->lpszShortName )
763 {
764 dwTotalSize += sizeof( WCHAR ) *
765 ( lstrlenW( lpConn->lpPlayerName->lpszShortName ) + 1 );
766 }
767
768 if( lpConn->lpPlayerName->lpszLongName )
769 {
770 dwTotalSize += sizeof( WCHAR ) *
771 ( lstrlenW( lpConn->lpPlayerName->lpszLongName ) + 1 );
772 }
773
774 }
775
776 dwTotalSize += lpConn->dwAddressSize;
777
778 return dwTotalSize;
779}
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 1005 of file dplayx_global.c.

1006{
1007 LPDPLAYX_LOBBYDATA lpLobbyData;
1008
1010
1011 if( !DPLAYX_IsAppIdLobbied( 0, &lpLobbyData ) )
1012 {
1014 return FALSE;
1015 }
1016
1017 lpLobbyData->bWaitForConnectionSettings = bWait;
1018
1020
1021 return TRUE;
1022}

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

Referenced by DPLAYX_ConstructData(), and DPLAYX_DestructData().

◆ hDplayxSharedMem

HANDLE hDplayxSharedMem
static

Definition at line 55 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData(), and DPLAYX_DestructData().

◆ lobbyData

◆ lpMemArea

DPLAYX_MEM_SLICE* lpMemArea
static

Definition at line 88 of file dplayx_global.c.

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

◆ lpSharedStaticData

LPVOID lpSharedStaticData = NULL
static

Definition at line 57 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData(), and DPLAYX_DestructData().

◆ lpszDplayxFileMapping

const char lpszDplayxFileMapping[] = "WINE_DPLAYX_FM"
static

Definition at line 54 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData().

◆ lpszDplayxSemaName

const char lpszDplayxSemaName[] = "WINE_DPLAYX_SM"
static

Definition at line 51 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData().

◆ sessionData

DPSESSIONDESC2* sessionData = NULL
static

Definition at line 172 of file dplayx_global.c.

Referenced by DPLAYX_ConstructData().