1999-09-28 18:35:32 +02:00
|
|
|
/* Direct Play Lobby 2 & 3 Implementation
|
|
|
|
*
|
2000-03-12 21:18:33 +01:00
|
|
|
* Copyright 1998,1999,2000 - Peter Hunnisett
|
1999-09-28 18:35:32 +02:00
|
|
|
*
|
|
|
|
* <presently under construction - contact hunnise@nortelnetworks.com>
|
|
|
|
*
|
|
|
|
*/
|
2001-01-22 03:17:29 +01:00
|
|
|
#include <string.h>
|
1999-09-28 18:35:32 +02:00
|
|
|
#include "winerror.h"
|
|
|
|
#include "winnt.h"
|
|
|
|
#include "winreg.h"
|
2000-11-16 01:28:52 +01:00
|
|
|
#include "winnls.h"
|
1999-09-28 18:35:32 +02:00
|
|
|
#include "debugtools.h"
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
#include "dplobby.h"
|
|
|
|
#include "dpinit.h"
|
|
|
|
#include "dplayx_global.h"
|
2000-07-10 15:19:28 +02:00
|
|
|
#include "dplayx_messages.h"
|
2000-08-25 23:58:05 +02:00
|
|
|
#include "dplayx_queue.h"
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-11-16 01:28:52 +01:00
|
|
|
DEFAULT_DEBUG_CHANNEL(dplay);
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Predeclare the interface implementation structures
|
|
|
|
*/
|
|
|
|
typedef struct IDirectPlayLobbyImpl IDirectPlayLobbyAImpl;
|
|
|
|
typedef struct IDirectPlayLobbyImpl IDirectPlayLobbyWImpl;
|
|
|
|
typedef struct IDirectPlayLobby2Impl IDirectPlayLobby2AImpl;
|
|
|
|
typedef struct IDirectPlayLobby2Impl IDirectPlayLobby2WImpl;
|
|
|
|
typedef struct IDirectPlayLobby3Impl IDirectPlayLobby3AImpl;
|
|
|
|
typedef struct IDirectPlayLobby3Impl IDirectPlayLobby3WImpl;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
/* Forward declarations for this module helper methods */
|
1999-11-25 23:04:53 +01:00
|
|
|
HRESULT DPL_CreateCompoundAddress ( LPCDPCOMPOUNDADDRESSELEMENT lpElements, DWORD dwElementCount,
|
|
|
|
LPVOID lpAddress, LPDWORD lpdwAddressSize, BOOL bAnsiInterface );
|
|
|
|
|
|
|
|
HRESULT DPL_CreateAddress( REFGUID guidSP, REFGUID guidDataType, LPCVOID lpData, DWORD dwDataSize,
|
|
|
|
LPVOID lpAddress, LPDWORD lpdwAddressSize, BOOL bAnsiInterface );
|
|
|
|
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress,
|
1999-11-04 03:17:03 +01:00
|
|
|
DWORD dwAddressSize, LPVOID lpContext );
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
static HRESULT WINAPI DPL_ConnectEx( IDirectPlayLobbyAImpl* This,
|
|
|
|
DWORD dwFlags, REFIID riid,
|
|
|
|
LPVOID* lplpDP, IUnknown* pUnk );
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
BOOL DPL_CreateAndSetLobbyHandles( DWORD dwDestProcessId, HANDLE hDestProcess,
|
|
|
|
LPHANDLE lphStart, LPHANDLE lphDeath,
|
|
|
|
LPHANDLE lphRead );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectPlayLobby {1,2,3} implementation structure
|
|
|
|
*
|
|
|
|
* The philosophy behind this extra pointer derefernce is that I wanted to
|
|
|
|
* have the same structure for all types of objects without having to do
|
|
|
|
* alot of casting. I also only wanted to implement an interface in the
|
|
|
|
* object it was "released" with IUnknown interface being implemented in the 1 version.
|
|
|
|
* Of course, with these new interfaces comes the data required to keep the state required
|
|
|
|
* by these interfaces. So, basically, the pointers contain the data associated with
|
|
|
|
* a release. If you use the data associated with release 3 in a release 2 object, you'll
|
|
|
|
* get a run time trap, as that won't have any data.
|
|
|
|
*
|
|
|
|
*/
|
2000-08-25 23:58:05 +02:00
|
|
|
struct DPLMSG
|
|
|
|
{
|
|
|
|
DPQ_ENTRY( DPLMSG ) msgs; /* Link to next queued message */
|
|
|
|
};
|
|
|
|
typedef struct DPLMSG* LPDPLMSG;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
typedef struct tagDirectPlayLobbyIUnknownData
|
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ULONG ulObjRef;
|
1999-09-28 18:35:32 +02:00
|
|
|
CRITICAL_SECTION DPL_lock;
|
|
|
|
} DirectPlayLobbyIUnknownData;
|
|
|
|
|
|
|
|
typedef struct tagDirectPlayLobbyData
|
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
HKEY hkCallbackKeyHack;
|
2000-08-25 23:58:05 +02:00
|
|
|
DWORD dwMsgThread;
|
|
|
|
DPQ_HEAD( DPLMSG ) msgs; /* List of messages received */
|
1999-09-28 18:35:32 +02:00
|
|
|
} DirectPlayLobbyData;
|
|
|
|
|
|
|
|
typedef struct tagDirectPlayLobby2Data
|
|
|
|
{
|
|
|
|
BOOL dummy;
|
|
|
|
} DirectPlayLobby2Data;
|
|
|
|
|
|
|
|
typedef struct tagDirectPlayLobby3Data
|
|
|
|
{
|
|
|
|
BOOL dummy;
|
|
|
|
} DirectPlayLobby3Data;
|
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
#define DPL_IMPL_FIELDS \
|
2000-08-25 23:58:05 +02:00
|
|
|
ULONG ulInterfaceRef; \
|
1999-11-25 23:04:53 +01:00
|
|
|
DirectPlayLobbyIUnknownData* unk; \
|
|
|
|
DirectPlayLobbyData* dpl; \
|
|
|
|
DirectPlayLobby2Data* dpl2; \
|
|
|
|
DirectPlayLobby3Data* dpl3;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
struct IDirectPlayLobbyImpl
|
|
|
|
{
|
1999-10-25 17:43:36 +02:00
|
|
|
ICOM_VFIELD(IDirectPlayLobby);
|
1999-11-25 23:04:53 +01:00
|
|
|
DPL_IMPL_FIELDS
|
1999-11-04 03:17:03 +01:00
|
|
|
};
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
struct IDirectPlayLobby2Impl
|
|
|
|
{
|
|
|
|
ICOM_VFIELD(IDirectPlayLobby2);
|
1999-11-25 23:04:53 +01:00
|
|
|
DPL_IMPL_FIELDS
|
1999-11-04 03:17:03 +01:00
|
|
|
};
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
struct IDirectPlayLobby3Impl
|
|
|
|
{
|
|
|
|
ICOM_VFIELD(IDirectPlayLobby3);
|
1999-11-25 23:04:53 +01:00
|
|
|
DPL_IMPL_FIELDS
|
1999-09-28 18:35:32 +02:00
|
|
|
};
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
/* Forward declarations of virtual tables */
|
1999-11-04 03:17:03 +01:00
|
|
|
static ICOM_VTABLE(IDirectPlayLobby) directPlayLobbyWVT;
|
1999-09-28 18:35:32 +02:00
|
|
|
static ICOM_VTABLE(IDirectPlayLobby2) directPlayLobby2WVT;
|
|
|
|
static ICOM_VTABLE(IDirectPlayLobby3) directPlayLobby3WVT;
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
static ICOM_VTABLE(IDirectPlayLobby) directPlayLobbyAVT;
|
|
|
|
static ICOM_VTABLE(IDirectPlayLobby2) directPlayLobby2AVT;
|
|
|
|
static ICOM_VTABLE(IDirectPlayLobby3) directPlayLobby3AVT;
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
static BOOL DPL_CreateIUnknown( LPVOID lpDPL )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,lpDPL);
|
|
|
|
|
|
|
|
This->unk = (DirectPlayLobbyIUnknownData*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
sizeof( *(This->unk) ) );
|
1999-11-25 23:04:53 +01:00
|
|
|
if ( This->unk == NULL )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
1999-11-25 23:04:53 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
InitializeCriticalSection( &This->unk->DPL_lock );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
return TRUE;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
static BOOL DPL_DestroyIUnknown( LPVOID lpDPL )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,lpDPL);
|
|
|
|
|
|
|
|
DeleteCriticalSection( &This->unk->DPL_lock );
|
|
|
|
HeapFree( GetProcessHeap(), 0, This->unk );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
static BOOL DPL_CreateLobby1( LPVOID lpDPL )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,lpDPL);
|
|
|
|
|
|
|
|
This->dpl = (DirectPlayLobbyData*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
sizeof( *(This->dpl) ) );
|
|
|
|
if ( This->dpl == NULL )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
DPQ_INIT( This->dpl->msgs );
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
static BOOL DPL_DestroyLobby1( LPVOID lpDPL )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,lpDPL);
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( This->dpl->dwMsgThread )
|
|
|
|
{
|
|
|
|
FIXME( "Should kill the msg thread\n" );
|
|
|
|
}
|
|
|
|
|
|
|
|
DPQ_DELETEQ( This->dpl->msgs, msgs, LPDPLMSG, cbDeleteElemFromHeap );
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
/* Delete the contents */
|
|
|
|
HeapFree( GetProcessHeap(), 0, This->dpl );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
static BOOL DPL_CreateLobby2( LPVOID lpDPL )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobby2AImpl,lpDPL);
|
|
|
|
|
|
|
|
This->dpl2 = (DirectPlayLobby2Data*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
sizeof( *(This->dpl2) ) );
|
|
|
|
if ( This->dpl2 == NULL )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
static BOOL DPL_DestroyLobby2( LPVOID lpDPL )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobby2AImpl,lpDPL);
|
|
|
|
|
|
|
|
HeapFree( GetProcessHeap(), 0, This->dpl2 );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
static BOOL DPL_CreateLobby3( LPVOID lpDPL )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobby3AImpl,lpDPL);
|
|
|
|
|
|
|
|
This->dpl3 = (DirectPlayLobby3Data*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
sizeof( *(This->dpl3) ) );
|
|
|
|
if ( This->dpl3 == NULL )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
static BOOL DPL_DestroyLobby3( LPVOID lpDPL )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobby3AImpl,lpDPL);
|
|
|
|
|
|
|
|
HeapFree( GetProcessHeap(), 0, This->dpl3 );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* The COM interface for upversioning an interface
|
|
|
|
* We've been given a GUID (riid) and we need to replace the present
|
|
|
|
* interface with that of the requested interface.
|
|
|
|
*
|
|
|
|
* Snip from some Microsoft document:
|
|
|
|
* There are four requirements for implementations of QueryInterface (In these
|
|
|
|
* cases, "must succeed" means "must succeed barring catastrophic failure."):
|
|
|
|
*
|
|
|
|
* * The set of interfaces accessible on an object through
|
|
|
|
* IUnknown::QueryInterface must be static, not dynamic. This means that
|
|
|
|
* if a call to QueryInterface for a pointer to a specified interface
|
|
|
|
* succeeds the first time, it must succeed again, and if it fails the
|
|
|
|
* first time, it must fail on all subsequent queries.
|
|
|
|
* * It must be symmetric ~W if a client holds a pointer to an interface on
|
|
|
|
* an object, and queries for that interface, the call must succeed.
|
|
|
|
* * It must be reflexive ~W if a client holding a pointer to one interface
|
|
|
|
* queries successfully for another, a query through the obtained pointer
|
|
|
|
* for the first interface must succeed.
|
|
|
|
* * It must be transitive ~W if a client holding a pointer to one interface
|
|
|
|
* queries successfully for a second, and through that pointer queries
|
|
|
|
* successfully for a third interface, a query for the first interface
|
|
|
|
* through the pointer for the third interface must succeed.
|
|
|
|
*/
|
1999-09-28 18:35:32 +02:00
|
|
|
extern
|
2000-08-25 23:58:05 +02:00
|
|
|
HRESULT DPL_CreateInterface
|
1999-09-28 18:35:32 +02:00
|
|
|
( REFIID riid, LPVOID* ppvObj )
|
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
TRACE( " for %s\n", debugstr_guid( riid ) );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
*ppvObj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
sizeof( IDirectPlayLobbyWImpl ) );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( *ppvObj == NULL )
|
|
|
|
{
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( IsEqualGUID( &IID_IDirectPlayLobby, riid ) )
|
|
|
|
{
|
|
|
|
ICOM_THIS(IDirectPlayLobbyWImpl,*ppvObj);
|
|
|
|
ICOM_VTBL(This) = &directPlayLobbyWVT;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
else if( IsEqualGUID( &IID_IDirectPlayLobbyA, riid ) )
|
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,*ppvObj);
|
|
|
|
ICOM_VTBL(This) = &directPlayLobbyAVT;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
else if( IsEqualGUID( &IID_IDirectPlayLobby2, riid ) )
|
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ICOM_THIS(IDirectPlayLobby2WImpl,*ppvObj);
|
|
|
|
ICOM_VTBL(This) = &directPlayLobby2WVT;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
else if( IsEqualGUID( &IID_IDirectPlayLobby2A, riid ) )
|
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ICOM_THIS(IDirectPlayLobby2AImpl,*ppvObj);
|
|
|
|
ICOM_VTBL(This) = &directPlayLobby2AVT;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
else if( IsEqualGUID( &IID_IDirectPlayLobby3, riid ) )
|
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ICOM_THIS(IDirectPlayLobby3WImpl,*ppvObj);
|
|
|
|
ICOM_VTBL(This) = &directPlayLobby3WVT;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
else if( IsEqualGUID( &IID_IDirectPlayLobby3A, riid ) )
|
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ICOM_THIS(IDirectPlayLobby3AImpl,*ppvObj);
|
|
|
|
ICOM_VTBL(This) = &directPlayLobby3AVT;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Unsupported interface */
|
1999-11-04 03:17:03 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, *ppvObj );
|
1999-09-28 18:35:32 +02:00
|
|
|
*ppvObj = NULL;
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize it */
|
|
|
|
if ( DPL_CreateIUnknown( *ppvObj ) &&
|
|
|
|
DPL_CreateLobby1( *ppvObj ) &&
|
|
|
|
DPL_CreateLobby2( *ppvObj ) &&
|
|
|
|
DPL_CreateLobby3( *ppvObj )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
IDirectPlayLobby_AddRef( (LPDIRECTPLAYLOBBY)*ppvObj );
|
1999-09-28 18:35:32 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Initialize failed, destroy it */
|
|
|
|
DPL_DestroyLobby3( *ppvObj );
|
|
|
|
DPL_DestroyLobby2( *ppvObj );
|
|
|
|
DPL_DestroyLobby1( *ppvObj );
|
|
|
|
DPL_DestroyIUnknown( *ppvObj );
|
|
|
|
HeapFree( GetProcessHeap(), 0, *ppvObj );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
*ppvObj = NULL;
|
|
|
|
return DPERR_NOMEMORY;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
static HRESULT WINAPI DPL_QueryInterface
|
|
|
|
( LPDIRECTPLAYLOBBYA iface,
|
1999-09-28 18:35:32 +02:00
|
|
|
REFIID riid,
|
|
|
|
LPVOID* ppvObj )
|
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,iface);
|
|
|
|
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid( riid ), ppvObj );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
*ppvObj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
2000-10-19 22:20:58 +02:00
|
|
|
sizeof( *This ) );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
if( *ppvObj == NULL )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
return DPERR_OUTOFMEMORY;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2000-10-19 22:20:58 +02:00
|
|
|
CopyMemory( *ppvObj, This, sizeof( *This ) );
|
|
|
|
(*(IDirectPlayLobbyAImpl**)ppvObj)->ulInterfaceRef = 0;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( IsEqualGUID( &IID_IDirectPlayLobby, riid ) )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ICOM_THIS(IDirectPlayLobbyWImpl,*ppvObj);
|
|
|
|
ICOM_VTBL(This) = &directPlayLobbyWVT;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
else if( IsEqualGUID( &IID_IDirectPlayLobbyA, riid ) )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,*ppvObj);
|
|
|
|
ICOM_VTBL(This) = &directPlayLobbyAVT;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
else if( IsEqualGUID( &IID_IDirectPlayLobby2, riid ) )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ICOM_THIS(IDirectPlayLobby2WImpl,*ppvObj);
|
|
|
|
ICOM_VTBL(This) = &directPlayLobby2WVT;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
else if( IsEqualGUID( &IID_IDirectPlayLobby2A, riid ) )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ICOM_THIS(IDirectPlayLobby2AImpl,*ppvObj);
|
|
|
|
ICOM_VTBL(This) = &directPlayLobby2AVT;
|
|
|
|
}
|
|
|
|
else if( IsEqualGUID( &IID_IDirectPlayLobby3, riid ) )
|
|
|
|
{
|
|
|
|
ICOM_THIS(IDirectPlayLobby3WImpl,*ppvObj);
|
|
|
|
ICOM_VTBL(This) = &directPlayLobby3WVT;
|
|
|
|
}
|
|
|
|
else if( IsEqualGUID( &IID_IDirectPlayLobby3A, riid ) )
|
|
|
|
{
|
|
|
|
ICOM_THIS(IDirectPlayLobby3AImpl,*ppvObj);
|
|
|
|
ICOM_VTBL(This) = &directPlayLobby3AVT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Unsupported interface */
|
|
|
|
HeapFree( GetProcessHeap(), 0, *ppvObj );
|
|
|
|
*ppvObj = NULL;
|
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
IDirectPlayLobby_AddRef( (LPDIRECTPLAYLOBBY)*ppvObj );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
return S_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Simple procedure. Just increment the reference count to this
|
|
|
|
* structure and return the new reference count.
|
|
|
|
*/
|
2000-08-25 23:58:05 +02:00
|
|
|
static ULONG WINAPI DPL_AddRef
|
1999-11-04 03:17:03 +01:00
|
|
|
( LPDIRECTPLAYLOBBY iface )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ULONG ulInterfaceRefCount, ulObjRefCount;
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyWImpl,iface);
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
ulObjRefCount = InterlockedIncrement( &This->unk->ulObjRef );
|
|
|
|
ulInterfaceRefCount = InterlockedIncrement( &This->ulInterfaceRef );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
TRACE( "ref count incremented to %lu:%lu for %p\n",
|
|
|
|
ulInterfaceRefCount, ulObjRefCount, This );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
return ulObjRefCount;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Simple COM procedure. Decrease the reference count to this object.
|
|
|
|
* If the object no longer has any reference counts, free up the associated
|
|
|
|
* memory.
|
|
|
|
*/
|
2000-08-25 23:58:05 +02:00
|
|
|
static ULONG WINAPI DPL_Release
|
1999-09-28 18:35:32 +02:00
|
|
|
( LPDIRECTPLAYLOBBYA iface )
|
|
|
|
{
|
2000-08-25 23:58:05 +02:00
|
|
|
ULONG ulInterfaceRefCount, ulObjRefCount;
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,iface);
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
ulObjRefCount = InterlockedDecrement( &This->unk->ulObjRef );
|
|
|
|
ulInterfaceRefCount = InterlockedDecrement( &This->ulInterfaceRef );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
TRACE( "ref count decremented to %lu:%lu for %p\n",
|
|
|
|
ulInterfaceRefCount, ulObjRefCount, This );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
/* Deallocate if this is the last reference to the object */
|
2000-08-25 23:58:05 +02:00
|
|
|
if( ulObjRefCount == 0 )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
DPL_DestroyLobby3( This );
|
|
|
|
DPL_DestroyLobby2( This );
|
|
|
|
DPL_DestroyLobby1( This );
|
|
|
|
DPL_DestroyIUnknown( This );
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( ulInterfaceRefCount == 0 )
|
|
|
|
{
|
|
|
|
HeapFree( GetProcessHeap(), 0, This );
|
|
|
|
}
|
|
|
|
|
|
|
|
return ulInterfaceRefCount;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Connects an application to the session specified by the DPLCONNECTION
|
|
|
|
* structure currently stored with the DirectPlayLobby object.
|
|
|
|
*
|
|
|
|
* Returns a IDirectPlay interface.
|
|
|
|
*
|
|
|
|
*/
|
2000-07-10 15:19:28 +02:00
|
|
|
static HRESULT WINAPI DPL_ConnectEx
|
|
|
|
( IDirectPlayLobbyAImpl* This,
|
|
|
|
DWORD dwFlags,
|
|
|
|
REFIID riid,
|
|
|
|
LPVOID* lplpDP,
|
1999-09-28 18:35:32 +02:00
|
|
|
IUnknown* pUnk)
|
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
HRESULT hr;
|
|
|
|
DWORD dwOpenFlags = 0;
|
|
|
|
DWORD dwConnSize = 0;
|
|
|
|
LPDPLCONNECTION lpConn;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
FIXME("(%p)->(0x%08lx,%p,%p): semi stub\n", This, dwFlags, lplpDP, pUnk );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( pUnk )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Backwards compatibility */
|
|
|
|
if( dwFlags == 0 )
|
|
|
|
{
|
|
|
|
dwFlags = DPCONNECT_RETURNSTATUS;
|
|
|
|
}
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
/* Create the DirectPlay interface */
|
2000-08-25 23:58:05 +02:00
|
|
|
if( ( hr = DP_CreateInterface( riid, lplpDP ) ) != DP_OK )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
ERR( "error creating interface for %s:%s.\n",
|
|
|
|
debugstr_guid( riid ), DPLAYX_HresultToString( hr ) );
|
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* FIXME: Is it safe/correct to use appID of 0? */
|
|
|
|
hr = IDirectPlayLobby_GetConnectionSettings( (LPDIRECTPLAYLOBBY)This,
|
|
|
|
0, NULL, &dwConnSize );
|
|
|
|
if( hr != DPERR_BUFFERTOOSMALL )
|
|
|
|
{
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
lpConn = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwConnSize );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
if( lpConn == NULL )
|
|
|
|
{
|
|
|
|
return DPERR_NOMEMORY;
|
|
|
|
}
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* FIXME: Is it safe/correct to use appID of 0? */
|
|
|
|
hr = IDirectPlayLobby_GetConnectionSettings( (LPDIRECTPLAYLOBBY)This,
|
|
|
|
0, lpConn, &dwConnSize );
|
|
|
|
if( FAILED( hr ) )
|
|
|
|
{
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
#if 0
|
|
|
|
/* - Need to call IDirectPlay::EnumConnections with the service provider to get that good information
|
|
|
|
* - Need to call CreateAddress to create the lpConnection param for IDirectPlay::InitializeConnection
|
|
|
|
* - Call IDirectPlay::InitializeConnection
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Now initialize the Service Provider */
|
|
|
|
hr = IDirectPlayX_InitializeConnection( (*(LPDIRECTPLAY2*)lplpDP),
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Setup flags to pass into DirectPlay::Open */
|
|
|
|
if( dwFlags & DPCONNECT_RETURNSTATUS )
|
|
|
|
{
|
|
|
|
dwOpenFlags |= DPOPEN_RETURNSTATUS;
|
|
|
|
}
|
|
|
|
dwOpenFlags |= lpConn->dwFlags;
|
|
|
|
|
|
|
|
hr = IDirectPlayX_Open( (*(LPDIRECTPLAY2*)lplpDP), lpConn->lpSessionDesc,
|
|
|
|
dwOpenFlags );
|
|
|
|
|
|
|
|
HeapFree( GetProcessHeap(), 0, lpConn );
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_Connect
|
|
|
|
( LPDIRECTPLAYLOBBYA iface,
|
|
|
|
DWORD dwFlags,
|
|
|
|
LPDIRECTPLAY2A* lplpDP,
|
|
|
|
IUnknown* pUnk)
|
|
|
|
{
|
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,iface);
|
|
|
|
return DPL_ConnectEx( This, dwFlags, &IID_IDirectPlay2A,
|
|
|
|
(LPVOID)lplpDP, pUnk );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyWImpl_Connect
|
|
|
|
( LPDIRECTPLAYLOBBY iface,
|
|
|
|
DWORD dwFlags,
|
|
|
|
LPDIRECTPLAY2* lplpDP,
|
|
|
|
IUnknown* pUnk)
|
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,iface); /* Yes cast to A */
|
|
|
|
return DPL_ConnectEx( This, dwFlags, &IID_IDirectPlay2,
|
|
|
|
(LPVOID)lplpDP, pUnk );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Creates a DirectPlay Address, given a service provider-specific network
|
|
|
|
* address.
|
|
|
|
* Returns an address contains the globally unique identifier
|
|
|
|
* (GUID) of the service provider and data that the service provider can
|
|
|
|
* interpret as a network address.
|
|
|
|
*
|
1999-11-04 03:17:03 +01:00
|
|
|
* NOTE: It appears that this method is supposed to be really really stupid
|
|
|
|
* with no error checking on the contents.
|
1999-09-28 18:35:32 +02:00
|
|
|
*/
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_CreateAddress
|
|
|
|
( LPDIRECTPLAYLOBBYA iface,
|
|
|
|
REFGUID guidSP,
|
|
|
|
REFGUID guidDataType,
|
|
|
|
LPCVOID lpData,
|
|
|
|
DWORD dwDataSize,
|
|
|
|
LPVOID lpAddress,
|
|
|
|
LPDWORD lpdwAddressSize )
|
|
|
|
{
|
1999-11-25 23:04:53 +01:00
|
|
|
return DPL_CreateAddress( guidSP, guidDataType, lpData, dwDataSize,
|
|
|
|
lpAddress, lpdwAddressSize, TRUE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyWImpl_CreateAddress
|
|
|
|
( LPDIRECTPLAYLOBBY iface,
|
|
|
|
REFGUID guidSP,
|
|
|
|
REFGUID guidDataType,
|
|
|
|
LPCVOID lpData,
|
|
|
|
DWORD dwDataSize,
|
|
|
|
LPVOID lpAddress,
|
|
|
|
LPDWORD lpdwAddressSize )
|
|
|
|
{
|
1999-11-25 23:04:53 +01:00
|
|
|
return DPL_CreateAddress( guidSP, guidDataType, lpData, dwDataSize,
|
|
|
|
lpAddress, lpdwAddressSize, FALSE );
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT DPL_CreateAddress(
|
|
|
|
REFGUID guidSP,
|
|
|
|
REFGUID guidDataType,
|
|
|
|
LPCVOID lpData,
|
|
|
|
DWORD dwDataSize,
|
|
|
|
LPVOID lpAddress,
|
|
|
|
LPDWORD lpdwAddressSize,
|
|
|
|
BOOL bAnsiInterface )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
const DWORD dwNumAddElements = 2; /* Service Provide & address data type */
|
2000-02-26 14:17:55 +01:00
|
|
|
DPCOMPOUNDADDRESSELEMENT addressElements[ 2 /* dwNumAddElements */ ];
|
1999-11-04 03:17:03 +01:00
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
TRACE( "(%p)->(%p,%p,0x%08lx,%p,%p,%d)\n", guidSP, guidDataType, lpData, dwDataSize,
|
|
|
|
lpAddress, lpdwAddressSize, bAnsiInterface );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
addressElements[ 0 ].guidDataType = DPAID_ServiceProvider;
|
|
|
|
addressElements[ 0 ].dwDataSize = sizeof( GUID );
|
|
|
|
addressElements[ 0 ].lpData = (LPVOID)guidSP;
|
|
|
|
|
|
|
|
addressElements[ 1 ].guidDataType = *guidDataType;
|
|
|
|
addressElements[ 1 ].dwDataSize = dwDataSize;
|
|
|
|
addressElements[ 1 ].lpData = (LPVOID)lpData;
|
|
|
|
|
|
|
|
/* Call CreateCompoundAddress to cut down on code.
|
|
|
|
NOTE: We can do this because we don't support DPL 1 interfaces! */
|
1999-11-25 23:04:53 +01:00
|
|
|
return DPL_CreateCompoundAddress( addressElements, dwNumAddElements,
|
|
|
|
lpAddress, lpdwAddressSize, bAnsiInterface );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Parses out chunks from the DirectPlay Address buffer by calling the
|
|
|
|
* given callback function, with lpContext, for each of the chunks.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumAddress
|
|
|
|
( LPDIRECTPLAYLOBBYA iface,
|
|
|
|
LPDPENUMADDRESSCALLBACK lpEnumAddressCallback,
|
|
|
|
LPCVOID lpAddress,
|
|
|
|
DWORD dwAddressSize,
|
|
|
|
LPVOID lpContext )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p,%p,0x%08lx,%p)\n", This, lpEnumAddressCallback, lpAddress,
|
|
|
|
dwAddressSize, lpContext );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
return DPL_EnumAddress( lpEnumAddressCallback, lpAddress, dwAddressSize, lpContext );
|
|
|
|
}
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumAddress
|
|
|
|
( LPDIRECTPLAYLOBBY iface,
|
|
|
|
LPDPENUMADDRESSCALLBACK lpEnumAddressCallback,
|
|
|
|
LPCVOID lpAddress,
|
|
|
|
DWORD dwAddressSize,
|
|
|
|
LPVOID lpContext )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyWImpl,iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p,%p,0x%08lx,%p)\n", This, lpEnumAddressCallback, lpAddress,
|
|
|
|
dwAddressSize, lpContext );
|
|
|
|
|
|
|
|
return DPL_EnumAddress( lpEnumAddressCallback, lpAddress, dwAddressSize, lpContext );
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress,
|
1999-11-04 03:17:03 +01:00
|
|
|
DWORD dwAddressSize, LPVOID lpContext )
|
|
|
|
{
|
|
|
|
DWORD dwTotalSizeEnumerated = 0;
|
|
|
|
|
|
|
|
/* FIXME: First chunk is always the total size chunk - Should we report it? */
|
|
|
|
|
|
|
|
while ( dwTotalSizeEnumerated < dwAddressSize )
|
|
|
|
{
|
|
|
|
LPDPADDRESS lpElements = (LPDPADDRESS)lpAddress;
|
|
|
|
DWORD dwSizeThisEnumeration;
|
|
|
|
|
|
|
|
/* Invoke the enum method. If false is returned, stop enumeration */
|
2000-08-25 23:58:05 +02:00
|
|
|
if ( !lpEnumAddressCallback( &lpElements->guidDataType,
|
|
|
|
lpElements->dwDataSize,
|
|
|
|
(BYTE*)lpElements + sizeof( DPADDRESS ),
|
|
|
|
lpContext ) )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
dwSizeThisEnumeration = sizeof( DPADDRESS ) + lpElements->dwDataSize;
|
2000-08-25 23:58:05 +02:00
|
|
|
lpAddress = (BYTE*) lpAddress + dwSizeThisEnumeration;
|
1999-11-04 03:17:03 +01:00
|
|
|
dwTotalSizeEnumerated += dwSizeThisEnumeration;
|
|
|
|
}
|
|
|
|
|
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Enumerates all the address types that a given service provider needs to
|
|
|
|
* build the DirectPlay Address.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumAddressTypes
|
|
|
|
( LPDIRECTPLAYLOBBYA iface,
|
|
|
|
LPDPLENUMADDRESSTYPESCALLBACK lpEnumAddressTypeCallback,
|
|
|
|
REFGUID guidSP,
|
|
|
|
LPVOID lpContext,
|
|
|
|
DWORD dwFlags )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,iface);
|
|
|
|
|
|
|
|
HKEY hkResult;
|
|
|
|
LPCSTR searchSubKey = "SOFTWARE\\Microsoft\\DirectPlay\\Service Providers";
|
|
|
|
DWORD dwIndex, sizeOfSubKeyName=50;
|
|
|
|
char subKeyName[51];
|
2000-03-12 21:18:33 +01:00
|
|
|
FILETIME filetime;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
TRACE(" (%p)->(%p,%p,%p,0x%08lx)\n", This, lpEnumAddressTypeCallback, guidSP, lpContext, dwFlags );
|
|
|
|
|
|
|
|
if( dwFlags != 0 )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !lpEnumAddressTypeCallback || !*lpEnumAddressTypeCallback )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( guidSP == NULL )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDOBJECT;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Need to loop over the service providers in the registry */
|
|
|
|
if( RegOpenKeyExA( HKEY_LOCAL_MACHINE, searchSubKey,
|
2000-03-12 21:18:33 +01:00
|
|
|
0, KEY_READ, &hkResult ) != ERROR_SUCCESS )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
/* Hmmm. Does this mean that there are no service providers? */
|
|
|
|
ERR(": no service providers?\n");
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Traverse all the service providers we have available */
|
|
|
|
for( dwIndex=0;
|
2000-03-12 21:18:33 +01:00
|
|
|
RegEnumKeyExA( hkResult, dwIndex, subKeyName, &sizeOfSubKeyName,
|
|
|
|
NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS;
|
|
|
|
++dwIndex, sizeOfSubKeyName=50 )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
HKEY hkServiceProvider, hkServiceProviderAt;
|
|
|
|
GUID serviceProviderGUID;
|
|
|
|
DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
|
|
|
|
char atSubKey[51];
|
|
|
|
char returnBuffer[51];
|
2000-11-16 01:28:52 +01:00
|
|
|
WCHAR buff[51];
|
1999-11-04 03:17:03 +01:00
|
|
|
DWORD dwAtIndex;
|
|
|
|
LPSTR atKey = "Address Types";
|
|
|
|
LPSTR guidDataSubKey = "Guid";
|
2000-03-12 21:18:33 +01:00
|
|
|
FILETIME filetime;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
TRACE(" this time through: %s\n", subKeyName );
|
|
|
|
|
|
|
|
/* Get a handle for this particular service provider */
|
2000-03-12 21:18:33 +01:00
|
|
|
if( RegOpenKeyExA( hkResult, subKeyName, 0, KEY_READ,
|
1999-11-04 03:17:03 +01:00
|
|
|
&hkServiceProvider ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR(": what the heck is going on?\n" );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( RegQueryValueExA( hkServiceProvider, guidDataSubKey,
|
|
|
|
NULL, &returnTypeGUID, returnBuffer,
|
|
|
|
&sizeOfReturnBuffer ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR(": missing GUID registry data members\n" );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Check return types to ensure we're interpreting data right */
|
2000-11-16 01:28:52 +01:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff)/sizeof(WCHAR) );
|
|
|
|
CLSIDFromString( (LPCOLESTR)buff, &serviceProviderGUID );
|
1999-11-04 03:17:03 +01:00
|
|
|
/* FIXME: Have I got a memory leak on the serviceProviderGUID? */
|
|
|
|
|
|
|
|
/* Determine if this is the Service Provider that the user asked for */
|
|
|
|
if( !IsEqualGUID( &serviceProviderGUID, guidSP ) )
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get a handle for this particular service provider */
|
2000-03-12 21:18:33 +01:00
|
|
|
if( RegOpenKeyExA( hkServiceProvider, atKey, 0, KEY_READ,
|
1999-11-04 03:17:03 +01:00
|
|
|
&hkServiceProviderAt ) != ERROR_SUCCESS )
|
|
|
|
{
|
2000-03-12 21:18:33 +01:00
|
|
|
TRACE(": No Address Types registry data sub key/members\n" );
|
1999-11-04 03:17:03 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Traverse all the address type we have available */
|
|
|
|
for( dwAtIndex=0;
|
2000-03-12 21:18:33 +01:00
|
|
|
RegEnumKeyExA( hkServiceProviderAt, dwAtIndex, atSubKey, &sizeOfSubKeyName,
|
|
|
|
NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS;
|
|
|
|
++dwAtIndex, sizeOfSubKeyName=50 )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
TRACE( "Found Address Type GUID %s\n", atSubKey );
|
|
|
|
|
|
|
|
/* FIXME: Check return types to ensure we're interpreting data right */
|
2000-11-16 01:28:52 +01:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, atSubKey, -1, buff, sizeof(buff)/sizeof(WCHAR) );
|
|
|
|
CLSIDFromString( (LPCOLESTR)buff, &serviceProviderGUID );
|
1999-11-04 03:17:03 +01:00
|
|
|
/* FIXME: Have I got a memory leak on the serviceProviderGUID? */
|
|
|
|
|
|
|
|
/* The enumeration will return FALSE if we are not to continue */
|
|
|
|
if( !lpEnumAddressTypeCallback( &serviceProviderGUID, lpContext, 0 ) )
|
|
|
|
{
|
|
|
|
WARN("lpEnumCallback returning FALSE\n" );
|
|
|
|
break; /* FIXME: This most likely has to break from the procedure...*/
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We only enumerate address types for 1 GUID. We've found it, so quit looking */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumAddressTypes
|
|
|
|
( LPDIRECTPLAYLOBBY iface,
|
|
|
|
LPDPLENUMADDRESSTYPESCALLBACK lpEnumAddressTypeCallback,
|
|
|
|
REFGUID guidSP,
|
|
|
|
LPVOID lpContext,
|
|
|
|
DWORD dwFlags )
|
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Enumerates what applications are registered with DirectPlay by
|
|
|
|
* invoking the callback function with lpContext.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumLocalApplications
|
|
|
|
( LPDIRECTPLAYLOBBY iface,
|
|
|
|
LPDPLENUMLOCALAPPLICATIONSCALLBACK lpEnumLocalAppCallback,
|
|
|
|
LPVOID lpContext,
|
|
|
|
DWORD dwFlags )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyWImpl,iface);
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
FIXME("(%p)->(%p,%p,0x%08lx):stub\n", This, lpEnumLocalAppCallback, lpContext, dwFlags );
|
|
|
|
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumLocalApplications
|
|
|
|
( LPDIRECTPLAYLOBBYA iface,
|
|
|
|
LPDPLENUMLOCALAPPLICATIONSCALLBACK lpEnumLocalAppCallback,
|
|
|
|
LPVOID lpContext,
|
|
|
|
DWORD dwFlags )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,iface);
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
HKEY hkResult;
|
|
|
|
LPCSTR searchSubKey = "SOFTWARE\\Microsoft\\DirectPlay\\Applications";
|
|
|
|
LPSTR guidDataSubKey = "Guid";
|
|
|
|
DWORD dwIndex, sizeOfSubKeyName=50;
|
|
|
|
char subKeyName[51];
|
2000-03-12 21:18:33 +01:00
|
|
|
FILETIME filetime;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
TRACE("(%p)->(%p,%p,0x%08lx)\n", This, lpEnumLocalAppCallback, lpContext, dwFlags );
|
|
|
|
|
|
|
|
if( dwFlags != 0 )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !lpEnumLocalAppCallback || !*lpEnumLocalAppCallback )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Need to loop over the service providers in the registry */
|
|
|
|
if( RegOpenKeyExA( HKEY_LOCAL_MACHINE, searchSubKey,
|
2000-03-12 21:18:33 +01:00
|
|
|
0, KEY_READ, &hkResult ) != ERROR_SUCCESS )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
/* Hmmm. Does this mean that there are no service providers? */
|
|
|
|
ERR(": no service providers?\n");
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Traverse all registered applications */
|
|
|
|
for( dwIndex=0;
|
2000-03-12 21:18:33 +01:00
|
|
|
RegEnumKeyExA( hkResult, dwIndex, subKeyName, &sizeOfSubKeyName, NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS;
|
|
|
|
++dwIndex, sizeOfSubKeyName=50 )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
HKEY hkServiceProvider;
|
|
|
|
GUID serviceProviderGUID;
|
|
|
|
DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
|
|
|
|
char returnBuffer[51];
|
2000-11-16 01:28:52 +01:00
|
|
|
WCHAR buff[51];
|
1999-11-04 03:17:03 +01:00
|
|
|
DPLAPPINFO dplAppInfo;
|
|
|
|
|
|
|
|
TRACE(" this time through: %s\n", subKeyName );
|
|
|
|
|
|
|
|
/* Get a handle for this particular service provider */
|
2000-03-12 21:18:33 +01:00
|
|
|
if( RegOpenKeyExA( hkResult, subKeyName, 0, KEY_READ,
|
1999-11-04 03:17:03 +01:00
|
|
|
&hkServiceProvider ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR(": what the heck is going on?\n" );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( RegQueryValueExA( hkServiceProvider, guidDataSubKey,
|
|
|
|
NULL, &returnTypeGUID, returnBuffer,
|
|
|
|
&sizeOfReturnBuffer ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR(": missing GUID registry data members\n" );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Check return types to ensure we're interpreting data right */
|
2000-11-16 01:28:52 +01:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff)/sizeof(WCHAR) );
|
|
|
|
CLSIDFromString( (LPCOLESTR)buff, &serviceProviderGUID );
|
1999-11-04 03:17:03 +01:00
|
|
|
/* FIXME: Have I got a memory leak on the serviceProviderGUID? */
|
|
|
|
|
|
|
|
dplAppInfo.dwSize = sizeof( dplAppInfo );
|
|
|
|
dplAppInfo.guidApplication = serviceProviderGUID;
|
2000-12-03 04:16:05 +01:00
|
|
|
dplAppInfo.u.lpszAppNameA = subKeyName;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
EnterCriticalSection( &This->unk->DPL_lock );
|
|
|
|
|
|
|
|
memcpy( &This->dpl->hkCallbackKeyHack, &hkServiceProvider, sizeof( hkServiceProvider ) );
|
|
|
|
|
|
|
|
if( !lpEnumLocalAppCallback( &dplAppInfo, lpContext, dwFlags ) )
|
|
|
|
{
|
|
|
|
LeaveCriticalSection( &This->unk->DPL_lock );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
LeaveCriticalSection( &This->unk->DPL_lock );
|
|
|
|
}
|
|
|
|
|
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Retrieves the DPLCONNECTION structure that contains all the information
|
|
|
|
* needed to start and connect an application. This was generated using
|
|
|
|
* either the RunApplication or SetConnectionSettings methods.
|
|
|
|
*
|
|
|
|
* NOTES: If lpData is NULL then just return lpdwDataSize. This allows
|
|
|
|
* the data structure to be allocated by our caller which can then
|
|
|
|
* call this procedure/method again with a valid data pointer.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_GetConnectionSettings
|
|
|
|
( LPDIRECTPLAYLOBBYA iface,
|
|
|
|
DWORD dwAppID,
|
|
|
|
LPVOID lpData,
|
|
|
|
LPDWORD lpdwDataSize )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,iface);
|
|
|
|
HRESULT hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
TRACE("(%p)->(0x%08lx,%p,%p)\n", This, dwAppID, lpData, lpdwDataSize );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
EnterCriticalSection( &This->unk->DPL_lock );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
hr = DPLAYX_GetConnectionSettingsA( dwAppID,
|
|
|
|
lpData,
|
2000-08-25 23:58:05 +02:00
|
|
|
lpdwDataSize
|
2000-07-10 15:19:28 +02:00
|
|
|
);
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
LeaveCriticalSection( &This->unk->DPL_lock );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyWImpl_GetConnectionSettings
|
|
|
|
( LPDIRECTPLAYLOBBY iface,
|
|
|
|
DWORD dwAppID,
|
|
|
|
LPVOID lpData,
|
|
|
|
LPDWORD lpdwDataSize )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyWImpl,iface);
|
|
|
|
HRESULT hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
TRACE("(%p)->(0x%08lx,%p,%p)\n", This, dwAppID, lpData, lpdwDataSize );
|
|
|
|
|
|
|
|
EnterCriticalSection( &This->unk->DPL_lock );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
hr = DPLAYX_GetConnectionSettingsW( dwAppID,
|
|
|
|
lpData,
|
2000-08-25 23:58:05 +02:00
|
|
|
lpdwDataSize
|
2000-07-10 15:19:28 +02:00
|
|
|
);
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
LeaveCriticalSection( &This->unk->DPL_lock );
|
|
|
|
|
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Retrieves the message sent between a lobby client and a DirectPlay
|
|
|
|
* application. All messages are queued until received.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_ReceiveLobbyMessage
|
|
|
|
( LPDIRECTPLAYLOBBYA iface,
|
|
|
|
DWORD dwFlags,
|
|
|
|
DWORD dwAppID,
|
|
|
|
LPDWORD lpdwMessageFlags,
|
|
|
|
LPVOID lpData,
|
|
|
|
LPDWORD lpdwDataSize )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,iface);
|
1999-09-28 18:35:32 +02:00
|
|
|
FIXME(":stub %p %08lx %08lx %p %p %p\n", This, dwFlags, dwAppID, lpdwMessageFlags, lpData,
|
|
|
|
lpdwDataSize );
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyWImpl_ReceiveLobbyMessage
|
|
|
|
( LPDIRECTPLAYLOBBY iface,
|
|
|
|
DWORD dwFlags,
|
|
|
|
DWORD dwAppID,
|
|
|
|
LPDWORD lpdwMessageFlags,
|
|
|
|
LPVOID lpData,
|
|
|
|
LPDWORD lpdwDataSize )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyWImpl,iface);
|
1999-09-28 18:35:32 +02:00
|
|
|
FIXME(":stub %p %08lx %08lx %p %p %p\n", This, dwFlags, dwAppID, lpdwMessageFlags, lpData,
|
|
|
|
lpdwDataSize );
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
typedef struct tagRunApplicationEnumStruct
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyAImpl* This;
|
|
|
|
|
|
|
|
GUID appGUID;
|
|
|
|
LPSTR lpszPath;
|
|
|
|
LPSTR lpszFileName;
|
|
|
|
LPSTR lpszCommandLine;
|
|
|
|
LPSTR lpszCurrentDirectory;
|
|
|
|
} RunApplicationEnumStruct, *lpRunApplicationEnumStruct;
|
|
|
|
|
|
|
|
/* To be called by RunApplication to find how to invoke the function */
|
|
|
|
static BOOL CALLBACK RunApplicationA_EnumLocalApplications
|
|
|
|
( LPCDPLAPPINFO lpAppInfo,
|
|
|
|
LPVOID lpContext,
|
|
|
|
DWORD dwFlags )
|
|
|
|
{
|
|
|
|
lpRunApplicationEnumStruct lpData = (lpRunApplicationEnumStruct)lpContext;
|
|
|
|
|
|
|
|
if( IsEqualGUID( &lpAppInfo->guidApplication, &lpData->appGUID ) )
|
|
|
|
{
|
|
|
|
char returnBuffer[200];
|
|
|
|
DWORD returnType, sizeOfReturnBuffer;
|
|
|
|
LPSTR clSubKey = "CommandLine";
|
|
|
|
LPSTR cdSubKey = "CurrentDirectory";
|
|
|
|
LPSTR fileSubKey = "File";
|
|
|
|
LPSTR pathSubKey = "Path";
|
|
|
|
|
|
|
|
/* FIXME: Lazy man hack - dplay struct has the present reg key saved */
|
|
|
|
|
|
|
|
sizeOfReturnBuffer = 200;
|
|
|
|
|
|
|
|
/* Get all the appropriate data from the registry */
|
|
|
|
if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, clSubKey,
|
|
|
|
NULL, &returnType, returnBuffer,
|
|
|
|
&sizeOfReturnBuffer ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR( ": missing CommandLine registry data member\n" );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-11-16 01:28:52 +01:00
|
|
|
if ((lpData->lpszCommandLine = HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer)+1 )))
|
|
|
|
strcpy( lpData->lpszCommandLine, returnBuffer );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sizeOfReturnBuffer = 200;
|
|
|
|
|
|
|
|
if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, cdSubKey,
|
|
|
|
NULL, &returnType, returnBuffer,
|
|
|
|
&sizeOfReturnBuffer ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR( ": missing CurrentDirectory registry data member\n" );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-11-16 01:28:52 +01:00
|
|
|
if ((lpData->lpszCurrentDirectory = HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer)+1 )))
|
|
|
|
strcpy( lpData->lpszCurrentDirectory, returnBuffer );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sizeOfReturnBuffer = 200;
|
|
|
|
|
|
|
|
if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, fileSubKey,
|
|
|
|
NULL, &returnType, returnBuffer,
|
|
|
|
&sizeOfReturnBuffer ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR( ": missing File registry data member\n" );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-11-16 01:28:52 +01:00
|
|
|
if ((lpData->lpszFileName = HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer)+1 )))
|
|
|
|
strcpy( lpData->lpszFileName, returnBuffer );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sizeOfReturnBuffer = 200;
|
|
|
|
|
|
|
|
if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, pathSubKey,
|
|
|
|
NULL, &returnType, returnBuffer,
|
|
|
|
&sizeOfReturnBuffer ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR( ": missing Path registry data member\n" );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-11-16 01:28:52 +01:00
|
|
|
if ((lpData->lpszPath = HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer)+1 )))
|
|
|
|
strcpy( lpData->lpszPath, returnBuffer );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE; /* No need to keep going as we found what we wanted */
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE; /* Keep enumerating, haven't found the application yet */
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
BOOL DPL_CreateAndSetLobbyHandles( DWORD dwDestProcessId, HANDLE hDestProcess,
|
|
|
|
LPHANDLE lphStart, LPHANDLE lphDeath,
|
|
|
|
LPHANDLE lphRead )
|
|
|
|
{
|
|
|
|
/* These are the handles for the created process */
|
2000-09-27 01:11:48 +02:00
|
|
|
HANDLE hAppStart, hAppDeath, hAppRead, hTemp;
|
2000-08-25 23:58:05 +02:00
|
|
|
SECURITY_ATTRIBUTES s_attrib;
|
|
|
|
|
|
|
|
s_attrib.nLength = sizeof( s_attrib );
|
|
|
|
s_attrib.lpSecurityDescriptor = NULL;
|
|
|
|
s_attrib.bInheritHandle = TRUE;
|
|
|
|
|
|
|
|
/* FIXME: Is there a handle leak here? */
|
2000-09-27 01:11:48 +02:00
|
|
|
hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL );
|
|
|
|
*lphStart = ConvertToGlobalHandle( hTemp );
|
|
|
|
|
|
|
|
hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL );
|
|
|
|
*lphDeath = ConvertToGlobalHandle( hTemp );
|
|
|
|
|
|
|
|
hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL );
|
|
|
|
*lphRead = ConvertToGlobalHandle( hTemp );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
if( ( !DuplicateHandle( GetCurrentProcess(), *lphStart,
|
|
|
|
hDestProcess, &hAppStart,
|
|
|
|
0, FALSE, DUPLICATE_SAME_ACCESS ) ) ||
|
|
|
|
( !DuplicateHandle( GetCurrentProcess(), *lphDeath,
|
|
|
|
hDestProcess, &hAppDeath,
|
|
|
|
0, FALSE, DUPLICATE_SAME_ACCESS ) ) ||
|
|
|
|
( !DuplicateHandle( GetCurrentProcess(), *lphRead,
|
|
|
|
hDestProcess, &hAppRead,
|
|
|
|
0, FALSE, DUPLICATE_SAME_ACCESS ) )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
/* FIXME: Handle leak... */
|
|
|
|
ERR( "Unable to dup handles\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !DPLAYX_SetLobbyHandles( dwDestProcessId,
|
|
|
|
hAppStart, hAppDeath, hAppRead ) )
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Starts an application and passes to it all the information to
|
|
|
|
* connect to a session.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_RunApplication
|
|
|
|
( LPDIRECTPLAYLOBBYA iface,
|
|
|
|
DWORD dwFlags,
|
|
|
|
LPDWORD lpdwAppID,
|
|
|
|
LPDPLCONNECTION lpConn,
|
|
|
|
HANDLE hReceiveEvent )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,iface);
|
|
|
|
HRESULT hr;
|
|
|
|
RunApplicationEnumStruct enumData;
|
|
|
|
char temp[200];
|
|
|
|
STARTUPINFOA startupInfo;
|
|
|
|
PROCESS_INFORMATION newProcessInfo;
|
|
|
|
LPSTR appName;
|
2000-07-10 15:19:28 +02:00
|
|
|
DWORD dwSuspendCount;
|
2000-08-25 23:58:05 +02:00
|
|
|
HANDLE hStart, hDeath, hSettingRead;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
TRACE( "(%p)->(0x%08lx,%p,%p,%x)\n",
|
|
|
|
This, dwFlags, lpdwAppID, lpConn, hReceiveEvent );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
if( dwFlags != 0 )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
if( DPLAYX_AnyLobbiesWaitingForConnSettings() )
|
|
|
|
{
|
|
|
|
FIXME( "Waiting lobby not being handled correctly\n" );
|
|
|
|
}
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
EnterCriticalSection( &This->unk->DPL_lock );
|
|
|
|
|
|
|
|
ZeroMemory( &enumData, sizeof( enumData ) );
|
|
|
|
enumData.This = This;
|
|
|
|
enumData.appGUID = lpConn->lpSessionDesc->guidApplication;
|
|
|
|
|
|
|
|
/* Our callback function will fill up the enumData structure with all the information
|
|
|
|
required to start a new process */
|
|
|
|
IDirectPlayLobby_EnumLocalApplications( iface, RunApplicationA_EnumLocalApplications,
|
|
|
|
(LPVOID)(&enumData), 0 );
|
|
|
|
|
|
|
|
/* First the application name */
|
|
|
|
strcpy( temp, enumData.lpszPath );
|
|
|
|
strcat( temp, "\\" );
|
|
|
|
strcat( temp, enumData.lpszFileName );
|
|
|
|
HeapFree( GetProcessHeap(), 0, enumData.lpszPath );
|
|
|
|
HeapFree( GetProcessHeap(), 0, enumData.lpszFileName );
|
2000-11-16 01:28:52 +01:00
|
|
|
if ((appName = HeapAlloc( GetProcessHeap(), 0, strlen(temp)+1 ))) strcpy( appName, temp );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
/* Now the command line */
|
|
|
|
strcat( temp, " " );
|
|
|
|
strcat( temp, enumData.lpszCommandLine );
|
|
|
|
HeapFree( GetProcessHeap(), 0, enumData.lpszCommandLine );
|
2000-11-16 01:28:52 +01:00
|
|
|
if ((enumData.lpszCommandLine = HeapAlloc( GetProcessHeap(), 0, strlen(temp)+1 )))
|
|
|
|
strcpy( enumData.lpszCommandLine, temp );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
ZeroMemory( &startupInfo, sizeof( startupInfo ) );
|
|
|
|
startupInfo.cb = sizeof( startupInfo );
|
|
|
|
/* FIXME: Should any fields be filled in? */
|
|
|
|
|
|
|
|
ZeroMemory( &newProcessInfo, sizeof( newProcessInfo ) );
|
|
|
|
|
|
|
|
if( !CreateProcessA( appName,
|
|
|
|
enumData.lpszCommandLine,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
FALSE,
|
|
|
|
CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE | CREATE_SUSPENDED, /* Creation Flags */
|
|
|
|
NULL,
|
|
|
|
enumData.lpszCurrentDirectory,
|
|
|
|
&startupInfo,
|
|
|
|
&newProcessInfo
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
ERR( "Failed to create process for app %s\n", appName );
|
1999-11-25 23:04:53 +01:00
|
|
|
|
|
|
|
HeapFree( GetProcessHeap(), 0, appName );
|
|
|
|
HeapFree( GetProcessHeap(), 0, enumData.lpszCommandLine );
|
|
|
|
HeapFree( GetProcessHeap(), 0, enumData.lpszCurrentDirectory );
|
|
|
|
|
|
|
|
return DPERR_CANTCREATEPROCESS;
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HeapFree( GetProcessHeap(), 0, appName );
|
|
|
|
HeapFree( GetProcessHeap(), 0, enumData.lpszCommandLine );
|
|
|
|
HeapFree( GetProcessHeap(), 0, enumData.lpszCurrentDirectory );
|
|
|
|
|
|
|
|
/* Reserve this global application id! */
|
2000-08-25 23:58:05 +02:00
|
|
|
if( !DPLAYX_CreateLobbyApplication( newProcessInfo.dwProcessId ) )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
ERR( "Unable to create global application data for 0x%08lx\n",
|
|
|
|
newProcessInfo.dwProcessId );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
hr = IDirectPlayLobby_SetConnectionSettings( iface, 0, newProcessInfo.dwProcessId, lpConn );
|
|
|
|
|
|
|
|
if( hr != DP_OK )
|
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
ERR( "SetConnectionSettings failure %s\n", DPLAYX_HresultToString( hr ) );
|
1999-11-04 03:17:03 +01:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Setup the handles for application notification */
|
|
|
|
DPL_CreateAndSetLobbyHandles( newProcessInfo.dwProcessId,
|
|
|
|
newProcessInfo.hProcess,
|
|
|
|
&hStart, &hDeath, &hSettingRead );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Setup the message thread ID */
|
|
|
|
This->dpl->dwMsgThread =
|
|
|
|
CreateLobbyMessageReceptionThread( hReceiveEvent, hStart, hDeath, hSettingRead );
|
|
|
|
|
|
|
|
DPLAYX_SetLobbyMsgThreadId( newProcessInfo.dwProcessId, This->dpl->dwMsgThread );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
LeaveCriticalSection( &This->unk->DPL_lock );
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Everything seems to have been set correctly, update the dwAppID */
|
|
|
|
*lpdwAppID = newProcessInfo.dwProcessId;
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Unsuspend the process - should return the prev suspension count */
|
|
|
|
if( ( dwSuspendCount = ResumeThread( newProcessInfo.hThread ) ) != 1 )
|
|
|
|
{
|
|
|
|
ERR( "ResumeThread failed with 0x%08lx\n", dwSuspendCount );
|
|
|
|
}
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyWImpl_RunApplication
|
|
|
|
( LPDIRECTPLAYLOBBY iface,
|
|
|
|
DWORD dwFlags,
|
|
|
|
LPDWORD lpdwAppID,
|
|
|
|
LPDPLCONNECTION lpConn,
|
|
|
|
HANDLE hReceiveEvent )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyWImpl,iface);
|
1999-11-28 21:31:04 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p,%p,%p):stub\n", This, dwFlags, lpdwAppID, lpConn, (void *)hReceiveEvent );
|
1999-09-28 18:35:32 +02:00
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Sends a message between the application and the lobby client.
|
|
|
|
* All messages are queued until received.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_SendLobbyMessage
|
|
|
|
( LPDIRECTPLAYLOBBYA iface,
|
|
|
|
DWORD dwFlags,
|
|
|
|
DWORD dwAppID,
|
|
|
|
LPVOID lpData,
|
|
|
|
DWORD dwDataSize )
|
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyWImpl_SendLobbyMessage
|
|
|
|
( LPDIRECTPLAYLOBBY iface,
|
|
|
|
DWORD dwFlags,
|
|
|
|
DWORD dwAppID,
|
|
|
|
LPVOID lpData,
|
|
|
|
DWORD dwDataSize )
|
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Modifies the DPLCONNECTION structure to contain all information
|
|
|
|
* needed to start and connect an application.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyWImpl_SetConnectionSettings
|
|
|
|
( LPDIRECTPLAYLOBBY iface,
|
|
|
|
DWORD dwFlags,
|
|
|
|
DWORD dwAppID,
|
|
|
|
LPDPLCONNECTION lpConn )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyWImpl,iface);
|
|
|
|
HRESULT hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
TRACE("(%p)->(0x%08lx,0x%08lx,%p)\n", This, dwFlags, dwAppID, lpConn );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
EnterCriticalSection( &This->unk->DPL_lock );
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
hr = DPLAYX_SetConnectionSettingsW( dwFlags, dwAppID, lpConn );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* FIXME: Don't think that this is supposed to fail, but the docuementation
|
|
|
|
is somewhat sketchy. I'll try creating a lobby application
|
|
|
|
for this... */
|
|
|
|
if( hr == DPERR_NOTLOBBIED )
|
|
|
|
{
|
|
|
|
FIXME( "Unlobbied app setting connections. Is this correct behavior?\n" );
|
2000-08-25 23:58:05 +02:00
|
|
|
if( dwAppID == 0 )
|
|
|
|
{
|
|
|
|
dwAppID = GetCurrentProcessId();
|
|
|
|
}
|
|
|
|
DPLAYX_CreateLobbyApplication( dwAppID );
|
2000-07-10 15:19:28 +02:00
|
|
|
hr = DPLAYX_SetConnectionSettingsW( dwFlags, dwAppID, lpConn );
|
|
|
|
}
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
LeaveCriticalSection( &This->unk->DPL_lock );
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_SetConnectionSettings
|
|
|
|
( LPDIRECTPLAYLOBBYA iface,
|
|
|
|
DWORD dwFlags,
|
|
|
|
DWORD dwAppID,
|
|
|
|
LPDPLCONNECTION lpConn )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
ICOM_THIS(IDirectPlayLobbyAImpl,iface);
|
|
|
|
HRESULT hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
TRACE("(%p)->(0x%08lx,0x%08lx,%p)\n", This, dwFlags, dwAppID, lpConn );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
EnterCriticalSection( &This->unk->DPL_lock );
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
hr = DPLAYX_SetConnectionSettingsA( dwFlags, dwAppID, lpConn );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
/* FIXME: Don't think that this is supposed to fail, but the docuementation
|
|
|
|
is somewhat sketchy. I'll try creating a lobby application
|
|
|
|
for this... */
|
|
|
|
if( hr == DPERR_NOTLOBBIED )
|
|
|
|
{
|
|
|
|
FIXME( "Unlobbied app setting connections. Is this correct behavior?\n" );
|
|
|
|
dwAppID = GetCurrentProcessId();
|
2000-08-25 23:58:05 +02:00
|
|
|
DPLAYX_CreateLobbyApplication( dwAppID );
|
2000-07-10 15:19:28 +02:00
|
|
|
hr = DPLAYX_SetConnectionSettingsA( dwFlags, dwAppID, lpConn );
|
|
|
|
}
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
LeaveCriticalSection( &This->unk->DPL_lock );
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Registers an event that will be set when a lobby message is received.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_SetLobbyMessageEvent
|
|
|
|
( LPDIRECTPLAYLOBBYA iface,
|
|
|
|
DWORD dwFlags,
|
|
|
|
DWORD dwAppID,
|
|
|
|
HANDLE hReceiveEvent )
|
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobbyWImpl_SetLobbyMessageEvent
|
|
|
|
( LPDIRECTPLAYLOBBY iface,
|
|
|
|
DWORD dwFlags,
|
|
|
|
DWORD dwAppID,
|
|
|
|
HANDLE hReceiveEvent )
|
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
/* DPL 2 methods */
|
1999-09-28 18:35:32 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2WImpl_CreateCompoundAddress
|
|
|
|
( LPDIRECTPLAYLOBBY2 iface,
|
|
|
|
LPCDPCOMPOUNDADDRESSELEMENT lpElements,
|
|
|
|
DWORD dwElementCount,
|
|
|
|
LPVOID lpAddress,
|
|
|
|
LPDWORD lpdwAddressSize )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
return DPL_CreateCompoundAddress( lpElements, dwElementCount, lpAddress, lpdwAddressSize, FALSE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobby2AImpl_CreateCompoundAddress
|
|
|
|
( LPDIRECTPLAYLOBBY2A iface,
|
|
|
|
LPCDPCOMPOUNDADDRESSELEMENT lpElements,
|
|
|
|
DWORD dwElementCount,
|
|
|
|
LPVOID lpAddress,
|
|
|
|
LPDWORD lpdwAddressSize )
|
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
return DPL_CreateCompoundAddress( lpElements, dwElementCount, lpAddress, lpdwAddressSize, TRUE );
|
|
|
|
}
|
|
|
|
|
1999-11-25 23:04:53 +01:00
|
|
|
HRESULT DPL_CreateCompoundAddress
|
1999-11-04 03:17:03 +01:00
|
|
|
( LPCDPCOMPOUNDADDRESSELEMENT lpElements,
|
|
|
|
DWORD dwElementCount,
|
|
|
|
LPVOID lpAddress,
|
|
|
|
LPDWORD lpdwAddressSize,
|
|
|
|
BOOL bAnsiInterface )
|
|
|
|
{
|
|
|
|
DWORD dwSizeRequired = 0;
|
|
|
|
DWORD dwElements;
|
|
|
|
LPCDPCOMPOUNDADDRESSELEMENT lpOrigElements = lpElements;
|
|
|
|
|
|
|
|
TRACE("(%p,0x%08lx,%p,%p)\n", lpElements, dwElementCount, lpAddress, lpdwAddressSize );
|
|
|
|
|
|
|
|
/* Parameter check */
|
|
|
|
if( ( lpElements == NULL ) ||
|
|
|
|
( dwElementCount == 0 ) /* FIXME: Not sure if this is a failure case */
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add the total size chunk */
|
|
|
|
dwSizeRequired += sizeof( DPADDRESS ) + sizeof( DWORD );
|
|
|
|
|
|
|
|
/* Calculate the size of the buffer required */
|
|
|
|
for ( dwElements = dwElementCount; dwElements > 0; --dwElements, ++lpElements )
|
|
|
|
{
|
|
|
|
if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ServiceProvider ) ) ||
|
|
|
|
( IsEqualGUID( &lpElements->guidDataType, &DPAID_LobbyProvider ) )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
dwSizeRequired += sizeof( DPADDRESS ) + sizeof( GUID );
|
|
|
|
}
|
|
|
|
else if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_Phone ) ) ||
|
|
|
|
( IsEqualGUID( &lpElements->guidDataType, &DPAID_Modem ) ) ||
|
|
|
|
( IsEqualGUID( &lpElements->guidDataType, &DPAID_INet ) )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if( !bAnsiInterface )
|
|
|
|
{
|
|
|
|
ERR( "Ansi GUIDs used for unicode interface\n" );
|
|
|
|
return DPERR_INVALIDFLAGS;
|
|
|
|
}
|
|
|
|
|
|
|
|
dwSizeRequired += sizeof( DPADDRESS ) + lpElements->dwDataSize;
|
|
|
|
}
|
|
|
|
else if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_PhoneW ) ) ||
|
|
|
|
( IsEqualGUID( &lpElements->guidDataType, &DPAID_ModemW ) ) ||
|
|
|
|
( IsEqualGUID( &lpElements->guidDataType, &DPAID_INetW ) )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if( bAnsiInterface )
|
|
|
|
{
|
|
|
|
ERR( "Unicode GUIDs used for ansi interface\n" );
|
|
|
|
return DPERR_INVALIDFLAGS;
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME( "Right size for unicode interface?\n" );
|
|
|
|
dwSizeRequired += sizeof( DPADDRESS ) + lpElements->dwDataSize * sizeof( WCHAR );
|
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INetPort ) )
|
|
|
|
{
|
|
|
|
dwSizeRequired += sizeof( DPADDRESS ) + sizeof( WORD );
|
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ComPort ) )
|
|
|
|
{
|
|
|
|
FIXME( "Right size for unicode interface?\n" );
|
|
|
|
dwSizeRequired += sizeof( DPADDRESS ) + sizeof( DPCOMPORTADDRESS ); /* FIXME: Right size? */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-01-18 06:09:49 +01:00
|
|
|
ERR( "Unknown GUID %s\n", debugstr_guid(&lpElements->guidDataType) );
|
1999-11-04 03:17:03 +01:00
|
|
|
return DPERR_INVALIDFLAGS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The user wants to know how big a buffer to allocate for us */
|
|
|
|
if( ( lpAddress == NULL ) ||
|
|
|
|
( *lpdwAddressSize < dwSizeRequired )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
*lpdwAddressSize = dwSizeRequired;
|
|
|
|
return DPERR_BUFFERTOOSMALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add the total size chunk */
|
|
|
|
{
|
|
|
|
LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( &lpdpAddress->guidDataType, &DPAID_TotalSize, sizeof( GUID ) );
|
1999-11-04 03:17:03 +01:00
|
|
|
lpdpAddress->dwDataSize = sizeof( DWORD );
|
2000-02-26 14:17:55 +01:00
|
|
|
lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
*(LPDWORD)lpAddress = dwSizeRequired;
|
2000-02-26 14:17:55 +01:00
|
|
|
lpAddress = (char *) lpAddress + sizeof( DWORD );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Calculate the size of the buffer required */
|
|
|
|
for( dwElements = dwElementCount, lpElements = lpOrigElements;
|
|
|
|
dwElements > 0;
|
|
|
|
--dwElements, ++lpElements )
|
|
|
|
{
|
|
|
|
if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ServiceProvider ) ) ||
|
|
|
|
( IsEqualGUID( &lpElements->guidDataType, &DPAID_LobbyProvider ) )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
|
|
|
|
sizeof( GUID ) );
|
1999-11-04 03:17:03 +01:00
|
|
|
lpdpAddress->dwDataSize = sizeof( GUID );
|
2000-02-26 14:17:55 +01:00
|
|
|
lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( lpAddress, lpElements->lpData, sizeof( GUID ) );
|
2000-02-26 14:17:55 +01:00
|
|
|
lpAddress = (char *) lpAddress + sizeof( GUID );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
else if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_Phone ) ) ||
|
|
|
|
( IsEqualGUID( &lpElements->guidDataType, &DPAID_Modem ) ) ||
|
|
|
|
( IsEqualGUID( &lpElements->guidDataType, &DPAID_INet ) )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
|
|
|
|
sizeof( GUID ) );
|
1999-11-04 03:17:03 +01:00
|
|
|
lpdpAddress->dwDataSize = lpElements->dwDataSize;
|
2000-02-26 14:17:55 +01:00
|
|
|
lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
lstrcpynA( (LPSTR)lpAddress,
|
|
|
|
(LPCSTR)lpElements->lpData,
|
|
|
|
lpElements->dwDataSize );
|
2000-02-26 14:17:55 +01:00
|
|
|
lpAddress = (char *) lpAddress + lpElements->dwDataSize;
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
else if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_PhoneW ) ) ||
|
|
|
|
( IsEqualGUID( &lpElements->guidDataType, &DPAID_ModemW ) ) ||
|
|
|
|
( IsEqualGUID( &lpElements->guidDataType, &DPAID_INetW ) )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
|
|
|
|
sizeof( GUID ) );
|
1999-11-04 03:17:03 +01:00
|
|
|
lpdpAddress->dwDataSize = lpElements->dwDataSize;
|
2000-02-26 14:17:55 +01:00
|
|
|
lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
lstrcpynW( (LPWSTR)lpAddress,
|
|
|
|
(LPCWSTR)lpElements->lpData,
|
|
|
|
lpElements->dwDataSize );
|
2000-02-26 14:17:55 +01:00
|
|
|
lpAddress = (char *) lpAddress + lpElements->dwDataSize * sizeof( WCHAR );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INetPort ) )
|
|
|
|
{
|
|
|
|
LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
|
|
|
|
sizeof( GUID ) );
|
1999-11-04 03:17:03 +01:00
|
|
|
lpdpAddress->dwDataSize = lpElements->dwDataSize;
|
2000-02-26 14:17:55 +01:00
|
|
|
lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
*((LPWORD)lpAddress) = *((LPWORD)lpElements->lpData);
|
2000-02-26 14:17:55 +01:00
|
|
|
lpAddress = (char *) lpAddress + sizeof( WORD );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ComPort ) )
|
|
|
|
{
|
|
|
|
LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
|
|
|
|
sizeof( GUID ) );
|
1999-11-04 03:17:03 +01:00
|
|
|
lpdpAddress->dwDataSize = lpElements->dwDataSize;
|
2000-02-26 14:17:55 +01:00
|
|
|
lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
CopyMemory( lpAddress, lpElements->lpData, sizeof( DPADDRESS ) );
|
2000-02-26 14:17:55 +01:00
|
|
|
lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* DPL 3 methods */
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobby3WImpl_ConnectEx
|
2000-07-10 15:19:28 +02:00
|
|
|
( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags, REFIID riid,
|
|
|
|
LPVOID* lplpDP, IUnknown* pUnk )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
ICOM_THIS( IDirectPlayLobbyAImpl, iface );
|
|
|
|
return DPL_ConnectEx( This, dwFlags, riid, lplpDP, pUnk );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_ConnectEx
|
2000-07-10 15:19:28 +02:00
|
|
|
( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags, REFIID riid,
|
|
|
|
LPVOID* lplpDP, IUnknown* pUnk )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
ICOM_THIS( IDirectPlayLobbyAImpl, iface );
|
|
|
|
return DPL_ConnectEx( This, dwFlags, riid, lplpDP, pUnk );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobby3WImpl_RegisterApplication
|
|
|
|
( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags, LPDPAPPLICATIONDESC lpAppDesc )
|
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_RegisterApplication
|
|
|
|
( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags, LPDPAPPLICATIONDESC lpAppDesc )
|
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobby3WImpl_UnregisterApplication
|
|
|
|
( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags, REFGUID lpAppDesc )
|
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_UnregisterApplication
|
|
|
|
( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags, REFGUID lpAppDesc )
|
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobby3WImpl_WaitForConnectionSettings
|
|
|
|
( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags )
|
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
HRESULT hr = DP_OK;
|
|
|
|
BOOL bStartWait = (dwFlags & DPLWAIT_CANCEL) ? FALSE : TRUE;
|
|
|
|
|
|
|
|
TRACE( "(%p)->(0x%08lx)\n", iface, dwFlags );
|
|
|
|
|
|
|
|
if( DPLAYX_WaitForConnectionSettings( bStartWait ) )
|
|
|
|
{
|
|
|
|
/* FIXME: What is the correct error return code? */
|
|
|
|
hr = DPERR_NOTLOBBIED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_WaitForConnectionSettings
|
|
|
|
( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags )
|
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
HRESULT hr = DP_OK;
|
|
|
|
BOOL bStartWait = (dwFlags & DPLWAIT_CANCEL) ? FALSE : TRUE;
|
|
|
|
|
|
|
|
TRACE( "(%p)->(0x%08lx)\n", iface, dwFlags );
|
|
|
|
|
|
|
|
if( DPLAYX_WaitForConnectionSettings( bStartWait ) )
|
|
|
|
{
|
|
|
|
/* FIXME: What is the correct error return code? */
|
|
|
|
hr = DPERR_NOTLOBBIED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Virtual Table definitions for DPL{1,2,3}{A,W} */
|
|
|
|
|
|
|
|
/* Note: Hack so we can reuse the old functions without compiler warnings */
|
|
|
|
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
|
2001-01-04 23:59:48 +01:00
|
|
|
# define XCAST(fun) (typeof(directPlayLobbyAVT.fun))
|
1999-09-28 18:35:32 +02:00
|
|
|
#else
|
|
|
|
# define XCAST(fun) (void*)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Direct Play Lobby 1 (ascii) Virtual Table for methods */
|
|
|
|
/* All lobby 1 methods are exactly the same except QueryInterface */
|
|
|
|
static struct ICOM_VTABLE(IDirectPlayLobby) directPlayLobbyAVT =
|
|
|
|
{
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
XCAST(QueryInterface)DPL_QueryInterface,
|
|
|
|
XCAST(AddRef)DPL_AddRef,
|
|
|
|
XCAST(Release)DPL_Release,
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
IDirectPlayLobbyAImpl_Connect,
|
|
|
|
IDirectPlayLobbyAImpl_CreateAddress,
|
|
|
|
IDirectPlayLobbyAImpl_EnumAddress,
|
|
|
|
IDirectPlayLobbyAImpl_EnumAddressTypes,
|
|
|
|
IDirectPlayLobbyAImpl_EnumLocalApplications,
|
|
|
|
IDirectPlayLobbyAImpl_GetConnectionSettings,
|
|
|
|
IDirectPlayLobbyAImpl_ReceiveLobbyMessage,
|
|
|
|
IDirectPlayLobbyAImpl_RunApplication,
|
|
|
|
IDirectPlayLobbyAImpl_SendLobbyMessage,
|
|
|
|
IDirectPlayLobbyAImpl_SetConnectionSettings,
|
|
|
|
IDirectPlayLobbyAImpl_SetLobbyMessageEvent
|
|
|
|
};
|
|
|
|
#undef XCAST
|
|
|
|
|
|
|
|
|
|
|
|
/* Note: Hack so we can reuse the old functions without compiler warnings */
|
|
|
|
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
|
2001-01-04 23:59:48 +01:00
|
|
|
# define XCAST(fun) (typeof(directPlayLobbyWVT.fun))
|
1999-09-28 18:35:32 +02:00
|
|
|
#else
|
|
|
|
# define XCAST(fun) (void*)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Direct Play Lobby 1 (unicode) Virtual Table for methods */
|
|
|
|
static ICOM_VTABLE(IDirectPlayLobby) directPlayLobbyWVT =
|
|
|
|
{
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
XCAST(QueryInterface)DPL_QueryInterface,
|
|
|
|
XCAST(AddRef)DPL_AddRef,
|
|
|
|
XCAST(Release)DPL_Release,
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
IDirectPlayLobbyWImpl_Connect,
|
|
|
|
IDirectPlayLobbyWImpl_CreateAddress,
|
|
|
|
IDirectPlayLobbyWImpl_EnumAddress,
|
|
|
|
IDirectPlayLobbyWImpl_EnumAddressTypes,
|
|
|
|
IDirectPlayLobbyWImpl_EnumLocalApplications,
|
|
|
|
IDirectPlayLobbyWImpl_GetConnectionSettings,
|
|
|
|
IDirectPlayLobbyWImpl_ReceiveLobbyMessage,
|
|
|
|
IDirectPlayLobbyWImpl_RunApplication,
|
|
|
|
IDirectPlayLobbyWImpl_SendLobbyMessage,
|
|
|
|
IDirectPlayLobbyWImpl_SetConnectionSettings,
|
|
|
|
IDirectPlayLobbyWImpl_SetLobbyMessageEvent
|
|
|
|
};
|
|
|
|
#undef XCAST
|
|
|
|
|
|
|
|
/* Note: Hack so we can reuse the old functions without compiler warnings */
|
|
|
|
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
|
2001-01-04 23:59:48 +01:00
|
|
|
# define XCAST(fun) (typeof(directPlayLobby2AVT.fun))
|
1999-09-28 18:35:32 +02:00
|
|
|
#else
|
|
|
|
# define XCAST(fun) (void*)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Direct Play Lobby 2 (ascii) Virtual Table for methods */
|
|
|
|
static ICOM_VTABLE(IDirectPlayLobby2) directPlayLobby2AVT =
|
|
|
|
{
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
XCAST(QueryInterface)DPL_QueryInterface,
|
|
|
|
XCAST(AddRef)DPL_AddRef,
|
|
|
|
XCAST(Release)DPL_Release,
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
XCAST(Connect)IDirectPlayLobbyAImpl_Connect,
|
|
|
|
XCAST(CreateAddress)IDirectPlayLobbyAImpl_CreateAddress,
|
|
|
|
XCAST(EnumAddress)IDirectPlayLobbyAImpl_EnumAddress,
|
|
|
|
XCAST(EnumAddressTypes)IDirectPlayLobbyAImpl_EnumAddressTypes,
|
|
|
|
XCAST(EnumLocalApplications)IDirectPlayLobbyAImpl_EnumLocalApplications,
|
|
|
|
XCAST(GetConnectionSettings)IDirectPlayLobbyAImpl_GetConnectionSettings,
|
|
|
|
XCAST(ReceiveLobbyMessage)IDirectPlayLobbyAImpl_ReceiveLobbyMessage,
|
|
|
|
XCAST(RunApplication)IDirectPlayLobbyAImpl_RunApplication,
|
|
|
|
XCAST(SendLobbyMessage)IDirectPlayLobbyAImpl_SendLobbyMessage,
|
|
|
|
XCAST(SetConnectionSettings)IDirectPlayLobbyAImpl_SetConnectionSettings,
|
|
|
|
XCAST(SetLobbyMessageEvent)IDirectPlayLobbyAImpl_SetLobbyMessageEvent,
|
|
|
|
|
|
|
|
IDirectPlayLobby2AImpl_CreateCompoundAddress
|
|
|
|
};
|
|
|
|
#undef XCAST
|
|
|
|
|
|
|
|
/* Note: Hack so we can reuse the old functions without compiler warnings */
|
|
|
|
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
|
2001-01-04 23:59:48 +01:00
|
|
|
# define XCAST(fun) (typeof(directPlayLobby2AVT.fun))
|
1999-09-28 18:35:32 +02:00
|
|
|
#else
|
|
|
|
# define XCAST(fun) (void*)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Direct Play Lobby 2 (unicode) Virtual Table for methods */
|
|
|
|
static ICOM_VTABLE(IDirectPlayLobby2) directPlayLobby2WVT =
|
|
|
|
{
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
XCAST(QueryInterface)DPL_QueryInterface,
|
|
|
|
XCAST(AddRef)DPL_AddRef,
|
|
|
|
XCAST(Release)DPL_Release,
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
XCAST(Connect)IDirectPlayLobbyWImpl_Connect,
|
|
|
|
XCAST(CreateAddress)IDirectPlayLobbyWImpl_CreateAddress,
|
|
|
|
XCAST(EnumAddress)IDirectPlayLobbyWImpl_EnumAddress,
|
|
|
|
XCAST(EnumAddressTypes)IDirectPlayLobbyWImpl_EnumAddressTypes,
|
|
|
|
XCAST(EnumLocalApplications)IDirectPlayLobbyWImpl_EnumLocalApplications,
|
|
|
|
XCAST(GetConnectionSettings)IDirectPlayLobbyWImpl_GetConnectionSettings,
|
|
|
|
XCAST(ReceiveLobbyMessage)IDirectPlayLobbyWImpl_ReceiveLobbyMessage,
|
|
|
|
XCAST(RunApplication)IDirectPlayLobbyWImpl_RunApplication,
|
|
|
|
XCAST(SendLobbyMessage)IDirectPlayLobbyWImpl_SendLobbyMessage,
|
|
|
|
XCAST(SetConnectionSettings)IDirectPlayLobbyWImpl_SetConnectionSettings,
|
|
|
|
XCAST(SetLobbyMessageEvent)IDirectPlayLobbyWImpl_SetLobbyMessageEvent,
|
|
|
|
|
|
|
|
IDirectPlayLobby2WImpl_CreateCompoundAddress
|
|
|
|
};
|
|
|
|
#undef XCAST
|
|
|
|
|
|
|
|
/* Direct Play Lobby 3 (ascii) Virtual Table for methods */
|
|
|
|
|
|
|
|
/* Note: Hack so we can reuse the old functions without compiler warnings */
|
|
|
|
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
|
2001-01-04 23:59:48 +01:00
|
|
|
# define XCAST(fun) (typeof(directPlayLobby3AVT.fun))
|
1999-09-28 18:35:32 +02:00
|
|
|
#else
|
|
|
|
# define XCAST(fun) (void*)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static ICOM_VTABLE(IDirectPlayLobby3) directPlayLobby3AVT =
|
|
|
|
{
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
2000-08-25 23:58:05 +02:00
|
|
|
XCAST(QueryInterface)DPL_QueryInterface,
|
|
|
|
XCAST(AddRef)DPL_AddRef,
|
|
|
|
XCAST(Release)DPL_Release,
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
XCAST(Connect)IDirectPlayLobbyAImpl_Connect,
|
|
|
|
XCAST(CreateAddress)IDirectPlayLobbyAImpl_CreateAddress,
|
|
|
|
XCAST(EnumAddress)IDirectPlayLobbyAImpl_EnumAddress,
|
|
|
|
XCAST(EnumAddressTypes)IDirectPlayLobbyAImpl_EnumAddressTypes,
|
|
|
|
XCAST(EnumLocalApplications)IDirectPlayLobbyAImpl_EnumLocalApplications,
|
|
|
|
XCAST(GetConnectionSettings)IDirectPlayLobbyAImpl_GetConnectionSettings,
|
|
|
|
XCAST(ReceiveLobbyMessage)IDirectPlayLobbyAImpl_ReceiveLobbyMessage,
|
|
|
|
XCAST(RunApplication)IDirectPlayLobbyAImpl_RunApplication,
|
|
|
|
XCAST(SendLobbyMessage)IDirectPlayLobbyAImpl_SendLobbyMessage,
|
|
|
|
XCAST(SetConnectionSettings)IDirectPlayLobbyAImpl_SetConnectionSettings,
|
|
|
|
XCAST(SetLobbyMessageEvent)IDirectPlayLobbyAImpl_SetLobbyMessageEvent,
|
|
|
|
|
|
|
|
XCAST(CreateCompoundAddress)IDirectPlayLobby2AImpl_CreateCompoundAddress,
|
|
|
|
|
|
|
|
IDirectPlayLobby3AImpl_ConnectEx,
|
|
|
|
IDirectPlayLobby3AImpl_RegisterApplication,
|
|
|
|
IDirectPlayLobby3AImpl_UnregisterApplication,
|
|
|
|
IDirectPlayLobby3AImpl_WaitForConnectionSettings
|
|
|
|
};
|
|
|
|
#undef XCAST
|
|
|
|
|
|
|
|
/* Direct Play Lobby 3 (unicode) Virtual Table for methods */
|
|
|
|
|
|
|
|
/* Note: Hack so we can reuse the old functions without compiler warnings */
|
|
|
|
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
|
2001-01-04 23:59:48 +01:00
|
|
|
# define XCAST(fun) (typeof(directPlayLobby3WVT.fun))
|
1999-09-28 18:35:32 +02:00
|
|
|
#else
|
|
|
|
# define XCAST(fun) (void*)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static ICOM_VTABLE(IDirectPlayLobby3) directPlayLobby3WVT =
|
|
|
|
{
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
2000-08-25 23:58:05 +02:00
|
|
|
XCAST(QueryInterface)DPL_QueryInterface,
|
|
|
|
XCAST(AddRef)DPL_AddRef,
|
|
|
|
XCAST(Release)DPL_Release,
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
XCAST(Connect)IDirectPlayLobbyWImpl_Connect,
|
|
|
|
XCAST(CreateAddress)IDirectPlayLobbyWImpl_CreateAddress,
|
|
|
|
XCAST(EnumAddress)IDirectPlayLobbyWImpl_EnumAddress,
|
|
|
|
XCAST(EnumAddressTypes)IDirectPlayLobbyWImpl_EnumAddressTypes,
|
|
|
|
XCAST(EnumLocalApplications)IDirectPlayLobbyWImpl_EnumLocalApplications,
|
|
|
|
XCAST(GetConnectionSettings)IDirectPlayLobbyWImpl_GetConnectionSettings,
|
|
|
|
XCAST(ReceiveLobbyMessage)IDirectPlayLobbyWImpl_ReceiveLobbyMessage,
|
|
|
|
XCAST(RunApplication)IDirectPlayLobbyWImpl_RunApplication,
|
|
|
|
XCAST(SendLobbyMessage)IDirectPlayLobbyWImpl_SendLobbyMessage,
|
|
|
|
XCAST(SetConnectionSettings)IDirectPlayLobbyWImpl_SetConnectionSettings,
|
|
|
|
XCAST(SetLobbyMessageEvent)IDirectPlayLobbyWImpl_SetLobbyMessageEvent,
|
|
|
|
|
|
|
|
XCAST(CreateCompoundAddress)IDirectPlayLobby2WImpl_CreateCompoundAddress,
|
|
|
|
|
|
|
|
IDirectPlayLobby3WImpl_ConnectEx,
|
|
|
|
IDirectPlayLobby3WImpl_RegisterApplication,
|
|
|
|
IDirectPlayLobby3WImpl_UnregisterApplication,
|
|
|
|
IDirectPlayLobby3WImpl_WaitForConnectionSettings
|
|
|
|
};
|
|
|
|
#undef XCAST
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************
|
|
|
|
*
|
2000-08-25 23:58:05 +02:00
|
|
|
* Direct Play Lobby Interface Implementation
|
1999-09-28 18:35:32 +02:00
|
|
|
*
|
|
|
|
*********************************************************/
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* DirectPlayLobbyCreateA (DPLAYX.4)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DirectPlayLobbyCreateA( LPGUID lpGUIDDSP,
|
|
|
|
LPDIRECTPLAYLOBBYA *lplpDPL,
|
|
|
|
IUnknown *lpUnk,
|
|
|
|
LPVOID lpData,
|
|
|
|
DWORD dwDataSize )
|
|
|
|
{
|
|
|
|
TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08lx\n",
|
|
|
|
lpGUIDDSP,lplpDPL,lpUnk,lpData,dwDataSize);
|
|
|
|
|
|
|
|
/* Parameter Check: lpGUIDSP, lpUnk & lpData must be NULL. dwDataSize must
|
|
|
|
* equal 0. These fields are mostly for future expansion.
|
|
|
|
*/
|
2000-08-25 23:58:05 +02:00
|
|
|
if ( lpGUIDDSP || lpData || dwDataSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
*lplpDPL = NULL;
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
if( lpUnk )
|
|
|
|
{
|
|
|
|
*lplpDPL = NULL;
|
|
|
|
ERR("Bad parameters!\n" );
|
|
|
|
return CLASS_E_NOAGGREGATION;
|
|
|
|
}
|
|
|
|
|
|
|
|
return DPL_CreateInterface( &IID_IDirectPlayLobbyA, (void**)lplpDPL );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* DirectPlayLobbyCreateW (DPLAYX.5)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DirectPlayLobbyCreateW( LPGUID lpGUIDDSP,
|
|
|
|
LPDIRECTPLAYLOBBY *lplpDPL,
|
|
|
|
IUnknown *lpUnk,
|
|
|
|
LPVOID lpData,
|
|
|
|
DWORD dwDataSize )
|
|
|
|
{
|
|
|
|
TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08lx\n",
|
|
|
|
lpGUIDDSP,lplpDPL,lpUnk,lpData,dwDataSize);
|
|
|
|
|
|
|
|
/* Parameter Check: lpGUIDSP, lpUnk & lpData must be NULL. dwDataSize must
|
|
|
|
* equal 0. These fields are mostly for future expansion.
|
|
|
|
*/
|
2000-05-30 22:08:32 +02:00
|
|
|
if ( lpGUIDDSP || lpData || dwDataSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
*lplpDPL = NULL;
|
|
|
|
ERR("Bad parameters!\n" );
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
2000-05-30 22:08:32 +02:00
|
|
|
if( lpUnk )
|
|
|
|
{
|
|
|
|
*lplpDPL = NULL;
|
|
|
|
ERR("Bad parameters!\n" );
|
|
|
|
return CLASS_E_NOAGGREGATION;
|
|
|
|
}
|
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
return DPL_CreateInterface( &IID_IDirectPlayLobby, (void**)lplpDPL );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|