mshtml: Get rid of PTInt64 type.
[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 static inline IDirectPlay8ClientImpl *impl_from_IDirectPlay8Client(IDirectPlay8Client *iface)
40 {
41     return CONTAINING_RECORD(iface, IDirectPlay8ClientImpl, IDirectPlay8Client_iface);
42 }
43
44 /* IDirectPlay8Client IUnknown parts follow: */
45 static HRESULT WINAPI IDirectPlay8ClientImpl_QueryInterface(IDirectPlay8Client *iface, REFIID riid,
46         void **ppobj)
47 {
48     IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
49
50     if (IsEqualGUID(riid, &IID_IUnknown)
51         || IsEqualGUID(riid, &IID_IDirectPlay8Client)) {
52         IUnknown_AddRef(iface);
53         *ppobj = This;
54         return DPN_OK;
55     }
56
57     WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
58     return E_NOINTERFACE;
59 }
60
61 static ULONG WINAPI IDirectPlay8ClientImpl_AddRef(IDirectPlay8Client *iface)
62 {
63     IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
64     ULONG refCount = InterlockedIncrement(&This->ref);
65
66     TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
67
68     return refCount;
69 }
70
71 static ULONG WINAPI IDirectPlay8ClientImpl_Release(IDirectPlay8Client *iface)
72 {
73     IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
74     ULONG refCount = InterlockedDecrement(&This->ref);
75
76     TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
77
78     if (!refCount) {
79         HeapFree(GetProcessHeap(), 0, This);
80     }
81     return refCount;
82 }
83
84 /* IDirectPlay8Client Interface follow: */
85
86 static HRESULT WINAPI IDirectPlay8ClientImpl_Initialize(IDirectPlay8Client *iface,
87         void * const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags)
88 {
89   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
90   FIXME("(%p):(%p,%p,%x): Stub\n", This, pvUserContext, pfn, dwFlags);
91   return DPN_OK; 
92 }
93
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)
98 {
99   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
100   FIXME("(%p):(%x): Stub\n", This, dwFlags);
101   return DPN_OK; 
102 }
103
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)
110 {
111   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
112   FIXME("(%p):(%p,%p,%x): Stub\n", This, pvUserContext, pAsyncHandle, dwFlags);
113   return DPN_OK; 
114 }
115
116 static HRESULT WINAPI IDirectPlay8ClientImpl_CancelAsyncOperation(IDirectPlay8Client *iface,
117         const DPNHANDLE hAsyncHandle, const DWORD dwFlags)
118 {
119   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
120   FIXME("(%p):(%u,%x): Stub\n", This, hAsyncHandle, dwFlags);
121   return DPN_OK; 
122 }
123
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)
130 {
131   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
132   FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
133   return DPN_OK; 
134 }
135
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)
139 {
140   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
141   FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
142   return DPN_OK; 
143 }
144
145 static HRESULT WINAPI IDirectPlay8ClientImpl_GetSendQueueInfo(IDirectPlay8Client *iface,
146         DWORD * const pdwNumMsgs, DWORD * const pdwNumBytes, const DWORD dwFlags)
147 {
148   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
149   FIXME("(%p):(%x): Stub\n", This, dwFlags);
150   return DPN_OK; 
151 }
152
153 static HRESULT WINAPI IDirectPlay8ClientImpl_GetApplicationDesc(IDirectPlay8Client *iface,
154         DPN_APPLICATION_DESC * const pAppDescBuffer, DWORD * const pcbDataSize, const DWORD dwFlags)
155 {
156   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
157   FIXME("(%p):(%x): Stub\n", This, dwFlags);
158   return DPN_OK; 
159 }
160
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)
164 {
165   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
166   FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
167   return DPN_OK; 
168 }
169
170 static HRESULT WINAPI IDirectPlay8ClientImpl_GetServerInfo(IDirectPlay8Client *iface,
171         DPN_PLAYER_INFO * const pdpnPlayerInfo, DWORD * const pdwSize, const DWORD dwFlags)
172 {
173   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
174   FIXME("(%p):(%x): Stub\n", This, dwFlags);
175   return DPN_OK; 
176 }
177
178 static HRESULT WINAPI IDirectPlay8ClientImpl_GetServerAddress(IDirectPlay8Client *iface,
179         IDirectPlay8Address ** const pAddress, const DWORD dwFlags)
180 {
181   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
182   FIXME("(%p):(%x): Stub\n", This, dwFlags);
183   return DPN_OK; 
184 }
185
186 static HRESULT WINAPI IDirectPlay8ClientImpl_Close(IDirectPlay8Client *iface, const DWORD dwFlags)
187 {
188   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
189   FIXME("(%p):(%x): Stub\n", This, dwFlags);
190   return DPN_OK; 
191 }
192
193 static HRESULT WINAPI IDirectPlay8ClientImpl_ReturnBuffer(IDirectPlay8Client *iface,
194         const DPNHANDLE hBufferHandle, const DWORD dwFlags)
195 {
196   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
197   FIXME("(%p):(%x): Stub\n", This, dwFlags);
198   return DPN_OK; 
199 }
200
201 static HRESULT WINAPI IDirectPlay8ClientImpl_GetCaps(IDirectPlay8Client *iface,
202         DPN_CAPS * const pdpCaps, const DWORD dwFlags)
203 {
204   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
205   FIXME("(%p):(%x): Stub\n", This, dwFlags);
206   return DPN_OK; 
207 }
208
209 static HRESULT WINAPI IDirectPlay8ClientImpl_SetCaps(IDirectPlay8Client *iface,
210         const DPN_CAPS * const pdpCaps, const DWORD dwFlags)
211 {
212   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
213   FIXME("(%p):(%x): Stub\n", This, dwFlags);
214   return DPN_OK; 
215 }
216
217 static HRESULT WINAPI IDirectPlay8ClientImpl_SetSPCaps(IDirectPlay8Client *iface,
218         const GUID * const pguidSP, const DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags)
219 {
220   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
221   FIXME("(%p):(%x): Stub\n", This, dwFlags);
222   return DPN_OK; 
223 }
224
225 static HRESULT WINAPI IDirectPlay8ClientImpl_GetSPCaps(IDirectPlay8Client *iface,
226         const GUID * const pguidSP, DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags)
227 {
228   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
229   FIXME("(%p):(%x): Stub\n", This, dwFlags);
230   return DPN_OK; 
231 }
232
233 static HRESULT WINAPI IDirectPlay8ClientImpl_GetConnectionInfo(IDirectPlay8Client *iface,
234         DPN_CONNECTION_INFO * const pdpConnectionInfo, const DWORD dwFlags)
235 {
236   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
237   FIXME("(%p):(%x): Stub\n", This, dwFlags);
238   return DPN_OK; 
239 }
240
241 static HRESULT WINAPI IDirectPlay8ClientImpl_RegisterLobby(IDirectPlay8Client *iface,
242         const DPNHANDLE dpnHandle,
243         struct IDirectPlay8LobbiedApplication * const pIDP8LobbiedApplication, const DWORD dwFlags)
244 {
245   IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
246   FIXME("(%p):(%x): Stub\n", This, dwFlags);
247   return DPN_OK; 
248 }
249
250 static const IDirectPlay8ClientVtbl DirectPlay8Client_Vtbl =
251 {
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
274 };
275
276 HRESULT DPNET_CreateDirectPlay8Client(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) {
277   IDirectPlay8ClientImpl* client;
278
279   TRACE("(%p, %s, %p)\n", punkOuter, debugstr_guid(riid), ppobj);
280   
281   client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8ClientImpl));
282   if (NULL == client) {
283     *ppobj = NULL;
284     return E_OUTOFMEMORY;
285   }
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);
289 }