1 /* Direct Play Lobby 2 & 3 Implementation
3 * Copyright 1998,1999 - Peter Hunnisett
5 * <presently under construction - contact hunnise@nortelnetworks.com>
14 #include "debugtools.h"
16 DEFAULT_DEBUG_CHANNEL(dplay)
18 /*****************************************************************************
19 * Predeclare the interface implementation structures
21 typedef struct IDirectPlayLobbyImpl IDirectPlayLobbyImpl;
22 typedef struct IDirectPlayLobbyImpl IDirectPlayLobbyAImpl;
23 typedef struct IDirectPlayLobbyImpl IDirectPlayLobbyWImpl;
24 typedef struct IDirectPlayLobbyImpl IDirectPlayLobby2Impl;
25 typedef struct IDirectPlayLobbyImpl IDirectPlayLobby2AImpl;
26 typedef struct IDirectPlayLobbyImpl IDirectPlayLobby3Impl;
27 typedef struct IDirectPlayLobbyImpl IDirectPlayLobby3AImpl;
29 /*****************************************************************************
30 * IDirectPlayLobby {1,2,3} implementation structure
32 * The philosophy behind this extra pointer derefernce is that I wanted to
33 * have the same structure for all types of objects without having to do
34 * alot of casting. I also only wanted to implement an interface in the
35 * object it was "released" with IUnknown interface being implemented in the 1 version.
36 * Of course, with these new interfaces comes the data required to keep the state required
37 * by these interfaces. So, basically, the pointers contain the data associated with
38 * a release. If you use the data associated with release 3 in a release 2 object, you'll
39 * get a run time trap, as that won't have any data.
43 typedef struct tagDirectPlayLobbyIUnknownData
46 CRITICAL_SECTION DPL_lock;
47 } DirectPlayLobbyIUnknownData;
49 /* FIXME: I don't think that everything belongs here...*/
50 typedef struct tagDirectPlayLobbyData
53 DPSESSIONDESC2 sessionDesc;
58 } DirectPlayLobbyData;
60 typedef struct tagDirectPlayLobby2Data
63 } DirectPlayLobby2Data;
65 typedef struct tagDirectPlayLobby3Data
68 } DirectPlayLobby3Data;
70 struct IDirectPlayLobbyImpl
72 ICOM_VTABLE(IDirectPlayLobby)* lpvtbl;
75 DirectPlayLobbyIUnknownData* unk;
77 /* IDirectPlayLobby 1 fields */
78 DirectPlayLobbyData* dpl;
80 /* IDirectPlayLobby 2 fields */
81 DirectPlayLobby2Data* dpl2;
83 /* IDirectPlayLobby 3 fields */
84 DirectPlayLobby3Data* dpl3;
87 /* Forward declarations of virtual tables */
88 static ICOM_VTABLE(IDirectPlayLobby) directPlayLobbyAVT;
89 static ICOM_VTABLE(IDirectPlayLobby) directPlayLobbyWVT;
90 static ICOM_VTABLE(IDirectPlayLobby2) directPlayLobby2AVT;
91 static ICOM_VTABLE(IDirectPlayLobby2) directPlayLobby2WVT;
92 static ICOM_VTABLE(IDirectPlayLobby3) directPlayLobby3AVT;
93 static ICOM_VTABLE(IDirectPlayLobby3) directPlayLobby3WVT;
98 /* The COM interface for upversioning an interface
99 * We've been given a GUID (riid) and we need to replace the present
100 * interface with that of the requested interface.
102 * Snip from some Microsoft document:
103 * There are four requirements for implementations of QueryInterface (In these
104 * cases, "must succeed" means "must succeed barring catastrophic failure."):
106 * * The set of interfaces accessible on an object through
107 * IUnknown::QueryInterface must be static, not dynamic. This means that
108 * if a call to QueryInterface for a pointer to a specified interface
109 * succeeds the first time, it must succeed again, and if it fails the
110 * first time, it must fail on all subsequent queries.
111 * * It must be symmetric ~W if a client holds a pointer to an interface on
112 * an object, and queries for that interface, the call must succeed.
113 * * It must be reflexive ~W if a client holding a pointer to one interface
114 * queries successfully for another, a query through the obtained pointer
115 * for the first interface must succeed.
116 * * It must be transitive ~W if a client holding a pointer to one interface
117 * queries successfully for a second, and through that pointer queries
118 * successfully for a third interface, a query for the first interface
119 * through the pointer for the third interface must succeed.
121 * As you can see, this interface doesn't qualify but will most likely
122 * be good enough for the time being.
126 BOOL DPL_CreateIUnknown( IDirectPlayLobbyImpl* lpDPL )
128 lpDPL->unk = (DirectPlayLobbyIUnknownData*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
129 sizeof( *(lpDPL->unk) ) );
130 if ( lpDPL->unk != NULL )
132 InitializeCriticalSection( &lpDPL->unk->DPL_lock );
134 IDirectPlayLobby_AddRef( (IDirectPlayLobby*)lpDPL );
142 BOOL DPL_DestroyIUnknown( IDirectPlayLobbyImpl* lpDPL )
144 DeleteCriticalSection( &lpDPL->unk->DPL_lock );
145 HeapFree( GetProcessHeap(), 0, lpDPL->unk );
150 BOOL DPL_CreateLobby1( IDirectPlayLobbyImpl* lpDPL )
152 lpDPL->dpl = (DirectPlayLobbyIUnknownData*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
153 sizeof( *(lpDPL->dpl) ) );
154 if ( lpDPL->dpl == NULL )
159 /* Initialize the dwSize fields for internal structures */
161 lpDPL->dpl->sessionDesc.dwSize = sizeof( lpDPL->dpl->sessionDesc );
162 lpDPL->dpl->playerName.dwSize = sizeof( lpDPL->dpl->playerName );
163 /* lpDPL->dpl->dwAddressSize = 0; Done in HeapAlloc */
168 BOOL DPL_DestroyLobby1( IDirectPlayLobbyImpl* lpDPL )
170 /* Delete the contents */
171 HeapFree( GetProcessHeap(), 0, lpDPL->dpl->sessionDesc.sess.lpszSessionNameA );
172 HeapFree( GetProcessHeap(), 0, lpDPL->dpl->sessionDesc.pass.lpszPasswordA );
174 HeapFree( GetProcessHeap(), 0, lpDPL->dpl->playerName.psn.lpszShortNameA );
175 HeapFree( GetProcessHeap(), 0, lpDPL->dpl->playerName.pln.lpszLongNameA );
177 HeapFree( GetProcessHeap(), 0, lpDPL->dpl->lpAddress );
179 HeapFree( GetProcessHeap(), 0, lpDPL->dpl );
184 BOOL DPL_CreateLobby2( IDirectPlayLobbyImpl* lpDPL )
186 lpDPL->dpl2 = (DirectPlayLobbyIUnknownData*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
187 sizeof( *(lpDPL->dpl2) ) );
188 if ( lpDPL->dpl2 == NULL )
196 BOOL DPL_DestroyLobby2( IDirectPlayLobbyImpl* lpDPL )
198 HeapFree( GetProcessHeap(), 0, lpDPL->dpl2 );
203 BOOL DPL_CreateLobby3( IDirectPlayLobbyImpl* lpDPL )
205 lpDPL->dpl3 = (DirectPlayLobbyIUnknownData*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
206 sizeof( *(lpDPL->dpl3) ) );
207 if ( lpDPL->dpl3 == NULL )
215 BOOL DPL_DestroyLobby3( IDirectPlayLobbyImpl* lpDPL )
217 HeapFree( GetProcessHeap(), 0, lpDPL->dpl3 );
223 /* Helper function for DirectPlayLobby QueryInterface */
225 HRESULT directPlayLobby_QueryInterface
226 ( REFIID riid, LPVOID* ppvObj )
228 IDirectPlayLobby3AImpl* lpDPL = NULL;
230 if( IsEqualGUID( &IID_IDirectPlayLobby, riid ) )
232 lpDPL = (IDirectPlayLobbyImpl*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
237 return E_OUTOFMEMORY;
240 lpDPL->lpvtbl = &directPlayLobbyWVT;
242 if ( DPL_CreateIUnknown( lpDPL ) &&
243 DPL_CreateLobby1( lpDPL )
250 else if( IsEqualGUID( &IID_IDirectPlayLobbyA, riid ) )
252 lpDPL = (IDirectPlayLobbyAImpl*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
257 return E_OUTOFMEMORY;
260 lpDPL->lpvtbl = &directPlayLobbyAVT;
262 if ( DPL_CreateIUnknown( lpDPL ) &&
263 DPL_CreateLobby1( lpDPL )
270 else if( IsEqualGUID( &IID_IDirectPlayLobby2, riid ) )
272 lpDPL = (IDirectPlayLobby2Impl*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
277 return E_OUTOFMEMORY;
280 lpDPL->lpvtbl = &directPlayLobby2WVT;
282 if ( DPL_CreateIUnknown( lpDPL ) &&
283 DPL_CreateLobby1( lpDPL ) &&
284 DPL_CreateLobby2( lpDPL )
291 else if( IsEqualGUID( &IID_IDirectPlayLobby2A, riid ) )
293 lpDPL = (IDirectPlayLobby2AImpl*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
298 return E_OUTOFMEMORY;
301 lpDPL->lpvtbl = &directPlayLobby2AVT;
303 if ( DPL_CreateIUnknown( lpDPL ) &&
304 DPL_CreateLobby1( lpDPL ) &&
305 DPL_CreateLobby2( lpDPL )
312 else if( IsEqualGUID( &IID_IDirectPlayLobby3, riid ) )
314 lpDPL = (IDirectPlayLobby3Impl*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
319 return E_OUTOFMEMORY;
322 lpDPL->lpvtbl = &directPlayLobby3WVT;
324 if ( DPL_CreateIUnknown( lpDPL ) &&
325 DPL_CreateLobby1( lpDPL ) &&
326 DPL_CreateLobby2( lpDPL ) &&
327 DPL_CreateLobby3( lpDPL )
334 else if( IsEqualGUID( &IID_IDirectPlayLobby3A, riid ) )
336 lpDPL = (IDirectPlayLobby3AImpl*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
341 return E_OUTOFMEMORY;
344 lpDPL->lpvtbl = &directPlayLobby3AVT;
346 if ( DPL_CreateIUnknown( lpDPL ) &&
347 DPL_CreateLobby1( lpDPL ) &&
348 DPL_CreateLobby2( lpDPL ) &&
349 DPL_CreateLobby3( lpDPL )
357 /* Check if we had problems creating an interface */
360 DPL_DestroyLobby3( lpDPL );
361 DPL_DestroyLobby2( lpDPL );
362 DPL_DestroyLobby1( lpDPL );
363 DPL_DestroyIUnknown( lpDPL );
364 HeapFree( GetProcessHeap(), 0, lpDPL );
368 return DPERR_NOMEMORY;
370 else /* Unsupported interface */
373 return E_NOINTERFACE;
377 static HRESULT WINAPI IDirectPlayLobbyAImpl_QueryInterface
378 ( LPDIRECTPLAYLOBBYA iface,
382 ICOM_THIS(IDirectPlayLobby2Impl,iface);
383 TRACE("(%p)->(%p,%p)\n", This, riid, ppvObj );
385 if( IsEqualGUID( &IID_IUnknown, riid ) ||
386 IsEqualGUID( &IID_IDirectPlayLobbyA, riid )
389 IDirectPlayLobby_AddRef( iface );
394 return directPlayLobby_QueryInterface( riid, ppvObj );
398 static HRESULT WINAPI IDirectPlayLobbyW_QueryInterface
399 ( LPDIRECTPLAYLOBBY iface,
403 ICOM_THIS(IDirectPlayLobbyImpl,iface);
404 TRACE("(%p)->(%p,%p)\n", This, riid, ppvObj );
406 if( IsEqualGUID( &IID_IUnknown, riid ) ||
407 IsEqualGUID( &IID_IDirectPlayLobby, riid )
410 IDirectPlayLobby_AddRef( iface );
415 return directPlayLobby_QueryInterface( riid, ppvObj );
419 static HRESULT WINAPI IDirectPlayLobby2AImpl_QueryInterface
420 ( LPDIRECTPLAYLOBBY2A iface,
424 ICOM_THIS(IDirectPlayLobby2Impl,iface);
425 TRACE("(%p)->(%p,%p)\n", This, riid, ppvObj );
427 /* Compare riids. We know this object is a direct play lobby 2A object.
428 If we are asking about the same type of interface we're fine.
430 if( IsEqualGUID( &IID_IUnknown, riid ) ||
431 IsEqualGUID( &IID_IDirectPlayLobby2A, riid )
434 IDirectPlayLobby_AddRef( iface );
438 return directPlayLobby_QueryInterface( riid, ppvObj );
441 static HRESULT WINAPI IDirectPlayLobby2WImpl_QueryInterface
442 ( LPDIRECTPLAYLOBBY2 iface,
446 ICOM_THIS(IDirectPlayLobby2Impl,iface);
448 /* Compare riids. We know this object is a direct play lobby 2 object.
449 If we are asking about the same type of interface we're fine.
451 if( IsEqualGUID( &IID_IUnknown, riid ) ||
452 IsEqualGUID( &IID_IDirectPlayLobby2, riid )
455 IDirectPlayLobby_AddRef( iface );
460 return directPlayLobby_QueryInterface( riid, ppvObj );
464 static HRESULT WINAPI IDirectPlayLobby3AImpl_QueryInterface
465 ( LPDIRECTPLAYLOBBY3A iface,
469 ICOM_THIS(IDirectPlayLobby3Impl,iface);
471 /* Compare riids. We know this object is a direct play lobby 3 object.
472 If we are asking about the same type of interface we're fine.
474 if( IsEqualGUID( &IID_IUnknown, riid ) ||
475 IsEqualGUID( &IID_IDirectPlayLobby3A, riid )
478 IDirectPlayLobby_AddRef( (IDirectPlayLobby*)This );
483 return directPlayLobby_QueryInterface( riid, ppvObj );
487 static HRESULT WINAPI IDirectPlayLobby3WImpl_QueryInterface
488 ( LPDIRECTPLAYLOBBY3 iface,
492 ICOM_THIS(IDirectPlayLobby3Impl,iface);
494 /* Compare riids. We know this object is a direct play lobby 3 object.
495 If we are asking about the same type of interface we're fine.
497 if( IsEqualGUID( &IID_IUnknown, riid ) ||
498 IsEqualGUID( &IID_IDirectPlayLobby3, riid )
501 IDirectPlayLobby_AddRef( (IDirectPlayLobby*)This );
506 return directPlayLobby_QueryInterface( riid, ppvObj );
511 * Simple procedure. Just increment the reference count to this
512 * structure and return the new reference count.
514 static ULONG WINAPI IDirectPlayLobbyAImpl_AddRef
515 ( LPDIRECTPLAYLOBBYA iface )
518 ICOM_THIS(IDirectPlayLobby2Impl,iface);
520 EnterCriticalSection( &This->unk->DPL_lock );
522 refCount = ++(This->unk->ref);
524 LeaveCriticalSection( &This->unk->DPL_lock );
526 TRACE("ref count incremented to %lu for %p\n", refCount, This );
532 * Simple COM procedure. Decrease the reference count to this object.
533 * If the object no longer has any reference counts, free up the associated
536 static ULONG WINAPI IDirectPlayLobbyAImpl_Release
537 ( LPDIRECTPLAYLOBBYA iface )
541 ICOM_THIS(IDirectPlayLobby2Impl,iface);
543 EnterCriticalSection( &This->unk->DPL_lock );
545 refCount = --(This->unk->ref);
547 LeaveCriticalSection( &This->unk->DPL_lock );
549 TRACE("ref count decremeneted to %lu for %p\n", refCount, This );
551 /* Deallocate if this is the last reference to the object */
554 DPL_DestroyLobby3( This );
555 DPL_DestroyLobby2( This );
556 DPL_DestroyLobby1( This );
557 DPL_DestroyIUnknown( This );
558 HeapFree( GetProcessHeap(), 0, This );
565 /********************************************************************
567 * Connects an application to the session specified by the DPLCONNECTION
568 * structure currently stored with the DirectPlayLobby object.
570 * Returns a IDirectPlay interface.
573 static HRESULT WINAPI IDirectPlayLobbyAImpl_Connect
574 ( LPDIRECTPLAYLOBBYA iface,
576 LPDIRECTPLAY2A* lplpDP,
579 ICOM_THIS(IDirectPlayLobbyImpl,iface);
581 LPDIRECTPLAY2A lpDirectPlay2A;
582 LPDIRECTPLAY3A lpDirectPlay3A;
583 LPDIRECTPLAYLOBBY2A lpDirectPlayLobby2A;
586 FIXME("(%p)->(0x%08lx,%p,%p): stub\n", This, dwFlags, lplpDP, pUnk );
588 if( dwFlags || pUnk )
590 return DPERR_INVALIDPARAMS;
593 if( ( rc = DirectPlayCreate( (LPGUID)&IID_IDirectPlay2A, lplpDP, pUnk ) ) != DP_OK )
595 ERR("error creating Direct Play 2W interface. Return Code = 0x%lx.\n", rc );
599 lpDirectPlay2A = *lplpDP;
601 /* This should invoke IDirectPlay3::InitializeConnection IDirectPlay3::Open */
602 /* - Use This object to get a DPL2 object using QueryInterface
603 * - Need to call CreateCompoundAddress to create the lpConnection param for IDirectPlay::InitializeConnection
604 * - Call IDirectPlay::InitializeConnection
605 * - Call IDirectPlay::Open
610 DPCOMPOUNDADDRESSELEMENT compoundAddress;
612 /* Get lobby version capable of supporting CreateCompoundAddress */
613 if( ( rc = IDirectPlayLobby_QueryInterface( This, &IID_IDirectPlayLobby2A, &lpDirectPlayLobby2A ) ) != DP_OK )
618 EnterCriticalSection( &This->unk->DPL_lock );
620 /* Actually create the compound address */
621 memcpy( compoundAddress.guidDataType, This->dpl->guidSP, sizeof( compoundAddress.guidDataType ) );
623 LeaveCriticalSection( &This->unk->DPL_lock );
625 rc = IDirectPlayLobby_CreateCompoundAddress( lpDirectPlayLobby2A, lpElements, dwElementCount, lpAddress, lpdwAddressSize )
627 /* Free the lobby object since we're done with it */
628 IDirectPlayLobby_Release( lpDirectPlayLobby2A );
636 if( ( rc = IDirectPlayX_QueryInterface( directPlay2A, &IID_IDirectPlay3A, &lpDirectPlay3A ) ) != DP_OK )
646 static HRESULT WINAPI IDirectPlayLobbyWImpl_Connect
647 ( LPDIRECTPLAYLOBBY iface,
649 LPDIRECTPLAY2* lplpDP,
652 ICOM_THIS(IDirectPlayLobbyImpl,iface);
653 LPDIRECTPLAY2* directPlay2W;
656 FIXME("(%p)->(0x%08lx,%p,%p): stub\n", This, dwFlags, lplpDP, pUnk );
658 if( dwFlags || pUnk )
660 return DPERR_INVALIDPARAMS;
663 if( ( createRC = DirectPlayCreate( (LPGUID)&IID_IDirectPlay2, lplpDP, pUnk ) ) != DP_OK )
665 ERR("error creating Direct Play 2W interface. Return Code = 0x%lx.\n", createRC );
669 /* This should invoke IDirectPlay3::InitializeConnection IDirectPlay3::Open */
670 directPlay2W = lplpDP;
676 /********************************************************************
678 * Creates a DirectPlay Address, given a service provider-specific network
680 * Returns an address contains the globally unique identifier
681 * (GUID) of the service provider and data that the service provider can
682 * interpret as a network address.
685 static HRESULT WINAPI IDirectPlayLobbyAImpl_CreateAddress
686 ( LPDIRECTPLAYLOBBYA iface,
688 REFGUID guidDataType,
692 LPDWORD lpdwAddressSize )
695 return DPERR_OUTOFMEMORY;
698 static HRESULT WINAPI IDirectPlayLobbyWImpl_CreateAddress
699 ( LPDIRECTPLAYLOBBY iface,
701 REFGUID guidDataType,
705 LPDWORD lpdwAddressSize )
708 return DPERR_OUTOFMEMORY;
712 /********************************************************************
714 * Parses out chunks from the DirectPlay Address buffer by calling the
715 * given callback function, with lpContext, for each of the chunks.
718 static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumAddress
719 ( LPDIRECTPLAYLOBBYA iface,
720 LPDPENUMADDRESSCALLBACK lpEnumAddressCallback,
726 return DPERR_OUTOFMEMORY;
729 static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumAddress
730 ( LPDIRECTPLAYLOBBY iface,
731 LPDPENUMADDRESSCALLBACK lpEnumAddressCallback,
737 return DPERR_OUTOFMEMORY;
740 /********************************************************************
742 * Enumerates all the address types that a given service provider needs to
743 * build the DirectPlay Address.
746 static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumAddressTypes
747 ( LPDIRECTPLAYLOBBYA iface,
748 LPDPLENUMADDRESSTYPESCALLBACK lpEnumAddressTypeCallback,
754 return DPERR_OUTOFMEMORY;
757 static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumAddressTypes
758 ( LPDIRECTPLAYLOBBY iface,
759 LPDPLENUMADDRESSTYPESCALLBACK lpEnumAddressTypeCallback,
765 return DPERR_OUTOFMEMORY;
768 /********************************************************************
770 * Enumerates what applications are registered with DirectPlay by
771 * invoking the callback function with lpContext.
774 static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumLocalApplications
775 ( LPDIRECTPLAYLOBBY iface,
776 LPDPLENUMLOCALAPPLICATIONSCALLBACK lpEnumLocalAppCallback,
780 ICOM_THIS(IDirectPlayLobbyImpl,iface);
782 FIXME("(%p)->(%p,%p,0x%08lx):stub\n", This, lpEnumLocalAppCallback, lpContext, dwFlags );
784 return DPERR_OUTOFMEMORY;
787 static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumLocalApplications
788 ( LPDIRECTPLAYLOBBYA iface,
789 LPDPLENUMLOCALAPPLICATIONSCALLBACK lpEnumLocalAppCallback,
793 ICOM_THIS(IDirectPlayLobbyImpl,iface);
795 FIXME("(%p)->(%p,%p,0x%08lx):stub\n", This, lpEnumLocalAppCallback, lpContext, dwFlags );
797 return DPERR_OUTOFMEMORY;
800 /********************************************************************
802 * Retrieves the DPLCONNECTION structure that contains all the information
803 * needed to start and connect an application. This was generated using
804 * either the RunApplication or SetConnectionSettings methods.
806 * NOTES: If lpData is NULL then just return lpdwDataSize. This allows
807 * the data structure to be allocated by our caller which can then
808 * call this procedure/method again with a valid data pointer.
810 static HRESULT WINAPI IDirectPlayLobbyAImpl_GetConnectionSettings
811 ( LPDIRECTPLAYLOBBYA iface,
814 LPDWORD lpdwDataSize )
816 ICOM_THIS(IDirectPlayLobbyImpl,iface);
817 LPDPLCONNECTION lpDplConnection;
819 FIXME(": semi stub (%p)->(0x%08lx,%p,%p)\n", This, dwAppID, lpData, lpdwDataSize );
821 /* Application is requesting us to give the required size */
822 if ( lpData == NULL )
824 *lpdwDataSize = sizeof( DPLCONNECTION );
825 return DPERR_BUFFERTOOSMALL;
828 /* Let's check the size of the buffer that the application has allocated */
829 if ( *lpdwDataSize < sizeof( DPLCONNECTION ) )
831 *lpdwDataSize = sizeof( DPLCONNECTION );
832 return DPERR_BUFFERTOOSMALL;
835 /* FIXME: Who's supposed to own the data */
837 /* Fill in the fields - let them just use the ptrs */
838 lpDplConnection = (LPDPLCONNECTION)lpData;
840 /* Copy everything we've got into here */
841 /* Need to actually store the stuff here. Check if we've already allocated each field first. */
842 lpDplConnection->dwFlags = This->dpl->dwConnFlags;
844 /* Copy LPDPSESSIONDESC2 struct */
845 lpDplConnection->lpSessionDesc = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( This->dpl->sessionDesc ) );
846 memcpy( lpDplConnection->lpSessionDesc, &This->dpl->sessionDesc, sizeof( This->dpl->sessionDesc ) );
848 if( This->dpl->sessionDesc.sess.lpszSessionName )
850 lpDplConnection->lpSessionDesc->sess.lpszSessionName =
851 HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, This->dpl->sessionDesc.sess.lpszSessionNameA );
854 if( This->dpl->sessionDesc.pass.lpszPassword )
856 lpDplConnection->lpSessionDesc->pass.lpszPassword =
857 HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, This->dpl->sessionDesc.pass.lpszPasswordA );
860 lpDplConnection->lpSessionDesc->dwReserved1 = This->dpl->sessionDesc.dwReserved1;
861 lpDplConnection->lpSessionDesc->dwReserved2 = This->dpl->sessionDesc.dwReserved2;
863 /* Copy DPNAME struct - seems to be optional - check for existance first */
864 lpDplConnection->lpPlayerName = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( This->dpl->playerName ) );
865 memcpy( lpDplConnection->lpPlayerName, &(This->dpl->playerName), sizeof( This->dpl->playerName ) );
867 if( This->dpl->playerName.psn.lpszShortName )
869 lpDplConnection->lpPlayerName->psn.lpszShortName =
870 HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, This->dpl->playerName.psn.lpszShortNameA );
873 if( This->dpl->playerName.pln.lpszLongName )
875 lpDplConnection->lpPlayerName->pln.lpszLongName =
876 HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, This->dpl->playerName.pln.lpszLongNameA );
879 memcpy( &lpDplConnection->guidSP, &This->dpl->guidSP, sizeof( This->dpl->guidSP ) );
881 lpDplConnection->lpAddress = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, This->dpl->dwAddressSize );
882 memcpy( lpDplConnection->lpAddress, This->dpl->lpAddress, This->dpl->dwAddressSize );
884 lpDplConnection->dwAddressSize = This->dpl->dwAddressSize;
889 static HRESULT WINAPI IDirectPlayLobbyWImpl_GetConnectionSettings
890 ( LPDIRECTPLAYLOBBY iface,
893 LPDWORD lpdwDataSize )
895 ICOM_THIS(IDirectPlayLobbyImpl,iface);
896 FIXME(":semi stub %p %08lx %p %p \n", This, dwAppID, lpData, lpdwDataSize );
898 /* Application is requesting us to give the required size */
901 /* Let's check the size of the buffer that the application has allocated */
902 if( *lpdwDataSize >= sizeof( DPLCONNECTION ) )
908 *lpdwDataSize = sizeof( DPLCONNECTION );
909 return DPERR_BUFFERTOOSMALL;
913 /* Fill in the fields - see above */
919 /********************************************************************
921 * Retrieves the message sent between a lobby client and a DirectPlay
922 * application. All messages are queued until received.
925 static HRESULT WINAPI IDirectPlayLobbyAImpl_ReceiveLobbyMessage
926 ( LPDIRECTPLAYLOBBYA iface,
929 LPDWORD lpdwMessageFlags,
931 LPDWORD lpdwDataSize )
933 ICOM_THIS(IDirectPlayLobbyImpl,iface);
934 FIXME(":stub %p %08lx %08lx %p %p %p\n", This, dwFlags, dwAppID, lpdwMessageFlags, lpData,
936 return DPERR_OUTOFMEMORY;
939 static HRESULT WINAPI IDirectPlayLobbyWImpl_ReceiveLobbyMessage
940 ( LPDIRECTPLAYLOBBY iface,
943 LPDWORD lpdwMessageFlags,
945 LPDWORD lpdwDataSize )
947 ICOM_THIS(IDirectPlayLobbyImpl,iface);
948 FIXME(":stub %p %08lx %08lx %p %p %p\n", This, dwFlags, dwAppID, lpdwMessageFlags, lpData,
950 return DPERR_OUTOFMEMORY;
953 /********************************************************************
955 * Starts an application and passes to it all the information to
956 * connect to a session.
959 static HRESULT WINAPI IDirectPlayLobbyAImpl_RunApplication
960 ( LPDIRECTPLAYLOBBYA iface,
963 LPDPLCONNECTION lpConn,
964 HANDLE hReceiveEvent )
967 return DPERR_OUTOFMEMORY;
970 static HRESULT WINAPI IDirectPlayLobbyWImpl_RunApplication
971 ( LPDIRECTPLAYLOBBY iface,
974 LPDPLCONNECTION lpConn,
975 HANDLE hReceiveEvent )
978 return DPERR_OUTOFMEMORY;
981 /********************************************************************
983 * Sends a message between the application and the lobby client.
984 * All messages are queued until received.
987 static HRESULT WINAPI IDirectPlayLobbyAImpl_SendLobbyMessage
988 ( LPDIRECTPLAYLOBBYA iface,
995 return DPERR_OUTOFMEMORY;
998 static HRESULT WINAPI IDirectPlayLobbyWImpl_SendLobbyMessage
999 ( LPDIRECTPLAYLOBBY iface,
1006 return DPERR_OUTOFMEMORY;
1009 /********************************************************************
1011 * Modifies the DPLCONNECTION structure to contain all information
1012 * needed to start and connect an application.
1015 static HRESULT WINAPI IDirectPlayLobbyWImpl_SetConnectionSettings
1016 ( LPDIRECTPLAYLOBBY iface,
1019 LPDPLCONNECTION lpConn )
1021 ICOM_THIS(IDirectPlayLobbyImpl,iface);
1022 TRACE(": This=%p, dwFlags=%08lx, dwAppId=%08lx, lpConn=%p\n",
1023 This, dwFlags, dwAppID, lpConn );
1025 /* Paramater check */
1026 if( dwFlags || !This || !lpConn )
1028 ERR("invalid parameters.\n");
1029 return DPERR_INVALIDPARAMS;
1032 /* See if there is a connection associated with this request.
1033 * dwAppID == 0 indicates that this request isn't associated with a connection.
1037 FIXME(": Connection dwAppID=%08lx given. Not implemented yet.\n",
1040 /* Need to add a check for this application Id...*/
1041 return DPERR_NOTLOBBIED;
1044 if( lpConn->dwSize != sizeof(DPLCONNECTION) )
1046 ERR(": old/new DPLCONNECTION type? Size=%08lx vs. expected=%ul bytes\n",
1047 lpConn->dwSize, sizeof( DPLCONNECTION ) );
1048 return DPERR_INVALIDPARAMS;
1051 /* Need to investigate the lpConn->lpSessionDesc to figure out
1052 * what type of session we need to join/create.
1054 if( (!lpConn->lpSessionDesc ) ||
1055 ( lpConn->lpSessionDesc->dwSize != sizeof( DPSESSIONDESC2 ) )
1058 ERR("DPSESSIONDESC passed in? Size=%08lx vs. expected=%ul bytes\n",
1059 lpConn->lpSessionDesc->dwSize, sizeof( DPSESSIONDESC2 ) );
1060 return DPERR_INVALIDPARAMS;
1063 EnterCriticalSection( &This->unk->DPL_lock );
1065 /* Need to actually store the stuff here. Check if we've already allocated each field first. */
1066 This->dpl->dwConnFlags = lpConn->dwFlags;
1068 /* Copy LPDPSESSIONDESC2 struct - this is required */
1069 memcpy( &This->dpl->sessionDesc, lpConn->lpSessionDesc, sizeof( *(lpConn->lpSessionDesc) ) );
1071 /* FIXME: Can this just be shorted? Does it handle the NULL case correctly? */
1072 if( lpConn->lpSessionDesc->sess.lpszSessionName )
1073 This->dpl->sessionDesc.sess.lpszSessionName = HEAP_strdupW( GetProcessHeap(), HEAP_ZERO_MEMORY, lpConn->lpSessionDesc->sess.lpszSessionName );
1075 This->dpl->sessionDesc.sess.lpszSessionName = NULL;
1077 if( lpConn->lpSessionDesc->pass.lpszPassword )
1078 This->dpl->sessionDesc.pass.lpszPassword = HEAP_strdupW( GetProcessHeap(), HEAP_ZERO_MEMORY, lpConn->lpSessionDesc->pass.lpszPassword );
1080 This->dpl->sessionDesc.pass.lpszPassword = NULL;
1082 This->dpl->sessionDesc.dwReserved1 = lpConn->lpSessionDesc->dwReserved1;
1083 This->dpl->sessionDesc.dwReserved2 = lpConn->lpSessionDesc->dwReserved2;
1085 /* Copy DPNAME struct - seems to be optional - check for existance first */
1086 if( lpConn->lpPlayerName )
1088 memcpy( &This->dpl->playerName, lpConn->lpPlayerName, sizeof( *lpConn->lpPlayerName ) );
1090 if( lpConn->lpPlayerName->psn.lpszShortName )
1091 This->dpl->playerName.psn.lpszShortName = HEAP_strdupW( GetProcessHeap(), HEAP_ZERO_MEMORY, lpConn->lpPlayerName->psn.lpszShortName );
1093 if( lpConn->lpPlayerName->pln.lpszLongName )
1094 This->dpl->playerName.pln.lpszLongName = HEAP_strdupW( GetProcessHeap(), HEAP_ZERO_MEMORY, lpConn->lpPlayerName->pln.lpszLongName );
1098 memcpy( &This->dpl->guidSP, &lpConn->guidSP, sizeof( lpConn->guidSP ) );
1100 This->dpl->lpAddress = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, lpConn->dwAddressSize );
1101 memcpy( This->dpl->lpAddress, lpConn->lpAddress, lpConn->dwAddressSize );
1103 This->dpl->dwAddressSize = lpConn->dwAddressSize;
1105 LeaveCriticalSection( &This->unk->DPL_lock );
1110 static HRESULT WINAPI IDirectPlayLobbyAImpl_SetConnectionSettings
1111 ( LPDIRECTPLAYLOBBYA iface,
1114 LPDPLCONNECTION lpConn )
1116 ICOM_THIS(IDirectPlayLobbyImpl,iface);
1117 TRACE(": This=%p, dwFlags=%08lx, dwAppId=%08lx, lpConn=%p\n",
1118 This, dwFlags, dwAppID, lpConn );
1120 /* Paramater check */
1121 if( dwFlags || !This || !lpConn )
1123 ERR("invalid parameters.\n");
1124 return DPERR_INVALIDPARAMS;
1127 /* See if there is a connection associated with this request.
1128 * dwAppID == 0 indicates that this request isn't associated with a connection.
1132 FIXME(": Connection dwAppID=%08lx given. Not implemented yet.\n",
1135 /* Need to add a check for this application Id...*/
1136 return DPERR_NOTLOBBIED;
1139 if( lpConn->dwSize != sizeof(DPLCONNECTION) )
1141 ERR(": old/new DPLCONNECTION type? Size=%08lx vs. expected=%ul bytes\n",
1142 lpConn->dwSize, sizeof( DPLCONNECTION ) );
1143 return DPERR_INVALIDPARAMS;
1146 /* Need to investigate the lpConn->lpSessionDesc to figure out
1147 * what type of session we need to join/create.
1149 if( (!lpConn->lpSessionDesc ) ||
1150 ( lpConn->lpSessionDesc->dwSize != sizeof( DPSESSIONDESC2 ) )
1153 ERR("DPSESSIONDESC passed in? Size=%08lx vs. expected=%ul bytes\n",
1154 lpConn->lpSessionDesc->dwSize, sizeof( DPSESSIONDESC2 ) );
1155 return DPERR_INVALIDPARAMS;
1158 EnterCriticalSection( &This->unk->DPL_lock );
1160 /* Need to actually store the stuff here. Check if we've already allocated each field first. */
1161 This->dpl->dwConnFlags = lpConn->dwFlags;
1163 /* Copy LPDPSESSIONDESC2 struct - this is required */
1164 memcpy( &This->dpl->sessionDesc, lpConn->lpSessionDesc, sizeof( *(lpConn->lpSessionDesc) ) );
1166 /* FIXME: Can this just be shorted? Does it handle the NULL case correctly? */
1167 if( lpConn->lpSessionDesc->sess.lpszSessionNameA )
1168 This->dpl->sessionDesc.sess.lpszSessionNameA = HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, lpConn->lpSessionDesc->sess.lpszSessionNameA );
1170 This->dpl->sessionDesc.sess.lpszSessionNameA = NULL;
1172 if( lpConn->lpSessionDesc->pass.lpszPasswordA )
1173 This->dpl->sessionDesc.pass.lpszPasswordA = HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, lpConn->lpSessionDesc->pass.lpszPasswordA );
1175 This->dpl->sessionDesc.pass.lpszPasswordA = NULL;
1177 This->dpl->sessionDesc.dwReserved1 = lpConn->lpSessionDesc->dwReserved1;
1178 This->dpl->sessionDesc.dwReserved2 = lpConn->lpSessionDesc->dwReserved2;
1180 /* Copy DPNAME struct - seems to be optional - check for existance first */
1181 if( lpConn->lpPlayerName )
1183 memcpy( &This->dpl->playerName, lpConn->lpPlayerName, sizeof( *lpConn->lpPlayerName ) );
1185 if( lpConn->lpPlayerName->psn.lpszShortNameA )
1186 This->dpl->playerName.psn.lpszShortNameA = HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, lpConn->lpPlayerName->psn.lpszShortNameA );
1188 if( lpConn->lpPlayerName->pln.lpszLongNameA )
1189 This->dpl->playerName.pln.lpszLongNameA = HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, lpConn->lpPlayerName->pln.lpszLongNameA );
1193 memcpy( &This->dpl->guidSP, &lpConn->guidSP, sizeof( lpConn->guidSP ) );
1195 This->dpl->lpAddress = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, lpConn->dwAddressSize );
1196 memcpy( This->dpl->lpAddress, lpConn->lpAddress, lpConn->dwAddressSize );
1198 This->dpl->dwAddressSize = lpConn->dwAddressSize;
1200 LeaveCriticalSection( &This->unk->DPL_lock );
1205 /********************************************************************
1207 * Registers an event that will be set when a lobby message is received.
1210 static HRESULT WINAPI IDirectPlayLobbyAImpl_SetLobbyMessageEvent
1211 ( LPDIRECTPLAYLOBBYA iface,
1214 HANDLE hReceiveEvent )
1217 return DPERR_OUTOFMEMORY;
1220 static HRESULT WINAPI IDirectPlayLobbyWImpl_SetLobbyMessageEvent
1221 ( LPDIRECTPLAYLOBBY iface,
1224 HANDLE hReceiveEvent )
1227 return DPERR_OUTOFMEMORY;
1231 /* DPL 2 methods - well actuall only one */
1233 /********************************************************************
1235 * Registers an event that will be set when a lobby message is received.
1238 static HRESULT WINAPI IDirectPlayLobby2WImpl_CreateCompoundAddress
1239 ( LPDIRECTPLAYLOBBY2 iface,
1240 LPCDPCOMPOUNDADDRESSELEMENT lpElements,
1241 DWORD dwElementCount,
1243 LPDWORD lpdwAddressSize )
1246 return DPERR_OUTOFMEMORY;
1249 static HRESULT WINAPI IDirectPlayLobby2AImpl_CreateCompoundAddress
1250 ( LPDIRECTPLAYLOBBY2A iface,
1251 LPCDPCOMPOUNDADDRESSELEMENT lpElements,
1252 DWORD dwElementCount,
1254 LPDWORD lpdwAddressSize )
1257 return DPERR_OUTOFMEMORY;
1262 static HRESULT WINAPI IDirectPlayLobby3WImpl_ConnectEx
1263 ( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags, REFIID riid, LPVOID* lplpDP, IUnknown* pUnk )
1269 static HRESULT WINAPI IDirectPlayLobby3AImpl_ConnectEx
1270 ( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags, REFIID riid, LPVOID* lplpDP, IUnknown* pUnk )
1276 static HRESULT WINAPI IDirectPlayLobby3WImpl_RegisterApplication
1277 ( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags, LPDPAPPLICATIONDESC lpAppDesc )
1283 static HRESULT WINAPI IDirectPlayLobby3AImpl_RegisterApplication
1284 ( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags, LPDPAPPLICATIONDESC lpAppDesc )
1290 static HRESULT WINAPI IDirectPlayLobby3WImpl_UnregisterApplication
1291 ( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags, REFGUID lpAppDesc )
1297 static HRESULT WINAPI IDirectPlayLobby3AImpl_UnregisterApplication
1298 ( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags, REFGUID lpAppDesc )
1304 static HRESULT WINAPI IDirectPlayLobby3WImpl_WaitForConnectionSettings
1305 ( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags )
1311 static HRESULT WINAPI IDirectPlayLobby3AImpl_WaitForConnectionSettings
1312 ( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags )
1319 /* Virtual Table definitions for DPL{1,2,3}{A,W} */
1321 /* Note: Hack so we can reuse the old functions without compiler warnings */
1322 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1323 # define XCAST(fun) (typeof(directPlayLobbyAVT.fn##fun))
1325 # define XCAST(fun) (void*)
1328 /* Direct Play Lobby 1 (ascii) Virtual Table for methods */
1329 /* All lobby 1 methods are exactly the same except QueryInterface */
1330 static struct ICOM_VTABLE(IDirectPlayLobby) directPlayLobbyAVT =
1332 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1334 IDirectPlayLobbyAImpl_QueryInterface,
1335 XCAST(AddRef)IDirectPlayLobbyAImpl_AddRef,
1336 XCAST(Release)IDirectPlayLobbyAImpl_Release,
1338 IDirectPlayLobbyAImpl_Connect,
1339 IDirectPlayLobbyAImpl_CreateAddress,
1340 IDirectPlayLobbyAImpl_EnumAddress,
1341 IDirectPlayLobbyAImpl_EnumAddressTypes,
1342 IDirectPlayLobbyAImpl_EnumLocalApplications,
1343 IDirectPlayLobbyAImpl_GetConnectionSettings,
1344 IDirectPlayLobbyAImpl_ReceiveLobbyMessage,
1345 IDirectPlayLobbyAImpl_RunApplication,
1346 IDirectPlayLobbyAImpl_SendLobbyMessage,
1347 IDirectPlayLobbyAImpl_SetConnectionSettings,
1348 IDirectPlayLobbyAImpl_SetLobbyMessageEvent
1353 /* Note: Hack so we can reuse the old functions without compiler warnings */
1354 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1355 # define XCAST(fun) (typeof(directPlayLobbyWVT.fn##fun))
1357 # define XCAST(fun) (void*)
1360 /* Direct Play Lobby 1 (unicode) Virtual Table for methods */
1361 static ICOM_VTABLE(IDirectPlayLobby) directPlayLobbyWVT =
1363 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1365 IDirectPlayLobbyW_QueryInterface,
1366 XCAST(AddRef)IDirectPlayLobbyAImpl_AddRef,
1367 XCAST(Release)IDirectPlayLobbyAImpl_Release,
1369 IDirectPlayLobbyWImpl_Connect,
1370 IDirectPlayLobbyWImpl_CreateAddress,
1371 IDirectPlayLobbyWImpl_EnumAddress,
1372 IDirectPlayLobbyWImpl_EnumAddressTypes,
1373 IDirectPlayLobbyWImpl_EnumLocalApplications,
1374 IDirectPlayLobbyWImpl_GetConnectionSettings,
1375 IDirectPlayLobbyWImpl_ReceiveLobbyMessage,
1376 IDirectPlayLobbyWImpl_RunApplication,
1377 IDirectPlayLobbyWImpl_SendLobbyMessage,
1378 IDirectPlayLobbyWImpl_SetConnectionSettings,
1379 IDirectPlayLobbyWImpl_SetLobbyMessageEvent
1383 /* Note: Hack so we can reuse the old functions without compiler warnings */
1384 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1385 # define XCAST(fun) (typeof(directPlayLobby2AVT.fn##fun))
1387 # define XCAST(fun) (void*)
1390 /* Direct Play Lobby 2 (ascii) Virtual Table for methods */
1391 static ICOM_VTABLE(IDirectPlayLobby2) directPlayLobby2AVT =
1393 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1395 IDirectPlayLobby2AImpl_QueryInterface,
1396 XCAST(AddRef)IDirectPlayLobbyAImpl_AddRef,
1397 XCAST(Release)IDirectPlayLobbyAImpl_Release,
1399 XCAST(Connect)IDirectPlayLobbyAImpl_Connect,
1400 XCAST(CreateAddress)IDirectPlayLobbyAImpl_CreateAddress,
1401 XCAST(EnumAddress)IDirectPlayLobbyAImpl_EnumAddress,
1402 XCAST(EnumAddressTypes)IDirectPlayLobbyAImpl_EnumAddressTypes,
1403 XCAST(EnumLocalApplications)IDirectPlayLobbyAImpl_EnumLocalApplications,
1404 XCAST(GetConnectionSettings)IDirectPlayLobbyAImpl_GetConnectionSettings,
1405 XCAST(ReceiveLobbyMessage)IDirectPlayLobbyAImpl_ReceiveLobbyMessage,
1406 XCAST(RunApplication)IDirectPlayLobbyAImpl_RunApplication,
1407 XCAST(SendLobbyMessage)IDirectPlayLobbyAImpl_SendLobbyMessage,
1408 XCAST(SetConnectionSettings)IDirectPlayLobbyAImpl_SetConnectionSettings,
1409 XCAST(SetLobbyMessageEvent)IDirectPlayLobbyAImpl_SetLobbyMessageEvent,
1411 IDirectPlayLobby2AImpl_CreateCompoundAddress
1415 /* Note: Hack so we can reuse the old functions without compiler warnings */
1416 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1417 # define XCAST(fun) (typeof(directPlayLobby2AVT.fn##fun))
1419 # define XCAST(fun) (void*)
1422 /* Direct Play Lobby 2 (unicode) Virtual Table for methods */
1423 static ICOM_VTABLE(IDirectPlayLobby2) directPlayLobby2WVT =
1425 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1427 IDirectPlayLobby2WImpl_QueryInterface,
1428 XCAST(AddRef)IDirectPlayLobbyAImpl_AddRef,
1429 XCAST(Release)IDirectPlayLobbyAImpl_Release,
1431 XCAST(Connect)IDirectPlayLobbyWImpl_Connect,
1432 XCAST(CreateAddress)IDirectPlayLobbyWImpl_CreateAddress,
1433 XCAST(EnumAddress)IDirectPlayLobbyWImpl_EnumAddress,
1434 XCAST(EnumAddressTypes)IDirectPlayLobbyWImpl_EnumAddressTypes,
1435 XCAST(EnumLocalApplications)IDirectPlayLobbyWImpl_EnumLocalApplications,
1436 XCAST(GetConnectionSettings)IDirectPlayLobbyWImpl_GetConnectionSettings,
1437 XCAST(ReceiveLobbyMessage)IDirectPlayLobbyWImpl_ReceiveLobbyMessage,
1438 XCAST(RunApplication)IDirectPlayLobbyWImpl_RunApplication,
1439 XCAST(SendLobbyMessage)IDirectPlayLobbyWImpl_SendLobbyMessage,
1440 XCAST(SetConnectionSettings)IDirectPlayLobbyWImpl_SetConnectionSettings,
1441 XCAST(SetLobbyMessageEvent)IDirectPlayLobbyWImpl_SetLobbyMessageEvent,
1443 IDirectPlayLobby2WImpl_CreateCompoundAddress
1447 /* Direct Play Lobby 3 (ascii) Virtual Table for methods */
1449 /* Note: Hack so we can reuse the old functions without compiler warnings */
1450 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1451 # define XCAST(fun) (typeof(directPlayLobby3AVT.fn##fun))
1453 # define XCAST(fun) (void*)
1456 static ICOM_VTABLE(IDirectPlayLobby3) directPlayLobby3AVT =
1458 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1459 IDirectPlayLobby3AImpl_QueryInterface,
1460 XCAST(AddRef)IDirectPlayLobbyAImpl_AddRef,
1461 XCAST(Release)IDirectPlayLobbyAImpl_Release,
1463 XCAST(Connect)IDirectPlayLobbyAImpl_Connect,
1464 XCAST(CreateAddress)IDirectPlayLobbyAImpl_CreateAddress,
1465 XCAST(EnumAddress)IDirectPlayLobbyAImpl_EnumAddress,
1466 XCAST(EnumAddressTypes)IDirectPlayLobbyAImpl_EnumAddressTypes,
1467 XCAST(EnumLocalApplications)IDirectPlayLobbyAImpl_EnumLocalApplications,
1468 XCAST(GetConnectionSettings)IDirectPlayLobbyAImpl_GetConnectionSettings,
1469 XCAST(ReceiveLobbyMessage)IDirectPlayLobbyAImpl_ReceiveLobbyMessage,
1470 XCAST(RunApplication)IDirectPlayLobbyAImpl_RunApplication,
1471 XCAST(SendLobbyMessage)IDirectPlayLobbyAImpl_SendLobbyMessage,
1472 XCAST(SetConnectionSettings)IDirectPlayLobbyAImpl_SetConnectionSettings,
1473 XCAST(SetLobbyMessageEvent)IDirectPlayLobbyAImpl_SetLobbyMessageEvent,
1475 XCAST(CreateCompoundAddress)IDirectPlayLobby2AImpl_CreateCompoundAddress,
1477 IDirectPlayLobby3AImpl_ConnectEx,
1478 IDirectPlayLobby3AImpl_RegisterApplication,
1479 IDirectPlayLobby3AImpl_UnregisterApplication,
1480 IDirectPlayLobby3AImpl_WaitForConnectionSettings
1484 /* Direct Play Lobby 3 (unicode) Virtual Table for methods */
1486 /* Note: Hack so we can reuse the old functions without compiler warnings */
1487 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1488 # define XCAST(fun) (typeof(directPlayLobby3WVT.fn##fun))
1490 # define XCAST(fun) (void*)
1493 static ICOM_VTABLE(IDirectPlayLobby3) directPlayLobby3WVT =
1495 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1496 IDirectPlayLobby3WImpl_QueryInterface,
1497 XCAST(AddRef)IDirectPlayLobbyAImpl_AddRef,
1498 XCAST(Release)IDirectPlayLobbyAImpl_Release,
1500 XCAST(Connect)IDirectPlayLobbyWImpl_Connect,
1501 XCAST(CreateAddress)IDirectPlayLobbyWImpl_CreateAddress,
1502 XCAST(EnumAddress)IDirectPlayLobbyWImpl_EnumAddress,
1503 XCAST(EnumAddressTypes)IDirectPlayLobbyWImpl_EnumAddressTypes,
1504 XCAST(EnumLocalApplications)IDirectPlayLobbyWImpl_EnumLocalApplications,
1505 XCAST(GetConnectionSettings)IDirectPlayLobbyWImpl_GetConnectionSettings,
1506 XCAST(ReceiveLobbyMessage)IDirectPlayLobbyWImpl_ReceiveLobbyMessage,
1507 XCAST(RunApplication)IDirectPlayLobbyWImpl_RunApplication,
1508 XCAST(SendLobbyMessage)IDirectPlayLobbyWImpl_SendLobbyMessage,
1509 XCAST(SetConnectionSettings)IDirectPlayLobbyWImpl_SetConnectionSettings,
1510 XCAST(SetLobbyMessageEvent)IDirectPlayLobbyWImpl_SetLobbyMessageEvent,
1512 XCAST(CreateCompoundAddress)IDirectPlayLobby2WImpl_CreateCompoundAddress,
1514 IDirectPlayLobby3WImpl_ConnectEx,
1515 IDirectPlayLobby3WImpl_RegisterApplication,
1516 IDirectPlayLobby3WImpl_UnregisterApplication,
1517 IDirectPlayLobby3WImpl_WaitForConnectionSettings
1522 /*********************************************************
1524 * Direct Play and Direct Play Lobby Interface Implementation
1526 *********************************************************/
1528 /***************************************************************************
1529 * DirectPlayLobbyCreateA (DPLAYX.4)
1532 HRESULT WINAPI DirectPlayLobbyCreateA( LPGUID lpGUIDDSP,
1533 LPDIRECTPLAYLOBBYA *lplpDPL,
1538 TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08lx\n",
1539 lpGUIDDSP,lplpDPL,lpUnk,lpData,dwDataSize);
1541 /* Parameter Check: lpGUIDSP, lpUnk & lpData must be NULL. dwDataSize must
1542 * equal 0. These fields are mostly for future expansion.
1544 if ( lpGUIDDSP || lpUnk || lpData || dwDataSize )
1547 return DPERR_INVALIDPARAMS;
1550 return directPlayLobby_QueryInterface( &IID_IDirectPlayLobbyA, (void**)lplpDPL );
1553 /***************************************************************************
1554 * DirectPlayLobbyCreateW (DPLAYX.5)
1557 HRESULT WINAPI DirectPlayLobbyCreateW( LPGUID lpGUIDDSP,
1558 LPDIRECTPLAYLOBBY *lplpDPL,
1563 TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08lx\n",
1564 lpGUIDDSP,lplpDPL,lpUnk,lpData,dwDataSize);
1566 /* Parameter Check: lpGUIDSP, lpUnk & lpData must be NULL. dwDataSize must
1567 * equal 0. These fields are mostly for future expansion.
1569 if ( lpGUIDDSP || lpUnk || lpData || dwDataSize )
1572 ERR("Bad parameters!\n" );
1573 return DPERR_INVALIDPARAMS;
1576 return directPlayLobby_QueryInterface( &IID_IDirectPlayLobby, (void**)lplpDPL );