crypt32: Added addref to store vtbl and use it instead of directly accessing ref.
[wine.git] / dlls / dplayx / lobbysp.c
blob3528f94e345eb774ad48e2d7754397e879d8b9ef
1 /* This contains the implementation of the Lobby Service
2 * Providers interface required to communicate with Direct Play
4 * Copyright 2001 Peter Hunnisett
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.
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.
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
21 #include "winerror.h"
22 #include "wine/debug.h"
24 #include "lobbysp.h"
25 #include "dplay_global.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(dplay);
29 typedef struct IDPLobbySPImpl
31 IDPLobbySP IDPLobbySP_iface;
32 LONG ref;
33 IDirectPlayImpl *dplay;
34 } IDPLobbySPImpl;
36 static inline IDPLobbySPImpl *impl_from_IDPLobbySP(IDPLobbySP *iface)
38 return CONTAINING_RECORD(iface, IDPLobbySPImpl, IDPLobbySP_iface);
41 static HRESULT WINAPI IDPLobbySPImpl_QueryInterface( IDPLobbySP *iface, REFIID riid,
42 void **ppv )
44 TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid( riid ), ppv );
46 if ( IsEqualGUID( &IID_IUnknown, riid ) || IsEqualGUID( &IID_IDPLobbySP, riid ) )
48 *ppv = iface;
49 IDPLobbySP_AddRef(iface);
50 return S_OK;
53 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
54 *ppv = NULL;
55 return E_NOINTERFACE;
58 static ULONG WINAPI IDPLobbySPImpl_AddRef( IDPLobbySP *iface )
60 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
61 ULONG ref = InterlockedIncrement( &This->ref );
63 TRACE( "(%p) ref=%d\n", This, ref );
65 return ref;
68 static ULONG WINAPI IDPLobbySPImpl_Release( IDPLobbySP *iface )
70 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
71 ULONG ref = InterlockedDecrement( &This->ref );
73 TRACE( "(%p) ref=%d\n", This, ref );
75 if( !ref )
76 HeapFree( GetProcessHeap(), 0, This );
78 return ref;
81 static HRESULT WINAPI IDPLobbySPImpl_AddGroupToGroup( IDPLobbySP *iface,
82 SPDATA_ADDREMOTEGROUPTOGROUP *argtg )
84 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
85 FIXME( "(%p)->(%p):stub\n", This, argtg );
86 return DP_OK;
89 static HRESULT WINAPI IDPLobbySPImpl_AddPlayerToGroup( IDPLobbySP *iface,
90 SPDATA_ADDREMOTEPLAYERTOGROUP *arptg )
92 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
93 FIXME( "(%p)->(%p):stub\n", This, arptg );
94 return DP_OK;
97 static HRESULT WINAPI IDPLobbySPImpl_CreateGroup( IDPLobbySP *iface,
98 SPDATA_CREATEREMOTEGROUP *crg )
100 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
101 FIXME( "(%p)->(%p):stub\n", This, crg );
102 return DP_OK;
105 static HRESULT WINAPI IDPLobbySPImpl_CreateGroupInGroup( IDPLobbySP *iface,
106 SPDATA_CREATEREMOTEGROUPINGROUP *crgig )
108 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
109 FIXME( "(%p)->(%p):stub\n", This, crgig );
110 return DP_OK;
113 static HRESULT WINAPI IDPLobbySPImpl_DeleteGroupFromGroup( IDPLobbySP *iface,
114 SPDATA_DELETEREMOTEGROUPFROMGROUP *drgfg )
116 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
117 FIXME( "(%p)->(%p):stub\n", This, drgfg );
118 return DP_OK;
121 static HRESULT WINAPI IDPLobbySPImpl_DeletePlayerFromGroup( IDPLobbySP *iface,
122 SPDATA_DELETEREMOTEPLAYERFROMGROUP *drpfg )
124 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
125 FIXME( "(%p)->(%p):stub\n", This, drpfg );
126 return DP_OK;
129 static HRESULT WINAPI IDPLobbySPImpl_DestroyGroup( IDPLobbySP *iface,
130 SPDATA_DESTROYREMOTEGROUP *drg )
132 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
133 FIXME( "(%p)->(%p):stub\n", This, drg );
134 return DP_OK;
137 static HRESULT WINAPI IDPLobbySPImpl_EnumSessionsResponse( IDPLobbySP *iface,
138 SPDATA_ENUMSESSIONSRESPONSE *er )
140 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
141 FIXME( "(%p)->(%p):stub\n", This, er );
142 return DP_OK;
145 static HRESULT WINAPI IDPLobbySPImpl_GetSPDataPointer( IDPLobbySP *iface, LPVOID* lplpData )
147 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
148 FIXME( "(%p)->(%p):stub\n", This, lplpData );
149 return DP_OK;
152 static HRESULT WINAPI IDPLobbySPImpl_HandleMessage( IDPLobbySP *iface, SPDATA_HANDLEMESSAGE *hm )
154 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
155 FIXME( "(%p)->(%p):stub\n", This, hm );
156 return DP_OK;
159 static HRESULT WINAPI IDPLobbySPImpl_SendChatMessage( IDPLobbySP *iface,
160 SPDATA_CHATMESSAGE *cm )
162 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
163 FIXME( "(%p)->(%p):stub\n", This, cm );
164 return DP_OK;
167 static HRESULT WINAPI IDPLobbySPImpl_SetGroupName( IDPLobbySP *iface,
168 SPDATA_SETREMOTEGROUPNAME *srgn )
170 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
171 FIXME( "(%p)->(%p):stub\n", This, srgn );
172 return DP_OK;
175 static HRESULT WINAPI IDPLobbySPImpl_SetPlayerName( IDPLobbySP *iface,
176 SPDATA_SETREMOTEPLAYERNAME *srpn )
178 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
179 FIXME( "(%p)->(%p):stub\n", This, srpn );
180 return DP_OK;
183 static HRESULT WINAPI IDPLobbySPImpl_SetSessionDesc( IDPLobbySP *iface,
184 SPDATA_SETSESSIONDESC *ssd )
186 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
187 FIXME( "(%p)->(%p):stub\n", This, ssd );
188 return DP_OK;
191 static HRESULT WINAPI IDPLobbySPImpl_SetSPDataPointer( IDPLobbySP *iface, void *lpData )
193 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
194 FIXME( "(%p)->(%p):stub\n", This, lpData );
195 return DP_OK;
198 static HRESULT WINAPI IDPLobbySPImpl_StartSession( IDPLobbySP *iface,
199 SPDATA_STARTSESSIONCOMMAND *ssc )
201 IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface );
202 FIXME( "(%p)->(%p):stub\n", This, ssc );
203 return DP_OK;
207 static const IDPLobbySPVtbl dpLobbySPVT =
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
230 HRESULT dplobbysp_create( REFIID riid, void **ppv, IDirectPlayImpl *dp )
232 IDPLobbySPImpl *obj;
233 HRESULT hr;
235 TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv );
237 *ppv = NULL;
238 obj = HeapAlloc( GetProcessHeap(), 0, sizeof( *obj ) );
239 if ( !obj )
240 return DPERR_OUTOFMEMORY;
242 obj->IDPLobbySP_iface.lpVtbl = &dpLobbySPVT;
243 obj->ref = 1;
244 obj->dplay = dp;
246 hr = IDPLobbySP_QueryInterface( &obj->IDPLobbySP_iface, riid, ppv );
247 IDPLobbySP_Release( &obj->IDPLobbySP_iface );
249 return hr;