35#define NONAMELESSUNION
62#define DPLAYX_AcquireSemaphore() TRACE( "Waiting for DPLAYX semaphore\n" ); \
63 WaitForSingleObject( hDplayxSema, INFINITE );\
64 TRACE( "Through wait\n" )
66#define DPLAYX_ReleaseSemaphore() ReleaseSemaphore( hDplayxSema, 1, NULL ); \
67 TRACE( "DPLAYX Semaphore released\n" )
71#define dwStaticSharedSize (128 * 1024)
72#define dwDynamicSharedSize (512 * 1024)
73#define dwTotalSharedSize ( dwStaticSharedSize + dwDynamicSharedSize )
80#define dwBlockSize 512
81#define dwMaxBlock (dwDynamicSharedSize/dwBlockSize)
116 FIXME(
"Size exceeded. Request of 0x%08x\n",
size );
132 ERR(
"No free block found\n" );
196 TRACE(
"Translated dwAppID == 0 into 0x%08x\n", dwAppID );
204 TRACE(
"Found 0x%08x @ %u\n", dwAppID,
i );
232 TRACE(
"Setting lobbyData[%u] for (0x%08x,0x%08x)\n",
248 ERR(
"No empty lobbies\n" );
285 BOOL bClearSetHandles )
297 if( lphStart !=
NULL )
307 if( bClearSetHandles )
314 if( lphDeath !=
NULL )
324 if( bClearSetHandles )
331 if( lphConnRead !=
NULL )
341 if( bClearSetHandles )
364 TRACE(
"DPLAYX dll loaded - construct called\n" );
370 s_attrib.
nLength =
sizeof(s_attrib);
380 bInitializeSharedMemory =
TRUE;
419 0, 0, 0, lpDesiredMemoryMapStart );
423 ERR(
": unable to map static data into process memory space (%d)\n",
443 ERR(
"File mapped to %p (not %p). Expect failure\n",
456 if( bInitializeSharedMemory )
460 TRACE(
"Initializing shared memory\n" );
492 TRACE(
"Signalling lobby app start event %p %s\n",
493 hInformOnStart,
bSuccess ?
"succeed" :
"failed" );
510 TRACE(
"DPLAYX dll unloaded - destruct called\n" );
519 TRACE(
"Signalling lobby app death event %p %s\n",
520 hInformOnDeath,
bSuccess ?
"succeed" :
"failed" );
542 BYTE* lpStartOfFreeSpace;
549 if(
src->lpSessionDesc )
553 *
dest->lpSessionDesc = *
src->lpSessionDesc;
556 if(
src->lpSessionDesc->u1.lpszSessionNameA )
558 strcpy( (
LPSTR)lpStartOfFreeSpace,
src->lpSessionDesc->u1.lpszSessionNameA );
559 dest->lpSessionDesc->u1.lpszSessionNameA = (
LPSTR)lpStartOfFreeSpace;
560 lpStartOfFreeSpace +=
561 strlen(
dest->lpSessionDesc->u1.lpszSessionNameA ) + 1;
564 if(
src->lpSessionDesc->u2.lpszPasswordA )
566 strcpy( (
LPSTR)lpStartOfFreeSpace,
src->lpSessionDesc->u2.lpszPasswordA );
567 dest->lpSessionDesc->u2.lpszPasswordA = (
LPSTR)lpStartOfFreeSpace;
568 lpStartOfFreeSpace +=
569 strlen(
dest->lpSessionDesc->u2.lpszPasswordA ) + 1;
574 if(
src->lpPlayerName )
577 lpStartOfFreeSpace +=
sizeof(
DPNAME );
578 *
dest->lpPlayerName = *
src->lpPlayerName;
580 if(
src->lpPlayerName->u1.lpszShortNameA )
582 strcpy( (
LPSTR)lpStartOfFreeSpace,
src->lpPlayerName->u1.lpszShortNameA );
583 dest->lpPlayerName->u1.lpszShortNameA = (
LPSTR)lpStartOfFreeSpace;
584 lpStartOfFreeSpace +=
585 strlen(
dest->lpPlayerName->u1.lpszShortNameA ) + 1;
588 if(
src->lpPlayerName->u2.lpszLongNameA )
590 strcpy( (
LPSTR)lpStartOfFreeSpace,
src->lpPlayerName->u2.lpszLongNameA );
591 dest->lpPlayerName->u2.lpszLongNameA = (
LPSTR)lpStartOfFreeSpace;
592 lpStartOfFreeSpace +=
601 dest->lpAddress = lpStartOfFreeSpace;
610 BYTE* lpStartOfFreeSpace;
617 if(
src->lpSessionDesc )
621 *
dest->lpSessionDesc = *
src->lpSessionDesc;
624 if(
src->lpSessionDesc->u1.lpszSessionName )
627 dest->lpSessionDesc->u1.lpszSessionName = (
LPWSTR)lpStartOfFreeSpace;
628 lpStartOfFreeSpace +=
sizeof(
WCHAR) *
629 (
lstrlenW(
dest->lpSessionDesc->u1.lpszSessionName ) + 1 );
632 if(
src->lpSessionDesc->u2.lpszPassword )
635 dest->lpSessionDesc->u2.lpszPassword = (
LPWSTR)lpStartOfFreeSpace;
636 lpStartOfFreeSpace +=
sizeof(
WCHAR) *
637 (
lstrlenW(
dest->lpSessionDesc->u2.lpszPassword ) + 1 );
642 if(
src->lpPlayerName )
645 lpStartOfFreeSpace +=
sizeof(
DPNAME );
646 *
dest->lpPlayerName = *
src->lpPlayerName;
648 if(
src->lpPlayerName->u1.lpszShortName )
651 dest->lpPlayerName->u1.lpszShortName = (
LPWSTR)lpStartOfFreeSpace;
652 lpStartOfFreeSpace +=
sizeof(
WCHAR) *
653 (
lstrlenW(
dest->lpPlayerName->u1.lpszShortName ) + 1 );
656 if(
src->lpPlayerName->u2.lpszLongName )
659 dest->lpPlayerName->u2.lpszLongName = (
LPWSTR)lpStartOfFreeSpace;
660 lpStartOfFreeSpace +=
sizeof(
WCHAR) *
661 (
lstrlenW(
dest->lpPlayerName->u2.lpszLongName ) + 1 );
669 dest->lpAddress = lpStartOfFreeSpace;
683 ERR(
"lpConn is NULL\n" );
704 dwTotalSize +=
sizeof(
DPNAME );
730 ERR(
"lpConn is NULL\n" );
740 dwTotalSize +=
sizeof(
WCHAR ) *
746 dwTotalSize +=
sizeof(
WCHAR ) *
753 dwTotalSize +=
sizeof(
DPNAME );
757 dwTotalSize +=
sizeof(
WCHAR ) *
763 dwTotalSize +=
sizeof(
WCHAR ) *
780 DWORD dwRequiredDataSize = 0;
781 HANDLE hInformOnSettingRead;
789 TRACE(
"Application 0x%08x is not lobbied\n", dwAppID );
798 if ( ( lpData ==
NULL ) ||
799 ( *lpdwDataSize < dwRequiredDataSize )
820 TRACE(
"Signalling setting read event %p %s\n",
821 hInformOnSettingRead,
bSuccess ?
"succeed" :
"failed" );
836 DWORD dwRequiredDataSize = 0;
837 HANDLE hInformOnSettingRead;
852 if ( ( lpData ==
NULL ) ||
853 ( *lpdwDataSize < dwRequiredDataSize )
874 TRACE(
"Signalling setting read event %p %s\n",
875 hInformOnSettingRead,
bSuccess ?
"succeed" :
"failed" );
898 ERR(
"invalid parameters.\n");
905 ERR(
": old/new DPLCONNECTION type? Size=%08x\n", lpConn->
dwSize );
925 ERR(
"DPSESSIONDESC passed in? Size=%u\n",
961 ERR(
"invalid parameters.\n");
968 ERR(
": old/new DPLCONNECTION type? Size=%u\n", lpConn->
dwSize );
1027 (
lobbyData[
i ].bWaitForConnectionSettings )
1065 static char szTempStr[12];
1072 return "DPERR_ALREADYINITIALIZED";
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";
1090 return "DPERR_EXCEPTION";
1092 return "DPERR_GENERIC";
1094 return "DPERR_INVALIDFLAGS";
1096 return "DPERR_INVALIDOBJECT";
1098 return "DPERR_INVALIDPARAMS";
1100 return "DPERR_INVALIDPLAYER";
1102 return "DPERR_INVALIDGROUP";
1104 return "DPERR_NOCAPS";
1106 return "DPERR_NOCONNECTION";
1108 return "DPERR_OUTOFMEMORY";
1110 return "DPERR_NOMESSAGES";
1112 return "DPERR_NONAMESERVERFOUND";
1114 return "DPERR_NOPLAYERS";
1116 return "DPERR_NOSESSIONS";
1118 return "DPERR_PENDING";
1120 return "DPERR_SENDTOOBIG";
1122 return "DPERR_TIMEOUT";
1124 return "DPERR_UNAVAILABLE";
1126 return "DPERR_UNSUPPORTED";
1128 return "DPERR_BUSY";
1130 return "DPERR_USERCANCEL";
1132 return "DPERR_NOINTERFACE";
1134 return "DPERR_CANNOTCREATESERVER";
1136 return "DPERR_PLAYERLOST";
1138 return "DPERR_SESSIONLOST";
1140 return "DPERR_UNINITIALIZED";
1142 return "DPERR_NONEWPLAYERS";
1144 return "DPERR_INVALIDPASSWORD";
1146 return "DPERR_CONNECTING";
1148 return "DPERR_CONNECTIONLOST";
1150 return "DPERR_UNKNOWNMESSAGE";
1152 return "DPERR_CANCELFAILED";
1154 return "DPERR_INVALIDPRIORITY";
1156 return "DPERR_NOTHANDLED";
1158 return "DPERR_CANCELLED";
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";
1174 return "DPERR_NOTLOBBIED";
1176 return "DPERR_SERVICEPROVIDERLOADED";
1178 return "DPERR_ALREADYREGISTERED";
1180 return "DPERR_NOTREGISTERED";
1182 return "DPERR_AUTHENTICATIONFAILED";
1184 return "DPERR_CANTLOADSSPI";
1186 return "DPERR_ENCRYPTIONFAILED";
1188 return "DPERR_SIGNFAILED";
1190 return "DPERR_CANTLOADSECURITYPACKAGE";
1192 return "DPERR_ENCRYPTIONNOTSUPPORTED";
1194 return "DPERR_CANTLOADCAPI";
1196 return "DPERR_NOTLOGGEDIN";
1198 return "DPERR_LOGONDENIED";
1202 WARN(
"Unknown error 0x%08x\n",
hr );
ACPI_SIZE strlen(const char *String)
char * strcpy(char *DstString, const char *SrcString)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define INVALID_HANDLE_VALUE
#define DPERR_INVALIDOBJECT
#define DPERR_ACCESSDENIED
#define DPERR_UNKNOWNAPPLICATION
#define DPERR_NOTLOGGEDIN
#define DPERR_LOGONDENIED
#define DPERR_NOTREGISTERED
#define DPERR_CANTADDPLAYER
#define DPERR_NOSERVICEPROVIDER
#define DPERR_BUFFERTOOLARGE
#define DPERR_SESSIONLOST
#define DPERR_NONEWPLAYERS
#define DPERR_UNINITIALIZED
#define DPERR_CANTCREATEPLAYER
#define DPERR_ALREADYREGISTERED
#define DPERR_INVALIDGROUP
struct tagDPNAME * LPDPNAME
#define DPERR_AUTHENTICATIONFAILED
#define DPERR_ENCRYPTIONFAILED
#define DPERR_INVALIDINTERFACE
#define DPERR_NOINTERFACE
#define DPERR_CANNOTCREATESERVER
#define DPERR_CANTLOADCAPI
#define DPERR_ENCRYPTIONNOTSUPPORTED
#define DPERR_CAPSNOTAVAILABLEYET
#define DPERR_CONNECTIONLOST
#define DPERR_BUFFERTOOSMALL
#define DPERR_ALREADYINITIALIZED
#define DPERR_INVALIDFLAGS
#define DPERR_CANTLOADSSPI
#define DPERR_SERVICEPROVIDERLOADED
#define DPERR_UNSUPPORTED
#define DPERR_UNKNOWNMESSAGE
#define DPERR_CANTCREATEGROUP
#define DPERR_UNAVAILABLE
#define DPERR_NONAMESERVERFOUND
#define DPERR_CANCELFAILED
#define DPERR_APPNOTSTARTED
#define DPERR_INVALIDPLAYER
#define DPERR_NOCONNECTION
#define DPERR_INVALIDPARAMS
#define DPERR_INVALIDPASSWORD
#define DPERR_ACTIVEPLAYERS
struct tagDPLCONNECTION DPLCONNECTION
#define DPERR_OUTOFMEMORY
#define DPERR_CANTCREATEPROCESS
struct tagDPSESSIONDESC2 * LPDPSESSIONDESC2
#define DPERR_INVALIDPRIORITY
#define DPERR_CANTCREATESESSION
struct tagDPSESSIONDESC2 DPSESSIONDESC2
#define DPERR_CANTLOADSECURITYPACKAGE
static BOOL DPLAYX_IsAppIdLobbied(DWORD dwAppID, LPDPLAYX_LOBBYDATA *lplpDplData)
static const char lpszDplayxSemaName[]
static BOOL DPLAYX_GetThisLobbyHandles(LPHANDLE lphStart, LPHANDLE lphDeath, LPHANDLE lphConnRead, BOOL bClearSetHandles)
HRESULT DPLAYX_GetConnectionSettingsA(DWORD dwAppID, LPVOID lpData, LPDWORD lpdwDataSize)
static DPSESSIONDESC2 * sessionData
BOOL DPLAYX_SetLobbyHandles(DWORD dwAppID, HANDLE hStart, HANDLE hDeath, HANDLE hConnRead)
#define dwDynamicSharedSize
static DPLAYX_MEM_SLICE * lpMemArea
#define dwTotalSharedSize
static void DPLAYX_InitializeLobbyDataEntry(LPDPLAYX_LOBBYDATA lpData)
static DWORD DPLAYX_SizeOfLobbyDataA(const DPLCONNECTION *lpConn)
static const char lpszDplayxFileMapping[]
BOOL DPLAYX_AnyLobbiesWaitingForConnSettings(void)
static void DPLAYX_PrivHeapFree(LPVOID addr)
static void DPLAYX_CopyConnStructA(LPDPLCONNECTION dest, const DPLCONNECTION *src)
HRESULT DPLAYX_SetConnectionSettingsA(DWORD dwFlags, DWORD dwAppID, const DPLCONNECTION *lpConn)
#define DPLAYX_ReleaseSemaphore()
static LPVOID lpSharedStaticData
static DWORD DPLAYX_SizeOfLobbyDataW(const DPLCONNECTION *lpConn)
BOOL DPLAYX_SetLobbyMsgThreadId(DWORD dwAppId, DWORD dwThreadId)
BOOL DPLAYX_CreateLobbyApplication(DWORD dwAppID)
BOOL DPLAYX_WaitForConnectionSettings(BOOL bWait)
static LPVOID DPLAYX_PrivHeapAlloc(DWORD flags, DWORD size)
HRESULT DPLAYX_SetConnectionSettingsW(DWORD dwFlags, DWORD dwAppID, const DPLCONNECTION *lpConn)
LPCSTR DPLAYX_HresultToString(HRESULT hr)
static HANDLE hDplayxSharedMem
BOOL DPLAYX_DestructData(void)
struct tagDPLAYX_LOBBYDATA DPLAYX_LOBBYDATA
struct tagDPLAYX_LOBBYDATA * LPDPLAYX_LOBBYDATA
static DPLAYX_LOBBYDATA * lobbyData
HRESULT DPLAYX_GetConnectionSettingsW(DWORD dwAppID, LPVOID lpData, LPDWORD lpdwDataSize)
static HANDLE hDplayxSema
static void DPLAYX_CopyConnStructW(LPDPLCONNECTION dest, const DPLCONNECTION *src)
#define DPLAYX_AcquireSemaphore()
#define dwStaticSharedSize
BOOL DPLAYX_ConstructData(void)
LPVOID NTAPI MapViewOfFileEx(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress)
BOOL NTAPI FlushViewOfFile(IN LPCVOID lpBaseAddress, IN SIZE_T dwNumberOfBytesToFlush)
HANDLE NTAPI CreateFileMappingA(IN HANDLE hFile, IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes, IN DWORD flProtect, IN DWORD dwMaximumSizeHigh, IN DWORD dwMaximumSizeLow, IN LPCSTR lpName)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum const GLvoid * addr
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
#define ERROR_ALREADY_EXISTS
BYTE data[dwBlockSize - sizeof(BOOL)]
LPVOID lpSecurityDescriptor
BOOL bWaitForConnectionSettings
DWORD dwAppLaunchedFromID
HANDLE hInformOnSettingRead
LPDPSESSIONDESC2 lpSessionDesc
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
#define CONTAINING_RECORD(address, type, field)
DWORD WINAPI GetLastError(void)
DWORD WINAPI GetCurrentProcessId(void)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)