dinput: Remove IDirectInputDevice8AImpl_{Build,Set}ActionMap() as it is unused.
[wine] / dlls / dpnet / client.c
1 /* 
2  * DirectPlay8 Client
3  * 
4  * Copyright 2004 Raphael Junqueira
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #include "config.h"
23
24 #include <stdarg.h>
25
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"
33
34 #include "dplay8.h"
35 #include "dpnet_private.h"
36
37 WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
38
39 /* IDirectPlay8Client IUnknown parts follow: */
40 static HRESULT WINAPI IDirectPlay8ClientImpl_QueryInterface(PDIRECTPLAY8CLIENT iface, REFIID riid, LPVOID *ppobj)
41 {
42     IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
43
44     if (IsEqualGUID(riid, &IID_IUnknown)
45         || IsEqualGUID(riid, &IID_IDirectPlay8Client)) {
46         IUnknown_AddRef(iface);
47         *ppobj = This;
48         return DPN_OK;
49     }
50
51     WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
52     return E_NOINTERFACE;
53 }
54
55 static ULONG WINAPI IDirectPlay8ClientImpl_AddRef(PDIRECTPLAY8CLIENT iface) {
56     IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
57     ULONG refCount = InterlockedIncrement(&This->ref);
58
59     TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
60
61     return refCount;
62 }
63
64 static ULONG WINAPI IDirectPlay8ClientImpl_Release(PDIRECTPLAY8CLIENT iface) {
65     IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
66     ULONG refCount = InterlockedDecrement(&This->ref);
67
68     TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
69
70     if (!refCount) {
71         HeapFree(GetProcessHeap(), 0, This);
72     }
73     return refCount;
74 }
75
76 /* IDirectPlay8Client Interface follow: */
77
78 static HRESULT WINAPI IDirectPlay8ClientImpl_Initialize(PDIRECTPLAY8CLIENT iface,  PVOID CONST pvUserContext, CONST PFNDPNMESSAGEHANDLER pfn, CONST DWORD dwFlags) { 
79   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
80   FIXME("(%p):(%p,%p,%x): Stub\n", This, pvUserContext, pfn, dwFlags);
81   return DPN_OK; 
82 }
83
84 static HRESULT WINAPI IDirectPlay8ClientImpl_EnumServiceProviders(PDIRECTPLAY8CLIENT iface, 
85                                                            CONST GUID * CONST pguidServiceProvider, 
86                                                            CONST GUID * CONST pguidApplication, 
87                                                            DPN_SERVICE_PROVIDER_INFO * CONST pSPInfoBuffer, 
88                                                            PDWORD CONST pcbEnumData, 
89                                                            PDWORD CONST pcReturned, 
90                                                            CONST DWORD dwFlags) { 
91   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
92   FIXME("(%p):(%x): Stub\n", This, dwFlags);
93   return DPN_OK; 
94 }
95
96 static HRESULT WINAPI IDirectPlay8ClientImpl_EnumHosts(PDIRECTPLAY8CLIENT iface, 
97                                                 PDPN_APPLICATION_DESC CONST pApplicationDesc, 
98                                                 IDirectPlay8Address * CONST pAddrHost, 
99                                                 IDirectPlay8Address * CONST pDeviceInfo, 
100                                                 PVOID CONST pUserEnumData, CONST DWORD dwUserEnumDataSize, CONST DWORD dwEnumCount, 
101                                                 CONST DWORD dwRetryInterval, 
102                                                 CONST DWORD dwTimeOut, 
103                                                 PVOID CONST pvUserContext, 
104                                                 DPNHANDLE * CONST pAsyncHandle, 
105                                                 CONST DWORD dwFlags) { 
106   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
107   /*FIXME("(%p):(%p,%p,%p,%p,%lu,%lu,%lu,%lu): Stub\n", This, pApplicationDesc, pAddrHost, pDeviceInfo, pUserEnumData, dwUserEnumDataSize, dwEnumCount, dwRetryInterval, dwTimeOut);*/
108   FIXME("(%p):(%p,%p,%x): Stub\n", This, pvUserContext, pAsyncHandle, dwFlags);
109   return DPN_OK; 
110 }
111
112 static HRESULT WINAPI IDirectPlay8ClientImpl_CancelAsyncOperation(PDIRECTPLAY8CLIENT iface, CONST DPNHANDLE hAsyncHandle, CONST DWORD dwFlags) { 
113   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
114   FIXME("(%p):(%u,%x): Stub\n", This, hAsyncHandle, dwFlags);
115   return DPN_OK; 
116 }
117
118 static HRESULT WINAPI IDirectPlay8ClientImpl_Connect(PDIRECTPLAY8CLIENT iface, 
119                                               CONST DPN_APPLICATION_DESC * CONST pdnAppDesc,
120                                               IDirectPlay8Address * CONST pHostAddr,
121                                               IDirectPlay8Address * CONST pDeviceInfo, 
122                                               CONST DPN_SECURITY_DESC * CONST pdnSecurity, 
123                                               CONST DPN_SECURITY_CREDENTIALS * CONST pdnCredentials, 
124                                               CONST void * CONST pvUserConnectData, 
125                                               CONST DWORD dwUserConnectDataSize, 
126                                               void * CONST pvAsyncContext, 
127                                               DPNHANDLE * CONST phAsyncHandle, 
128                                               CONST DWORD dwFlags) { 
129   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
130   FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
131   return DPN_OK; 
132 }
133
134 static HRESULT WINAPI IDirectPlay8ClientImpl_Send(PDIRECTPLAY8CLIENT iface, 
135                                            CONST DPN_BUFFER_DESC * CONST prgBufferDesc, 
136                                            CONST DWORD cBufferDesc, 
137                                            CONST DWORD dwTimeOut, 
138                                            void * CONST pvAsyncContext, 
139                                            DPNHANDLE * CONST phAsyncHandle, 
140                                            CONST DWORD dwFlags) { 
141   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
142   FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
143   return DPN_OK; 
144 }
145
146 static HRESULT WINAPI IDirectPlay8ClientImpl_GetSendQueueInfo(PDIRECTPLAY8CLIENT iface, DWORD * CONST pdwNumMsgs, DWORD * CONST pdwNumBytes, CONST DWORD dwFlags) {
147   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
148   FIXME("(%p):(%x): Stub\n", This, dwFlags);
149   return DPN_OK; 
150 }
151
152 static HRESULT WINAPI IDirectPlay8ClientImpl_GetApplicationDesc(PDIRECTPLAY8CLIENT iface, DPN_APPLICATION_DESC * CONST pAppDescBuffer, DWORD * CONST pcbDataSize, CONST DWORD dwFlags) { 
153   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
154   FIXME("(%p):(%x): Stub\n", This, dwFlags);
155   return DPN_OK; 
156 }
157
158 static HRESULT WINAPI IDirectPlay8ClientImpl_SetClientInfo(PDIRECTPLAY8CLIENT iface, 
159                                                     CONST DPN_PLAYER_INFO * CONST pdpnPlayerInfo, 
160                                                     PVOID CONST pvAsyncContext, 
161                                                     DPNHANDLE * CONST phAsyncHandle, 
162                                                     CONST DWORD dwFlags) { 
163   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
164   FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
165   return DPN_OK; 
166 }
167
168 static HRESULT WINAPI IDirectPlay8ClientImpl_GetServerInfo(PDIRECTPLAY8CLIENT iface, DPN_PLAYER_INFO * CONST pdpnPlayerInfo, DWORD * CONST pdwSize, CONST DWORD dwFlags) { 
169   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
170   FIXME("(%p):(%x): Stub\n", This, dwFlags);
171   return DPN_OK; 
172 }
173
174 static HRESULT WINAPI IDirectPlay8ClientImpl_GetServerAddress(PDIRECTPLAY8CLIENT iface, IDirectPlay8Address ** CONST pAddress, CONST DWORD dwFlags) { 
175   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
176   FIXME("(%p):(%x): Stub\n", This, dwFlags);
177   return DPN_OK; 
178 }
179
180 static HRESULT WINAPI IDirectPlay8ClientImpl_Close(PDIRECTPLAY8CLIENT iface, CONST DWORD dwFlags) { 
181   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
182   FIXME("(%p):(%x): Stub\n", This, dwFlags);
183   return DPN_OK; 
184 }
185
186 static HRESULT WINAPI IDirectPlay8ClientImpl_ReturnBuffer(PDIRECTPLAY8CLIENT iface, CONST DPNHANDLE hBufferHandle, CONST DWORD dwFlags) { 
187   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
188   FIXME("(%p):(%x): Stub\n", This, dwFlags);
189   return DPN_OK; 
190 }
191
192 static HRESULT WINAPI IDirectPlay8ClientImpl_GetCaps(PDIRECTPLAY8CLIENT iface, DPN_CAPS * CONST pdpCaps, CONST DWORD dwFlags) { 
193   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
194   FIXME("(%p):(%x): Stub\n", This, dwFlags);
195   return DPN_OK; 
196 }
197
198 static HRESULT WINAPI IDirectPlay8ClientImpl_SetCaps(PDIRECTPLAY8CLIENT iface, CONST DPN_CAPS * CONST pdpCaps, CONST DWORD dwFlags) { 
199   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
200   FIXME("(%p):(%x): Stub\n", This, dwFlags);
201   return DPN_OK; 
202 }
203
204 static HRESULT WINAPI IDirectPlay8ClientImpl_SetSPCaps(PDIRECTPLAY8CLIENT iface, CONST GUID * CONST pguidSP, CONST DPN_SP_CAPS * CONST pdpspCaps, CONST DWORD dwFlags ) { 
205   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
206   FIXME("(%p):(%x): Stub\n", This, dwFlags);
207   return DPN_OK; 
208 }
209
210 static HRESULT WINAPI IDirectPlay8ClientImpl_GetSPCaps(PDIRECTPLAY8CLIENT iface, CONST GUID * CONST pguidSP, DPN_SP_CAPS * CONST pdpspCaps, CONST DWORD dwFlags) { 
211   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
212   FIXME("(%p):(%x): Stub\n", This, dwFlags);
213   return DPN_OK; 
214 }
215
216 static HRESULT WINAPI IDirectPlay8ClientImpl_GetConnectionInfo(PDIRECTPLAY8CLIENT iface, DPN_CONNECTION_INFO * CONST pdpConnectionInfo, CONST DWORD dwFlags) { 
217   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
218   FIXME("(%p):(%x): Stub\n", This, dwFlags);
219   return DPN_OK; 
220 }
221
222 static HRESULT WINAPI IDirectPlay8ClientImpl_RegisterLobby(PDIRECTPLAY8CLIENT iface, CONST DPNHANDLE dpnHandle, struct IDirectPlay8LobbiedApplication * CONST pIDP8LobbiedApplication, CONST DWORD dwFlags) { 
223   IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
224   FIXME("(%p):(%x): Stub\n", This, dwFlags);
225   return DPN_OK; 
226 }
227
228 static const IDirectPlay8ClientVtbl DirectPlay8Client_Vtbl =
229 {
230     IDirectPlay8ClientImpl_QueryInterface,
231     IDirectPlay8ClientImpl_AddRef,
232     IDirectPlay8ClientImpl_Release,
233     IDirectPlay8ClientImpl_Initialize,
234     IDirectPlay8ClientImpl_EnumServiceProviders,
235     IDirectPlay8ClientImpl_EnumHosts,
236     IDirectPlay8ClientImpl_CancelAsyncOperation,
237     IDirectPlay8ClientImpl_Connect,
238     IDirectPlay8ClientImpl_Send,
239     IDirectPlay8ClientImpl_GetSendQueueInfo,
240     IDirectPlay8ClientImpl_GetApplicationDesc,
241     IDirectPlay8ClientImpl_SetClientInfo,
242     IDirectPlay8ClientImpl_GetServerInfo,
243     IDirectPlay8ClientImpl_GetServerAddress,
244     IDirectPlay8ClientImpl_Close,
245     IDirectPlay8ClientImpl_ReturnBuffer,
246     IDirectPlay8ClientImpl_GetCaps,
247     IDirectPlay8ClientImpl_SetCaps,
248     IDirectPlay8ClientImpl_SetSPCaps,
249     IDirectPlay8ClientImpl_GetSPCaps,
250     IDirectPlay8ClientImpl_GetConnectionInfo,
251     IDirectPlay8ClientImpl_RegisterLobby
252 };
253
254 HRESULT DPNET_CreateDirectPlay8Client(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) {
255   IDirectPlay8ClientImpl* client;
256
257   TRACE("(%p, %s, %p)\n", punkOuter, debugstr_guid(riid), ppobj);
258   
259   client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8ClientImpl));
260   if (NULL == client) {
261     *ppobj = NULL;
262     return E_OUTOFMEMORY;
263   }
264   client->lpVtbl = &DirectPlay8Client_Vtbl;
265   client->ref = 0; /* will be inited with QueryInterface */
266   return IDirectPlay8ClientImpl_QueryInterface ((PDIRECTPLAY8CLIENT)client, riid, ppobj);
267 }