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
|
|
|
*
|
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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1999-09-28 18:35:32 +02:00
|
|
|
*/
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2001-01-22 03:17:29 +01:00
|
|
|
#include <string.h>
|
2002-12-10 23:56:43 +01:00
|
|
|
|
2013-04-13 21:43:24 +02:00
|
|
|
#define COBJMACROS
|
2003-01-07 21:36:20 +01:00
|
|
|
#define NONAMELESSUNION
|
2015-03-11 11:30:00 +01:00
|
|
|
|
2002-12-10 23:56:43 +01:00
|
|
|
#include "windef.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winbase.h"
|
1999-09-28 18:35:32 +02:00
|
|
|
#include "winerror.h"
|
|
|
|
#include "winreg.h"
|
2000-11-16 01:28:52 +01:00
|
|
|
#include "winnls.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
#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"
|
2003-09-09 21:39:31 +02:00
|
|
|
#include "dplobby.h"
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dplay);
|
1999-09-28 18:35:32 +02:00
|
|
|
|
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,
|
2011-05-13 17:05:24 +02:00
|
|
|
LPVOID lpAddress, LPDWORD lpdwAddressSize, BOOL bAnsiInterface )DECLSPEC_HIDDEN;
|
1999-11-25 23:04:53 +01:00
|
|
|
|
2007-01-06 20:31:56 +01:00
|
|
|
static HRESULT DPL_CreateAddress( REFGUID guidSP, REFGUID guidDataType, LPCVOID lpData, DWORD dwDataSize,
|
1999-11-25 23:04:53 +01:00
|
|
|
LPVOID lpAddress, LPDWORD lpdwAddressSize, BOOL bAnsiInterface );
|
|
|
|
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectPlayLobby {1,2,3} implementation structure
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
2005-01-26 22:09:04 +01:00
|
|
|
* The philosophy behind this extra pointer dereference is that I wanted to
|
1999-09-28 18:35:32 +02:00
|
|
|
* have the same structure for all types of objects without having to do
|
2005-01-26 22:09:04 +01:00
|
|
|
* a lot of casting. I also only wanted to implement an interface in the
|
1999-09-28 18:35:32 +02:00
|
|
|
* 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
|
|
|
|
2013-04-09 22:32:53 +02:00
|
|
|
typedef struct IDirectPlayLobbyImpl
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-17 22:10:53 +02:00
|
|
|
IDirectPlayLobby IDirectPlayLobby_iface;
|
2013-04-17 22:12:04 +02:00
|
|
|
IDirectPlayLobbyA IDirectPlayLobbyA_iface;
|
2013-04-17 22:13:45 +02:00
|
|
|
IDirectPlayLobby2 IDirectPlayLobby2_iface;
|
2013-04-17 22:12:53 +02:00
|
|
|
IDirectPlayLobby2A IDirectPlayLobby2A_iface;
|
2013-04-11 23:53:38 +02:00
|
|
|
IDirectPlayLobby3 IDirectPlayLobby3_iface;
|
|
|
|
IDirectPlayLobby3A IDirectPlayLobby3A_iface;
|
2013-04-13 21:41:32 +02:00
|
|
|
LONG numIfaces; /* "in use interfaces" refcount */
|
2013-04-17 22:13:45 +02:00
|
|
|
LONG ref, refA, ref2, ref2A, ref3, ref3A;
|
2013-04-11 23:54:45 +02:00
|
|
|
CRITICAL_SECTION lock;
|
2013-04-17 22:14:38 +02:00
|
|
|
HKEY cbkeyhack;
|
|
|
|
DWORD msgtid;
|
|
|
|
DPQ_HEAD( DPLMSG ) msgs; /* List of messages received */
|
2013-04-09 22:32:53 +02:00
|
|
|
} IDirectPlayLobbyImpl;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static inline IDirectPlayLobbyImpl *impl_from_IDirectPlayLobby( IDirectPlayLobby *iface )
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD( iface, IDirectPlayLobbyImpl, IDirectPlayLobby_iface );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:04 +02:00
|
|
|
static inline IDirectPlayLobbyImpl *impl_from_IDirectPlayLobbyA( IDirectPlayLobbyA *iface )
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD( iface, IDirectPlayLobbyImpl, IDirectPlayLobbyA_iface );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static inline IDirectPlayLobbyImpl *impl_from_IDirectPlayLobby2( IDirectPlayLobby2 *iface )
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD( iface, IDirectPlayLobbyImpl, IDirectPlayLobby2_iface );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static inline IDirectPlayLobbyImpl *impl_from_IDirectPlayLobby2A( IDirectPlayLobby2A *iface )
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD( iface, IDirectPlayLobbyImpl, IDirectPlayLobby2A_iface );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:52:18 +02:00
|
|
|
static inline IDirectPlayLobbyImpl *impl_from_IDirectPlayLobby3( IDirectPlayLobby3 *iface )
|
|
|
|
{
|
2013-04-11 23:53:38 +02:00
|
|
|
return CONTAINING_RECORD( iface, IDirectPlayLobbyImpl, IDirectPlayLobby3_iface );
|
2013-04-11 23:52:18 +02:00
|
|
|
}
|
|
|
|
|
2013-04-11 23:50:53 +02:00
|
|
|
static inline IDirectPlayLobbyImpl *impl_from_IDirectPlayLobby3A( IDirectPlayLobby3A *iface )
|
|
|
|
{
|
2013-04-11 23:53:38 +02:00
|
|
|
return CONTAINING_RECORD( iface, IDirectPlayLobbyImpl, IDirectPlayLobby3A_iface );
|
2013-04-11 23:50:53 +02:00
|
|
|
}
|
|
|
|
|
2013-04-13 21:41:32 +02:00
|
|
|
static void dplobby_destroy(IDirectPlayLobbyImpl *obj)
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-17 22:14:38 +02:00
|
|
|
if ( obj->msgtid )
|
|
|
|
FIXME( "Should kill the msg thread\n" );
|
|
|
|
|
|
|
|
DPQ_DELETEQ( obj->msgs, msgs, LPDPLMSG, cbDeleteElemFromHeap );
|
2013-04-13 21:41:32 +02:00
|
|
|
obj->lock.DebugInfo->Spare[0] = 0;
|
|
|
|
DeleteCriticalSection( &obj->lock );
|
|
|
|
HeapFree( GetProcessHeap(), 0, obj );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:04 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_QueryInterface( IDirectPlayLobbyA *iface, REFIID riid,
|
|
|
|
void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobbyA( iface );
|
|
|
|
return IDirectPlayLobby_QueryInterface( &This->IDirectPlayLobby3_iface, riid, ppv );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyImpl_QueryInterface( IDirectPlayLobby *iface, REFIID riid,
|
|
|
|
void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby( iface );
|
|
|
|
return IDirectPlayLobby_QueryInterface( &This->IDirectPlayLobby3_iface, riid, ppv );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2AImpl_QueryInterface( IDirectPlayLobby2A *iface, REFIID riid,
|
|
|
|
void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
return IDirectPlayLobby_QueryInterface( &This->IDirectPlayLobby3_iface, riid, ppv );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2Impl_QueryInterface( IDirectPlayLobby2 *iface, REFIID riid,
|
|
|
|
void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
return IDirectPlayLobby_QueryInterface( &This->IDirectPlayLobby3_iface, riid, ppv );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:52:18 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_QueryInterface( IDirectPlayLobby3A *iface, REFIID riid,
|
|
|
|
void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3A( iface );
|
2013-04-13 21:43:24 +02:00
|
|
|
return IDirectPlayLobby_QueryInterface( &This->IDirectPlayLobby3_iface, riid, ppv );
|
2013-04-11 23:52:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_QueryInterface( IDirectPlayLobby3 *iface, REFIID riid,
|
|
|
|
void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3( iface );
|
2013-04-13 21:43:24 +02:00
|
|
|
|
|
|
|
if ( IsEqualGUID( &IID_IUnknown, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IUnknown %p)\n", This, ppv );
|
2013-04-17 22:10:53 +02:00
|
|
|
*ppv = &This->IDirectPlayLobby_iface;
|
2013-04-13 21:43:24 +02:00
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &IID_IDirectPlayLobby, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IDirectPlayLobby %p)\n", This, ppv );
|
2013-04-17 22:10:53 +02:00
|
|
|
*ppv = &This->IDirectPlayLobby_iface;
|
2013-04-13 21:43:24 +02:00
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &IID_IDirectPlayLobbyA, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IDirectPlayLobbyA %p)\n", This, ppv );
|
2013-04-17 22:12:04 +02:00
|
|
|
*ppv = &This->IDirectPlayLobbyA_iface;
|
2013-04-13 21:43:24 +02:00
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &IID_IDirectPlayLobby2, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IDirectPlayLobby2 %p)\n", This, ppv );
|
2013-04-17 22:13:45 +02:00
|
|
|
*ppv = &This->IDirectPlayLobby2_iface;
|
2013-04-13 21:43:24 +02:00
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &IID_IDirectPlayLobby2A, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IDirectPlayLobby2A %p)\n", This, ppv );
|
2013-04-17 22:12:53 +02:00
|
|
|
*ppv = &This->IDirectPlayLobby2A_iface;
|
2013-04-13 21:43:24 +02:00
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &IID_IDirectPlayLobby3, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IDirectPlay3 %p)\n", This, ppv );
|
|
|
|
*ppv = &This->IDirectPlayLobby3_iface;
|
|
|
|
}
|
|
|
|
else if ( IsEqualGUID( &IID_IDirectPlayLobby3A, riid ) )
|
|
|
|
{
|
|
|
|
TRACE( "(%p)->(IID_IDirectPlayLobby3A %p)\n", This, ppv );
|
|
|
|
*ppv = &This->IDirectPlayLobby3A_iface;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
2013-04-11 23:52:18 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:04 +02:00
|
|
|
static ULONG WINAPI IDirectPlayLobbyAImpl_AddRef( IDirectPlayLobbyA *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobbyA( iface );
|
|
|
|
ULONG ref = InterlockedIncrement( &This->refA );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) refA=%ld\n", This, ref );
|
2013-04-17 22:12:04 +02:00
|
|
|
|
|
|
|
if ( ref == 1 )
|
|
|
|
InterlockedIncrement( &This->numIfaces );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static ULONG WINAPI IDirectPlayLobbyImpl_AddRef( IDirectPlayLobby *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby( iface );
|
|
|
|
ULONG ref = InterlockedIncrement( &This->ref );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref=%ld\n", This, ref );
|
2013-04-17 22:10:53 +02:00
|
|
|
|
|
|
|
if ( ref == 1 )
|
|
|
|
InterlockedIncrement( &This->numIfaces );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static ULONG WINAPI IDirectPlayLobby2AImpl_AddRef(IDirectPlayLobby2A *iface)
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
ULONG ref = InterlockedIncrement( &This->ref2A );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref2A=%ld\n", This, ref );
|
2013-04-17 22:12:53 +02:00
|
|
|
|
|
|
|
if ( ref == 1 )
|
|
|
|
InterlockedIncrement( &This->numIfaces );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static ULONG WINAPI IDirectPlayLobby2Impl_AddRef(IDirectPlayLobby2 *iface)
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
ULONG ref = InterlockedIncrement( &This->ref2 );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref2=%ld\n", This, ref );
|
2013-04-17 22:13:45 +02:00
|
|
|
|
|
|
|
if ( ref == 1 )
|
|
|
|
InterlockedIncrement( &This->numIfaces );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:52:18 +02:00
|
|
|
static ULONG WINAPI IDirectPlayLobby3AImpl_AddRef(IDirectPlayLobby3A *iface)
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3A( iface );
|
2013-04-13 21:41:32 +02:00
|
|
|
ULONG ref = InterlockedIncrement( &This->ref3A );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref3A=%ld\n", This, ref );
|
2013-04-13 21:41:32 +02:00
|
|
|
|
|
|
|
if ( ref == 1 )
|
|
|
|
InterlockedIncrement( &This->numIfaces );
|
|
|
|
|
|
|
|
return ref;
|
2013-04-11 23:52:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IDirectPlayLobby3Impl_AddRef(IDirectPlayLobby3 *iface)
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3( iface );
|
2013-04-13 21:41:32 +02:00
|
|
|
ULONG ref = InterlockedIncrement( &This->ref3 );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref3=%ld\n", This, ref );
|
2013-04-13 21:41:32 +02:00
|
|
|
|
|
|
|
if ( ref == 1 )
|
|
|
|
InterlockedIncrement( &This->numIfaces );
|
|
|
|
|
|
|
|
return ref;
|
2013-04-11 23:52:18 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:04 +02:00
|
|
|
static ULONG WINAPI IDirectPlayLobbyAImpl_Release( IDirectPlayLobbyA *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobbyA( iface );
|
|
|
|
ULONG ref = InterlockedDecrement( &This->refA );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) refA=%ld\n", This, ref );
|
2013-04-17 22:12:04 +02:00
|
|
|
|
|
|
|
if ( !ref && !InterlockedDecrement( &This->numIfaces ) )
|
|
|
|
dplobby_destroy( This );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static ULONG WINAPI IDirectPlayLobbyImpl_Release( IDirectPlayLobby *iface )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby( iface );
|
|
|
|
ULONG ref = InterlockedDecrement( &This->ref );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref=%ld\n", This, ref );
|
2013-04-17 22:10:53 +02:00
|
|
|
|
|
|
|
if ( !ref && !InterlockedDecrement( &This->numIfaces ) )
|
|
|
|
dplobby_destroy( This );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static ULONG WINAPI IDirectPlayLobby2AImpl_Release(IDirectPlayLobby2A *iface)
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
ULONG ref = InterlockedDecrement( &This->ref2A );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref2A=%ld\n", This, ref );
|
2013-04-17 22:12:53 +02:00
|
|
|
|
|
|
|
if ( !ref && !InterlockedDecrement( &This->numIfaces ) )
|
|
|
|
dplobby_destroy( This );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static ULONG WINAPI IDirectPlayLobby2Impl_Release(IDirectPlayLobby2 *iface)
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
ULONG ref = InterlockedDecrement( &This->ref2 );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref2=%ld\n", This, ref );
|
2013-04-17 22:13:45 +02:00
|
|
|
|
|
|
|
if ( !ref && !InterlockedDecrement( &This->numIfaces ) )
|
|
|
|
dplobby_destroy( This );
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:52:18 +02:00
|
|
|
static ULONG WINAPI IDirectPlayLobby3AImpl_Release(IDirectPlayLobby3A *iface)
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3A( iface );
|
2013-04-13 21:41:32 +02:00
|
|
|
ULONG ref = InterlockedDecrement( &This->ref3A );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref3A=%ld\n", This, ref );
|
2013-04-13 21:41:32 +02:00
|
|
|
|
|
|
|
if ( !ref && !InterlockedDecrement( &This->numIfaces ) )
|
|
|
|
dplobby_destroy( This );
|
|
|
|
|
|
|
|
return ref;
|
2013-04-11 23:52:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IDirectPlayLobby3Impl_Release(IDirectPlayLobby3 *iface)
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3( iface );
|
2013-04-13 21:41:32 +02:00
|
|
|
ULONG ref = InterlockedDecrement( &This->ref3 );
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p) ref3=%ld\n", This, ref );
|
2013-04-13 21:41:32 +02:00
|
|
|
|
|
|
|
if ( !ref && !InterlockedDecrement( &This->numIfaces ) )
|
|
|
|
dplobby_destroy( This );
|
|
|
|
|
|
|
|
return ref;
|
2013-04-11 23:52:18 +02:00
|
|
|
}
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
/********************************************************************
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
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.
|
|
|
|
*
|
2005-03-23 14:15:18 +01:00
|
|
|
* Returns an IDirectPlay interface.
|
1999-09-28 18:35:32 +02:00
|
|
|
*
|
|
|
|
*/
|
2013-04-17 22:10:08 +02:00
|
|
|
static HRESULT DPL_ConnectEx( IDirectPlayLobbyImpl *This, DWORD dwFlags, REFIID riid, void **lplpDP,
|
|
|
|
IUnknown* pUnk)
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
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
|
|
|
|
2022-02-03 10:43:50 +01: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;
|
|
|
|
}
|
|
|
|
|
2013-03-29 16:48:57 +01:00
|
|
|
if ( ( hr = dplay_create( riid, lplpDP ) ) != DP_OK )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
ERR( "error creating interface for %s:%s.\n",
|
2000-07-10 15:19:28 +02:00
|
|
|
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? */
|
2013-04-11 23:53:38 +02:00
|
|
|
hr = IDirectPlayLobby_GetConnectionSettings( &This->IDirectPlayLobby3_iface,
|
2002-06-01 01:06:46 +02:00
|
|
|
0, NULL, &dwConnSize );
|
2000-07-10 15:19:28 +02:00
|
|
|
if( hr != DPERR_BUFFERTOOSMALL )
|
|
|
|
{
|
|
|
|
return hr;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
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? */
|
2013-04-11 23:53:38 +02:00
|
|
|
hr = IDirectPlayLobby_GetConnectionSettings( &This->IDirectPlayLobby3_iface,
|
2000-07-10 15:19:28 +02:00
|
|
|
0, lpConn, &dwConnSize );
|
|
|
|
if( FAILED( hr ) )
|
|
|
|
{
|
2003-04-03 20:04:40 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, lpConn );
|
2000-07-10 15:19:28 +02:00
|
|
|
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
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
|
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;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
hr = IDirectPlayX_Open( (*(LPDIRECTPLAY2*)lplpDP), lpConn->lpSessionDesc,
|
2000-07-10 15:19:28 +02:00
|
|
|
dwOpenFlags );
|
|
|
|
|
|
|
|
HeapFree( GetProcessHeap(), 0, lpConn );
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:04 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_Connect( IDirectPlayLobbyA *iface, DWORD flags,
|
|
|
|
IDirectPlay2A **dp, IUnknown *unk )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobbyA( iface );
|
|
|
|
return IDirectPlayLobby_Connect( &This->IDirectPlayLobby3A_iface, flags, dp, unk );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyImpl_Connect( IDirectPlayLobby *iface, DWORD flags,
|
|
|
|
IDirectPlay2A **dp, IUnknown *unk )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby( iface );
|
|
|
|
return IDirectPlayLobby_Connect( &This->IDirectPlayLobby3_iface, flags, dp, unk );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2AImpl_Connect( IDirectPlayLobby2A *iface, DWORD flags,
|
|
|
|
IDirectPlay2A **dp, IUnknown *unk )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
return IDirectPlayLobby_Connect( &This->IDirectPlayLobby3A_iface, flags, dp, unk );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2Impl_Connect( IDirectPlayLobby2 *iface, DWORD flags,
|
|
|
|
IDirectPlay2A **dp, IUnknown *unk )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
return IDirectPlayLobby_Connect( &This->IDirectPlayLobby3_iface, flags, dp, unk );
|
|
|
|
}
|
|
|
|
|
2013-04-09 22:38:44 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_Connect( IDirectPlayLobby3A *iface, DWORD flags,
|
|
|
|
IDirectPlay2A **dp, IUnknown *unk)
|
2000-07-10 15:19:28 +02:00
|
|
|
{
|
2013-04-09 22:38:44 +02:00
|
|
|
return IDirectPlayLobby_ConnectEx( iface, flags, &IID_IDirectPlay2A, (void**)dp, unk );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-04-09 22:38:44 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_Connect( IDirectPlayLobby3 *iface, DWORD flags,
|
|
|
|
IDirectPlay2 **dp, IUnknown *unk)
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-09 22:38:44 +02:00
|
|
|
return IDirectPlayLobby_ConnectEx( iface, flags, &IID_IDirectPlay2A, (void**)dp, unk );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Creates a DirectPlay Address, given a service provider-specific network
|
2002-06-01 01:06:46 +02:00
|
|
|
* address.
|
1999-09-28 18:35:32 +02:00
|
|
|
* 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
|
|
|
*/
|
2013-04-17 22:12:04 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_CreateAddress( IDirectPlayLobbyA *iface, REFGUID sp,
|
|
|
|
REFGUID datatype, const void *data, DWORD datasize, void *address, DWORD *addrsize )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobbyA( iface );
|
|
|
|
return IDirectPlayLobby_CreateAddress( &This->IDirectPlayLobby3A_iface, sp, datatype, data,
|
|
|
|
datasize, address, addrsize );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyImpl_CreateAddress( IDirectPlayLobby *iface, REFGUID sp,
|
|
|
|
REFGUID datatype, const void *data, DWORD datasize, void *address, DWORD *addrsize )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby( iface );
|
|
|
|
return IDirectPlayLobby_CreateAddress( &This->IDirectPlayLobby3_iface, sp, datatype, data,
|
|
|
|
datasize, address, addrsize );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2AImpl_CreateAddress( IDirectPlayLobby2A *iface, REFGUID sp,
|
|
|
|
REFGUID datatype, const void *data, DWORD datasize, void *address, DWORD *addrsize )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
return IDirectPlayLobby_CreateAddress( &This->IDirectPlayLobby3A_iface, sp, datatype, data,
|
|
|
|
datasize, address, addrsize );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2Impl_CreateAddress( IDirectPlayLobby2 *iface, REFGUID sp,
|
|
|
|
REFGUID datatype, const void *data, DWORD datasize, void *address, DWORD *addrsize )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
return IDirectPlayLobby_CreateAddress( &This->IDirectPlayLobby3_iface, sp, datatype, data,
|
|
|
|
datasize, address, addrsize );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:48:28 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_CreateAddress( IDirectPlayLobby3A *iface,
|
|
|
|
REFGUID guidSP, REFGUID guidDataType, const void *lpData, DWORD dwDataSize, void *lpAddress,
|
|
|
|
DWORD *lpdwAddressSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
return DPL_CreateAddress( guidSP, guidDataType, lpData, dwDataSize,
|
|
|
|
lpAddress, lpdwAddressSize, TRUE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_CreateAddress( IDirectPlayLobby3 *iface, REFGUID guidSP,
|
|
|
|
REFGUID guidDataType, const void *lpData, DWORD dwDataSize, void *lpAddress,
|
|
|
|
DWORD *lpdwAddressSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
1999-11-25 23:04:53 +01:00
|
|
|
return DPL_CreateAddress( guidSP, guidDataType, lpData, dwDataSize,
|
|
|
|
lpAddress, lpdwAddressSize, FALSE );
|
|
|
|
}
|
|
|
|
|
2007-01-06 20:31:56 +01:00
|
|
|
static HRESULT DPL_CreateAddress(
|
1999-11-25 23:04:53 +01:00
|
|
|
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
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(%p,%p,0x%08lx,%p,%p,%d)\n", guidSP, guidDataType, lpData, dwDataSize,
|
1999-11-25 23:04:53 +01:00
|
|
|
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.
|
|
|
|
*
|
|
|
|
*/
|
2013-04-17 22:12:04 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumAddress( IDirectPlayLobbyA *iface,
|
|
|
|
LPDPENUMADDRESSCALLBACK enumaddrcb, const void *address, DWORD size, void *context )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobbyA( iface );
|
|
|
|
return IDirectPlayLobby_EnumAddress( &This->IDirectPlayLobby3A_iface, enumaddrcb, address, size,
|
|
|
|
context );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyImpl_EnumAddress( IDirectPlayLobby *iface,
|
|
|
|
LPDPENUMADDRESSCALLBACK enumaddrcb, const void *address, DWORD size, void *context )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby( iface );
|
|
|
|
return IDirectPlayLobby_EnumAddress( &This->IDirectPlayLobby3_iface, enumaddrcb, address, size,
|
|
|
|
context );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2AImpl_EnumAddress( IDirectPlayLobby2A *iface,
|
|
|
|
LPDPENUMADDRESSCALLBACK enumaddrcb, const void *address, DWORD size, void *context )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
return IDirectPlayLobby_EnumAddress( &This->IDirectPlayLobby3A_iface, enumaddrcb, address, size,
|
|
|
|
context );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2Impl_EnumAddress( IDirectPlayLobby2 *iface,
|
|
|
|
LPDPENUMADDRESSCALLBACK enumaddrcb, const void *address, DWORD size, void *context )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
return IDirectPlayLobby_EnumAddress( &This->IDirectPlayLobby3_iface, enumaddrcb, address, size,
|
|
|
|
context );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:48:28 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_EnumAddress( IDirectPlayLobby3A *iface,
|
|
|
|
LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, const void *lpAddress, DWORD dwAddressSize,
|
|
|
|
void *lpContext )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-11 23:50:53 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3A( iface );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE("(%p)->(%p,%p,0x%08lx,%p)\n", This, lpEnumAddressCallback, lpAddress,
|
1999-11-04 03:17:03 +01:00
|
|
|
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 );
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_EnumAddress( IDirectPlayLobby3 *iface,
|
|
|
|
LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, const void *lpAddress, DWORD dwAddressSize,
|
|
|
|
void *lpContext )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-17 22:07:06 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3( iface );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE("(%p)->(%p,%p,0x%08lx,%p)\n", This, lpEnumAddressCallback, lpAddress,
|
1999-11-04 03:17:03 +01:00
|
|
|
dwAddressSize, lpContext );
|
|
|
|
|
|
|
|
return DPL_EnumAddress( lpEnumAddressCallback, lpAddress, dwAddressSize, lpContext );
|
|
|
|
}
|
|
|
|
|
2008-05-21 22:50:32 +02:00
|
|
|
HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress,
|
|
|
|
DWORD dwAddressSize, LPVOID lpContext )
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
DWORD dwTotalSizeEnumerated = 0;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* FIXME: First chunk is always the total size chunk - Should we report it? */
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
while ( dwTotalSizeEnumerated < dwAddressSize )
|
|
|
|
{
|
2009-01-16 09:53:59 +01:00
|
|
|
const DPADDRESS* lpElements = lpAddress;
|
2002-06-01 01:06:46 +02:00
|
|
|
DWORD dwSizeThisEnumeration;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
/* Invoke the enum method. If false is returned, stop enumeration */
|
2002-06-01 01:06:46 +02:00
|
|
|
if ( !lpEnumAddressCallback( &lpElements->guidDataType,
|
|
|
|
lpElements->dwDataSize,
|
2007-07-19 23:04:55 +02:00
|
|
|
(const BYTE *)lpElements + sizeof( DPADDRESS ),
|
2000-08-25 23:58:05 +02:00
|
|
|
lpContext ) )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
dwSizeThisEnumeration = sizeof( DPADDRESS ) + lpElements->dwDataSize;
|
2004-11-30 22:38:57 +01:00
|
|
|
lpAddress = (const 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.
|
|
|
|
*
|
|
|
|
*/
|
2013-04-17 22:12:04 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumAddressTypes( IDirectPlayLobbyA *iface,
|
|
|
|
LPDPLENUMADDRESSTYPESCALLBACK enumaddrtypecb, REFGUID sp, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobbyA( iface );
|
|
|
|
return IDirectPlayLobby_EnumAddressTypes( &This->IDirectPlayLobby3A_iface, enumaddrtypecb, sp,
|
|
|
|
context, flags );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyImpl_EnumAddressTypes( IDirectPlayLobby *iface,
|
|
|
|
LPDPLENUMADDRESSTYPESCALLBACK enumaddrtypecb, REFGUID sp, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby( iface );
|
|
|
|
return IDirectPlayLobby_EnumAddressTypes( &This->IDirectPlayLobby3_iface, enumaddrtypecb, sp,
|
|
|
|
context, flags );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2AImpl_EnumAddressTypes( IDirectPlayLobby2A *iface,
|
|
|
|
LPDPLENUMADDRESSTYPESCALLBACK enumaddrtypecb, REFGUID sp, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
return IDirectPlayLobby_EnumAddressTypes( &This->IDirectPlayLobby3A_iface, enumaddrtypecb, sp,
|
|
|
|
context, flags );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2Impl_EnumAddressTypes( IDirectPlayLobby2 *iface,
|
|
|
|
LPDPLENUMADDRESSTYPESCALLBACK enumaddrtypecb, REFGUID sp, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
return IDirectPlayLobby_EnumAddressTypes( &This->IDirectPlayLobby3_iface, enumaddrtypecb, sp,
|
|
|
|
context, flags );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:48:28 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_EnumAddressTypes( IDirectPlayLobby3A *iface,
|
|
|
|
LPDPLENUMADDRESSTYPESCALLBACK lpEnumAddressTypeCallback, REFGUID guidSP, void *lpContext,
|
|
|
|
DWORD dwFlags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-11 23:50:53 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3A( iface );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE(" (%p)->(%p,%p,%p,0x%08lx)\n", This, lpEnumAddressTypeCallback, guidSP, lpContext, dwFlags );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
if( dwFlags != 0 )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
2008-02-21 17:44:34 +01:00
|
|
|
if( !lpEnumAddressTypeCallback )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
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;
|
2003-10-07 05:30:47 +02:00
|
|
|
LPCSTR atKey = "Address Types";
|
|
|
|
LPCSTR guidDataSubKey = "Guid";
|
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,
|
2005-07-07 14:08:42 +02:00
|
|
|
NULL, &returnTypeGUID, (LPBYTE)returnBuffer,
|
1999-11-04 03:17:03 +01:00
|
|
|
&sizeOfReturnBuffer ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR(": missing GUID registry data members\n" );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Check return types to ensure we're interpreting data right */
|
2018-09-10 22:49:38 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, ARRAY_SIZE( buff ));
|
2004-01-23 21:57:26 +01:00
|
|
|
CLSIDFromString( 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 */
|
2018-09-10 22:49:38 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, atSubKey, -1, buff, ARRAY_SIZE( buff ));
|
2004-01-23 21:57:26 +01:00
|
|
|
CLSIDFromString( buff, &serviceProviderGUID );
|
1999-11-04 03:17:03 +01:00
|
|
|
/* FIXME: Have I got a memory leak on the serviceProviderGUID? */
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
/* 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;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_EnumAddressTypes( IDirectPlayLobby3 *iface,
|
|
|
|
LPDPLENUMADDRESSTYPESCALLBACK enumaddrtypecb, REFGUID sp, void *context, DWORD flags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2017-06-08 07:55:26 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3( iface );
|
|
|
|
return IDirectPlayLobby_EnumAddressTypes( &This->IDirectPlayLobby3A_iface, enumaddrtypecb, sp,
|
|
|
|
context, flags );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Enumerates what applications are registered with DirectPlay by
|
|
|
|
* invoking the callback function with lpContext.
|
|
|
|
*
|
|
|
|
*/
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_EnumLocalApplications( IDirectPlayLobby3 *iface,
|
|
|
|
LPDPLENUMLOCALAPPLICATIONSCALLBACK lpEnumLocalAppCallback, void *lpContext, DWORD dwFlags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-17 22:07:06 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3( iface );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME("(%p)->(%p,%p,0x%08lx):stub\n", This, lpEnumLocalAppCallback, lpContext, dwFlags );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:04 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumLocalApplications( IDirectPlayLobbyA *iface,
|
|
|
|
LPDPLENUMLOCALAPPLICATIONSCALLBACK enumlocalappcb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobbyA( iface );
|
|
|
|
return IDirectPlayLobby_EnumLocalApplications( &This->IDirectPlayLobby3A_iface, enumlocalappcb,
|
|
|
|
context, flags );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyImpl_EnumLocalApplications( IDirectPlayLobby *iface,
|
|
|
|
LPDPLENUMLOCALAPPLICATIONSCALLBACK enumlocalappcb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby( iface );
|
|
|
|
return IDirectPlayLobby_EnumLocalApplications( &This->IDirectPlayLobby3_iface, enumlocalappcb,
|
|
|
|
context, flags );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2AImpl_EnumLocalApplications( IDirectPlayLobby2A *iface,
|
|
|
|
LPDPLENUMLOCALAPPLICATIONSCALLBACK enumlocalappcb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
return IDirectPlayLobby_EnumLocalApplications( &This->IDirectPlayLobby3A_iface, enumlocalappcb,
|
|
|
|
context, flags );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2Impl_EnumLocalApplications( IDirectPlayLobby2 *iface,
|
|
|
|
LPDPLENUMLOCALAPPLICATIONSCALLBACK enumlocalappcb, void *context, DWORD flags )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
return IDirectPlayLobby_EnumLocalApplications( &This->IDirectPlayLobby3_iface, enumlocalappcb,
|
|
|
|
context, flags );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:48:28 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_EnumLocalApplications( IDirectPlayLobby3A *iface,
|
|
|
|
LPDPLENUMLOCALAPPLICATIONSCALLBACK lpEnumLocalAppCallback, void *lpContext, DWORD dwFlags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-11 23:50:53 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3A( 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";
|
2003-10-07 05:30:47 +02:00
|
|
|
LPCSTR guidDataSubKey = "Guid";
|
1999-11-04 03:17:03 +01:00
|
|
|
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
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE("(%p)->(%p,%p,0x%08lx)\n", This, lpEnumLocalAppCallback, lpContext, dwFlags );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
if( dwFlags != 0 )
|
|
|
|
{
|
|
|
|
return DPERR_INVALIDPARAMS;
|
|
|
|
}
|
|
|
|
|
2008-02-21 17:44:34 +01:00
|
|
|
if( !lpEnumLocalAppCallback )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
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,
|
2005-07-07 14:08:42 +02:00
|
|
|
NULL, &returnTypeGUID, (LPBYTE)returnBuffer,
|
1999-11-04 03:17:03 +01:00
|
|
|
&sizeOfReturnBuffer ) != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
ERR(": missing GUID registry data members\n" );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Check return types to ensure we're interpreting data right */
|
2018-09-10 22:49:38 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, ARRAY_SIZE( buff ));
|
2004-01-23 21:57:26 +01:00
|
|
|
CLSIDFromString( 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;
|
2002-06-01 01:06:46 +02:00
|
|
|
dplAppInfo.u.lpszAppNameA = subKeyName;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2013-04-11 23:54:45 +02:00
|
|
|
EnterCriticalSection( &This->lock );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2013-04-17 22:14:38 +02:00
|
|
|
memcpy( &This->cbkeyhack, &hkServiceProvider, sizeof( hkServiceProvider ) );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
if( !lpEnumLocalAppCallback( &dplAppInfo, lpContext, dwFlags ) )
|
|
|
|
{
|
2013-04-11 23:54:45 +02:00
|
|
|
LeaveCriticalSection( &This->lock );
|
1999-11-04 03:17:03 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:54:45 +02:00
|
|
|
LeaveCriticalSection( &This->lock );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
2013-04-17 22:12:04 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_GetConnectionSettings( IDirectPlayLobbyA *iface,
|
|
|
|
DWORD appid, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobbyA( iface );
|
|
|
|
return IDirectPlayLobby_GetConnectionSettings( &This->IDirectPlayLobby3A_iface, appid, data,
|
|
|
|
size );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyImpl_GetConnectionSettings( IDirectPlayLobby *iface,
|
|
|
|
DWORD appid, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby( iface );
|
|
|
|
return IDirectPlayLobby_GetConnectionSettings( &This->IDirectPlayLobby3_iface, appid, data,
|
|
|
|
size );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2AImpl_GetConnectionSettings( IDirectPlayLobby2A *iface,
|
|
|
|
DWORD appid, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
return IDirectPlayLobby_GetConnectionSettings( &This->IDirectPlayLobby3A_iface, appid, data,
|
|
|
|
size );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2Impl_GetConnectionSettings( IDirectPlayLobby2 *iface,
|
|
|
|
DWORD appid, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
return IDirectPlayLobby_GetConnectionSettings( &This->IDirectPlayLobby3_iface, appid, data,
|
|
|
|
size );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:48:28 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_GetConnectionSettings( IDirectPlayLobby3A *iface,
|
|
|
|
DWORD dwAppID, void *lpData, DWORD *lpdwDataSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-11 23:50:53 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3A( iface );
|
2002-06-01 01:06:46 +02:00
|
|
|
HRESULT hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE("(%p)->(0x%08lx,%p,%p)\n", This, dwAppID, lpData, lpdwDataSize );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-04-11 23:54:45 +02:00
|
|
|
EnterCriticalSection( &This->lock );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2002-06-01 01:06:46 +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
|
|
|
|
2013-04-11 23:54:45 +02:00
|
|
|
LeaveCriticalSection( &This->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
|
|
|
}
|
|
|
|
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_GetConnectionSettings( IDirectPlayLobby3 *iface,
|
|
|
|
DWORD dwAppID, void *lpData, DWORD *lpdwDataSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-17 22:07:06 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3( iface );
|
1999-11-04 03:17:03 +01:00
|
|
|
HRESULT hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE("(%p)->(0x%08lx,%p,%p)\n", This, dwAppID, lpData, lpdwDataSize );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2013-04-11 23:54:45 +02:00
|
|
|
EnterCriticalSection( &This->lock );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2002-06-01 01:06:46 +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
|
|
|
|
2013-04-11 23:54:45 +02:00
|
|
|
LeaveCriticalSection( &This->lock );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
*
|
2002-06-01 01:06:46 +02:00
|
|
|
* Retrieves the message sent between a lobby client and a DirectPlay
|
1999-09-28 18:35:32 +02:00
|
|
|
* application. All messages are queued until received.
|
|
|
|
*
|
|
|
|
*/
|
2013-04-17 22:12:04 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_ReceiveLobbyMessage( IDirectPlayLobbyA *iface,
|
|
|
|
DWORD flags, DWORD appid, DWORD *msgflags, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobbyA( iface );
|
|
|
|
return IDirectPlayLobby_ReceiveLobbyMessage( &This->IDirectPlayLobby3A_iface, flags, appid,
|
|
|
|
msgflags, data, size );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyImpl_ReceiveLobbyMessage( IDirectPlayLobby *iface,
|
|
|
|
DWORD flags, DWORD appid, DWORD *msgflags, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby( iface );
|
|
|
|
return IDirectPlayLobby_ReceiveLobbyMessage( &This->IDirectPlayLobby3_iface, flags, appid,
|
|
|
|
msgflags, data, size );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2AImpl_ReceiveLobbyMessage( IDirectPlayLobby2A *iface,
|
|
|
|
DWORD flags, DWORD appid, DWORD *msgflags, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
return IDirectPlayLobby_ReceiveLobbyMessage( &This->IDirectPlayLobby3A_iface, flags, appid,
|
|
|
|
msgflags, data, size );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2Impl_ReceiveLobbyMessage( IDirectPlayLobby2 *iface,
|
|
|
|
DWORD flags, DWORD appid, DWORD *msgflags, void *data, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
return IDirectPlayLobby_ReceiveLobbyMessage( &This->IDirectPlayLobby3_iface, flags, appid,
|
|
|
|
msgflags, data, size );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:48:28 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_ReceiveLobbyMessage( IDirectPlayLobby3A *iface,
|
|
|
|
DWORD dwFlags, DWORD dwAppID, DWORD *lpdwMessageFlags, void *lpData,
|
|
|
|
DWORD *lpdwDataSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-11 23:50:53 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3A( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME(":stub %p %08lx %08lx %p %p %p\n", This, dwFlags, dwAppID, lpdwMessageFlags, lpData,
|
1999-09-28 18:35:32 +02:00
|
|
|
lpdwDataSize );
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_ReceiveLobbyMessage( IDirectPlayLobby3 *iface,
|
|
|
|
DWORD dwFlags, DWORD dwAppID, DWORD *lpdwMessageFlags, void *lpData,
|
|
|
|
DWORD *lpdwDataSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-17 22:07:06 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME(":stub %p %08lx %08lx %p %p %p\n", This, dwFlags, dwAppID, lpdwMessageFlags, lpData,
|
1999-09-28 18:35:32 +02:00
|
|
|
lpdwDataSize );
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
typedef struct tagRunApplicationEnumStruct
|
|
|
|
{
|
2013-04-17 22:10:08 +02:00
|
|
|
IDirectPlayLobbyImpl *This;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
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;
|
2003-10-07 05:30:47 +02:00
|
|
|
LPCSTR clSubKey = "CommandLine";
|
|
|
|
LPCSTR cdSubKey = "CurrentDirectory";
|
|
|
|
LPCSTR fileSubKey = "File";
|
|
|
|
LPCSTR pathSubKey = "Path";
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* FIXME: Lazy man hack - dplay struct has the present reg key saved */
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
sizeOfReturnBuffer = 200;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
/* Get all the appropriate data from the registry */
|
2013-04-17 22:14:38 +02:00
|
|
|
if( RegQueryValueExA( lpData->This->cbkeyhack, clSubKey,
|
2005-07-07 14:08:42 +02:00
|
|
|
NULL, &returnType, (LPBYTE)returnBuffer,
|
1999-11-04 03:17:03 +01:00
|
|
|
&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;
|
|
|
|
|
2013-04-17 22:14:38 +02:00
|
|
|
if( RegQueryValueExA( lpData->This->cbkeyhack, cdSubKey,
|
2005-07-07 14:08:42 +02:00
|
|
|
NULL, &returnType, (LPBYTE)returnBuffer,
|
1999-11-04 03:17:03 +01:00
|
|
|
&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;
|
|
|
|
|
2013-04-17 22:14:38 +02:00
|
|
|
if( RegQueryValueExA( lpData->This->cbkeyhack, fileSubKey,
|
2005-07-07 14:08:42 +02:00
|
|
|
NULL, &returnType, (LPBYTE)returnBuffer,
|
1999-11-04 03:17:03 +01:00
|
|
|
&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;
|
|
|
|
|
2013-04-17 22:14:38 +02:00
|
|
|
if( RegQueryValueExA( lpData->This->cbkeyhack, pathSubKey,
|
2005-07-07 14:08:42 +02:00
|
|
|
NULL, &returnType, (LPBYTE)returnBuffer,
|
1999-11-04 03:17:03 +01:00
|
|
|
&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 */
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
return TRUE; /* Keep enumerating, haven't found the application yet */
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
2007-01-06 20:31:56 +01:00
|
|
|
static BOOL DPL_CreateAndSetLobbyHandles( DWORD dwDestProcessId, HANDLE hDestProcess,
|
2002-06-01 01:06:46 +02:00
|
|
|
LPHANDLE lphStart, LPHANDLE lphDeath,
|
2000-08-25 23:58:05 +02:00
|
|
|
LPHANDLE lphRead )
|
|
|
|
{
|
|
|
|
/* These are the handles for the created process */
|
2005-03-09 12:48:05 +01:00
|
|
|
HANDLE hAppStart = 0, hAppDeath = 0, hAppRead = 0;
|
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;
|
|
|
|
|
2005-03-09 12:48:05 +01:00
|
|
|
*lphStart = CreateEventW( &s_attrib, TRUE, FALSE, NULL );
|
|
|
|
*lphDeath = CreateEventW( &s_attrib, TRUE, FALSE, NULL );
|
|
|
|
*lphRead = CreateEventW( &s_attrib, TRUE, FALSE, NULL );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if( ( !DuplicateHandle( GetCurrentProcess(), *lphStart,
|
|
|
|
hDestProcess, &hAppStart,
|
2000-08-25 23:58:05 +02:00
|
|
|
0, FALSE, DUPLICATE_SAME_ACCESS ) ) ||
|
2002-06-01 01:06:46 +02:00
|
|
|
( !DuplicateHandle( GetCurrentProcess(), *lphDeath,
|
|
|
|
hDestProcess, &hAppDeath,
|
2000-08-25 23:58:05 +02:00
|
|
|
0, FALSE, DUPLICATE_SAME_ACCESS ) ) ||
|
2002-06-01 01:06:46 +02:00
|
|
|
( !DuplicateHandle( GetCurrentProcess(), *lphRead,
|
|
|
|
hDestProcess, &hAppRead,
|
2000-08-25 23:58:05 +02:00
|
|
|
0, FALSE, DUPLICATE_SAME_ACCESS ) )
|
|
|
|
)
|
|
|
|
{
|
2005-03-09 12:48:05 +01:00
|
|
|
if (*lphStart) { CloseHandle(*lphStart); *lphStart = 0; }
|
|
|
|
if (*lphDeath) { CloseHandle(*lphDeath); *lphDeath = 0; }
|
|
|
|
if (*lphRead) { CloseHandle(*lphRead); *lphRead = 0; }
|
2000-08-25 23:58:05 +02:00
|
|
|
/* FIXME: Handle leak... */
|
|
|
|
ERR( "Unable to dup handles\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if( !DPLAYX_SetLobbyHandles( dwDestProcessId,
|
2000-08-25 23:58:05 +02:00
|
|
|
hAppStart, hAppDeath, hAppRead ) )
|
|
|
|
{
|
2005-03-09 12:48:05 +01:00
|
|
|
/* FIXME: Handle leak... */
|
2002-06-01 01:06:46 +02:00
|
|
|
return FALSE;
|
2000-08-25 23:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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.
|
|
|
|
*
|
|
|
|
*/
|
2013-04-17 22:12:04 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_RunApplication( IDirectPlayLobbyA *iface, DWORD flags,
|
|
|
|
DWORD *appid, DPLCONNECTION *conn, HANDLE event )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobbyA( iface );
|
|
|
|
return IDirectPlayLobby_RunApplication( &This->IDirectPlayLobby3A_iface, flags, appid, conn,
|
|
|
|
event );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyImpl_RunApplication( IDirectPlayLobby *iface, DWORD flags,
|
|
|
|
DWORD *appid, DPLCONNECTION *conn, HANDLE event )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby( iface );
|
|
|
|
return IDirectPlayLobby_RunApplication( &This->IDirectPlayLobby3_iface, flags, appid, conn,
|
|
|
|
event );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2AImpl_RunApplication( IDirectPlayLobby2A *iface, DWORD flags,
|
|
|
|
DWORD *appid, DPLCONNECTION *conn, HANDLE event )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
return IDirectPlayLobby_RunApplication( &This->IDirectPlayLobby3A_iface, flags, appid, conn,
|
|
|
|
event );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2Impl_RunApplication( IDirectPlayLobby2 *iface, DWORD flags,
|
|
|
|
DWORD *appid, DPLCONNECTION *conn, HANDLE event )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
return IDirectPlayLobby_RunApplication( &This->IDirectPlayLobby3_iface, flags, appid, conn,
|
|
|
|
event );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:48:28 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_RunApplication( IDirectPlayLobby3A *iface,
|
|
|
|
DWORD dwFlags, DWORD *lpdwAppID, DPLCONNECTION *lpConn, HANDLE hReceiveEvent )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-11 23:50:53 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3A( iface );
|
1999-11-04 03:17:03 +01:00
|
|
|
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
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx,%p,%p,%p)\n",
|
2000-08-25 23:58:05 +02:00
|
|
|
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" );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:54:45 +02:00
|
|
|
EnterCriticalSection( &This->lock );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
ZeroMemory( &enumData, sizeof( enumData ) );
|
|
|
|
enumData.This = This;
|
|
|
|
enumData.appGUID = lpConn->lpSessionDesc->guidApplication;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* Our callback function will fill up the enumData structure with all the information
|
1999-11-04 03:17:03 +01:00
|
|
|
required to start a new process */
|
|
|
|
IDirectPlayLobby_EnumLocalApplications( iface, RunApplicationA_EnumLocalApplications,
|
2009-01-16 09:53:59 +01:00
|
|
|
(&enumData), 0 );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
/* First the application name */
|
|
|
|
strcpy( temp, enumData.lpszPath );
|
|
|
|
strcat( temp, "\\" );
|
2002-06-01 01:06:46 +02:00
|
|
|
strcat( temp, enumData.lpszFileName );
|
|
|
|
HeapFree( GetProcessHeap(), 0, enumData.lpszPath );
|
1999-11-04 03:17:03 +01:00
|
|
|
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 */
|
2002-06-01 01:06:46 +02:00
|
|
|
strcat( temp, " " );
|
1999-11-04 03:17:03 +01:00
|
|
|
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 );
|
|
|
|
|
2013-04-11 23:54:45 +02:00
|
|
|
LeaveCriticalSection( &This->lock );
|
2002-06-01 01:06:46 +02:00
|
|
|
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
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
ERR( "Unable to create global application data for 0x%08lx\n",
|
2000-07-10 15:19:28 +02:00
|
|
|
newProcessInfo.dwProcessId );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
hr = IDirectPlayLobby_SetConnectionSettings( iface, 0, newProcessInfo.dwProcessId, lpConn );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
if( hr != DP_OK )
|
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
ERR( "SetConnectionSettings failure %s\n", DPLAYX_HresultToString( hr ) );
|
2013-04-11 23:54:45 +02:00
|
|
|
LeaveCriticalSection( &This->lock );
|
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 */
|
2013-04-17 22:14:38 +02:00
|
|
|
This->msgtid = CreateLobbyMessageReceptionThread( hReceiveEvent, hStart, hDeath, hSettingRead );
|
2000-08-25 23:58:05 +02:00
|
|
|
|
2013-04-17 22:14:38 +02:00
|
|
|
DPLAYX_SetLobbyMsgThreadId( newProcessInfo.dwProcessId, This->msgtid );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2013-04-11 23:54:45 +02:00
|
|
|
LeaveCriticalSection( &This->lock );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* Everything seems to have been set correctly, update the dwAppID */
|
|
|
|
*lpdwAppID = newProcessInfo.dwProcessId;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* Unsuspend the process - should return the prev suspension count */
|
2000-07-10 15:19:28 +02:00
|
|
|
if( ( dwSuspendCount = ResumeThread( newProcessInfo.hThread ) ) != 1 )
|
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
ERR( "ResumeThread failed with 0x%08lx\n", dwSuspendCount );
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
return DP_OK;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_RunApplication( IDirectPlayLobby3 *iface, DWORD dwFlags,
|
|
|
|
DWORD *lpdwAppID, DPLCONNECTION *lpConn, HANDLE hReceiveEvent )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-17 22:07:06 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3( iface );
|
2022-02-03 10:43:50 +01:00
|
|
|
FIXME( "(%p)->(0x%08lx,%p,%p,%p):stub\n", This, dwFlags, lpdwAppID, lpConn, 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.
|
|
|
|
*
|
|
|
|
*/
|
2013-04-17 22:12:04 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_SendLobbyMessage( IDirectPlayLobbyA *iface, DWORD flags,
|
|
|
|
DWORD appid, void *data, DWORD size )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobbyA( iface );
|
|
|
|
return IDirectPlayLobby_SendLobbyMessage( &This->IDirectPlayLobby3A_iface, flags, appid, data,
|
|
|
|
size );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyImpl_SendLobbyMessage( IDirectPlayLobby *iface, DWORD flags,
|
|
|
|
DWORD appid, void *data, DWORD size )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby( iface );
|
|
|
|
return IDirectPlayLobby_SendLobbyMessage( &This->IDirectPlayLobby3_iface, flags, appid, data,
|
|
|
|
size );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2AImpl_SendLobbyMessage( IDirectPlayLobby2A *iface,
|
|
|
|
DWORD flags, DWORD appid, void *data, DWORD size )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
return IDirectPlayLobby_SendLobbyMessage( &This->IDirectPlayLobby3A_iface, flags, appid, data,
|
|
|
|
size );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2Impl_SendLobbyMessage( IDirectPlayLobby2 *iface, DWORD flags,
|
|
|
|
DWORD appid, void *data, DWORD size )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
return IDirectPlayLobby_SendLobbyMessage( &This->IDirectPlayLobby3_iface, flags, appid, data,
|
|
|
|
size );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:48:28 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_SendLobbyMessage( IDirectPlayLobby3A *iface,
|
|
|
|
DWORD flags, DWORD appid, void *data, DWORD size )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_SendLobbyMessage( IDirectPlayLobby3 *iface,
|
|
|
|
DWORD flags, DWORD appid, void *data, DWORD size )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Modifies the DPLCONNECTION structure to contain all information
|
|
|
|
* needed to start and connect an application.
|
|
|
|
*
|
|
|
|
*/
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_SetConnectionSettings( IDirectPlayLobby3 *iface,
|
|
|
|
DWORD dwFlags, DWORD dwAppID, DPLCONNECTION *lpConn )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-17 22:07:06 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3( iface );
|
1999-11-04 03:17:03 +01:00
|
|
|
HRESULT hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE("(%p)->(0x%08lx,0x%08lx,%p)\n", This, dwFlags, dwAppID, lpConn );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-04-11 23:54:45 +02:00
|
|
|
EnterCriticalSection( &This->lock );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
hr = DPLAYX_SetConnectionSettingsW( dwFlags, dwAppID, lpConn );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2008-04-02 22:10:47 +02:00
|
|
|
/* FIXME: Don't think that this is supposed to fail, but the documentation
|
2000-07-10 15:19:28 +02:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:54:45 +02:00
|
|
|
LeaveCriticalSection( &This->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
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:04 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_SetConnectionSettings( IDirectPlayLobbyA *iface,
|
|
|
|
DWORD flags, DWORD appid, DPLCONNECTION *conn )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobbyA( iface );
|
|
|
|
return IDirectPlayLobby_SetConnectionSettings( &This->IDirectPlayLobby3A_iface, flags,
|
|
|
|
appid, conn );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyImpl_SetConnectionSettings( IDirectPlayLobby *iface,
|
|
|
|
DWORD flags, DWORD appid, DPLCONNECTION *conn )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby( iface );
|
|
|
|
return IDirectPlayLobby_SetConnectionSettings( &This->IDirectPlayLobby3_iface, flags,
|
|
|
|
appid, conn );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2AImpl_SetConnectionSettings( IDirectPlayLobby2A *iface,
|
|
|
|
DWORD flags, DWORD appid, DPLCONNECTION *conn )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
return IDirectPlayLobby_SetConnectionSettings( &This->IDirectPlayLobby3A_iface, flags,
|
|
|
|
appid, conn );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2Impl_SetConnectionSettings( IDirectPlayLobby2 *iface,
|
|
|
|
DWORD flags, DWORD appid, DPLCONNECTION *conn )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
return IDirectPlayLobby_SetConnectionSettings( &This->IDirectPlayLobby3_iface, flags,
|
|
|
|
appid, conn );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:48:28 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_SetConnectionSettings( IDirectPlayLobby3A *iface,
|
|
|
|
DWORD dwFlags, DWORD dwAppID, DPLCONNECTION *lpConn )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-11 23:50:53 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3A( iface );
|
1999-11-04 03:17:03 +01:00
|
|
|
HRESULT hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE("(%p)->(0x%08lx,0x%08lx,%p)\n", This, dwFlags, dwAppID, lpConn );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-04-11 23:54:45 +02:00
|
|
|
EnterCriticalSection( &This->lock );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
hr = DPLAYX_SetConnectionSettingsA( dwFlags, dwAppID, lpConn );
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2008-04-02 22:10:47 +02:00
|
|
|
/* FIXME: Don't think that this is supposed to fail, but the documentation
|
2000-07-10 15:19:28 +02:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:54:45 +02:00
|
|
|
LeaveCriticalSection( &This->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
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
*
|
|
|
|
* Registers an event that will be set when a lobby message is received.
|
|
|
|
*
|
|
|
|
*/
|
2013-04-17 22:12:04 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyAImpl_SetLobbyMessageEvent( IDirectPlayLobbyA *iface,
|
|
|
|
DWORD flags, DWORD appid, HANDLE event )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobbyA( iface );
|
|
|
|
return IDirectPlayLobby_SetLobbyMessageEvent( &This->IDirectPlayLobby3A_iface, flags, appid,
|
|
|
|
event );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobbyImpl_SetLobbyMessageEvent( IDirectPlayLobby *iface,
|
|
|
|
DWORD flags, DWORD appid, HANDLE event )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby( iface );
|
|
|
|
return IDirectPlayLobby_SetLobbyMessageEvent( &This->IDirectPlayLobby3_iface, flags, appid,
|
|
|
|
event );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2AImpl_SetLobbyMessageEvent( IDirectPlayLobby2A *iface,
|
|
|
|
DWORD flags, DWORD appid, HANDLE event )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
return IDirectPlayLobby_SetLobbyMessageEvent( &This->IDirectPlayLobby3A_iface, flags, appid,
|
|
|
|
event );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2Impl_SetLobbyMessageEvent( IDirectPlayLobby2 *iface,
|
|
|
|
DWORD flags, DWORD appid, HANDLE event )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
return IDirectPlayLobby_SetLobbyMessageEvent( &This->IDirectPlayLobby3_iface, flags, appid,
|
|
|
|
event );
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:48:28 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_SetLobbyMessageEvent( IDirectPlayLobby3A *iface,
|
|
|
|
DWORD flags, DWORD appid, HANDLE event )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_SetLobbyMessageEvent( IDirectPlayLobby3 *iface,
|
|
|
|
DWORD flags, DWORD appid, HANDLE event )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
/* DPL 2 methods */
|
2013-04-17 22:12:53 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2AImpl_CreateCompoundAddress( IDirectPlayLobby2A *iface,
|
|
|
|
const DPCOMPOUNDADDRESSELEMENT *elements, DWORD count, void *address, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2A( iface );
|
|
|
|
return IDirectPlayLobby_CreateCompoundAddress( &This->IDirectPlayLobby3A_iface, elements,
|
|
|
|
count, address, size );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby2Impl_CreateCompoundAddress( IDirectPlayLobby2 *iface,
|
|
|
|
const DPCOMPOUNDADDRESSELEMENT *elements, DWORD count, void *address, DWORD *size )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby2( iface );
|
|
|
|
return IDirectPlayLobby_CreateCompoundAddress( &This->IDirectPlayLobby3_iface, elements,
|
|
|
|
count, address, size );
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_CreateCompoundAddress( IDirectPlayLobby3 *iface,
|
|
|
|
const DPCOMPOUNDADDRESSELEMENT *lpElements, DWORD dwElementCount, void *lpAddress,
|
|
|
|
DWORD *lpdwAddressSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
return DPL_CreateCompoundAddress( lpElements, dwElementCount, lpAddress, lpdwAddressSize, FALSE );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-04-11 23:48:28 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_CreateCompoundAddress( IDirectPlayLobby3A *iface,
|
|
|
|
const DPCOMPOUNDADDRESSELEMENT *lpElements, DWORD dwElementCount, void *lpAddress,
|
|
|
|
DWORD *lpdwAddressSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
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;
|
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE("(%p,0x%08lx,%p,%p)\n", lpElements, dwElementCount, lpAddress, lpdwAddressSize );
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
/* 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 */
|
2002-06-01 01:06:46 +02:00
|
|
|
for ( dwElements = dwElementCount; dwElements > 0; --dwElements, ++lpElements )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ServiceProvider ) ) ||
|
|
|
|
( IsEqualGUID( &lpElements->guidDataType, &DPAID_LobbyProvider ) )
|
|
|
|
)
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
dwSizeRequired += sizeof( DPADDRESS ) + 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 ) )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if( !bAnsiInterface )
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
1999-11-04 03:17:03 +01:00
|
|
|
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
|
|
|
|
{
|
2017-03-03 06:15:32 +01:00
|
|
|
WARN( "Skipping Unknown GUID %s\n", debugstr_guid(&lpElements->guidDataType) );
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The user wants to know how big a buffer to allocate for us */
|
|
|
|
if( ( lpAddress == NULL ) ||
|
2002-06-01 01:06:46 +02:00
|
|
|
( *lpdwAddressSize < dwSizeRequired )
|
1999-11-04 03:17:03 +01:00
|
|
|
)
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
*lpdwAddressSize = dwSizeRequired;
|
1999-11-04 03:17:03 +01:00
|
|
|
return DPERR_BUFFERTOOSMALL;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
/* Add the total size chunk */
|
|
|
|
{
|
2009-01-16 09:53:59 +01:00
|
|
|
LPDPADDRESS lpdpAddress = lpAddress;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2008-03-28 23:52:28 +01:00
|
|
|
lpdpAddress->guidDataType = DPAID_TotalSize;
|
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 */
|
2002-06-01 01:06:46 +02:00
|
|
|
for( dwElements = dwElementCount, lpElements = lpOrigElements;
|
|
|
|
dwElements > 0;
|
|
|
|
--dwElements, ++lpElements )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ServiceProvider ) ) ||
|
|
|
|
( IsEqualGUID( &lpElements->guidDataType, &DPAID_LobbyProvider ) )
|
|
|
|
)
|
|
|
|
{
|
2009-01-16 09:53:59 +01:00
|
|
|
LPDPADDRESS lpdpAddress = lpAddress;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2008-03-28 23:52:28 +01:00
|
|
|
lpdpAddress->guidDataType = lpElements->guidDataType;
|
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 ) ) ||
|
2002-06-01 01:06:46 +02:00
|
|
|
( IsEqualGUID( &lpElements->guidDataType, &DPAID_Modem ) ) ||
|
1999-11-04 03:17:03 +01:00
|
|
|
( IsEqualGUID( &lpElements->guidDataType, &DPAID_INet ) )
|
|
|
|
)
|
|
|
|
{
|
2009-01-16 09:53:59 +01:00
|
|
|
LPDPADDRESS lpdpAddress = lpAddress;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2008-03-28 23:52:28 +01:00
|
|
|
lpdpAddress->guidDataType = lpElements->guidDataType;
|
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
|
|
|
|
2009-01-16 09:53:59 +01:00
|
|
|
lstrcpynA( lpAddress, 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 ) )
|
|
|
|
)
|
|
|
|
{
|
2009-01-16 09:53:59 +01:00
|
|
|
LPDPADDRESS lpdpAddress = lpAddress;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2008-03-28 23:52:28 +01:00
|
|
|
lpdpAddress->guidDataType = lpElements->guidDataType;
|
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
|
|
|
|
2009-01-16 09:53:59 +01:00
|
|
|
lstrcpynW( lpAddress, 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 ) )
|
|
|
|
{
|
2009-01-16 09:53:59 +01:00
|
|
|
LPDPADDRESS lpdpAddress = lpAddress;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2008-03-28 23:52:28 +01:00
|
|
|
lpdpAddress->guidDataType = lpElements->guidDataType;
|
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 ) )
|
|
|
|
{
|
2009-01-16 09:53:59 +01:00
|
|
|
LPDPADDRESS lpdpAddress = lpAddress;
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2008-03-28 23:52:28 +01:00
|
|
|
lpdpAddress->guidDataType = lpElements->guidDataType;
|
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
|
|
|
|
2002-06-01 01:06:46 +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 */
|
|
|
|
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_ConnectEx( IDirectPlayLobby3 *iface, DWORD dwFlags,
|
|
|
|
REFIID riid, LPVOID* lplpDP, IUnknown* pUnk )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-17 22:07:06 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3( iface );
|
2000-07-10 15:19:28 +02:00
|
|
|
return DPL_ConnectEx( This, dwFlags, riid, lplpDP, pUnk );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 22:09:15 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_ConnectEx( IDirectPlayLobby3A *iface, DWORD dwFlags,
|
|
|
|
REFIID riid, void **lplpDP, IUnknown *pUnk )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-11 23:50:53 +02:00
|
|
|
IDirectPlayLobbyImpl *This = impl_from_IDirectPlayLobby3A( iface );
|
2000-07-10 15:19:28 +02:00
|
|
|
return DPL_ConnectEx( This, dwFlags, riid, lplpDP, pUnk );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_RegisterApplication( IDirectPlayLobby3 *iface,
|
|
|
|
DWORD flags, DPAPPLICATIONDESC *appdesc )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:09:15 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_RegisterApplication( IDirectPlayLobby3A *iface,
|
|
|
|
DWORD flags, DPAPPLICATIONDESC *appdesc )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_UnregisterApplication( IDirectPlayLobby3 *iface,
|
|
|
|
DWORD flags, REFGUID appdesc )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:09:15 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_UnregisterApplication( IDirectPlayLobby3A *iface,
|
|
|
|
DWORD flags, REFGUID appdesc )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return DP_OK;
|
|
|
|
}
|
|
|
|
|
2013-04-17 22:07:06 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3Impl_WaitForConnectionSettings( IDirectPlayLobby3 *iface,
|
|
|
|
DWORD dwFlags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
HRESULT hr = DP_OK;
|
2012-08-27 13:23:37 +02:00
|
|
|
BOOL bStartWait = !(dwFlags & DPLWAIT_CANCEL);
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx)\n", iface, dwFlags );
|
2000-07-10 15:19:28 +02:00
|
|
|
|
|
|
|
if( DPLAYX_WaitForConnectionSettings( bStartWait ) )
|
|
|
|
{
|
|
|
|
/* FIXME: What is the correct error return code? */
|
2002-06-01 01:06:46 +02:00
|
|
|
hr = DPERR_NOTLOBBIED;
|
2000-07-10 15:19:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 22:09:15 +02:00
|
|
|
static HRESULT WINAPI IDirectPlayLobby3AImpl_WaitForConnectionSettings( IDirectPlayLobby3A *iface,
|
|
|
|
DWORD dwFlags )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
HRESULT hr = DP_OK;
|
2012-08-27 13:23:37 +02:00
|
|
|
BOOL bStartWait = !(dwFlags & DPLWAIT_CANCEL);
|
2000-07-10 15:19:28 +02:00
|
|
|
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE( "(%p)->(0x%08lx)\n", iface, dwFlags );
|
2000-07-10 15:19:28 +02:00
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2013-04-17 22:12:04 +02:00
|
|
|
static const IDirectPlayLobbyVtbl dplA_vt =
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyAImpl_QueryInterface,
|
|
|
|
IDirectPlayLobbyAImpl_AddRef,
|
|
|
|
IDirectPlayLobbyAImpl_Release,
|
|
|
|
IDirectPlayLobbyAImpl_Connect,
|
|
|
|
IDirectPlayLobbyAImpl_CreateAddress,
|
|
|
|
IDirectPlayLobbyAImpl_EnumAddress,
|
|
|
|
IDirectPlayLobbyAImpl_EnumAddressTypes,
|
|
|
|
IDirectPlayLobbyAImpl_EnumLocalApplications,
|
|
|
|
IDirectPlayLobbyAImpl_GetConnectionSettings,
|
|
|
|
IDirectPlayLobbyAImpl_ReceiveLobbyMessage,
|
|
|
|
IDirectPlayLobbyAImpl_RunApplication,
|
|
|
|
IDirectPlayLobbyAImpl_SendLobbyMessage,
|
|
|
|
IDirectPlayLobbyAImpl_SetConnectionSettings,
|
|
|
|
IDirectPlayLobbyAImpl_SetLobbyMessageEvent
|
|
|
|
};
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
static const IDirectPlayLobbyVtbl dpl_vt =
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl_QueryInterface,
|
|
|
|
IDirectPlayLobbyImpl_AddRef,
|
|
|
|
IDirectPlayLobbyImpl_Release,
|
|
|
|
IDirectPlayLobbyImpl_Connect,
|
|
|
|
IDirectPlayLobbyImpl_CreateAddress,
|
|
|
|
IDirectPlayLobbyImpl_EnumAddress,
|
|
|
|
IDirectPlayLobbyImpl_EnumAddressTypes,
|
|
|
|
IDirectPlayLobbyImpl_EnumLocalApplications,
|
|
|
|
IDirectPlayLobbyImpl_GetConnectionSettings,
|
|
|
|
IDirectPlayLobbyImpl_ReceiveLobbyMessage,
|
|
|
|
IDirectPlayLobbyImpl_RunApplication,
|
|
|
|
IDirectPlayLobbyImpl_SendLobbyMessage,
|
|
|
|
IDirectPlayLobbyImpl_SetConnectionSettings,
|
|
|
|
IDirectPlayLobbyImpl_SetLobbyMessageEvent
|
|
|
|
};
|
1999-09-28 18:35:32 +02:00
|
|
|
|
2013-04-17 22:12:53 +02:00
|
|
|
static const IDirectPlayLobby2Vtbl dpl2A_vt =
|
|
|
|
{
|
|
|
|
IDirectPlayLobby2AImpl_QueryInterface,
|
|
|
|
IDirectPlayLobby2AImpl_AddRef,
|
|
|
|
IDirectPlayLobby2AImpl_Release,
|
|
|
|
IDirectPlayLobby2AImpl_Connect,
|
|
|
|
IDirectPlayLobby2AImpl_CreateAddress,
|
|
|
|
IDirectPlayLobby2AImpl_EnumAddress,
|
|
|
|
IDirectPlayLobby2AImpl_EnumAddressTypes,
|
|
|
|
IDirectPlayLobby2AImpl_EnumLocalApplications,
|
|
|
|
IDirectPlayLobby2AImpl_GetConnectionSettings,
|
|
|
|
IDirectPlayLobby2AImpl_ReceiveLobbyMessage,
|
|
|
|
IDirectPlayLobby2AImpl_RunApplication,
|
|
|
|
IDirectPlayLobby2AImpl_SendLobbyMessage,
|
|
|
|
IDirectPlayLobby2AImpl_SetConnectionSettings,
|
|
|
|
IDirectPlayLobby2AImpl_SetLobbyMessageEvent,
|
|
|
|
IDirectPlayLobby2AImpl_CreateCompoundAddress
|
|
|
|
};
|
|
|
|
|
2013-04-17 22:13:45 +02:00
|
|
|
static const IDirectPlayLobby2Vtbl dpl2_vt =
|
|
|
|
{
|
|
|
|
IDirectPlayLobby2Impl_QueryInterface,
|
|
|
|
IDirectPlayLobby2Impl_AddRef,
|
|
|
|
IDirectPlayLobby2Impl_Release,
|
|
|
|
IDirectPlayLobby2Impl_Connect,
|
|
|
|
IDirectPlayLobby2Impl_CreateAddress,
|
|
|
|
IDirectPlayLobby2Impl_EnumAddress,
|
|
|
|
IDirectPlayLobby2Impl_EnumAddressTypes,
|
|
|
|
IDirectPlayLobby2Impl_EnumLocalApplications,
|
|
|
|
IDirectPlayLobby2Impl_GetConnectionSettings,
|
|
|
|
IDirectPlayLobby2Impl_ReceiveLobbyMessage,
|
|
|
|
IDirectPlayLobby2Impl_RunApplication,
|
|
|
|
IDirectPlayLobby2Impl_SendLobbyMessage,
|
|
|
|
IDirectPlayLobby2Impl_SetConnectionSettings,
|
|
|
|
IDirectPlayLobby2Impl_SetLobbyMessageEvent,
|
|
|
|
IDirectPlayLobby2Impl_CreateCompoundAddress
|
|
|
|
};
|
|
|
|
|
2013-04-11 23:56:31 +02:00
|
|
|
static const IDirectPlayLobby3Vtbl dpl3A_vt =
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-11 23:52:18 +02:00
|
|
|
IDirectPlayLobby3AImpl_QueryInterface,
|
|
|
|
IDirectPlayLobby3AImpl_AddRef,
|
|
|
|
IDirectPlayLobby3AImpl_Release,
|
2013-04-09 22:38:44 +02:00
|
|
|
IDirectPlayLobby3AImpl_Connect,
|
2013-04-11 23:48:28 +02:00
|
|
|
IDirectPlayLobby3AImpl_CreateAddress,
|
|
|
|
IDirectPlayLobby3AImpl_EnumAddress,
|
|
|
|
IDirectPlayLobby3AImpl_EnumAddressTypes,
|
|
|
|
IDirectPlayLobby3AImpl_EnumLocalApplications,
|
|
|
|
IDirectPlayLobby3AImpl_GetConnectionSettings,
|
|
|
|
IDirectPlayLobby3AImpl_ReceiveLobbyMessage,
|
|
|
|
IDirectPlayLobby3AImpl_RunApplication,
|
|
|
|
IDirectPlayLobby3AImpl_SendLobbyMessage,
|
|
|
|
IDirectPlayLobby3AImpl_SetConnectionSettings,
|
|
|
|
IDirectPlayLobby3AImpl_SetLobbyMessageEvent,
|
|
|
|
IDirectPlayLobby3AImpl_CreateCompoundAddress,
|
|
|
|
IDirectPlayLobby3AImpl_ConnectEx,
|
|
|
|
IDirectPlayLobby3AImpl_RegisterApplication,
|
|
|
|
IDirectPlayLobby3AImpl_UnregisterApplication,
|
|
|
|
IDirectPlayLobby3AImpl_WaitForConnectionSettings
|
1999-09-28 18:35:32 +02:00
|
|
|
};
|
|
|
|
|
2013-04-11 23:56:31 +02:00
|
|
|
static const IDirectPlayLobby3Vtbl dpl3_vt =
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2013-04-11 23:52:18 +02:00
|
|
|
IDirectPlayLobby3Impl_QueryInterface,
|
|
|
|
IDirectPlayLobby3Impl_AddRef,
|
|
|
|
IDirectPlayLobby3Impl_Release,
|
2013-04-09 22:38:44 +02:00
|
|
|
IDirectPlayLobby3Impl_Connect,
|
2013-04-17 22:07:06 +02:00
|
|
|
IDirectPlayLobby3Impl_CreateAddress,
|
|
|
|
IDirectPlayLobby3Impl_EnumAddress,
|
|
|
|
IDirectPlayLobby3Impl_EnumAddressTypes,
|
|
|
|
IDirectPlayLobby3Impl_EnumLocalApplications,
|
|
|
|
IDirectPlayLobby3Impl_GetConnectionSettings,
|
|
|
|
IDirectPlayLobby3Impl_ReceiveLobbyMessage,
|
|
|
|
IDirectPlayLobby3Impl_RunApplication,
|
|
|
|
IDirectPlayLobby3Impl_SendLobbyMessage,
|
|
|
|
IDirectPlayLobby3Impl_SetConnectionSettings,
|
|
|
|
IDirectPlayLobby3Impl_SetLobbyMessageEvent,
|
|
|
|
IDirectPlayLobby3Impl_CreateCompoundAddress,
|
|
|
|
IDirectPlayLobby3Impl_ConnectEx,
|
|
|
|
IDirectPlayLobby3Impl_RegisterApplication,
|
|
|
|
IDirectPlayLobby3Impl_UnregisterApplication,
|
|
|
|
IDirectPlayLobby3Impl_WaitForConnectionSettings
|
1999-09-28 18:35:32 +02:00
|
|
|
};
|
|
|
|
|
2013-04-11 23:56:31 +02:00
|
|
|
HRESULT dplobby_create( REFIID riid, void **ppv )
|
|
|
|
{
|
|
|
|
IDirectPlayLobbyImpl *obj;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv );
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
obj = HeapAlloc( GetProcessHeap(), 0, sizeof( *obj ) );
|
|
|
|
if ( !obj )
|
|
|
|
return DPERR_OUTOFMEMORY;
|
|
|
|
|
2013-04-17 22:10:53 +02:00
|
|
|
obj->IDirectPlayLobby_iface.lpVtbl = &dpl_vt;
|
2013-04-17 22:12:04 +02:00
|
|
|
obj->IDirectPlayLobbyA_iface.lpVtbl = &dplA_vt;
|
2013-04-17 22:13:45 +02:00
|
|
|
obj->IDirectPlayLobby2_iface.lpVtbl = &dpl2_vt;
|
2013-04-17 22:12:53 +02:00
|
|
|
obj->IDirectPlayLobby2A_iface.lpVtbl = &dpl2A_vt;
|
2013-04-11 23:56:31 +02:00
|
|
|
obj->IDirectPlayLobby3_iface.lpVtbl = &dpl3_vt;
|
|
|
|
obj->IDirectPlayLobby3A_iface.lpVtbl = &dpl3A_vt;
|
2013-04-13 21:41:32 +02:00
|
|
|
obj->numIfaces = 1;
|
2014-05-07 04:06:17 +02:00
|
|
|
obj->msgtid = 0;
|
2013-04-17 22:10:53 +02:00
|
|
|
obj->ref = 0;
|
2013-04-17 22:12:04 +02:00
|
|
|
obj->refA = 0;
|
2013-04-17 22:13:45 +02:00
|
|
|
obj->ref2 = 0;
|
2013-04-17 22:12:53 +02:00
|
|
|
obj->ref2A = 0;
|
2013-04-13 21:41:32 +02:00
|
|
|
obj->ref3 = 1;
|
|
|
|
obj->ref3A = 0;
|
2013-04-11 23:56:31 +02:00
|
|
|
|
|
|
|
InitializeCriticalSection( &obj->lock );
|
|
|
|
obj->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IDirectPlayLobbyImpl.lock");
|
2013-04-17 22:14:38 +02:00
|
|
|
DPQ_INIT( obj->msgs );
|
2013-04-11 23:56:31 +02:00
|
|
|
|
2013-04-17 22:14:38 +02:00
|
|
|
hr = IDirectPlayLobby_QueryInterface( &obj->IDirectPlayLobby3_iface, riid, ppv );
|
2013-04-11 23:56:31 +02:00
|
|
|
IDirectPlayLobby_Release( &obj->IDirectPlayLobby3_iface );
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
1999-09-28 18:35:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* DirectPlayLobbyCreateA (DPLAYX.4)
|
|
|
|
*
|
|
|
|
*/
|
2013-04-17 22:09:15 +02:00
|
|
|
HRESULT WINAPI DirectPlayLobbyCreateA( GUID *lpGUIDDSP, IDirectPlayLobbyA **lplpDPL,
|
|
|
|
IUnknown *lpUnk, void *lpData, DWORD dwDataSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08lx\n",
|
1999-09-28 18:35:32 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:56:31 +02:00
|
|
|
return dplobby_create( &IID_IDirectPlayLobbyA, (void**)lplpDPL );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* DirectPlayLobbyCreateW (DPLAYX.5)
|
|
|
|
*
|
|
|
|
*/
|
2013-04-17 22:09:15 +02:00
|
|
|
HRESULT WINAPI DirectPlayLobbyCreateW( GUID *lpGUIDDSP, IDirectPlayLobby **lplpDPL,
|
|
|
|
IUnknown *lpUnk, void *lpData, DWORD dwDataSize )
|
1999-09-28 18:35:32 +02:00
|
|
|
{
|
2022-02-03 10:43:50 +01:00
|
|
|
TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08lx\n",
|
1999-09-28 18:35:32 +02:00
|
|
|
lpGUIDDSP,lplpDPL,lpUnk,lpData,dwDataSize);
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* Parameter Check: lpGUIDSP, lpUnk & lpData must be NULL. dwDataSize must
|
1999-09-28 18:35:32 +02:00
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
|
2013-04-11 23:56:31 +02:00
|
|
|
return dplobby_create( &IID_IDirectPlayLobby, (void**)lplpDPL );
|
1999-09-28 18:35:32 +02:00
|
|
|
}
|