[DPLAYX]
[reactos.git] / reactos / dll / directx / wine / dplayx / lobbysp.c
1 /* This contains the implementation of the Lobby Service
2 * Providers interface required to communicate with Direct Play
3 *
4 * Copyright 2001 Peter Hunnisett
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 #include "dplayx_global.h"
22
23
24 typedef struct IDPLobbySPImpl
25 {
26 IDPLobbySP IDPLobbySP_iface;
27 LONG ref;
28 IDirectPlayImpl *dplay;
29 } IDPLobbySPImpl;
30
31 static inline IDPLobbySPImpl *impl_from_IDPLobbySP(IDPLobbySP *iface)
32 {
33 return CONTAINING_RECORD(iface, IDPLobbySPImpl, IDPLobbySP_iface);
34 }
35
36 static HRESULT WINAPI IDPLobbySPImpl_QueryInterface( IDPLobbySP *iface, REFIID riid,
37 void **ppv )
38 {
39 TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid( riid ), ppv );
40
41 if ( IsEqualGUID( &IID_IUnknown, riid ) || IsEqualGUID( &IID_IDPLobbySP, riid ) )
42 {
43 *ppv = iface;
44 IDPLobbySP_AddRef(iface);
45 return S_OK;
46 }
47
48 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
49 *ppv = NULL;
50 return E_NOINTERFACE;
51 }
52
53 static ULONG WINAPI IDPLobbySPImpl_AddRef( IDPLobbySP *iface )
54 {
55 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
56 ULONG ref = InterlockedIncrement( &This->ref );
57
58 TRACE( "(%p) ref=%d\n", This, ref );
59
60 return ref;
61 }
62
63 static ULONG WINAPI IDPLobbySPImpl_Release( IDPLobbySP *iface )
64 {
65 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
66 ULONG ref = InterlockedDecrement( &This->ref );
67
68 TRACE( "(%p) ref=%d\n", This, ref );
69
70 if( !ref )
71 HeapFree( GetProcessHeap(), 0, This );
72
73 return ref;
74 }
75
76 static HRESULT WINAPI IDPLobbySPImpl_AddGroupToGroup( IDPLobbySP *iface,
77 SPDATA_ADDREMOTEGROUPTOGROUP *argtg )
78 {
79 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
80 FIXME( "(%p)->(%p):stub\n", This, argtg );
81 return DP_OK;
82 }
83
84 static HRESULT WINAPI IDPLobbySPImpl_AddPlayerToGroup( IDPLobbySP *iface,
85 SPDATA_ADDREMOTEPLAYERTOGROUP *arptg )
86 {
87 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
88 FIXME( "(%p)->(%p):stub\n", This, arptg );
89 return DP_OK;
90 }
91
92 static HRESULT WINAPI IDPLobbySPImpl_CreateGroup( IDPLobbySP *iface,
93 SPDATA_CREATEREMOTEGROUP *crg )
94 {
95 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
96 FIXME( "(%p)->(%p):stub\n", This, crg );
97 return DP_OK;
98 }
99
100 static HRESULT WINAPI IDPLobbySPImpl_CreateGroupInGroup( IDPLobbySP *iface,
101 SPDATA_CREATEREMOTEGROUPINGROUP *crgig )
102 {
103 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
104 FIXME( "(%p)->(%p):stub\n", This, crgig );
105 return DP_OK;
106 }
107
108 static HRESULT WINAPI IDPLobbySPImpl_DeleteGroupFromGroup( IDPLobbySP *iface,
109 SPDATA_DELETEREMOTEGROUPFROMGROUP *drgfg )
110 {
111 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
112 FIXME( "(%p)->(%p):stub\n", This, drgfg );
113 return DP_OK;
114 }
115
116 static HRESULT WINAPI IDPLobbySPImpl_DeletePlayerFromGroup( IDPLobbySP *iface,
117 SPDATA_DELETEREMOTEPLAYERFROMGROUP *drpfg )
118 {
119 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
120 FIXME( "(%p)->(%p):stub\n", This, drpfg );
121 return DP_OK;
122 }
123
124 static HRESULT WINAPI IDPLobbySPImpl_DestroyGroup( IDPLobbySP *iface,
125 SPDATA_DESTROYREMOTEGROUP *drg )
126 {
127 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
128 FIXME( "(%p)->(%p):stub\n", This, drg );
129 return DP_OK;
130 }
131
132 static HRESULT WINAPI IDPLobbySPImpl_EnumSessionsResponse( IDPLobbySP *iface,
133 SPDATA_ENUMSESSIONSRESPONSE *er )
134 {
135 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
136 FIXME( "(%p)->(%p):stub\n", This, er );
137 return DP_OK;
138 }
139
140 static HRESULT WINAPI IDPLobbySPImpl_GetSPDataPointer( IDPLobbySP *iface, LPVOID* lplpData )
141 {
142 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
143 FIXME( "(%p)->(%p):stub\n", This, lplpData );
144 return DP_OK;
145 }
146
147 static HRESULT WINAPI IDPLobbySPImpl_HandleMessage( IDPLobbySP *iface, SPDATA_HANDLEMESSAGE *hm )
148 {
149 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
150 FIXME( "(%p)->(%p):stub\n", This, hm );
151 return DP_OK;
152 }
153
154 static HRESULT WINAPI IDPLobbySPImpl_SendChatMessage( IDPLobbySP *iface,
155 SPDATA_CHATMESSAGE *cm )
156 {
157 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
158 FIXME( "(%p)->(%p):stub\n", This, cm );
159 return DP_OK;
160 }
161
162 static HRESULT WINAPI IDPLobbySPImpl_SetGroupName( IDPLobbySP *iface,
163 SPDATA_SETREMOTEGROUPNAME *srgn )
164 {
165 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
166 FIXME( "(%p)->(%p):stub\n", This, srgn );
167 return DP_OK;
168 }
169
170 static HRESULT WINAPI IDPLobbySPImpl_SetPlayerName( IDPLobbySP *iface,
171 SPDATA_SETREMOTEPLAYERNAME *srpn )
172 {
173 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
174 FIXME( "(%p)->(%p):stub\n", This, srpn );
175 return DP_OK;
176 }
177
178 static HRESULT WINAPI IDPLobbySPImpl_SetSessionDesc( IDPLobbySP *iface,
179 SPDATA_SETSESSIONDESC *ssd )
180 {
181 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
182 FIXME( "(%p)->(%p):stub\n", This, ssd );
183 return DP_OK;
184 }
185
186 static HRESULT WINAPI IDPLobbySPImpl_SetSPDataPointer( IDPLobbySP *iface, void *lpData )
187 {
188 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
189 FIXME( "(%p)->(%p):stub\n", This, lpData );
190 return DP_OK;
191 }
192
193 static HRESULT WINAPI IDPLobbySPImpl_StartSession( IDPLobbySP *iface,
194 SPDATA_STARTSESSIONCOMMAND *ssc )
195 {
196 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
197 FIXME( "(%p)->(%p):stub\n", This, ssc );
198 return DP_OK;
199 }
200
201
202 static const IDPLobbySPVtbl dpLobbySPVT =
203 {
204 IDPLobbySPImpl_QueryInterface,
205 IDPLobbySPImpl_AddRef,
206 IDPLobbySPImpl_Release,
207 IDPLobbySPImpl_AddGroupToGroup,
208 IDPLobbySPImpl_AddPlayerToGroup,
209 IDPLobbySPImpl_CreateGroup,
210 IDPLobbySPImpl_CreateGroupInGroup,
211 IDPLobbySPImpl_DeleteGroupFromGroup,
212 IDPLobbySPImpl_DeletePlayerFromGroup,
213 IDPLobbySPImpl_DestroyGroup,
214 IDPLobbySPImpl_EnumSessionsResponse,
215 IDPLobbySPImpl_GetSPDataPointer,
216 IDPLobbySPImpl_HandleMessage,
217 IDPLobbySPImpl_SendChatMessage,
218 IDPLobbySPImpl_SetGroupName,
219 IDPLobbySPImpl_SetPlayerName,
220 IDPLobbySPImpl_SetSessionDesc,
221 IDPLobbySPImpl_SetSPDataPointer,
222 IDPLobbySPImpl_StartSession
223 };
224
225 HRESULT dplobbysp_create( REFIID riid, void **ppv, IDirectPlayImpl *dp )
226 {
227 IDPLobbySPImpl *obj;
228 HRESULT hr;
229
230 TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv );
231
232 *ppv = NULL;
233 obj = HeapAlloc( GetProcessHeap(), 0, sizeof( *obj ) );
234 if ( !obj )
235 return DPERR_OUTOFMEMORY;
236
237 obj->IDPLobbySP_iface.lpVtbl = &dpLobbySPVT;
238 obj->ref = 1;
239 obj->dplay = dp;
240
241 hr = IDPLobbySP_QueryInterface( &obj->IDPLobbySP_iface, riid, ppv );
242 IDPLobbySP_Release( &obj->IDPLobbySP_iface );
243
244 return hr;
245 }