1 /* Direct Play Lobby 2 & 3 Implementation
3 * Copyright 1998,1999,2000 - Peter Hunnisett
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define NONAMELESSUNION
23 #define NONAMELESSSTRUCT
29 #include "wine/debug.h"
31 #include "dplayx_global.h"
32 #include "dplayx_messages.h"
33 #include "dplayx_queue.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(dplay
);
39 /*****************************************************************************
40 * Predeclare the interface implementation structures
42 typedef struct IDirectPlayLobbyImpl IDirectPlayLobbyAImpl
;
43 typedef struct IDirectPlayLobbyImpl IDirectPlayLobbyWImpl
;
44 typedef struct IDirectPlayLobby2Impl IDirectPlayLobby2AImpl
;
45 typedef struct IDirectPlayLobby2Impl IDirectPlayLobby2WImpl
;
46 typedef struct IDirectPlayLobby3Impl IDirectPlayLobby3AImpl
;
47 typedef struct IDirectPlayLobby3Impl IDirectPlayLobby3WImpl
;
49 /* Forward declarations for this module helper methods */
50 HRESULT
DPL_CreateCompoundAddress ( LPCDPCOMPOUNDADDRESSELEMENT lpElements
, DWORD dwElementCount
,
51 LPVOID lpAddress
, LPDWORD lpdwAddressSize
, BOOL bAnsiInterface
)DECLSPEC_HIDDEN
;
53 static HRESULT
DPL_CreateAddress( REFGUID guidSP
, REFGUID guidDataType
, LPCVOID lpData
, DWORD dwDataSize
,
54 LPVOID lpAddress
, LPDWORD lpdwAddressSize
, BOOL bAnsiInterface
);
57 /*****************************************************************************
58 * IDirectPlayLobby {1,2,3} implementation structure
60 * The philosophy behind this extra pointer dereference is that I wanted to
61 * have the same structure for all types of objects without having to do
62 * a lot of casting. I also only wanted to implement an interface in the
63 * object it was "released" with IUnknown interface being implemented in the 1 version.
64 * Of course, with these new interfaces comes the data required to keep the state required
65 * by these interfaces. So, basically, the pointers contain the data associated with
66 * a release. If you use the data associated with release 3 in a release 2 object, you'll
67 * get a run time trap, as that won't have any data.
72 DPQ_ENTRY( DPLMSG
) msgs
; /* Link to next queued message */
74 typedef struct DPLMSG
* LPDPLMSG
;
76 typedef struct tagDirectPlayLobbyIUnknownData
79 CRITICAL_SECTION DPL_lock
;
80 } DirectPlayLobbyIUnknownData
;
82 typedef struct tagDirectPlayLobbyData
84 HKEY hkCallbackKeyHack
;
86 DPQ_HEAD( DPLMSG
) msgs
; /* List of messages received */
87 } DirectPlayLobbyData
;
89 typedef struct tagDirectPlayLobby2Data
92 } DirectPlayLobby2Data
;
94 typedef struct tagDirectPlayLobby3Data
97 } DirectPlayLobby3Data
;
99 #define DPL_IMPL_FIELDS \
100 LONG ulInterfaceRef; \
101 DirectPlayLobbyIUnknownData* unk; \
102 DirectPlayLobbyData* dpl; \
103 DirectPlayLobby2Data* dpl2; \
104 DirectPlayLobby3Data* dpl3;
106 struct IDirectPlayLobbyImpl
108 const IDirectPlayLobbyVtbl
*lpVtbl
;
112 struct IDirectPlayLobby2Impl
114 const IDirectPlayLobby2Vtbl
*lpVtbl
;
118 struct IDirectPlayLobby3Impl
120 const IDirectPlayLobby3Vtbl
*lpVtbl
;
124 /* Forward declarations of virtual tables */
125 static const IDirectPlayLobbyVtbl directPlayLobbyWVT
;
126 static const IDirectPlayLobby2Vtbl directPlayLobby2WVT
;
127 static const IDirectPlayLobby3Vtbl directPlayLobby3WVT
;
129 static const IDirectPlayLobbyVtbl directPlayLobbyAVT
;
130 static const IDirectPlayLobby2Vtbl directPlayLobby2AVT
;
131 static const IDirectPlayLobby3Vtbl directPlayLobby3AVT
;
133 static BOOL
DPL_CreateIUnknown( LPVOID lpDPL
)
135 IDirectPlayLobbyAImpl
*This
= lpDPL
;
137 This
->unk
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof( *(This
->unk
) ) );
138 if ( This
->unk
== NULL
)
143 InitializeCriticalSection( &This
->unk
->DPL_lock
);
144 This
->unk
->DPL_lock
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": IDirectPlayLobbyAImpl*->DirectPlayLobbyIUnknownData*->DPL_lock");
149 static BOOL
DPL_DestroyIUnknown( LPVOID lpDPL
)
151 IDirectPlayLobbyAImpl
*This
= lpDPL
;
153 This
->unk
->DPL_lock
.DebugInfo
->Spare
[0] = 0;
154 DeleteCriticalSection( &This
->unk
->DPL_lock
);
155 HeapFree( GetProcessHeap(), 0, This
->unk
);
160 static BOOL
DPL_CreateLobby1( LPVOID lpDPL
)
162 IDirectPlayLobbyAImpl
*This
= lpDPL
;
164 This
->dpl
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof( *(This
->dpl
) ) );
165 if ( This
->dpl
== NULL
)
170 DPQ_INIT( This
->dpl
->msgs
);
175 static BOOL
DPL_DestroyLobby1( LPVOID lpDPL
)
177 IDirectPlayLobbyAImpl
*This
= lpDPL
;
179 if( This
->dpl
->dwMsgThread
)
181 FIXME( "Should kill the msg thread\n" );
184 DPQ_DELETEQ( This
->dpl
->msgs
, msgs
, LPDPLMSG
, cbDeleteElemFromHeap
);
186 /* Delete the contents */
187 HeapFree( GetProcessHeap(), 0, This
->dpl
);
192 static BOOL
DPL_CreateLobby2( LPVOID lpDPL
)
194 IDirectPlayLobby2AImpl
*This
= lpDPL
;
196 This
->dpl2
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof( *(This
->dpl2
) ) );
197 if ( This
->dpl2
== NULL
)
205 static BOOL
DPL_DestroyLobby2( LPVOID lpDPL
)
207 IDirectPlayLobby2AImpl
*This
= lpDPL
;
209 HeapFree( GetProcessHeap(), 0, This
->dpl2
);
214 static BOOL
DPL_CreateLobby3( LPVOID lpDPL
)
216 IDirectPlayLobby3AImpl
*This
= lpDPL
;
218 This
->dpl3
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof( *(This
->dpl3
) ) );
219 if ( This
->dpl3
== NULL
)
227 static BOOL
DPL_DestroyLobby3( LPVOID lpDPL
)
229 IDirectPlayLobby3AImpl
*This
= lpDPL
;
231 HeapFree( GetProcessHeap(), 0, This
->dpl3
);
237 /* The COM interface for upversioning an interface
238 * We've been given a GUID (riid) and we need to replace the present
239 * interface with that of the requested interface.
241 * Snip from some Microsoft document:
242 * There are four requirements for implementations of QueryInterface (In these
243 * cases, "must succeed" means "must succeed barring catastrophic failure."):
245 * * The set of interfaces accessible on an object through
246 * IUnknown::QueryInterface must be static, not dynamic. This means that
247 * if a call to QueryInterface for a pointer to a specified interface
248 * succeeds the first time, it must succeed again, and if it fails the
249 * first time, it must fail on all subsequent queries.
250 * * It must be symmetric ~W if a client holds a pointer to an interface on
251 * an object, and queries for that interface, the call must succeed.
252 * * It must be reflexive ~W if a client holding a pointer to one interface
253 * queries successfully for another, a query through the obtained pointer
254 * for the first interface must succeed.
255 * * It must be transitive ~W if a client holding a pointer to one interface
256 * queries successfully for a second, and through that pointer queries
257 * successfully for a third interface, a query for the first interface
258 * through the pointer for the third interface must succeed.
260 HRESULT DPL_CreateInterface
261 ( REFIID riid
, LPVOID
* ppvObj
)
263 TRACE( " for %s\n", debugstr_guid( riid
) );
265 *ppvObj
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
,
266 sizeof( IDirectPlayLobbyWImpl
) );
268 if( *ppvObj
== NULL
)
270 return DPERR_OUTOFMEMORY
;
273 if( IsEqualGUID( &IID_IDirectPlayLobby
, riid
) )
275 IDirectPlayLobbyWImpl
*This
= *ppvObj
;
276 This
->lpVtbl
= &directPlayLobbyWVT
;
278 else if( IsEqualGUID( &IID_IDirectPlayLobbyA
, riid
) )
280 IDirectPlayLobbyAImpl
*This
= *ppvObj
;
281 This
->lpVtbl
= &directPlayLobbyAVT
;
283 else if( IsEqualGUID( &IID_IDirectPlayLobby2
, riid
) )
285 IDirectPlayLobby2WImpl
*This
= *ppvObj
;
286 This
->lpVtbl
= &directPlayLobby2WVT
;
288 else if( IsEqualGUID( &IID_IDirectPlayLobby2A
, riid
) )
290 IDirectPlayLobby2AImpl
*This
= *ppvObj
;
291 This
->lpVtbl
= &directPlayLobby2AVT
;
293 else if( IsEqualGUID( &IID_IDirectPlayLobby3
, riid
) )
295 IDirectPlayLobby3WImpl
*This
= *ppvObj
;
296 This
->lpVtbl
= &directPlayLobby3WVT
;
298 else if( IsEqualGUID( &IID_IDirectPlayLobby3A
, riid
) )
300 IDirectPlayLobby3AImpl
*This
= *ppvObj
;
301 This
->lpVtbl
= &directPlayLobby3AVT
;
305 /* Unsupported interface */
306 HeapFree( GetProcessHeap(), 0, *ppvObj
);
309 return E_NOINTERFACE
;
313 if ( DPL_CreateIUnknown( *ppvObj
) &&
314 DPL_CreateLobby1( *ppvObj
) &&
315 DPL_CreateLobby2( *ppvObj
) &&
316 DPL_CreateLobby3( *ppvObj
)
319 IDirectPlayLobby_AddRef( (LPDIRECTPLAYLOBBY
)*ppvObj
);
323 /* Initialize failed, destroy it */
324 DPL_DestroyLobby3( *ppvObj
);
325 DPL_DestroyLobby2( *ppvObj
);
326 DPL_DestroyLobby1( *ppvObj
);
327 DPL_DestroyIUnknown( *ppvObj
);
328 HeapFree( GetProcessHeap(), 0, *ppvObj
);
331 return DPERR_NOMEMORY
;
334 static HRESULT WINAPI DPL_QueryInterface
335 ( LPDIRECTPLAYLOBBYA iface
,
339 IDirectPlayLobbyAImpl
*This
= (IDirectPlayLobbyAImpl
*)iface
;
340 TRACE("(%p)->(%s,%p)\n", This
, debugstr_guid( riid
), ppvObj
);
342 *ppvObj
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
,
345 if( *ppvObj
== NULL
)
347 return DPERR_OUTOFMEMORY
;
350 CopyMemory( *ppvObj
, This
, sizeof( *This
) );
351 (*(IDirectPlayLobbyAImpl
**)ppvObj
)->ulInterfaceRef
= 0;
353 if( IsEqualGUID( &IID_IDirectPlayLobby
, riid
) )
355 IDirectPlayLobbyWImpl
*This
= *ppvObj
;
356 This
->lpVtbl
= &directPlayLobbyWVT
;
358 else if( IsEqualGUID( &IID_IDirectPlayLobbyA
, riid
) )
360 IDirectPlayLobbyAImpl
*This
= *ppvObj
;
361 This
->lpVtbl
= &directPlayLobbyAVT
;
363 else if( IsEqualGUID( &IID_IDirectPlayLobby2
, riid
) )
365 IDirectPlayLobby2WImpl
*This
= *ppvObj
;
366 This
->lpVtbl
= &directPlayLobby2WVT
;
368 else if( IsEqualGUID( &IID_IDirectPlayLobby2A
, riid
) )
370 IDirectPlayLobby2AImpl
*This
= *ppvObj
;
371 This
->lpVtbl
= &directPlayLobby2AVT
;
373 else if( IsEqualGUID( &IID_IDirectPlayLobby3
, riid
) )
375 IDirectPlayLobby3WImpl
*This
= *ppvObj
;
376 This
->lpVtbl
= &directPlayLobby3WVT
;
378 else if( IsEqualGUID( &IID_IDirectPlayLobby3A
, riid
) )
380 IDirectPlayLobby3AImpl
*This
= *ppvObj
;
381 This
->lpVtbl
= &directPlayLobby3AVT
;
385 /* Unsupported interface */
386 HeapFree( GetProcessHeap(), 0, *ppvObj
);
389 return E_NOINTERFACE
;
392 IDirectPlayLobby_AddRef( (LPDIRECTPLAYLOBBY
)*ppvObj
);
398 * Simple procedure. Just increment the reference count to this
399 * structure and return the new reference count.
401 static ULONG WINAPI DPL_AddRef
402 ( LPDIRECTPLAYLOBBY iface
)
404 ULONG ulInterfaceRefCount
, ulObjRefCount
;
405 IDirectPlayLobbyWImpl
*This
= (IDirectPlayLobbyWImpl
*)iface
;
407 ulObjRefCount
= InterlockedIncrement( &This
->unk
->ulObjRef
);
408 ulInterfaceRefCount
= InterlockedIncrement( &This
->ulInterfaceRef
);
410 TRACE( "ref count incremented to %u:%u for %p\n",
411 ulInterfaceRefCount
, ulObjRefCount
, This
);
413 return ulObjRefCount
;
417 * Simple COM procedure. Decrease the reference count to this object.
418 * If the object no longer has any reference counts, free up the associated
421 static ULONG WINAPI DPL_Release
422 ( LPDIRECTPLAYLOBBYA iface
)
424 ULONG ulInterfaceRefCount
, ulObjRefCount
;
425 IDirectPlayLobbyAImpl
*This
= (IDirectPlayLobbyAImpl
*)iface
;
427 ulObjRefCount
= InterlockedDecrement( &This
->unk
->ulObjRef
);
428 ulInterfaceRefCount
= InterlockedDecrement( &This
->ulInterfaceRef
);
430 TRACE( "ref count decremented to %u:%u for %p\n",
431 ulInterfaceRefCount
, ulObjRefCount
, This
);
433 /* Deallocate if this is the last reference to the object */
434 if( ulObjRefCount
== 0 )
436 DPL_DestroyLobby3( This
);
437 DPL_DestroyLobby2( This
);
438 DPL_DestroyLobby1( This
);
439 DPL_DestroyIUnknown( This
);
442 if( ulInterfaceRefCount
== 0 )
444 HeapFree( GetProcessHeap(), 0, This
);
447 return ulInterfaceRefCount
;
451 /********************************************************************
453 * Connects an application to the session specified by the DPLCONNECTION
454 * structure currently stored with the DirectPlayLobby object.
456 * Returns an IDirectPlay interface.
459 static HRESULT DPL_ConnectEx
460 ( IDirectPlayLobbyAImpl
* This
,
467 DWORD dwOpenFlags
= 0;
468 DWORD dwConnSize
= 0;
469 LPDPLCONNECTION lpConn
;
471 FIXME("(%p)->(0x%08x,%p,%p): semi stub\n", This
, dwFlags
, lplpDP
, pUnk
);
475 return DPERR_INVALIDPARAMS
;
478 /* Backwards compatibility */
481 dwFlags
= DPCONNECT_RETURNSTATUS
;
484 if ( ( hr
= dplay_create( riid
, lplpDP
) ) != DP_OK
)
486 ERR( "error creating interface for %s:%s.\n",
487 debugstr_guid( riid
), DPLAYX_HresultToString( hr
) );
491 /* FIXME: Is it safe/correct to use appID of 0? */
492 hr
= IDirectPlayLobby_GetConnectionSettings( (LPDIRECTPLAYLOBBY
)This
,
493 0, NULL
, &dwConnSize
);
494 if( hr
!= DPERR_BUFFERTOOSMALL
)
499 lpConn
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, dwConnSize
);
503 return DPERR_NOMEMORY
;
506 /* FIXME: Is it safe/correct to use appID of 0? */
507 hr
= IDirectPlayLobby_GetConnectionSettings( (LPDIRECTPLAYLOBBY
)This
,
508 0, lpConn
, &dwConnSize
);
511 HeapFree( GetProcessHeap(), 0, lpConn
);
516 /* - Need to call IDirectPlay::EnumConnections with the service provider to get that good information
517 * - Need to call CreateAddress to create the lpConnection param for IDirectPlay::InitializeConnection
518 * - Call IDirectPlay::InitializeConnection
521 /* Now initialize the Service Provider */
522 hr
= IDirectPlayX_InitializeConnection( (*(LPDIRECTPLAY2
*)lplpDP
),
526 /* Setup flags to pass into DirectPlay::Open */
527 if( dwFlags
& DPCONNECT_RETURNSTATUS
)
529 dwOpenFlags
|= DPOPEN_RETURNSTATUS
;
531 dwOpenFlags
|= lpConn
->dwFlags
;
533 hr
= IDirectPlayX_Open( (*(LPDIRECTPLAY2
*)lplpDP
), lpConn
->lpSessionDesc
,
536 HeapFree( GetProcessHeap(), 0, lpConn
);
541 static HRESULT WINAPI IDirectPlayLobbyAImpl_Connect
542 ( LPDIRECTPLAYLOBBYA iface
,
544 LPDIRECTPLAY2A
* lplpDP
,
547 IDirectPlayLobbyAImpl
*This
= (IDirectPlayLobbyAImpl
*)iface
;
548 return DPL_ConnectEx( This
, dwFlags
, &IID_IDirectPlay2A
,
549 (LPVOID
)lplpDP
, pUnk
);
552 static HRESULT WINAPI IDirectPlayLobbyWImpl_Connect
553 ( LPDIRECTPLAYLOBBY iface
,
555 LPDIRECTPLAY2
* lplpDP
,
558 IDirectPlayLobbyAImpl
*This
= (IDirectPlayLobbyAImpl
*)iface
; /* Yes cast to A */
559 return DPL_ConnectEx( This
, dwFlags
, &IID_IDirectPlay2
,
560 (LPVOID
)lplpDP
, pUnk
);
563 /********************************************************************
565 * Creates a DirectPlay Address, given a service provider-specific network
567 * Returns an address contains the globally unique identifier
568 * (GUID) of the service provider and data that the service provider can
569 * interpret as a network address.
571 * NOTE: It appears that this method is supposed to be really really stupid
572 * with no error checking on the contents.
574 static HRESULT WINAPI IDirectPlayLobbyAImpl_CreateAddress
575 ( LPDIRECTPLAYLOBBYA iface
,
577 REFGUID guidDataType
,
581 LPDWORD lpdwAddressSize
)
583 return DPL_CreateAddress( guidSP
, guidDataType
, lpData
, dwDataSize
,
584 lpAddress
, lpdwAddressSize
, TRUE
);
587 static HRESULT WINAPI IDirectPlayLobbyWImpl_CreateAddress
588 ( LPDIRECTPLAYLOBBY iface
,
590 REFGUID guidDataType
,
594 LPDWORD lpdwAddressSize
)
596 return DPL_CreateAddress( guidSP
, guidDataType
, lpData
, dwDataSize
,
597 lpAddress
, lpdwAddressSize
, FALSE
);
600 static HRESULT
DPL_CreateAddress(
602 REFGUID guidDataType
,
606 LPDWORD lpdwAddressSize
,
607 BOOL bAnsiInterface
)
609 const DWORD dwNumAddElements
= 2; /* Service Provide & address data type */
610 DPCOMPOUNDADDRESSELEMENT addressElements
[ 2 /* dwNumAddElements */ ];
612 TRACE( "(%p)->(%p,%p,0x%08x,%p,%p,%d)\n", guidSP
, guidDataType
, lpData
, dwDataSize
,
613 lpAddress
, lpdwAddressSize
, bAnsiInterface
);
615 addressElements
[ 0 ].guidDataType
= DPAID_ServiceProvider
;
616 addressElements
[ 0 ].dwDataSize
= sizeof( GUID
);
617 addressElements
[ 0 ].lpData
= (LPVOID
)guidSP
;
619 addressElements
[ 1 ].guidDataType
= *guidDataType
;
620 addressElements
[ 1 ].dwDataSize
= dwDataSize
;
621 addressElements
[ 1 ].lpData
= (LPVOID
)lpData
;
623 /* Call CreateCompoundAddress to cut down on code.
624 NOTE: We can do this because we don't support DPL 1 interfaces! */
625 return DPL_CreateCompoundAddress( addressElements
, dwNumAddElements
,
626 lpAddress
, lpdwAddressSize
, bAnsiInterface
);
631 /********************************************************************
633 * Parses out chunks from the DirectPlay Address buffer by calling the
634 * given callback function, with lpContext, for each of the chunks.
637 static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumAddress
638 ( LPDIRECTPLAYLOBBYA iface
,
639 LPDPENUMADDRESSCALLBACK lpEnumAddressCallback
,
644 IDirectPlayLobbyAImpl
*This
= (IDirectPlayLobbyAImpl
*)iface
;
646 TRACE("(%p)->(%p,%p,0x%08x,%p)\n", This
, lpEnumAddressCallback
, lpAddress
,
647 dwAddressSize
, lpContext
);
649 return DPL_EnumAddress( lpEnumAddressCallback
, lpAddress
, dwAddressSize
, lpContext
);
652 static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumAddress
653 ( LPDIRECTPLAYLOBBY iface
,
654 LPDPENUMADDRESSCALLBACK lpEnumAddressCallback
,
659 IDirectPlayLobbyWImpl
*This
= (IDirectPlayLobbyWImpl
*)iface
;
661 TRACE("(%p)->(%p,%p,0x%08x,%p)\n", This
, lpEnumAddressCallback
, lpAddress
,
662 dwAddressSize
, lpContext
);
664 return DPL_EnumAddress( lpEnumAddressCallback
, lpAddress
, dwAddressSize
, lpContext
);
667 HRESULT
DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback
, LPCVOID lpAddress
,
668 DWORD dwAddressSize
, LPVOID lpContext
)
670 DWORD dwTotalSizeEnumerated
= 0;
672 /* FIXME: First chunk is always the total size chunk - Should we report it? */
674 while ( dwTotalSizeEnumerated
< dwAddressSize
)
676 const DPADDRESS
* lpElements
= lpAddress
;
677 DWORD dwSizeThisEnumeration
;
679 /* Invoke the enum method. If false is returned, stop enumeration */
680 if ( !lpEnumAddressCallback( &lpElements
->guidDataType
,
681 lpElements
->dwDataSize
,
682 (const BYTE
*)lpElements
+ sizeof( DPADDRESS
),
688 dwSizeThisEnumeration
= sizeof( DPADDRESS
) + lpElements
->dwDataSize
;
689 lpAddress
= (const BYTE
*) lpAddress
+ dwSizeThisEnumeration
;
690 dwTotalSizeEnumerated
+= dwSizeThisEnumeration
;
696 /********************************************************************
698 * Enumerates all the address types that a given service provider needs to
699 * build the DirectPlay Address.
702 static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumAddressTypes
703 ( LPDIRECTPLAYLOBBYA iface
,
704 LPDPLENUMADDRESSTYPESCALLBACK lpEnumAddressTypeCallback
,
709 IDirectPlayLobbyAImpl
*This
= (IDirectPlayLobbyAImpl
*)iface
;
712 LPCSTR searchSubKey
= "SOFTWARE\\Microsoft\\DirectPlay\\Service Providers";
713 DWORD dwIndex
, sizeOfSubKeyName
=50;
717 TRACE(" (%p)->(%p,%p,%p,0x%08x)\n", This
, lpEnumAddressTypeCallback
, guidSP
, lpContext
, dwFlags
);
721 return DPERR_INVALIDPARAMS
;
724 if( !lpEnumAddressTypeCallback
)
726 return DPERR_INVALIDPARAMS
;
731 return DPERR_INVALIDOBJECT
;
734 /* Need to loop over the service providers in the registry */
735 if( RegOpenKeyExA( HKEY_LOCAL_MACHINE
, searchSubKey
,
736 0, KEY_READ
, &hkResult
) != ERROR_SUCCESS
)
738 /* Hmmm. Does this mean that there are no service providers? */
739 ERR(": no service providers?\n");
743 /* Traverse all the service providers we have available */
745 RegEnumKeyExA( hkResult
, dwIndex
, subKeyName
, &sizeOfSubKeyName
,
746 NULL
, NULL
, NULL
, &filetime
) != ERROR_NO_MORE_ITEMS
;
747 ++dwIndex
, sizeOfSubKeyName
=50 )
750 HKEY hkServiceProvider
, hkServiceProviderAt
;
751 GUID serviceProviderGUID
;
752 DWORD returnTypeGUID
, sizeOfReturnBuffer
= 50;
754 char returnBuffer
[51];
757 LPCSTR atKey
= "Address Types";
758 LPCSTR guidDataSubKey
= "Guid";
762 TRACE(" this time through: %s\n", subKeyName
);
764 /* Get a handle for this particular service provider */
765 if( RegOpenKeyExA( hkResult
, subKeyName
, 0, KEY_READ
,
766 &hkServiceProvider
) != ERROR_SUCCESS
)
768 ERR(": what the heck is going on?\n" );
772 if( RegQueryValueExA( hkServiceProvider
, guidDataSubKey
,
773 NULL
, &returnTypeGUID
, (LPBYTE
)returnBuffer
,
774 &sizeOfReturnBuffer
) != ERROR_SUCCESS
)
776 ERR(": missing GUID registry data members\n" );
780 /* FIXME: Check return types to ensure we're interpreting data right */
781 MultiByteToWideChar( CP_ACP
, 0, returnBuffer
, -1, buff
, sizeof(buff
)/sizeof(WCHAR
) );
782 CLSIDFromString( buff
, &serviceProviderGUID
);
783 /* FIXME: Have I got a memory leak on the serviceProviderGUID? */
785 /* Determine if this is the Service Provider that the user asked for */
786 if( !IsEqualGUID( &serviceProviderGUID
, guidSP
) )
791 /* Get a handle for this particular service provider */
792 if( RegOpenKeyExA( hkServiceProvider
, atKey
, 0, KEY_READ
,
793 &hkServiceProviderAt
) != ERROR_SUCCESS
)
795 TRACE(": No Address Types registry data sub key/members\n" );
799 /* Traverse all the address type we have available */
801 RegEnumKeyExA( hkServiceProviderAt
, dwAtIndex
, atSubKey
, &sizeOfSubKeyName
,
802 NULL
, NULL
, NULL
, &filetime
) != ERROR_NO_MORE_ITEMS
;
803 ++dwAtIndex
, sizeOfSubKeyName
=50 )
805 TRACE( "Found Address Type GUID %s\n", atSubKey
);
807 /* FIXME: Check return types to ensure we're interpreting data right */
808 MultiByteToWideChar( CP_ACP
, 0, atSubKey
, -1, buff
, sizeof(buff
)/sizeof(WCHAR
) );
809 CLSIDFromString( buff
, &serviceProviderGUID
);
810 /* FIXME: Have I got a memory leak on the serviceProviderGUID? */
812 /* The enumeration will return FALSE if we are not to continue */
813 if( !lpEnumAddressTypeCallback( &serviceProviderGUID
, lpContext
, 0 ) )
815 WARN("lpEnumCallback returning FALSE\n" );
816 break; /* FIXME: This most likely has to break from the procedure...*/
821 /* We only enumerate address types for 1 GUID. We've found it, so quit looking */
828 static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumAddressTypes
829 ( LPDIRECTPLAYLOBBY iface
,
830 LPDPLENUMADDRESSTYPESCALLBACK lpEnumAddressTypeCallback
,
836 return DPERR_OUTOFMEMORY
;
839 /********************************************************************
841 * Enumerates what applications are registered with DirectPlay by
842 * invoking the callback function with lpContext.
845 static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumLocalApplications
846 ( LPDIRECTPLAYLOBBY iface
,
847 LPDPLENUMLOCALAPPLICATIONSCALLBACK lpEnumLocalAppCallback
,
851 IDirectPlayLobbyWImpl
*This
= (IDirectPlayLobbyWImpl
*)iface
;
853 FIXME("(%p)->(%p,%p,0x%08x):stub\n", This
, lpEnumLocalAppCallback
, lpContext
, dwFlags
);
855 return DPERR_OUTOFMEMORY
;
858 static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumLocalApplications
859 ( LPDIRECTPLAYLOBBYA iface
,
860 LPDPLENUMLOCALAPPLICATIONSCALLBACK lpEnumLocalAppCallback
,
864 IDirectPlayLobbyAImpl
*This
= (IDirectPlayLobbyAImpl
*)iface
;
867 LPCSTR searchSubKey
= "SOFTWARE\\Microsoft\\DirectPlay\\Applications";
868 LPCSTR guidDataSubKey
= "Guid";
869 DWORD dwIndex
, sizeOfSubKeyName
=50;
873 TRACE("(%p)->(%p,%p,0x%08x)\n", This
, lpEnumLocalAppCallback
, lpContext
, dwFlags
);
877 return DPERR_INVALIDPARAMS
;
880 if( !lpEnumLocalAppCallback
)
882 return DPERR_INVALIDPARAMS
;
885 /* Need to loop over the service providers in the registry */
886 if( RegOpenKeyExA( HKEY_LOCAL_MACHINE
, searchSubKey
,
887 0, KEY_READ
, &hkResult
) != ERROR_SUCCESS
)
889 /* Hmmm. Does this mean that there are no service providers? */
890 ERR(": no service providers?\n");
894 /* Traverse all registered applications */
896 RegEnumKeyExA( hkResult
, dwIndex
, subKeyName
, &sizeOfSubKeyName
, NULL
, NULL
, NULL
, &filetime
) != ERROR_NO_MORE_ITEMS
;
897 ++dwIndex
, sizeOfSubKeyName
=50 )
900 HKEY hkServiceProvider
;
901 GUID serviceProviderGUID
;
902 DWORD returnTypeGUID
, sizeOfReturnBuffer
= 50;
903 char returnBuffer
[51];
905 DPLAPPINFO dplAppInfo
;
907 TRACE(" this time through: %s\n", subKeyName
);
909 /* Get a handle for this particular service provider */
910 if( RegOpenKeyExA( hkResult
, subKeyName
, 0, KEY_READ
,
911 &hkServiceProvider
) != ERROR_SUCCESS
)
913 ERR(": what the heck is going on?\n" );
917 if( RegQueryValueExA( hkServiceProvider
, guidDataSubKey
,
918 NULL
, &returnTypeGUID
, (LPBYTE
)returnBuffer
,
919 &sizeOfReturnBuffer
) != ERROR_SUCCESS
)
921 ERR(": missing GUID registry data members\n" );
925 /* FIXME: Check return types to ensure we're interpreting data right */
926 MultiByteToWideChar( CP_ACP
, 0, returnBuffer
, -1, buff
, sizeof(buff
)/sizeof(WCHAR
) );
927 CLSIDFromString( buff
, &serviceProviderGUID
);
928 /* FIXME: Have I got a memory leak on the serviceProviderGUID? */
930 dplAppInfo
.dwSize
= sizeof( dplAppInfo
);
931 dplAppInfo
.guidApplication
= serviceProviderGUID
;
932 dplAppInfo
.u
.lpszAppNameA
= subKeyName
;
934 EnterCriticalSection( &This
->unk
->DPL_lock
);
936 memcpy( &This
->dpl
->hkCallbackKeyHack
, &hkServiceProvider
, sizeof( hkServiceProvider
) );
938 if( !lpEnumLocalAppCallback( &dplAppInfo
, lpContext
, dwFlags
) )
940 LeaveCriticalSection( &This
->unk
->DPL_lock
);
944 LeaveCriticalSection( &This
->unk
->DPL_lock
);
950 /********************************************************************
952 * Retrieves the DPLCONNECTION structure that contains all the information
953 * needed to start and connect an application. This was generated using
954 * either the RunApplication or SetConnectionSettings methods.
956 * NOTES: If lpData is NULL then just return lpdwDataSize. This allows
957 * the data structure to be allocated by our caller which can then
958 * call this procedure/method again with a valid data pointer.
960 static HRESULT WINAPI IDirectPlayLobbyAImpl_GetConnectionSettings
961 ( LPDIRECTPLAYLOBBYA iface
,
964 LPDWORD lpdwDataSize
)
966 IDirectPlayLobbyAImpl
*This
= (IDirectPlayLobbyAImpl
*)iface
;
969 TRACE("(%p)->(0x%08x,%p,%p)\n", This
, dwAppID
, lpData
, lpdwDataSize
);
971 EnterCriticalSection( &This
->unk
->DPL_lock
);
973 hr
= DPLAYX_GetConnectionSettingsA( dwAppID
,
978 LeaveCriticalSection( &This
->unk
->DPL_lock
);
983 static HRESULT WINAPI IDirectPlayLobbyWImpl_GetConnectionSettings
984 ( LPDIRECTPLAYLOBBY iface
,
987 LPDWORD lpdwDataSize
)
989 IDirectPlayLobbyWImpl
*This
= (IDirectPlayLobbyWImpl
*)iface
;
992 TRACE("(%p)->(0x%08x,%p,%p)\n", This
, dwAppID
, lpData
, lpdwDataSize
);
994 EnterCriticalSection( &This
->unk
->DPL_lock
);
996 hr
= DPLAYX_GetConnectionSettingsW( dwAppID
,
1001 LeaveCriticalSection( &This
->unk
->DPL_lock
);
1006 /********************************************************************
1008 * Retrieves the message sent between a lobby client and a DirectPlay
1009 * application. All messages are queued until received.
1012 static HRESULT WINAPI IDirectPlayLobbyAImpl_ReceiveLobbyMessage
1013 ( LPDIRECTPLAYLOBBYA iface
,
1016 LPDWORD lpdwMessageFlags
,
1018 LPDWORD lpdwDataSize
)
1020 IDirectPlayLobbyAImpl
*This
= (IDirectPlayLobbyAImpl
*)iface
;
1021 FIXME(":stub %p %08x %08x %p %p %p\n", This
, dwFlags
, dwAppID
, lpdwMessageFlags
, lpData
,
1023 return DPERR_OUTOFMEMORY
;
1026 static HRESULT WINAPI IDirectPlayLobbyWImpl_ReceiveLobbyMessage
1027 ( LPDIRECTPLAYLOBBY iface
,
1030 LPDWORD lpdwMessageFlags
,
1032 LPDWORD lpdwDataSize
)
1034 IDirectPlayLobbyWImpl
*This
= (IDirectPlayLobbyWImpl
*)iface
;
1035 FIXME(":stub %p %08x %08x %p %p %p\n", This
, dwFlags
, dwAppID
, lpdwMessageFlags
, lpData
,
1037 return DPERR_OUTOFMEMORY
;
1040 typedef struct tagRunApplicationEnumStruct
1042 IDirectPlayLobbyAImpl
* This
;
1047 LPSTR lpszCommandLine
;
1048 LPSTR lpszCurrentDirectory
;
1049 } RunApplicationEnumStruct
, *lpRunApplicationEnumStruct
;
1051 /* To be called by RunApplication to find how to invoke the function */
1052 static BOOL CALLBACK RunApplicationA_EnumLocalApplications
1053 ( LPCDPLAPPINFO lpAppInfo
,
1057 lpRunApplicationEnumStruct lpData
= (lpRunApplicationEnumStruct
)lpContext
;
1059 if( IsEqualGUID( &lpAppInfo
->guidApplication
, &lpData
->appGUID
) )
1061 char returnBuffer
[200];
1062 DWORD returnType
, sizeOfReturnBuffer
;
1063 LPCSTR clSubKey
= "CommandLine";
1064 LPCSTR cdSubKey
= "CurrentDirectory";
1065 LPCSTR fileSubKey
= "File";
1066 LPCSTR pathSubKey
= "Path";
1068 /* FIXME: Lazy man hack - dplay struct has the present reg key saved */
1070 sizeOfReturnBuffer
= 200;
1072 /* Get all the appropriate data from the registry */
1073 if( RegQueryValueExA( lpData
->This
->dpl
->hkCallbackKeyHack
, clSubKey
,
1074 NULL
, &returnType
, (LPBYTE
)returnBuffer
,
1075 &sizeOfReturnBuffer
) != ERROR_SUCCESS
)
1077 ERR( ": missing CommandLine registry data member\n" );
1081 if ((lpData
->lpszCommandLine
= HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer
)+1 )))
1082 strcpy( lpData
->lpszCommandLine
, returnBuffer
);
1085 sizeOfReturnBuffer
= 200;
1087 if( RegQueryValueExA( lpData
->This
->dpl
->hkCallbackKeyHack
, cdSubKey
,
1088 NULL
, &returnType
, (LPBYTE
)returnBuffer
,
1089 &sizeOfReturnBuffer
) != ERROR_SUCCESS
)
1091 ERR( ": missing CurrentDirectory registry data member\n" );
1095 if ((lpData
->lpszCurrentDirectory
= HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer
)+1 )))
1096 strcpy( lpData
->lpszCurrentDirectory
, returnBuffer
);
1099 sizeOfReturnBuffer
= 200;
1101 if( RegQueryValueExA( lpData
->This
->dpl
->hkCallbackKeyHack
, fileSubKey
,
1102 NULL
, &returnType
, (LPBYTE
)returnBuffer
,
1103 &sizeOfReturnBuffer
) != ERROR_SUCCESS
)
1105 ERR( ": missing File registry data member\n" );
1109 if ((lpData
->lpszFileName
= HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer
)+1 )))
1110 strcpy( lpData
->lpszFileName
, returnBuffer
);
1113 sizeOfReturnBuffer
= 200;
1115 if( RegQueryValueExA( lpData
->This
->dpl
->hkCallbackKeyHack
, pathSubKey
,
1116 NULL
, &returnType
, (LPBYTE
)returnBuffer
,
1117 &sizeOfReturnBuffer
) != ERROR_SUCCESS
)
1119 ERR( ": missing Path registry data member\n" );
1123 if ((lpData
->lpszPath
= HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer
)+1 )))
1124 strcpy( lpData
->lpszPath
, returnBuffer
);
1127 return FALSE
; /* No need to keep going as we found what we wanted */
1130 return TRUE
; /* Keep enumerating, haven't found the application yet */
1133 static BOOL
DPL_CreateAndSetLobbyHandles( DWORD dwDestProcessId
, HANDLE hDestProcess
,
1134 LPHANDLE lphStart
, LPHANDLE lphDeath
,
1137 /* These are the handles for the created process */
1138 HANDLE hAppStart
= 0, hAppDeath
= 0, hAppRead
= 0;
1139 SECURITY_ATTRIBUTES s_attrib
;
1141 s_attrib
.nLength
= sizeof( s_attrib
);
1142 s_attrib
.lpSecurityDescriptor
= NULL
;
1143 s_attrib
.bInheritHandle
= TRUE
;
1145 *lphStart
= CreateEventW( &s_attrib
, TRUE
, FALSE
, NULL
);
1146 *lphDeath
= CreateEventW( &s_attrib
, TRUE
, FALSE
, NULL
);
1147 *lphRead
= CreateEventW( &s_attrib
, TRUE
, FALSE
, NULL
);
1149 if( ( !DuplicateHandle( GetCurrentProcess(), *lphStart
,
1150 hDestProcess
, &hAppStart
,
1151 0, FALSE
, DUPLICATE_SAME_ACCESS
) ) ||
1152 ( !DuplicateHandle( GetCurrentProcess(), *lphDeath
,
1153 hDestProcess
, &hAppDeath
,
1154 0, FALSE
, DUPLICATE_SAME_ACCESS
) ) ||
1155 ( !DuplicateHandle( GetCurrentProcess(), *lphRead
,
1156 hDestProcess
, &hAppRead
,
1157 0, FALSE
, DUPLICATE_SAME_ACCESS
) )
1160 if (*lphStart
) { CloseHandle(*lphStart
); *lphStart
= 0; }
1161 if (*lphDeath
) { CloseHandle(*lphDeath
); *lphDeath
= 0; }
1162 if (*lphRead
) { CloseHandle(*lphRead
); *lphRead
= 0; }
1163 /* FIXME: Handle leak... */
1164 ERR( "Unable to dup handles\n" );
1168 if( !DPLAYX_SetLobbyHandles( dwDestProcessId
,
1169 hAppStart
, hAppDeath
, hAppRead
) )
1171 /* FIXME: Handle leak... */
1179 /********************************************************************
1181 * Starts an application and passes to it all the information to
1182 * connect to a session.
1185 static HRESULT WINAPI IDirectPlayLobbyAImpl_RunApplication
1186 ( LPDIRECTPLAYLOBBYA iface
,
1189 LPDPLCONNECTION lpConn
,
1190 HANDLE hReceiveEvent
)
1192 IDirectPlayLobbyAImpl
*This
= (IDirectPlayLobbyAImpl
*)iface
;
1194 RunApplicationEnumStruct enumData
;
1196 STARTUPINFOA startupInfo
;
1197 PROCESS_INFORMATION newProcessInfo
;
1199 DWORD dwSuspendCount
;
1200 HANDLE hStart
, hDeath
, hSettingRead
;
1202 TRACE( "(%p)->(0x%08x,%p,%p,%p)\n",
1203 This
, dwFlags
, lpdwAppID
, lpConn
, hReceiveEvent
);
1207 return DPERR_INVALIDPARAMS
;
1210 if( DPLAYX_AnyLobbiesWaitingForConnSettings() )
1212 FIXME( "Waiting lobby not being handled correctly\n" );
1215 EnterCriticalSection( &This
->unk
->DPL_lock
);
1217 ZeroMemory( &enumData
, sizeof( enumData
) );
1218 enumData
.This
= This
;
1219 enumData
.appGUID
= lpConn
->lpSessionDesc
->guidApplication
;
1221 /* Our callback function will fill up the enumData structure with all the information
1222 required to start a new process */
1223 IDirectPlayLobby_EnumLocalApplications( iface
, RunApplicationA_EnumLocalApplications
,
1226 /* First the application name */
1227 strcpy( temp
, enumData
.lpszPath
);
1228 strcat( temp
, "\\" );
1229 strcat( temp
, enumData
.lpszFileName
);
1230 HeapFree( GetProcessHeap(), 0, enumData
.lpszPath
);
1231 HeapFree( GetProcessHeap(), 0, enumData
.lpszFileName
);
1232 if ((appName
= HeapAlloc( GetProcessHeap(), 0, strlen(temp
)+1 ))) strcpy( appName
, temp
);
1234 /* Now the command line */
1235 strcat( temp
, " " );
1236 strcat( temp
, enumData
.lpszCommandLine
);
1237 HeapFree( GetProcessHeap(), 0, enumData
.lpszCommandLine
);
1238 if ((enumData
.lpszCommandLine
= HeapAlloc( GetProcessHeap(), 0, strlen(temp
)+1 )))
1239 strcpy( enumData
.lpszCommandLine
, temp
);
1241 ZeroMemory( &startupInfo
, sizeof( startupInfo
) );
1242 startupInfo
.cb
= sizeof( startupInfo
);
1243 /* FIXME: Should any fields be filled in? */
1245 ZeroMemory( &newProcessInfo
, sizeof( newProcessInfo
) );
1247 if( !CreateProcessA( appName
,
1248 enumData
.lpszCommandLine
,
1252 CREATE_DEFAULT_ERROR_MODE
| CREATE_NEW_CONSOLE
| CREATE_SUSPENDED
, /* Creation Flags */
1254 enumData
.lpszCurrentDirectory
,
1260 ERR( "Failed to create process for app %s\n", appName
);
1262 HeapFree( GetProcessHeap(), 0, appName
);
1263 HeapFree( GetProcessHeap(), 0, enumData
.lpszCommandLine
);
1264 HeapFree( GetProcessHeap(), 0, enumData
.lpszCurrentDirectory
);
1266 LeaveCriticalSection( &This
->unk
->DPL_lock
);
1267 return DPERR_CANTCREATEPROCESS
;
1270 HeapFree( GetProcessHeap(), 0, appName
);
1271 HeapFree( GetProcessHeap(), 0, enumData
.lpszCommandLine
);
1272 HeapFree( GetProcessHeap(), 0, enumData
.lpszCurrentDirectory
);
1274 /* Reserve this global application id! */
1275 if( !DPLAYX_CreateLobbyApplication( newProcessInfo
.dwProcessId
) )
1277 ERR( "Unable to create global application data for 0x%08x\n",
1278 newProcessInfo
.dwProcessId
);
1281 hr
= IDirectPlayLobby_SetConnectionSettings( iface
, 0, newProcessInfo
.dwProcessId
, lpConn
);
1285 ERR( "SetConnectionSettings failure %s\n", DPLAYX_HresultToString( hr
) );
1286 LeaveCriticalSection( &This
->unk
->DPL_lock
);
1290 /* Setup the handles for application notification */
1291 DPL_CreateAndSetLobbyHandles( newProcessInfo
.dwProcessId
,
1292 newProcessInfo
.hProcess
,
1293 &hStart
, &hDeath
, &hSettingRead
);
1295 /* Setup the message thread ID */
1296 This
->dpl
->dwMsgThread
=
1297 CreateLobbyMessageReceptionThread( hReceiveEvent
, hStart
, hDeath
, hSettingRead
);
1299 DPLAYX_SetLobbyMsgThreadId( newProcessInfo
.dwProcessId
, This
->dpl
->dwMsgThread
);
1301 LeaveCriticalSection( &This
->unk
->DPL_lock
);
1303 /* Everything seems to have been set correctly, update the dwAppID */
1304 *lpdwAppID
= newProcessInfo
.dwProcessId
;
1306 /* Unsuspend the process - should return the prev suspension count */
1307 if( ( dwSuspendCount
= ResumeThread( newProcessInfo
.hThread
) ) != 1 )
1309 ERR( "ResumeThread failed with 0x%08x\n", dwSuspendCount
);
1315 static HRESULT WINAPI IDirectPlayLobbyWImpl_RunApplication
1316 ( LPDIRECTPLAYLOBBY iface
,
1319 LPDPLCONNECTION lpConn
,
1320 HANDLE hReceiveEvent
)
1322 IDirectPlayLobbyWImpl
*This
= (IDirectPlayLobbyWImpl
*)iface
;
1323 FIXME( "(%p)->(0x%08x,%p,%p,%p):stub\n", This
, dwFlags
, lpdwAppID
, lpConn
, hReceiveEvent
);
1324 return DPERR_OUTOFMEMORY
;
1327 /********************************************************************
1329 * Sends a message between the application and the lobby client.
1330 * All messages are queued until received.
1333 static HRESULT WINAPI IDirectPlayLobbyAImpl_SendLobbyMessage
1334 ( LPDIRECTPLAYLOBBYA iface
,
1341 return DPERR_OUTOFMEMORY
;
1344 static HRESULT WINAPI IDirectPlayLobbyWImpl_SendLobbyMessage
1345 ( LPDIRECTPLAYLOBBY iface
,
1352 return DPERR_OUTOFMEMORY
;
1355 /********************************************************************
1357 * Modifies the DPLCONNECTION structure to contain all information
1358 * needed to start and connect an application.
1361 static HRESULT WINAPI IDirectPlayLobbyWImpl_SetConnectionSettings
1362 ( LPDIRECTPLAYLOBBY iface
,
1365 LPDPLCONNECTION lpConn
)
1367 IDirectPlayLobbyWImpl
*This
= (IDirectPlayLobbyWImpl
*)iface
;
1370 TRACE("(%p)->(0x%08x,0x%08x,%p)\n", This
, dwFlags
, dwAppID
, lpConn
);
1372 EnterCriticalSection( &This
->unk
->DPL_lock
);
1374 hr
= DPLAYX_SetConnectionSettingsW( dwFlags
, dwAppID
, lpConn
);
1376 /* FIXME: Don't think that this is supposed to fail, but the documentation
1377 is somewhat sketchy. I'll try creating a lobby application
1379 if( hr
== DPERR_NOTLOBBIED
)
1381 FIXME( "Unlobbied app setting connections. Is this correct behavior?\n" );
1384 dwAppID
= GetCurrentProcessId();
1386 DPLAYX_CreateLobbyApplication( dwAppID
);
1387 hr
= DPLAYX_SetConnectionSettingsW( dwFlags
, dwAppID
, lpConn
);
1390 LeaveCriticalSection( &This
->unk
->DPL_lock
);
1395 static HRESULT WINAPI IDirectPlayLobbyAImpl_SetConnectionSettings
1396 ( LPDIRECTPLAYLOBBYA iface
,
1399 LPDPLCONNECTION lpConn
)
1401 IDirectPlayLobbyAImpl
*This
= (IDirectPlayLobbyAImpl
*)iface
;
1404 TRACE("(%p)->(0x%08x,0x%08x,%p)\n", This
, dwFlags
, dwAppID
, lpConn
);
1406 EnterCriticalSection( &This
->unk
->DPL_lock
);
1408 hr
= DPLAYX_SetConnectionSettingsA( dwFlags
, dwAppID
, lpConn
);
1410 /* FIXME: Don't think that this is supposed to fail, but the documentation
1411 is somewhat sketchy. I'll try creating a lobby application
1413 if( hr
== DPERR_NOTLOBBIED
)
1415 FIXME( "Unlobbied app setting connections. Is this correct behavior?\n" );
1416 dwAppID
= GetCurrentProcessId();
1417 DPLAYX_CreateLobbyApplication( dwAppID
);
1418 hr
= DPLAYX_SetConnectionSettingsA( dwFlags
, dwAppID
, lpConn
);
1421 LeaveCriticalSection( &This
->unk
->DPL_lock
);
1426 /********************************************************************
1428 * Registers an event that will be set when a lobby message is received.
1431 static HRESULT WINAPI IDirectPlayLobbyAImpl_SetLobbyMessageEvent
1432 ( LPDIRECTPLAYLOBBYA iface
,
1435 HANDLE hReceiveEvent
)
1438 return DPERR_OUTOFMEMORY
;
1441 static HRESULT WINAPI IDirectPlayLobbyWImpl_SetLobbyMessageEvent
1442 ( LPDIRECTPLAYLOBBY iface
,
1445 HANDLE hReceiveEvent
)
1448 return DPERR_OUTOFMEMORY
;
1453 static HRESULT WINAPI IDirectPlayLobby2WImpl_CreateCompoundAddress
1454 ( LPDIRECTPLAYLOBBY2 iface
,
1455 LPCDPCOMPOUNDADDRESSELEMENT lpElements
,
1456 DWORD dwElementCount
,
1458 LPDWORD lpdwAddressSize
)
1460 return DPL_CreateCompoundAddress( lpElements
, dwElementCount
, lpAddress
, lpdwAddressSize
, FALSE
);
1463 static HRESULT WINAPI IDirectPlayLobby2AImpl_CreateCompoundAddress
1464 ( LPDIRECTPLAYLOBBY2A iface
,
1465 LPCDPCOMPOUNDADDRESSELEMENT lpElements
,
1466 DWORD dwElementCount
,
1468 LPDWORD lpdwAddressSize
)
1470 return DPL_CreateCompoundAddress( lpElements
, dwElementCount
, lpAddress
, lpdwAddressSize
, TRUE
);
1473 HRESULT DPL_CreateCompoundAddress
1474 ( LPCDPCOMPOUNDADDRESSELEMENT lpElements
,
1475 DWORD dwElementCount
,
1477 LPDWORD lpdwAddressSize
,
1478 BOOL bAnsiInterface
)
1480 DWORD dwSizeRequired
= 0;
1482 LPCDPCOMPOUNDADDRESSELEMENT lpOrigElements
= lpElements
;
1484 TRACE("(%p,0x%08x,%p,%p)\n", lpElements
, dwElementCount
, lpAddress
, lpdwAddressSize
);
1486 /* Parameter check */
1487 if( ( lpElements
== NULL
) ||
1488 ( dwElementCount
== 0 ) /* FIXME: Not sure if this is a failure case */
1491 return DPERR_INVALIDPARAMS
;
1494 /* Add the total size chunk */
1495 dwSizeRequired
+= sizeof( DPADDRESS
) + sizeof( DWORD
);
1497 /* Calculate the size of the buffer required */
1498 for ( dwElements
= dwElementCount
; dwElements
> 0; --dwElements
, ++lpElements
)
1500 if ( ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_ServiceProvider
) ) ||
1501 ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_LobbyProvider
) )
1504 dwSizeRequired
+= sizeof( DPADDRESS
) + sizeof( GUID
);
1506 else if ( ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_Phone
) ) ||
1507 ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_Modem
) ) ||
1508 ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_INet
) )
1511 if( !bAnsiInterface
)
1513 ERR( "Ansi GUIDs used for unicode interface\n" );
1514 return DPERR_INVALIDFLAGS
;
1517 dwSizeRequired
+= sizeof( DPADDRESS
) + lpElements
->dwDataSize
;
1519 else if ( ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_PhoneW
) ) ||
1520 ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_ModemW
) ) ||
1521 ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_INetW
) )
1524 if( bAnsiInterface
)
1526 ERR( "Unicode GUIDs used for ansi interface\n" );
1527 return DPERR_INVALIDFLAGS
;
1530 FIXME( "Right size for unicode interface?\n" );
1531 dwSizeRequired
+= sizeof( DPADDRESS
) + lpElements
->dwDataSize
* sizeof( WCHAR
);
1533 else if ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_INetPort
) )
1535 dwSizeRequired
+= sizeof( DPADDRESS
) + sizeof( WORD
);
1537 else if ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_ComPort
) )
1539 FIXME( "Right size for unicode interface?\n" );
1540 dwSizeRequired
+= sizeof( DPADDRESS
) + sizeof( DPCOMPORTADDRESS
); /* FIXME: Right size? */
1544 ERR( "Unknown GUID %s\n", debugstr_guid(&lpElements
->guidDataType
) );
1545 return DPERR_INVALIDFLAGS
;
1549 /* The user wants to know how big a buffer to allocate for us */
1550 if( ( lpAddress
== NULL
) ||
1551 ( *lpdwAddressSize
< dwSizeRequired
)
1554 *lpdwAddressSize
= dwSizeRequired
;
1555 return DPERR_BUFFERTOOSMALL
;
1558 /* Add the total size chunk */
1560 LPDPADDRESS lpdpAddress
= lpAddress
;
1562 lpdpAddress
->guidDataType
= DPAID_TotalSize
;
1563 lpdpAddress
->dwDataSize
= sizeof( DWORD
);
1564 lpAddress
= (char *) lpAddress
+ sizeof( DPADDRESS
);
1566 *(LPDWORD
)lpAddress
= dwSizeRequired
;
1567 lpAddress
= (char *) lpAddress
+ sizeof( DWORD
);
1570 /* Calculate the size of the buffer required */
1571 for( dwElements
= dwElementCount
, lpElements
= lpOrigElements
;
1573 --dwElements
, ++lpElements
)
1575 if ( ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_ServiceProvider
) ) ||
1576 ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_LobbyProvider
) )
1579 LPDPADDRESS lpdpAddress
= lpAddress
;
1581 lpdpAddress
->guidDataType
= lpElements
->guidDataType
;
1582 lpdpAddress
->dwDataSize
= sizeof( GUID
);
1583 lpAddress
= (char *) lpAddress
+ sizeof( DPADDRESS
);
1585 CopyMemory( lpAddress
, lpElements
->lpData
, sizeof( GUID
) );
1586 lpAddress
= (char *) lpAddress
+ sizeof( GUID
);
1588 else if ( ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_Phone
) ) ||
1589 ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_Modem
) ) ||
1590 ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_INet
) )
1593 LPDPADDRESS lpdpAddress
= lpAddress
;
1595 lpdpAddress
->guidDataType
= lpElements
->guidDataType
;
1596 lpdpAddress
->dwDataSize
= lpElements
->dwDataSize
;
1597 lpAddress
= (char *) lpAddress
+ sizeof( DPADDRESS
);
1599 lstrcpynA( lpAddress
, lpElements
->lpData
, lpElements
->dwDataSize
);
1600 lpAddress
= (char *) lpAddress
+ lpElements
->dwDataSize
;
1602 else if ( ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_PhoneW
) ) ||
1603 ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_ModemW
) ) ||
1604 ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_INetW
) )
1607 LPDPADDRESS lpdpAddress
= lpAddress
;
1609 lpdpAddress
->guidDataType
= lpElements
->guidDataType
;
1610 lpdpAddress
->dwDataSize
= lpElements
->dwDataSize
;
1611 lpAddress
= (char *) lpAddress
+ sizeof( DPADDRESS
);
1613 lstrcpynW( lpAddress
, lpElements
->lpData
, lpElements
->dwDataSize
);
1614 lpAddress
= (char *) lpAddress
+ lpElements
->dwDataSize
* sizeof( WCHAR
);
1616 else if ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_INetPort
) )
1618 LPDPADDRESS lpdpAddress
= lpAddress
;
1620 lpdpAddress
->guidDataType
= lpElements
->guidDataType
;
1621 lpdpAddress
->dwDataSize
= lpElements
->dwDataSize
;
1622 lpAddress
= (char *) lpAddress
+ sizeof( DPADDRESS
);
1624 *((LPWORD
)lpAddress
) = *((LPWORD
)lpElements
->lpData
);
1625 lpAddress
= (char *) lpAddress
+ sizeof( WORD
);
1627 else if ( IsEqualGUID( &lpElements
->guidDataType
, &DPAID_ComPort
) )
1629 LPDPADDRESS lpdpAddress
= lpAddress
;
1631 lpdpAddress
->guidDataType
= lpElements
->guidDataType
;
1632 lpdpAddress
->dwDataSize
= lpElements
->dwDataSize
;
1633 lpAddress
= (char *) lpAddress
+ sizeof( DPADDRESS
);
1635 CopyMemory( lpAddress
, lpElements
->lpData
, sizeof( DPADDRESS
) );
1636 lpAddress
= (char *) lpAddress
+ sizeof( DPADDRESS
);
1645 static HRESULT WINAPI IDirectPlayLobby3WImpl_ConnectEx
1646 ( LPDIRECTPLAYLOBBY3 iface
, DWORD dwFlags
, REFIID riid
,
1647 LPVOID
* lplpDP
, IUnknown
* pUnk
)
1649 IDirectPlayLobbyAImpl
*This
= (IDirectPlayLobbyAImpl
*)iface
;
1650 return DPL_ConnectEx( This
, dwFlags
, riid
, lplpDP
, pUnk
);
1653 static HRESULT WINAPI IDirectPlayLobby3AImpl_ConnectEx
1654 ( LPDIRECTPLAYLOBBY3A iface
, DWORD dwFlags
, REFIID riid
,
1655 LPVOID
* lplpDP
, IUnknown
* pUnk
)
1657 IDirectPlayLobbyAImpl
*This
= (IDirectPlayLobbyAImpl
*)iface
;
1658 return DPL_ConnectEx( This
, dwFlags
, riid
, lplpDP
, pUnk
);
1661 static HRESULT WINAPI IDirectPlayLobby3WImpl_RegisterApplication
1662 ( LPDIRECTPLAYLOBBY3 iface
, DWORD dwFlags
, LPDPAPPLICATIONDESC lpAppDesc
)
1668 static HRESULT WINAPI IDirectPlayLobby3AImpl_RegisterApplication
1669 ( LPDIRECTPLAYLOBBY3A iface
, DWORD dwFlags
, LPDPAPPLICATIONDESC lpAppDesc
)
1675 static HRESULT WINAPI IDirectPlayLobby3WImpl_UnregisterApplication
1676 ( LPDIRECTPLAYLOBBY3 iface
, DWORD dwFlags
, REFGUID lpAppDesc
)
1682 static HRESULT WINAPI IDirectPlayLobby3AImpl_UnregisterApplication
1683 ( LPDIRECTPLAYLOBBY3A iface
, DWORD dwFlags
, REFGUID lpAppDesc
)
1689 static HRESULT WINAPI IDirectPlayLobby3WImpl_WaitForConnectionSettings
1690 ( LPDIRECTPLAYLOBBY3 iface
, DWORD dwFlags
)
1693 BOOL bStartWait
= !(dwFlags
& DPLWAIT_CANCEL
);
1695 TRACE( "(%p)->(0x%08x)\n", iface
, dwFlags
);
1697 if( DPLAYX_WaitForConnectionSettings( bStartWait
) )
1699 /* FIXME: What is the correct error return code? */
1700 hr
= DPERR_NOTLOBBIED
;
1706 static HRESULT WINAPI IDirectPlayLobby3AImpl_WaitForConnectionSettings
1707 ( LPDIRECTPLAYLOBBY3A iface
, DWORD dwFlags
)
1710 BOOL bStartWait
= !(dwFlags
& DPLWAIT_CANCEL
);
1712 TRACE( "(%p)->(0x%08x)\n", iface
, dwFlags
);
1714 if( DPLAYX_WaitForConnectionSettings( bStartWait
) )
1716 /* FIXME: What is the correct error return code? */
1717 hr
= DPERR_NOTLOBBIED
;
1724 /* Virtual Table definitions for DPL{1,2,3}{A,W} */
1726 /* Note: Hack so we can reuse the old functions without compiler warnings */
1727 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1728 # define XCAST(fun) (typeof(directPlayLobbyAVT.fun))
1730 # define XCAST(fun) (void*)
1733 /* Direct Play Lobby 1 (ascii) Virtual Table for methods */
1734 /* All lobby 1 methods are exactly the same except QueryInterface */
1735 static const IDirectPlayLobbyVtbl directPlayLobbyAVT
=
1738 XCAST(QueryInterface
)DPL_QueryInterface
,
1739 XCAST(AddRef
)DPL_AddRef
,
1740 XCAST(Release
)DPL_Release
,
1742 IDirectPlayLobbyAImpl_Connect
,
1743 IDirectPlayLobbyAImpl_CreateAddress
,
1744 IDirectPlayLobbyAImpl_EnumAddress
,
1745 IDirectPlayLobbyAImpl_EnumAddressTypes
,
1746 IDirectPlayLobbyAImpl_EnumLocalApplications
,
1747 IDirectPlayLobbyAImpl_GetConnectionSettings
,
1748 IDirectPlayLobbyAImpl_ReceiveLobbyMessage
,
1749 IDirectPlayLobbyAImpl_RunApplication
,
1750 IDirectPlayLobbyAImpl_SendLobbyMessage
,
1751 IDirectPlayLobbyAImpl_SetConnectionSettings
,
1752 IDirectPlayLobbyAImpl_SetLobbyMessageEvent
1757 /* Note: Hack so we can reuse the old functions without compiler warnings */
1758 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1759 # define XCAST(fun) (typeof(directPlayLobbyWVT.fun))
1761 # define XCAST(fun) (void*)
1764 /* Direct Play Lobby 1 (unicode) Virtual Table for methods */
1765 static const IDirectPlayLobbyVtbl directPlayLobbyWVT
=
1768 XCAST(QueryInterface
)DPL_QueryInterface
,
1769 XCAST(AddRef
)DPL_AddRef
,
1770 XCAST(Release
)DPL_Release
,
1772 IDirectPlayLobbyWImpl_Connect
,
1773 IDirectPlayLobbyWImpl_CreateAddress
,
1774 IDirectPlayLobbyWImpl_EnumAddress
,
1775 IDirectPlayLobbyWImpl_EnumAddressTypes
,
1776 IDirectPlayLobbyWImpl_EnumLocalApplications
,
1777 IDirectPlayLobbyWImpl_GetConnectionSettings
,
1778 IDirectPlayLobbyWImpl_ReceiveLobbyMessage
,
1779 IDirectPlayLobbyWImpl_RunApplication
,
1780 IDirectPlayLobbyWImpl_SendLobbyMessage
,
1781 IDirectPlayLobbyWImpl_SetConnectionSettings
,
1782 IDirectPlayLobbyWImpl_SetLobbyMessageEvent
1786 /* Note: Hack so we can reuse the old functions without compiler warnings */
1787 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1788 # define XCAST(fun) (typeof(directPlayLobby2AVT.fun))
1790 # define XCAST(fun) (void*)
1793 /* Direct Play Lobby 2 (ascii) Virtual Table for methods */
1794 static const IDirectPlayLobby2Vtbl directPlayLobby2AVT
=
1797 XCAST(QueryInterface
)DPL_QueryInterface
,
1798 XCAST(AddRef
)DPL_AddRef
,
1799 XCAST(Release
)DPL_Release
,
1801 XCAST(Connect
)IDirectPlayLobbyAImpl_Connect
,
1802 XCAST(CreateAddress
)IDirectPlayLobbyAImpl_CreateAddress
,
1803 XCAST(EnumAddress
)IDirectPlayLobbyAImpl_EnumAddress
,
1804 XCAST(EnumAddressTypes
)IDirectPlayLobbyAImpl_EnumAddressTypes
,
1805 XCAST(EnumLocalApplications
)IDirectPlayLobbyAImpl_EnumLocalApplications
,
1806 XCAST(GetConnectionSettings
)IDirectPlayLobbyAImpl_GetConnectionSettings
,
1807 XCAST(ReceiveLobbyMessage
)IDirectPlayLobbyAImpl_ReceiveLobbyMessage
,
1808 XCAST(RunApplication
)IDirectPlayLobbyAImpl_RunApplication
,
1809 XCAST(SendLobbyMessage
)IDirectPlayLobbyAImpl_SendLobbyMessage
,
1810 XCAST(SetConnectionSettings
)IDirectPlayLobbyAImpl_SetConnectionSettings
,
1811 XCAST(SetLobbyMessageEvent
)IDirectPlayLobbyAImpl_SetLobbyMessageEvent
,
1813 IDirectPlayLobby2AImpl_CreateCompoundAddress
1817 /* Note: Hack so we can reuse the old functions without compiler warnings */
1818 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1819 # define XCAST(fun) (typeof(directPlayLobby2WVT.fun))
1821 # define XCAST(fun) (void*)
1824 /* Direct Play Lobby 2 (unicode) Virtual Table for methods */
1825 static const IDirectPlayLobby2Vtbl directPlayLobby2WVT
=
1828 XCAST(QueryInterface
)DPL_QueryInterface
,
1829 XCAST(AddRef
)DPL_AddRef
,
1830 XCAST(Release
)DPL_Release
,
1832 XCAST(Connect
)IDirectPlayLobbyWImpl_Connect
,
1833 XCAST(CreateAddress
)IDirectPlayLobbyWImpl_CreateAddress
,
1834 XCAST(EnumAddress
)IDirectPlayLobbyWImpl_EnumAddress
,
1835 XCAST(EnumAddressTypes
)IDirectPlayLobbyWImpl_EnumAddressTypes
,
1836 XCAST(EnumLocalApplications
)IDirectPlayLobbyWImpl_EnumLocalApplications
,
1837 XCAST(GetConnectionSettings
)IDirectPlayLobbyWImpl_GetConnectionSettings
,
1838 XCAST(ReceiveLobbyMessage
)IDirectPlayLobbyWImpl_ReceiveLobbyMessage
,
1839 XCAST(RunApplication
)IDirectPlayLobbyWImpl_RunApplication
,
1840 XCAST(SendLobbyMessage
)IDirectPlayLobbyWImpl_SendLobbyMessage
,
1841 XCAST(SetConnectionSettings
)IDirectPlayLobbyWImpl_SetConnectionSettings
,
1842 XCAST(SetLobbyMessageEvent
)IDirectPlayLobbyWImpl_SetLobbyMessageEvent
,
1844 IDirectPlayLobby2WImpl_CreateCompoundAddress
1848 /* Direct Play Lobby 3 (ascii) Virtual Table for methods */
1850 /* Note: Hack so we can reuse the old functions without compiler warnings */
1851 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1852 # define XCAST(fun) (typeof(directPlayLobby3AVT.fun))
1854 # define XCAST(fun) (void*)
1857 static const IDirectPlayLobby3Vtbl directPlayLobby3AVT
=
1859 XCAST(QueryInterface
)DPL_QueryInterface
,
1860 XCAST(AddRef
)DPL_AddRef
,
1861 XCAST(Release
)DPL_Release
,
1863 XCAST(Connect
)IDirectPlayLobbyAImpl_Connect
,
1864 XCAST(CreateAddress
)IDirectPlayLobbyAImpl_CreateAddress
,
1865 XCAST(EnumAddress
)IDirectPlayLobbyAImpl_EnumAddress
,
1866 XCAST(EnumAddressTypes
)IDirectPlayLobbyAImpl_EnumAddressTypes
,
1867 XCAST(EnumLocalApplications
)IDirectPlayLobbyAImpl_EnumLocalApplications
,
1868 XCAST(GetConnectionSettings
)IDirectPlayLobbyAImpl_GetConnectionSettings
,
1869 XCAST(ReceiveLobbyMessage
)IDirectPlayLobbyAImpl_ReceiveLobbyMessage
,
1870 XCAST(RunApplication
)IDirectPlayLobbyAImpl_RunApplication
,
1871 XCAST(SendLobbyMessage
)IDirectPlayLobbyAImpl_SendLobbyMessage
,
1872 XCAST(SetConnectionSettings
)IDirectPlayLobbyAImpl_SetConnectionSettings
,
1873 XCAST(SetLobbyMessageEvent
)IDirectPlayLobbyAImpl_SetLobbyMessageEvent
,
1875 XCAST(CreateCompoundAddress
)IDirectPlayLobby2AImpl_CreateCompoundAddress
,
1877 IDirectPlayLobby3AImpl_ConnectEx
,
1878 IDirectPlayLobby3AImpl_RegisterApplication
,
1879 IDirectPlayLobby3AImpl_UnregisterApplication
,
1880 IDirectPlayLobby3AImpl_WaitForConnectionSettings
1884 /* Direct Play Lobby 3 (unicode) Virtual Table for methods */
1886 /* Note: Hack so we can reuse the old functions without compiler warnings */
1887 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1888 # define XCAST(fun) (typeof(directPlayLobby3WVT.fun))
1890 # define XCAST(fun) (void*)
1893 static const IDirectPlayLobby3Vtbl directPlayLobby3WVT
=
1895 XCAST(QueryInterface
)DPL_QueryInterface
,
1896 XCAST(AddRef
)DPL_AddRef
,
1897 XCAST(Release
)DPL_Release
,
1899 XCAST(Connect
)IDirectPlayLobbyWImpl_Connect
,
1900 XCAST(CreateAddress
)IDirectPlayLobbyWImpl_CreateAddress
,
1901 XCAST(EnumAddress
)IDirectPlayLobbyWImpl_EnumAddress
,
1902 XCAST(EnumAddressTypes
)IDirectPlayLobbyWImpl_EnumAddressTypes
,
1903 XCAST(EnumLocalApplications
)IDirectPlayLobbyWImpl_EnumLocalApplications
,
1904 XCAST(GetConnectionSettings
)IDirectPlayLobbyWImpl_GetConnectionSettings
,
1905 XCAST(ReceiveLobbyMessage
)IDirectPlayLobbyWImpl_ReceiveLobbyMessage
,
1906 XCAST(RunApplication
)IDirectPlayLobbyWImpl_RunApplication
,
1907 XCAST(SendLobbyMessage
)IDirectPlayLobbyWImpl_SendLobbyMessage
,
1908 XCAST(SetConnectionSettings
)IDirectPlayLobbyWImpl_SetConnectionSettings
,
1909 XCAST(SetLobbyMessageEvent
)IDirectPlayLobbyWImpl_SetLobbyMessageEvent
,
1911 XCAST(CreateCompoundAddress
)IDirectPlayLobby2WImpl_CreateCompoundAddress
,
1913 IDirectPlayLobby3WImpl_ConnectEx
,
1914 IDirectPlayLobby3WImpl_RegisterApplication
,
1915 IDirectPlayLobby3WImpl_UnregisterApplication
,
1916 IDirectPlayLobby3WImpl_WaitForConnectionSettings
1921 /*********************************************************
1923 * Direct Play Lobby Interface Implementation
1925 *********************************************************/
1927 /***************************************************************************
1928 * DirectPlayLobbyCreateA (DPLAYX.4)
1931 HRESULT WINAPI
DirectPlayLobbyCreateA( LPGUID lpGUIDDSP
,
1932 LPDIRECTPLAYLOBBYA
*lplpDPL
,
1937 TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08x\n",
1938 lpGUIDDSP
,lplpDPL
,lpUnk
,lpData
,dwDataSize
);
1940 /* Parameter Check: lpGUIDSP, lpUnk & lpData must be NULL. dwDataSize must
1941 * equal 0. These fields are mostly for future expansion.
1943 if ( lpGUIDDSP
|| lpData
|| dwDataSize
)
1946 return DPERR_INVALIDPARAMS
;
1952 ERR("Bad parameters!\n" );
1953 return CLASS_E_NOAGGREGATION
;
1956 return DPL_CreateInterface( &IID_IDirectPlayLobbyA
, (void**)lplpDPL
);
1959 /***************************************************************************
1960 * DirectPlayLobbyCreateW (DPLAYX.5)
1963 HRESULT WINAPI
DirectPlayLobbyCreateW( LPGUID lpGUIDDSP
,
1964 LPDIRECTPLAYLOBBY
*lplpDPL
,
1969 TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08x\n",
1970 lpGUIDDSP
,lplpDPL
,lpUnk
,lpData
,dwDataSize
);
1972 /* Parameter Check: lpGUIDSP, lpUnk & lpData must be NULL. dwDataSize must
1973 * equal 0. These fields are mostly for future expansion.
1975 if ( lpGUIDDSP
|| lpData
|| dwDataSize
)
1978 ERR("Bad parameters!\n" );
1979 return DPERR_INVALIDPARAMS
;
1985 ERR("Bad parameters!\n" );
1986 return CLASS_E_NOAGGREGATION
;
1989 return DPL_CreateInterface( &IID_IDirectPlayLobby
, (void**)lplpDPL
);