4 * Copyright 2004 Raphael Junqueira
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/debug.h"
36 #include "dpnet_private.h"
38 typedef struct IDirectPlay8ServerImpl
40 IDirectPlay8Server IDirectPlay8Server_iface
;
43 PFNDPNMESSAGEHANDLER msghandler
;
46 } IDirectPlay8ServerImpl
;
48 WINE_DEFAULT_DEBUG_CHANNEL(dpnet
);
50 static inline IDirectPlay8ServerImpl
*impl_from_IDirectPlay8Server(IDirectPlay8Server
*iface
)
52 return CONTAINING_RECORD(iface
, IDirectPlay8ServerImpl
, IDirectPlay8Server_iface
);
55 static HRESULT WINAPI
IDirectPlay8ServerImpl_QueryInterface(IDirectPlay8Server
*iface
, REFIID riid
, void **ppv
)
57 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
59 TRACE("%p %s %p\n", This
, debugstr_guid(riid
), ppv
);
61 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
62 IsEqualGUID(riid
, &IID_IDirectPlay8Server
))
64 TRACE("(%p)->(IID_IDirectPlay8Server %p)\n", This
, ppv
);
65 *ppv
= &This
->IDirectPlay8Server_iface
;
68 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
73 IUnknown_AddRef((IUnknown
*)*ppv
);
77 static ULONG WINAPI
IDirectPlay8ServerImpl_AddRef(IDirectPlay8Server
*iface
)
79 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
80 ULONG ref
= InterlockedIncrement(&This
->ref
);
82 TRACE("(%p) ref=%d\n", This
, ref
);
87 static ULONG WINAPI
IDirectPlay8ServerImpl_Release(IDirectPlay8Server
*iface
)
89 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
90 ULONG ref
= InterlockedDecrement(&This
->ref
);
92 TRACE("(%p) ref=%d\n", This
, ref
);
95 HeapFree(GetProcessHeap(), 0, This
);
101 static HRESULT WINAPI
IDirectPlay8ServerImpl_Initialize(IDirectPlay8Server
*iface
, PVOID pvUserContext
,
102 PFNDPNMESSAGEHANDLER pfn
, DWORD dwFlags
)
104 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
105 TRACE("(%p)->(%p %p %d)\n", This
, pvUserContext
, pfn
, dwFlags
);
108 return DPNERR_INVALIDPARAM
;
110 This
->usercontext
= pvUserContext
;
111 This
->msghandler
= pfn
;
112 This
->flags
= dwFlags
;
117 static HRESULT WINAPI
IDirectPlay8ServerImpl_EnumServiceProviders(IDirectPlay8Server
*iface
, const GUID
*pguidServiceProvider
,
118 const GUID
*pguidApplication
, DPN_SERVICE_PROVIDER_INFO
*pSPInfoBuffer
, PDWORD pcbEnumData
,
119 PDWORD pcReturned
, DWORD dwFlags
)
121 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
122 FIXME("(%p)->(%s %s %p %p %p %d)\n", This
, debugstr_guid(pguidServiceProvider
), debugstr_guid(pguidApplication
),
123 pSPInfoBuffer
, pcbEnumData
, pcReturned
, dwFlags
);
127 static HRESULT WINAPI
IDirectPlay8ServerImpl_CancelAsyncOperation(IDirectPlay8Server
*iface
, DPNHANDLE hAsyncHandle
, DWORD dwFlags
)
129 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
130 FIXME("(%p)->(%d %d)\n", This
, hAsyncHandle
, dwFlags
);
134 static HRESULT WINAPI
IDirectPlay8ServerImpl_GetSendQueueInfo(IDirectPlay8Server
*iface
, DPNID dpnid
, DWORD
*pdwNumMsgs
,
135 DWORD
*pdwNumBytes
, DWORD dwFlags
)
137 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
138 FIXME("(%p)->(%d %p %p %d)\n", This
, dpnid
, pdwNumMsgs
, pdwNumBytes
, dwFlags
);
142 static HRESULT WINAPI
IDirectPlay8ServerImpl_GetApplicationDesc(IDirectPlay8Server
*iface
, DPN_APPLICATION_DESC
*pAppDescBuffer
,
143 DWORD
*pcbDataSize
, DWORD dwFlags
)
145 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
146 FIXME("(%p)->(%p %p %d)\n", This
, pAppDescBuffer
, pcbDataSize
, dwFlags
);
150 static HRESULT WINAPI
IDirectPlay8ServerImpl_SetServerInfo(IDirectPlay8Server
*iface
, const DPN_PLAYER_INFO
*pdpnPlayerInfo
,
151 PVOID pvAsyncContext
, DPNHANDLE
*phAsyncHandle
, DWORD dwFlags
)
153 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
154 FIXME("(%p)->(%p %p %p %d)\n", This
, pdpnPlayerInfo
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
158 static HRESULT WINAPI
IDirectPlay8ServerImpl_GetClientInfo(IDirectPlay8Server
*iface
, DPNID dpnid
, DPN_PLAYER_INFO
*pdpnPlayerInfo
,
159 DWORD
*pdwSize
, DWORD dwFlags
)
161 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
162 FIXME("(%p)->(%d %p %p %d)\n", This
, dpnid
, pdpnPlayerInfo
, pdwSize
, dwFlags
);
166 static HRESULT WINAPI
IDirectPlay8ServerImpl_GetClientAddress(IDirectPlay8Server
*iface
, DPNID dpnid
, IDirectPlay8Address
**pAddress
,
169 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
170 FIXME("(%p)->(%d %p %d)\n", This
, dpnid
, pAddress
, dwFlags
);
174 static HRESULT WINAPI
IDirectPlay8ServerImpl_GetLocalHostAddresses(IDirectPlay8Server
*iface
, IDirectPlay8Address
**prgpAddress
,
175 DWORD
*pcAddress
, DWORD dwFlags
)
177 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
178 FIXME("(%p)->(%p %p %d)\n", This
, prgpAddress
, pcAddress
, dwFlags
);
182 static HRESULT WINAPI
IDirectPlay8ServerImpl_SetApplicationDesc(IDirectPlay8Server
*iface
, const DPN_APPLICATION_DESC
*pad
, DWORD dwFlags
)
184 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
185 FIXME("(%p)->(%p %d)\n", This
, pad
, dwFlags
);
189 static HRESULT WINAPI
IDirectPlay8ServerImpl_Host(IDirectPlay8Server
*iface
, const DPN_APPLICATION_DESC
*pdnAppDesc
,
190 IDirectPlay8Address
**prgpDeviceInfo
, DWORD cDeviceInfo
, const DPN_SECURITY_DESC
*pdnSecurity
,
191 const DPN_SECURITY_CREDENTIALS
*pdnCredentials
, void *pvPlayerContext
, DWORD dwFlags
)
193 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
194 FIXME("(%p)->(%p %p %d %p %p %p %d)\n", This
, pdnAppDesc
, prgpDeviceInfo
, cDeviceInfo
, pdnSecurity
, pdnCredentials
,
195 pvPlayerContext
, dwFlags
);
199 static HRESULT WINAPI
IDirectPlay8ServerImpl_SendTo(IDirectPlay8Server
*iface
, DPNID dpnid
, const DPN_BUFFER_DESC
*prgBufferDesc
,
200 DWORD cBufferDesc
, DWORD dwTimeOut
, void *pvAsyncContext
, DPNHANDLE
*phAsyncHandle
, DWORD dwFlags
)
202 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
203 FIXME("(%p)->(%d %p %d %d %p %p %d)\n", This
, dpnid
, prgBufferDesc
, cBufferDesc
, dwTimeOut
, pvAsyncContext
, phAsyncHandle
,
208 static HRESULT WINAPI
IDirectPlay8ServerImpl_CreateGroup(IDirectPlay8Server
*iface
, const DPN_GROUP_INFO
*pdpnGroupInfo
,
209 void *pvGroupContext
, void *pvAsyncContext
, DPNHANDLE
*phAsyncHandle
, DWORD dwFlags
)
211 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
212 FIXME("(%p)->(%p %p %p %p %d)\n", This
, pdpnGroupInfo
, pvGroupContext
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
216 static HRESULT WINAPI
IDirectPlay8ServerImpl_DestroyGroup(IDirectPlay8Server
*iface
, DPNID idGroup
, PVOID pvAsyncContext
,
217 DPNHANDLE
*phAsyncHandle
, DWORD dwFlags
)
219 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
220 FIXME("(%p)->(%d %p %p %d)\n", This
, idGroup
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
224 static HRESULT WINAPI
IDirectPlay8ServerImpl_AddPlayerToGroup(IDirectPlay8Server
*iface
, DPNID idGroup
, DPNID idClient
,
225 PVOID pvAsyncContext
, DPNHANDLE
*phAsyncHandle
, DWORD dwFlags
)
227 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
228 FIXME("(%p)->(%d %d %p %p %d)\n", This
, idGroup
, idClient
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
232 static HRESULT WINAPI
IDirectPlay8ServerImpl_RemovePlayerFromGroup(IDirectPlay8Server
*iface
, DPNID idGroup
, DPNID idClient
,
233 PVOID pvAsyncContext
, DPNHANDLE
*phAsyncHandle
, DWORD dwFlags
)
235 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
236 FIXME("(%p)->(%d %d %p %p %d)\n", This
, idGroup
, idClient
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
240 static HRESULT WINAPI
IDirectPlay8ServerImpl_SetGroupInfo(IDirectPlay8Server
*iface
, DPNID dpnid
, DPN_GROUP_INFO
*pdpnGroupInfo
,
241 PVOID pvAsyncContext
, DPNHANDLE
*phAsyncHandle
, DWORD dwFlags
)
243 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
244 FIXME("(%p)->(%d %p %p %p %d)\n", This
, dpnid
, pdpnGroupInfo
, pvAsyncContext
, phAsyncHandle
, dwFlags
);
248 static HRESULT WINAPI
IDirectPlay8ServerImpl_GetGroupInfo(IDirectPlay8Server
*iface
, DPNID dpnid
, DPN_GROUP_INFO
*pdpnGroupInfo
,
249 DWORD
*pdwSize
, DWORD dwFlags
)
251 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
252 FIXME("(%p)->(%d %p %p %d)\n", This
, dpnid
, pdpnGroupInfo
, pdwSize
, dwFlags
);
256 static HRESULT WINAPI
IDirectPlay8ServerImpl_EnumPlayersAndGroups(IDirectPlay8Server
*iface
, DPNID
*prgdpnid
, DWORD
*pcdpnid
, DWORD dwFlags
)
258 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
259 FIXME("(%p)->(%p %p %d)\n", This
, prgdpnid
, pcdpnid
, dwFlags
);
263 static HRESULT WINAPI
IDirectPlay8ServerImpl_EnumGroupMembers(IDirectPlay8Server
*iface
, DPNID dpnid
, DPNID
*prgdpnid
, DWORD
*pcdpnid
, DWORD dwFlags
)
265 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
266 FIXME("(%p)->(%d %p %p %d)\n", This
, dpnid
, prgdpnid
, pcdpnid
, dwFlags
);
270 static HRESULT WINAPI
IDirectPlay8ServerImpl_Close(IDirectPlay8Server
*iface
, DWORD dwFlags
)
272 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
273 FIXME("(%p)->(%d)\n", This
, dwFlags
);
277 static HRESULT WINAPI
IDirectPlay8ServerImpl_DestroyClient(IDirectPlay8Server
*iface
, DPNID dpnidClient
, const void *pvDestroyData
,
278 DWORD dwDestroyDataSize
, DWORD dwFlags
)
280 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
281 FIXME("(%p)->(%d %p %d %d)\n", This
, dpnidClient
, pvDestroyData
, dwDestroyDataSize
, dwFlags
);
285 static HRESULT WINAPI
IDirectPlay8ServerImpl_ReturnBuffer(IDirectPlay8Server
*iface
, DPNHANDLE hBufferHandle
, DWORD dwFlags
)
287 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
288 FIXME("(%p)->(%d %d)\n", This
, hBufferHandle
, dwFlags
);
292 static HRESULT WINAPI
IDirectPlay8ServerImpl_GetPlayerContext(IDirectPlay8Server
*iface
, DPNID dpnid
, PVOID
*ppvPlayerContext
, DWORD dwFlags
)
294 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
295 FIXME("(%p)->(%d %p %d)\n", This
, dpnid
, ppvPlayerContext
, dwFlags
);
299 static HRESULT WINAPI
IDirectPlay8ServerImpl_GetGroupContext(IDirectPlay8Server
*iface
, DPNID dpnid
, PVOID
*ppvGroupContext
, DWORD dwFlags
)
301 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
302 FIXME("(%p)->(%d %p %d)\n", This
, dpnid
, ppvGroupContext
, dwFlags
);
306 static HRESULT WINAPI
IDirectPlay8ServerImpl_GetCaps(IDirectPlay8Server
*iface
, DPN_CAPS
*pdpCaps
, DWORD dwFlags
)
308 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
309 FIXME("(%p)->(%p %d)\n", This
, pdpCaps
, dwFlags
);
313 static HRESULT WINAPI
IDirectPlay8ServerImpl_SetCaps(IDirectPlay8Server
*iface
, const DPN_CAPS
*pdpCaps
, DWORD dwFlags
)
315 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
316 FIXME("(%p)->(%p %d)\n", This
, pdpCaps
, dwFlags
);
320 static HRESULT WINAPI
IDirectPlay8ServerImpl_SetSPCaps(IDirectPlay8Server
*iface
, const GUID
*pguidSP
, const DPN_SP_CAPS
*pdpspCaps
, DWORD dwFlags
)
322 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
323 FIXME("(%p)->(%p %p %d)\n", This
, pguidSP
, pdpspCaps
, dwFlags
);
327 static HRESULT WINAPI
IDirectPlay8ServerImpl_GetSPCaps(IDirectPlay8Server
*iface
, const GUID
*pguidSP
, DPN_SP_CAPS
*pdpspCaps
, DWORD dwFlags
)
329 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
330 FIXME("(%p)->(%p %p %d)\n", This
, pguidSP
, pdpspCaps
, dwFlags
);
334 static HRESULT WINAPI
IDirectPlay8ServerImpl_GetConnectionInfo(IDirectPlay8Server
*iface
, DPNID dpnid
,
335 DPN_CONNECTION_INFO
*pdpConnectionInfo
, DWORD dwFlags
)
337 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
338 FIXME("(%p)->(%d %p %d)\n", This
, dpnid
, pdpConnectionInfo
, dwFlags
);
342 static HRESULT WINAPI
IDirectPlay8ServerImpl_RegisterLobby(IDirectPlay8Server
*iface
, DPNHANDLE dpnHandle
,
343 struct IDirectPlay8LobbiedApplication
*pIDP8LobbiedApplication
, DWORD dwFlags
)
345 IDirectPlay8ServerImpl
*This
= impl_from_IDirectPlay8Server(iface
);
346 FIXME("(%p)->(%d %p %d)\n", This
, dpnHandle
, pIDP8LobbiedApplication
, dwFlags
);
350 static const IDirectPlay8ServerVtbl DirectPlay8ServerVtbl
=
352 IDirectPlay8ServerImpl_QueryInterface
,
353 IDirectPlay8ServerImpl_AddRef
,
354 IDirectPlay8ServerImpl_Release
,
355 IDirectPlay8ServerImpl_Initialize
,
356 IDirectPlay8ServerImpl_EnumServiceProviders
,
357 IDirectPlay8ServerImpl_CancelAsyncOperation
,
358 IDirectPlay8ServerImpl_GetSendQueueInfo
,
359 IDirectPlay8ServerImpl_GetApplicationDesc
,
360 IDirectPlay8ServerImpl_SetServerInfo
,
361 IDirectPlay8ServerImpl_GetClientInfo
,
362 IDirectPlay8ServerImpl_GetClientAddress
,
363 IDirectPlay8ServerImpl_GetLocalHostAddresses
,
364 IDirectPlay8ServerImpl_SetApplicationDesc
,
365 IDirectPlay8ServerImpl_Host
,
366 IDirectPlay8ServerImpl_SendTo
,
367 IDirectPlay8ServerImpl_CreateGroup
,
368 IDirectPlay8ServerImpl_DestroyGroup
,
369 IDirectPlay8ServerImpl_AddPlayerToGroup
,
370 IDirectPlay8ServerImpl_RemovePlayerFromGroup
,
371 IDirectPlay8ServerImpl_SetGroupInfo
,
372 IDirectPlay8ServerImpl_GetGroupInfo
,
373 IDirectPlay8ServerImpl_EnumPlayersAndGroups
,
374 IDirectPlay8ServerImpl_EnumGroupMembers
,
375 IDirectPlay8ServerImpl_Close
,
376 IDirectPlay8ServerImpl_DestroyClient
,
377 IDirectPlay8ServerImpl_ReturnBuffer
,
378 IDirectPlay8ServerImpl_GetPlayerContext
,
379 IDirectPlay8ServerImpl_GetGroupContext
,
380 IDirectPlay8ServerImpl_GetCaps
,
381 IDirectPlay8ServerImpl_SetCaps
,
382 IDirectPlay8ServerImpl_SetSPCaps
,
383 IDirectPlay8ServerImpl_GetSPCaps
,
384 IDirectPlay8ServerImpl_GetConnectionInfo
,
385 IDirectPlay8ServerImpl_RegisterLobby
388 HRESULT
DPNET_CreateDirectPlay8Server(IClassFactory
*iface
, IUnknown
*pUnkOuter
, REFIID riid
, void **ppv
)
390 IDirectPlay8ServerImpl
*server
;
393 TRACE("(%p, %s, %p)\n", pUnkOuter
, debugstr_guid(riid
), ppv
);
398 return CLASS_E_NOAGGREGATION
;
400 server
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectPlay8ServerImpl
));
402 return E_OUTOFMEMORY
;
404 server
->IDirectPlay8Server_iface
.lpVtbl
= &DirectPlay8ServerVtbl
;
406 server
->usercontext
= NULL
;
407 server
->msghandler
= NULL
;
410 hr
= IDirectPlay8Server_QueryInterface(&server
->IDirectPlay8Server_iface
, riid
, ppv
);
411 IDirectPlay8Server_Release(&server
->IDirectPlay8Server_iface
);