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
34 #include "wine/debug.h"
36 #include "dpnet_private.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(dpnet
);
41 typedef struct IDirectPlay8PeerImpl
43 IDirectPlay8Peer IDirectPlay8Peer_iface
;
46 PFNDPNMESSAGEHANDLER msghandler
;
55 } IDirectPlay8PeerImpl
;
57 static inline IDirectPlay8PeerImpl
*impl_from_IDirectPlay8Peer(IDirectPlay8Peer
*iface
)
59 return CONTAINING_RECORD(iface
, IDirectPlay8PeerImpl
, IDirectPlay8Peer_iface
);
62 /* IUnknown interface follows */
63 static HRESULT WINAPI
IDirectPlay8PeerImpl_QueryInterface(IDirectPlay8Peer
*iface
, REFIID riid
,
66 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
68 if(IsEqualGUID(riid
, &IID_IUnknown
) ||
69 IsEqualGUID(riid
, &IID_IDirectPlay8Peer
))
71 IUnknown_AddRef(iface
);
76 WARN("(%p)->(%s,%p): not found\n", This
, debugstr_guid(riid
), ppobj
);
80 static ULONG WINAPI
IDirectPlay8PeerImpl_AddRef(IDirectPlay8Peer
*iface
)
82 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
83 ULONG RefCount
= InterlockedIncrement(&This
->ref
);
85 TRACE("(%p) ref=%d\n", This
, RefCount
);
90 static ULONG WINAPI
IDirectPlay8PeerImpl_Release(IDirectPlay8Peer
*iface
)
92 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
93 ULONG RefCount
= InterlockedDecrement(&This
->ref
);
95 TRACE("(%p) ref=%d\n", This
, RefCount
);
99 heap_free(This
->username
);
100 heap_free(This
->data
);
108 /* IDirectPlay8Peer interface follows */
110 static HRESULT WINAPI
IDirectPlay8PeerImpl_Initialize(IDirectPlay8Peer
*iface
,
111 void * const pvUserContext
, const PFNDPNMESSAGEHANDLER pfn
, const DWORD dwFlags
)
113 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
115 TRACE("(%p)->(%p,%p,%x): stub\n", iface
, pvUserContext
, pfn
, dwFlags
);
118 return DPNERR_INVALIDPARAM
;
120 This
->usercontext
= pvUserContext
;
121 This
->msghandler
= pfn
;
122 This
->flags
= dwFlags
;
129 HRESULT
enum_services_providers(const GUID
* const service
, DPN_SERVICE_PROVIDER_INFO
* const info_buffer
,
130 DWORD
* const buf_size
, DWORD
* const returned
)
132 static const WCHAR serviceproviders
[] = {'S','O','F','T','W','A','R','E','\\','M','i','c','r','o','s','o','f','t','\\',
133 'D','i','r','e','c','t','P','l','a','y','8','\\',
134 'S','e','r','v','i','c','e',' ','P','r','o','v','i','d','e','r','s',0};
135 static const WCHAR friendly
[] = {'F','r','i','e','n','d','l','y',' ','N','a','m','e',0};
136 static const WCHAR dp_adapterW
[] = {'L','o','c','a','l',' ','A','r','e','a',' ','C','o','n','n','e','c','t','i','o','n',
137 ' ','-',' ','I','P','v','4',0};
138 static const GUID adapter_guid
= {0x4ce725f6, 0xd3c0, 0xdade, {0xba, 0x6f, 0x11, 0xf9, 0x65, 0xbc, 0x42, 0x99}};
144 WCHAR provider
[MAX_PATH
];
147 if(!returned
|| !buf_size
)
154 res
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
, serviceproviders
, 0, KEY_READ
, &key
);
155 if(res
== ERROR_FILE_NOT_FOUND
)
156 return DPNERR_DOESNOTEXIST
;
158 next_key
= RegEnumKeyW( key
, index
, provider
, MAX_PATH
);
159 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
)
202 res
= RegGetValueW(key
, provider
, friendly
, RRF_RT_REG_SZ
, NULL
, NULL
, &size
);
203 if(res
== ERROR_SUCCESS
)
205 info_buffer
[count
].guid
= CLSID_DP8SP_TCPIP
;
206 info_buffer
[count
].pwszName
= (LPWSTR
)(infoend
+ offset
);
208 RegGetValueW(key
, provider
, friendly
, RRF_RT_REG_SZ
, NULL
, info_buffer
[count
].pwszName
, &size
);
215 next_key
= RegEnumKeyW(key
, index
, provider
, MAX_PATH
);
220 info_buffer
->pwszName
= (LPWSTR
)(info_buffer
+ 1);
221 lstrcpyW(info_buffer
->pwszName
, dp_adapterW
);
222 info_buffer
->guid
= adapter_guid
;
231 static HRESULT WINAPI
IDirectPlay8PeerImpl_EnumServiceProviders(IDirectPlay8Peer
*iface
,
232 const GUID
* const pguidServiceProvider
, const GUID
* const pguidApplication
,
233 DPN_SERVICE_PROVIDER_INFO
* const pSPInfoBuffer
, DWORD
* const pcbEnumData
,
234 DWORD
* const pcReturned
, const DWORD dwFlags
)
236 TRACE("(%p)->(%s,%s,%p,%p,%p,%x)\n", iface
, debugstr_guid(pguidServiceProvider
), debugstr_guid(pguidApplication
),
237 pSPInfoBuffer
, pcbEnumData
, pcReturned
, dwFlags
);
240 FIXME("Unhandled flags %x\n", dwFlags
);
243 FIXME("Application guid %s is currently being ignored\n", debugstr_guid(pguidApplication
));
245 return enum_services_providers(pguidServiceProvider
, pSPInfoBuffer
, pcbEnumData
, pcReturned
);
248 static HRESULT WINAPI
IDirectPlay8PeerImpl_CancelAsyncOperation(IDirectPlay8Peer
*iface
,
249 const DPNHANDLE hAsyncHandle
, const DWORD dwFlags
)
251 FIXME("(%p)->(%x,%x): stub\n", iface
, hAsyncHandle
, dwFlags
);
253 return DPNERR_GENERIC
;
256 static HRESULT WINAPI
IDirectPlay8PeerImpl_Connect(IDirectPlay8Peer
*iface
,
257 const DPN_APPLICATION_DESC
* const pdnAppDesc
, IDirectPlay8Address
* const pHostAddr
,
258 IDirectPlay8Address
* const pDeviceInfo
, const DPN_SECURITY_DESC
* const pdnSecurity
,
259 const DPN_SECURITY_CREDENTIALS
* const pdnCredentials
, const void * const pvUserConnectData
,
260 const DWORD dwUserConnectDataSize
, void * const pvPlayerContext
,
261 void * const pvAsyncContext
, DPNHANDLE
* const phAsyncHandle
, const DWORD dwFlags
)
263 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
);
265 return DPNERR_GENERIC
;
268 static HRESULT WINAPI
IDirectPlay8PeerImpl_SendTo(IDirectPlay8Peer
*iface
, const DPNID dpnId
,
269 const DPN_BUFFER_DESC
*pBufferDesc
, const DWORD cBufferDesc
, const DWORD dwTimeOut
,
270 void * const pvAsyncContext
, DPNHANDLE
* const phAsyncHandle
, const DWORD dwFlags
)
272 FIXME("(%p)->(%x,%p,%x,%x,%p,%p,%x): stub\n", iface
, dpnId
, pBufferDesc
, cBufferDesc
, dwTimeOut
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
274 return DPNERR_GENERIC
;
277 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetSendQueueInfo(IDirectPlay8Peer
*iface
,
278 const DPNID dpnid
, DWORD
* const pdwNumMsgs
, DWORD
* const pdwNumBytes
, const DWORD dwFlags
)
280 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface
, dpnid
, pdwNumMsgs
, pdwNumBytes
, dwFlags
);
282 return DPNERR_GENERIC
;
285 static HRESULT WINAPI
IDirectPlay8PeerImpl_Host(IDirectPlay8Peer
*iface
,
286 const DPN_APPLICATION_DESC
* const pdnAppDesc
, IDirectPlay8Address
** const prgpDeviceInfo
,
287 const DWORD cDeviceInfo
, const DPN_SECURITY_DESC
* const pdpSecurity
,
288 const DPN_SECURITY_CREDENTIALS
* const pdpCredentials
, void * const pvPlayerContext
,
291 FIXME("(%p)->(%p,%p,%x,%p,%p,%p,%x): stub\n", iface
, pdnAppDesc
, prgpDeviceInfo
, cDeviceInfo
, pdpSecurity
, pdpCredentials
, pvPlayerContext
, dwFlags
);
293 return DPNERR_GENERIC
;
296 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetApplicationDesc(IDirectPlay8Peer
*iface
,
297 DPN_APPLICATION_DESC
* const pAppDescBuffer
, DWORD
* const pcbDataSize
, const DWORD dwFlags
)
299 FIXME("(%p)->(%p,%p,%x): stub\n", iface
, pAppDescBuffer
, pcbDataSize
, dwFlags
);
301 return DPNERR_GENERIC
;
304 static HRESULT WINAPI
IDirectPlay8PeerImpl_SetApplicationDesc(IDirectPlay8Peer
*iface
,
305 const DPN_APPLICATION_DESC
* const pad
, const DWORD dwFlags
)
307 FIXME("(%p)->(%p,%x): stub\n", iface
, pad
, dwFlags
);
309 return DPNERR_GENERIC
;
312 static HRESULT WINAPI
IDirectPlay8PeerImpl_CreateGroup(IDirectPlay8Peer
*iface
,
313 const DPN_GROUP_INFO
* const pdpnGroupInfo
, void * const pvGroupContext
,
314 void * const pvAsyncContext
, DPNHANDLE
* const phAsyncHandle
, const DWORD dwFlags
)
316 FIXME("(%p)->(%p,%p,%p,%p,%x): stub\n", iface
, pdpnGroupInfo
, pvGroupContext
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
318 return DPNERR_GENERIC
;
321 static HRESULT WINAPI
IDirectPlay8PeerImpl_DestroyGroup(IDirectPlay8Peer
*iface
,
322 const DPNID idGroup
, void * const pvAsyncContext
, DPNHANDLE
* const phAsyncHandle
,
325 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface
, idGroup
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
327 return DPNERR_GENERIC
;
330 static HRESULT WINAPI
IDirectPlay8PeerImpl_AddPlayerToGroup(IDirectPlay8Peer
*iface
,
331 const DPNID idGroup
, const DPNID idClient
, void * const pvAsyncContext
,
332 DPNHANDLE
* const phAsyncHandle
, const DWORD dwFlags
)
334 FIXME("(%p)->(%x,%x,%p,%p,%x): stub\n", iface
, idGroup
, idClient
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
336 return DPNERR_GENERIC
;
339 static HRESULT WINAPI
IDirectPlay8PeerImpl_RemovePlayerFromGroup(IDirectPlay8Peer
*iface
,
340 const DPNID idGroup
, const DPNID idClient
, void * const pvAsyncContext
,
341 DPNHANDLE
* const phAsyncHandle
, const DWORD dwFlags
)
343 FIXME("(%p)->(%x,%x,%p,%p,%x): stub\n", iface
, idGroup
, idClient
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
345 return DPNERR_GENERIC
;
348 static HRESULT WINAPI
IDirectPlay8PeerImpl_SetGroupInfo(IDirectPlay8Peer
*iface
, const DPNID dpnid
,
349 DPN_GROUP_INFO
* const pdpnGroupInfo
, void * const pvAsyncContext
,
350 DPNHANDLE
* const phAsyncHandle
, const DWORD dwFlags
)
352 FIXME("(%p)->(%x,%p,%p,%p,%x): stub\n", iface
, dpnid
, pdpnGroupInfo
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
354 return DPNERR_GENERIC
;
357 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetGroupInfo(IDirectPlay8Peer
*iface
, const DPNID dpnid
,
358 DPN_GROUP_INFO
* const pdpnGroupInfo
, DWORD
* const pdwSize
, const DWORD dwFlags
)
360 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface
, dpnid
, pdpnGroupInfo
, pdwSize
, dwFlags
);
362 return DPNERR_GENERIC
;
365 static HRESULT WINAPI
IDirectPlay8PeerImpl_EnumPlayersAndGroups(IDirectPlay8Peer
*iface
,
366 DPNID
* const prgdpnid
, DWORD
* const pcdpnid
, const DWORD dwFlags
)
368 FIXME("(%p)->(%p,%p,%x): stub\n", iface
, prgdpnid
, pcdpnid
, dwFlags
);
370 return DPNERR_GENERIC
;
373 static HRESULT WINAPI
IDirectPlay8PeerImpl_EnumGroupMembers(IDirectPlay8Peer
*iface
,
374 const DPNID dpnid
, DPNID
* const prgdpnid
, DWORD
* const pcdpnid
, const DWORD dwFlags
)
376 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface
, dpnid
, prgdpnid
, pcdpnid
, dwFlags
);
378 return DPNERR_GENERIC
;
381 static HRESULT WINAPI
IDirectPlay8PeerImpl_SetPeerInfo(IDirectPlay8Peer
*iface
,
382 const DPN_PLAYER_INFO
* const pdpnPlayerInfo
, void * const pvAsyncContext
,
383 DPNHANDLE
* const phAsyncHandle
, const DWORD dwFlags
)
385 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
387 FIXME("(%p)->(%p,%p,%p,%x) Semi-stub.\n", This
, pdpnPlayerInfo
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
393 FIXME("Async handle currently not supported.\n");
395 if (pdpnPlayerInfo
->dwInfoFlags
& DPNINFO_NAME
)
397 heap_free(This
->username
);
398 This
->username
= NULL
;
400 if(pdpnPlayerInfo
->pwszName
)
402 This
->username
= heap_strdupW(pdpnPlayerInfo
->pwszName
);
404 return E_OUTOFMEMORY
;
408 if (pdpnPlayerInfo
->dwInfoFlags
& DPNINFO_DATA
)
410 heap_free(This
->data
);
412 This
->datasize
= pdpnPlayerInfo
->dwDataSize
;
413 This
->data
= heap_alloc(pdpnPlayerInfo
->dwDataSize
);
415 return E_OUTOFMEMORY
;
417 memcpy(This
->data
, pdpnPlayerInfo
->pvData
, pdpnPlayerInfo
->dwDataSize
);
423 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetPeerInfo(IDirectPlay8Peer
*iface
, const DPNID dpnid
,
424 DPN_PLAYER_INFO
* const pdpnPlayerInfo
, DWORD
* const pdwSize
, const DWORD dwFlags
)
426 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface
, dpnid
, pdpnPlayerInfo
, pdwSize
, dwFlags
);
428 return DPNERR_GENERIC
;
431 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetPeerAddress(IDirectPlay8Peer
*iface
,
432 const DPNID dpnid
, IDirectPlay8Address
** const pAddress
, const DWORD dwFlags
)
434 FIXME("(%p)->(%x,%p,%x): stub\n", iface
, dpnid
, pAddress
, dwFlags
);
436 return DPNERR_GENERIC
;
439 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetLocalHostAddresses(IDirectPlay8Peer
*iface
,
440 IDirectPlay8Address
** const prgpAddress
, DWORD
* const pcAddress
, const DWORD dwFlags
)
442 FIXME("(%p)->(%p,%p,%x): stub\n", iface
, prgpAddress
, pcAddress
, dwFlags
);
444 return DPNERR_GENERIC
;
447 static HRESULT WINAPI
IDirectPlay8PeerImpl_Close(IDirectPlay8Peer
*iface
, const DWORD dwFlags
)
449 FIXME("(%p)->(%x): stub\n", iface
, dwFlags
);
454 static HRESULT WINAPI
IDirectPlay8PeerImpl_EnumHosts(IDirectPlay8Peer
*iface
,
455 PDPN_APPLICATION_DESC
const pApplicationDesc
, IDirectPlay8Address
* const pAddrHost
,
456 IDirectPlay8Address
* const pDeviceInfo
, void * const pUserEnumData
,
457 const DWORD dwUserEnumDataSize
, const DWORD dwEnumCount
, const DWORD dwRetryInterval
,
458 const DWORD dwTimeOut
, void * const pvUserContext
, DPNHANDLE
* const pAsyncHandle
, const DWORD dwFlags
)
460 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
462 FIXME("(%p)->(%p,%p,%p,%p,%x,%x,%x,%x,%p,%p,%x): stub\n",
463 This
, pApplicationDesc
, pAddrHost
, pDeviceInfo
, pUserEnumData
, dwUserEnumDataSize
, dwEnumCount
,
464 dwRetryInterval
, dwTimeOut
, pvUserContext
, pAsyncHandle
, dwFlags
);
466 if(!This
->msghandler
)
467 return DPNERR_UNINITIALIZED
;
469 if((dwFlags
& DPNENUMHOSTS_SYNC
) && pAsyncHandle
)
470 return DPNERR_INVALIDPARAM
;
472 if(dwUserEnumDataSize
> This
->spcaps
.dwMaxEnumPayloadSize
)
473 return DPNERR_ENUMQUERYTOOLARGE
;
475 return (dwFlags
& DPNENUMHOSTS_SYNC
) ? DPN_OK
: DPNSUCCESS_PENDING
;
478 static HRESULT WINAPI
IDirectPlay8PeerImpl_DestroyPeer(IDirectPlay8Peer
*iface
, const DPNID dpnidClient
,
479 const void * const pvDestroyData
, const DWORD dwDestroyDataSize
, const DWORD dwFlags
)
481 FIXME("(%p)->(%x,%p,%x,%x): stub\n", iface
, dpnidClient
, pvDestroyData
, dwDestroyDataSize
, dwFlags
);
483 return DPNERR_GENERIC
;
486 static HRESULT WINAPI
IDirectPlay8PeerImpl_ReturnBuffer(IDirectPlay8Peer
*iface
, const DPNHANDLE hBufferHandle
,
489 FIXME("(%p)->(%x,%x): stub\n", iface
, hBufferHandle
, dwFlags
);
491 return DPNERR_GENERIC
;
494 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetPlayerContext(IDirectPlay8Peer
*iface
, const DPNID dpnid
,
495 void ** const ppvPlayerContext
, const DWORD dwFlags
)
497 FIXME("(%p)->(%x,%p,%x): stub\n", iface
, dpnid
, ppvPlayerContext
, dwFlags
);
499 return DPNERR_GENERIC
;
502 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetGroupContext(IDirectPlay8Peer
*iface
, const DPNID dpnid
,
503 void ** const ppvGroupContext
, const DWORD dwFlags
)
505 FIXME("(%p)->(%x,%p,%x): stub\n", iface
, dpnid
, ppvGroupContext
, dwFlags
);
507 return DPNERR_GENERIC
;
510 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetCaps(IDirectPlay8Peer
*iface
, DPN_CAPS
* const pdpCaps
,
513 FIXME("(%p)->(%p,%x): stub\n", iface
, pdpCaps
, dwFlags
);
515 return DPNERR_GENERIC
;
518 static HRESULT WINAPI
IDirectPlay8PeerImpl_SetCaps(IDirectPlay8Peer
*iface
, const DPN_CAPS
* const pdpCaps
,
521 FIXME("(%p)->(%p,%x): stub\n", iface
, pdpCaps
, dwFlags
);
523 return DPNERR_GENERIC
;
526 static HRESULT WINAPI
IDirectPlay8PeerImpl_SetSPCaps(IDirectPlay8Peer
*iface
, const GUID
* const pguidSP
,
527 const DPN_SP_CAPS
* const pdpspCaps
, const DWORD dwFlags
)
529 FIXME("(%p)->(%p,%p,%x): stub\n", iface
, pguidSP
, pdpspCaps
, dwFlags
);
531 return DPNERR_GENERIC
;
534 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetSPCaps(IDirectPlay8Peer
*iface
, const GUID
* const pguidSP
,
535 DPN_SP_CAPS
* const pdpspCaps
, const DWORD dwFlags
)
537 IDirectPlay8PeerImpl
* This
= impl_from_IDirectPlay8Peer(iface
);
539 TRACE("(%p)->(%p,%p,%x)\n", This
, pguidSP
, pdpspCaps
, dwFlags
);
541 if(!This
->msghandler
)
542 return DPNERR_UNINITIALIZED
;
544 if(pdpspCaps
->dwSize
!= sizeof(DPN_SP_CAPS
))
546 return DPNERR_INVALIDPARAM
;
549 *pdpspCaps
= This
->spcaps
;
554 static HRESULT WINAPI
IDirectPlay8PeerImpl_GetConnectionInfo(IDirectPlay8Peer
*iface
, const DPNID dpnid
,
555 DPN_CONNECTION_INFO
* const pdpConnectionInfo
, const DWORD dwFlags
)
557 FIXME("(%p)->(%x,%p,%x): stub\n", iface
, dpnid
, pdpConnectionInfo
, dwFlags
);
559 return DPNERR_GENERIC
;
562 static HRESULT WINAPI
IDirectPlay8PeerImpl_RegisterLobby(IDirectPlay8Peer
*iface
, const DPNHANDLE dpnHandle
,
563 struct IDirectPlay8LobbiedApplication
* const pIDP8LobbiedApplication
, const DWORD dwFlags
)
565 FIXME("(%p)->(%x,%p,%x): stub\n", iface
, dpnHandle
, pIDP8LobbiedApplication
, dwFlags
);
567 return DPNERR_GENERIC
;
570 static HRESULT WINAPI
IDirectPlay8PeerImpl_TerminateSession(IDirectPlay8Peer
*iface
, void * const pvTerminateData
,
571 const DWORD dwTerminateDataSize
, const DWORD dwFlags
)
573 FIXME("(%p)->(%p,%x,%x): stub\n", iface
, pvTerminateData
, dwTerminateDataSize
, dwFlags
);
575 return DPNERR_GENERIC
;
578 static const IDirectPlay8PeerVtbl DirectPlay8Peer_Vtbl
=
580 IDirectPlay8PeerImpl_QueryInterface
,
581 IDirectPlay8PeerImpl_AddRef
,
582 IDirectPlay8PeerImpl_Release
,
583 IDirectPlay8PeerImpl_Initialize
,
584 IDirectPlay8PeerImpl_EnumServiceProviders
,
585 IDirectPlay8PeerImpl_CancelAsyncOperation
,
586 IDirectPlay8PeerImpl_Connect
,
587 IDirectPlay8PeerImpl_SendTo
,
588 IDirectPlay8PeerImpl_GetSendQueueInfo
,
589 IDirectPlay8PeerImpl_Host
,
590 IDirectPlay8PeerImpl_GetApplicationDesc
,
591 IDirectPlay8PeerImpl_SetApplicationDesc
,
592 IDirectPlay8PeerImpl_CreateGroup
,
593 IDirectPlay8PeerImpl_DestroyGroup
,
594 IDirectPlay8PeerImpl_AddPlayerToGroup
,
595 IDirectPlay8PeerImpl_RemovePlayerFromGroup
,
596 IDirectPlay8PeerImpl_SetGroupInfo
,
597 IDirectPlay8PeerImpl_GetGroupInfo
,
598 IDirectPlay8PeerImpl_EnumPlayersAndGroups
,
599 IDirectPlay8PeerImpl_EnumGroupMembers
,
600 IDirectPlay8PeerImpl_SetPeerInfo
,
601 IDirectPlay8PeerImpl_GetPeerInfo
,
602 IDirectPlay8PeerImpl_GetPeerAddress
,
603 IDirectPlay8PeerImpl_GetLocalHostAddresses
,
604 IDirectPlay8PeerImpl_Close
,
605 IDirectPlay8PeerImpl_EnumHosts
,
606 IDirectPlay8PeerImpl_DestroyPeer
,
607 IDirectPlay8PeerImpl_ReturnBuffer
,
608 IDirectPlay8PeerImpl_GetPlayerContext
,
609 IDirectPlay8PeerImpl_GetGroupContext
,
610 IDirectPlay8PeerImpl_GetCaps
,
611 IDirectPlay8PeerImpl_SetCaps
,
612 IDirectPlay8PeerImpl_SetSPCaps
,
613 IDirectPlay8PeerImpl_GetSPCaps
,
614 IDirectPlay8PeerImpl_GetConnectionInfo
,
615 IDirectPlay8PeerImpl_RegisterLobby
,
616 IDirectPlay8PeerImpl_TerminateSession
619 void init_dpn_sp_caps(DPN_SP_CAPS
*dpnspcaps
)
621 dpnspcaps
->dwSize
= sizeof(DPN_SP_CAPS
);
622 dpnspcaps
->dwFlags
= DPNSPCAPS_SUPPORTSDPNSRV
| DPNSPCAPS_SUPPORTSBROADCAST
|
623 DPNSPCAPS_SUPPORTSALLADAPTERS
| DPNSPCAPS_SUPPORTSTHREADPOOL
;
624 dpnspcaps
->dwNumThreads
= 3;
625 dpnspcaps
->dwDefaultEnumCount
= 5;
626 dpnspcaps
->dwDefaultEnumRetryInterval
= 1500;
627 dpnspcaps
->dwDefaultEnumTimeout
= 1500;
628 dpnspcaps
->dwMaxEnumPayloadSize
= 983;
629 dpnspcaps
->dwBuffersPerThread
= 1;
630 dpnspcaps
->dwSystemBufferSize
= 0x10000;
633 HRESULT
DPNET_CreateDirectPlay8Peer(IClassFactory
*iface
, IUnknown
*pUnkOuter
, REFIID riid
, LPVOID
*ppobj
)
635 IDirectPlay8PeerImpl
* Client
;
638 Client
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectPlay8PeerImpl
));
644 WARN("Not enough memory\n");
645 return E_OUTOFMEMORY
;
648 Client
->IDirectPlay8Peer_iface
.lpVtbl
= &DirectPlay8Peer_Vtbl
;
650 Client
->usercontext
= NULL
;
651 Client
->msghandler
= NULL
;
654 init_dpn_sp_caps(&Client
->spcaps
);
656 ret
= IDirectPlay8Peer_QueryInterface(&Client
->IDirectPlay8Peer_iface
, riid
, ppobj
);
657 IDirectPlay8Peer_Release(&Client
->IDirectPlay8Peer_iface
);