1999-11-04 03:17:03 +01:00
|
|
|
/* dplayx.dll global data implementation.
|
|
|
|
*
|
2000-05-27 00:26:30 +02:00
|
|
|
* Copyright 1999,2000 - Peter Hunnisett
|
1999-11-04 03:17:03 +01:00
|
|
|
*
|
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2003-09-27 04:23:44 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* NOTES:
|
|
|
|
* o Implementation of all things which are associated with dplay on
|
|
|
|
* the computer - ie shared resources and such. Methods in this
|
|
|
|
* compilation unit should not call anything out side this unit
|
|
|
|
* excepting base windows services and an interface to start the
|
|
|
|
* messaging thread.
|
|
|
|
* o Methods that begin with DPLAYX_ are used for dealing with
|
|
|
|
* dplayx.dll data which is accessible from all processes.
|
|
|
|
*
|
2002-06-01 01:06:46 +02:00
|
|
|
*/
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2001-01-26 21:43:40 +01:00
|
|
|
#include <string.h>
|
2003-01-07 21:36:20 +01:00
|
|
|
|
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
1999-11-04 03:17:03 +01:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "winerror.h"
|
2000-08-14 16:41:19 +02:00
|
|
|
#include "wine/unicode.h"
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
#include "dplayx_global.h"
|
2000-07-10 15:19:28 +02:00
|
|
|
#include "dplayx_messages.h" /* For CreateMessageReceptionThread only */
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dplay);
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
/* FIXME: Need to do all that fun other dll referencing type of stuff */
|
|
|
|
|
|
|
|
/* Static data for all processes */
|
2000-07-10 15:19:28 +02:00
|
|
|
static LPCSTR lpszDplayxSemaName = "WINE_DPLAYX_SM";
|
1999-11-04 03:17:03 +01:00
|
|
|
static HANDLE hDplayxSema;
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
static LPCSTR lpszDplayxFileMapping = "WINE_DPLAYX_FM";
|
|
|
|
static HANDLE hDplayxSharedMem;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
static LPVOID lpSharedStaticData = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
#define DPLAYX_AquireSemaphore() TRACE( "Waiting for DPLAYX semaphore\n" ); \
|
|
|
|
WaitForSingleObject( hDplayxSema, INFINITE );\
|
|
|
|
TRACE( "Through wait\n" )
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
#define DPLAYX_ReleaseSemaphore() ReleaseSemaphore( hDplayxSema, 1, NULL ); \
|
2000-07-10 15:19:28 +02:00
|
|
|
TRACE( "DPLAYX Semaphore released\n" ) /* FIXME: Is this correct? */
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* HACK for simple global data right now */
|
2000-08-25 23:58:05 +02:00
|
|
|
#define dwStaticSharedSize (128 * 1024) /* 128 KBytes */
|
|
|
|
#define dwDynamicSharedSize (512 * 1024) /* 512 KBytes */
|
|
|
|
#define dwTotalSharedSize ( dwStaticSharedSize + dwDynamicSharedSize )
|
2000-07-10 15:19:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* FIXME: Is there no easier way? */
|
|
|
|
|
|
|
|
/* Pretend the entire dynamic area is carved up into 512 byte blocks.
|
|
|
|
* Each block has 4 bytes which are 0 unless used */
|
|
|
|
#define dwBlockSize 512
|
|
|
|
#define dwMaxBlock (dwDynamicSharedSize/dwBlockSize)
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
typedef struct
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
|
|
|
DWORD used;
|
|
|
|
DWORD data[dwBlockSize-sizeof(DWORD)];
|
|
|
|
} DPLAYX_MEM_SLICE;
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
static DPLAYX_MEM_SLICE* lpMemArea;
|
2000-07-10 15:19:28 +02:00
|
|
|
|
|
|
|
void DPLAYX_PrivHeapFree( LPVOID addr );
|
|
|
|
void DPLAYX_PrivHeapFree( LPVOID addr )
|
|
|
|
{
|
|
|
|
LPVOID lpAddrStart;
|
|
|
|
DWORD dwBlockUsed;
|
|
|
|
|
|
|
|
/* Handle getting passed a NULL */
|
|
|
|
if( addr == NULL )
|
|
|
|
{
|
|
|
|
return;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2002-07-03 23:10:43 +02:00
|
|
|
lpAddrStart = (char*)addr - sizeof(DWORD); /* Find block header */
|
2000-07-10 15:19:28 +02:00
|
|
|
dwBlockUsed = ((BYTE*)lpAddrStart - (BYTE*)lpMemArea)/dwBlockSize;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
lpMemArea[ dwBlockUsed ].used = 0;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* FIXME: This should be static, but is being used for a hack right now */
|
2000-07-10 15:19:28 +02:00
|
|
|
LPVOID DPLAYX_PrivHeapAlloc( DWORD flags, DWORD size );
|
|
|
|
LPVOID DPLAYX_PrivHeapAlloc( DWORD flags, DWORD size )
|
|
|
|
{
|
|
|
|
LPVOID lpvArea = NULL;
|
|
|
|
UINT uBlockUsed;
|
|
|
|
|
|
|
|
if( size > (dwBlockSize - sizeof(DWORD)) )
|
|
|
|
{
|
|
|
|
FIXME( "Size exceeded. Request of 0x%08lx\n", size );
|
|
|
|
size = dwBlockSize - sizeof(DWORD);
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2000-07-10 15:19:28 +02:00
|
|
|
|
|
|
|
/* Find blank area */
|
2002-06-01 01:06:46 +02:00
|
|
|
uBlockUsed = 0;
|
|
|
|
while( ( lpMemArea[ uBlockUsed ].used != 0 ) && ( uBlockUsed <= dwMaxBlock ) ) { uBlockUsed++; }
|
2000-07-10 15:19:28 +02:00
|
|
|
|
|
|
|
if( uBlockUsed <= dwMaxBlock )
|
|
|
|
{
|
|
|
|
/* Set the area used */
|
|
|
|
lpMemArea[ uBlockUsed ].used = 1;
|
|
|
|
lpvArea = &(lpMemArea[ uBlockUsed ].data);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR( "No free block found\n" );
|
|
|
|
return NULL;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
if( flags & HEAP_ZERO_MEMORY )
|
|
|
|
{
|
|
|
|
ZeroMemory( lpvArea, size );
|
|
|
|
}
|
|
|
|
|
|
|
|
return lpvArea;
|
|
|
|
}
|
|
|
|
|
|
|
|
LPSTR DPLAYX_strdupA( DWORD flags, LPCSTR str );
|
|
|
|
LPSTR DPLAYX_strdupA( DWORD flags, LPCSTR str )
|
|
|
|
{
|
|
|
|
LPSTR p = DPLAYX_PrivHeapAlloc( flags, strlen(str) + 1 );
|
|
|
|
if(p) {
|
|
|
|
strcpy( p, str );
|
|
|
|
}
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
LPWSTR DPLAYX_strdupW( DWORD flags, LPCWSTR str );
|
|
|
|
LPWSTR DPLAYX_strdupW( DWORD flags, LPCWSTR str )
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
2000-08-14 16:41:19 +02:00
|
|
|
INT len = strlenW(str) + 1;
|
2000-07-10 15:19:28 +02:00
|
|
|
LPWSTR p = DPLAYX_PrivHeapAlloc( flags, len * sizeof(WCHAR) );
|
|
|
|
if(p) {
|
2000-08-14 16:41:19 +02:00
|
|
|
strcpyW( p, str );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-27 00:26:30 +02:00
|
|
|
enum { numSupportedLobbies = 32, numSupportedSessions = 32 };
|
2000-07-10 15:19:28 +02:00
|
|
|
typedef struct tagDPLAYX_LOBBYDATA
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Points to lpConn + block of contiguous extra memory for dynamic parts
|
2002-06-01 01:06:46 +02:00
|
|
|
* of the struct directly following
|
2000-07-10 15:19:28 +02:00
|
|
|
*/
|
|
|
|
LPDPLCONNECTION lpConn;
|
2000-05-27 00:26:30 +02:00
|
|
|
|
|
|
|
/* Information for dplobby interfaces */
|
1999-11-04 03:17:03 +01:00
|
|
|
DWORD dwAppID;
|
1999-11-25 23:04:53 +01:00
|
|
|
DWORD dwAppLaunchedFromID;
|
2000-05-27 00:26:30 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Should this lobby app send messages to creator at important life
|
|
|
|
* stages
|
|
|
|
*/
|
2000-08-25 23:58:05 +02:00
|
|
|
HANDLE hInformOnAppStart;
|
|
|
|
HANDLE hInformOnAppDeath;
|
|
|
|
HANDLE hInformOnSettingRead;
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Sundries */
|
2000-07-10 15:19:28 +02:00
|
|
|
BOOL bWaitForConnectionSettings;
|
2000-08-25 23:58:05 +02:00
|
|
|
DWORD dwLobbyMsgThreadId;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
|
|
|
|
} DPLAYX_LOBBYDATA, *LPDPLAYX_LOBBYDATA;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
static DPLAYX_LOBBYDATA* lobbyData = NULL;
|
|
|
|
/* static DPLAYX_LOBBYDATA lobbyData[ numSupportedLobbies ]; */
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
static DPSESSIONDESC2* sessionData = NULL;
|
2000-07-10 15:19:28 +02:00
|
|
|
/* static DPSESSIONDESC2* sessionData[ numSupportedSessions ]; */
|
2000-05-27 00:26:30 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
/* Function prototypes */
|
2000-07-10 15:19:28 +02:00
|
|
|
DWORD DPLAYX_SizeOfLobbyDataA( LPDPLCONNECTION lpDplData );
|
|
|
|
DWORD DPLAYX_SizeOfLobbyDataW( LPDPLCONNECTION lpDplData );
|
|
|
|
void DPLAYX_CopyConnStructA( LPDPLCONNECTION dest, LPDPLCONNECTION src );
|
|
|
|
void DPLAYX_CopyConnStructW( LPDPLCONNECTION dest, LPDPLCONNECTION src );
|
|
|
|
BOOL DPLAYX_IsAppIdLobbied( DWORD dwAppId, LPDPLAYX_LOBBYDATA* dplData );
|
|
|
|
void DPLAYX_InitializeLobbyDataEntry( LPDPLAYX_LOBBYDATA lpData );
|
2000-05-27 00:26:30 +02:00
|
|
|
BOOL DPLAYX_CopyIntoSessionDesc2A( LPDPSESSIONDESC2 lpSessionDest,
|
|
|
|
LPCDPSESSIONDESC2 lpSessionSrc );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* Called to initialize the global data. This will only be used on the
|
|
|
|
* loading of the dll
|
|
|
|
***************************************************************************/
|
2000-07-10 15:19:28 +02:00
|
|
|
BOOL DPLAYX_ConstructData(void)
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
SECURITY_ATTRIBUTES s_attrib;
|
|
|
|
BOOL bInitializeSharedMemory = FALSE;
|
|
|
|
LPVOID lpDesiredMemoryMapStart = (LPVOID)0x50000000;
|
2000-08-25 23:58:05 +02:00
|
|
|
HANDLE hInformOnStart;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
TRACE( "DPLAYX dll loaded - construct called\n" );
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Create a semaphore to block access to DPLAYX global data structs */
|
|
|
|
|
|
|
|
s_attrib.bInheritHandle = TRUE;
|
|
|
|
s_attrib.lpSecurityDescriptor = NULL;
|
|
|
|
s_attrib.nLength = sizeof(s_attrib);
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
hDplayxSema = CreateSemaphoreA( &s_attrib, 1, 1, lpszDplayxSemaName );
|
2000-07-10 15:19:28 +02:00
|
|
|
|
|
|
|
/* First instance creates the semaphore. Others just use it */
|
|
|
|
if( GetLastError() == ERROR_SUCCESS )
|
|
|
|
{
|
2002-10-24 00:20:46 +02:00
|
|
|
TRACE( "Semaphore %p created\n", hDplayxSema );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* The semaphore creator will also build the shared memory */
|
|
|
|
bInitializeSharedMemory = TRUE;
|
|
|
|
}
|
|
|
|
else if ( GetLastError() == ERROR_ALREADY_EXISTS )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2002-10-24 00:20:46 +02:00
|
|
|
TRACE( "Found semaphore handle %p\n", hDplayxSema );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-11-19 03:30:01 +01:00
|
|
|
ERR( ": semaphore error %ld\n", GetLastError() );
|
2000-07-10 15:19:28 +02:00
|
|
|
return FALSE;
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
SetLastError( ERROR_SUCCESS );
|
|
|
|
|
|
|
|
DPLAYX_AquireSemaphore();
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
hDplayxSharedMem = CreateFileMappingA( INVALID_HANDLE_VALUE,
|
|
|
|
&s_attrib,
|
|
|
|
PAGE_READWRITE | SEC_COMMIT,
|
2002-06-01 01:06:46 +02:00
|
|
|
0,
|
2000-07-10 15:19:28 +02:00
|
|
|
dwTotalSharedSize,
|
2002-06-01 01:06:46 +02:00
|
|
|
lpszDplayxFileMapping );
|
2000-07-10 15:19:28 +02:00
|
|
|
|
|
|
|
if( GetLastError() == ERROR_SUCCESS )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2002-10-24 00:20:46 +02:00
|
|
|
TRACE( "File mapped %p created\n", hDplayxSharedMem );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
else if ( GetLastError() == ERROR_ALREADY_EXISTS )
|
|
|
|
{
|
2002-10-24 00:20:46 +02:00
|
|
|
TRACE( "Found FileMapping handle %p\n", hDplayxSharedMem );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-11-19 03:30:01 +01:00
|
|
|
ERR( ": unable to create shared memory (%ld)\n", GetLastError() );
|
2000-07-10 15:19:28 +02:00
|
|
|
return FALSE;
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
lpSharedStaticData = MapViewOfFileEx( hDplayxSharedMem,
|
|
|
|
FILE_MAP_WRITE,
|
2000-07-10 15:19:28 +02:00
|
|
|
0, 0, 0, lpDesiredMemoryMapStart );
|
|
|
|
|
|
|
|
if( lpSharedStaticData == NULL )
|
2000-05-27 00:26:30 +02:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
ERR( ": unable to map static data into process memory space (%ld)\n",
|
2000-07-10 15:19:28 +02:00
|
|
|
GetLastError() );
|
|
|
|
return FALSE;
|
2000-05-27 00:26:30 +02:00
|
|
|
}
|
2000-07-10 15:19:28 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if( lpDesiredMemoryMapStart == lpSharedStaticData )
|
|
|
|
{
|
|
|
|
TRACE( "File mapped to %p\n", lpSharedStaticData );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Presently the shared data structures use pointers. If the
|
|
|
|
* files are no mapped into the same area, the pointers will no
|
|
|
|
* longer make any sense :(
|
|
|
|
* FIXME: In the future make the shared data structures have some
|
|
|
|
* sort of fixup to make them independent between data spaces.
|
|
|
|
* This will also require a rework of the session data stuff.
|
|
|
|
*/
|
|
|
|
ERR( "File mapped to %p (not %p). Expect failure\n",
|
|
|
|
lpSharedStaticData, lpDesiredMemoryMapStart );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Dynamic area starts just after the static area */
|
|
|
|
lpMemArea = (LPVOID)((BYTE*)lpSharedStaticData + dwStaticSharedSize);
|
|
|
|
|
|
|
|
/* FIXME: Crude hack */
|
|
|
|
lobbyData = (DPLAYX_LOBBYDATA*)lpSharedStaticData;
|
|
|
|
sessionData = (DPSESSIONDESC2*)((BYTE*)lpSharedStaticData + (dwStaticSharedSize/2));
|
|
|
|
|
|
|
|
/* Initialize shared data segments. */
|
|
|
|
if( bInitializeSharedMemory )
|
|
|
|
{
|
|
|
|
UINT i;
|
2000-05-27 00:26:30 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
TRACE( "Initializing shared memory\n" );
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* Set all lobbies to be "empty" */
|
2000-07-10 15:19:28 +02:00
|
|
|
for( i=0; i < numSupportedLobbies; i++ )
|
|
|
|
{
|
|
|
|
DPLAYX_InitializeLobbyDataEntry( &lobbyData[ i ] );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set all sessions to be "empty" */
|
|
|
|
for( i=0; i < numSupportedSessions; i++ )
|
|
|
|
{
|
|
|
|
sessionData[i].dwSize = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Zero out the dynmaic area */
|
|
|
|
ZeroMemory( lpMemArea, dwDynamicSharedSize );
|
|
|
|
|
|
|
|
/* Just for fun sync the whole data area */
|
|
|
|
FlushViewOfFile( lpSharedStaticData, dwTotalSharedSize );
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Everything was created correctly. Signal the lobby client that
|
|
|
|
* we started up correctly
|
|
|
|
*/
|
|
|
|
if( DPLAYX_GetThisLobbyHandles( &hInformOnStart, NULL, NULL, FALSE ) &&
|
2002-06-01 01:06:46 +02:00
|
|
|
hInformOnStart
|
2000-08-25 23:58:05 +02:00
|
|
|
)
|
|
|
|
{
|
|
|
|
BOOL bSuccess;
|
|
|
|
bSuccess = SetEvent( hInformOnStart );
|
2002-10-24 00:20:46 +02:00
|
|
|
TRACE( "Signalling lobby app start event %p %s\n",
|
2000-08-25 23:58:05 +02:00
|
|
|
hInformOnStart, bSuccess ? "succeed" : "failed" );
|
|
|
|
|
|
|
|
/* Close out handle */
|
|
|
|
DPLAYX_GetThisLobbyHandles( &hInformOnStart, NULL, NULL, TRUE );
|
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
return TRUE;
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* Called to destroy all global data. This will only be used on the
|
|
|
|
* unloading of the dll
|
|
|
|
***************************************************************************/
|
2000-07-10 15:19:28 +02:00
|
|
|
BOOL DPLAYX_DestructData(void)
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
HANDLE hInformOnDeath;
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
TRACE( "DPLAYX dll unloaded - destruct called\n" );
|
1999-11-25 23:04:53 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* If required, inform that this app is dying */
|
|
|
|
if( DPLAYX_GetThisLobbyHandles( NULL, &hInformOnDeath, NULL, FALSE ) &&
|
2002-06-01 01:06:46 +02:00
|
|
|
hInformOnDeath
|
2000-08-25 23:58:05 +02:00
|
|
|
)
|
|
|
|
{
|
|
|
|
BOOL bSuccess;
|
|
|
|
bSuccess = SetEvent( hInformOnDeath );
|
2002-10-24 00:20:46 +02:00
|
|
|
TRACE( "Signalling lobby app death event %p %s\n",
|
2000-08-25 23:58:05 +02:00
|
|
|
hInformOnDeath, bSuccess ? "succeed" : "failed" );
|
|
|
|
|
|
|
|
/* Close out handle */
|
|
|
|
DPLAYX_GetThisLobbyHandles( NULL, &hInformOnDeath, NULL, TRUE );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DO CLEAN UP (LAST) */
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Delete the semaphore */
|
1999-11-25 23:04:53 +01:00
|
|
|
CloseHandle( hDplayxSema );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Delete shared memory file mapping */
|
|
|
|
UnmapViewOfFile( lpSharedStaticData );
|
|
|
|
CloseHandle( hDplayxSharedMem );
|
|
|
|
|
|
|
|
return FALSE;
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
void DPLAYX_InitializeLobbyDataEntry( LPDPLAYX_LOBBYDATA lpData )
|
1999-11-25 23:04:53 +01:00
|
|
|
{
|
|
|
|
ZeroMemory( lpData, sizeof( *lpData ) );
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* NOTE: This must be called with the semaphore aquired.
|
1999-11-25 23:04:53 +01:00
|
|
|
* TRUE/FALSE with a pointer to it's data returned. Pointer data is
|
|
|
|
* is only valid if TRUE is returned.
|
1999-11-04 03:17:03 +01:00
|
|
|
*/
|
2000-07-10 15:19:28 +02:00
|
|
|
BOOL DPLAYX_IsAppIdLobbied( DWORD dwAppID, LPDPLAYX_LOBBYDATA* lplpDplData )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
UINT i;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
*lplpDplData = NULL;
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
if( dwAppID == 0 )
|
|
|
|
{
|
|
|
|
dwAppID = GetCurrentProcessId();
|
1999-11-25 23:04:53 +01:00
|
|
|
TRACE( "Translated dwAppID == 0 into 0x%08lx\n", dwAppID );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for( i=0; i < numSupportedLobbies; i++ )
|
|
|
|
{
|
|
|
|
if( lobbyData[ i ].dwAppID == dwAppID )
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
/* This process is lobbied */
|
2000-07-10 15:19:28 +02:00
|
|
|
TRACE( "Found 0x%08lx @ %u\n", dwAppID, i );
|
1999-11-04 03:17:03 +01:00
|
|
|
*lplpDplData = &lobbyData[ i ];
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
/* Reserve a spot for the new appliction. TRUE means success and FALSE failure. */
|
2000-08-25 23:58:05 +02:00
|
|
|
BOOL DPLAYX_CreateLobbyApplication( DWORD dwAppID )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
1999-11-25 23:04:53 +01:00
|
|
|
UINT i;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
/* 0 is the marker for unused application data slots */
|
|
|
|
if( dwAppID == 0 )
|
|
|
|
{
|
|
|
|
return FALSE;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
DPLAYX_AquireSemaphore();
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
/* Find an empty space in the list and insert the data */
|
|
|
|
for( i=0; i < numSupportedLobbies; i++ )
|
|
|
|
{
|
|
|
|
if( lobbyData[ i ].dwAppID == 0 )
|
|
|
|
{
|
|
|
|
/* This process is now lobbied */
|
2000-08-25 23:58:05 +02:00
|
|
|
TRACE( "Setting lobbyData[%u] for (0x%08lx,0x%08lx)\n",
|
|
|
|
i, dwAppID, GetCurrentProcessId() );
|
2000-07-10 15:19:28 +02:00
|
|
|
|
|
|
|
lobbyData[ i ].dwAppID = dwAppID;
|
|
|
|
lobbyData[ i ].dwAppLaunchedFromID = GetCurrentProcessId();
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* FIXME: Where is the best place for this? In interface or here? */
|
2002-06-01 01:06:46 +02:00
|
|
|
lobbyData[ i ].hInformOnAppStart = 0;
|
2000-08-25 23:58:05 +02:00
|
|
|
lobbyData[ i ].hInformOnAppDeath = 0;
|
|
|
|
lobbyData[ i ].hInformOnSettingRead = 0;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
ERR( "No empty lobbies\n" );
|
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
return FALSE;
|
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
/* I'm not sure when I'm going to need this, but here it is */
|
2002-06-01 01:06:46 +02:00
|
|
|
BOOL DPLAYX_DestroyLobbyApplication( DWORD dwAppID )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
1999-11-25 23:04:53 +01:00
|
|
|
UINT i;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
DPLAYX_AquireSemaphore();
|
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
/* Find an empty space in the list and insert the data */
|
1999-11-04 03:17:03 +01:00
|
|
|
for( i=0; i < numSupportedLobbies; i++ )
|
|
|
|
{
|
1999-11-25 23:04:53 +01:00
|
|
|
if( lobbyData[ i ].dwAppID == dwAppID )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
/* FIXME: Should free up anything unused. Tisk tisk :0 */
|
1999-11-25 23:04:53 +01:00
|
|
|
/* Mark this entry unused */
|
2000-07-10 15:19:28 +02:00
|
|
|
TRACE( "Marking lobbyData[%u] unused\n", i );
|
1999-11-25 23:04:53 +01:00
|
|
|
DPLAYX_InitializeLobbyDataEntry( &lobbyData[ i ] );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
1999-11-25 23:04:53 +01:00
|
|
|
ERR( "Unable to find global entry for application\n" );
|
1999-11-04 03:17:03 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
BOOL DPLAYX_SetLobbyHandles( DWORD dwAppID,
|
|
|
|
HANDLE hStart, HANDLE hDeath, HANDLE hConnRead )
|
|
|
|
{
|
|
|
|
LPDPLAYX_LOBBYDATA lpLData;
|
|
|
|
|
|
|
|
/* Need to explictly give lobby application. Can't set for yourself */
|
|
|
|
if( dwAppID == 0 )
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
DPLAYX_AquireSemaphore();
|
|
|
|
|
|
|
|
if( !DPLAYX_IsAppIdLobbied( dwAppID, &lpLData ) )
|
|
|
|
{
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
lpLData->hInformOnAppStart = hStart;
|
|
|
|
lpLData->hInformOnAppDeath = hDeath;
|
|
|
|
lpLData->hInformOnSettingRead = hConnRead;
|
|
|
|
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
BOOL DPLAYX_GetThisLobbyHandles( LPHANDLE lphStart,
|
2000-08-25 23:58:05 +02:00
|
|
|
LPHANDLE lphDeath,
|
|
|
|
LPHANDLE lphConnRead,
|
|
|
|
BOOL bClearSetHandles )
|
|
|
|
{
|
|
|
|
LPDPLAYX_LOBBYDATA lpLData;
|
|
|
|
|
|
|
|
DPLAYX_AquireSemaphore();
|
|
|
|
|
|
|
|
if( !DPLAYX_IsAppIdLobbied( 0, &lpLData ) )
|
|
|
|
{
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( lphStart != NULL )
|
|
|
|
{
|
|
|
|
if( lpLData->hInformOnAppStart == 0 )
|
|
|
|
{
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
2002-06-01 01:06:46 +02:00
|
|
|
return FALSE;
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
*lphStart = lpLData->hInformOnAppStart;
|
|
|
|
|
|
|
|
if( bClearSetHandles )
|
|
|
|
{
|
|
|
|
CloseHandle( lpLData->hInformOnAppStart );
|
|
|
|
lpLData->hInformOnAppStart = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( lphDeath != NULL )
|
|
|
|
{
|
|
|
|
if( lpLData->hInformOnAppDeath == 0 )
|
|
|
|
{
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*lphDeath = lpLData->hInformOnAppDeath;
|
|
|
|
|
|
|
|
if( bClearSetHandles )
|
|
|
|
{
|
|
|
|
CloseHandle( lpLData->hInformOnAppDeath );
|
|
|
|
lpLData->hInformOnAppDeath = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( lphConnRead != NULL )
|
|
|
|
{
|
|
|
|
if( lpLData->hInformOnSettingRead == 0 )
|
|
|
|
{
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*lphConnRead = lpLData->hInformOnSettingRead;
|
|
|
|
|
|
|
|
if( bClearSetHandles )
|
|
|
|
{
|
|
|
|
CloseHandle( lpLData->hInformOnSettingRead );
|
|
|
|
lpLData->hInformOnSettingRead = 0;
|
|
|
|
}
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
HRESULT DPLAYX_GetConnectionSettingsA
|
|
|
|
( DWORD dwAppID,
|
|
|
|
LPVOID lpData,
|
2000-08-25 23:58:05 +02:00
|
|
|
LPDWORD lpdwDataSize )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
LPDPLAYX_LOBBYDATA lpDplData;
|
|
|
|
DWORD dwRequiredDataSize = 0;
|
2000-08-25 23:58:05 +02:00
|
|
|
HANDLE hInformOnSettingRead;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
DPLAYX_AquireSemaphore();
|
|
|
|
|
|
|
|
if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
|
|
|
|
{
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
2000-05-23 03:16:36 +02:00
|
|
|
|
|
|
|
TRACE( "Application 0x%08lx is not lobbied\n", dwAppID );
|
1999-11-25 23:04:53 +01:00
|
|
|
return DPERR_NOTLOBBIED;
|
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
dwRequiredDataSize = DPLAYX_SizeOfLobbyDataA( lpDplData->lpConn );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Do they want to know the required buffer size or is the provided buffer
|
2002-06-01 01:06:46 +02:00
|
|
|
* big enough?
|
2000-07-10 15:19:28 +02:00
|
|
|
*/
|
|
|
|
if ( ( lpData == NULL ) ||
|
|
|
|
( *lpdwDataSize < dwRequiredDataSize )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
*lpdwDataSize = DPLAYX_SizeOfLobbyDataA( lpDplData->lpConn );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
return DPERR_BUFFERTOOSMALL;
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
DPLAYX_CopyConnStructA( (LPDPLCONNECTION)lpData, lpDplData->lpConn );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
DPLAYX_ReleaseSemaphore();
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* They have gotten the information - signal the event if required */
|
|
|
|
if( DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, FALSE ) &&
|
2002-06-01 01:06:46 +02:00
|
|
|
hInformOnSettingRead
|
2000-08-25 23:58:05 +02:00
|
|
|
)
|
|
|
|
{
|
|
|
|
BOOL bSuccess;
|
|
|
|
bSuccess = SetEvent( hInformOnSettingRead );
|
2002-10-24 00:20:46 +02:00
|
|
|
TRACE( "Signalling setting read event %p %s\n",
|
2000-08-25 23:58:05 +02:00
|
|
|
hInformOnSettingRead, bSuccess ? "succeed" : "failed" );
|
|
|
|
|
|
|
|
/* Close out handle */
|
|
|
|
DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, TRUE );
|
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Assumption: Enough contiguous space was allocated at dest */
|
|
|
|
void DPLAYX_CopyConnStructA( LPDPLCONNECTION dest, LPDPLCONNECTION src )
|
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
BYTE* lpStartOfFreeSpace;
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( dest, src, sizeof( DPLCONNECTION ) );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
lpStartOfFreeSpace = ((BYTE*)dest) + sizeof( DPLCONNECTION );
|
|
|
|
|
|
|
|
/* Copy the LPDPSESSIONDESC2 structure if it exists */
|
|
|
|
if( src->lpSessionDesc )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
dest->lpSessionDesc = (LPDPSESSIONDESC2)lpStartOfFreeSpace;
|
|
|
|
lpStartOfFreeSpace += sizeof( DPSESSIONDESC2 );
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( dest->lpSessionDesc, src->lpSessionDesc, sizeof( DPSESSIONDESC2 ) );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Session names may or may not exist */
|
2000-12-03 04:16:05 +01:00
|
|
|
if( src->lpSessionDesc->u1.lpszSessionNameA )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
strcpy( (LPSTR)lpStartOfFreeSpace, src->lpSessionDesc->u1.lpszSessionNameA );
|
|
|
|
dest->lpSessionDesc->u1.lpszSessionNameA = (LPSTR)lpStartOfFreeSpace;
|
2002-06-01 01:06:46 +02:00
|
|
|
lpStartOfFreeSpace +=
|
2000-12-03 04:16:05 +01:00
|
|
|
strlen( (LPSTR)dest->lpSessionDesc->u1.lpszSessionNameA ) + 1;
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( src->lpSessionDesc->u2.lpszPasswordA )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
strcpy( (LPSTR)lpStartOfFreeSpace, src->lpSessionDesc->u2.lpszPasswordA );
|
|
|
|
dest->lpSessionDesc->u2.lpszPasswordA = (LPSTR)lpStartOfFreeSpace;
|
2002-06-01 01:06:46 +02:00
|
|
|
lpStartOfFreeSpace +=
|
2000-12-03 04:16:05 +01:00
|
|
|
strlen( (LPSTR)dest->lpSessionDesc->u2.lpszPasswordA ) + 1;
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* DPNAME structure is optional */
|
|
|
|
if( src->lpPlayerName )
|
|
|
|
{
|
|
|
|
dest->lpPlayerName = (LPDPNAME)lpStartOfFreeSpace;
|
|
|
|
lpStartOfFreeSpace += sizeof( DPNAME );
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( dest->lpPlayerName, src->lpPlayerName, sizeof( DPNAME ) );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( src->lpPlayerName->u1.lpszShortNameA )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
strcpy( (LPSTR)lpStartOfFreeSpace, src->lpPlayerName->u1.lpszShortNameA );
|
|
|
|
dest->lpPlayerName->u1.lpszShortNameA = (LPSTR)lpStartOfFreeSpace;
|
2002-06-01 01:06:46 +02:00
|
|
|
lpStartOfFreeSpace +=
|
2000-12-03 04:16:05 +01:00
|
|
|
strlen( (LPSTR)dest->lpPlayerName->u1.lpszShortNameA ) + 1;
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( src->lpPlayerName->u2.lpszLongNameA )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
strcpy( (LPSTR)lpStartOfFreeSpace, src->lpPlayerName->u2.lpszLongNameA );
|
|
|
|
dest->lpPlayerName->u2.lpszLongNameA = (LPSTR)lpStartOfFreeSpace;
|
2002-06-01 01:06:46 +02:00
|
|
|
lpStartOfFreeSpace +=
|
2000-12-03 04:16:05 +01:00
|
|
|
strlen( (LPSTR)dest->lpPlayerName->u2.lpszLongName ) + 1 ;
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy address if it exists */
|
|
|
|
if( src->lpAddress )
|
|
|
|
{
|
|
|
|
dest->lpAddress = (LPVOID)lpStartOfFreeSpace;
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( lpStartOfFreeSpace, src->lpAddress, src->dwAddressSize );
|
2000-07-10 15:19:28 +02:00
|
|
|
/* No need to advance lpStartOfFreeSpace as there is no more "dynamic" data */
|
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT DPLAYX_GetConnectionSettingsW
|
|
|
|
( DWORD dwAppID,
|
|
|
|
LPVOID lpData,
|
2000-08-25 23:58:05 +02:00
|
|
|
LPDWORD lpdwDataSize )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
LPDPLAYX_LOBBYDATA lpDplData;
|
|
|
|
DWORD dwRequiredDataSize = 0;
|
2000-08-25 23:58:05 +02:00
|
|
|
HANDLE hInformOnSettingRead;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
DPLAYX_AquireSemaphore();
|
|
|
|
|
|
|
|
if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
|
|
|
|
{
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
return DPERR_NOTLOBBIED;
|
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
dwRequiredDataSize = DPLAYX_SizeOfLobbyDataW( lpDplData->lpConn );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Do they want to know the required buffer size or is the provided buffer
|
2002-06-01 01:06:46 +02:00
|
|
|
* big enough?
|
2000-07-10 15:19:28 +02:00
|
|
|
*/
|
|
|
|
if ( ( lpData == NULL ) ||
|
|
|
|
( *lpdwDataSize < dwRequiredDataSize )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
*lpdwDataSize = DPLAYX_SizeOfLobbyDataW( lpDplData->lpConn );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
return DPERR_BUFFERTOOSMALL;
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
DPLAYX_CopyConnStructW( (LPDPLCONNECTION)lpData, lpDplData->lpConn );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
DPLAYX_ReleaseSemaphore();
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* They have gotten the information - signal the event if required */
|
|
|
|
if( DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, FALSE ) &&
|
2002-06-01 01:06:46 +02:00
|
|
|
hInformOnSettingRead
|
2000-08-25 23:58:05 +02:00
|
|
|
)
|
|
|
|
{
|
|
|
|
BOOL bSuccess;
|
|
|
|
bSuccess = SetEvent( hInformOnSettingRead );
|
2002-10-24 00:20:46 +02:00
|
|
|
TRACE( "Signalling setting read event %p %s\n",
|
2000-08-25 23:58:05 +02:00
|
|
|
hInformOnSettingRead, bSuccess ? "succeed" : "failed" );
|
|
|
|
|
|
|
|
/* Close out handle */
|
|
|
|
DPLAYX_GetThisLobbyHandles( NULL, NULL, &hInformOnSettingRead, TRUE );
|
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Assumption: Enough contiguous space was allocated at dest */
|
|
|
|
void DPLAYX_CopyConnStructW( LPDPLCONNECTION dest, LPDPLCONNECTION src )
|
|
|
|
{
|
|
|
|
BYTE* lpStartOfFreeSpace;
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( dest, src, sizeof( DPLCONNECTION ) );
|
2000-07-10 15:19:28 +02:00
|
|
|
|
|
|
|
lpStartOfFreeSpace = ( (BYTE*)dest) + sizeof( DPLCONNECTION );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Copy the LPDPSESSIONDESC2 structure if it exists */
|
|
|
|
if( src->lpSessionDesc )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
dest->lpSessionDesc = (LPDPSESSIONDESC2)lpStartOfFreeSpace;
|
|
|
|
lpStartOfFreeSpace += sizeof( DPSESSIONDESC2 );
|
2002-06-01 01:06:46 +02:00
|
|
|
CopyMemory( dest->lpSessionDesc, src->lpSessionDesc, sizeof( DPSESSIONDESC2 ) );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Session names may or may not exist */
|
2000-12-03 04:16:05 +01:00
|
|
|
if( src->lpSessionDesc->u1.lpszSessionName )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
strcpyW( (LPWSTR)lpStartOfFreeSpace, dest->lpSessionDesc->u1.lpszSessionName );
|
|
|
|
src->lpSessionDesc->u1.lpszSessionName = (LPWSTR)lpStartOfFreeSpace;
|
2000-07-10 15:19:28 +02:00
|
|
|
lpStartOfFreeSpace += sizeof(WCHAR) *
|
2000-12-03 04:16:05 +01:00
|
|
|
( strlenW( (LPWSTR)dest->lpSessionDesc->u1.lpszSessionName ) + 1 );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( src->lpSessionDesc->u2.lpszPassword )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
strcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpSessionDesc->u2.lpszPassword );
|
|
|
|
dest->lpSessionDesc->u2.lpszPassword = (LPWSTR)lpStartOfFreeSpace;
|
2000-07-10 15:19:28 +02:00
|
|
|
lpStartOfFreeSpace += sizeof(WCHAR) *
|
2000-12-03 04:16:05 +01:00
|
|
|
( strlenW( (LPWSTR)dest->lpSessionDesc->u2.lpszPassword ) + 1 );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* DPNAME structure is optional */
|
|
|
|
if( src->lpPlayerName )
|
|
|
|
{
|
|
|
|
dest->lpPlayerName = (LPDPNAME)lpStartOfFreeSpace;
|
|
|
|
lpStartOfFreeSpace += sizeof( DPNAME );
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( dest->lpPlayerName, src->lpPlayerName, sizeof( DPNAME ) );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( src->lpPlayerName->u1.lpszShortName )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
strcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpPlayerName->u1.lpszShortName );
|
|
|
|
dest->lpPlayerName->u1.lpszShortName = (LPWSTR)lpStartOfFreeSpace;
|
2000-07-10 15:19:28 +02:00
|
|
|
lpStartOfFreeSpace += sizeof(WCHAR) *
|
2000-12-03 04:16:05 +01:00
|
|
|
( strlenW( (LPWSTR)dest->lpPlayerName->u1.lpszShortName ) + 1 );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( src->lpPlayerName->u2.lpszLongName )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
strcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpPlayerName->u2.lpszLongName );
|
|
|
|
dest->lpPlayerName->u2.lpszLongName = (LPWSTR)lpStartOfFreeSpace;
|
2000-07-10 15:19:28 +02:00
|
|
|
lpStartOfFreeSpace += sizeof(WCHAR) *
|
2000-12-03 04:16:05 +01:00
|
|
|
( strlenW( (LPWSTR)dest->lpPlayerName->u2.lpszLongName ) + 1 );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Copy address if it exists */
|
|
|
|
if( src->lpAddress )
|
|
|
|
{
|
|
|
|
dest->lpAddress = (LPVOID)lpStartOfFreeSpace;
|
2002-06-01 01:06:46 +02:00
|
|
|
CopyMemory( lpStartOfFreeSpace, src->lpAddress, src->dwAddressSize );
|
2000-07-10 15:19:28 +02:00
|
|
|
/* No need to advance lpStartOfFreeSpace as there is no more "dynamic" data */
|
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Store the structure into the shared data structre. Ensure that allocs for
|
|
|
|
* variable length strings come from the shared data structure.
|
2002-06-01 01:06:46 +02:00
|
|
|
* FIXME: We need to free information as well
|
2000-07-10 15:19:28 +02:00
|
|
|
*/
|
1999-11-04 03:17:03 +01:00
|
|
|
HRESULT DPLAYX_SetConnectionSettingsA
|
|
|
|
( DWORD dwFlags,
|
|
|
|
DWORD dwAppID,
|
|
|
|
LPDPLCONNECTION lpConn )
|
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
LPDPLAYX_LOBBYDATA lpDplData;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2003-06-18 05:30:39 +02:00
|
|
|
/* Parameter check */
|
1999-11-25 23:04:53 +01:00
|
|
|
if( dwFlags || !lpConn )
|
|
|
|
{
|
|
|
|
ERR("invalid parameters.\n");
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
/* Store information */
|
|
|
|
if( lpConn->dwSize != sizeof(DPLCONNECTION) )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
1999-11-25 23:04:53 +01:00
|
|
|
ERR(": old/new DPLCONNECTION type? Size=%08lx vs. expected=%ul bytes\n",
|
|
|
|
lpConn->dwSize, sizeof( DPLCONNECTION ) );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
return DPERR_INVALIDPARAMS;
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
DPLAYX_AquireSemaphore();
|
|
|
|
|
|
|
|
if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
return DPERR_NOTLOBBIED;
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if( (!lpConn->lpSessionDesc ) ||
|
|
|
|
( lpConn->lpSessionDesc->dwSize != sizeof( DPSESSIONDESC2 ) )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
ERR("DPSESSIONDESC passed in? Size=%lu vs. expected=%u bytes\n",
|
1999-11-04 03:17:03 +01:00
|
|
|
lpConn->lpSessionDesc->dwSize, sizeof( DPSESSIONDESC2 ) );
|
|
|
|
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Free the existing memory */
|
|
|
|
DPLAYX_PrivHeapFree( lpDplData->lpConn );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
lpDplData->lpConn = DPLAYX_PrivHeapAlloc( HEAP_ZERO_MEMORY,
|
2000-07-10 15:19:28 +02:00
|
|
|
DPLAYX_SizeOfLobbyDataA( lpConn ) );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
DPLAYX_CopyConnStructA( lpDplData->lpConn, lpConn );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
DPLAYX_ReleaseSemaphore();
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
/* FIXME: Send a message - I think */
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Store the structure into the shared data structre. Ensure that allocs for
|
|
|
|
* variable length strings come from the shared data structure.
|
2002-06-01 01:06:46 +02:00
|
|
|
* FIXME: We need to free information as well
|
2000-07-10 15:19:28 +02:00
|
|
|
*/
|
1999-11-04 03:17:03 +01:00
|
|
|
HRESULT DPLAYX_SetConnectionSettingsW
|
|
|
|
( DWORD dwFlags,
|
|
|
|
DWORD dwAppID,
|
|
|
|
LPDPLCONNECTION lpConn )
|
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
LPDPLAYX_LOBBYDATA lpDplData;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2003-06-18 05:30:39 +02:00
|
|
|
/* Parameter check */
|
1999-11-04 03:17:03 +01:00
|
|
|
if( dwFlags || !lpConn )
|
|
|
|
{
|
|
|
|
ERR("invalid parameters.\n");
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Store information */
|
|
|
|
if( lpConn->dwSize != sizeof(DPLCONNECTION) )
|
|
|
|
{
|
1999-11-25 23:04:53 +01:00
|
|
|
ERR(": old/new DPLCONNECTION type? Size=%lu vs. expected=%u bytes\n",
|
1999-11-04 03:17:03 +01:00
|
|
|
lpConn->dwSize, sizeof( DPLCONNECTION ) );
|
|
|
|
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
DPLAYX_AquireSemaphore();
|
|
|
|
|
|
|
|
if ( ! DPLAYX_IsAppIdLobbied( dwAppID, &lpDplData ) )
|
|
|
|
{
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
2000-07-10 15:19:28 +02:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
return DPERR_NOTLOBBIED;
|
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Free the existing memory */
|
|
|
|
DPLAYX_PrivHeapFree( lpDplData->lpConn );
|
|
|
|
|
|
|
|
lpDplData->lpConn = DPLAYX_PrivHeapAlloc( HEAP_ZERO_MEMORY,
|
|
|
|
DPLAYX_SizeOfLobbyDataW( lpConn ) );
|
|
|
|
|
|
|
|
DPLAYX_CopyConnStructW( lpDplData->lpConn, lpConn );
|
|
|
|
|
|
|
|
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
|
|
|
|
/* FIXME: Send a message - I think */
|
|
|
|
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD DPLAYX_SizeOfLobbyDataA( LPDPLCONNECTION lpConn )
|
|
|
|
{
|
|
|
|
DWORD dwTotalSize = sizeof( DPLCONNECTION );
|
|
|
|
|
|
|
|
/* Just a safety check */
|
|
|
|
if( lpConn == NULL )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
ERR( "lpConn is NULL\n" );
|
|
|
|
return 0;
|
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
if( lpConn->lpSessionDesc != NULL )
|
|
|
|
{
|
|
|
|
dwTotalSize += sizeof( DPSESSIONDESC2 );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpConn->lpSessionDesc->u1.lpszSessionNameA )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
dwTotalSize += strlen( lpConn->lpSessionDesc->u1.lpszSessionNameA ) + 1;
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpConn->lpSessionDesc->u2.lpszPasswordA )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
dwTotalSize += strlen( lpConn->lpSessionDesc->u2.lpszPasswordA ) + 1;
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
if( lpConn->lpPlayerName != NULL )
|
|
|
|
{
|
|
|
|
dwTotalSize += sizeof( DPNAME );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpConn->lpPlayerName->u1.lpszShortNameA )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
dwTotalSize += strlen( lpConn->lpPlayerName->u1.lpszShortNameA ) + 1;
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpConn->lpPlayerName->u2.lpszLongNameA )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
dwTotalSize += strlen( lpConn->lpPlayerName->u2.lpszLongNameA ) + 1;
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
dwTotalSize += lpConn->dwAddressSize;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
return dwTotalSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD DPLAYX_SizeOfLobbyDataW( LPDPLCONNECTION lpConn )
|
|
|
|
{
|
|
|
|
DWORD dwTotalSize = sizeof( DPLCONNECTION );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Just a safety check */
|
|
|
|
if( lpConn == NULL )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
ERR( "lpConn is NULL\n" );
|
|
|
|
return 0;
|
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
if( lpConn->lpSessionDesc != NULL )
|
|
|
|
{
|
|
|
|
dwTotalSize += sizeof( DPSESSIONDESC2 );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpConn->lpSessionDesc->u1.lpszSessionName )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
|
|
|
dwTotalSize += sizeof( WCHAR ) *
|
2000-12-03 04:16:05 +01:00
|
|
|
( strlenW( lpConn->lpSessionDesc->u1.lpszSessionName ) + 1 );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpConn->lpSessionDesc->u2.lpszPassword )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
|
|
|
dwTotalSize += sizeof( WCHAR ) *
|
2000-12-03 04:16:05 +01:00
|
|
|
( strlenW( lpConn->lpSessionDesc->u2.lpszPassword ) + 1 );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
if( lpConn->lpPlayerName != NULL )
|
|
|
|
{
|
|
|
|
dwTotalSize += sizeof( DPNAME );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpConn->lpPlayerName->u1.lpszShortName )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
|
|
|
dwTotalSize += sizeof( WCHAR ) *
|
2000-12-03 04:16:05 +01:00
|
|
|
( strlenW( lpConn->lpPlayerName->u1.lpszShortName ) + 1 );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpConn->lpPlayerName->u2.lpszLongName )
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
|
|
|
dwTotalSize += sizeof( WCHAR ) *
|
2000-12-03 04:16:05 +01:00
|
|
|
( strlenW( lpConn->lpPlayerName->u2.lpszLongName ) + 1 );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
dwTotalSize += lpConn->dwAddressSize;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
return dwTotalSize;
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
1999-11-25 23:04:53 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
|
|
|
|
|
2000-05-27 00:26:30 +02:00
|
|
|
LPDPSESSIONDESC2 DPLAYX_CopyAndAllocateSessionDesc2A( LPCDPSESSIONDESC2 lpSessionSrc )
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
LPDPSESSIONDESC2 lpSessionDest =
|
|
|
|
(LPDPSESSIONDESC2)HeapAlloc( GetProcessHeap(),
|
2000-08-25 23:58:05 +02:00
|
|
|
HEAP_ZERO_MEMORY, sizeof( *lpSessionSrc ) );
|
2000-05-27 00:26:30 +02:00
|
|
|
DPLAYX_CopyIntoSessionDesc2A( lpSessionDest, lpSessionSrc );
|
|
|
|
|
|
|
|
return lpSessionDest;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy an ANSI session desc structure to the given buffer */
|
|
|
|
BOOL DPLAYX_CopyIntoSessionDesc2A( LPDPSESSIONDESC2 lpSessionDest,
|
|
|
|
LPCDPSESSIONDESC2 lpSessionSrc )
|
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( lpSessionDest, lpSessionSrc, sizeof( *lpSessionSrc ) );
|
2000-05-27 00:26:30 +02:00
|
|
|
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpSessionSrc->u1.lpszSessionNameA )
|
2000-05-27 00:26:30 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
if ((lpSessionDest->u1.lpszSessionNameA = HeapAlloc( GetProcessHeap(), 0,
|
|
|
|
strlen(lpSessionSrc->u1.lpszSessionNameA)+1 )))
|
|
|
|
strcpy( lpSessionDest->u1.lpszSessionNameA, lpSessionSrc->u1.lpszSessionNameA );
|
2000-05-27 00:26:30 +02:00
|
|
|
}
|
2000-12-03 04:16:05 +01:00
|
|
|
if( lpSessionSrc->u2.lpszPasswordA )
|
2000-05-27 00:26:30 +02:00
|
|
|
{
|
2000-12-03 04:16:05 +01:00
|
|
|
if ((lpSessionDest->u2.lpszPasswordA = HeapAlloc( GetProcessHeap(), 0,
|
|
|
|
strlen(lpSessionSrc->u2.lpszPasswordA)+1 )))
|
|
|
|
strcpy( lpSessionDest->u2.lpszPasswordA, lpSessionSrc->u2.lpszPasswordA );
|
2000-05-27 00:26:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Start the index at 0. index will be updated to equal that which should
|
|
|
|
be passed back into this function for the next element */
|
|
|
|
LPDPSESSIONDESC2 DPLAYX_CopyAndAllocateLocalSession( UINT* index )
|
|
|
|
{
|
|
|
|
for( ; (*index) < numSupportedSessions; (*index)++ )
|
|
|
|
{
|
|
|
|
if( sessionData[(*index)].dwSize != 0 )
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
return DPLAYX_CopyAndAllocateSessionDesc2A( &sessionData[(*index)++] );
|
2000-05-27 00:26:30 +02:00
|
|
|
}
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-05-27 00:26:30 +02:00
|
|
|
/* No more sessions */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Start the index at 0. index will be updated to equal that which should
|
|
|
|
be passed back into this function for the next element */
|
|
|
|
BOOL DPLAYX_CopyLocalSession( UINT* index, LPDPSESSIONDESC2 lpsd )
|
|
|
|
{
|
|
|
|
for( ; (*index) < numSupportedSessions; (*index)++ )
|
|
|
|
{
|
|
|
|
if( sessionData[(*index)].dwSize != 0 )
|
|
|
|
{
|
|
|
|
return DPLAYX_CopyIntoSessionDesc2A( lpsd, &sessionData[(*index)++] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No more sessions */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DPLAYX_SetLocalSession( LPCDPSESSIONDESC2 lpsd )
|
|
|
|
{
|
|
|
|
UINT i;
|
|
|
|
|
|
|
|
/* FIXME: Is this an error if it exists already? */
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-05-27 00:26:30 +02:00
|
|
|
/* Crude/wrong implementation for now. Just always add to first empty spot */
|
|
|
|
for( i=0; i < numSupportedSessions; i++ )
|
|
|
|
{
|
|
|
|
/* Is this one empty? */
|
|
|
|
if( sessionData[i].dwSize == 0 )
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
DPLAYX_CopyIntoSessionDesc2A( &sessionData[i], lpsd );
|
2000-05-27 00:26:30 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
BOOL DPLAYX_WaitForConnectionSettings( BOOL bWait )
|
|
|
|
{
|
|
|
|
LPDPLAYX_LOBBYDATA lpLobbyData;
|
|
|
|
|
|
|
|
DPLAYX_AquireSemaphore();
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
if( !DPLAYX_IsAppIdLobbied( 0, &lpLobbyData ) )
|
|
|
|
{
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
lpLobbyData->bWaitForConnectionSettings = bWait;
|
|
|
|
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL DPLAYX_AnyLobbiesWaitingForConnSettings(void)
|
|
|
|
{
|
|
|
|
UINT i;
|
|
|
|
BOOL bFound = FALSE;
|
|
|
|
|
|
|
|
DPLAYX_AquireSemaphore();
|
|
|
|
|
|
|
|
for( i=0; i < numSupportedLobbies; i++ )
|
|
|
|
{
|
|
|
|
if( ( lobbyData[ i ].dwAppID != 0 ) && /* lobby initialized */
|
|
|
|
( lobbyData[ i ].bWaitForConnectionSettings ) /* Waiting */
|
|
|
|
)
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
bFound = TRUE;
|
2002-06-01 01:06:46 +02:00
|
|
|
break;
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
|
|
|
|
return bFound;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
BOOL DPLAYX_SetLobbyMsgThreadId( DWORD dwAppId, DWORD dwThreadId )
|
|
|
|
{
|
|
|
|
LPDPLAYX_LOBBYDATA lpLobbyData;
|
|
|
|
|
|
|
|
DPLAYX_AquireSemaphore();
|
|
|
|
|
|
|
|
if( !DPLAYX_IsAppIdLobbied( dwAppId, &lpLobbyData ) )
|
|
|
|
{
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
lpLobbyData->dwLobbyMsgThreadId = dwThreadId;
|
|
|
|
|
|
|
|
DPLAYX_ReleaseSemaphore();
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* NOTE: This is potentially not thread safe. You are not guaranteed to end up
|
1999-11-25 23:04:53 +01:00
|
|
|
with the correct string printed in the case where the HRESULT is not
|
|
|
|
known. You'll just get the last hr passed in printed. This can change
|
|
|
|
over time if this method is used alot :) */
|
|
|
|
LPCSTR DPLAYX_HresultToString(HRESULT hr)
|
|
|
|
{
|
|
|
|
static char szTempStr[12];
|
|
|
|
|
|
|
|
switch (hr)
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
case DP_OK:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DP_OK";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_ALREADYINITIALIZED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_ALREADYINITIALIZED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_ACCESSDENIED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_ACCESSDENIED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_ACTIVEPLAYERS:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_ACTIVEPLAYERS";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_BUFFERTOOSMALL:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_BUFFERTOOSMALL";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_CANTADDPLAYER:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_CANTADDPLAYER";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_CANTCREATEGROUP:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_CANTCREATEGROUP";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_CANTCREATEPLAYER:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_CANTCREATEPLAYER";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_CANTCREATESESSION:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_CANTCREATESESSION";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_CAPSNOTAVAILABLEYET:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_CAPSNOTAVAILABLEYET";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_EXCEPTION:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_EXCEPTION";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_GENERIC:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_GENERIC";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_INVALIDFLAGS:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_INVALIDFLAGS";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_INVALIDOBJECT:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_INVALIDOBJECT";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_INVALIDPARAMS:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_INVALIDPARAMS";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_INVALIDPLAYER:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_INVALIDPLAYER";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_INVALIDGROUP:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_INVALIDGROUP";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_NOCAPS:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_NOCAPS";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_NOCONNECTION:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_NOCONNECTION";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_OUTOFMEMORY:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_OUTOFMEMORY";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_NOMESSAGES:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_NOMESSAGES";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_NONAMESERVERFOUND:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_NONAMESERVERFOUND";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_NOPLAYERS:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_NOPLAYERS";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_NOSESSIONS:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_NOSESSIONS";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_PENDING:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_PENDING";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_SENDTOOBIG:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_SENDTOOBIG";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_TIMEOUT:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_TIMEOUT";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_UNAVAILABLE:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_UNAVAILABLE";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_UNSUPPORTED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_UNSUPPORTED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_BUSY:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_BUSY";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_USERCANCEL:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_USERCANCEL";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_NOINTERFACE:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_NOINTERFACE";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_CANNOTCREATESERVER:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_CANNOTCREATESERVER";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_PLAYERLOST:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_PLAYERLOST";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_SESSIONLOST:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_SESSIONLOST";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_UNINITIALIZED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_UNINITIALIZED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_NONEWPLAYERS:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_NONEWPLAYERS";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_INVALIDPASSWORD:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_INVALIDPASSWORD";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_CONNECTING:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_CONNECTING";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_CONNECTIONLOST:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_CONNECTIONLOST";
|
|
|
|
case DPERR_UNKNOWNMESSAGE:
|
|
|
|
return "DPERR_UNKNOWNMESSAGE";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_CANCELFAILED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_CANCELFAILED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_INVALIDPRIORITY:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_INVALIDPRIORITY";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_NOTHANDLED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_NOTHANDLED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_CANCELLED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_CANCELLED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_ABORTED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_ABORTED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_BUFFERTOOLARGE:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_BUFFERTOOLARGE";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_CANTCREATEPROCESS:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_CANTCREATEPROCESS";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_APPNOTSTARTED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_APPNOTSTARTED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_INVALIDINTERFACE:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_INVALIDINTERFACE";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_NOSERVICEPROVIDER:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_NOSERVICEPROVIDER";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_UNKNOWNAPPLICATION:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_UNKNOWNAPPLICATION";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_NOTLOBBIED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_NOTLOBBIED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_SERVICEPROVIDERLOADED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_SERVICEPROVIDERLOADED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_ALREADYREGISTERED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_ALREADYREGISTERED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_NOTREGISTERED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_NOTREGISTERED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_AUTHENTICATIONFAILED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_AUTHENTICATIONFAILED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_CANTLOADSSPI:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_CANTLOADSSPI";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_ENCRYPTIONFAILED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_ENCRYPTIONFAILED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_SIGNFAILED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_SIGNFAILED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_CANTLOADSECURITYPACKAGE:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_CANTLOADSECURITYPACKAGE";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_ENCRYPTIONNOTSUPPORTED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_ENCRYPTIONNOTSUPPORTED";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_CANTLOADCAPI:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_CANTLOADCAPI";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_NOTLOGGEDIN:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_NOTLOGGEDIN";
|
2002-06-01 01:06:46 +02:00
|
|
|
case DPERR_LOGONDENIED:
|
1999-11-25 23:04:53 +01:00
|
|
|
return "DPERR_LOGONDENIED";
|
|
|
|
default:
|
|
|
|
/* For errors not in the list, return HRESULT as a string
|
|
|
|
This part is not thread safe */
|
|
|
|
WARN( "Unknown error 0x%08lx\n", hr );
|
2000-08-25 23:58:05 +02:00
|
|
|
wsprintfA( szTempStr, "0x%08lx", hr );
|
1999-11-25 23:04:53 +01:00
|
|
|
return szTempStr;
|
|
|
|
}
|
|
|
|
}
|