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