ntoskrnl.exe: Defer deallocation of in_buff in dispatch_ioctl.
[wine.git] / dlls / dpnet / peer.c
bloba07a59a993f020b37510905c3e51d0793ada5e76
1 /*
2 * DirectPlay8 Peer
3 *
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
24 #include "config.h"
26 #include <stdarg.h>
28 #define COBJMACROS
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wingdi.h"
32 #include "winuser.h"
33 #include "objbase.h"
34 #include "wine/debug.h"
36 #include "dplay8.h"
37 #include "dpnet_private.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
42 typedef struct IDirectPlay8PeerImpl
44 IDirectPlay8Peer IDirectPlay8Peer_iface;
45 LONG ref;
47 PFNDPNMESSAGEHANDLER msghandler;
48 DWORD flags;
49 void *usercontext;
51 DPN_SP_CAPS spcaps;
52 } IDirectPlay8PeerImpl;
54 static inline IDirectPlay8PeerImpl *impl_from_IDirectPlay8Peer(IDirectPlay8Peer *iface)
56 return CONTAINING_RECORD(iface, IDirectPlay8PeerImpl, IDirectPlay8Peer_iface);
59 /* IUnknown interface follows */
60 static HRESULT WINAPI IDirectPlay8PeerImpl_QueryInterface(IDirectPlay8Peer *iface, REFIID riid,
61 void **ppobj)
63 IDirectPlay8PeerImpl* This = impl_from_IDirectPlay8Peer(iface);
65 if(IsEqualGUID(riid, &IID_IUnknown) ||
66 IsEqualGUID(riid, &IID_IDirectPlay8Peer))
68 IUnknown_AddRef(iface);
69 *ppobj = This;
70 return DPN_OK;
73 WARN("(%p)->(%s,%p): not found\n", This, debugstr_guid(riid), ppobj);
74 return E_NOINTERFACE;
77 static ULONG WINAPI IDirectPlay8PeerImpl_AddRef(IDirectPlay8Peer *iface)
79 IDirectPlay8PeerImpl* This = impl_from_IDirectPlay8Peer(iface);
80 ULONG RefCount = InterlockedIncrement(&This->ref);
82 TRACE("(%p) ref=%d\n", This, RefCount);
84 return RefCount;
87 static ULONG WINAPI IDirectPlay8PeerImpl_Release(IDirectPlay8Peer *iface)
89 IDirectPlay8PeerImpl* This = impl_from_IDirectPlay8Peer(iface);
90 ULONG RefCount = InterlockedDecrement(&This->ref);
92 TRACE("(%p) ref=%d\n", This, RefCount);
94 if(!RefCount)
95 HeapFree(GetProcessHeap(), 0, This);
97 return RefCount;
100 /* IDirectPlay8Peer interface follows */
102 static HRESULT WINAPI IDirectPlay8PeerImpl_Initialize(IDirectPlay8Peer *iface,
103 void * const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags)
105 IDirectPlay8PeerImpl* This = impl_from_IDirectPlay8Peer(iface);
107 TRACE("(%p)->(%p,%p,%x): stub\n", iface, pvUserContext, pfn, dwFlags);
109 if(!pfn)
110 return DPNERR_INVALIDPARAM;
112 This->usercontext = pvUserContext;
113 This->msghandler = pfn;
114 This->flags = dwFlags;
116 return DPN_OK;
119 static HRESULT WINAPI IDirectPlay8PeerImpl_EnumServiceProviders(IDirectPlay8Peer *iface,
120 const GUID * const pguidServiceProvider, const GUID * const pguidApplication,
121 DPN_SERVICE_PROVIDER_INFO * const pSPInfoBuffer, DWORD * const pcbEnumData,
122 DWORD * const pcReturned, const DWORD dwFlags)
124 static const WCHAR dp_providerW[] = {'D','i','r','e','c','t','P','l','a','y','8',' ','T','C','P','/','I','P',' ',
125 'S','e','r','v','i','c','e',' ','P','r','o','v','i','d','e','r','\0'};
126 static const WCHAR dp_adapterW[] = {'L','o','c','a','l',' ','A','r','e','a',' ','C','o','n','n','e','c','t','i','o','n',
127 ' ','-',' ','I','P','v','4','\0'};
129 static const GUID adapter_guid = {0x4ce725f6, 0xd3c0, 0xdade, {0xba, 0x6f, 0x11, 0xf9, 0x65, 0xbc, 0x42, 0x99}};
130 DWORD req_size;
132 TRACE("(%p)->(%p,%p,%p,%p,%p,%x): stub\n", iface, pguidServiceProvider, pguidApplication, pSPInfoBuffer,
133 pcbEnumData, pcReturned, dwFlags);
135 if(!pcReturned || !pcbEnumData)
136 return E_POINTER;
138 if(!pguidServiceProvider)
140 req_size = sizeof(DPN_SERVICE_PROVIDER_INFO) + sizeof(dp_providerW);
142 else if(IsEqualGUID(pguidServiceProvider, &CLSID_DP8SP_TCPIP))
144 req_size = sizeof(DPN_SERVICE_PROVIDER_INFO) + sizeof(dp_adapterW);
146 else
148 FIXME("Application requested a provider we don't handle (yet)\n");
149 *pcReturned = 0;
150 return DPNERR_DOESNOTEXIST;
153 if(*pcbEnumData < req_size)
155 *pcbEnumData = req_size;
156 return DPNERR_BUFFERTOOSMALL;
159 pSPInfoBuffer->pwszName = (LPWSTR)(pSPInfoBuffer + 1);
161 if(!pguidServiceProvider)
163 lstrcpyW(pSPInfoBuffer->pwszName, dp_providerW);
164 pSPInfoBuffer->guid = CLSID_DP8SP_TCPIP;
166 else
168 lstrcpyW(pSPInfoBuffer->pwszName, dp_adapterW);
169 pSPInfoBuffer->guid = adapter_guid;
172 *pcReturned = 1;
173 return DPN_OK;
176 static HRESULT WINAPI IDirectPlay8PeerImpl_CancelAsyncOperation(IDirectPlay8Peer *iface,
177 const DPNHANDLE hAsyncHandle, const DWORD dwFlags)
179 FIXME("(%p)->(%x,%x): stub\n", iface, hAsyncHandle, dwFlags);
181 return DPNERR_GENERIC;
184 static HRESULT WINAPI IDirectPlay8PeerImpl_Connect(IDirectPlay8Peer *iface,
185 const DPN_APPLICATION_DESC * const pdnAppDesc, IDirectPlay8Address * const pHostAddr,
186 IDirectPlay8Address * const pDeviceInfo, const DPN_SECURITY_DESC * const pdnSecurity,
187 const DPN_SECURITY_CREDENTIALS * const pdnCredentials, const void * const pvUserConnectData,
188 const DWORD dwUserConnectDataSize, void * const pvPlayerContext,
189 void * const pvAsyncContext, DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
191 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);
193 return DPNERR_GENERIC;
196 static HRESULT WINAPI IDirectPlay8PeerImpl_SendTo(IDirectPlay8Peer *iface, const DPNID dpnId,
197 const DPN_BUFFER_DESC *pBufferDesc, const DWORD cBufferDesc, const DWORD dwTimeOut,
198 void * const pvAsyncContext, DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
200 FIXME("(%p)->(%x,%p,%x,%x,%p,%p,%x): stub\n", iface, dpnId, pBufferDesc, cBufferDesc, dwTimeOut, pvAsyncContext, phAsyncHandle, dwFlags);
202 return DPNERR_GENERIC;
205 static HRESULT WINAPI IDirectPlay8PeerImpl_GetSendQueueInfo(IDirectPlay8Peer *iface,
206 const DPNID dpnid, DWORD * const pdwNumMsgs, DWORD * const pdwNumBytes, const DWORD dwFlags)
208 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, dpnid, pdwNumMsgs, pdwNumBytes, dwFlags);
210 return DPNERR_GENERIC;
213 static HRESULT WINAPI IDirectPlay8PeerImpl_Host(IDirectPlay8Peer *iface,
214 const DPN_APPLICATION_DESC * const pdnAppDesc, IDirectPlay8Address ** const prgpDeviceInfo,
215 const DWORD cDeviceInfo, const DPN_SECURITY_DESC * const pdpSecurity,
216 const DPN_SECURITY_CREDENTIALS * const pdpCredentials, void * const pvPlayerContext,
217 const DWORD dwFlags)
219 FIXME("(%p)->(%p,%p,%x,%p,%p,%p,%x): stub\n", iface, pdnAppDesc, prgpDeviceInfo, cDeviceInfo, pdpSecurity, pdpCredentials, pvPlayerContext, dwFlags);
221 return DPNERR_GENERIC;
224 static HRESULT WINAPI IDirectPlay8PeerImpl_GetApplicationDesc(IDirectPlay8Peer *iface,
225 DPN_APPLICATION_DESC * const pAppDescBuffer, DWORD * const pcbDataSize, const DWORD dwFlags)
227 FIXME("(%p)->(%p,%p,%x): stub\n", iface, pAppDescBuffer, pcbDataSize, dwFlags);
229 return DPNERR_GENERIC;
232 static HRESULT WINAPI IDirectPlay8PeerImpl_SetApplicationDesc(IDirectPlay8Peer *iface,
233 const DPN_APPLICATION_DESC * const pad, const DWORD dwFlags)
235 FIXME("(%p)->(%p,%x): stub\n", iface, pad, dwFlags);
237 return DPNERR_GENERIC;
240 static HRESULT WINAPI IDirectPlay8PeerImpl_CreateGroup(IDirectPlay8Peer *iface,
241 const DPN_GROUP_INFO * const pdpnGroupInfo, void * const pvGroupContext,
242 void * const pvAsyncContext, DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
244 FIXME("(%p)->(%p,%p,%p,%p,%x): stub\n", iface, pdpnGroupInfo, pvGroupContext, pvAsyncContext, phAsyncHandle, dwFlags);
246 return DPNERR_GENERIC;
249 static HRESULT WINAPI IDirectPlay8PeerImpl_DestroyGroup(IDirectPlay8Peer *iface,
250 const DPNID idGroup, void * const pvAsyncContext, DPNHANDLE * const phAsyncHandle,
251 const DWORD dwFlags)
253 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, idGroup, pvAsyncContext, phAsyncHandle, dwFlags);
255 return DPNERR_GENERIC;
258 static HRESULT WINAPI IDirectPlay8PeerImpl_AddPlayerToGroup(IDirectPlay8Peer *iface,
259 const DPNID idGroup, const DPNID idClient, void * const pvAsyncContext,
260 DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
262 FIXME("(%p)->(%x,%x,%p,%p,%x): stub\n", iface, idGroup, idClient, pvAsyncContext, phAsyncHandle, dwFlags);
264 return DPNERR_GENERIC;
267 static HRESULT WINAPI IDirectPlay8PeerImpl_RemovePlayerFromGroup(IDirectPlay8Peer *iface,
268 const DPNID idGroup, const DPNID idClient, void * const pvAsyncContext,
269 DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
271 FIXME("(%p)->(%x,%x,%p,%p,%x): stub\n", iface, idGroup, idClient, pvAsyncContext, phAsyncHandle, dwFlags);
273 return DPNERR_GENERIC;
276 static HRESULT WINAPI IDirectPlay8PeerImpl_SetGroupInfo(IDirectPlay8Peer *iface, const DPNID dpnid,
277 DPN_GROUP_INFO * const pdpnGroupInfo, void * const pvAsyncContext,
278 DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
280 FIXME("(%p)->(%x,%p,%p,%p,%x): stub\n", iface, dpnid, pdpnGroupInfo, pvAsyncContext, phAsyncHandle, dwFlags);
282 return DPNERR_GENERIC;
285 static HRESULT WINAPI IDirectPlay8PeerImpl_GetGroupInfo(IDirectPlay8Peer *iface, const DPNID dpnid,
286 DPN_GROUP_INFO * const pdpnGroupInfo, DWORD * const pdwSize, const DWORD dwFlags)
288 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, dpnid, pdpnGroupInfo, pdwSize, dwFlags);
290 return DPNERR_GENERIC;
293 static HRESULT WINAPI IDirectPlay8PeerImpl_EnumPlayersAndGroups(IDirectPlay8Peer *iface,
294 DPNID * const prgdpnid, DWORD * const pcdpnid, const DWORD dwFlags)
296 FIXME("(%p)->(%p,%p,%x): stub\n", iface, prgdpnid, pcdpnid, dwFlags);
298 return DPNERR_GENERIC;
301 static HRESULT WINAPI IDirectPlay8PeerImpl_EnumGroupMembers(IDirectPlay8Peer *iface,
302 const DPNID dpnid, DPNID * const prgdpnid, DWORD * const pcdpnid, const DWORD dwFlags)
304 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, dpnid, prgdpnid, pcdpnid, dwFlags);
306 return DPNERR_GENERIC;
309 static HRESULT WINAPI IDirectPlay8PeerImpl_SetPeerInfo(IDirectPlay8Peer *iface,
310 const DPN_PLAYER_INFO * const pdpnPlayerInfo, void * const pvAsyncContext,
311 DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
313 FIXME("(%p)->(%p,%p,%p,%x): stub\n", iface, pdpnPlayerInfo, pvAsyncContext, phAsyncHandle, dwFlags);
315 return DPNERR_GENERIC;
318 static HRESULT WINAPI IDirectPlay8PeerImpl_GetPeerInfo(IDirectPlay8Peer *iface, const DPNID dpnid,
319 DPN_PLAYER_INFO * const pdpnPlayerInfo, DWORD * const pdwSize, const DWORD dwFlags)
321 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, dpnid, pdpnPlayerInfo, pdwSize, dwFlags);
323 return DPNERR_GENERIC;
326 static HRESULT WINAPI IDirectPlay8PeerImpl_GetPeerAddress(IDirectPlay8Peer *iface,
327 const DPNID dpnid, IDirectPlay8Address ** const pAddress, const DWORD dwFlags)
329 FIXME("(%p)->(%x,%p,%x): stub\n", iface, dpnid, pAddress, dwFlags);
331 return DPNERR_GENERIC;
334 static HRESULT WINAPI IDirectPlay8PeerImpl_GetLocalHostAddresses(IDirectPlay8Peer *iface,
335 IDirectPlay8Address ** const prgpAddress, DWORD * const pcAddress, const DWORD dwFlags)
337 FIXME("(%p)->(%p,%p,%x): stub\n", iface, prgpAddress, pcAddress, dwFlags);
339 return DPNERR_GENERIC;
342 static HRESULT WINAPI IDirectPlay8PeerImpl_Close(IDirectPlay8Peer *iface, const DWORD dwFlags)
344 FIXME("(%p)->(%x): stub\n", iface, dwFlags);
346 return DPN_OK;
349 static HRESULT WINAPI IDirectPlay8PeerImpl_EnumHosts(IDirectPlay8Peer *iface,
350 PDPN_APPLICATION_DESC const pApplicationDesc, IDirectPlay8Address * const pAddrHost,
351 IDirectPlay8Address * const pDeviceInfo, void * const pUserEnumData,
352 const DWORD dwUserEnumDataSize, const DWORD dwEnumCount, const DWORD dwRetryInterval,
353 const DWORD dwTimeOut, void * const pvUserContext, DPNHANDLE * const pAsyncHandle, const DWORD dwFlags)
355 FIXME("(%p)->(%p,%p,%p,%p,%x,%x,%x,%x,%p,%p,%x): stub\n",
356 iface, pApplicationDesc, pAddrHost, pDeviceInfo, pUserEnumData, dwUserEnumDataSize, dwEnumCount,
357 dwRetryInterval, dwTimeOut, pvUserContext, pAsyncHandle, dwFlags);
359 return DPNERR_GENERIC;
362 static HRESULT WINAPI IDirectPlay8PeerImpl_DestroyPeer(IDirectPlay8Peer *iface, const DPNID dpnidClient,
363 const void * const pvDestroyData, const DWORD dwDestroyDataSize, const DWORD dwFlags)
365 FIXME("(%p)->(%x,%p,%x,%x): stub\n", iface, dpnidClient, pvDestroyData, dwDestroyDataSize, dwFlags);
367 return DPNERR_GENERIC;
370 static HRESULT WINAPI IDirectPlay8PeerImpl_ReturnBuffer(IDirectPlay8Peer *iface, const DPNHANDLE hBufferHandle,
371 const DWORD dwFlags)
373 FIXME("(%p)->(%x,%x): stub\n", iface, hBufferHandle, dwFlags);
375 return DPNERR_GENERIC;
378 static HRESULT WINAPI IDirectPlay8PeerImpl_GetPlayerContext(IDirectPlay8Peer *iface, const DPNID dpnid,
379 void ** const ppvPlayerContext, const DWORD dwFlags)
381 FIXME("(%p)->(%x,%p,%x): stub\n", iface, dpnid, ppvPlayerContext, dwFlags);
383 return DPNERR_GENERIC;
386 static HRESULT WINAPI IDirectPlay8PeerImpl_GetGroupContext(IDirectPlay8Peer *iface, const DPNID dpnid,
387 void ** const ppvGroupContext, const DWORD dwFlags)
389 FIXME("(%p)->(%x,%p,%x): stub\n", iface, dpnid, ppvGroupContext, dwFlags);
391 return DPNERR_GENERIC;
394 static HRESULT WINAPI IDirectPlay8PeerImpl_GetCaps(IDirectPlay8Peer *iface, DPN_CAPS * const pdpCaps,
395 const DWORD dwFlags)
397 FIXME("(%p)->(%p,%x): stub\n", iface, pdpCaps, dwFlags);
399 return DPNERR_GENERIC;
402 static HRESULT WINAPI IDirectPlay8PeerImpl_SetCaps(IDirectPlay8Peer *iface, const DPN_CAPS * const pdpCaps,
403 const DWORD dwFlags)
405 FIXME("(%p)->(%p,%x): stub\n", iface, pdpCaps, dwFlags);
407 return DPNERR_GENERIC;
410 static HRESULT WINAPI IDirectPlay8PeerImpl_SetSPCaps(IDirectPlay8Peer *iface, const GUID * const pguidSP,
411 const DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags )
413 FIXME("(%p)->(%p,%p,%x): stub\n", iface, pguidSP, pdpspCaps, dwFlags);
415 return DPNERR_GENERIC;
418 static HRESULT WINAPI IDirectPlay8PeerImpl_GetSPCaps(IDirectPlay8Peer *iface, const GUID * const pguidSP,
419 DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags)
421 IDirectPlay8PeerImpl* This = impl_from_IDirectPlay8Peer(iface);
423 TRACE("(%p)->(%p,%p,%x)\n", This, pguidSP, pdpspCaps, dwFlags);
425 if(!This->msghandler)
426 return DPNERR_UNINITIALIZED;
428 if(pdpspCaps->dwSize != sizeof(DPN_SP_CAPS))
430 return DPNERR_INVALIDPARAM;
433 *pdpspCaps = This->spcaps;
435 return DPN_OK;
438 static HRESULT WINAPI IDirectPlay8PeerImpl_GetConnectionInfo(IDirectPlay8Peer *iface, const DPNID dpnid,
439 DPN_CONNECTION_INFO * const pdpConnectionInfo, const DWORD dwFlags)
441 FIXME("(%p)->(%x,%p,%x): stub\n", iface, dpnid, pdpConnectionInfo, dwFlags);
443 return DPNERR_GENERIC;
446 static HRESULT WINAPI IDirectPlay8PeerImpl_RegisterLobby(IDirectPlay8Peer *iface, const DPNHANDLE dpnHandle,
447 struct IDirectPlay8LobbiedApplication * const pIDP8LobbiedApplication, const DWORD dwFlags)
449 FIXME("(%p)->(%x,%p,%x): stub\n", iface, dpnHandle, pIDP8LobbiedApplication, dwFlags);
451 return DPNERR_GENERIC;
454 static HRESULT WINAPI IDirectPlay8PeerImpl_TerminateSession(IDirectPlay8Peer *iface, void * const pvTerminateData,
455 const DWORD dwTerminateDataSize, const DWORD dwFlags)
457 FIXME("(%p)->(%p,%x,%x): stub\n", iface, pvTerminateData, dwTerminateDataSize, dwFlags);
459 return DPNERR_GENERIC;
462 static const IDirectPlay8PeerVtbl DirectPlay8Peer_Vtbl =
464 IDirectPlay8PeerImpl_QueryInterface,
465 IDirectPlay8PeerImpl_AddRef,
466 IDirectPlay8PeerImpl_Release,
467 IDirectPlay8PeerImpl_Initialize,
468 IDirectPlay8PeerImpl_EnumServiceProviders,
469 IDirectPlay8PeerImpl_CancelAsyncOperation,
470 IDirectPlay8PeerImpl_Connect,
471 IDirectPlay8PeerImpl_SendTo,
472 IDirectPlay8PeerImpl_GetSendQueueInfo,
473 IDirectPlay8PeerImpl_Host,
474 IDirectPlay8PeerImpl_GetApplicationDesc,
475 IDirectPlay8PeerImpl_SetApplicationDesc,
476 IDirectPlay8PeerImpl_CreateGroup,
477 IDirectPlay8PeerImpl_DestroyGroup,
478 IDirectPlay8PeerImpl_AddPlayerToGroup,
479 IDirectPlay8PeerImpl_RemovePlayerFromGroup,
480 IDirectPlay8PeerImpl_SetGroupInfo,
481 IDirectPlay8PeerImpl_GetGroupInfo,
482 IDirectPlay8PeerImpl_EnumPlayersAndGroups,
483 IDirectPlay8PeerImpl_EnumGroupMembers,
484 IDirectPlay8PeerImpl_SetPeerInfo,
485 IDirectPlay8PeerImpl_GetPeerInfo,
486 IDirectPlay8PeerImpl_GetPeerAddress,
487 IDirectPlay8PeerImpl_GetLocalHostAddresses,
488 IDirectPlay8PeerImpl_Close,
489 IDirectPlay8PeerImpl_EnumHosts,
490 IDirectPlay8PeerImpl_DestroyPeer,
491 IDirectPlay8PeerImpl_ReturnBuffer,
492 IDirectPlay8PeerImpl_GetPlayerContext,
493 IDirectPlay8PeerImpl_GetGroupContext,
494 IDirectPlay8PeerImpl_GetCaps,
495 IDirectPlay8PeerImpl_SetCaps,
496 IDirectPlay8PeerImpl_SetSPCaps,
497 IDirectPlay8PeerImpl_GetSPCaps,
498 IDirectPlay8PeerImpl_GetConnectionInfo,
499 IDirectPlay8PeerImpl_RegisterLobby,
500 IDirectPlay8PeerImpl_TerminateSession
503 void init_dpn_sp_caps(DPN_SP_CAPS *dpnspcaps)
505 dpnspcaps->dwFlags = DPNSPCAPS_SUPPORTSDPNSRV | DPNSPCAPS_SUPPORTSBROADCAST |
506 DPNSPCAPS_SUPPORTSALLADAPTERS | DPNSPCAPS_SUPPORTSTHREADPOOL;
507 dpnspcaps->dwNumThreads = 3;
508 dpnspcaps->dwDefaultEnumCount = 5;
509 dpnspcaps->dwDefaultEnumRetryInterval = 1500;
510 dpnspcaps->dwDefaultEnumTimeout = 1500;
511 dpnspcaps->dwMaxEnumPayloadSize = 983;
512 dpnspcaps->dwBuffersPerThread = 1;
513 dpnspcaps->dwSystemBufferSize = 0x10000;
516 HRESULT DPNET_CreateDirectPlay8Peer(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, LPVOID *ppobj)
518 IDirectPlay8PeerImpl* Client;
519 HRESULT ret;
521 Client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8PeerImpl));
523 *ppobj = NULL;
525 if(Client == NULL)
527 WARN("Not enough memory\n");
528 return E_OUTOFMEMORY;
531 Client->IDirectPlay8Peer_iface.lpVtbl = &DirectPlay8Peer_Vtbl;
532 Client->ref = 1;
533 Client->usercontext = NULL;
534 Client->msghandler = NULL;
535 Client->flags = 0;
537 init_dpn_sp_caps(&Client->spcaps);
539 ret = IDirectPlay8Peer_QueryInterface(&Client->IDirectPlay8Peer_iface, riid, ppobj);
540 IDirectPlay8Peer_Release(&Client->IDirectPlay8Peer_iface);
542 return ret;