4 * Copyright 2004 Raphael Junqueira
5 * Copyright 2008 Alexander N. Sørnes <alex@thehandofagony.com>
6 * Copyright 2011 Louis Lenders
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/debug.h"
35 #include "dpnet_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(dpnet
);
40 typedef struct IDirectPlay8PeerImpl
42 IDirectPlay8Peer IDirectPlay8Peer_iface
;
45 PFNDPNMESSAGEHANDLER msghandler
;
54 } IDirectPlay8PeerImpl
;
56 static inline IDirectPlay8PeerImpl
*impl_from_IDirectPlay8Peer(IDirectPlay8Peer
*iface
)
58 return CONTAINING_RECORD(iface
, IDirectPlay8PeerImpl
, IDirectPlay8Peer_iface
);
61 /* IUnknown interface follows */
62 static HRESULT WINAPI
IDirectPlay8PeerImpl_QueryInterface(IDirectPlay8Peer
*iface
, REFIID riid
,
65 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
67 if(IsEqualGUID(riid
, &IID_IUnknown
) ||
68 IsEqualGUID(riid
, &IID_IDirectPlay8Peer
))
70 IUnknown_AddRef(iface
);
75 WARN("(%p)->(%s,%p): not found\n", This
, debugstr_guid(riid
), ppobj
);
79 static ULONG WINAPI
IDirectPlay8PeerImpl_AddRef(IDirectPlay8Peer
*iface
)
81 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
82 ULONG RefCount
= InterlockedIncrement(&This
->ref
);
84 TRACE("(%p) ref=%d\n", This
, RefCount
);
89 static ULONG WINAPI
IDirectPlay8PeerImpl_Release(IDirectPlay8Peer
*iface
)
91 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
92 ULONG RefCount
= InterlockedDecrement(&This
->ref
);
94 TRACE("(%p) ref=%d\n", This
, RefCount
);
98 heap_free(This
->username
);
99 heap_free(This
->data
);
107 /* IDirectPlay8Peer interface follows */
109 static HRESULT WINAPI
IDirectPlay8PeerImpl_Initialize(IDirectPlay8Peer
*iface
,
110 void * const pvUserContext
, const PFNDPNMESSAGEHANDLER pfn
, const DWORD dwFlags
)
112 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
114 TRACE("(%p)->(%p,%p,%x): stub\n", iface
, pvUserContext
, pfn
, dwFlags
);
117 return DPNERR_INVALIDPARAM
;
119 This
->usercontext
= pvUserContext
;
120 This
->msghandler
= pfn
;
121 This
->flags
= dwFlags
;
128 HRESULT
enum_services_providers(const GUID
* const service
, DPN_SERVICE_PROVIDER_INFO
* const info_buffer
,
129 DWORD
* const buf_size
, DWORD
* const returned
)
131 static const WCHAR serviceproviders
[] = {'S','O','F','T','W','A','R','E','\\','M','i','c','r','o','s','o','f','t','\\',
132 'D','i','r','e','c','t','P','l','a','y','8','\\',
133 'S','e','r','v','i','c','e',' ','P','r','o','v','i','d','e','r','s',0};
134 static const WCHAR friendly
[] = {'F','r','i','e','n','d','l','y',' ','N','a','m','e',0};
135 static const WCHAR dp_adapterW
[] = {'L','o','c','a','l',' ','A','r','e','a',' ','C','o','n','n','e','c','t','i','o','n',
136 ' ','-',' ','I','P','v','4',0};
137 static const GUID adapter_guid
= {0x4ce725f6, 0xd3c0, 0xdade, {0xba, 0x6f, 0x11, 0xf9, 0x65, 0xbc, 0x42, 0x99}};
143 WCHAR provider
[MAX_PATH
];
146 if(!returned
|| !buf_size
)
153 res
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
, serviceproviders
, 0, KEY_READ
, &key
);
154 if(res
== ERROR_FILE_NOT_FOUND
)
155 return DPNERR_DOESNOTEXIST
;
157 next_key
= RegEnumKeyW( key
, index
, provider
, MAX_PATH
);
158 while(next_key
== ERROR_SUCCESS
)
161 res
= RegGetValueW(key
, provider
, friendly
, RRF_RT_REG_SZ
, NULL
, NULL
, &size
);
162 if(res
== ERROR_SUCCESS
)
164 req_size
+= sizeof(DPN_SERVICE_PROVIDER_INFO
) + size
;
170 next_key
= RegEnumKeyW( key
, index
, provider
, MAX_PATH
);
174 else if(IsEqualGUID(service
, &CLSID_DP8SP_TCPIP
))
176 req_size
= sizeof(DPN_SERVICE_PROVIDER_INFO
) + sizeof(dp_adapterW
);
180 FIXME("Application requested a provider we don't handle (yet)\n");
181 return DPNERR_DOESNOTEXIST
;
184 if(*buf_size
< req_size
)
188 *buf_size
= req_size
;
189 return DPNERR_BUFFERTOOSMALL
;
196 char *infoend
= ((char *)info_buffer
+ (sizeof(DPN_SERVICE_PROVIDER_INFO
) * (*returned
)));
199 next_key
= RegEnumKeyW( key
, index
, provider
, MAX_PATH
);
200 while(next_key
== ERROR_SUCCESS
)
203 res
= RegGetValueW(key
, provider
, friendly
, RRF_RT_REG_SZ
, NULL
, NULL
, &size
);
204 if(res
== ERROR_SUCCESS
)
206 info_buffer
[count
].guid
= CLSID_DP8SP_TCPIP
;
207 info_buffer
[count
].pwszName
= (LPWSTR
)(infoend
+ offset
);
209 RegGetValueW(key
, provider
, friendly
, RRF_RT_REG_SZ
, NULL
, info_buffer
[count
].pwszName
, &size
);
216 next_key
= RegEnumKeyW(key
, index
, provider
, MAX_PATH
);
221 info_buffer
->pwszName
= (LPWSTR
)(info_buffer
+ 1);
222 lstrcpyW(info_buffer
->pwszName
, dp_adapterW
);
223 info_buffer
->guid
= adapter_guid
;
232 static HRESULT WINAPI
IDirectPlay8PeerImpl_EnumServiceProviders(IDirectPlay8Peer
*iface
,
233 const GUID
* const pguidServiceProvider
, const GUID
* const pguidApplication
,
234 DPN_SERVICE_PROVIDER_INFO
* const pSPInfoBuffer
, DWORD
* const pcbEnumData
,
235 DWORD
* const pcReturned
, const DWORD dwFlags
)
237 TRACE("(%p)->(%s,%s,%p,%p,%p,%x)\n", iface
, debugstr_guid(pguidServiceProvider
), debugstr_guid(pguidApplication
),
238 pSPInfoBuffer
, pcbEnumData
, pcReturned
, dwFlags
);
241 FIXME("Unhandled flags %x\n", dwFlags
);
244 FIXME("Application guid %s is currently being ignored\n", debugstr_guid(pguidApplication
));
246 return enum_services_providers(pguidServiceProvider
, pSPInfoBuffer
, pcbEnumData
, pcReturned
);
249 static HRESULT WINAPI
IDirectPlay8PeerImpl_CancelAsyncOperation(IDirectPlay8Peer
*iface
,
250 const DPNHANDLE hAsyncHandle
, const DWORD dwFlags
)
252 FIXME("(%p)->(%x,%x): stub\n", iface
, hAsyncHandle
, dwFlags
);
254 return DPNERR_GENERIC
;
257 static HRESULT WINAPI
IDirectPlay8PeerImpl_Connect(IDirectPlay8Peer
*iface
,
258 const DPN_APPLICATION_DESC
* const pdnAppDesc
, IDirectPlay8Address
* const pHostAddr
,
259 IDirectPlay8Address
* const pDeviceInfo
, const DPN_SECURITY_DESC
* const pdnSecurity
,
260 const DPN_SECURITY_CREDENTIALS
* const pdnCredentials
, const void * const pvUserConnectData
,
261 const DWORD dwUserConnectDataSize
, void * const pvPlayerContext
,
262 void * const pvAsyncContext
, DPNHANDLE
* const phAsyncHandle
, const DWORD dwFlags
)
264 FIXME("(%p)->(%p,%p,%p,%p,%p,%p,%x,%p,%p,%p,%x): stub\n", iface
, pdnAppDesc
, pHostAddr
, pDeviceInfo
, pdnSecurity
, pdnCredentials
, pvUserConnectData
, dwUserConnectDataSize
, pvPlayerContext
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
266 return DPNERR_GENERIC
;
269 static HRESULT WINAPI
IDirectPlay8PeerImpl_SendTo(IDirectPlay8Peer
*iface
, const DPNID dpnId
,
270 const DPN_BUFFER_DESC
*pBufferDesc
, const DWORD cBufferDesc
, const DWORD dwTimeOut
,
271 void * const pvAsyncContext
, DPNHANDLE
* const phAsyncHandle
, const DWORD dwFlags
)
273 FIXME("(%p)->(%x,%p,%x,%x,%p,%p,%x): stub\n", iface
, dpnId
, pBufferDesc
, cBufferDesc
, dwTimeOut
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
275 return DPNERR_GENERIC
;
278 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetSendQueueInfo(IDirectPlay8Peer
*iface
,
279 const DPNID dpnid
, DWORD
* const pdwNumMsgs
, DWORD
* const pdwNumBytes
, const DWORD dwFlags
)
281 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface
, dpnid
, pdwNumMsgs
, pdwNumBytes
, dwFlags
);
283 return DPNERR_GENERIC
;
286 static HRESULT WINAPI
IDirectPlay8PeerImpl_Host(IDirectPlay8Peer
*iface
,
287 const DPN_APPLICATION_DESC
* const pdnAppDesc
, IDirectPlay8Address
** const prgpDeviceInfo
,
288 const DWORD cDeviceInfo
, const DPN_SECURITY_DESC
* const pdpSecurity
,
289 const DPN_SECURITY_CREDENTIALS
* const pdpCredentials
, void * const pvPlayerContext
,
292 FIXME("(%p)->(%p,%p,%x,%p,%p,%p,%x): stub\n", iface
, pdnAppDesc
, prgpDeviceInfo
, cDeviceInfo
, pdpSecurity
, pdpCredentials
, pvPlayerContext
, dwFlags
);
294 return DPNERR_GENERIC
;
297 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetApplicationDesc(IDirectPlay8Peer
*iface
,
298 DPN_APPLICATION_DESC
* const pAppDescBuffer
, DWORD
* const pcbDataSize
, const DWORD dwFlags
)
300 FIXME("(%p)->(%p,%p,%x): stub\n", iface
, pAppDescBuffer
, pcbDataSize
, dwFlags
);
302 return DPNERR_GENERIC
;
305 static HRESULT WINAPI
IDirectPlay8PeerImpl_SetApplicationDesc(IDirectPlay8Peer
*iface
,
306 const DPN_APPLICATION_DESC
* const pad
, const DWORD dwFlags
)
308 FIXME("(%p)->(%p,%x): stub\n", iface
, pad
, dwFlags
);
310 return DPNERR_GENERIC
;
313 static HRESULT WINAPI
IDirectPlay8PeerImpl_CreateGroup(IDirectPlay8Peer
*iface
,
314 const DPN_GROUP_INFO
* const pdpnGroupInfo
, void * const pvGroupContext
,
315 void * const pvAsyncContext
, DPNHANDLE
* const phAsyncHandle
, const DWORD dwFlags
)
317 FIXME("(%p)->(%p,%p,%p,%p,%x): stub\n", iface
, pdpnGroupInfo
, pvGroupContext
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
319 return DPNERR_GENERIC
;
322 static HRESULT WINAPI
IDirectPlay8PeerImpl_DestroyGroup(IDirectPlay8Peer
*iface
,
323 const DPNID idGroup
, void * const pvAsyncContext
, DPNHANDLE
* const phAsyncHandle
,
326 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface
, idGroup
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
328 return DPNERR_GENERIC
;
331 static HRESULT WINAPI
IDirectPlay8PeerImpl_AddPlayerToGroup(IDirectPlay8Peer
*iface
,
332 const DPNID idGroup
, const DPNID idClient
, void * const pvAsyncContext
,
333 DPNHANDLE
* const phAsyncHandle
, const DWORD dwFlags
)
335 FIXME("(%p)->(%x,%x,%p,%p,%x): stub\n", iface
, idGroup
, idClient
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
337 return DPNERR_GENERIC
;
340 static HRESULT WINAPI
IDirectPlay8PeerImpl_RemovePlayerFromGroup(IDirectPlay8Peer
*iface
,
341 const DPNID idGroup
, const DPNID idClient
, void * const pvAsyncContext
,
342 DPNHANDLE
* const phAsyncHandle
, const DWORD dwFlags
)
344 FIXME("(%p)->(%x,%x,%p,%p,%x): stub\n", iface
, idGroup
, idClient
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
346 return DPNERR_GENERIC
;
349 static HRESULT WINAPI
IDirectPlay8PeerImpl_SetGroupInfo(IDirectPlay8Peer
*iface
, const DPNID dpnid
,
350 DPN_GROUP_INFO
* const pdpnGroupInfo
, void * const pvAsyncContext
,
351 DPNHANDLE
* const phAsyncHandle
, const DWORD dwFlags
)
353 FIXME("(%p)->(%x,%p,%p,%p,%x): stub\n", iface
, dpnid
, pdpnGroupInfo
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
355 return DPNERR_GENERIC
;
358 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetGroupInfo(IDirectPlay8Peer
*iface
, const DPNID dpnid
,
359 DPN_GROUP_INFO
* const pdpnGroupInfo
, DWORD
* const pdwSize
, const DWORD dwFlags
)
361 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface
, dpnid
, pdpnGroupInfo
, pdwSize
, dwFlags
);
363 return DPNERR_GENERIC
;
366 static HRESULT WINAPI
IDirectPlay8PeerImpl_EnumPlayersAndGroups(IDirectPlay8Peer
*iface
,
367 DPNID
* const prgdpnid
, DWORD
* const pcdpnid
, const DWORD dwFlags
)
369 FIXME("(%p)->(%p,%p,%x): stub\n", iface
, prgdpnid
, pcdpnid
, dwFlags
);
371 return DPNERR_GENERIC
;
374 static HRESULT WINAPI
IDirectPlay8PeerImpl_EnumGroupMembers(IDirectPlay8Peer
*iface
,
375 const DPNID dpnid
, DPNID
* const prgdpnid
, DWORD
* const pcdpnid
, const DWORD dwFlags
)
377 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface
, dpnid
, prgdpnid
, pcdpnid
, dwFlags
);
379 return DPNERR_GENERIC
;
382 static HRESULT WINAPI
IDirectPlay8PeerImpl_SetPeerInfo(IDirectPlay8Peer
*iface
,
383 const DPN_PLAYER_INFO
* const pdpnPlayerInfo
, void * const pvAsyncContext
,
384 DPNHANDLE
* const phAsyncHandle
, const DWORD dwFlags
)
386 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
388 FIXME("(%p)->(%p,%p,%p,%x) Semi-stub.\n", This
, pdpnPlayerInfo
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
394 FIXME("Async handle currently not supported.\n");
396 if (pdpnPlayerInfo
->dwInfoFlags
& DPNINFO_NAME
)
398 heap_free(This
->username
);
399 This
->username
= NULL
;
401 if(pdpnPlayerInfo
->pwszName
)
403 This
->username
= heap_strdupW(pdpnPlayerInfo
->pwszName
);
405 return E_OUTOFMEMORY
;
409 if (pdpnPlayerInfo
->dwInfoFlags
& DPNINFO_DATA
)
411 heap_free(This
->data
);
413 This
->datasize
= pdpnPlayerInfo
->dwDataSize
;
414 This
->data
= heap_alloc(pdpnPlayerInfo
->dwDataSize
);
416 return E_OUTOFMEMORY
;
418 memcpy(This
->data
, pdpnPlayerInfo
->pvData
, pdpnPlayerInfo
->dwDataSize
);
424 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetPeerInfo(IDirectPlay8Peer
*iface
, const DPNID dpnid
,
425 DPN_PLAYER_INFO
* const pdpnPlayerInfo
, DWORD
* const pdwSize
, const DWORD dwFlags
)
427 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface
, dpnid
, pdpnPlayerInfo
, pdwSize
, dwFlags
);
429 return DPNERR_GENERIC
;
432 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetPeerAddress(IDirectPlay8Peer
*iface
,
433 const DPNID dpnid
, IDirectPlay8Address
** const pAddress
, const DWORD dwFlags
)
435 FIXME("(%p)->(%x,%p,%x): stub\n", iface
, dpnid
, pAddress
, dwFlags
);
437 return DPNERR_GENERIC
;
440 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetLocalHostAddresses(IDirectPlay8Peer
*iface
,
441 IDirectPlay8Address
** const prgpAddress
, DWORD
* const pcAddress
, const DWORD dwFlags
)
443 FIXME("(%p)->(%p,%p,%x): stub\n", iface
, prgpAddress
, pcAddress
, dwFlags
);
445 return DPNERR_GENERIC
;
448 static HRESULT WINAPI
IDirectPlay8PeerImpl_Close(IDirectPlay8Peer
*iface
, const DWORD dwFlags
)
450 FIXME("(%p)->(%x): stub\n", iface
, dwFlags
);
455 static HRESULT WINAPI
IDirectPlay8PeerImpl_EnumHosts(IDirectPlay8Peer
*iface
,
456 PDPN_APPLICATION_DESC
const pApplicationDesc
, IDirectPlay8Address
* const pAddrHost
,
457 IDirectPlay8Address
* const pDeviceInfo
, void * const pUserEnumData
,
458 const DWORD dwUserEnumDataSize
, const DWORD dwEnumCount
, const DWORD dwRetryInterval
,
459 const DWORD dwTimeOut
, void * const pvUserContext
, DPNHANDLE
* const pAsyncHandle
, const DWORD dwFlags
)
461 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
463 FIXME("(%p)->(%p,%p,%p,%p,%x,%x,%x,%x,%p,%p,%x): stub\n",
464 This
, pApplicationDesc
, pAddrHost
, pDeviceInfo
, pUserEnumData
, dwUserEnumDataSize
, dwEnumCount
,
465 dwRetryInterval
, dwTimeOut
, pvUserContext
, pAsyncHandle
, dwFlags
);
467 if(!This
->msghandler
)
468 return DPNERR_UNINITIALIZED
;
470 if((dwFlags
& DPNENUMHOSTS_SYNC
) && pAsyncHandle
)
471 return DPNERR_INVALIDPARAM
;
473 if(dwUserEnumDataSize
> This
->spcaps
.dwMaxEnumPayloadSize
)
474 return DPNERR_ENUMQUERYTOOLARGE
;
476 return (dwFlags
& DPNENUMHOSTS_SYNC
) ? DPN_OK
: DPNSUCCESS_PENDING
;
479 static HRESULT WINAPI
IDirectPlay8PeerImpl_DestroyPeer(IDirectPlay8Peer
*iface
, const DPNID dpnidClient
,
480 const void * const pvDestroyData
, const DWORD dwDestroyDataSize
, const DWORD dwFlags
)
482 FIXME("(%p)->(%x,%p,%x,%x): stub\n", iface
, dpnidClient
, pvDestroyData
, dwDestroyDataSize
, dwFlags
);
484 return DPNERR_GENERIC
;
487 static HRESULT WINAPI
IDirectPlay8PeerImpl_ReturnBuffer(IDirectPlay8Peer
*iface
, const DPNHANDLE hBufferHandle
,
490 FIXME("(%p)->(%x,%x): stub\n", iface
, hBufferHandle
, dwFlags
);
492 return DPNERR_GENERIC
;
495 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetPlayerContext(IDirectPlay8Peer
*iface
, const DPNID dpnid
,
496 void ** const ppvPlayerContext
, const DWORD dwFlags
)
498 FIXME("(%p)->(%x,%p,%x): stub\n", iface
, dpnid
, ppvPlayerContext
, dwFlags
);
500 return DPNERR_GENERIC
;
503 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetGroupContext(IDirectPlay8Peer
*iface
, const DPNID dpnid
,
504 void ** const ppvGroupContext
, const DWORD dwFlags
)
506 FIXME("(%p)->(%x,%p,%x): stub\n", iface
, dpnid
, ppvGroupContext
, dwFlags
);
508 return DPNERR_GENERIC
;
511 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetCaps(IDirectPlay8Peer
*iface
, DPN_CAPS
* const pdpCaps
,
514 FIXME("(%p)->(%p,%x): stub\n", iface
, pdpCaps
, dwFlags
);
516 return DPNERR_GENERIC
;
519 static HRESULT WINAPI
IDirectPlay8PeerImpl_SetCaps(IDirectPlay8Peer
*iface
, const DPN_CAPS
* const pdpCaps
,
522 FIXME("(%p)->(%p,%x): stub\n", iface
, pdpCaps
, dwFlags
);
524 return DPNERR_GENERIC
;
527 static HRESULT WINAPI
IDirectPlay8PeerImpl_SetSPCaps(IDirectPlay8Peer
*iface
, const GUID
* const pguidSP
,
528 const DPN_SP_CAPS
* const pdpspCaps
, const DWORD dwFlags
)
530 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
532 TRACE("(%p)->(%p,%p,%x): stub\n", iface
, pguidSP
, pdpspCaps
, dwFlags
);
534 if(!This
->msghandler
|| pdpspCaps
->dwSize
!= sizeof(DPN_SP_CAPS
))
535 return DPNERR_INVALIDPARAM
;
537 /* Only dwSystemBufferSize is set by this call. */
538 This
->spcaps
.dwSystemBufferSize
= pdpspCaps
->dwSystemBufferSize
;
543 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetSPCaps(IDirectPlay8Peer
*iface
, const GUID
* const pguidSP
,
544 DPN_SP_CAPS
* const pdpspCaps
, const DWORD dwFlags
)
546 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
548 TRACE("(%p)->(%p,%p,%x)\n", This
, pguidSP
, pdpspCaps
, dwFlags
);
550 if(!This
->msghandler
)
551 return DPNERR_UNINITIALIZED
;
553 if(pdpspCaps
->dwSize
!= sizeof(DPN_SP_CAPS
))
555 return DPNERR_INVALIDPARAM
;
558 *pdpspCaps
= This
->spcaps
;
563 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetConnectionInfo(IDirectPlay8Peer
*iface
, const DPNID dpnid
,
564 DPN_CONNECTION_INFO
* const pdpConnectionInfo
, const DWORD dwFlags
)
566 FIXME("(%p)->(%x,%p,%x): stub\n", iface
, dpnid
, pdpConnectionInfo
, dwFlags
);
568 return DPNERR_GENERIC
;
571 static HRESULT WINAPI
IDirectPlay8PeerImpl_RegisterLobby(IDirectPlay8Peer
*iface
, const DPNHANDLE dpnHandle
,
572 struct IDirectPlay8LobbiedApplication
* const pIDP8LobbiedApplication
, const DWORD dwFlags
)
574 FIXME("(%p)->(%x,%p,%x): stub\n", iface
, dpnHandle
, pIDP8LobbiedApplication
, dwFlags
);
576 return DPNERR_GENERIC
;
579 static HRESULT WINAPI
IDirectPlay8PeerImpl_TerminateSession(IDirectPlay8Peer
*iface
, void * const pvTerminateData
,
580 const DWORD dwTerminateDataSize
, const DWORD dwFlags
)
582 FIXME("(%p)->(%p,%x,%x): stub\n", iface
, pvTerminateData
, dwTerminateDataSize
, dwFlags
);
584 return DPNERR_GENERIC
;
587 static const IDirectPlay8PeerVtbl DirectPlay8Peer_Vtbl
=
589 IDirectPlay8PeerImpl_QueryInterface
,
590 IDirectPlay8PeerImpl_AddRef
,
591 IDirectPlay8PeerImpl_Release
,
592 IDirectPlay8PeerImpl_Initialize
,
593 IDirectPlay8PeerImpl_EnumServiceProviders
,
594 IDirectPlay8PeerImpl_CancelAsyncOperation
,
595 IDirectPlay8PeerImpl_Connect
,
596 IDirectPlay8PeerImpl_SendTo
,
597 IDirectPlay8PeerImpl_GetSendQueueInfo
,
598 IDirectPlay8PeerImpl_Host
,
599 IDirectPlay8PeerImpl_GetApplicationDesc
,
600 IDirectPlay8PeerImpl_SetApplicationDesc
,
601 IDirectPlay8PeerImpl_CreateGroup
,
602 IDirectPlay8PeerImpl_DestroyGroup
,
603 IDirectPlay8PeerImpl_AddPlayerToGroup
,
604 IDirectPlay8PeerImpl_RemovePlayerFromGroup
,
605 IDirectPlay8PeerImpl_SetGroupInfo
,
606 IDirectPlay8PeerImpl_GetGroupInfo
,
607 IDirectPlay8PeerImpl_EnumPlayersAndGroups
,
608 IDirectPlay8PeerImpl_EnumGroupMembers
,
609 IDirectPlay8PeerImpl_SetPeerInfo
,
610 IDirectPlay8PeerImpl_GetPeerInfo
,
611 IDirectPlay8PeerImpl_GetPeerAddress
,
612 IDirectPlay8PeerImpl_GetLocalHostAddresses
,
613 IDirectPlay8PeerImpl_Close
,
614 IDirectPlay8PeerImpl_EnumHosts
,
615 IDirectPlay8PeerImpl_DestroyPeer
,
616 IDirectPlay8PeerImpl_ReturnBuffer
,
617 IDirectPlay8PeerImpl_GetPlayerContext
,
618 IDirectPlay8PeerImpl_GetGroupContext
,
619 IDirectPlay8PeerImpl_GetCaps
,
620 IDirectPlay8PeerImpl_SetCaps
,
621 IDirectPlay8PeerImpl_SetSPCaps
,
622 IDirectPlay8PeerImpl_GetSPCaps
,
623 IDirectPlay8PeerImpl_GetConnectionInfo
,
624 IDirectPlay8PeerImpl_RegisterLobby
,
625 IDirectPlay8PeerImpl_TerminateSession
628 void init_dpn_sp_caps(DPN_SP_CAPS
*dpnspcaps
)
630 dpnspcaps
->dwSize
= sizeof(DPN_SP_CAPS
);
631 dpnspcaps
->dwFlags
= DPNSPCAPS_SUPPORTSDPNSRV
| DPNSPCAPS_SUPPORTSBROADCAST
|
632 DPNSPCAPS_SUPPORTSALLADAPTERS
| DPNSPCAPS_SUPPORTSTHREADPOOL
;
633 dpnspcaps
->dwNumThreads
= 3;
634 dpnspcaps
->dwDefaultEnumCount
= 5;
635 dpnspcaps
->dwDefaultEnumRetryInterval
= 1500;
636 dpnspcaps
->dwDefaultEnumTimeout
= 1500;
637 dpnspcaps
->dwMaxEnumPayloadSize
= 983;
638 dpnspcaps
->dwBuffersPerThread
= 1;
639 dpnspcaps
->dwSystemBufferSize
= 0x10000;
642 HRESULT
DPNET_CreateDirectPlay8Peer(IClassFactory
*iface
, IUnknown
*pUnkOuter
, REFIID riid
, LPVOID
*ppobj
)
644 IDirectPlay8PeerImpl
* Client
;
647 Client
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectPlay8PeerImpl
));
653 WARN("Not enough memory\n");
654 return E_OUTOFMEMORY
;
657 Client
->IDirectPlay8Peer_iface
.lpVtbl
= &DirectPlay8Peer_Vtbl
;
659 Client
->usercontext
= NULL
;
660 Client
->msghandler
= NULL
;
663 init_dpn_sp_caps(&Client
->spcaps
);
665 ret
= IDirectPlay8Peer_QueryInterface(&Client
->IDirectPlay8Peer_iface
, riid
, ppobj
);
666 IDirectPlay8Peer_Release(&Client
->IDirectPlay8Peer_iface
);