1 /* Direct Play Lobby 2 & 3 Implementation
3 * Copyright 1998,1999,2000 - Peter Hunnisett
5 * <presently under construction - contact hunnise@nortelnetworks.com>
12 #include "debugtools.h"
16 #include "dplayx_global.h"
17 #include "dplayx_messages.h"
18 #include "dplayx_queue.h"
20 DEFAULT_DEBUG_CHANNEL(dplay)
22 /*****************************************************************************
23 * Predeclare the interface implementation structures
25 typedef struct IDirectPlayLobbyImpl IDirectPlayLobbyAImpl;
26 typedef struct IDirectPlayLobbyImpl IDirectPlayLobbyWImpl;
27 typedef struct IDirectPlayLobby2Impl IDirectPlayLobby2AImpl;
28 typedef struct IDirectPlayLobby2Impl IDirectPlayLobby2WImpl;
29 typedef struct IDirectPlayLobby3Impl IDirectPlayLobby3AImpl;
30 typedef struct IDirectPlayLobby3Impl IDirectPlayLobby3WImpl;
32 /* Forward declarations for this module helper methods */
33 HRESULT DPL_CreateCompoundAddress ( LPCDPCOMPOUNDADDRESSELEMENT lpElements, DWORD dwElementCount,
34 LPVOID lpAddress, LPDWORD lpdwAddressSize, BOOL bAnsiInterface );
36 HRESULT DPL_CreateAddress( REFGUID guidSP, REFGUID guidDataType, LPCVOID lpData, DWORD dwDataSize,
37 LPVOID lpAddress, LPDWORD lpdwAddressSize, BOOL bAnsiInterface );
41 extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress,
42 DWORD dwAddressSize, LPVOID lpContext );
44 static HRESULT WINAPI DPL_ConnectEx( IDirectPlayLobbyAImpl* This,
45 DWORD dwFlags, REFIID riid,
46 LPVOID* lplpDP, IUnknown* pUnk );
48 BOOL DPL_CreateAndSetLobbyHandles( DWORD dwDestProcessId, HANDLE hDestProcess,
49 LPHANDLE lphStart, LPHANDLE lphDeath,
53 /*****************************************************************************
54 * IDirectPlayLobby {1,2,3} implementation structure
56 * The philosophy behind this extra pointer derefernce is that I wanted to
57 * have the same structure for all types of objects without having to do
58 * alot of casting. I also only wanted to implement an interface in the
59 * object it was "released" with IUnknown interface being implemented in the 1 version.
60 * Of course, with these new interfaces comes the data required to keep the state required
61 * by these interfaces. So, basically, the pointers contain the data associated with
62 * a release. If you use the data associated with release 3 in a release 2 object, you'll
63 * get a run time trap, as that won't have any data.
68 DPQ_ENTRY( DPLMSG ) msgs; /* Link to next queued message */
70 typedef struct DPLMSG* LPDPLMSG;
72 typedef struct tagDirectPlayLobbyIUnknownData
75 CRITICAL_SECTION DPL_lock;
76 } DirectPlayLobbyIUnknownData;
78 typedef struct tagDirectPlayLobbyData
80 HKEY hkCallbackKeyHack;
82 DPQ_HEAD( DPLMSG ) msgs; /* List of messages received */
83 } DirectPlayLobbyData;
85 typedef struct tagDirectPlayLobby2Data
88 } DirectPlayLobby2Data;
90 typedef struct tagDirectPlayLobby3Data
93 } DirectPlayLobby3Data;
95 #define DPL_IMPL_FIELDS \
96 ULONG ulInterfaceRef; \
97 DirectPlayLobbyIUnknownData* unk; \
98 DirectPlayLobbyData* dpl; \
99 DirectPlayLobby2Data* dpl2; \
100 DirectPlayLobby3Data* dpl3;
102 struct IDirectPlayLobbyImpl
104 ICOM_VFIELD(IDirectPlayLobby);
108 struct IDirectPlayLobby2Impl
110 ICOM_VFIELD(IDirectPlayLobby2);
114 struct IDirectPlayLobby3Impl
116 ICOM_VFIELD(IDirectPlayLobby3);
121 /* Forward declarations of virtual tables */
122 static ICOM_VTABLE(IDirectPlayLobby) directPlayLobbyWVT;
123 static ICOM_VTABLE(IDirectPlayLobby2) directPlayLobby2WVT;
124 static ICOM_VTABLE(IDirectPlayLobby3) directPlayLobby3WVT;
126 static ICOM_VTABLE(IDirectPlayLobby) directPlayLobbyAVT;
127 static ICOM_VTABLE(IDirectPlayLobby2) directPlayLobby2AVT;
128 static ICOM_VTABLE(IDirectPlayLobby3) directPlayLobby3AVT;
133 static BOOL DPL_CreateIUnknown( LPVOID lpDPL )
135 ICOM_THIS(IDirectPlayLobbyAImpl,lpDPL);
137 This->unk = (DirectPlayLobbyIUnknownData*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
138 sizeof( *(This->unk) ) );
139 if ( This->unk == NULL )
144 InitializeCriticalSection( &This->unk->DPL_lock );
149 static BOOL DPL_DestroyIUnknown( LPVOID lpDPL )
151 ICOM_THIS(IDirectPlayLobbyAImpl,lpDPL);
153 DeleteCriticalSection( &This->unk->DPL_lock );
154 HeapFree( GetProcessHeap(), 0, This->unk );
159 static BOOL DPL_CreateLobby1( LPVOID lpDPL )
161 ICOM_THIS(IDirectPlayLobbyAImpl,lpDPL);
163 This->dpl = (DirectPlayLobbyData*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
164 sizeof( *(This->dpl) ) );
165 if ( This->dpl == NULL )
170 DPQ_INIT( This->dpl->msgs );
175 static BOOL DPL_DestroyLobby1( LPVOID lpDPL )
177 ICOM_THIS(IDirectPlayLobbyAImpl,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 ICOM_THIS(IDirectPlayLobby2AImpl,lpDPL);
196 This->dpl2 = (DirectPlayLobby2Data*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
197 sizeof( *(This->dpl2) ) );
198 if ( This->dpl2 == NULL )
206 static BOOL DPL_DestroyLobby2( LPVOID lpDPL )
208 ICOM_THIS(IDirectPlayLobby2AImpl,lpDPL);
210 HeapFree( GetProcessHeap(), 0, This->dpl2 );
215 static BOOL DPL_CreateLobby3( LPVOID lpDPL )
217 ICOM_THIS(IDirectPlayLobby3AImpl,lpDPL);
219 This->dpl3 = (DirectPlayLobby3Data*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
220 sizeof( *(This->dpl3) ) );
221 if ( This->dpl3 == NULL )
229 static BOOL DPL_DestroyLobby3( LPVOID lpDPL )
231 ICOM_THIS(IDirectPlayLobby3AImpl,lpDPL);
233 HeapFree( GetProcessHeap(), 0, This->dpl3 );
239 /* The COM interface for upversioning an interface
240 * We've been given a GUID (riid) and we need to replace the present
241 * interface with that of the requested interface.
243 * Snip from some Microsoft document:
244 * There are four requirements for implementations of QueryInterface (In these
245 * cases, "must succeed" means "must succeed barring catastrophic failure."):
247 * * The set of interfaces accessible on an object through
248 * IUnknown::QueryInterface must be static, not dynamic. This means that
249 * if a call to QueryInterface for a pointer to a specified interface
250 * succeeds the first time, it must succeed again, and if it fails the
251 * first time, it must fail on all subsequent queries.
252 * * It must be symmetric ~W if a client holds a pointer to an interface on
253 * an object, and queries for that interface, the call must succeed.
254 * * It must be reflexive ~W if a client holding a pointer to one interface
255 * queries successfully for another, a query through the obtained pointer
256 * for the first interface must succeed.
257 * * It must be transitive ~W if a client holding a pointer to one interface
258 * queries successfully for a second, and through that pointer queries
259 * successfully for a third interface, a query for the first interface
260 * through the pointer for the third interface must succeed.
263 HRESULT DPL_CreateInterface
264 ( REFIID riid, LPVOID* ppvObj )
266 TRACE( " for %s\n", debugstr_guid( riid ) );
268 *ppvObj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
269 sizeof( IDirectPlayLobbyWImpl ) );
271 if( *ppvObj == NULL )
273 return DPERR_OUTOFMEMORY;
276 if( IsEqualGUID( &IID_IDirectPlayLobby, riid ) )
278 ICOM_THIS(IDirectPlayLobbyWImpl,*ppvObj);
279 ICOM_VTBL(This) = &directPlayLobbyWVT;
281 else if( IsEqualGUID( &IID_IDirectPlayLobbyA, riid ) )
283 ICOM_THIS(IDirectPlayLobbyAImpl,*ppvObj);
284 ICOM_VTBL(This) = &directPlayLobbyAVT;
286 else if( IsEqualGUID( &IID_IDirectPlayLobby2, riid ) )
288 ICOM_THIS(IDirectPlayLobby2WImpl,*ppvObj);
289 ICOM_VTBL(This) = &directPlayLobby2WVT;
291 else if( IsEqualGUID( &IID_IDirectPlayLobby2A, riid ) )
293 ICOM_THIS(IDirectPlayLobby2AImpl,*ppvObj);
294 ICOM_VTBL(This) = &directPlayLobby2AVT;
296 else if( IsEqualGUID( &IID_IDirectPlayLobby3, riid ) )
298 ICOM_THIS(IDirectPlayLobby3WImpl,*ppvObj);
299 ICOM_VTBL(This) = &directPlayLobby3WVT;
301 else if( IsEqualGUID( &IID_IDirectPlayLobby3A, riid ) )
303 ICOM_THIS(IDirectPlayLobby3AImpl,*ppvObj);
304 ICOM_VTBL(This) = &directPlayLobby3AVT;
308 /* Unsupported interface */
309 HeapFree( GetProcessHeap(), 0, *ppvObj );
312 return E_NOINTERFACE;
316 if ( DPL_CreateIUnknown( *ppvObj ) &&
317 DPL_CreateLobby1( *ppvObj ) &&
318 DPL_CreateLobby2( *ppvObj ) &&
319 DPL_CreateLobby3( *ppvObj )
322 IDirectPlayLobby_AddRef( (LPDIRECTPLAYLOBBY)*ppvObj );
326 /* Initialize failed, destroy it */
327 DPL_DestroyLobby3( *ppvObj );
328 DPL_DestroyLobby2( *ppvObj );
329 DPL_DestroyLobby1( *ppvObj );
330 DPL_DestroyIUnknown( *ppvObj );
331 HeapFree( GetProcessHeap(), 0, *ppvObj );
334 return DPERR_NOMEMORY;
337 static HRESULT WINAPI DPL_QueryInterface
338 ( LPDIRECTPLAYLOBBYA iface,
342 ICOM_THIS(IDirectPlayLobbyAImpl,iface);
343 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid( riid ), ppvObj );
345 *ppvObj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
348 if( *ppvObj == NULL )
350 return DPERR_OUTOFMEMORY;
353 CopyMemory( *ppvObj, This, sizeof( *This ) );
354 (*(IDirectPlayLobbyAImpl**)ppvObj)->ulInterfaceRef = 0;
356 if( IsEqualGUID( &IID_IDirectPlayLobby, riid ) )
358 ICOM_THIS(IDirectPlayLobbyWImpl,*ppvObj);
359 ICOM_VTBL(This) = &directPlayLobbyWVT;
361 else if( IsEqualGUID( &IID_IDirectPlayLobbyA, riid ) )
363 ICOM_THIS(IDirectPlayLobbyAImpl,*ppvObj);
364 ICOM_VTBL(This) = &directPlayLobbyAVT;
366 else if( IsEqualGUID( &IID_IDirectPlayLobby2, riid ) )
368 ICOM_THIS(IDirectPlayLobby2WImpl,*ppvObj);
369 ICOM_VTBL(This) = &directPlayLobby2WVT;
371 else if( IsEqualGUID( &IID_IDirectPlayLobby2A, riid ) )
373 ICOM_THIS(IDirectPlayLobby2AImpl,*ppvObj);
374 ICOM_VTBL(This) = &directPlayLobby2AVT;
376 else if( IsEqualGUID( &IID_IDirectPlayLobby3, riid ) )
378 ICOM_THIS(IDirectPlayLobby3WImpl,*ppvObj);
379 ICOM_VTBL(This) = &directPlayLobby3WVT;
381 else if( IsEqualGUID( &IID_IDirectPlayLobby3A, riid ) )
383 ICOM_THIS(IDirectPlayLobby3AImpl,*ppvObj);
384 ICOM_VTBL(This) = &directPlayLobby3AVT;
388 /* Unsupported interface */
389 HeapFree( GetProcessHeap(), 0, *ppvObj );
392 return E_NOINTERFACE;
395 IDirectPlayLobby_AddRef( (LPDIRECTPLAYLOBBY)*ppvObj );
401 * Simple procedure. Just increment the reference count to this
402 * structure and return the new reference count.
404 static ULONG WINAPI DPL_AddRef
405 ( LPDIRECTPLAYLOBBY iface )
407 ULONG ulInterfaceRefCount, ulObjRefCount;
408 ICOM_THIS(IDirectPlayLobbyWImpl,iface);
410 ulObjRefCount = InterlockedIncrement( &This->unk->ulObjRef );
411 ulInterfaceRefCount = InterlockedIncrement( &This->ulInterfaceRef );
413 TRACE( "ref count incremented to %lu:%lu for %p\n",
414 ulInterfaceRefCount, ulObjRefCount, This );
416 return ulObjRefCount;
420 * Simple COM procedure. Decrease the reference count to this object.
421 * If the object no longer has any reference counts, free up the associated
424 static ULONG WINAPI DPL_Release
425 ( LPDIRECTPLAYLOBBYA iface )
427 ULONG ulInterfaceRefCount, ulObjRefCount;
428 ICOM_THIS(IDirectPlayLobbyAImpl,iface);
430 ulObjRefCount = InterlockedDecrement( &This->unk->ulObjRef );
431 ulInterfaceRefCount = InterlockedDecrement( &This->ulInterfaceRef );
433 TRACE( "ref count decremented to %lu:%lu for %p\n",
434 ulInterfaceRefCount, ulObjRefCount, This );
436 /* Deallocate if this is the last reference to the object */
437 if( ulObjRefCount == 0 )
439 DPL_DestroyLobby3( This );
440 DPL_DestroyLobby2( This );
441 DPL_DestroyLobby1( This );
442 DPL_DestroyIUnknown( This );
445 if( ulInterfaceRefCount == 0 )
447 HeapFree( GetProcessHeap(), 0, This );
450 return ulInterfaceRefCount;
454 /********************************************************************
456 * Connects an application to the session specified by the DPLCONNECTION
457 * structure currently stored with the DirectPlayLobby object.
459 * Returns a IDirectPlay interface.
462 static HRESULT WINAPI DPL_ConnectEx
463 ( IDirectPlayLobbyAImpl* This,
470 DWORD dwOpenFlags = 0;
471 DWORD dwConnSize = 0;
472 LPDPLCONNECTION lpConn;
474 FIXME("(%p)->(0x%08lx,%p,%p): semi stub\n", This, dwFlags, lplpDP, pUnk );
478 return DPERR_INVALIDPARAMS;
481 /* Backwards compatibility */
484 dwFlags = DPCONNECT_RETURNSTATUS;
487 /* Create the DirectPlay interface */
488 if( ( hr = DP_CreateInterface( riid, lplpDP ) ) != DP_OK )
490 ERR( "error creating interface for %s:%s.\n",
491 debugstr_guid( riid ), DPLAYX_HresultToString( hr ) );
495 /* FIXME: Is it safe/correct to use appID of 0? */
496 hr = IDirectPlayLobby_GetConnectionSettings( (LPDIRECTPLAYLOBBY)This,
497 0, NULL, &dwConnSize );
498 if( hr != DPERR_BUFFERTOOSMALL )
503 lpConn = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwConnSize );
507 return DPERR_NOMEMORY;
510 /* FIXME: Is it safe/correct to use appID of 0? */
511 hr = IDirectPlayLobby_GetConnectionSettings( (LPDIRECTPLAYLOBBY)This,
512 0, lpConn, &dwConnSize );
519 /* - Need to call IDirectPlay::EnumConnections with the service provider to get that good information
520 * - Need to call CreateAddress to create the lpConnection param for IDirectPlay::InitializeConnection
521 * - Call IDirectPlay::InitializeConnection
524 /* Now initialize the Service Provider */
525 hr = IDirectPlayX_InitializeConnection( (*(LPDIRECTPLAY2*)lplpDP),
529 /* Setup flags to pass into DirectPlay::Open */
530 if( dwFlags & DPCONNECT_RETURNSTATUS )
532 dwOpenFlags |= DPOPEN_RETURNSTATUS;
534 dwOpenFlags |= lpConn->dwFlags;
536 hr = IDirectPlayX_Open( (*(LPDIRECTPLAY2*)lplpDP), lpConn->lpSessionDesc,
539 HeapFree( GetProcessHeap(), 0, lpConn );
544 static HRESULT WINAPI IDirectPlayLobbyAImpl_Connect
545 ( LPDIRECTPLAYLOBBYA iface,
547 LPDIRECTPLAY2A* lplpDP,
550 ICOM_THIS(IDirectPlayLobbyAImpl,iface);
551 return DPL_ConnectEx( This, dwFlags, &IID_IDirectPlay2A,
552 (LPVOID)lplpDP, pUnk );
555 static HRESULT WINAPI IDirectPlayLobbyWImpl_Connect
556 ( LPDIRECTPLAYLOBBY iface,
558 LPDIRECTPLAY2* lplpDP,
561 ICOM_THIS(IDirectPlayLobbyAImpl,iface); /* Yes cast to A */
562 return DPL_ConnectEx( This, dwFlags, &IID_IDirectPlay2,
563 (LPVOID)lplpDP, pUnk );
566 /********************************************************************
568 * Creates a DirectPlay Address, given a service provider-specific network
570 * Returns an address contains the globally unique identifier
571 * (GUID) of the service provider and data that the service provider can
572 * interpret as a network address.
574 * NOTE: It appears that this method is supposed to be really really stupid
575 * with no error checking on the contents.
577 static HRESULT WINAPI IDirectPlayLobbyAImpl_CreateAddress
578 ( LPDIRECTPLAYLOBBYA iface,
580 REFGUID guidDataType,
584 LPDWORD lpdwAddressSize )
586 return DPL_CreateAddress( guidSP, guidDataType, lpData, dwDataSize,
587 lpAddress, lpdwAddressSize, TRUE );
590 static HRESULT WINAPI IDirectPlayLobbyWImpl_CreateAddress
591 ( LPDIRECTPLAYLOBBY iface,
593 REFGUID guidDataType,
597 LPDWORD lpdwAddressSize )
599 return DPL_CreateAddress( guidSP, guidDataType, lpData, dwDataSize,
600 lpAddress, lpdwAddressSize, FALSE );
603 HRESULT DPL_CreateAddress(
605 REFGUID guidDataType,
609 LPDWORD lpdwAddressSize,
610 BOOL bAnsiInterface )
612 const DWORD dwNumAddElements = 2; /* Service Provide & address data type */
613 DPCOMPOUNDADDRESSELEMENT addressElements[ 2 /* dwNumAddElements */ ];
615 TRACE( "(%p)->(%p,%p,0x%08lx,%p,%p,%d)\n", guidSP, guidDataType, lpData, dwDataSize,
616 lpAddress, lpdwAddressSize, bAnsiInterface );
618 addressElements[ 0 ].guidDataType = DPAID_ServiceProvider;
619 addressElements[ 0 ].dwDataSize = sizeof( GUID );
620 addressElements[ 0 ].lpData = (LPVOID)guidSP;
622 addressElements[ 1 ].guidDataType = *guidDataType;
623 addressElements[ 1 ].dwDataSize = dwDataSize;
624 addressElements[ 1 ].lpData = (LPVOID)lpData;
626 /* Call CreateCompoundAddress to cut down on code.
627 NOTE: We can do this because we don't support DPL 1 interfaces! */
628 return DPL_CreateCompoundAddress( addressElements, dwNumAddElements,
629 lpAddress, lpdwAddressSize, bAnsiInterface );
634 /********************************************************************
636 * Parses out chunks from the DirectPlay Address buffer by calling the
637 * given callback function, with lpContext, for each of the chunks.
640 static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumAddress
641 ( LPDIRECTPLAYLOBBYA iface,
642 LPDPENUMADDRESSCALLBACK lpEnumAddressCallback,
647 ICOM_THIS(IDirectPlayLobbyAImpl,iface);
649 TRACE("(%p)->(%p,%p,0x%08lx,%p)\n", This, lpEnumAddressCallback, lpAddress,
650 dwAddressSize, lpContext );
652 return DPL_EnumAddress( lpEnumAddressCallback, lpAddress, dwAddressSize, lpContext );
655 static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumAddress
656 ( LPDIRECTPLAYLOBBY iface,
657 LPDPENUMADDRESSCALLBACK lpEnumAddressCallback,
662 ICOM_THIS(IDirectPlayLobbyWImpl,iface);
664 TRACE("(%p)->(%p,%p,0x%08lx,%p)\n", This, lpEnumAddressCallback, lpAddress,
665 dwAddressSize, lpContext );
667 return DPL_EnumAddress( lpEnumAddressCallback, lpAddress, dwAddressSize, lpContext );
670 extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress,
671 DWORD dwAddressSize, LPVOID lpContext )
673 DWORD dwTotalSizeEnumerated = 0;
675 /* FIXME: First chunk is always the total size chunk - Should we report it? */
677 while ( dwTotalSizeEnumerated < dwAddressSize )
679 LPDPADDRESS lpElements = (LPDPADDRESS)lpAddress;
680 DWORD dwSizeThisEnumeration;
682 /* Invoke the enum method. If false is returned, stop enumeration */
683 if ( !lpEnumAddressCallback( &lpElements->guidDataType,
684 lpElements->dwDataSize,
685 (BYTE*)lpElements + sizeof( DPADDRESS ),
691 dwSizeThisEnumeration = sizeof( DPADDRESS ) + lpElements->dwDataSize;
692 lpAddress = (BYTE*) lpAddress + dwSizeThisEnumeration;
693 dwTotalSizeEnumerated += dwSizeThisEnumeration;
699 /********************************************************************
701 * Enumerates all the address types that a given service provider needs to
702 * build the DirectPlay Address.
705 static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumAddressTypes
706 ( LPDIRECTPLAYLOBBYA iface,
707 LPDPLENUMADDRESSTYPESCALLBACK lpEnumAddressTypeCallback,
712 ICOM_THIS(IDirectPlayLobbyAImpl,iface);
715 LPCSTR searchSubKey = "SOFTWARE\\Microsoft\\DirectPlay\\Service Providers";
716 DWORD dwIndex, sizeOfSubKeyName=50;
720 TRACE(" (%p)->(%p,%p,%p,0x%08lx)\n", This, lpEnumAddressTypeCallback, guidSP, lpContext, dwFlags );
724 return DPERR_INVALIDPARAMS;
727 if( !lpEnumAddressTypeCallback || !*lpEnumAddressTypeCallback )
729 return DPERR_INVALIDPARAMS;
734 return DPERR_INVALIDOBJECT;
737 /* Need to loop over the service providers in the registry */
738 if( RegOpenKeyExA( HKEY_LOCAL_MACHINE, searchSubKey,
739 0, KEY_READ, &hkResult ) != ERROR_SUCCESS )
741 /* Hmmm. Does this mean that there are no service providers? */
742 ERR(": no service providers?\n");
746 /* Traverse all the service providers we have available */
748 RegEnumKeyExA( hkResult, dwIndex, subKeyName, &sizeOfSubKeyName,
749 NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS;
750 ++dwIndex, sizeOfSubKeyName=50 )
753 HKEY hkServiceProvider, hkServiceProviderAt;
754 GUID serviceProviderGUID;
755 DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
757 char returnBuffer[51];
758 LPWSTR lpWGUIDString;
760 LPSTR atKey = "Address Types";
761 LPSTR guidDataSubKey = "Guid";
765 TRACE(" this time through: %s\n", subKeyName );
767 /* Get a handle for this particular service provider */
768 if( RegOpenKeyExA( hkResult, subKeyName, 0, KEY_READ,
769 &hkServiceProvider ) != ERROR_SUCCESS )
771 ERR(": what the heck is going on?\n" );
775 if( RegQueryValueExA( hkServiceProvider, guidDataSubKey,
776 NULL, &returnTypeGUID, returnBuffer,
777 &sizeOfReturnBuffer ) != ERROR_SUCCESS )
779 ERR(": missing GUID registry data members\n" );
783 /* FIXME: Check return types to ensure we're interpreting data right */
784 lpWGUIDString = HEAP_strdupAtoW( GetProcessHeap(), 0, returnBuffer );
785 CLSIDFromString( (LPCOLESTR)lpWGUIDString, &serviceProviderGUID );
786 HeapFree( GetProcessHeap(), 0, lpWGUIDString );
787 /* FIXME: Have I got a memory leak on the serviceProviderGUID? */
789 /* Determine if this is the Service Provider that the user asked for */
790 if( !IsEqualGUID( &serviceProviderGUID, guidSP ) )
795 /* Get a handle for this particular service provider */
796 if( RegOpenKeyExA( hkServiceProvider, atKey, 0, KEY_READ,
797 &hkServiceProviderAt ) != ERROR_SUCCESS )
799 TRACE(": No Address Types registry data sub key/members\n" );
803 /* Traverse all the address type we have available */
805 RegEnumKeyExA( hkServiceProviderAt, dwAtIndex, atSubKey, &sizeOfSubKeyName,
806 NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS;
807 ++dwAtIndex, sizeOfSubKeyName=50 )
809 TRACE( "Found Address Type GUID %s\n", atSubKey );
811 /* FIXME: Check return types to ensure we're interpreting data right */
812 lpWGUIDString = HEAP_strdupAtoW( GetProcessHeap(), 0, atSubKey );
813 CLSIDFromString( (LPCOLESTR)lpWGUIDString, &serviceProviderGUID );
814 HeapFree( GetProcessHeap(), 0, lpWGUIDString );
815 /* FIXME: Have I got a memory leak on the serviceProviderGUID? */
817 /* The enumeration will return FALSE if we are not to continue */
818 if( !lpEnumAddressTypeCallback( &serviceProviderGUID, lpContext, 0 ) )
820 WARN("lpEnumCallback returning FALSE\n" );
821 break; /* FIXME: This most likely has to break from the procedure...*/
826 /* We only enumerate address types for 1 GUID. We've found it, so quit looking */
833 static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumAddressTypes
834 ( LPDIRECTPLAYLOBBY iface,
835 LPDPLENUMADDRESSTYPESCALLBACK lpEnumAddressTypeCallback,
841 return DPERR_OUTOFMEMORY;
844 /********************************************************************
846 * Enumerates what applications are registered with DirectPlay by
847 * invoking the callback function with lpContext.
850 static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumLocalApplications
851 ( LPDIRECTPLAYLOBBY iface,
852 LPDPLENUMLOCALAPPLICATIONSCALLBACK lpEnumLocalAppCallback,
856 ICOM_THIS(IDirectPlayLobbyWImpl,iface);
858 FIXME("(%p)->(%p,%p,0x%08lx):stub\n", This, lpEnumLocalAppCallback, lpContext, dwFlags );
860 return DPERR_OUTOFMEMORY;
863 static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumLocalApplications
864 ( LPDIRECTPLAYLOBBYA iface,
865 LPDPLENUMLOCALAPPLICATIONSCALLBACK lpEnumLocalAppCallback,
869 ICOM_THIS(IDirectPlayLobbyAImpl,iface);
872 LPCSTR searchSubKey = "SOFTWARE\\Microsoft\\DirectPlay\\Applications";
873 LPSTR guidDataSubKey = "Guid";
874 DWORD dwIndex, sizeOfSubKeyName=50;
878 TRACE("(%p)->(%p,%p,0x%08lx)\n", This, lpEnumLocalAppCallback, lpContext, dwFlags );
882 return DPERR_INVALIDPARAMS;
885 if( !lpEnumLocalAppCallback || !*lpEnumLocalAppCallback )
887 return DPERR_INVALIDPARAMS;
890 /* Need to loop over the service providers in the registry */
891 if( RegOpenKeyExA( HKEY_LOCAL_MACHINE, searchSubKey,
892 0, KEY_READ, &hkResult ) != ERROR_SUCCESS )
894 /* Hmmm. Does this mean that there are no service providers? */
895 ERR(": no service providers?\n");
899 /* Traverse all registered applications */
901 RegEnumKeyExA( hkResult, dwIndex, subKeyName, &sizeOfSubKeyName, NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS;
902 ++dwIndex, sizeOfSubKeyName=50 )
905 HKEY hkServiceProvider;
906 GUID serviceProviderGUID;
907 DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
908 char returnBuffer[51];
909 LPWSTR lpWGUIDString;
910 DPLAPPINFO dplAppInfo;
912 TRACE(" this time through: %s\n", subKeyName );
914 /* Get a handle for this particular service provider */
915 if( RegOpenKeyExA( hkResult, subKeyName, 0, KEY_READ,
916 &hkServiceProvider ) != ERROR_SUCCESS )
918 ERR(": what the heck is going on?\n" );
922 if( RegQueryValueExA( hkServiceProvider, guidDataSubKey,
923 NULL, &returnTypeGUID, returnBuffer,
924 &sizeOfReturnBuffer ) != ERROR_SUCCESS )
926 ERR(": missing GUID registry data members\n" );
930 /* FIXME: Check return types to ensure we're interpreting data right */
931 lpWGUIDString = HEAP_strdupAtoW( GetProcessHeap(), 0, returnBuffer );
932 CLSIDFromString( (LPCOLESTR)lpWGUIDString, &serviceProviderGUID );
933 HeapFree( GetProcessHeap(), 0, lpWGUIDString );
934 /* FIXME: Have I got a memory leak on the serviceProviderGUID? */
936 dplAppInfo.dwSize = sizeof( dplAppInfo );
937 dplAppInfo.guidApplication = serviceProviderGUID;
938 dplAppInfo.appName.lpszAppNameA = subKeyName;
940 EnterCriticalSection( &This->unk->DPL_lock );
942 memcpy( &This->dpl->hkCallbackKeyHack, &hkServiceProvider, sizeof( hkServiceProvider ) );
944 if( !lpEnumLocalAppCallback( &dplAppInfo, lpContext, dwFlags ) )
946 LeaveCriticalSection( &This->unk->DPL_lock );
950 LeaveCriticalSection( &This->unk->DPL_lock );
956 /********************************************************************
958 * Retrieves the DPLCONNECTION structure that contains all the information
959 * needed to start and connect an application. This was generated using
960 * either the RunApplication or SetConnectionSettings methods.
962 * NOTES: If lpData is NULL then just return lpdwDataSize. This allows
963 * the data structure to be allocated by our caller which can then
964 * call this procedure/method again with a valid data pointer.
966 static HRESULT WINAPI IDirectPlayLobbyAImpl_GetConnectionSettings
967 ( LPDIRECTPLAYLOBBYA iface,
970 LPDWORD lpdwDataSize )
972 ICOM_THIS(IDirectPlayLobbyAImpl,iface);
975 TRACE("(%p)->(0x%08lx,%p,%p)\n", This, dwAppID, lpData, lpdwDataSize );
977 EnterCriticalSection( &This->unk->DPL_lock );
979 hr = DPLAYX_GetConnectionSettingsA( dwAppID,
984 LeaveCriticalSection( &This->unk->DPL_lock );
989 static HRESULT WINAPI IDirectPlayLobbyWImpl_GetConnectionSettings
990 ( LPDIRECTPLAYLOBBY iface,
993 LPDWORD lpdwDataSize )
995 ICOM_THIS(IDirectPlayLobbyWImpl,iface);
998 TRACE("(%p)->(0x%08lx,%p,%p)\n", This, dwAppID, lpData, lpdwDataSize );
1000 EnterCriticalSection( &This->unk->DPL_lock );
1002 hr = DPLAYX_GetConnectionSettingsW( dwAppID,
1007 LeaveCriticalSection( &This->unk->DPL_lock );
1012 /********************************************************************
1014 * Retrieves the message sent between a lobby client and a DirectPlay
1015 * application. All messages are queued until received.
1018 static HRESULT WINAPI IDirectPlayLobbyAImpl_ReceiveLobbyMessage
1019 ( LPDIRECTPLAYLOBBYA iface,
1022 LPDWORD lpdwMessageFlags,
1024 LPDWORD lpdwDataSize )
1026 ICOM_THIS(IDirectPlayLobbyAImpl,iface);
1027 FIXME(":stub %p %08lx %08lx %p %p %p\n", This, dwFlags, dwAppID, lpdwMessageFlags, lpData,
1029 return DPERR_OUTOFMEMORY;
1032 static HRESULT WINAPI IDirectPlayLobbyWImpl_ReceiveLobbyMessage
1033 ( LPDIRECTPLAYLOBBY iface,
1036 LPDWORD lpdwMessageFlags,
1038 LPDWORD lpdwDataSize )
1040 ICOM_THIS(IDirectPlayLobbyWImpl,iface);
1041 FIXME(":stub %p %08lx %08lx %p %p %p\n", This, dwFlags, dwAppID, lpdwMessageFlags, lpData,
1043 return DPERR_OUTOFMEMORY;
1046 typedef struct tagRunApplicationEnumStruct
1048 IDirectPlayLobbyAImpl* This;
1053 LPSTR lpszCommandLine;
1054 LPSTR lpszCurrentDirectory;
1055 } RunApplicationEnumStruct, *lpRunApplicationEnumStruct;
1057 /* To be called by RunApplication to find how to invoke the function */
1058 static BOOL CALLBACK RunApplicationA_EnumLocalApplications
1059 ( LPCDPLAPPINFO lpAppInfo,
1063 lpRunApplicationEnumStruct lpData = (lpRunApplicationEnumStruct)lpContext;
1065 if( IsEqualGUID( &lpAppInfo->guidApplication, &lpData->appGUID ) )
1067 char returnBuffer[200];
1068 DWORD returnType, sizeOfReturnBuffer;
1069 LPSTR clSubKey = "CommandLine";
1070 LPSTR cdSubKey = "CurrentDirectory";
1071 LPSTR fileSubKey = "File";
1072 LPSTR pathSubKey = "Path";
1074 /* FIXME: Lazy man hack - dplay struct has the present reg key saved */
1076 sizeOfReturnBuffer = 200;
1078 /* Get all the appropriate data from the registry */
1079 if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, clSubKey,
1080 NULL, &returnType, returnBuffer,
1081 &sizeOfReturnBuffer ) != ERROR_SUCCESS )
1083 ERR( ": missing CommandLine registry data member\n" );
1087 lpData->lpszCommandLine = HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, returnBuffer );
1090 sizeOfReturnBuffer = 200;
1092 if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, cdSubKey,
1093 NULL, &returnType, returnBuffer,
1094 &sizeOfReturnBuffer ) != ERROR_SUCCESS )
1096 ERR( ": missing CurrentDirectory registry data member\n" );
1100 lpData->lpszCurrentDirectory = HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, returnBuffer );
1103 sizeOfReturnBuffer = 200;
1105 if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, fileSubKey,
1106 NULL, &returnType, returnBuffer,
1107 &sizeOfReturnBuffer ) != ERROR_SUCCESS )
1109 ERR( ": missing File registry data member\n" );
1113 lpData->lpszFileName = HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, returnBuffer );
1116 sizeOfReturnBuffer = 200;
1118 if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, pathSubKey,
1119 NULL, &returnType, returnBuffer,
1120 &sizeOfReturnBuffer ) != ERROR_SUCCESS )
1122 ERR( ": missing Path registry data member\n" );
1126 lpData->lpszPath = HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, returnBuffer );
1129 return FALSE; /* No need to keep going as we found what we wanted */
1132 return TRUE; /* Keep enumerating, haven't found the application yet */
1135 BOOL DPL_CreateAndSetLobbyHandles( DWORD dwDestProcessId, HANDLE hDestProcess,
1136 LPHANDLE lphStart, LPHANDLE lphDeath,
1139 /* These are the handles for the created process */
1140 HANDLE hAppStart, hAppDeath, hAppRead, hTemp;
1141 SECURITY_ATTRIBUTES s_attrib;
1143 s_attrib.nLength = sizeof( s_attrib );
1144 s_attrib.lpSecurityDescriptor = NULL;
1145 s_attrib.bInheritHandle = TRUE;
1147 /* FIXME: Is there a handle leak here? */
1148 hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL );
1149 *lphStart = ConvertToGlobalHandle( hTemp );
1151 hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL );
1152 *lphDeath = ConvertToGlobalHandle( hTemp );
1154 hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL );
1155 *lphRead = ConvertToGlobalHandle( hTemp );
1157 if( ( !DuplicateHandle( GetCurrentProcess(), *lphStart,
1158 hDestProcess, &hAppStart,
1159 0, FALSE, DUPLICATE_SAME_ACCESS ) ) ||
1160 ( !DuplicateHandle( GetCurrentProcess(), *lphDeath,
1161 hDestProcess, &hAppDeath,
1162 0, FALSE, DUPLICATE_SAME_ACCESS ) ) ||
1163 ( !DuplicateHandle( GetCurrentProcess(), *lphRead,
1164 hDestProcess, &hAppRead,
1165 0, FALSE, DUPLICATE_SAME_ACCESS ) )
1168 /* FIXME: Handle leak... */
1169 ERR( "Unable to dup handles\n" );
1173 if( !DPLAYX_SetLobbyHandles( dwDestProcessId,
1174 hAppStart, hAppDeath, hAppRead ) )
1183 /********************************************************************
1185 * Starts an application and passes to it all the information to
1186 * connect to a session.
1189 static HRESULT WINAPI IDirectPlayLobbyAImpl_RunApplication
1190 ( LPDIRECTPLAYLOBBYA iface,
1193 LPDPLCONNECTION lpConn,
1194 HANDLE hReceiveEvent )
1196 ICOM_THIS(IDirectPlayLobbyAImpl,iface);
1198 RunApplicationEnumStruct enumData;
1200 STARTUPINFOA startupInfo;
1201 PROCESS_INFORMATION newProcessInfo;
1203 DWORD dwSuspendCount;
1204 HANDLE hStart, hDeath, hSettingRead;
1206 TRACE( "(%p)->(0x%08lx,%p,%p,%x)\n",
1207 This, dwFlags, lpdwAppID, lpConn, hReceiveEvent );
1211 return DPERR_INVALIDPARAMS;
1214 if( DPLAYX_AnyLobbiesWaitingForConnSettings() )
1216 FIXME( "Waiting lobby not being handled correctly\n" );
1219 EnterCriticalSection( &This->unk->DPL_lock );
1221 ZeroMemory( &enumData, sizeof( enumData ) );
1222 enumData.This = This;
1223 enumData.appGUID = lpConn->lpSessionDesc->guidApplication;
1225 /* Our callback function will fill up the enumData structure with all the information
1226 required to start a new process */
1227 IDirectPlayLobby_EnumLocalApplications( iface, RunApplicationA_EnumLocalApplications,
1228 (LPVOID)(&enumData), 0 );
1230 /* First the application name */
1231 strcpy( temp, enumData.lpszPath );
1232 strcat( temp, "\\" );
1233 strcat( temp, enumData.lpszFileName );
1234 HeapFree( GetProcessHeap(), 0, enumData.lpszPath );
1235 HeapFree( GetProcessHeap(), 0, enumData.lpszFileName );
1236 appName = HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, temp );
1238 /* Now the command line */
1239 strcat( temp, " " );
1240 strcat( temp, enumData.lpszCommandLine );
1241 HeapFree( GetProcessHeap(), 0, enumData.lpszCommandLine );
1242 enumData.lpszCommandLine = HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, temp );
1244 ZeroMemory( &startupInfo, sizeof( startupInfo ) );
1245 startupInfo.cb = sizeof( startupInfo );
1246 /* FIXME: Should any fields be filled in? */
1248 ZeroMemory( &newProcessInfo, sizeof( newProcessInfo ) );
1250 if( !CreateProcessA( appName,
1251 enumData.lpszCommandLine,
1255 CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE | CREATE_SUSPENDED, /* Creation Flags */
1257 enumData.lpszCurrentDirectory,
1263 ERR( "Failed to create process for app %s\n", appName );
1265 HeapFree( GetProcessHeap(), 0, appName );
1266 HeapFree( GetProcessHeap(), 0, enumData.lpszCommandLine );
1267 HeapFree( GetProcessHeap(), 0, enumData.lpszCurrentDirectory );
1269 return DPERR_CANTCREATEPROCESS;
1272 HeapFree( GetProcessHeap(), 0, appName );
1273 HeapFree( GetProcessHeap(), 0, enumData.lpszCommandLine );
1274 HeapFree( GetProcessHeap(), 0, enumData.lpszCurrentDirectory );
1276 /* Reserve this global application id! */
1277 if( !DPLAYX_CreateLobbyApplication( newProcessInfo.dwProcessId ) )
1279 ERR( "Unable to create global application data for 0x%08lx\n",
1280 newProcessInfo.dwProcessId );
1283 hr = IDirectPlayLobby_SetConnectionSettings( iface, 0, newProcessInfo.dwProcessId, lpConn );
1287 ERR( "SetConnectionSettings failure %s\n", DPLAYX_HresultToString( hr ) );
1291 /* Setup the handles for application notification */
1292 DPL_CreateAndSetLobbyHandles( newProcessInfo.dwProcessId,
1293 newProcessInfo.hProcess,
1294 &hStart, &hDeath, &hSettingRead );
1296 /* Setup the message thread ID */
1297 This->dpl->dwMsgThread =
1298 CreateLobbyMessageReceptionThread( hReceiveEvent, hStart, hDeath, hSettingRead );
1300 DPLAYX_SetLobbyMsgThreadId( newProcessInfo.dwProcessId, This->dpl->dwMsgThread );
1302 LeaveCriticalSection( &This->unk->DPL_lock );
1304 /* Everything seems to have been set correctly, update the dwAppID */
1305 *lpdwAppID = newProcessInfo.dwProcessId;
1307 /* Unsuspend the process - should return the prev suspension count */
1308 if( ( dwSuspendCount = ResumeThread( newProcessInfo.hThread ) ) != 1 )
1310 ERR( "ResumeThread failed with 0x%08lx\n", dwSuspendCount );
1316 static HRESULT WINAPI IDirectPlayLobbyWImpl_RunApplication
1317 ( LPDIRECTPLAYLOBBY iface,
1320 LPDPLCONNECTION lpConn,
1321 HANDLE hReceiveEvent )
1323 ICOM_THIS(IDirectPlayLobbyWImpl,iface);
1324 FIXME( "(%p)->(0x%08lx,%p,%p,%p):stub\n", This, dwFlags, lpdwAppID, lpConn, (void *)hReceiveEvent );
1325 return DPERR_OUTOFMEMORY;
1328 /********************************************************************
1330 * Sends a message between the application and the lobby client.
1331 * All messages are queued until received.
1334 static HRESULT WINAPI IDirectPlayLobbyAImpl_SendLobbyMessage
1335 ( LPDIRECTPLAYLOBBYA iface,
1342 return DPERR_OUTOFMEMORY;
1345 static HRESULT WINAPI IDirectPlayLobbyWImpl_SendLobbyMessage
1346 ( LPDIRECTPLAYLOBBY iface,
1353 return DPERR_OUTOFMEMORY;
1356 /********************************************************************
1358 * Modifies the DPLCONNECTION structure to contain all information
1359 * needed to start and connect an application.
1362 static HRESULT WINAPI IDirectPlayLobbyWImpl_SetConnectionSettings
1363 ( LPDIRECTPLAYLOBBY iface,
1366 LPDPLCONNECTION lpConn )
1368 ICOM_THIS(IDirectPlayLobbyWImpl,iface);
1371 TRACE("(%p)->(0x%08lx,0x%08lx,%p)\n", This, dwFlags, dwAppID, lpConn );
1373 EnterCriticalSection( &This->unk->DPL_lock );
1375 hr = DPLAYX_SetConnectionSettingsW( dwFlags, dwAppID, lpConn );
1377 /* FIXME: Don't think that this is supposed to fail, but the docuementation
1378 is somewhat sketchy. I'll try creating a lobby application
1380 if( hr == DPERR_NOTLOBBIED )
1382 FIXME( "Unlobbied app setting connections. Is this correct behavior?\n" );
1385 dwAppID = GetCurrentProcessId();
1387 DPLAYX_CreateLobbyApplication( dwAppID );
1388 hr = DPLAYX_SetConnectionSettingsW( dwFlags, dwAppID, lpConn );
1391 LeaveCriticalSection( &This->unk->DPL_lock );
1396 static HRESULT WINAPI IDirectPlayLobbyAImpl_SetConnectionSettings
1397 ( LPDIRECTPLAYLOBBYA iface,
1400 LPDPLCONNECTION lpConn )
1402 ICOM_THIS(IDirectPlayLobbyAImpl,iface);
1405 TRACE("(%p)->(0x%08lx,0x%08lx,%p)\n", This, dwFlags, dwAppID, lpConn );
1407 EnterCriticalSection( &This->unk->DPL_lock );
1409 hr = DPLAYX_SetConnectionSettingsA( dwFlags, dwAppID, lpConn );
1411 /* FIXME: Don't think that this is supposed to fail, but the docuementation
1412 is somewhat sketchy. I'll try creating a lobby application
1414 if( hr == DPERR_NOTLOBBIED )
1416 FIXME( "Unlobbied app setting connections. Is this correct behavior?\n" );
1417 dwAppID = GetCurrentProcessId();
1418 DPLAYX_CreateLobbyApplication( dwAppID );
1419 hr = DPLAYX_SetConnectionSettingsA( dwFlags, dwAppID, lpConn );
1422 LeaveCriticalSection( &This->unk->DPL_lock );
1427 /********************************************************************
1429 * Registers an event that will be set when a lobby message is received.
1432 static HRESULT WINAPI IDirectPlayLobbyAImpl_SetLobbyMessageEvent
1433 ( LPDIRECTPLAYLOBBYA iface,
1436 HANDLE hReceiveEvent )
1439 return DPERR_OUTOFMEMORY;
1442 static HRESULT WINAPI IDirectPlayLobbyWImpl_SetLobbyMessageEvent
1443 ( LPDIRECTPLAYLOBBY iface,
1446 HANDLE hReceiveEvent )
1449 return DPERR_OUTOFMEMORY;
1454 static HRESULT WINAPI IDirectPlayLobby2WImpl_CreateCompoundAddress
1455 ( LPDIRECTPLAYLOBBY2 iface,
1456 LPCDPCOMPOUNDADDRESSELEMENT lpElements,
1457 DWORD dwElementCount,
1459 LPDWORD lpdwAddressSize )
1461 return DPL_CreateCompoundAddress( lpElements, dwElementCount, lpAddress, lpdwAddressSize, FALSE );
1464 static HRESULT WINAPI IDirectPlayLobby2AImpl_CreateCompoundAddress
1465 ( LPDIRECTPLAYLOBBY2A iface,
1466 LPCDPCOMPOUNDADDRESSELEMENT lpElements,
1467 DWORD dwElementCount,
1469 LPDWORD lpdwAddressSize )
1471 return DPL_CreateCompoundAddress( lpElements, dwElementCount, lpAddress, lpdwAddressSize, TRUE );
1474 HRESULT DPL_CreateCompoundAddress
1475 ( LPCDPCOMPOUNDADDRESSELEMENT lpElements,
1476 DWORD dwElementCount,
1478 LPDWORD lpdwAddressSize,
1479 BOOL bAnsiInterface )
1481 DWORD dwSizeRequired = 0;
1483 LPCDPCOMPOUNDADDRESSELEMENT lpOrigElements = lpElements;
1485 TRACE("(%p,0x%08lx,%p,%p)\n", lpElements, dwElementCount, lpAddress, lpdwAddressSize );
1487 /* Parameter check */
1488 if( ( lpElements == NULL ) ||
1489 ( dwElementCount == 0 ) /* FIXME: Not sure if this is a failure case */
1492 return DPERR_INVALIDPARAMS;
1495 /* Add the total size chunk */
1496 dwSizeRequired += sizeof( DPADDRESS ) + sizeof( DWORD );
1498 /* Calculate the size of the buffer required */
1499 for ( dwElements = dwElementCount; dwElements > 0; --dwElements, ++lpElements )
1501 if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ServiceProvider ) ) ||
1502 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_LobbyProvider ) )
1505 dwSizeRequired += sizeof( DPADDRESS ) + sizeof( GUID );
1507 else if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_Phone ) ) ||
1508 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_Modem ) ) ||
1509 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INet ) )
1512 if( !bAnsiInterface )
1514 ERR( "Ansi GUIDs used for unicode interface\n" );
1515 return DPERR_INVALIDFLAGS;
1518 dwSizeRequired += sizeof( DPADDRESS ) + lpElements->dwDataSize;
1520 else if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_PhoneW ) ) ||
1521 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ModemW ) ) ||
1522 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INetW ) )
1525 if( bAnsiInterface )
1527 ERR( "Unicode GUIDs used for ansi interface\n" );
1528 return DPERR_INVALIDFLAGS;
1531 FIXME( "Right size for unicode interface?\n" );
1532 dwSizeRequired += sizeof( DPADDRESS ) + lpElements->dwDataSize * sizeof( WCHAR );
1534 else if ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INetPort ) )
1536 dwSizeRequired += sizeof( DPADDRESS ) + sizeof( WORD );
1538 else if ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ComPort ) )
1540 FIXME( "Right size for unicode interface?\n" );
1541 dwSizeRequired += sizeof( DPADDRESS ) + sizeof( DPCOMPORTADDRESS ); /* FIXME: Right size? */
1545 ERR( "Unknown GUID %s\n", debugstr_guid(&lpElements->guidDataType) );
1546 return DPERR_INVALIDFLAGS;
1550 /* The user wants to know how big a buffer to allocate for us */
1551 if( ( lpAddress == NULL ) ||
1552 ( *lpdwAddressSize < dwSizeRequired )
1555 *lpdwAddressSize = dwSizeRequired;
1556 return DPERR_BUFFERTOOSMALL;
1559 /* Add the total size chunk */
1561 LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
1563 CopyMemory( &lpdpAddress->guidDataType, &DPAID_TotalSize, sizeof( GUID ) );
1564 lpdpAddress->dwDataSize = sizeof( DWORD );
1565 lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
1567 *(LPDWORD)lpAddress = dwSizeRequired;
1568 lpAddress = (char *) lpAddress + sizeof( DWORD );
1571 /* Calculate the size of the buffer required */
1572 for( dwElements = dwElementCount, lpElements = lpOrigElements;
1574 --dwElements, ++lpElements )
1576 if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ServiceProvider ) ) ||
1577 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_LobbyProvider ) )
1580 LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
1582 CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
1584 lpdpAddress->dwDataSize = sizeof( GUID );
1585 lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
1587 CopyMemory( lpAddress, lpElements->lpData, sizeof( GUID ) );
1588 lpAddress = (char *) lpAddress + sizeof( GUID );
1590 else if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_Phone ) ) ||
1591 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_Modem ) ) ||
1592 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INet ) )
1595 LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
1597 CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
1599 lpdpAddress->dwDataSize = lpElements->dwDataSize;
1600 lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
1602 lstrcpynA( (LPSTR)lpAddress,
1603 (LPCSTR)lpElements->lpData,
1604 lpElements->dwDataSize );
1605 lpAddress = (char *) lpAddress + lpElements->dwDataSize;
1607 else if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_PhoneW ) ) ||
1608 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ModemW ) ) ||
1609 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INetW ) )
1612 LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
1614 CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
1616 lpdpAddress->dwDataSize = lpElements->dwDataSize;
1617 lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
1619 lstrcpynW( (LPWSTR)lpAddress,
1620 (LPCWSTR)lpElements->lpData,
1621 lpElements->dwDataSize );
1622 lpAddress = (char *) lpAddress + lpElements->dwDataSize * sizeof( WCHAR );
1624 else if ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INetPort ) )
1626 LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
1628 CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
1630 lpdpAddress->dwDataSize = lpElements->dwDataSize;
1631 lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
1633 *((LPWORD)lpAddress) = *((LPWORD)lpElements->lpData);
1634 lpAddress = (char *) lpAddress + sizeof( WORD );
1636 else if ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ComPort ) )
1638 LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
1640 CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
1642 lpdpAddress->dwDataSize = lpElements->dwDataSize;
1643 lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
1645 CopyMemory( lpAddress, lpElements->lpData, sizeof( DPADDRESS ) );
1646 lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
1655 static HRESULT WINAPI IDirectPlayLobby3WImpl_ConnectEx
1656 ( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags, REFIID riid,
1657 LPVOID* lplpDP, IUnknown* pUnk )
1659 ICOM_THIS( IDirectPlayLobbyAImpl, iface );
1660 return DPL_ConnectEx( This, dwFlags, riid, lplpDP, pUnk );
1663 static HRESULT WINAPI IDirectPlayLobby3AImpl_ConnectEx
1664 ( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags, REFIID riid,
1665 LPVOID* lplpDP, IUnknown* pUnk )
1667 ICOM_THIS( IDirectPlayLobbyAImpl, iface );
1668 return DPL_ConnectEx( This, dwFlags, riid, lplpDP, pUnk );
1671 static HRESULT WINAPI IDirectPlayLobby3WImpl_RegisterApplication
1672 ( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags, LPDPAPPLICATIONDESC lpAppDesc )
1678 static HRESULT WINAPI IDirectPlayLobby3AImpl_RegisterApplication
1679 ( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags, LPDPAPPLICATIONDESC lpAppDesc )
1685 static HRESULT WINAPI IDirectPlayLobby3WImpl_UnregisterApplication
1686 ( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags, REFGUID lpAppDesc )
1692 static HRESULT WINAPI IDirectPlayLobby3AImpl_UnregisterApplication
1693 ( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags, REFGUID lpAppDesc )
1699 static HRESULT WINAPI IDirectPlayLobby3WImpl_WaitForConnectionSettings
1700 ( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags )
1703 BOOL bStartWait = (dwFlags & DPLWAIT_CANCEL) ? FALSE : TRUE;
1705 TRACE( "(%p)->(0x%08lx)\n", iface, dwFlags );
1707 if( DPLAYX_WaitForConnectionSettings( bStartWait ) )
1709 /* FIXME: What is the correct error return code? */
1710 hr = DPERR_NOTLOBBIED;
1716 static HRESULT WINAPI IDirectPlayLobby3AImpl_WaitForConnectionSettings
1717 ( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags )
1720 BOOL bStartWait = (dwFlags & DPLWAIT_CANCEL) ? FALSE : TRUE;
1722 TRACE( "(%p)->(0x%08lx)\n", iface, dwFlags );
1724 if( DPLAYX_WaitForConnectionSettings( bStartWait ) )
1726 /* FIXME: What is the correct error return code? */
1727 hr = DPERR_NOTLOBBIED;
1734 /* Virtual Table definitions for DPL{1,2,3}{A,W} */
1736 /* Note: Hack so we can reuse the old functions without compiler warnings */
1737 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1738 # define XCAST(fun) (typeof(directPlayLobbyAVT.fn##fun))
1740 # define XCAST(fun) (void*)
1743 /* Direct Play Lobby 1 (ascii) Virtual Table for methods */
1744 /* All lobby 1 methods are exactly the same except QueryInterface */
1745 static struct ICOM_VTABLE(IDirectPlayLobby) directPlayLobbyAVT =
1747 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1749 XCAST(QueryInterface)DPL_QueryInterface,
1750 XCAST(AddRef)DPL_AddRef,
1751 XCAST(Release)DPL_Release,
1753 IDirectPlayLobbyAImpl_Connect,
1754 IDirectPlayLobbyAImpl_CreateAddress,
1755 IDirectPlayLobbyAImpl_EnumAddress,
1756 IDirectPlayLobbyAImpl_EnumAddressTypes,
1757 IDirectPlayLobbyAImpl_EnumLocalApplications,
1758 IDirectPlayLobbyAImpl_GetConnectionSettings,
1759 IDirectPlayLobbyAImpl_ReceiveLobbyMessage,
1760 IDirectPlayLobbyAImpl_RunApplication,
1761 IDirectPlayLobbyAImpl_SendLobbyMessage,
1762 IDirectPlayLobbyAImpl_SetConnectionSettings,
1763 IDirectPlayLobbyAImpl_SetLobbyMessageEvent
1768 /* Note: Hack so we can reuse the old functions without compiler warnings */
1769 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1770 # define XCAST(fun) (typeof(directPlayLobbyWVT.fn##fun))
1772 # define XCAST(fun) (void*)
1775 /* Direct Play Lobby 1 (unicode) Virtual Table for methods */
1776 static ICOM_VTABLE(IDirectPlayLobby) directPlayLobbyWVT =
1778 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1780 XCAST(QueryInterface)DPL_QueryInterface,
1781 XCAST(AddRef)DPL_AddRef,
1782 XCAST(Release)DPL_Release,
1784 IDirectPlayLobbyWImpl_Connect,
1785 IDirectPlayLobbyWImpl_CreateAddress,
1786 IDirectPlayLobbyWImpl_EnumAddress,
1787 IDirectPlayLobbyWImpl_EnumAddressTypes,
1788 IDirectPlayLobbyWImpl_EnumLocalApplications,
1789 IDirectPlayLobbyWImpl_GetConnectionSettings,
1790 IDirectPlayLobbyWImpl_ReceiveLobbyMessage,
1791 IDirectPlayLobbyWImpl_RunApplication,
1792 IDirectPlayLobbyWImpl_SendLobbyMessage,
1793 IDirectPlayLobbyWImpl_SetConnectionSettings,
1794 IDirectPlayLobbyWImpl_SetLobbyMessageEvent
1798 /* Note: Hack so we can reuse the old functions without compiler warnings */
1799 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1800 # define XCAST(fun) (typeof(directPlayLobby2AVT.fn##fun))
1802 # define XCAST(fun) (void*)
1805 /* Direct Play Lobby 2 (ascii) Virtual Table for methods */
1806 static ICOM_VTABLE(IDirectPlayLobby2) directPlayLobby2AVT =
1808 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1810 XCAST(QueryInterface)DPL_QueryInterface,
1811 XCAST(AddRef)DPL_AddRef,
1812 XCAST(Release)DPL_Release,
1814 XCAST(Connect)IDirectPlayLobbyAImpl_Connect,
1815 XCAST(CreateAddress)IDirectPlayLobbyAImpl_CreateAddress,
1816 XCAST(EnumAddress)IDirectPlayLobbyAImpl_EnumAddress,
1817 XCAST(EnumAddressTypes)IDirectPlayLobbyAImpl_EnumAddressTypes,
1818 XCAST(EnumLocalApplications)IDirectPlayLobbyAImpl_EnumLocalApplications,
1819 XCAST(GetConnectionSettings)IDirectPlayLobbyAImpl_GetConnectionSettings,
1820 XCAST(ReceiveLobbyMessage)IDirectPlayLobbyAImpl_ReceiveLobbyMessage,
1821 XCAST(RunApplication)IDirectPlayLobbyAImpl_RunApplication,
1822 XCAST(SendLobbyMessage)IDirectPlayLobbyAImpl_SendLobbyMessage,
1823 XCAST(SetConnectionSettings)IDirectPlayLobbyAImpl_SetConnectionSettings,
1824 XCAST(SetLobbyMessageEvent)IDirectPlayLobbyAImpl_SetLobbyMessageEvent,
1826 IDirectPlayLobby2AImpl_CreateCompoundAddress
1830 /* Note: Hack so we can reuse the old functions without compiler warnings */
1831 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1832 # define XCAST(fun) (typeof(directPlayLobby2AVT.fn##fun))
1834 # define XCAST(fun) (void*)
1837 /* Direct Play Lobby 2 (unicode) Virtual Table for methods */
1838 static ICOM_VTABLE(IDirectPlayLobby2) directPlayLobby2WVT =
1840 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1842 XCAST(QueryInterface)DPL_QueryInterface,
1843 XCAST(AddRef)DPL_AddRef,
1844 XCAST(Release)DPL_Release,
1846 XCAST(Connect)IDirectPlayLobbyWImpl_Connect,
1847 XCAST(CreateAddress)IDirectPlayLobbyWImpl_CreateAddress,
1848 XCAST(EnumAddress)IDirectPlayLobbyWImpl_EnumAddress,
1849 XCAST(EnumAddressTypes)IDirectPlayLobbyWImpl_EnumAddressTypes,
1850 XCAST(EnumLocalApplications)IDirectPlayLobbyWImpl_EnumLocalApplications,
1851 XCAST(GetConnectionSettings)IDirectPlayLobbyWImpl_GetConnectionSettings,
1852 XCAST(ReceiveLobbyMessage)IDirectPlayLobbyWImpl_ReceiveLobbyMessage,
1853 XCAST(RunApplication)IDirectPlayLobbyWImpl_RunApplication,
1854 XCAST(SendLobbyMessage)IDirectPlayLobbyWImpl_SendLobbyMessage,
1855 XCAST(SetConnectionSettings)IDirectPlayLobbyWImpl_SetConnectionSettings,
1856 XCAST(SetLobbyMessageEvent)IDirectPlayLobbyWImpl_SetLobbyMessageEvent,
1858 IDirectPlayLobby2WImpl_CreateCompoundAddress
1862 /* Direct Play Lobby 3 (ascii) Virtual Table for methods */
1864 /* Note: Hack so we can reuse the old functions without compiler warnings */
1865 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1866 # define XCAST(fun) (typeof(directPlayLobby3AVT.fn##fun))
1868 # define XCAST(fun) (void*)
1871 static ICOM_VTABLE(IDirectPlayLobby3) directPlayLobby3AVT =
1873 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1874 XCAST(QueryInterface)DPL_QueryInterface,
1875 XCAST(AddRef)DPL_AddRef,
1876 XCAST(Release)DPL_Release,
1878 XCAST(Connect)IDirectPlayLobbyAImpl_Connect,
1879 XCAST(CreateAddress)IDirectPlayLobbyAImpl_CreateAddress,
1880 XCAST(EnumAddress)IDirectPlayLobbyAImpl_EnumAddress,
1881 XCAST(EnumAddressTypes)IDirectPlayLobbyAImpl_EnumAddressTypes,
1882 XCAST(EnumLocalApplications)IDirectPlayLobbyAImpl_EnumLocalApplications,
1883 XCAST(GetConnectionSettings)IDirectPlayLobbyAImpl_GetConnectionSettings,
1884 XCAST(ReceiveLobbyMessage)IDirectPlayLobbyAImpl_ReceiveLobbyMessage,
1885 XCAST(RunApplication)IDirectPlayLobbyAImpl_RunApplication,
1886 XCAST(SendLobbyMessage)IDirectPlayLobbyAImpl_SendLobbyMessage,
1887 XCAST(SetConnectionSettings)IDirectPlayLobbyAImpl_SetConnectionSettings,
1888 XCAST(SetLobbyMessageEvent)IDirectPlayLobbyAImpl_SetLobbyMessageEvent,
1890 XCAST(CreateCompoundAddress)IDirectPlayLobby2AImpl_CreateCompoundAddress,
1892 IDirectPlayLobby3AImpl_ConnectEx,
1893 IDirectPlayLobby3AImpl_RegisterApplication,
1894 IDirectPlayLobby3AImpl_UnregisterApplication,
1895 IDirectPlayLobby3AImpl_WaitForConnectionSettings
1899 /* Direct Play Lobby 3 (unicode) Virtual Table for methods */
1901 /* Note: Hack so we can reuse the old functions without compiler warnings */
1902 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1903 # define XCAST(fun) (typeof(directPlayLobby3WVT.fn##fun))
1905 # define XCAST(fun) (void*)
1908 static ICOM_VTABLE(IDirectPlayLobby3) directPlayLobby3WVT =
1910 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1911 XCAST(QueryInterface)DPL_QueryInterface,
1912 XCAST(AddRef)DPL_AddRef,
1913 XCAST(Release)DPL_Release,
1915 XCAST(Connect)IDirectPlayLobbyWImpl_Connect,
1916 XCAST(CreateAddress)IDirectPlayLobbyWImpl_CreateAddress,
1917 XCAST(EnumAddress)IDirectPlayLobbyWImpl_EnumAddress,
1918 XCAST(EnumAddressTypes)IDirectPlayLobbyWImpl_EnumAddressTypes,
1919 XCAST(EnumLocalApplications)IDirectPlayLobbyWImpl_EnumLocalApplications,
1920 XCAST(GetConnectionSettings)IDirectPlayLobbyWImpl_GetConnectionSettings,
1921 XCAST(ReceiveLobbyMessage)IDirectPlayLobbyWImpl_ReceiveLobbyMessage,
1922 XCAST(RunApplication)IDirectPlayLobbyWImpl_RunApplication,
1923 XCAST(SendLobbyMessage)IDirectPlayLobbyWImpl_SendLobbyMessage,
1924 XCAST(SetConnectionSettings)IDirectPlayLobbyWImpl_SetConnectionSettings,
1925 XCAST(SetLobbyMessageEvent)IDirectPlayLobbyWImpl_SetLobbyMessageEvent,
1927 XCAST(CreateCompoundAddress)IDirectPlayLobby2WImpl_CreateCompoundAddress,
1929 IDirectPlayLobby3WImpl_ConnectEx,
1930 IDirectPlayLobby3WImpl_RegisterApplication,
1931 IDirectPlayLobby3WImpl_UnregisterApplication,
1932 IDirectPlayLobby3WImpl_WaitForConnectionSettings
1937 /*********************************************************
1939 * Direct Play Lobby Interface Implementation
1941 *********************************************************/
1943 /***************************************************************************
1944 * DirectPlayLobbyCreateA (DPLAYX.4)
1947 HRESULT WINAPI DirectPlayLobbyCreateA( LPGUID lpGUIDDSP,
1948 LPDIRECTPLAYLOBBYA *lplpDPL,
1953 TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08lx\n",
1954 lpGUIDDSP,lplpDPL,lpUnk,lpData,dwDataSize);
1956 /* Parameter Check: lpGUIDSP, lpUnk & lpData must be NULL. dwDataSize must
1957 * equal 0. These fields are mostly for future expansion.
1959 if ( lpGUIDDSP || lpData || dwDataSize )
1962 return DPERR_INVALIDPARAMS;
1968 ERR("Bad parameters!\n" );
1969 return CLASS_E_NOAGGREGATION;
1972 return DPL_CreateInterface( &IID_IDirectPlayLobbyA, (void**)lplpDPL );
1975 /***************************************************************************
1976 * DirectPlayLobbyCreateW (DPLAYX.5)
1979 HRESULT WINAPI DirectPlayLobbyCreateW( LPGUID lpGUIDDSP,
1980 LPDIRECTPLAYLOBBY *lplpDPL,
1985 TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08lx\n",
1986 lpGUIDDSP,lplpDPL,lpUnk,lpData,dwDataSize);
1988 /* Parameter Check: lpGUIDSP, lpUnk & lpData must be NULL. dwDataSize must
1989 * equal 0. These fields are mostly for future expansion.
1991 if ( lpGUIDDSP || lpData || dwDataSize )
1994 ERR("Bad parameters!\n" );
1995 return DPERR_INVALIDPARAMS;
2001 ERR("Bad parameters!\n" );
2002 return CLASS_E_NOAGGREGATION;
2005 return DPL_CreateInterface( &IID_IDirectPlayLobby, (void**)lplpDPL );