gameux: Add IGameExplorer2 implementation stub.
[wine.git] / dlls / gameux / gameexplorer.c
blobdcb2d67028ab24ab16a9923c7d0645ab1afb09fe
1 /*
2 * Gameux library coclass GameExplorer implementation
4 * Copyright (C) 2010 Mariusz PluciƄski
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
20 #define COBJMACROS
22 #include "config.h"
24 #include "ole2.h"
26 #include "gameux.h"
27 #include "gameux_private.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(gameux);
34 * GameExplorer implementation
37 typedef struct _GameExplorerImpl
39 const struct IGameExplorerVtbl *lpGameExplorerVtbl;
40 const struct IGameExplorer2Vtbl *lpGameExplorer2Vtbl;
41 LONG ref;
42 } GameExplorerImpl;
44 static inline GameExplorerImpl *impl_from_IGameExplorer(IGameExplorer *iface)
46 return (GameExplorerImpl*)((char*)iface - FIELD_OFFSET(GameExplorerImpl, lpGameExplorerVtbl));
49 static inline IGameExplorer* IGameExplorer_from_impl(GameExplorerImpl* This)
51 return (struct IGameExplorer*)&This->lpGameExplorerVtbl;
54 static inline GameExplorerImpl *impl_from_IGameExplorer2(IGameExplorer2 *iface)
56 return (GameExplorerImpl*)((char*)iface - FIELD_OFFSET(GameExplorerImpl, lpGameExplorer2Vtbl));
59 static inline IGameExplorer2* IGameExplorer2_from_impl(GameExplorerImpl* This)
61 return (struct IGameExplorer2*)&This->lpGameExplorer2Vtbl;
64 static HRESULT WINAPI GameExplorerImpl_QueryInterface(
65 IGameExplorer *iface,
66 REFIID riid,
67 void **ppvObject)
69 GameExplorerImpl *This = impl_from_IGameExplorer(iface);
71 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppvObject);
73 *ppvObject = NULL;
75 if(IsEqualGUID(riid, &IID_IUnknown) ||
76 IsEqualGUID(riid, &IID_IGameExplorer))
78 *ppvObject = IGameExplorer_from_impl(This);
80 else if(IsEqualGUID(riid, &IID_IGameExplorer2))
82 *ppvObject = IGameExplorer2_from_impl(This);
84 else
86 FIXME("interface %s not implemented\n", debugstr_guid(riid));
87 return E_NOINTERFACE;
90 IGameExplorer_AddRef(iface);
91 return S_OK;
94 static ULONG WINAPI GameExplorerImpl_AddRef(IGameExplorer *iface)
96 GameExplorerImpl *This = impl_from_IGameExplorer(iface);
97 LONG ref;
99 ref = InterlockedIncrement(&This->ref);
101 TRACE("(%p): ref=%d\n", This, ref);
102 return ref;
105 static ULONG WINAPI GameExplorerImpl_Release(IGameExplorer *iface)
107 GameExplorerImpl *This = impl_from_IGameExplorer(iface);
108 LONG ref;
110 ref = InterlockedDecrement(&This->ref);
111 TRACE("(%p): ref=%d\n", This, ref);
113 if(ref == 0)
115 TRACE("freeing GameExplorer object\n");
116 HeapFree(GetProcessHeap(), 0, This);
119 return ref;
122 static HRESULT WINAPI GameExplorerImpl_AddGame(
123 IGameExplorer *iface,
124 BSTR bstrGDFBinaryPath,
125 BSTR sGameInstallDirectory,
126 GAME_INSTALL_SCOPE installScope,
127 GUID *pInstanceID)
129 GameExplorerImpl *This = impl_from_IGameExplorer(iface);
131 TRACE("(%p, %s, %s, %d, %s)\n", This, debugstr_w(bstrGDFBinaryPath), debugstr_w(sGameInstallDirectory), installScope, debugstr_guid(pInstanceID));
132 FIXME("stub\n");
133 return E_NOTIMPL;
136 static HRESULT WINAPI GameExplorerImpl_RemoveGame(
137 IGameExplorer *iface,
138 GUID instanceID)
140 GameExplorerImpl *This = impl_from_IGameExplorer(iface);
142 TRACE("(%p, %s)\n", This, debugstr_guid(&instanceID));
143 FIXME("stub\n");
144 return E_NOTIMPL;
147 static HRESULT WINAPI GameExplorerImpl_UpdateGame(
148 IGameExplorer *iface,
149 GUID instanceID)
151 GameExplorerImpl *This = impl_from_IGameExplorer(iface);
153 TRACE("(%p, %s)\n", This, debugstr_guid(&instanceID));
154 FIXME("stub\n");
155 return E_NOTIMPL;
158 static HRESULT WINAPI GameExplorerImpl_VerifyAccess(
159 IGameExplorer *iface,
160 BSTR sGDFBinaryPath,
161 BOOL *pHasAccess)
163 GameExplorerImpl *This = impl_from_IGameExplorer(iface);
165 TRACE("(%p, %s, %p)\n", This, debugstr_w(sGDFBinaryPath), pHasAccess);
166 FIXME("stub\n");
167 return E_NOTIMPL;
170 static const struct IGameExplorerVtbl GameExplorerImplVtbl =
172 GameExplorerImpl_QueryInterface,
173 GameExplorerImpl_AddRef,
174 GameExplorerImpl_Release,
175 GameExplorerImpl_AddGame,
176 GameExplorerImpl_RemoveGame,
177 GameExplorerImpl_UpdateGame,
178 GameExplorerImpl_VerifyAccess
182 static HRESULT WINAPI GameExplorer2Impl_QueryInterface(
183 IGameExplorer2 *iface,
184 REFIID riid,
185 void **ppvObject)
187 GameExplorerImpl *This = impl_from_IGameExplorer2(iface);
188 return GameExplorerImpl_QueryInterface(IGameExplorer_from_impl(This), riid, ppvObject);
191 static ULONG WINAPI GameExplorer2Impl_AddRef(IGameExplorer2 *iface)
193 GameExplorerImpl *This = impl_from_IGameExplorer2(iface);
194 return GameExplorerImpl_AddRef(IGameExplorer_from_impl(This));
197 static ULONG WINAPI GameExplorer2Impl_Release(IGameExplorer2 *iface)
199 GameExplorerImpl *This = impl_from_IGameExplorer2(iface);
200 return GameExplorerImpl_Release(IGameExplorer_from_impl(This));
203 static HRESULT WINAPI GameExplorer2Impl_CheckAccess(
204 IGameExplorer2 *iface,
205 LPCWSTR binaryGDFPath,
206 BOOL *pHasAccess)
208 GameExplorerImpl *This = impl_from_IGameExplorer2(iface);
209 FIXME("stub (%p, %s, %p)\n", This, debugstr_w(binaryGDFPath), pHasAccess);
210 return E_NOTIMPL;
213 static HRESULT WINAPI GameExplorer2Impl_InstallGame(
214 IGameExplorer2 *iface,
215 LPCWSTR binaryGDFPath,
216 LPCWSTR installDirectory,
217 GAME_INSTALL_SCOPE installScope)
219 GameExplorerImpl *This = impl_from_IGameExplorer2(iface);
220 FIXME("stub (%p, %s, %s, 0x%x)\n", This, debugstr_w(binaryGDFPath), debugstr_w(installDirectory), installScope);
221 return E_NOTIMPL;
224 static HRESULT WINAPI GameExplorer2Impl_UninstallGame(
225 IGameExplorer2 *iface,
226 LPCWSTR binaryGDFPath)
228 GameExplorerImpl *This = impl_from_IGameExplorer2(iface);
229 FIXME("stub (%p, %s)\n", This, debugstr_w(binaryGDFPath));
230 return E_NOTIMPL;
233 static const struct IGameExplorer2Vtbl GameExplorer2ImplVtbl =
235 GameExplorer2Impl_QueryInterface,
236 GameExplorer2Impl_AddRef,
237 GameExplorer2Impl_Release,
238 GameExplorer2Impl_InstallGame,
239 GameExplorer2Impl_UninstallGame,
240 GameExplorer2Impl_CheckAccess
244 * Construction routine
246 HRESULT GameExplorer_create(
247 IUnknown* pUnkOuter,
248 IUnknown** ppObj)
250 GameExplorerImpl *pGameExplorer;
252 TRACE("(%p, %p)\n", pUnkOuter, ppObj);
254 pGameExplorer = HeapAlloc(GetProcessHeap(), 0, sizeof(*pGameExplorer));
256 if(!pGameExplorer)
257 return E_OUTOFMEMORY;
259 pGameExplorer->lpGameExplorerVtbl = &GameExplorerImplVtbl;
260 pGameExplorer->lpGameExplorer2Vtbl = &GameExplorer2ImplVtbl;
261 pGameExplorer->ref = 1;
263 *ppObj = (IUnknown*)(&pGameExplorer->lpGameExplorerVtbl);
265 TRACE("returning iface: %p\n", *ppObj);
266 return S_OK;