winex11: Use the create_pixmap_from_image helper to select DIB pattern brushes.
[wine] / dlls / dpnet / peer.c
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
7  *
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.
12  *
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.
17  *
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
21  *
22  */
23
24 #include "config.h"
25
26 #include <stdarg.h>
27
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"
35
36 #include "dplay8.h"
37 #include "dpnet_private.h"
38
39 WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
40
41 static inline IDirectPlay8PeerImpl *impl_from_IDirectPlay8Peer(IDirectPlay8Peer *iface)
42 {
43     return CONTAINING_RECORD(iface, IDirectPlay8PeerImpl, IDirectPlay8Peer_iface);
44 }
45
46 /* IUnknown interface follows */
47 static HRESULT WINAPI IDirectPlay8PeerImpl_QueryInterface(IDirectPlay8Peer *iface, REFIID riid,
48         void **ppobj)
49 {
50     IDirectPlay8PeerImpl* This = impl_from_IDirectPlay8Peer(iface);
51
52     if(IsEqualGUID(riid, &IID_IUnknown) ||
53        IsEqualGUID(riid, &IID_IDirectPlay8Peer))
54     {
55         IUnknown_AddRef(iface);
56         *ppobj = This;
57         return DPN_OK;
58     }
59
60     WARN("(%p)->(%s,%p): not found\n", This, debugstr_guid(riid), ppobj);
61     return E_NOINTERFACE;
62 }
63
64 static ULONG WINAPI IDirectPlay8PeerImpl_AddRef(IDirectPlay8Peer *iface)
65 {
66     IDirectPlay8PeerImpl* This = impl_from_IDirectPlay8Peer(iface);
67     ULONG RefCount = InterlockedIncrement(&This->ref);
68
69     return RefCount;
70 }
71
72 static ULONG WINAPI IDirectPlay8PeerImpl_Release(IDirectPlay8Peer *iface)
73 {
74     IDirectPlay8PeerImpl* This = impl_from_IDirectPlay8Peer(iface);
75     ULONG RefCount = InterlockedDecrement(&This->ref);
76
77     if(!RefCount)
78         HeapFree(GetProcessHeap(), 0, This);
79
80     return RefCount;
81 }
82
83 /* IDirectPlay8Peer interface follows */
84
85 static HRESULT WINAPI IDirectPlay8PeerImpl_Initialize(IDirectPlay8Peer *iface,
86         void * const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags)
87 {
88     TRACE("(%p)->(%p,%p,%x): stub\n", iface, pvUserContext, pfn, dwFlags);
89
90     return DPN_OK;
91 }
92
93 static HRESULT WINAPI IDirectPlay8PeerImpl_EnumServiceProviders(IDirectPlay8Peer *iface,
94         const GUID * const pguidServiceProvider, const GUID * const pguidApplication,
95         DPN_SERVICE_PROVIDER_INFO * const pSPInfoBuffer, DWORD * const pcbEnumData,
96         DWORD * const pcReturned, const DWORD dwFlags)
97 {
98     static const WCHAR dp_providerW[] = {'D','i','r','e','c','t','P','l','a','y','8',' ','T','C','P','/','I','P',' ',
99                                          'S','e','r','v','i','c','e',' ','P','r','o','v','i','d','e','r','\0'};
100     static const WCHAR dp_adapterW[] = {'L','o','c','a','l',' ','A','r','e','a',' ','C','o','n','n','e','c','t','i','o','n',
101                                         ' ','-',' ','I','P','v','4','\0'};
102
103     static const GUID adapter_guid = {0x4ce725f6, 0xd3c0, 0xdade, {0xba, 0x6f, 0x11, 0xf9, 0x65, 0xbc, 0x42, 0x99}};
104     DWORD req_size;
105
106     TRACE("(%p)->(%p,%p,%p,%p,%p,%x): stub\n", iface, pguidServiceProvider, pguidApplication, pSPInfoBuffer,
107                                                pcbEnumData, pcReturned, dwFlags);
108
109     if(!pguidServiceProvider)
110     {
111         req_size = sizeof(DPN_SERVICE_PROVIDER_INFO) + sizeof(dp_providerW);
112     }
113     else if(IsEqualGUID(pguidServiceProvider, &CLSID_DP8SP_TCPIP))
114     {
115         req_size = sizeof(DPN_SERVICE_PROVIDER_INFO) + sizeof(dp_adapterW);
116     }
117     else
118     {
119         FIXME("Application requested a provider we don't handle (yet)\n");
120         *pcReturned = 0;
121         return DPNERR_DOESNOTEXIST;
122     }
123
124     if(*pcbEnumData < req_size)
125     {
126         *pcbEnumData = req_size;
127         return DPNERR_BUFFERTOOSMALL;
128     }
129
130     pSPInfoBuffer->pwszName = (LPWSTR)(pSPInfoBuffer + 1);
131
132     if(!pguidServiceProvider)
133     {
134         lstrcpyW(pSPInfoBuffer->pwszName, dp_providerW);
135         pSPInfoBuffer->guid = CLSID_DP8SP_TCPIP;
136     }
137     else
138     {
139         lstrcpyW(pSPInfoBuffer->pwszName, dp_adapterW);
140         pSPInfoBuffer->guid = adapter_guid;
141     }
142
143     *pcReturned = 1;
144     return DPN_OK;
145 }
146
147 static HRESULT WINAPI IDirectPlay8PeerImpl_CancelAsyncOperation(IDirectPlay8Peer *iface,
148         const DPNHANDLE hAsyncHandle, const DWORD dwFlags)
149 {
150     FIXME("(%p)->(%x,%x): stub\n", iface, hAsyncHandle, dwFlags);
151
152     return DPNERR_GENERIC;
153 }
154
155 static HRESULT WINAPI IDirectPlay8PeerImpl_Connect(IDirectPlay8Peer *iface,
156         const DPN_APPLICATION_DESC * const pdnAppDesc, IDirectPlay8Address * const pHostAddr,
157         IDirectPlay8Address * const pDeviceInfo, const DPN_SECURITY_DESC * const pdnSecurity,
158         const DPN_SECURITY_CREDENTIALS * const pdnCredentials, const void * const pvUserConnectData,
159         const DWORD dwUserConnectDataSize, void * const pvPlayerContext,
160         void * const pvAsyncContext, DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
161 {
162     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);
163
164     return DPNERR_GENERIC;
165 }
166
167 static HRESULT WINAPI IDirectPlay8PeerImpl_SendTo(IDirectPlay8Peer *iface, const DPNID dpnId,
168         const DPN_BUFFER_DESC *pBufferDesc, const DWORD cBufferDesc, const DWORD dwTimeOut,
169         void * const pvAsyncContext, DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
170 {
171     FIXME("(%p)->(%x,%p,%x,%x,%p,%p,%x): stub\n", iface, dpnId, pBufferDesc, cBufferDesc, dwTimeOut, pvAsyncContext, phAsyncHandle, dwFlags);
172
173     return DPNERR_GENERIC;
174 }
175
176 static HRESULT WINAPI IDirectPlay8PeerImpl_GetSendQueueInfo(IDirectPlay8Peer *iface,
177         const DPNID dpnid, DWORD * const pdwNumMsgs, DWORD * const pdwNumBytes, const DWORD dwFlags)
178 {
179     FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, dpnid, pdwNumMsgs, pdwNumBytes, dwFlags);
180
181     return DPNERR_GENERIC;
182 }
183
184 static HRESULT WINAPI IDirectPlay8PeerImpl_Host(IDirectPlay8Peer *iface,
185         const DPN_APPLICATION_DESC * const pdnAppDesc, IDirectPlay8Address ** const prgpDeviceInfo,
186         const DWORD cDeviceInfo, const DPN_SECURITY_DESC * const pdpSecurity,
187         const DPN_SECURITY_CREDENTIALS * const pdpCredentials, void * const pvPlayerContext,
188         const DWORD dwFlags)
189 {
190     FIXME("(%p)->(%p,%p,%x,%p,%p,%p,%x): stub\n", iface, pdnAppDesc, prgpDeviceInfo, cDeviceInfo, pdpSecurity, pdpCredentials, pvPlayerContext, dwFlags);
191
192     return DPNERR_GENERIC;
193 }
194
195 static HRESULT WINAPI IDirectPlay8PeerImpl_GetApplicationDesc(IDirectPlay8Peer *iface,
196         DPN_APPLICATION_DESC * const pAppDescBuffer, DWORD * const pcbDataSize, const DWORD dwFlags)
197 {
198     FIXME("(%p)->(%p,%p,%x): stub\n", iface, pAppDescBuffer, pcbDataSize, dwFlags);
199
200     return DPNERR_GENERIC;
201 }
202
203 static HRESULT WINAPI IDirectPlay8PeerImpl_SetApplicationDesc(IDirectPlay8Peer *iface,
204         const DPN_APPLICATION_DESC * const pad, const DWORD dwFlags)
205 {
206     FIXME("(%p)->(%p,%x): stub\n", iface, pad, dwFlags);
207
208     return DPNERR_GENERIC;
209 }
210
211 static HRESULT WINAPI IDirectPlay8PeerImpl_CreateGroup(IDirectPlay8Peer *iface,
212         const DPN_GROUP_INFO * const pdpnGroupInfo, void * const pvGroupContext,
213         void * const pvAsyncContext, DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
214 {
215     FIXME("(%p)->(%p,%p,%p,%p,%x): stub\n", iface, pdpnGroupInfo, pvGroupContext, pvAsyncContext, phAsyncHandle, dwFlags);
216
217     return DPNERR_GENERIC;
218 }
219
220 static HRESULT WINAPI IDirectPlay8PeerImpl_DestroyGroup(IDirectPlay8Peer *iface,
221         const DPNID idGroup, void * const pvAsyncContext, DPNHANDLE * const phAsyncHandle,
222         const DWORD dwFlags)
223 {
224     FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, idGroup, pvAsyncContext, phAsyncHandle, dwFlags);
225
226     return DPNERR_GENERIC;
227 }
228
229 static HRESULT WINAPI IDirectPlay8PeerImpl_AddPlayerToGroup(IDirectPlay8Peer *iface,
230         const DPNID idGroup, const DPNID idClient, void * const pvAsyncContext,
231         DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
232 {
233     FIXME("(%p)->(%x,%x,%p,%p,%x): stub\n", iface, idGroup, idClient, pvAsyncContext, phAsyncHandle, dwFlags);
234
235     return DPNERR_GENERIC;
236 }
237
238 static HRESULT WINAPI IDirectPlay8PeerImpl_RemovePlayerFromGroup(IDirectPlay8Peer *iface,
239         const DPNID idGroup, const DPNID idClient, void * const pvAsyncContext,
240         DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
241 {
242     FIXME("(%p)->(%x,%x,%p,%p,%x): stub\n", iface, idGroup, idClient, pvAsyncContext, phAsyncHandle, dwFlags);
243
244     return DPNERR_GENERIC;
245 }
246
247 static HRESULT WINAPI IDirectPlay8PeerImpl_SetGroupInfo(IDirectPlay8Peer *iface, const DPNID dpnid,
248         DPN_GROUP_INFO * const pdpnGroupInfo, void * const pvAsyncContext,
249         DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
250 {
251     FIXME("(%p)->(%x,%p,%p,%p,%x): stub\n", iface, dpnid, pdpnGroupInfo, pvAsyncContext, phAsyncHandle, dwFlags);
252
253     return DPNERR_GENERIC;
254 }
255
256 static HRESULT WINAPI IDirectPlay8PeerImpl_GetGroupInfo(IDirectPlay8Peer *iface, const DPNID dpnid,
257         DPN_GROUP_INFO * const pdpnGroupInfo, DWORD * const pdwSize, const DWORD dwFlags)
258 {
259     FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, dpnid, pdpnGroupInfo, pdwSize, dwFlags);
260
261     return DPNERR_GENERIC;
262 }
263
264 static HRESULT WINAPI IDirectPlay8PeerImpl_EnumPlayersAndGroups(IDirectPlay8Peer *iface,
265         DPNID * const prgdpnid, DWORD * const pcdpnid, const DWORD dwFlags)
266 {
267     FIXME("(%p)->(%p,%p,%x): stub\n", iface, prgdpnid, pcdpnid, dwFlags);
268
269     return DPNERR_GENERIC;
270 }
271
272 static HRESULT WINAPI IDirectPlay8PeerImpl_EnumGroupMembers(IDirectPlay8Peer *iface,
273         const DPNID dpnid, DPNID * const prgdpnid, DWORD * const pcdpnid, const DWORD dwFlags)
274 {
275     FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, dpnid, prgdpnid, pcdpnid, dwFlags);
276
277     return DPNERR_GENERIC;
278 }
279
280 static HRESULT WINAPI IDirectPlay8PeerImpl_SetPeerInfo(IDirectPlay8Peer *iface,
281         const DPN_PLAYER_INFO * const pdpnPlayerInfo, void * const pvAsyncContext,
282         DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
283 {
284     FIXME("(%p)->(%p,%p,%p,%x): stub\n", iface, pdpnPlayerInfo, pvAsyncContext, phAsyncHandle, dwFlags);
285
286     return DPNERR_GENERIC;
287 }
288
289 static HRESULT WINAPI IDirectPlay8PeerImpl_GetPeerInfo(IDirectPlay8Peer *iface, const DPNID dpnid,
290         DPN_PLAYER_INFO * const pdpnPlayerInfo, DWORD * const pdwSize, const DWORD dwFlags)
291 {
292     FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, dpnid, pdpnPlayerInfo, pdwSize, dwFlags);
293
294     return DPNERR_GENERIC;
295 }
296
297 static HRESULT WINAPI IDirectPlay8PeerImpl_GetPeerAddress(IDirectPlay8Peer *iface,
298         const DPNID dpnid, IDirectPlay8Address ** const pAddress, const DWORD dwFlags)
299 {
300     FIXME("(%p)->(%x,%p,%x): stub\n", iface, dpnid, pAddress, dwFlags);
301
302     return DPNERR_GENERIC;
303 }
304
305 static HRESULT WINAPI IDirectPlay8PeerImpl_GetLocalHostAddresses(IDirectPlay8Peer *iface,
306         IDirectPlay8Address ** const prgpAddress, DWORD * const pcAddress, const DWORD dwFlags)
307 {
308     FIXME("(%p)->(%p,%p,%x): stub\n", iface, prgpAddress, pcAddress, dwFlags);
309
310     return DPNERR_GENERIC;
311 }
312
313 static HRESULT WINAPI IDirectPlay8PeerImpl_Close(IDirectPlay8Peer *iface, const DWORD dwFlags)
314 {
315     FIXME("(%p)->(%x): stub\n", iface, dwFlags);
316
317     return DPN_OK;
318 }
319
320 static HRESULT WINAPI IDirectPlay8PeerImpl_EnumHosts(IDirectPlay8Peer *iface,
321         PDPN_APPLICATION_DESC const pApplicationDesc, IDirectPlay8Address * const pAddrHost,
322         IDirectPlay8Address * const pDeviceInfo, void * const pUserEnumData,
323         const DWORD dwUserEnumDataSize, const DWORD dwEnumCount, const DWORD dwRetryInterval,
324         const DWORD dwTimeOut, void * const pvUserContext, DPNHANDLE * const pAsyncHandle, const DWORD dwFlags)
325 {
326     FIXME("(%p)->(%p,%p,%p,%p,%x,%x,%x,%x,%p,%p,%x): stub\n",
327             iface, pApplicationDesc, pAddrHost, pDeviceInfo, pUserEnumData, dwUserEnumDataSize, dwEnumCount,
328             dwRetryInterval, dwTimeOut, pvUserContext, pAsyncHandle, dwFlags);
329
330     return DPNERR_GENERIC;
331 }
332
333 static HRESULT WINAPI IDirectPlay8PeerImpl_DestroyPeer(IDirectPlay8Peer *iface, const DPNID dpnidClient,
334         const void * const pvDestroyData, const DWORD dwDestroyDataSize, const DWORD dwFlags)
335 {
336     FIXME("(%p)->(%x,%p,%x,%x): stub\n", iface, dpnidClient, pvDestroyData, dwDestroyDataSize, dwFlags);
337
338     return DPNERR_GENERIC;
339 }
340
341 static HRESULT WINAPI IDirectPlay8PeerImpl_ReturnBuffer(IDirectPlay8Peer *iface, const DPNHANDLE hBufferHandle,
342         const DWORD dwFlags)
343 {
344     FIXME("(%p)->(%x,%x): stub\n", iface, hBufferHandle, dwFlags);
345
346     return DPNERR_GENERIC;
347 }
348
349 static HRESULT WINAPI IDirectPlay8PeerImpl_GetPlayerContext(IDirectPlay8Peer *iface, const DPNID dpnid,
350         void ** const ppvPlayerContext, const DWORD dwFlags)
351 {
352     FIXME("(%p)->(%x,%p,%x): stub\n", iface, dpnid, ppvPlayerContext, dwFlags);
353
354     return DPNERR_GENERIC;
355 }
356
357 static HRESULT WINAPI IDirectPlay8PeerImpl_GetGroupContext(IDirectPlay8Peer *iface, const DPNID dpnid,
358         void ** const ppvGroupContext, const DWORD dwFlags)
359 {
360     FIXME("(%p)->(%x,%p,%x): stub\n", iface, dpnid, ppvGroupContext, dwFlags);
361
362     return DPNERR_GENERIC;
363 }
364
365 static HRESULT WINAPI IDirectPlay8PeerImpl_GetCaps(IDirectPlay8Peer *iface, DPN_CAPS * const pdpCaps,
366         const DWORD dwFlags)
367 {
368     FIXME("(%p)->(%p,%x): stub\n", iface, pdpCaps, dwFlags);
369
370     return DPNERR_GENERIC;
371 }
372
373 static HRESULT WINAPI IDirectPlay8PeerImpl_SetCaps(IDirectPlay8Peer *iface, const DPN_CAPS * const pdpCaps,
374         const DWORD dwFlags)
375 {
376     FIXME("(%p)->(%p,%x): stub\n", iface, pdpCaps, dwFlags);
377
378     return DPNERR_GENERIC;
379 }
380
381 static HRESULT WINAPI IDirectPlay8PeerImpl_SetSPCaps(IDirectPlay8Peer *iface, const GUID * const pguidSP,
382         const DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags )
383 {
384     FIXME("(%p)->(%p,%p,%x): stub\n", iface, pguidSP, pdpspCaps, dwFlags);
385
386     return DPNERR_GENERIC;
387 }
388
389 static HRESULT WINAPI IDirectPlay8PeerImpl_GetSPCaps(IDirectPlay8Peer *iface, const GUID * const pguidSP,
390         DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags)
391 {
392     TRACE("(%p)->(%p,%p,%x)\n", iface, pguidSP, pdpspCaps, dwFlags);
393
394     if(pdpspCaps->dwSize != sizeof(DPN_SP_CAPS))
395     {
396         return DPNERR_INVALIDPARAM;
397     }
398
399     pdpspCaps->dwFlags = DPNSPCAPS_SUPPORTSDPNSRV | DPNSPCAPS_SUPPORTSBROADCAST |
400                          DPNSPCAPS_SUPPORTSALLADAPTERS | DPNSPCAPS_SUPPORTSTHREADPOOL;
401     pdpspCaps->dwNumThreads = 3;
402     pdpspCaps->dwDefaultEnumCount = 5;
403     pdpspCaps->dwDefaultEnumRetryInterval = 1500;
404     pdpspCaps->dwDefaultEnumTimeout = 1500;
405     pdpspCaps->dwMaxEnumPayloadSize = 983;
406     pdpspCaps->dwBuffersPerThread = 1;
407     pdpspCaps->dwSystemBufferSize = 8192;
408
409     return DPN_OK;
410 }
411
412 static HRESULT WINAPI IDirectPlay8PeerImpl_GetConnectionInfo(IDirectPlay8Peer *iface, const DPNID dpnid,
413         DPN_CONNECTION_INFO * const pdpConnectionInfo, const DWORD dwFlags)
414 {
415     FIXME("(%p)->(%x,%p,%x): stub\n", iface, dpnid, pdpConnectionInfo, dwFlags);
416
417     return DPNERR_GENERIC;
418 }
419
420 static HRESULT WINAPI IDirectPlay8PeerImpl_RegisterLobby(IDirectPlay8Peer *iface, const DPNHANDLE dpnHandle,
421         struct IDirectPlay8LobbiedApplication * const pIDP8LobbiedApplication, const DWORD dwFlags)
422 {
423     FIXME("(%p)->(%x,%p,%x): stub\n", iface, dpnHandle, pIDP8LobbiedApplication, dwFlags);
424
425     return DPNERR_GENERIC;
426 }
427
428 static HRESULT WINAPI IDirectPlay8PeerImpl_TerminateSession(IDirectPlay8Peer *iface, void * const pvTerminateData,
429         const DWORD dwTerminateDataSize, const DWORD dwFlags)
430 {
431     FIXME("(%p)->(%p,%x,%x): stub\n", iface, pvTerminateData, dwTerminateDataSize, dwFlags);
432
433     return DPNERR_GENERIC;
434 }
435
436 static const IDirectPlay8PeerVtbl DirectPlay8Peer_Vtbl =
437 {
438     IDirectPlay8PeerImpl_QueryInterface,
439     IDirectPlay8PeerImpl_AddRef,
440     IDirectPlay8PeerImpl_Release,
441     IDirectPlay8PeerImpl_Initialize,
442     IDirectPlay8PeerImpl_EnumServiceProviders,
443     IDirectPlay8PeerImpl_CancelAsyncOperation,
444     IDirectPlay8PeerImpl_Connect,
445     IDirectPlay8PeerImpl_SendTo,
446     IDirectPlay8PeerImpl_GetSendQueueInfo,
447     IDirectPlay8PeerImpl_Host,
448     IDirectPlay8PeerImpl_GetApplicationDesc,
449     IDirectPlay8PeerImpl_SetApplicationDesc,
450     IDirectPlay8PeerImpl_CreateGroup,
451     IDirectPlay8PeerImpl_DestroyGroup,
452     IDirectPlay8PeerImpl_AddPlayerToGroup,
453     IDirectPlay8PeerImpl_RemovePlayerFromGroup,
454     IDirectPlay8PeerImpl_SetGroupInfo,
455     IDirectPlay8PeerImpl_GetGroupInfo,
456     IDirectPlay8PeerImpl_EnumPlayersAndGroups,
457     IDirectPlay8PeerImpl_EnumGroupMembers,
458     IDirectPlay8PeerImpl_SetPeerInfo,
459     IDirectPlay8PeerImpl_GetPeerInfo,
460     IDirectPlay8PeerImpl_GetPeerAddress,
461     IDirectPlay8PeerImpl_GetLocalHostAddresses,
462     IDirectPlay8PeerImpl_Close,
463     IDirectPlay8PeerImpl_EnumHosts,
464     IDirectPlay8PeerImpl_DestroyPeer,
465     IDirectPlay8PeerImpl_ReturnBuffer,
466     IDirectPlay8PeerImpl_GetPlayerContext,
467     IDirectPlay8PeerImpl_GetGroupContext,
468     IDirectPlay8PeerImpl_GetCaps,
469     IDirectPlay8PeerImpl_SetCaps,
470     IDirectPlay8PeerImpl_SetSPCaps,
471     IDirectPlay8PeerImpl_GetSPCaps,
472     IDirectPlay8PeerImpl_GetConnectionInfo,
473     IDirectPlay8PeerImpl_RegisterLobby,
474     IDirectPlay8PeerImpl_TerminateSession
475 };
476
477 HRESULT DPNET_CreateDirectPlay8Peer(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) {
478     IDirectPlay8PeerImpl* Client;
479     HRESULT ret;
480
481     Client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8PeerImpl));
482
483     if(Client == NULL)
484     {
485         *ppobj = NULL;
486         WARN("Not enough memory\n");
487         return E_OUTOFMEMORY;
488     }
489
490     Client->IDirectPlay8Peer_iface.lpVtbl = &DirectPlay8Peer_Vtbl;
491     ret = IDirectPlay8PeerImpl_QueryInterface(&Client->IDirectPlay8Peer_iface, riid, ppobj);
492     if(ret != DPN_OK)
493         HeapFree(GetProcessHeap(), 0, Client);
494
495     return ret;
496 }