Add AppDefaults app selection to control panel
[wine/gsoc-2012-control.git] / dlls / dpnet / client.c
blob637dcb8ccb28ac00d1613c04b55731668f6607eb
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 static inline IDirectPlay8ClientImpl *impl_from_IDirectPlay8Client(IDirectPlay8Client *iface)
41 return CONTAINING_RECORD(iface, IDirectPlay8ClientImpl, IDirectPlay8Client_iface);
44 /* IDirectPlay8Client IUnknown parts follow: */
45 static HRESULT WINAPI IDirectPlay8ClientImpl_QueryInterface(IDirectPlay8Client *iface, REFIID riid,
46 void **ppobj)
48 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
50 if (IsEqualGUID(riid, &IID_IUnknown)
51 || IsEqualGUID(riid, &IID_IDirectPlay8Client)) {
52 IUnknown_AddRef(iface);
53 *ppobj = This;
54 return DPN_OK;
57 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
58 return E_NOINTERFACE;
61 static ULONG WINAPI IDirectPlay8ClientImpl_AddRef(IDirectPlay8Client *iface)
63 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
64 ULONG refCount = InterlockedIncrement(&This->ref);
66 TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
68 return refCount;
71 static ULONG WINAPI IDirectPlay8ClientImpl_Release(IDirectPlay8Client *iface)
73 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
74 ULONG refCount = InterlockedDecrement(&This->ref);
76 TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
78 if (!refCount) {
79 HeapFree(GetProcessHeap(), 0, This);
81 return refCount;
84 /* IDirectPlay8Client Interface follow: */
86 static HRESULT WINAPI IDirectPlay8ClientImpl_Initialize(IDirectPlay8Client *iface,
87 void * const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags)
89 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
90 FIXME("(%p):(%p,%p,%x): Stub\n", This, pvUserContext, pfn, dwFlags);
91 return DPN_OK;
94 static HRESULT WINAPI IDirectPlay8ClientImpl_EnumServiceProviders(IDirectPlay8Client *iface,
95 const GUID * const pguidServiceProvider, const GUID * const pguidApplication,
96 DPN_SERVICE_PROVIDER_INFO * const pSPInfoBuffer, PDWORD const pcbEnumData,
97 PDWORD const pcReturned, const DWORD dwFlags)
99 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
100 FIXME("(%p):(%x): Stub\n", This, dwFlags);
101 return DPN_OK;
104 static HRESULT WINAPI IDirectPlay8ClientImpl_EnumHosts(IDirectPlay8Client *iface,
105 PDPN_APPLICATION_DESC const pApplicationDesc, IDirectPlay8Address * const pAddrHost,
106 IDirectPlay8Address * const pDeviceInfo, void * const pUserEnumData,
107 const DWORD dwUserEnumDataSize, const DWORD dwEnumCount, const DWORD dwRetryInterval,
108 const DWORD dwTimeOut, void * const pvUserContext, DPNHANDLE * const pAsyncHandle,
109 const DWORD dwFlags)
111 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
112 FIXME("(%p):(%p,%p,%x): Stub\n", This, pvUserContext, pAsyncHandle, dwFlags);
113 return DPN_OK;
116 static HRESULT WINAPI IDirectPlay8ClientImpl_CancelAsyncOperation(IDirectPlay8Client *iface,
117 const DPNHANDLE hAsyncHandle, const DWORD dwFlags)
119 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
120 FIXME("(%p):(%u,%x): Stub\n", This, hAsyncHandle, dwFlags);
121 return DPN_OK;
124 static HRESULT WINAPI IDirectPlay8ClientImpl_Connect(IDirectPlay8Client *iface,
125 const DPN_APPLICATION_DESC * const pdnAppDesc, IDirectPlay8Address * const pHostAddr,
126 IDirectPlay8Address * const pDeviceInfo, const DPN_SECURITY_DESC * const pdnSecurity,
127 const DPN_SECURITY_CREDENTIALS * const pdnCredentials, const void * const pvUserConnectData,
128 const DWORD dwUserConnectDataSize, void * const pvAsyncContext,
129 DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
131 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
132 FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
133 return DPN_OK;
136 static HRESULT WINAPI IDirectPlay8ClientImpl_Send(IDirectPlay8Client *iface,
137 const DPN_BUFFER_DESC * const prgBufferDesc, const DWORD cBufferDesc, const DWORD dwTimeOut,
138 void * const pvAsyncContext, DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
140 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
141 FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
142 return DPN_OK;
145 static HRESULT WINAPI IDirectPlay8ClientImpl_GetSendQueueInfo(IDirectPlay8Client *iface,
146 DWORD * const pdwNumMsgs, DWORD * const pdwNumBytes, const DWORD dwFlags)
148 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
149 FIXME("(%p):(%x): Stub\n", This, dwFlags);
150 return DPN_OK;
153 static HRESULT WINAPI IDirectPlay8ClientImpl_GetApplicationDesc(IDirectPlay8Client *iface,
154 DPN_APPLICATION_DESC * const pAppDescBuffer, DWORD * const pcbDataSize, const DWORD dwFlags)
156 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
157 FIXME("(%p):(%x): Stub\n", This, dwFlags);
158 return DPN_OK;
161 static HRESULT WINAPI IDirectPlay8ClientImpl_SetClientInfo(IDirectPlay8Client *iface,
162 const DPN_PLAYER_INFO * const pdpnPlayerInfo, void * const pvAsyncContext,
163 DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
165 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
166 FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
167 return DPN_OK;
170 static HRESULT WINAPI IDirectPlay8ClientImpl_GetServerInfo(IDirectPlay8Client *iface,
171 DPN_PLAYER_INFO * const pdpnPlayerInfo, DWORD * const pdwSize, const DWORD dwFlags)
173 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
174 FIXME("(%p):(%x): Stub\n", This, dwFlags);
175 return DPN_OK;
178 static HRESULT WINAPI IDirectPlay8ClientImpl_GetServerAddress(IDirectPlay8Client *iface,
179 IDirectPlay8Address ** const pAddress, const DWORD dwFlags)
181 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
182 FIXME("(%p):(%x): Stub\n", This, dwFlags);
183 return DPN_OK;
186 static HRESULT WINAPI IDirectPlay8ClientImpl_Close(IDirectPlay8Client *iface, const DWORD dwFlags)
188 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
189 FIXME("(%p):(%x): Stub\n", This, dwFlags);
190 return DPN_OK;
193 static HRESULT WINAPI IDirectPlay8ClientImpl_ReturnBuffer(IDirectPlay8Client *iface,
194 const DPNHANDLE hBufferHandle, const DWORD dwFlags)
196 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
197 FIXME("(%p):(%x): Stub\n", This, dwFlags);
198 return DPN_OK;
201 static HRESULT WINAPI IDirectPlay8ClientImpl_GetCaps(IDirectPlay8Client *iface,
202 DPN_CAPS * const pdpCaps, const DWORD dwFlags)
204 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
205 FIXME("(%p):(%x): Stub\n", This, dwFlags);
206 return DPN_OK;
209 static HRESULT WINAPI IDirectPlay8ClientImpl_SetCaps(IDirectPlay8Client *iface,
210 const DPN_CAPS * const pdpCaps, const DWORD dwFlags)
212 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
213 FIXME("(%p):(%x): Stub\n", This, dwFlags);
214 return DPN_OK;
217 static HRESULT WINAPI IDirectPlay8ClientImpl_SetSPCaps(IDirectPlay8Client *iface,
218 const GUID * const pguidSP, const DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags)
220 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
221 FIXME("(%p):(%x): Stub\n", This, dwFlags);
222 return DPN_OK;
225 static HRESULT WINAPI IDirectPlay8ClientImpl_GetSPCaps(IDirectPlay8Client *iface,
226 const GUID * const pguidSP, DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags)
228 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
229 FIXME("(%p):(%x): Stub\n", This, dwFlags);
230 return DPN_OK;
233 static HRESULT WINAPI IDirectPlay8ClientImpl_GetConnectionInfo(IDirectPlay8Client *iface,
234 DPN_CONNECTION_INFO * const pdpConnectionInfo, const DWORD dwFlags)
236 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
237 FIXME("(%p):(%x): Stub\n", This, dwFlags);
238 return DPN_OK;
241 static HRESULT WINAPI IDirectPlay8ClientImpl_RegisterLobby(IDirectPlay8Client *iface,
242 const DPNHANDLE dpnHandle,
243 struct IDirectPlay8LobbiedApplication * const pIDP8LobbiedApplication, const DWORD dwFlags)
245 IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
246 FIXME("(%p):(%x): Stub\n", This, dwFlags);
247 return DPN_OK;
250 static const IDirectPlay8ClientVtbl DirectPlay8Client_Vtbl =
252 IDirectPlay8ClientImpl_QueryInterface,
253 IDirectPlay8ClientImpl_AddRef,
254 IDirectPlay8ClientImpl_Release,
255 IDirectPlay8ClientImpl_Initialize,
256 IDirectPlay8ClientImpl_EnumServiceProviders,
257 IDirectPlay8ClientImpl_EnumHosts,
258 IDirectPlay8ClientImpl_CancelAsyncOperation,
259 IDirectPlay8ClientImpl_Connect,
260 IDirectPlay8ClientImpl_Send,
261 IDirectPlay8ClientImpl_GetSendQueueInfo,
262 IDirectPlay8ClientImpl_GetApplicationDesc,
263 IDirectPlay8ClientImpl_SetClientInfo,
264 IDirectPlay8ClientImpl_GetServerInfo,
265 IDirectPlay8ClientImpl_GetServerAddress,
266 IDirectPlay8ClientImpl_Close,
267 IDirectPlay8ClientImpl_ReturnBuffer,
268 IDirectPlay8ClientImpl_GetCaps,
269 IDirectPlay8ClientImpl_SetCaps,
270 IDirectPlay8ClientImpl_SetSPCaps,
271 IDirectPlay8ClientImpl_GetSPCaps,
272 IDirectPlay8ClientImpl_GetConnectionInfo,
273 IDirectPlay8ClientImpl_RegisterLobby
276 HRESULT DPNET_CreateDirectPlay8Client(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) {
277 IDirectPlay8ClientImpl* client;
279 TRACE("(%p, %s, %p)\n", punkOuter, debugstr_guid(riid), ppobj);
281 client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8ClientImpl));
282 if (NULL == client) {
283 *ppobj = NULL;
284 return E_OUTOFMEMORY;
286 client->IDirectPlay8Client_iface.lpVtbl = &DirectPlay8Client_Vtbl;
287 client->ref = 0; /* will be inited with QueryInterface */
288 return IDirectPlay8ClientImpl_QueryInterface(&client->IDirectPlay8Client_iface, riid, ppobj);