mciqtz32: Fix mciOpen.
[wine/multimedia.git] / dlls / gameux / gameexplorer.c
blob0fa5e9c02b84c5a96751b711bff20d67def0eb2e
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 * IGameExplorer implementation
37 typedef struct _GameExplorerImpl
39 const struct IGameExplorerVtbl *lpGameExplorerVtbl;
40 LONG ref;
41 } GameExplorerImpl;
43 static inline GameExplorerImpl *impl_from_IGameExplorer(IGameExplorer *iface)
45 return (GameExplorerImpl*)((char*)iface - FIELD_OFFSET(GameExplorerImpl, lpGameExplorerVtbl));
48 static HRESULT WINAPI GameExplorerImpl_QueryInterface(
49 IGameExplorer *iface,
50 REFIID riid,
51 void **ppvObject)
53 GameExplorerImpl *This = impl_from_IGameExplorer(iface);
55 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppvObject);
57 *ppvObject = NULL;
59 if(IsEqualGUID(riid, &IID_IUnknown) ||
60 IsEqualGUID(riid, &IID_IGameExplorer))
62 *ppvObject = iface;
64 else
66 FIXME("interface %s not implemented\n", debugstr_guid(riid));
67 return E_NOINTERFACE;
70 IGameExplorer_AddRef(iface);
71 return S_OK;
74 static ULONG WINAPI GameExplorerImpl_AddRef(IGameExplorer *iface)
76 GameExplorerImpl *This = impl_from_IGameExplorer(iface);
77 LONG ref;
79 ref = InterlockedIncrement(&This->ref);
81 TRACE("(%p): ref=%d\n", This, ref);
82 return ref;
85 static ULONG WINAPI GameExplorerImpl_Release(IGameExplorer *iface)
87 GameExplorerImpl *This = impl_from_IGameExplorer(iface);
88 LONG ref;
90 ref = InterlockedDecrement(&This->ref);
91 TRACE("(%p): ref=%d\n", This, ref);
93 if(ref == 0)
95 TRACE("freeing GameExplorer object\n");
96 HeapFree(GetProcessHeap(), 0, This);
99 return ref;
102 static HRESULT WINAPI GameExplorerImpl_AddGame(
103 IGameExplorer *iface,
104 BSTR bstrGDFBinaryPath,
105 BSTR sGameInstallDirectory,
106 GAME_INSTALL_SCOPE installScope,
107 GUID *pInstanceID)
109 GameExplorerImpl *This = impl_from_IGameExplorer(iface);
111 TRACE("(%p, %s, %s, %d, %s)\n", This, debugstr_w(bstrGDFBinaryPath), debugstr_w(sGameInstallDirectory), installScope, debugstr_guid(pInstanceID));
112 FIXME("stub\n");
113 return E_NOTIMPL;
116 static HRESULT WINAPI GameExplorerImpl_RemoveGame(
117 IGameExplorer *iface,
118 GUID instanceID)
120 GameExplorerImpl *This = impl_from_IGameExplorer(iface);
122 TRACE("(%p, %s)\n", This, debugstr_guid(&instanceID));
123 FIXME("stub\n");
124 return E_NOTIMPL;
127 static HRESULT WINAPI GameExplorerImpl_UpdateGame(
128 IGameExplorer *iface,
129 GUID instanceID)
131 GameExplorerImpl *This = impl_from_IGameExplorer(iface);
133 TRACE("(%p, %s)\n", This, debugstr_guid(&instanceID));
134 FIXME("stub\n");
135 return E_NOTIMPL;
138 static HRESULT WINAPI GameExplorerImpl_VerifyAccess(
139 IGameExplorer *iface,
140 BSTR sGDFBinaryPath,
141 BOOL *pHasAccess)
143 GameExplorerImpl *This = impl_from_IGameExplorer(iface);
145 TRACE("(%p, %s, %p)\n", This, debugstr_w(sGDFBinaryPath), pHasAccess);
146 FIXME("stub\n");
147 return E_NOTIMPL;
150 static const struct IGameExplorerVtbl GameExplorerImplVtbl =
152 GameExplorerImpl_QueryInterface,
153 GameExplorerImpl_AddRef,
154 GameExplorerImpl_Release,
155 GameExplorerImpl_AddGame,
156 GameExplorerImpl_RemoveGame,
157 GameExplorerImpl_UpdateGame,
158 GameExplorerImpl_VerifyAccess
162 * Construction routine
164 HRESULT GameExplorer_create(
165 IUnknown* pUnkOuter,
166 IUnknown** ppObj)
168 GameExplorerImpl *pGameExplorer;
170 TRACE("(%p, %p)\n", pUnkOuter, ppObj);
172 pGameExplorer = HeapAlloc(GetProcessHeap(), 0, sizeof(*pGameExplorer));
174 if(!pGameExplorer)
175 return E_OUTOFMEMORY;
177 pGameExplorer->lpGameExplorerVtbl = &GameExplorerImplVtbl;
178 pGameExplorer->ref = 1;
180 *ppObj = (IUnknown*)(&pGameExplorer->lpGameExplorerVtbl);
182 TRACE("returning iface: %p\n", *ppObj);
183 return S_OK;