1 /* Direct Play Lobby 2 & 3 Implementation
3 * Copyright 1998,1999,2000 - Peter Hunnisett
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #define NONAMELESSUNION
23 #define NONAMELESSSTRUCT
29 #include "wine/debug.h"
31 #include "dplayx_global.h"
32 #include "dplayx_messages.h"
33 #include "dplayx_queue.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(dplay);
39 /*****************************************************************************
40 * Predeclare the interface implementation structures
42 typedef struct IDirectPlayLobbyImpl IDirectPlayLobbyAImpl;
43 typedef struct IDirectPlayLobbyImpl IDirectPlayLobbyWImpl;
44 typedef struct IDirectPlayLobby2Impl IDirectPlayLobby2AImpl;
45 typedef struct IDirectPlayLobby2Impl IDirectPlayLobby2WImpl;
46 typedef struct IDirectPlayLobby3Impl IDirectPlayLobby3AImpl;
47 typedef struct IDirectPlayLobby3Impl IDirectPlayLobby3WImpl;
49 /* Forward declarations for this module helper methods */
50 HRESULT DPL_CreateCompoundAddress ( LPCDPCOMPOUNDADDRESSELEMENT lpElements, DWORD dwElementCount,
51 LPVOID lpAddress, LPDWORD lpdwAddressSize, BOOL bAnsiInterface );
53 HRESULT DPL_CreateAddress( REFGUID guidSP, REFGUID guidDataType, LPCVOID lpData, DWORD dwDataSize,
54 LPVOID lpAddress, LPDWORD lpdwAddressSize, BOOL bAnsiInterface );
58 extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress,
59 DWORD dwAddressSize, LPVOID lpContext );
61 static HRESULT WINAPI DPL_ConnectEx( IDirectPlayLobbyAImpl* This,
62 DWORD dwFlags, REFIID riid,
63 LPVOID* lplpDP, IUnknown* pUnk );
65 BOOL DPL_CreateAndSetLobbyHandles( DWORD dwDestProcessId, HANDLE hDestProcess,
66 LPHANDLE lphStart, LPHANDLE lphDeath,
70 /*****************************************************************************
71 * IDirectPlayLobby {1,2,3} implementation structure
73 * The philosophy behind this extra pointer derefernce is that I wanted to
74 * have the same structure for all types of objects without having to do
75 * alot of casting. I also only wanted to implement an interface in the
76 * object it was "released" with IUnknown interface being implemented in the 1 version.
77 * Of course, with these new interfaces comes the data required to keep the state required
78 * by these interfaces. So, basically, the pointers contain the data associated with
79 * a release. If you use the data associated with release 3 in a release 2 object, you'll
80 * get a run time trap, as that won't have any data.
85 DPQ_ENTRY( DPLMSG ) msgs; /* Link to next queued message */
87 typedef struct DPLMSG* LPDPLMSG;
89 typedef struct tagDirectPlayLobbyIUnknownData
92 CRITICAL_SECTION DPL_lock;
93 } DirectPlayLobbyIUnknownData;
95 typedef struct tagDirectPlayLobbyData
97 HKEY hkCallbackKeyHack;
99 DPQ_HEAD( DPLMSG ) msgs; /* List of messages received */
100 } DirectPlayLobbyData;
102 typedef struct tagDirectPlayLobby2Data
105 } DirectPlayLobby2Data;
107 typedef struct tagDirectPlayLobby3Data
110 } DirectPlayLobby3Data;
112 #define DPL_IMPL_FIELDS \
113 ULONG ulInterfaceRef; \
114 DirectPlayLobbyIUnknownData* unk; \
115 DirectPlayLobbyData* dpl; \
116 DirectPlayLobby2Data* dpl2; \
117 DirectPlayLobby3Data* dpl3;
119 struct IDirectPlayLobbyImpl
121 IDirectPlayLobbyVtbl *lpVtbl;
125 struct IDirectPlayLobby2Impl
127 IDirectPlayLobby2Vtbl *lpVtbl;
131 struct IDirectPlayLobby3Impl
133 IDirectPlayLobby3Vtbl *lpVtbl;
138 /* Forward declarations of virtual tables */
139 static IDirectPlayLobbyVtbl directPlayLobbyWVT;
140 static IDirectPlayLobby2Vtbl directPlayLobby2WVT;
141 static IDirectPlayLobby3Vtbl directPlayLobby3WVT;
143 static IDirectPlayLobbyVtbl directPlayLobbyAVT;
144 static IDirectPlayLobby2Vtbl directPlayLobby2AVT;
145 static IDirectPlayLobby3Vtbl directPlayLobby3AVT;
150 static BOOL DPL_CreateIUnknown( LPVOID lpDPL )
152 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)lpDPL;
154 This->unk = (DirectPlayLobbyIUnknownData*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
155 sizeof( *(This->unk) ) );
156 if ( This->unk == NULL )
161 InitializeCriticalSection( &This->unk->DPL_lock );
166 static BOOL DPL_DestroyIUnknown( LPVOID lpDPL )
168 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)lpDPL;
170 DeleteCriticalSection( &This->unk->DPL_lock );
171 HeapFree( GetProcessHeap(), 0, This->unk );
176 static BOOL DPL_CreateLobby1( LPVOID lpDPL )
178 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)lpDPL;
180 This->dpl = (DirectPlayLobbyData*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
181 sizeof( *(This->dpl) ) );
182 if ( This->dpl == NULL )
187 DPQ_INIT( This->dpl->msgs );
192 static BOOL DPL_DestroyLobby1( LPVOID lpDPL )
194 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)lpDPL;
196 if( This->dpl->dwMsgThread )
198 FIXME( "Should kill the msg thread\n" );
201 DPQ_DELETEQ( This->dpl->msgs, msgs, LPDPLMSG, cbDeleteElemFromHeap );
203 /* Delete the contents */
204 HeapFree( GetProcessHeap(), 0, This->dpl );
209 static BOOL DPL_CreateLobby2( LPVOID lpDPL )
211 IDirectPlayLobby2AImpl *This = (IDirectPlayLobby2AImpl *)lpDPL;
213 This->dpl2 = (DirectPlayLobby2Data*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
214 sizeof( *(This->dpl2) ) );
215 if ( This->dpl2 == NULL )
223 static BOOL DPL_DestroyLobby2( LPVOID lpDPL )
225 IDirectPlayLobby2AImpl *This = (IDirectPlayLobby2AImpl *)lpDPL;
227 HeapFree( GetProcessHeap(), 0, This->dpl2 );
232 static BOOL DPL_CreateLobby3( LPVOID lpDPL )
234 IDirectPlayLobby3AImpl *This = (IDirectPlayLobby3AImpl *)lpDPL;
236 This->dpl3 = (DirectPlayLobby3Data*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
237 sizeof( *(This->dpl3) ) );
238 if ( This->dpl3 == NULL )
246 static BOOL DPL_DestroyLobby3( LPVOID lpDPL )
248 IDirectPlayLobby3AImpl *This = (IDirectPlayLobby3AImpl *)lpDPL;
250 HeapFree( GetProcessHeap(), 0, This->dpl3 );
256 /* The COM interface for upversioning an interface
257 * We've been given a GUID (riid) and we need to replace the present
258 * interface with that of the requested interface.
260 * Snip from some Microsoft document:
261 * There are four requirements for implementations of QueryInterface (In these
262 * cases, "must succeed" means "must succeed barring catastrophic failure."):
264 * * The set of interfaces accessible on an object through
265 * IUnknown::QueryInterface must be static, not dynamic. This means that
266 * if a call to QueryInterface for a pointer to a specified interface
267 * succeeds the first time, it must succeed again, and if it fails the
268 * first time, it must fail on all subsequent queries.
269 * * It must be symmetric ~W if a client holds a pointer to an interface on
270 * an object, and queries for that interface, the call must succeed.
271 * * It must be reflexive ~W if a client holding a pointer to one interface
272 * queries successfully for another, a query through the obtained pointer
273 * for the first interface must succeed.
274 * * It must be transitive ~W if a client holding a pointer to one interface
275 * queries successfully for a second, and through that pointer queries
276 * successfully for a third interface, a query for the first interface
277 * through the pointer for the third interface must succeed.
280 HRESULT DPL_CreateInterface
281 ( REFIID riid, LPVOID* ppvObj )
283 TRACE( " for %s\n", debugstr_guid( riid ) );
285 *ppvObj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
286 sizeof( IDirectPlayLobbyWImpl ) );
288 if( *ppvObj == NULL )
290 return DPERR_OUTOFMEMORY;
293 if( IsEqualGUID( &IID_IDirectPlayLobby, riid ) )
295 IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)*ppvObj;
296 This->lpVtbl = &directPlayLobbyWVT;
298 else if( IsEqualGUID( &IID_IDirectPlayLobbyA, riid ) )
300 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)*ppvObj;
301 This->lpVtbl = &directPlayLobbyAVT;
303 else if( IsEqualGUID( &IID_IDirectPlayLobby2, riid ) )
305 IDirectPlayLobby2WImpl *This = (IDirectPlayLobby2WImpl *)*ppvObj;
306 This->lpVtbl = &directPlayLobby2WVT;
308 else if( IsEqualGUID( &IID_IDirectPlayLobby2A, riid ) )
310 IDirectPlayLobby2AImpl *This = (IDirectPlayLobby2AImpl *)*ppvObj;
311 This->lpVtbl = &directPlayLobby2AVT;
313 else if( IsEqualGUID( &IID_IDirectPlayLobby3, riid ) )
315 IDirectPlayLobby3WImpl *This = (IDirectPlayLobby3WImpl *)*ppvObj;
316 This->lpVtbl = &directPlayLobby3WVT;
318 else if( IsEqualGUID( &IID_IDirectPlayLobby3A, riid ) )
320 IDirectPlayLobby3AImpl *This = (IDirectPlayLobby3AImpl *)*ppvObj;
321 This->lpVtbl = &directPlayLobby3AVT;
325 /* Unsupported interface */
326 HeapFree( GetProcessHeap(), 0, *ppvObj );
329 return E_NOINTERFACE;
333 if ( DPL_CreateIUnknown( *ppvObj ) &&
334 DPL_CreateLobby1( *ppvObj ) &&
335 DPL_CreateLobby2( *ppvObj ) &&
336 DPL_CreateLobby3( *ppvObj )
339 IDirectPlayLobby_AddRef( (LPDIRECTPLAYLOBBY)*ppvObj );
343 /* Initialize failed, destroy it */
344 DPL_DestroyLobby3( *ppvObj );
345 DPL_DestroyLobby2( *ppvObj );
346 DPL_DestroyLobby1( *ppvObj );
347 DPL_DestroyIUnknown( *ppvObj );
348 HeapFree( GetProcessHeap(), 0, *ppvObj );
351 return DPERR_NOMEMORY;
354 static HRESULT WINAPI DPL_QueryInterface
355 ( LPDIRECTPLAYLOBBYA iface,
359 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface;
360 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid( riid ), ppvObj );
362 *ppvObj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
365 if( *ppvObj == NULL )
367 return DPERR_OUTOFMEMORY;
370 CopyMemory( *ppvObj, This, sizeof( *This ) );
371 (*(IDirectPlayLobbyAImpl**)ppvObj)->ulInterfaceRef = 0;
373 if( IsEqualGUID( &IID_IDirectPlayLobby, riid ) )
375 IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)*ppvObj;
376 This->lpVtbl = &directPlayLobbyWVT;
378 else if( IsEqualGUID( &IID_IDirectPlayLobbyA, riid ) )
380 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)*ppvObj;
381 This->lpVtbl = &directPlayLobbyAVT;
383 else if( IsEqualGUID( &IID_IDirectPlayLobby2, riid ) )
385 IDirectPlayLobby2WImpl *This = (IDirectPlayLobby2WImpl *)*ppvObj;
386 This->lpVtbl = &directPlayLobby2WVT;
388 else if( IsEqualGUID( &IID_IDirectPlayLobby2A, riid ) )
390 IDirectPlayLobby2AImpl *This = (IDirectPlayLobby2AImpl *)*ppvObj;
391 This->lpVtbl = &directPlayLobby2AVT;
393 else if( IsEqualGUID( &IID_IDirectPlayLobby3, riid ) )
395 IDirectPlayLobby3WImpl *This = (IDirectPlayLobby3WImpl *)*ppvObj;
396 This->lpVtbl = &directPlayLobby3WVT;
398 else if( IsEqualGUID( &IID_IDirectPlayLobby3A, riid ) )
400 IDirectPlayLobby3AImpl *This = (IDirectPlayLobby3AImpl *)*ppvObj;
401 This->lpVtbl = &directPlayLobby3AVT;
405 /* Unsupported interface */
406 HeapFree( GetProcessHeap(), 0, *ppvObj );
409 return E_NOINTERFACE;
412 IDirectPlayLobby_AddRef( (LPDIRECTPLAYLOBBY)*ppvObj );
418 * Simple procedure. Just increment the reference count to this
419 * structure and return the new reference count.
421 static ULONG WINAPI DPL_AddRef
422 ( LPDIRECTPLAYLOBBY iface )
424 ULONG ulInterfaceRefCount, ulObjRefCount;
425 IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)iface;
427 ulObjRefCount = InterlockedIncrement( &This->unk->ulObjRef );
428 ulInterfaceRefCount = InterlockedIncrement( &This->ulInterfaceRef );
430 TRACE( "ref count incremented to %lu:%lu for %p\n",
431 ulInterfaceRefCount, ulObjRefCount, This );
433 return ulObjRefCount;
437 * Simple COM procedure. Decrease the reference count to this object.
438 * If the object no longer has any reference counts, free up the associated
441 static ULONG WINAPI DPL_Release
442 ( LPDIRECTPLAYLOBBYA iface )
444 ULONG ulInterfaceRefCount, ulObjRefCount;
445 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface;
447 ulObjRefCount = InterlockedDecrement( &This->unk->ulObjRef );
448 ulInterfaceRefCount = InterlockedDecrement( &This->ulInterfaceRef );
450 TRACE( "ref count decremented to %lu:%lu for %p\n",
451 ulInterfaceRefCount, ulObjRefCount, This );
453 /* Deallocate if this is the last reference to the object */
454 if( ulObjRefCount == 0 )
456 DPL_DestroyLobby3( This );
457 DPL_DestroyLobby2( This );
458 DPL_DestroyLobby1( This );
459 DPL_DestroyIUnknown( This );
462 if( ulInterfaceRefCount == 0 )
464 HeapFree( GetProcessHeap(), 0, This );
467 return ulInterfaceRefCount;
471 /********************************************************************
473 * Connects an application to the session specified by the DPLCONNECTION
474 * structure currently stored with the DirectPlayLobby object.
476 * Returns a IDirectPlay interface.
479 static HRESULT WINAPI DPL_ConnectEx
480 ( IDirectPlayLobbyAImpl* This,
487 DWORD dwOpenFlags = 0;
488 DWORD dwConnSize = 0;
489 LPDPLCONNECTION lpConn;
491 FIXME("(%p)->(0x%08lx,%p,%p): semi stub\n", This, dwFlags, lplpDP, pUnk );
495 return DPERR_INVALIDPARAMS;
498 /* Backwards compatibility */
501 dwFlags = DPCONNECT_RETURNSTATUS;
504 /* Create the DirectPlay interface */
505 if( ( hr = DP_CreateInterface( riid, lplpDP ) ) != DP_OK )
507 ERR( "error creating interface for %s:%s.\n",
508 debugstr_guid( riid ), DPLAYX_HresultToString( hr ) );
512 /* FIXME: Is it safe/correct to use appID of 0? */
513 hr = IDirectPlayLobby_GetConnectionSettings( (LPDIRECTPLAYLOBBY)This,
514 0, NULL, &dwConnSize );
515 if( hr != DPERR_BUFFERTOOSMALL )
520 lpConn = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwConnSize );
524 return DPERR_NOMEMORY;
527 /* FIXME: Is it safe/correct to use appID of 0? */
528 hr = IDirectPlayLobby_GetConnectionSettings( (LPDIRECTPLAYLOBBY)This,
529 0, lpConn, &dwConnSize );
532 HeapFree( GetProcessHeap(), 0, lpConn );
537 /* - Need to call IDirectPlay::EnumConnections with the service provider to get that good information
538 * - Need to call CreateAddress to create the lpConnection param for IDirectPlay::InitializeConnection
539 * - Call IDirectPlay::InitializeConnection
542 /* Now initialize the Service Provider */
543 hr = IDirectPlayX_InitializeConnection( (*(LPDIRECTPLAY2*)lplpDP),
547 /* Setup flags to pass into DirectPlay::Open */
548 if( dwFlags & DPCONNECT_RETURNSTATUS )
550 dwOpenFlags |= DPOPEN_RETURNSTATUS;
552 dwOpenFlags |= lpConn->dwFlags;
554 hr = IDirectPlayX_Open( (*(LPDIRECTPLAY2*)lplpDP), lpConn->lpSessionDesc,
557 HeapFree( GetProcessHeap(), 0, lpConn );
562 static HRESULT WINAPI IDirectPlayLobbyAImpl_Connect
563 ( LPDIRECTPLAYLOBBYA iface,
565 LPDIRECTPLAY2A* lplpDP,
568 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface;
569 return DPL_ConnectEx( This, dwFlags, &IID_IDirectPlay2A,
570 (LPVOID)lplpDP, pUnk );
573 static HRESULT WINAPI IDirectPlayLobbyWImpl_Connect
574 ( LPDIRECTPLAYLOBBY iface,
576 LPDIRECTPLAY2* lplpDP,
579 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface; /* Yes cast to A */
580 return DPL_ConnectEx( This, dwFlags, &IID_IDirectPlay2,
581 (LPVOID)lplpDP, pUnk );
584 /********************************************************************
586 * Creates a DirectPlay Address, given a service provider-specific network
588 * Returns an address contains the globally unique identifier
589 * (GUID) of the service provider and data that the service provider can
590 * interpret as a network address.
592 * NOTE: It appears that this method is supposed to be really really stupid
593 * with no error checking on the contents.
595 static HRESULT WINAPI IDirectPlayLobbyAImpl_CreateAddress
596 ( LPDIRECTPLAYLOBBYA iface,
598 REFGUID guidDataType,
602 LPDWORD lpdwAddressSize )
604 return DPL_CreateAddress( guidSP, guidDataType, lpData, dwDataSize,
605 lpAddress, lpdwAddressSize, TRUE );
608 static HRESULT WINAPI IDirectPlayLobbyWImpl_CreateAddress
609 ( LPDIRECTPLAYLOBBY iface,
611 REFGUID guidDataType,
615 LPDWORD lpdwAddressSize )
617 return DPL_CreateAddress( guidSP, guidDataType, lpData, dwDataSize,
618 lpAddress, lpdwAddressSize, FALSE );
621 HRESULT DPL_CreateAddress(
623 REFGUID guidDataType,
627 LPDWORD lpdwAddressSize,
628 BOOL bAnsiInterface )
630 const DWORD dwNumAddElements = 2; /* Service Provide & address data type */
631 DPCOMPOUNDADDRESSELEMENT addressElements[ 2 /* dwNumAddElements */ ];
633 TRACE( "(%p)->(%p,%p,0x%08lx,%p,%p,%d)\n", guidSP, guidDataType, lpData, dwDataSize,
634 lpAddress, lpdwAddressSize, bAnsiInterface );
636 addressElements[ 0 ].guidDataType = DPAID_ServiceProvider;
637 addressElements[ 0 ].dwDataSize = sizeof( GUID );
638 addressElements[ 0 ].lpData = (LPVOID)guidSP;
640 addressElements[ 1 ].guidDataType = *guidDataType;
641 addressElements[ 1 ].dwDataSize = dwDataSize;
642 addressElements[ 1 ].lpData = (LPVOID)lpData;
644 /* Call CreateCompoundAddress to cut down on code.
645 NOTE: We can do this because we don't support DPL 1 interfaces! */
646 return DPL_CreateCompoundAddress( addressElements, dwNumAddElements,
647 lpAddress, lpdwAddressSize, bAnsiInterface );
652 /********************************************************************
654 * Parses out chunks from the DirectPlay Address buffer by calling the
655 * given callback function, with lpContext, for each of the chunks.
658 static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumAddress
659 ( LPDIRECTPLAYLOBBYA iface,
660 LPDPENUMADDRESSCALLBACK lpEnumAddressCallback,
665 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface;
667 TRACE("(%p)->(%p,%p,0x%08lx,%p)\n", This, lpEnumAddressCallback, lpAddress,
668 dwAddressSize, lpContext );
670 return DPL_EnumAddress( lpEnumAddressCallback, lpAddress, dwAddressSize, lpContext );
673 static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumAddress
674 ( LPDIRECTPLAYLOBBY iface,
675 LPDPENUMADDRESSCALLBACK lpEnumAddressCallback,
680 IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)iface;
682 TRACE("(%p)->(%p,%p,0x%08lx,%p)\n", This, lpEnumAddressCallback, lpAddress,
683 dwAddressSize, lpContext );
685 return DPL_EnumAddress( lpEnumAddressCallback, lpAddress, dwAddressSize, lpContext );
688 extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress,
689 DWORD dwAddressSize, LPVOID lpContext )
691 DWORD dwTotalSizeEnumerated = 0;
693 /* FIXME: First chunk is always the total size chunk - Should we report it? */
695 while ( dwTotalSizeEnumerated < dwAddressSize )
697 LPDPADDRESS lpElements = (LPDPADDRESS)lpAddress;
698 DWORD dwSizeThisEnumeration;
700 /* Invoke the enum method. If false is returned, stop enumeration */
701 if ( !lpEnumAddressCallback( &lpElements->guidDataType,
702 lpElements->dwDataSize,
703 (BYTE*)lpElements + sizeof( DPADDRESS ),
709 dwSizeThisEnumeration = sizeof( DPADDRESS ) + lpElements->dwDataSize;
710 lpAddress = (BYTE*) lpAddress + dwSizeThisEnumeration;
711 dwTotalSizeEnumerated += dwSizeThisEnumeration;
717 /********************************************************************
719 * Enumerates all the address types that a given service provider needs to
720 * build the DirectPlay Address.
723 static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumAddressTypes
724 ( LPDIRECTPLAYLOBBYA iface,
725 LPDPLENUMADDRESSTYPESCALLBACK lpEnumAddressTypeCallback,
730 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface;
733 LPCSTR searchSubKey = "SOFTWARE\\Microsoft\\DirectPlay\\Service Providers";
734 DWORD dwIndex, sizeOfSubKeyName=50;
738 TRACE(" (%p)->(%p,%p,%p,0x%08lx)\n", This, lpEnumAddressTypeCallback, guidSP, lpContext, dwFlags );
742 return DPERR_INVALIDPARAMS;
745 if( !lpEnumAddressTypeCallback || !*lpEnumAddressTypeCallback )
747 return DPERR_INVALIDPARAMS;
752 return DPERR_INVALIDOBJECT;
755 /* Need to loop over the service providers in the registry */
756 if( RegOpenKeyExA( HKEY_LOCAL_MACHINE, searchSubKey,
757 0, KEY_READ, &hkResult ) != ERROR_SUCCESS )
759 /* Hmmm. Does this mean that there are no service providers? */
760 ERR(": no service providers?\n");
764 /* Traverse all the service providers we have available */
766 RegEnumKeyExA( hkResult, dwIndex, subKeyName, &sizeOfSubKeyName,
767 NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS;
768 ++dwIndex, sizeOfSubKeyName=50 )
771 HKEY hkServiceProvider, hkServiceProviderAt;
772 GUID serviceProviderGUID;
773 DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
775 char returnBuffer[51];
778 LPCSTR atKey = "Address Types";
779 LPCSTR guidDataSubKey = "Guid";
783 TRACE(" this time through: %s\n", subKeyName );
785 /* Get a handle for this particular service provider */
786 if( RegOpenKeyExA( hkResult, subKeyName, 0, KEY_READ,
787 &hkServiceProvider ) != ERROR_SUCCESS )
789 ERR(": what the heck is going on?\n" );
793 if( RegQueryValueExA( hkServiceProvider, guidDataSubKey,
794 NULL, &returnTypeGUID, returnBuffer,
795 &sizeOfReturnBuffer ) != ERROR_SUCCESS )
797 ERR(": missing GUID registry data members\n" );
801 /* FIXME: Check return types to ensure we're interpreting data right */
802 MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff)/sizeof(WCHAR) );
803 CLSIDFromString( buff, &serviceProviderGUID );
804 /* FIXME: Have I got a memory leak on the serviceProviderGUID? */
806 /* Determine if this is the Service Provider that the user asked for */
807 if( !IsEqualGUID( &serviceProviderGUID, guidSP ) )
812 /* Get a handle for this particular service provider */
813 if( RegOpenKeyExA( hkServiceProvider, atKey, 0, KEY_READ,
814 &hkServiceProviderAt ) != ERROR_SUCCESS )
816 TRACE(": No Address Types registry data sub key/members\n" );
820 /* Traverse all the address type we have available */
822 RegEnumKeyExA( hkServiceProviderAt, dwAtIndex, atSubKey, &sizeOfSubKeyName,
823 NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS;
824 ++dwAtIndex, sizeOfSubKeyName=50 )
826 TRACE( "Found Address Type GUID %s\n", atSubKey );
828 /* FIXME: Check return types to ensure we're interpreting data right */
829 MultiByteToWideChar( CP_ACP, 0, atSubKey, -1, buff, sizeof(buff)/sizeof(WCHAR) );
830 CLSIDFromString( buff, &serviceProviderGUID );
831 /* FIXME: Have I got a memory leak on the serviceProviderGUID? */
833 /* The enumeration will return FALSE if we are not to continue */
834 if( !lpEnumAddressTypeCallback( &serviceProviderGUID, lpContext, 0 ) )
836 WARN("lpEnumCallback returning FALSE\n" );
837 break; /* FIXME: This most likely has to break from the procedure...*/
842 /* We only enumerate address types for 1 GUID. We've found it, so quit looking */
849 static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumAddressTypes
850 ( LPDIRECTPLAYLOBBY iface,
851 LPDPLENUMADDRESSTYPESCALLBACK lpEnumAddressTypeCallback,
857 return DPERR_OUTOFMEMORY;
860 /********************************************************************
862 * Enumerates what applications are registered with DirectPlay by
863 * invoking the callback function with lpContext.
866 static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumLocalApplications
867 ( LPDIRECTPLAYLOBBY iface,
868 LPDPLENUMLOCALAPPLICATIONSCALLBACK lpEnumLocalAppCallback,
872 IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)iface;
874 FIXME("(%p)->(%p,%p,0x%08lx):stub\n", This, lpEnumLocalAppCallback, lpContext, dwFlags );
876 return DPERR_OUTOFMEMORY;
879 static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumLocalApplications
880 ( LPDIRECTPLAYLOBBYA iface,
881 LPDPLENUMLOCALAPPLICATIONSCALLBACK lpEnumLocalAppCallback,
885 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface;
888 LPCSTR searchSubKey = "SOFTWARE\\Microsoft\\DirectPlay\\Applications";
889 LPCSTR guidDataSubKey = "Guid";
890 DWORD dwIndex, sizeOfSubKeyName=50;
894 TRACE("(%p)->(%p,%p,0x%08lx)\n", This, lpEnumLocalAppCallback, lpContext, dwFlags );
898 return DPERR_INVALIDPARAMS;
901 if( !lpEnumLocalAppCallback || !*lpEnumLocalAppCallback )
903 return DPERR_INVALIDPARAMS;
906 /* Need to loop over the service providers in the registry */
907 if( RegOpenKeyExA( HKEY_LOCAL_MACHINE, searchSubKey,
908 0, KEY_READ, &hkResult ) != ERROR_SUCCESS )
910 /* Hmmm. Does this mean that there are no service providers? */
911 ERR(": no service providers?\n");
915 /* Traverse all registered applications */
917 RegEnumKeyExA( hkResult, dwIndex, subKeyName, &sizeOfSubKeyName, NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS;
918 ++dwIndex, sizeOfSubKeyName=50 )
921 HKEY hkServiceProvider;
922 GUID serviceProviderGUID;
923 DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
924 char returnBuffer[51];
926 DPLAPPINFO dplAppInfo;
928 TRACE(" this time through: %s\n", subKeyName );
930 /* Get a handle for this particular service provider */
931 if( RegOpenKeyExA( hkResult, subKeyName, 0, KEY_READ,
932 &hkServiceProvider ) != ERROR_SUCCESS )
934 ERR(": what the heck is going on?\n" );
938 if( RegQueryValueExA( hkServiceProvider, guidDataSubKey,
939 NULL, &returnTypeGUID, returnBuffer,
940 &sizeOfReturnBuffer ) != ERROR_SUCCESS )
942 ERR(": missing GUID registry data members\n" );
946 /* FIXME: Check return types to ensure we're interpreting data right */
947 MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff)/sizeof(WCHAR) );
948 CLSIDFromString( buff, &serviceProviderGUID );
949 /* FIXME: Have I got a memory leak on the serviceProviderGUID? */
951 dplAppInfo.dwSize = sizeof( dplAppInfo );
952 dplAppInfo.guidApplication = serviceProviderGUID;
953 dplAppInfo.u.lpszAppNameA = subKeyName;
955 EnterCriticalSection( &This->unk->DPL_lock );
957 memcpy( &This->dpl->hkCallbackKeyHack, &hkServiceProvider, sizeof( hkServiceProvider ) );
959 if( !lpEnumLocalAppCallback( &dplAppInfo, lpContext, dwFlags ) )
961 LeaveCriticalSection( &This->unk->DPL_lock );
965 LeaveCriticalSection( &This->unk->DPL_lock );
971 /********************************************************************
973 * Retrieves the DPLCONNECTION structure that contains all the information
974 * needed to start and connect an application. This was generated using
975 * either the RunApplication or SetConnectionSettings methods.
977 * NOTES: If lpData is NULL then just return lpdwDataSize. This allows
978 * the data structure to be allocated by our caller which can then
979 * call this procedure/method again with a valid data pointer.
981 static HRESULT WINAPI IDirectPlayLobbyAImpl_GetConnectionSettings
982 ( LPDIRECTPLAYLOBBYA iface,
985 LPDWORD lpdwDataSize )
987 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface;
990 TRACE("(%p)->(0x%08lx,%p,%p)\n", This, dwAppID, lpData, lpdwDataSize );
992 EnterCriticalSection( &This->unk->DPL_lock );
994 hr = DPLAYX_GetConnectionSettingsA( dwAppID,
999 LeaveCriticalSection( &This->unk->DPL_lock );
1004 static HRESULT WINAPI IDirectPlayLobbyWImpl_GetConnectionSettings
1005 ( LPDIRECTPLAYLOBBY iface,
1008 LPDWORD lpdwDataSize )
1010 IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)iface;
1013 TRACE("(%p)->(0x%08lx,%p,%p)\n", This, dwAppID, lpData, lpdwDataSize );
1015 EnterCriticalSection( &This->unk->DPL_lock );
1017 hr = DPLAYX_GetConnectionSettingsW( dwAppID,
1022 LeaveCriticalSection( &This->unk->DPL_lock );
1027 /********************************************************************
1029 * Retrieves the message sent between a lobby client and a DirectPlay
1030 * application. All messages are queued until received.
1033 static HRESULT WINAPI IDirectPlayLobbyAImpl_ReceiveLobbyMessage
1034 ( LPDIRECTPLAYLOBBYA iface,
1037 LPDWORD lpdwMessageFlags,
1039 LPDWORD lpdwDataSize )
1041 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface;
1042 FIXME(":stub %p %08lx %08lx %p %p %p\n", This, dwFlags, dwAppID, lpdwMessageFlags, lpData,
1044 return DPERR_OUTOFMEMORY;
1047 static HRESULT WINAPI IDirectPlayLobbyWImpl_ReceiveLobbyMessage
1048 ( LPDIRECTPLAYLOBBY iface,
1051 LPDWORD lpdwMessageFlags,
1053 LPDWORD lpdwDataSize )
1055 IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)iface;
1056 FIXME(":stub %p %08lx %08lx %p %p %p\n", This, dwFlags, dwAppID, lpdwMessageFlags, lpData,
1058 return DPERR_OUTOFMEMORY;
1061 typedef struct tagRunApplicationEnumStruct
1063 IDirectPlayLobbyAImpl* This;
1068 LPSTR lpszCommandLine;
1069 LPSTR lpszCurrentDirectory;
1070 } RunApplicationEnumStruct, *lpRunApplicationEnumStruct;
1072 /* To be called by RunApplication to find how to invoke the function */
1073 static BOOL CALLBACK RunApplicationA_EnumLocalApplications
1074 ( LPCDPLAPPINFO lpAppInfo,
1078 lpRunApplicationEnumStruct lpData = (lpRunApplicationEnumStruct)lpContext;
1080 if( IsEqualGUID( &lpAppInfo->guidApplication, &lpData->appGUID ) )
1082 char returnBuffer[200];
1083 DWORD returnType, sizeOfReturnBuffer;
1084 LPCSTR clSubKey = "CommandLine";
1085 LPCSTR cdSubKey = "CurrentDirectory";
1086 LPCSTR fileSubKey = "File";
1087 LPCSTR pathSubKey = "Path";
1089 /* FIXME: Lazy man hack - dplay struct has the present reg key saved */
1091 sizeOfReturnBuffer = 200;
1093 /* Get all the appropriate data from the registry */
1094 if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, clSubKey,
1095 NULL, &returnType, returnBuffer,
1096 &sizeOfReturnBuffer ) != ERROR_SUCCESS )
1098 ERR( ": missing CommandLine registry data member\n" );
1102 if ((lpData->lpszCommandLine = HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer)+1 )))
1103 strcpy( lpData->lpszCommandLine, returnBuffer );
1106 sizeOfReturnBuffer = 200;
1108 if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, cdSubKey,
1109 NULL, &returnType, returnBuffer,
1110 &sizeOfReturnBuffer ) != ERROR_SUCCESS )
1112 ERR( ": missing CurrentDirectory registry data member\n" );
1116 if ((lpData->lpszCurrentDirectory = HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer)+1 )))
1117 strcpy( lpData->lpszCurrentDirectory, returnBuffer );
1120 sizeOfReturnBuffer = 200;
1122 if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, fileSubKey,
1123 NULL, &returnType, returnBuffer,
1124 &sizeOfReturnBuffer ) != ERROR_SUCCESS )
1126 ERR( ": missing File registry data member\n" );
1130 if ((lpData->lpszFileName = HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer)+1 )))
1131 strcpy( lpData->lpszFileName, returnBuffer );
1134 sizeOfReturnBuffer = 200;
1136 if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, pathSubKey,
1137 NULL, &returnType, returnBuffer,
1138 &sizeOfReturnBuffer ) != ERROR_SUCCESS )
1140 ERR( ": missing Path registry data member\n" );
1144 if ((lpData->lpszPath = HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer)+1 )))
1145 strcpy( lpData->lpszPath, returnBuffer );
1148 return FALSE; /* No need to keep going as we found what we wanted */
1151 return TRUE; /* Keep enumerating, haven't found the application yet */
1154 BOOL DPL_CreateAndSetLobbyHandles( DWORD dwDestProcessId, HANDLE hDestProcess,
1155 LPHANDLE lphStart, LPHANDLE lphDeath,
1158 /* These are the handles for the created process */
1159 HANDLE hAppStart, hAppDeath, hAppRead, hTemp;
1160 SECURITY_ATTRIBUTES s_attrib;
1162 s_attrib.nLength = sizeof( s_attrib );
1163 s_attrib.lpSecurityDescriptor = NULL;
1164 s_attrib.bInheritHandle = TRUE;
1166 /* FIXME: Is there a handle leak here? */
1167 hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL );
1168 *lphStart = ConvertToGlobalHandle( hTemp );
1170 hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL );
1171 *lphDeath = ConvertToGlobalHandle( hTemp );
1173 hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL );
1174 *lphRead = ConvertToGlobalHandle( hTemp );
1176 if( ( !DuplicateHandle( GetCurrentProcess(), *lphStart,
1177 hDestProcess, &hAppStart,
1178 0, FALSE, DUPLICATE_SAME_ACCESS ) ) ||
1179 ( !DuplicateHandle( GetCurrentProcess(), *lphDeath,
1180 hDestProcess, &hAppDeath,
1181 0, FALSE, DUPLICATE_SAME_ACCESS ) ) ||
1182 ( !DuplicateHandle( GetCurrentProcess(), *lphRead,
1183 hDestProcess, &hAppRead,
1184 0, FALSE, DUPLICATE_SAME_ACCESS ) )
1187 /* FIXME: Handle leak... */
1188 ERR( "Unable to dup handles\n" );
1192 if( !DPLAYX_SetLobbyHandles( dwDestProcessId,
1193 hAppStart, hAppDeath, hAppRead ) )
1202 /********************************************************************
1204 * Starts an application and passes to it all the information to
1205 * connect to a session.
1208 static HRESULT WINAPI IDirectPlayLobbyAImpl_RunApplication
1209 ( LPDIRECTPLAYLOBBYA iface,
1212 LPDPLCONNECTION lpConn,
1213 HANDLE hReceiveEvent )
1215 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface;
1217 RunApplicationEnumStruct enumData;
1219 STARTUPINFOA startupInfo;
1220 PROCESS_INFORMATION newProcessInfo;
1222 DWORD dwSuspendCount;
1223 HANDLE hStart, hDeath, hSettingRead;
1225 TRACE( "(%p)->(0x%08lx,%p,%p,%p)\n",
1226 This, dwFlags, lpdwAppID, lpConn, hReceiveEvent );
1230 return DPERR_INVALIDPARAMS;
1233 if( DPLAYX_AnyLobbiesWaitingForConnSettings() )
1235 FIXME( "Waiting lobby not being handled correctly\n" );
1238 EnterCriticalSection( &This->unk->DPL_lock );
1240 ZeroMemory( &enumData, sizeof( enumData ) );
1241 enumData.This = This;
1242 enumData.appGUID = lpConn->lpSessionDesc->guidApplication;
1244 /* Our callback function will fill up the enumData structure with all the information
1245 required to start a new process */
1246 IDirectPlayLobby_EnumLocalApplications( iface, RunApplicationA_EnumLocalApplications,
1247 (LPVOID)(&enumData), 0 );
1249 /* First the application name */
1250 strcpy( temp, enumData.lpszPath );
1251 strcat( temp, "\\" );
1252 strcat( temp, enumData.lpszFileName );
1253 HeapFree( GetProcessHeap(), 0, enumData.lpszPath );
1254 HeapFree( GetProcessHeap(), 0, enumData.lpszFileName );
1255 if ((appName = HeapAlloc( GetProcessHeap(), 0, strlen(temp)+1 ))) strcpy( appName, temp );
1257 /* Now the command line */
1258 strcat( temp, " " );
1259 strcat( temp, enumData.lpszCommandLine );
1260 HeapFree( GetProcessHeap(), 0, enumData.lpszCommandLine );
1261 if ((enumData.lpszCommandLine = HeapAlloc( GetProcessHeap(), 0, strlen(temp)+1 )))
1262 strcpy( enumData.lpszCommandLine, temp );
1264 ZeroMemory( &startupInfo, sizeof( startupInfo ) );
1265 startupInfo.cb = sizeof( startupInfo );
1266 /* FIXME: Should any fields be filled in? */
1268 ZeroMemory( &newProcessInfo, sizeof( newProcessInfo ) );
1270 if( !CreateProcessA( appName,
1271 enumData.lpszCommandLine,
1275 CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE | CREATE_SUSPENDED, /* Creation Flags */
1277 enumData.lpszCurrentDirectory,
1283 ERR( "Failed to create process for app %s\n", appName );
1285 HeapFree( GetProcessHeap(), 0, appName );
1286 HeapFree( GetProcessHeap(), 0, enumData.lpszCommandLine );
1287 HeapFree( GetProcessHeap(), 0, enumData.lpszCurrentDirectory );
1289 LeaveCriticalSection( &This->unk->DPL_lock );
1290 return DPERR_CANTCREATEPROCESS;
1293 HeapFree( GetProcessHeap(), 0, appName );
1294 HeapFree( GetProcessHeap(), 0, enumData.lpszCommandLine );
1295 HeapFree( GetProcessHeap(), 0, enumData.lpszCurrentDirectory );
1297 /* Reserve this global application id! */
1298 if( !DPLAYX_CreateLobbyApplication( newProcessInfo.dwProcessId ) )
1300 ERR( "Unable to create global application data for 0x%08lx\n",
1301 newProcessInfo.dwProcessId );
1304 hr = IDirectPlayLobby_SetConnectionSettings( iface, 0, newProcessInfo.dwProcessId, lpConn );
1308 ERR( "SetConnectionSettings failure %s\n", DPLAYX_HresultToString( hr ) );
1309 LeaveCriticalSection( &This->unk->DPL_lock );
1313 /* Setup the handles for application notification */
1314 DPL_CreateAndSetLobbyHandles( newProcessInfo.dwProcessId,
1315 newProcessInfo.hProcess,
1316 &hStart, &hDeath, &hSettingRead );
1318 /* Setup the message thread ID */
1319 This->dpl->dwMsgThread =
1320 CreateLobbyMessageReceptionThread( hReceiveEvent, hStart, hDeath, hSettingRead );
1322 DPLAYX_SetLobbyMsgThreadId( newProcessInfo.dwProcessId, This->dpl->dwMsgThread );
1324 LeaveCriticalSection( &This->unk->DPL_lock );
1326 /* Everything seems to have been set correctly, update the dwAppID */
1327 *lpdwAppID = newProcessInfo.dwProcessId;
1329 /* Unsuspend the process - should return the prev suspension count */
1330 if( ( dwSuspendCount = ResumeThread( newProcessInfo.hThread ) ) != 1 )
1332 ERR( "ResumeThread failed with 0x%08lx\n", dwSuspendCount );
1338 static HRESULT WINAPI IDirectPlayLobbyWImpl_RunApplication
1339 ( LPDIRECTPLAYLOBBY iface,
1342 LPDPLCONNECTION lpConn,
1343 HANDLE hReceiveEvent )
1345 IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)iface;
1346 FIXME( "(%p)->(0x%08lx,%p,%p,%p):stub\n", This, dwFlags, lpdwAppID, lpConn, (void *)hReceiveEvent );
1347 return DPERR_OUTOFMEMORY;
1350 /********************************************************************
1352 * Sends a message between the application and the lobby client.
1353 * All messages are queued until received.
1356 static HRESULT WINAPI IDirectPlayLobbyAImpl_SendLobbyMessage
1357 ( LPDIRECTPLAYLOBBYA iface,
1364 return DPERR_OUTOFMEMORY;
1367 static HRESULT WINAPI IDirectPlayLobbyWImpl_SendLobbyMessage
1368 ( LPDIRECTPLAYLOBBY iface,
1375 return DPERR_OUTOFMEMORY;
1378 /********************************************************************
1380 * Modifies the DPLCONNECTION structure to contain all information
1381 * needed to start and connect an application.
1384 static HRESULT WINAPI IDirectPlayLobbyWImpl_SetConnectionSettings
1385 ( LPDIRECTPLAYLOBBY iface,
1388 LPDPLCONNECTION lpConn )
1390 IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)iface;
1393 TRACE("(%p)->(0x%08lx,0x%08lx,%p)\n", This, dwFlags, dwAppID, lpConn );
1395 EnterCriticalSection( &This->unk->DPL_lock );
1397 hr = DPLAYX_SetConnectionSettingsW( dwFlags, dwAppID, lpConn );
1399 /* FIXME: Don't think that this is supposed to fail, but the docuementation
1400 is somewhat sketchy. I'll try creating a lobby application
1402 if( hr == DPERR_NOTLOBBIED )
1404 FIXME( "Unlobbied app setting connections. Is this correct behavior?\n" );
1407 dwAppID = GetCurrentProcessId();
1409 DPLAYX_CreateLobbyApplication( dwAppID );
1410 hr = DPLAYX_SetConnectionSettingsW( dwFlags, dwAppID, lpConn );
1413 LeaveCriticalSection( &This->unk->DPL_lock );
1418 static HRESULT WINAPI IDirectPlayLobbyAImpl_SetConnectionSettings
1419 ( LPDIRECTPLAYLOBBYA iface,
1422 LPDPLCONNECTION lpConn )
1424 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface;
1427 TRACE("(%p)->(0x%08lx,0x%08lx,%p)\n", This, dwFlags, dwAppID, lpConn );
1429 EnterCriticalSection( &This->unk->DPL_lock );
1431 hr = DPLAYX_SetConnectionSettingsA( dwFlags, dwAppID, lpConn );
1433 /* FIXME: Don't think that this is supposed to fail, but the docuementation
1434 is somewhat sketchy. I'll try creating a lobby application
1436 if( hr == DPERR_NOTLOBBIED )
1438 FIXME( "Unlobbied app setting connections. Is this correct behavior?\n" );
1439 dwAppID = GetCurrentProcessId();
1440 DPLAYX_CreateLobbyApplication( dwAppID );
1441 hr = DPLAYX_SetConnectionSettingsA( dwFlags, dwAppID, lpConn );
1444 LeaveCriticalSection( &This->unk->DPL_lock );
1449 /********************************************************************
1451 * Registers an event that will be set when a lobby message is received.
1454 static HRESULT WINAPI IDirectPlayLobbyAImpl_SetLobbyMessageEvent
1455 ( LPDIRECTPLAYLOBBYA iface,
1458 HANDLE hReceiveEvent )
1461 return DPERR_OUTOFMEMORY;
1464 static HRESULT WINAPI IDirectPlayLobbyWImpl_SetLobbyMessageEvent
1465 ( LPDIRECTPLAYLOBBY iface,
1468 HANDLE hReceiveEvent )
1471 return DPERR_OUTOFMEMORY;
1476 static HRESULT WINAPI IDirectPlayLobby2WImpl_CreateCompoundAddress
1477 ( LPDIRECTPLAYLOBBY2 iface,
1478 LPCDPCOMPOUNDADDRESSELEMENT lpElements,
1479 DWORD dwElementCount,
1481 LPDWORD lpdwAddressSize )
1483 return DPL_CreateCompoundAddress( lpElements, dwElementCount, lpAddress, lpdwAddressSize, FALSE );
1486 static HRESULT WINAPI IDirectPlayLobby2AImpl_CreateCompoundAddress
1487 ( LPDIRECTPLAYLOBBY2A iface,
1488 LPCDPCOMPOUNDADDRESSELEMENT lpElements,
1489 DWORD dwElementCount,
1491 LPDWORD lpdwAddressSize )
1493 return DPL_CreateCompoundAddress( lpElements, dwElementCount, lpAddress, lpdwAddressSize, TRUE );
1496 HRESULT DPL_CreateCompoundAddress
1497 ( LPCDPCOMPOUNDADDRESSELEMENT lpElements,
1498 DWORD dwElementCount,
1500 LPDWORD lpdwAddressSize,
1501 BOOL bAnsiInterface )
1503 DWORD dwSizeRequired = 0;
1505 LPCDPCOMPOUNDADDRESSELEMENT lpOrigElements = lpElements;
1507 TRACE("(%p,0x%08lx,%p,%p)\n", lpElements, dwElementCount, lpAddress, lpdwAddressSize );
1509 /* Parameter check */
1510 if( ( lpElements == NULL ) ||
1511 ( dwElementCount == 0 ) /* FIXME: Not sure if this is a failure case */
1514 return DPERR_INVALIDPARAMS;
1517 /* Add the total size chunk */
1518 dwSizeRequired += sizeof( DPADDRESS ) + sizeof( DWORD );
1520 /* Calculate the size of the buffer required */
1521 for ( dwElements = dwElementCount; dwElements > 0; --dwElements, ++lpElements )
1523 if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ServiceProvider ) ) ||
1524 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_LobbyProvider ) )
1527 dwSizeRequired += sizeof( DPADDRESS ) + sizeof( GUID );
1529 else if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_Phone ) ) ||
1530 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_Modem ) ) ||
1531 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INet ) )
1534 if( !bAnsiInterface )
1536 ERR( "Ansi GUIDs used for unicode interface\n" );
1537 return DPERR_INVALIDFLAGS;
1540 dwSizeRequired += sizeof( DPADDRESS ) + lpElements->dwDataSize;
1542 else if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_PhoneW ) ) ||
1543 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ModemW ) ) ||
1544 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INetW ) )
1547 if( bAnsiInterface )
1549 ERR( "Unicode GUIDs used for ansi interface\n" );
1550 return DPERR_INVALIDFLAGS;
1553 FIXME( "Right size for unicode interface?\n" );
1554 dwSizeRequired += sizeof( DPADDRESS ) + lpElements->dwDataSize * sizeof( WCHAR );
1556 else if ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INetPort ) )
1558 dwSizeRequired += sizeof( DPADDRESS ) + sizeof( WORD );
1560 else if ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ComPort ) )
1562 FIXME( "Right size for unicode interface?\n" );
1563 dwSizeRequired += sizeof( DPADDRESS ) + sizeof( DPCOMPORTADDRESS ); /* FIXME: Right size? */
1567 ERR( "Unknown GUID %s\n", debugstr_guid(&lpElements->guidDataType) );
1568 return DPERR_INVALIDFLAGS;
1572 /* The user wants to know how big a buffer to allocate for us */
1573 if( ( lpAddress == NULL ) ||
1574 ( *lpdwAddressSize < dwSizeRequired )
1577 *lpdwAddressSize = dwSizeRequired;
1578 return DPERR_BUFFERTOOSMALL;
1581 /* Add the total size chunk */
1583 LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
1585 CopyMemory( &lpdpAddress->guidDataType, &DPAID_TotalSize, sizeof( GUID ) );
1586 lpdpAddress->dwDataSize = sizeof( DWORD );
1587 lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
1589 *(LPDWORD)lpAddress = dwSizeRequired;
1590 lpAddress = (char *) lpAddress + sizeof( DWORD );
1593 /* Calculate the size of the buffer required */
1594 for( dwElements = dwElementCount, lpElements = lpOrigElements;
1596 --dwElements, ++lpElements )
1598 if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ServiceProvider ) ) ||
1599 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_LobbyProvider ) )
1602 LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
1604 CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
1606 lpdpAddress->dwDataSize = sizeof( GUID );
1607 lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
1609 CopyMemory( lpAddress, lpElements->lpData, sizeof( GUID ) );
1610 lpAddress = (char *) lpAddress + sizeof( GUID );
1612 else if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_Phone ) ) ||
1613 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_Modem ) ) ||
1614 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INet ) )
1617 LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
1619 CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
1621 lpdpAddress->dwDataSize = lpElements->dwDataSize;
1622 lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
1624 lstrcpynA( (LPSTR)lpAddress,
1625 (LPCSTR)lpElements->lpData,
1626 lpElements->dwDataSize );
1627 lpAddress = (char *) lpAddress + lpElements->dwDataSize;
1629 else if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_PhoneW ) ) ||
1630 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ModemW ) ) ||
1631 ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INetW ) )
1634 LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
1636 CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
1638 lpdpAddress->dwDataSize = lpElements->dwDataSize;
1639 lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
1641 lstrcpynW( (LPWSTR)lpAddress,
1642 (LPCWSTR)lpElements->lpData,
1643 lpElements->dwDataSize );
1644 lpAddress = (char *) lpAddress + lpElements->dwDataSize * sizeof( WCHAR );
1646 else if ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INetPort ) )
1648 LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
1650 CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
1652 lpdpAddress->dwDataSize = lpElements->dwDataSize;
1653 lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
1655 *((LPWORD)lpAddress) = *((LPWORD)lpElements->lpData);
1656 lpAddress = (char *) lpAddress + sizeof( WORD );
1658 else if ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ComPort ) )
1660 LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
1662 CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
1664 lpdpAddress->dwDataSize = lpElements->dwDataSize;
1665 lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
1667 CopyMemory( lpAddress, lpElements->lpData, sizeof( DPADDRESS ) );
1668 lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
1677 static HRESULT WINAPI IDirectPlayLobby3WImpl_ConnectEx
1678 ( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags, REFIID riid,
1679 LPVOID* lplpDP, IUnknown* pUnk )
1681 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface ;
1682 return DPL_ConnectEx( This, dwFlags, riid, lplpDP, pUnk );
1685 static HRESULT WINAPI IDirectPlayLobby3AImpl_ConnectEx
1686 ( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags, REFIID riid,
1687 LPVOID* lplpDP, IUnknown* pUnk )
1689 IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface ;
1690 return DPL_ConnectEx( This, dwFlags, riid, lplpDP, pUnk );
1693 static HRESULT WINAPI IDirectPlayLobby3WImpl_RegisterApplication
1694 ( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags, LPDPAPPLICATIONDESC lpAppDesc )
1700 static HRESULT WINAPI IDirectPlayLobby3AImpl_RegisterApplication
1701 ( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags, LPDPAPPLICATIONDESC lpAppDesc )
1707 static HRESULT WINAPI IDirectPlayLobby3WImpl_UnregisterApplication
1708 ( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags, REFGUID lpAppDesc )
1714 static HRESULT WINAPI IDirectPlayLobby3AImpl_UnregisterApplication
1715 ( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags, REFGUID lpAppDesc )
1721 static HRESULT WINAPI IDirectPlayLobby3WImpl_WaitForConnectionSettings
1722 ( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags )
1725 BOOL bStartWait = (dwFlags & DPLWAIT_CANCEL) ? FALSE : TRUE;
1727 TRACE( "(%p)->(0x%08lx)\n", iface, dwFlags );
1729 if( DPLAYX_WaitForConnectionSettings( bStartWait ) )
1731 /* FIXME: What is the correct error return code? */
1732 hr = DPERR_NOTLOBBIED;
1738 static HRESULT WINAPI IDirectPlayLobby3AImpl_WaitForConnectionSettings
1739 ( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags )
1742 BOOL bStartWait = (dwFlags & DPLWAIT_CANCEL) ? FALSE : TRUE;
1744 TRACE( "(%p)->(0x%08lx)\n", iface, dwFlags );
1746 if( DPLAYX_WaitForConnectionSettings( bStartWait ) )
1748 /* FIXME: What is the correct error return code? */
1749 hr = DPERR_NOTLOBBIED;
1756 /* Virtual Table definitions for DPL{1,2,3}{A,W} */
1758 /* Note: Hack so we can reuse the old functions without compiler warnings */
1759 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1760 # define XCAST(fun) (typeof(directPlayLobbyAVT.fun))
1762 # define XCAST(fun) (void*)
1765 /* Direct Play Lobby 1 (ascii) Virtual Table for methods */
1766 /* All lobby 1 methods are exactly the same except QueryInterface */
1767 static struct IDirectPlayLobbyVtbl directPlayLobbyAVT =
1770 XCAST(QueryInterface)DPL_QueryInterface,
1771 XCAST(AddRef)DPL_AddRef,
1772 XCAST(Release)DPL_Release,
1774 IDirectPlayLobbyAImpl_Connect,
1775 IDirectPlayLobbyAImpl_CreateAddress,
1776 IDirectPlayLobbyAImpl_EnumAddress,
1777 IDirectPlayLobbyAImpl_EnumAddressTypes,
1778 IDirectPlayLobbyAImpl_EnumLocalApplications,
1779 IDirectPlayLobbyAImpl_GetConnectionSettings,
1780 IDirectPlayLobbyAImpl_ReceiveLobbyMessage,
1781 IDirectPlayLobbyAImpl_RunApplication,
1782 IDirectPlayLobbyAImpl_SendLobbyMessage,
1783 IDirectPlayLobbyAImpl_SetConnectionSettings,
1784 IDirectPlayLobbyAImpl_SetLobbyMessageEvent
1789 /* Note: Hack so we can reuse the old functions without compiler warnings */
1790 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1791 # define XCAST(fun) (typeof(directPlayLobbyWVT.fun))
1793 # define XCAST(fun) (void*)
1796 /* Direct Play Lobby 1 (unicode) Virtual Table for methods */
1797 static IDirectPlayLobbyVtbl directPlayLobbyWVT =
1800 XCAST(QueryInterface)DPL_QueryInterface,
1801 XCAST(AddRef)DPL_AddRef,
1802 XCAST(Release)DPL_Release,
1804 IDirectPlayLobbyWImpl_Connect,
1805 IDirectPlayLobbyWImpl_CreateAddress,
1806 IDirectPlayLobbyWImpl_EnumAddress,
1807 IDirectPlayLobbyWImpl_EnumAddressTypes,
1808 IDirectPlayLobbyWImpl_EnumLocalApplications,
1809 IDirectPlayLobbyWImpl_GetConnectionSettings,
1810 IDirectPlayLobbyWImpl_ReceiveLobbyMessage,
1811 IDirectPlayLobbyWImpl_RunApplication,
1812 IDirectPlayLobbyWImpl_SendLobbyMessage,
1813 IDirectPlayLobbyWImpl_SetConnectionSettings,
1814 IDirectPlayLobbyWImpl_SetLobbyMessageEvent
1818 /* Note: Hack so we can reuse the old functions without compiler warnings */
1819 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1820 # define XCAST(fun) (typeof(directPlayLobby2AVT.fun))
1822 # define XCAST(fun) (void*)
1825 /* Direct Play Lobby 2 (ascii) Virtual Table for methods */
1826 static IDirectPlayLobby2Vtbl directPlayLobby2AVT =
1829 XCAST(QueryInterface)DPL_QueryInterface,
1830 XCAST(AddRef)DPL_AddRef,
1831 XCAST(Release)DPL_Release,
1833 XCAST(Connect)IDirectPlayLobbyAImpl_Connect,
1834 XCAST(CreateAddress)IDirectPlayLobbyAImpl_CreateAddress,
1835 XCAST(EnumAddress)IDirectPlayLobbyAImpl_EnumAddress,
1836 XCAST(EnumAddressTypes)IDirectPlayLobbyAImpl_EnumAddressTypes,
1837 XCAST(EnumLocalApplications)IDirectPlayLobbyAImpl_EnumLocalApplications,
1838 XCAST(GetConnectionSettings)IDirectPlayLobbyAImpl_GetConnectionSettings,
1839 XCAST(ReceiveLobbyMessage)IDirectPlayLobbyAImpl_ReceiveLobbyMessage,
1840 XCAST(RunApplication)IDirectPlayLobbyAImpl_RunApplication,
1841 XCAST(SendLobbyMessage)IDirectPlayLobbyAImpl_SendLobbyMessage,
1842 XCAST(SetConnectionSettings)IDirectPlayLobbyAImpl_SetConnectionSettings,
1843 XCAST(SetLobbyMessageEvent)IDirectPlayLobbyAImpl_SetLobbyMessageEvent,
1845 IDirectPlayLobby2AImpl_CreateCompoundAddress
1849 /* Note: Hack so we can reuse the old functions without compiler warnings */
1850 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1851 # define XCAST(fun) (typeof(directPlayLobby2AVT.fun))
1853 # define XCAST(fun) (void*)
1856 /* Direct Play Lobby 2 (unicode) Virtual Table for methods */
1857 static IDirectPlayLobby2Vtbl directPlayLobby2WVT =
1860 XCAST(QueryInterface)DPL_QueryInterface,
1861 XCAST(AddRef)DPL_AddRef,
1862 XCAST(Release)DPL_Release,
1864 XCAST(Connect)IDirectPlayLobbyWImpl_Connect,
1865 XCAST(CreateAddress)IDirectPlayLobbyWImpl_CreateAddress,
1866 XCAST(EnumAddress)IDirectPlayLobbyWImpl_EnumAddress,
1867 XCAST(EnumAddressTypes)IDirectPlayLobbyWImpl_EnumAddressTypes,
1868 XCAST(EnumLocalApplications)IDirectPlayLobbyWImpl_EnumLocalApplications,
1869 XCAST(GetConnectionSettings)IDirectPlayLobbyWImpl_GetConnectionSettings,
1870 XCAST(ReceiveLobbyMessage)IDirectPlayLobbyWImpl_ReceiveLobbyMessage,
1871 XCAST(RunApplication)IDirectPlayLobbyWImpl_RunApplication,
1872 XCAST(SendLobbyMessage)IDirectPlayLobbyWImpl_SendLobbyMessage,
1873 XCAST(SetConnectionSettings)IDirectPlayLobbyWImpl_SetConnectionSettings,
1874 XCAST(SetLobbyMessageEvent)IDirectPlayLobbyWImpl_SetLobbyMessageEvent,
1876 IDirectPlayLobby2WImpl_CreateCompoundAddress
1880 /* Direct Play Lobby 3 (ascii) Virtual Table for methods */
1882 /* Note: Hack so we can reuse the old functions without compiler warnings */
1883 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1884 # define XCAST(fun) (typeof(directPlayLobby3AVT.fun))
1886 # define XCAST(fun) (void*)
1889 static IDirectPlayLobby3Vtbl directPlayLobby3AVT =
1891 XCAST(QueryInterface)DPL_QueryInterface,
1892 XCAST(AddRef)DPL_AddRef,
1893 XCAST(Release)DPL_Release,
1895 XCAST(Connect)IDirectPlayLobbyAImpl_Connect,
1896 XCAST(CreateAddress)IDirectPlayLobbyAImpl_CreateAddress,
1897 XCAST(EnumAddress)IDirectPlayLobbyAImpl_EnumAddress,
1898 XCAST(EnumAddressTypes)IDirectPlayLobbyAImpl_EnumAddressTypes,
1899 XCAST(EnumLocalApplications)IDirectPlayLobbyAImpl_EnumLocalApplications,
1900 XCAST(GetConnectionSettings)IDirectPlayLobbyAImpl_GetConnectionSettings,
1901 XCAST(ReceiveLobbyMessage)IDirectPlayLobbyAImpl_ReceiveLobbyMessage,
1902 XCAST(RunApplication)IDirectPlayLobbyAImpl_RunApplication,
1903 XCAST(SendLobbyMessage)IDirectPlayLobbyAImpl_SendLobbyMessage,
1904 XCAST(SetConnectionSettings)IDirectPlayLobbyAImpl_SetConnectionSettings,
1905 XCAST(SetLobbyMessageEvent)IDirectPlayLobbyAImpl_SetLobbyMessageEvent,
1907 XCAST(CreateCompoundAddress)IDirectPlayLobby2AImpl_CreateCompoundAddress,
1909 IDirectPlayLobby3AImpl_ConnectEx,
1910 IDirectPlayLobby3AImpl_RegisterApplication,
1911 IDirectPlayLobby3AImpl_UnregisterApplication,
1912 IDirectPlayLobby3AImpl_WaitForConnectionSettings
1916 /* Direct Play Lobby 3 (unicode) Virtual Table for methods */
1918 /* Note: Hack so we can reuse the old functions without compiler warnings */
1919 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1920 # define XCAST(fun) (typeof(directPlayLobby3WVT.fun))
1922 # define XCAST(fun) (void*)
1925 static IDirectPlayLobby3Vtbl directPlayLobby3WVT =
1927 XCAST(QueryInterface)DPL_QueryInterface,
1928 XCAST(AddRef)DPL_AddRef,
1929 XCAST(Release)DPL_Release,
1931 XCAST(Connect)IDirectPlayLobbyWImpl_Connect,
1932 XCAST(CreateAddress)IDirectPlayLobbyWImpl_CreateAddress,
1933 XCAST(EnumAddress)IDirectPlayLobbyWImpl_EnumAddress,
1934 XCAST(EnumAddressTypes)IDirectPlayLobbyWImpl_EnumAddressTypes,
1935 XCAST(EnumLocalApplications)IDirectPlayLobbyWImpl_EnumLocalApplications,
1936 XCAST(GetConnectionSettings)IDirectPlayLobbyWImpl_GetConnectionSettings,
1937 XCAST(ReceiveLobbyMessage)IDirectPlayLobbyWImpl_ReceiveLobbyMessage,
1938 XCAST(RunApplication)IDirectPlayLobbyWImpl_RunApplication,
1939 XCAST(SendLobbyMessage)IDirectPlayLobbyWImpl_SendLobbyMessage,
1940 XCAST(SetConnectionSettings)IDirectPlayLobbyWImpl_SetConnectionSettings,
1941 XCAST(SetLobbyMessageEvent)IDirectPlayLobbyWImpl_SetLobbyMessageEvent,
1943 XCAST(CreateCompoundAddress)IDirectPlayLobby2WImpl_CreateCompoundAddress,
1945 IDirectPlayLobby3WImpl_ConnectEx,
1946 IDirectPlayLobby3WImpl_RegisterApplication,
1947 IDirectPlayLobby3WImpl_UnregisterApplication,
1948 IDirectPlayLobby3WImpl_WaitForConnectionSettings
1953 /*********************************************************
1955 * Direct Play Lobby Interface Implementation
1957 *********************************************************/
1959 /***************************************************************************
1960 * DirectPlayLobbyCreateA (DPLAYX.4)
1963 HRESULT WINAPI DirectPlayLobbyCreateA( LPGUID lpGUIDDSP,
1964 LPDIRECTPLAYLOBBYA *lplpDPL,
1969 TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08lx\n",
1970 lpGUIDDSP,lplpDPL,lpUnk,lpData,dwDataSize);
1972 /* Parameter Check: lpGUIDSP, lpUnk & lpData must be NULL. dwDataSize must
1973 * equal 0. These fields are mostly for future expansion.
1975 if ( lpGUIDDSP || lpData || dwDataSize )
1978 return DPERR_INVALIDPARAMS;
1984 ERR("Bad parameters!\n" );
1985 return CLASS_E_NOAGGREGATION;
1988 return DPL_CreateInterface( &IID_IDirectPlayLobbyA, (void**)lplpDPL );
1991 /***************************************************************************
1992 * DirectPlayLobbyCreateW (DPLAYX.5)
1995 HRESULT WINAPI DirectPlayLobbyCreateW( LPGUID lpGUIDDSP,
1996 LPDIRECTPLAYLOBBY *lplpDPL,
2001 TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08lx\n",
2002 lpGUIDDSP,lplpDPL,lpUnk,lpData,dwDataSize);
2004 /* Parameter Check: lpGUIDSP, lpUnk & lpData must be NULL. dwDataSize must
2005 * equal 0. These fields are mostly for future expansion.
2007 if ( lpGUIDDSP || lpData || dwDataSize )
2010 ERR("Bad parameters!\n" );
2011 return DPERR_INVALIDPARAMS;
2017 ERR("Bad parameters!\n" );
2018 return CLASS_E_NOAGGREGATION;
2021 return DPL_CreateInterface( &IID_IDirectPlayLobby, (void**)lplpDPL );