2 * Gameux library coclass GameStatistics 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
27 #include "gameux_private.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(gameux);
34 * IGameStatisticsMgr implementation
37 typedef struct _GameStatisticsMgrImpl
39 const struct IGameStatisticsMgrVtbl *lpVtbl;
41 } GameStatisticsMgrImpl;
43 static inline GameStatisticsMgrImpl *impl_from_IGameStatisticsMgr( IGameStatisticsMgr *iface )
45 return (GameStatisticsMgrImpl *)((char*)iface - FIELD_OFFSET(GameStatisticsMgrImpl, lpVtbl));
49 static HRESULT WINAPI GameStatisticsMgrImpl_QueryInterface(
50 IGameStatisticsMgr *iface,
54 GameStatisticsMgrImpl *This = impl_from_IGameStatisticsMgr( iface );
56 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
60 if(IsEqualGUID(riid, &IID_IUnknown) ||
61 IsEqualGUID(riid, &IID_IGameStatisticsMgr) )
67 FIXME("interface %s not implemented\n", debugstr_guid(riid));
71 IGameStatisticsMgr_AddRef( iface );
75 static ULONG WINAPI GameStatisticsMgrImpl_AddRef(IGameStatisticsMgr *iface)
77 GameStatisticsMgrImpl *This = impl_from_IGameStatisticsMgr( iface );
80 ref = InterlockedIncrement(&This->ref);
82 TRACE("(%p): ref=%d\n", This, ref);
86 static ULONG WINAPI GameStatisticsMgrImpl_Release(IGameStatisticsMgr *iface)
88 GameStatisticsMgrImpl *This = impl_from_IGameStatisticsMgr( iface );
91 ref = InterlockedDecrement(&This->ref);
92 TRACE("(%p): ref=%d\n", This, ref);
96 TRACE("freeing GameStatistics object\n");
97 HeapFree( GetProcessHeap(), 0, This);
103 static HRESULT STDMETHODCALLTYPE GameStatisticsMgrImpl_GetGameStatistics(
104 IGameStatisticsMgr* iface,
105 LPCWSTR GDFBinaryPath,
106 GAMESTATS_OPEN_TYPE openType,
107 GAMESTATS_OPEN_RESULT *pOpenResult,
108 IGameStatistics **ppiStats)
110 FIXME("stub (%p, %s, 0x%x, %p, %p)\n", iface, debugstr_w(GDFBinaryPath), openType, pOpenResult, ppiStats);
114 static HRESULT STDMETHODCALLTYPE GameStatisticsMgrImpl_RemoveGameStatistics(
115 IGameStatisticsMgr* iface,
116 LPCWSTR GDFBinaryPath)
118 FIXME("stub (%p, %s)\n", iface, debugstr_w(GDFBinaryPath));
122 static const struct IGameStatisticsMgrVtbl GameStatisticsMgrImplVtbl =
124 GameStatisticsMgrImpl_QueryInterface,
125 GameStatisticsMgrImpl_AddRef,
126 GameStatisticsMgrImpl_Release,
127 GameStatisticsMgrImpl_GetGameStatistics,
128 GameStatisticsMgrImpl_RemoveGameStatistics,
131 HRESULT GameStatistics_create(
135 GameStatisticsMgrImpl *pGameStatistics;
137 TRACE("(%p, %p)\n", pUnkOuter, ppObj);
139 pGameStatistics = HeapAlloc( GetProcessHeap(), 0, sizeof (*pGameStatistics) );
141 if( !pGameStatistics )
142 return E_OUTOFMEMORY;
144 pGameStatistics->lpVtbl = &GameStatisticsMgrImplVtbl;
145 pGameStatistics->ref = 1;
147 *ppObj = (IUnknown*)(&pGameStatistics->lpVtbl);
149 TRACE("returning iface %p\n", *ppObj);