mstask: COM cleanup for the ITaskScheduler iface.
[wine.git] / dlls / dpnet / peer.c
blob1bc3b47bbea973ee91aa4d4331c3d0bbb8d21b38
1 /*
2 * DirectPlay8 Peer
3 *
4 * Copyright 2004 Raphael Junqueira
5 * Copyright 2008 Alexander N. Sørnes <alex@thehandofagony.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "config.h"
25 #include <stdarg.h>
27 #define COBJMACROS
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "winuser.h"
32 #include "objbase.h"
33 #include "wine/debug.h"
35 #include "dplay8.h"
36 #include "dpnet_private.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
40 /* IUnknown interface follows */
42 static HRESULT WINAPI IDirectPlay8PeerImpl_QueryInterface(PDIRECTPLAY8PEER iface, REFIID riid, LPVOID* ppobj)
44 IDirectPlay8PeerImpl* This = (IDirectPlay8PeerImpl*)iface;
46 if(IsEqualGUID(riid, &IID_IUnknown) ||
47 IsEqualGUID(riid, &IID_IDirectPlay8Peer))
49 IUnknown_AddRef(iface);
50 *ppobj = This;
51 return DPN_OK;
54 WARN("(%p)->(%s,%p): not found\n", This, debugstr_guid(riid), ppobj);
55 return E_NOINTERFACE;
58 static ULONG WINAPI IDirectPlay8PeerImpl_AddRef(PDIRECTPLAY8PEER iface)
60 IDirectPlay8PeerImpl* This = (IDirectPlay8PeerImpl*)iface;
61 ULONG RefCount = InterlockedIncrement(&This->ref);
63 return RefCount;
66 static ULONG WINAPI IDirectPlay8PeerImpl_Release(PDIRECTPLAY8PEER iface)
68 IDirectPlay8PeerImpl* This = (IDirectPlay8PeerImpl*)iface;
69 ULONG RefCount = InterlockedDecrement(&This->ref);
71 if(!RefCount)
72 HeapFree(GetProcessHeap(), 0, This);
74 return RefCount;
77 /* IDirectPlay8Peer interface follows */
79 static HRESULT WINAPI IDirectPlay8PeerImpl_Initialize(PDIRECTPLAY8PEER iface, PVOID CONST pvUserContext, CONST PFNDPNMESSAGEHANDLER pfn, CONST DWORD dwFlags)
81 FIXME("(%p)->(%p,%p,%x): stub\n", iface, pvUserContext, pfn, dwFlags);
83 return DPNERR_GENERIC;
86 static HRESULT WINAPI IDirectPlay8PeerImpl_EnumServiceProviders(PDIRECTPLAY8PEER iface, CONST GUID *CONST pguidServiceProvider, CONST GUID *CONST pguidApplication, DPN_SERVICE_PROVIDER_INFO *CONST pSPInfoBuffer, DWORD *CONST pcbEnumData, DWORD *CONST pcReturned, CONST DWORD dwFlags)
88 FIXME("(%p)->(%p,%p,%p,%p,%p,%x): stub\n", iface, pguidServiceProvider, pguidApplication, pSPInfoBuffer, pcbEnumData, pcReturned, dwFlags);
89 return DPNERR_GENERIC;
92 static HRESULT WINAPI IDirectPlay8PeerImpl_CancelAsyncOperation(PDIRECTPLAY8PEER iface,
93 CONST DPNHANDLE hAsyncHandle,
94 CONST DWORD dwFlags)
96 FIXME("(%p)->(%x,%x): stub\n", iface, hAsyncHandle, dwFlags);
98 return DPNERR_GENERIC;
101 static HRESULT WINAPI IDirectPlay8PeerImpl_Connect(PDIRECTPLAY8PEER iface,
102 CONST DPN_APPLICATION_DESC* CONST pdnAppDesc,
103 IDirectPlay8Address *CONST pHostAddr,
104 IDirectPlay8Address *CONST pDeviceInfo,
105 CONST DPN_SECURITY_DESC *CONST pdnSecurity,
106 CONST DPN_SECURITY_CREDENTIALS *CONST pdnCredentials,
107 CONST VOID *CONST pvUserConnectData,
108 CONST DWORD dwUserConnectDataSize,
109 VOID *CONST pvPlayerContext,
110 VOID *CONST pvAsyncContext,
111 DPNHANDLE *CONST phAsyncHandle,
112 CONST DWORD dwFlags)
114 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);
116 return DPNERR_GENERIC;
119 static HRESULT WINAPI IDirectPlay8PeerImpl_SendTo(PDIRECTPLAY8PEER iface,
120 CONST DPNID dpnId,
121 CONST DPN_BUFFER_DESC *pBufferDesc,
122 CONST DWORD cBufferDesc,
123 CONST DWORD dwTimeOut,
124 VOID *CONST pvAsyncContext,
125 DPNHANDLE *CONST phAsyncHandle,
126 CONST DWORD dwFlags)
128 FIXME("(%p)->(%x,%p,%x,%x,%p,%p,%x): stub\n", iface, dpnId, pBufferDesc, cBufferDesc, dwTimeOut, pvAsyncContext, phAsyncHandle, dwFlags);
130 return DPNERR_GENERIC;
133 static HRESULT WINAPI IDirectPlay8PeerImpl_GetSendQueueInfo(PDIRECTPLAY8PEER iface,
134 CONST DPNID dpnid,
135 DWORD *CONST pdwNumMsgs,
136 DWORD *CONST pdwNumBytes,
137 CONST DWORD dwFlags)
139 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, dpnid, pdwNumMsgs, pdwNumBytes, dwFlags);
141 return DPNERR_GENERIC;
144 static HRESULT WINAPI IDirectPlay8PeerImpl_Host(PDIRECTPLAY8PEER iface,
145 CONST DPN_APPLICATION_DESC *CONST pdnAppDesc,
146 IDirectPlay8Address **CONST prgpDeviceInfo,
147 CONST DWORD cDeviceInfo,
148 CONST DPN_SECURITY_DESC *CONST pdpSecurity,
149 CONST DPN_SECURITY_CREDENTIALS *CONST pdpCredentials,
150 VOID *CONST pvPlayerContext,
151 CONST DWORD dwFlags)
153 FIXME("(%p)->(%p,%p,%x,%p,%p,%p,%x): stub\n", iface, pdnAppDesc, prgpDeviceInfo, cDeviceInfo, pdpSecurity, pdpCredentials, pvPlayerContext, dwFlags);
155 return DPNERR_GENERIC;
158 static HRESULT WINAPI IDirectPlay8PeerImpl_GetApplicationDesc(PDIRECTPLAY8PEER iface,
159 DPN_APPLICATION_DESC *CONST pAppDescBuffer,
160 DWORD *CONST pcbDataSize,
161 CONST DWORD dwFlags)
163 FIXME("(%p)->(%p,%p,%x): stub\n", iface, pAppDescBuffer, pcbDataSize, dwFlags);
165 return DPNERR_GENERIC;
168 static HRESULT WINAPI IDirectPlay8PeerImpl_SetApplicationDesc(PDIRECTPLAY8PEER iface,
169 CONST DPN_APPLICATION_DESC *CONST pad,
170 CONST DWORD dwFlags)
172 FIXME("(%p)->(%p,%x): stub\n", iface, pad, dwFlags);
174 return DPNERR_GENERIC;
177 static HRESULT WINAPI IDirectPlay8PeerImpl_CreateGroup(PDIRECTPLAY8PEER iface,
178 CONST DPN_GROUP_INFO *CONST pdpnGroupInfo,
179 VOID *CONST pvGroupContext,
180 VOID *CONST pvAsyncContext,
181 DPNHANDLE *CONST phAsyncHandle,
182 CONST DWORD dwFlags)
184 FIXME("(%p)->(%p,%p,%p,%p,%x): stub\n", iface, pdpnGroupInfo, pvGroupContext, pvAsyncContext, phAsyncHandle, dwFlags);
186 return DPNERR_GENERIC;
189 static HRESULT WINAPI IDirectPlay8PeerImpl_DestroyGroup(PDIRECTPLAY8PEER iface,
190 CONST DPNID idGroup,
191 PVOID CONST pvAsyncContext,
192 DPNHANDLE *CONST phAsyncHandle,
193 CONST DWORD dwFlags)
195 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, idGroup, pvAsyncContext, phAsyncHandle, dwFlags);
197 return DPNERR_GENERIC;
200 static HRESULT WINAPI IDirectPlay8PeerImpl_AddPlayerToGroup(PDIRECTPLAY8PEER iface,
201 CONST DPNID idGroup,
202 CONST DPNID idClient,
203 PVOID CONST pvAsyncContext,
204 DPNHANDLE *CONST phAsyncHandle,
205 CONST DWORD dwFlags)
207 FIXME("(%p)->(%x,%x,%p,%p,%x): stub\n", iface, idGroup, idClient, pvAsyncContext, phAsyncHandle, dwFlags);
209 return DPNERR_GENERIC;
212 static HRESULT WINAPI IDirectPlay8PeerImpl_RemovePlayerFromGroup(PDIRECTPLAY8PEER iface,
213 CONST DPNID idGroup,
214 CONST DPNID idClient,
215 PVOID CONST pvAsyncContext,
216 DPNHANDLE *CONST phAsyncHandle,
217 CONST DWORD dwFlags)
219 FIXME("(%p)->(%x,%x,%p,%p,%x): stub\n", iface, idGroup, idClient, pvAsyncContext, phAsyncHandle, dwFlags);
221 return DPNERR_GENERIC;
224 static HRESULT WINAPI IDirectPlay8PeerImpl_SetGroupInfo(PDIRECTPLAY8PEER iface,
225 CONST DPNID dpnid,
226 DPN_GROUP_INFO *CONST pdpnGroupInfo,
227 PVOID CONST pvAsyncContext,
228 DPNHANDLE *CONST phAsyncHandle,
229 CONST DWORD dwFlags)
231 FIXME("(%p)->(%x,%p,%p,%p,%x): stub\n", iface, dpnid, pdpnGroupInfo, pvAsyncContext, phAsyncHandle, dwFlags);
233 return DPNERR_GENERIC;
236 static HRESULT WINAPI IDirectPlay8PeerImpl_GetGroupInfo(PDIRECTPLAY8PEER iface,
237 CONST DPNID dpnid,
238 DPN_GROUP_INFO *CONST pdpnGroupInfo,
239 DWORD *CONST pdwSize,
240 CONST DWORD dwFlags)
242 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, dpnid, pdpnGroupInfo, pdwSize, dwFlags);
244 return DPNERR_GENERIC;
247 static HRESULT WINAPI IDirectPlay8PeerImpl_EnumPlayersAndGroups(PDIRECTPLAY8PEER iface,
248 DPNID *CONST prgdpnid,
249 DWORD *CONST pcdpnid,
250 CONST DWORD dwFlags)
252 FIXME("(%p)->(%p,%p,%x): stub\n", iface, prgdpnid, pcdpnid, dwFlags);
254 return DPNERR_GENERIC;
257 static HRESULT WINAPI IDirectPlay8PeerImpl_EnumGroupMembers(PDIRECTPLAY8PEER iface,
258 CONST DPNID dpnid,
259 DPNID *CONST prgdpnid,
260 DWORD *CONST pcdpnid,
261 CONST DWORD dwFlags)
263 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, dpnid, prgdpnid, pcdpnid, dwFlags);
265 return DPNERR_GENERIC;
268 static HRESULT WINAPI IDirectPlay8PeerImpl_SetPeerInfo(PDIRECTPLAY8PEER iface,
269 CONST DPN_PLAYER_INFO *CONST pdpnPlayerInfo,
270 PVOID CONST pvAsyncContext,
271 DPNHANDLE *CONST phAsyncHandle,
272 CONST DWORD dwFlags)
274 FIXME("(%p)->(%p,%p,%p,%x): stub\n", iface, pdpnPlayerInfo, pvAsyncContext, phAsyncHandle, dwFlags);
276 return DPNERR_GENERIC;
279 static HRESULT WINAPI IDirectPlay8PeerImpl_GetPeerInfo(PDIRECTPLAY8PEER iface,
280 CONST DPNID dpnid,
281 DPN_PLAYER_INFO *CONST pdpnPlayerInfo,
282 DWORD *CONST pdwSize,
283 CONST DWORD dwFlags)
285 FIXME("(%p)->(%x,%p,%p,%x): stub\n", iface, dpnid, pdpnPlayerInfo, pdwSize, dwFlags);
287 return DPNERR_GENERIC;
290 static HRESULT WINAPI IDirectPlay8PeerImpl_GetPeerAddress(PDIRECTPLAY8PEER iface,
291 CONST DPNID dpnid,
292 IDirectPlay8Address **CONST pAddress,
293 CONST DWORD dwFlags)
295 FIXME("(%p)->(%x,%p,%x): stub\n", iface, dpnid, pAddress, dwFlags);
297 return DPNERR_GENERIC;
300 static HRESULT WINAPI IDirectPlay8PeerImpl_GetLocalHostAddresses(PDIRECTPLAY8PEER iface,
301 IDirectPlay8Address **CONST prgpAddress,
302 DWORD *CONST pcAddress,
303 CONST DWORD dwFlags)
305 FIXME("(%p)->(%p,%p,%x): stub\n", iface, prgpAddress, pcAddress, dwFlags);
307 return DPNERR_GENERIC;
310 static HRESULT WINAPI IDirectPlay8PeerImpl_Close(PDIRECTPLAY8PEER iface,
311 CONST DWORD dwFlags)
313 FIXME("(%p)->(%x): stub\n", iface, dwFlags);
315 return DPN_OK;
318 static const IDirectPlay8PeerVtbl DirectPlay8Peer_Vtbl =
320 IDirectPlay8PeerImpl_QueryInterface,
321 IDirectPlay8PeerImpl_AddRef,
322 IDirectPlay8PeerImpl_Release,
323 IDirectPlay8PeerImpl_Initialize,
324 IDirectPlay8PeerImpl_EnumServiceProviders,
325 IDirectPlay8PeerImpl_CancelAsyncOperation,
326 IDirectPlay8PeerImpl_Connect,
327 IDirectPlay8PeerImpl_SendTo,
328 IDirectPlay8PeerImpl_GetSendQueueInfo,
329 IDirectPlay8PeerImpl_Host,
330 IDirectPlay8PeerImpl_GetApplicationDesc,
331 IDirectPlay8PeerImpl_SetApplicationDesc,
332 IDirectPlay8PeerImpl_CreateGroup,
333 IDirectPlay8PeerImpl_DestroyGroup,
334 IDirectPlay8PeerImpl_AddPlayerToGroup,
335 IDirectPlay8PeerImpl_RemovePlayerFromGroup,
336 IDirectPlay8PeerImpl_SetGroupInfo,
337 IDirectPlay8PeerImpl_GetGroupInfo,
338 IDirectPlay8PeerImpl_EnumPlayersAndGroups,
339 IDirectPlay8PeerImpl_EnumGroupMembers,
340 IDirectPlay8PeerImpl_SetPeerInfo,
341 IDirectPlay8PeerImpl_GetPeerInfo,
342 IDirectPlay8PeerImpl_GetPeerAddress,
343 IDirectPlay8PeerImpl_GetLocalHostAddresses,
344 IDirectPlay8PeerImpl_Close
347 HRESULT DPNET_CreateDirectPlay8Peer(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) {
348 IDirectPlay8PeerImpl* Client;
349 HRESULT Ret;
351 Client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8PeerImpl));
353 if(Client == NULL)
355 *ppobj = NULL;
356 WARN("Not enough memory\n");
357 return E_OUTOFMEMORY;
360 Client->lpVtbl = &DirectPlay8Peer_Vtbl;
361 if((Ret = IDirectPlay8PeerImpl_QueryInterface((PDIRECTPLAY8PEER)Client, riid, ppobj)) != DPN_OK)
362 HeapFree(GetProcessHeap(), 0, Client);
364 return Ret;