wined3d: Use a separate STATE_TRANSFORM(WINED3D_TS_VIEW) state handler in the GLSL...
[wine/multimedia.git] / dlls / dpnet / client.c
blobbf2b8d2c465660f6761ce99a18ff2befd793fa33
1 /*
2 * DirectPlay8 Client
3 *
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
22 #include "config.h"
24 #include <stdarg.h>
26 #define COBJMACROS
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wingdi.h"
30 #include "winuser.h"
31 #include "objbase.h"
32 #include "wine/debug.h"
34 #include "dplay8.h"
35 #include "dpnet_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
39 typedef struct IDirectPlay8LobbyClientImpl
41 IDirectPlay8LobbyClient IDirectPlay8LobbyClient_iface;
42 LONG ref;
43 } IDirectPlay8LobbyClientImpl;
45 static inline IDirectPlay8LobbyClientImpl *impl_from_IDirectPlay8LobbyClient(IDirectPlay8LobbyClient *iface)
47 return CONTAINING_RECORD(iface, IDirectPlay8LobbyClientImpl, IDirectPlay8LobbyClient_iface);
50 static inline IDirectPlay8ClientImpl *impl_from_IDirectPlay8Client(IDirectPlay8Client *iface)
52 return CONTAINING_RECORD(iface, IDirectPlay8ClientImpl, IDirectPlay8Client_iface);
55 /* IDirectPlay8Client IUnknown parts follow: */
56 static HRESULT WINAPI IDirectPlay8ClientImpl_QueryInterface(IDirectPlay8Client *iface, REFIID riid,
57 void **ppobj)
59 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
61 if (IsEqualGUID(riid, &IID_IUnknown)
62 || IsEqualGUID(riid, &IID_IDirectPlay8Client)) {
63 IUnknown_AddRef(iface);
64 *ppobj = This;
65 return DPN_OK;
68 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
69 return E_NOINTERFACE;
72 static ULONG WINAPI IDirectPlay8ClientImpl_AddRef(IDirectPlay8Client *iface)
74 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
75 ULONG ref = InterlockedIncrement(&This->ref);
77 TRACE("(%p) ref=%u\n", This, ref);
79 return ref;
82 static ULONG WINAPI IDirectPlay8ClientImpl_Release(IDirectPlay8Client *iface)
84 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
85 ULONG ref = InterlockedDecrement(&This->ref);
87 TRACE("(%p) ref=%u\n", This, ref);
89 if (!ref) {
90 HeapFree(GetProcessHeap(), 0, This);
92 return ref;
95 /* IDirectPlay8Client Interface follow: */
97 static HRESULT WINAPI IDirectPlay8ClientImpl_Initialize(IDirectPlay8Client *iface,
98 void * const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags)
100 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
102 TRACE("(%p):(%p,%p,%x)\n", This, pvUserContext, pfn, dwFlags);
104 if(!pfn)
105 return DPNERR_INVALIDPARAM;
107 This->usercontext = pvUserContext;
108 This->msghandler = pfn;
109 This->flags = dwFlags;
111 return DPN_OK;
114 static HRESULT WINAPI IDirectPlay8ClientImpl_EnumServiceProviders(IDirectPlay8Client *iface,
115 const GUID * const pguidServiceProvider, const GUID * const pguidApplication,
116 DPN_SERVICE_PROVIDER_INFO * const pSPInfoBuffer, PDWORD const pcbEnumData,
117 PDWORD const pcReturned, const DWORD dwFlags)
119 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
120 FIXME("(%p):(%x): Stub\n", This, dwFlags);
121 return DPN_OK;
124 static HRESULT WINAPI IDirectPlay8ClientImpl_EnumHosts(IDirectPlay8Client *iface,
125 PDPN_APPLICATION_DESC const pApplicationDesc, IDirectPlay8Address * const pAddrHost,
126 IDirectPlay8Address * const pDeviceInfo, void * const pUserEnumData,
127 const DWORD dwUserEnumDataSize, const DWORD dwEnumCount, const DWORD dwRetryInterval,
128 const DWORD dwTimeOut, void * const pvUserContext, DPNHANDLE * const pAsyncHandle,
129 const DWORD dwFlags)
131 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
132 FIXME("(%p):(%p,%p,%x): Stub\n", This, pvUserContext, pAsyncHandle, dwFlags);
133 return DPN_OK;
136 static HRESULT WINAPI IDirectPlay8ClientImpl_CancelAsyncOperation(IDirectPlay8Client *iface,
137 const DPNHANDLE hAsyncHandle, const DWORD dwFlags)
139 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
140 FIXME("(%p):(%u,%x): Stub\n", This, hAsyncHandle, dwFlags);
141 return DPN_OK;
144 static HRESULT WINAPI IDirectPlay8ClientImpl_Connect(IDirectPlay8Client *iface,
145 const DPN_APPLICATION_DESC * const pdnAppDesc, IDirectPlay8Address * const pHostAddr,
146 IDirectPlay8Address * const pDeviceInfo, const DPN_SECURITY_DESC * const pdnSecurity,
147 const DPN_SECURITY_CREDENTIALS * const pdnCredentials, const void * const pvUserConnectData,
148 const DWORD dwUserConnectDataSize, void * const pvAsyncContext,
149 DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
151 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
152 FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
153 return DPN_OK;
156 static HRESULT WINAPI IDirectPlay8ClientImpl_Send(IDirectPlay8Client *iface,
157 const DPN_BUFFER_DESC * const prgBufferDesc, const DWORD cBufferDesc, const DWORD dwTimeOut,
158 void * const pvAsyncContext, DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
160 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
161 FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
162 return DPN_OK;
165 static HRESULT WINAPI IDirectPlay8ClientImpl_GetSendQueueInfo(IDirectPlay8Client *iface,
166 DWORD * const pdwNumMsgs, DWORD * const pdwNumBytes, const DWORD dwFlags)
168 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
169 FIXME("(%p):(%x): Stub\n", This, dwFlags);
170 return DPN_OK;
173 static HRESULT WINAPI IDirectPlay8ClientImpl_GetApplicationDesc(IDirectPlay8Client *iface,
174 DPN_APPLICATION_DESC * const pAppDescBuffer, DWORD * const pcbDataSize, const DWORD dwFlags)
176 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
177 FIXME("(%p):(%x): Stub\n", This, dwFlags);
178 return DPN_OK;
181 static HRESULT WINAPI IDirectPlay8ClientImpl_SetClientInfo(IDirectPlay8Client *iface,
182 const DPN_PLAYER_INFO * const pdpnPlayerInfo, void * const pvAsyncContext,
183 DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
185 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
186 FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
187 return DPN_OK;
190 static HRESULT WINAPI IDirectPlay8ClientImpl_GetServerInfo(IDirectPlay8Client *iface,
191 DPN_PLAYER_INFO * const pdpnPlayerInfo, DWORD * const pdwSize, const DWORD dwFlags)
193 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
194 FIXME("(%p):(%x): Stub\n", This, dwFlags);
195 return DPN_OK;
198 static HRESULT WINAPI IDirectPlay8ClientImpl_GetServerAddress(IDirectPlay8Client *iface,
199 IDirectPlay8Address ** const pAddress, const DWORD dwFlags)
201 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
202 FIXME("(%p):(%x): Stub\n", This, dwFlags);
203 return DPN_OK;
206 static HRESULT WINAPI IDirectPlay8ClientImpl_Close(IDirectPlay8Client *iface, const DWORD dwFlags)
208 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
209 FIXME("(%p):(%x): Stub\n", This, dwFlags);
210 return DPN_OK;
213 static HRESULT WINAPI IDirectPlay8ClientImpl_ReturnBuffer(IDirectPlay8Client *iface,
214 const DPNHANDLE hBufferHandle, const DWORD dwFlags)
216 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
217 FIXME("(%p):(%x): Stub\n", This, dwFlags);
218 return DPN_OK;
221 static HRESULT WINAPI IDirectPlay8ClientImpl_GetCaps(IDirectPlay8Client *iface,
222 DPN_CAPS * const pdpCaps, const DWORD dwFlags)
224 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
225 FIXME("(%p):(%x): Stub\n", This, dwFlags);
226 return DPN_OK;
229 static HRESULT WINAPI IDirectPlay8ClientImpl_SetCaps(IDirectPlay8Client *iface,
230 const DPN_CAPS * const pdpCaps, const DWORD dwFlags)
232 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
233 FIXME("(%p):(%x): Stub\n", This, dwFlags);
234 return DPN_OK;
237 static HRESULT WINAPI IDirectPlay8ClientImpl_SetSPCaps(IDirectPlay8Client *iface,
238 const GUID * const pguidSP, const DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags)
240 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
241 FIXME("(%p):(%x): Stub\n", This, dwFlags);
242 return DPN_OK;
245 static HRESULT WINAPI IDirectPlay8ClientImpl_GetSPCaps(IDirectPlay8Client *iface,
246 const GUID * const pguidSP, DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags)
248 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
250 TRACE("(%p)->(%p,%p,%x)\n", This, pguidSP, pdpspCaps, dwFlags);
252 if(!This->msghandler)
253 return DPNERR_UNINITIALIZED;
255 if(pdpspCaps->dwSize != sizeof(DPN_SP_CAPS))
257 return DPNERR_INVALIDPARAM;
260 *pdpspCaps = This->spcaps;
262 return DPN_OK;
265 static HRESULT WINAPI IDirectPlay8ClientImpl_GetConnectionInfo(IDirectPlay8Client *iface,
266 DPN_CONNECTION_INFO * const pdpConnectionInfo, const DWORD dwFlags)
268 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
269 FIXME("(%p):(%x): Stub\n", This, dwFlags);
270 return DPN_OK;
273 static HRESULT WINAPI IDirectPlay8ClientImpl_RegisterLobby(IDirectPlay8Client *iface,
274 const DPNHANDLE dpnHandle,
275 struct IDirectPlay8LobbiedApplication * const pIDP8LobbiedApplication, const DWORD dwFlags)
277 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
278 FIXME("(%p):(%x): Stub\n", This, dwFlags);
279 return DPN_OK;
282 static const IDirectPlay8ClientVtbl DirectPlay8Client_Vtbl =
284 IDirectPlay8ClientImpl_QueryInterface,
285 IDirectPlay8ClientImpl_AddRef,
286 IDirectPlay8ClientImpl_Release,
287 IDirectPlay8ClientImpl_Initialize,
288 IDirectPlay8ClientImpl_EnumServiceProviders,
289 IDirectPlay8ClientImpl_EnumHosts,
290 IDirectPlay8ClientImpl_CancelAsyncOperation,
291 IDirectPlay8ClientImpl_Connect,
292 IDirectPlay8ClientImpl_Send,
293 IDirectPlay8ClientImpl_GetSendQueueInfo,
294 IDirectPlay8ClientImpl_GetApplicationDesc,
295 IDirectPlay8ClientImpl_SetClientInfo,
296 IDirectPlay8ClientImpl_GetServerInfo,
297 IDirectPlay8ClientImpl_GetServerAddress,
298 IDirectPlay8ClientImpl_Close,
299 IDirectPlay8ClientImpl_ReturnBuffer,
300 IDirectPlay8ClientImpl_GetCaps,
301 IDirectPlay8ClientImpl_SetCaps,
302 IDirectPlay8ClientImpl_SetSPCaps,
303 IDirectPlay8ClientImpl_GetSPCaps,
304 IDirectPlay8ClientImpl_GetConnectionInfo,
305 IDirectPlay8ClientImpl_RegisterLobby
308 HRESULT DPNET_CreateDirectPlay8Client(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv)
310 IDirectPlay8ClientImpl* client;
311 HRESULT hr;
313 TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppv);
315 *ppv = NULL;
317 if(pUnkOuter)
318 return CLASS_E_NOAGGREGATION;
320 client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8ClientImpl));
321 if (!client)
322 return E_OUTOFMEMORY;
324 client->IDirectPlay8Client_iface.lpVtbl = &DirectPlay8Client_Vtbl;
325 client->ref = 1;
327 init_dpn_sp_caps(&client->spcaps);
329 hr = IDirectPlay8ClientImpl_QueryInterface(&client->IDirectPlay8Client_iface, riid, ppv);
330 IDirectPlay8ClientImpl_Release(&client->IDirectPlay8Client_iface);
332 return hr;
335 static HRESULT WINAPI lobbyclient_QueryInterface(IDirectPlay8LobbyClient *iface, REFIID riid, void **obj)
337 IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
339 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
341 *obj = NULL;
343 if (IsEqualGUID(riid, &IID_IUnknown) ||
344 IsEqualGUID(riid, &IID_IDirectPlay8LobbyClient))
346 *obj = &This->IDirectPlay8LobbyClient_iface;
347 IUnknown_AddRef( (IUnknown*)*obj);
349 return DPN_OK;
352 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),obj);
353 return E_NOINTERFACE;
356 static ULONG WINAPI lobbyclient_AddRef(IDirectPlay8LobbyClient *iface)
358 IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
359 ULONG ref = InterlockedIncrement(&This->ref);
361 TRACE("(%p) ref=%u\n", This, ref);
363 return ref;
366 static ULONG WINAPI lobbyclient_Release(IDirectPlay8LobbyClient *iface)
368 IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
369 ULONG ref = InterlockedDecrement(&This->ref);
371 TRACE("(%p) ref=%u\n", This, ref);
373 if (!ref)
375 HeapFree(GetProcessHeap(), 0, This);
378 return ref;
381 static HRESULT WINAPI lobbyclient_Initialize(IDirectPlay8LobbyClient *iface, void *context,
382 PFNDPNMESSAGEHANDLER msghandler, DWORD flags)
384 IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
386 FIXME("(%p)->(%p %p 0x%08x)\n", This, context, msghandler, flags);
388 return E_NOTIMPL;
391 static HRESULT WINAPI lobbyclient_EnumLocalPrograms(IDirectPlay8LobbyClient *iface, GUID* guidapplication,
392 BYTE *enumdata, DWORD *enumDataSize, DWORD *items, DWORD flags)
394 IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
396 FIXME("(%p)->(%p %p %p %p 0x%08x)\n", This, guidapplication, enumdata, enumDataSize, items, flags);
398 return E_NOTIMPL;
401 static HRESULT WINAPI lobbyclient_ConnectApplication(IDirectPlay8LobbyClient *iface, DPL_CONNECT_INFO *connectioninfo,
402 void *connectioncontext, DPNHANDLE *application, DWORD timeout,
403 DWORD flags)
405 IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
407 FIXME("(%p)->(%p %p %p %u 0x%08x)\n", This, connectioninfo, connectioncontext, application, timeout, flags);
409 return E_NOTIMPL;
412 static HRESULT WINAPI lobbyclient_Send(IDirectPlay8LobbyClient *iface, DPNHANDLE connection, BYTE *buffer, DWORD buffersize, DWORD flags)
414 IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
416 FIXME("(%p)->(%u %p %u 0x%08x)\n", This, connection, buffer, buffersize, flags);
418 return E_NOTIMPL;
421 static HRESULT WINAPI lobbyclient_ReleaseApplication(IDirectPlay8LobbyClient *iface, DPNHANDLE connection, DWORD flags)
423 IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
425 FIXME("(%p)->(%u 0x%08x)\n", This, connection, flags);
427 return E_NOTIMPL;
430 static HRESULT WINAPI lobbyclient_Close(IDirectPlay8LobbyClient *iface, DWORD flags)
432 IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
434 FIXME("(%p)->(0x%08x)\n", This, flags);
436 return E_NOTIMPL;
439 static HRESULT WINAPI lobbyclient_GetConnectionSettings(IDirectPlay8LobbyClient *iface, DPNHANDLE connection, DPL_CONNECTION_SETTINGS *sessioninfo, DWORD *infosize, DWORD flags)
441 IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
443 FIXME("(%p)->(%u %p %p 0x%08x)\n", This, connection, sessioninfo, infosize, flags);
445 return E_NOTIMPL;
448 static HRESULT WINAPI lobbyclient_SetConnectionSettings(IDirectPlay8LobbyClient *iface, DPNHANDLE connection, const DPL_CONNECTION_SETTINGS *sessioninfo, DWORD flags)
450 IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
452 FIXME("(%p)->(%u %p 0x%08x)\n", This, connection, sessioninfo, flags);
454 return E_NOTIMPL;
457 static const IDirectPlay8LobbyClientVtbl DirectPlay8LobbiedClient_Vtbl =
459 lobbyclient_QueryInterface,
460 lobbyclient_AddRef,
461 lobbyclient_Release,
462 lobbyclient_Initialize,
463 lobbyclient_EnumLocalPrograms,
464 lobbyclient_ConnectApplication,
465 lobbyclient_Send,
466 lobbyclient_ReleaseApplication,
467 lobbyclient_Close,
468 lobbyclient_GetConnectionSettings,
469 lobbyclient_SetConnectionSettings
472 HRESULT DPNET_CreateDirectPlay8LobbyClient(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
474 IDirectPlay8LobbyClientImpl *client;
475 HRESULT ret;
477 TRACE("%p (%p, %s, %p)\n", iface, outer, debugstr_guid(riid), obj);
479 client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*client));
480 if (!client)
482 *obj = NULL;
483 return E_OUTOFMEMORY;
486 client->IDirectPlay8LobbyClient_iface.lpVtbl = &DirectPlay8LobbiedClient_Vtbl;
487 client->ref = 1;
489 ret = lobbyclient_QueryInterface(&client->IDirectPlay8LobbyClient_iface, riid, obj);
490 lobbyclient_Release(&client->IDirectPlay8LobbyClient_iface);
492 return ret;