urlmon: Implemented CreateUriWithFragment.
[wine/multimedia.git] / dlls / gameux / gamestatistics.c
blob098754e033775de7d1c495901dcf8ece4ad69822
1 /*
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
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 * IGameStatisticsMgr implementation
37 typedef struct _GameStatisticsMgrImpl
39 const struct IGameStatisticsMgrVtbl *lpVtbl;
40 LONG ref;
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,
51 REFIID riid,
52 void **ppvObject)
54 GameStatisticsMgrImpl *This = impl_from_IGameStatisticsMgr( iface );
56 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
58 *ppvObject = NULL;
60 if(IsEqualGUID(riid, &IID_IUnknown) ||
61 IsEqualGUID(riid, &IID_IGameStatisticsMgr) )
63 *ppvObject = iface;
65 else
67 FIXME("interface %s not implemented\n", debugstr_guid(riid));
68 return E_NOINTERFACE;
71 IGameStatisticsMgr_AddRef( iface );
72 return S_OK;
75 static ULONG WINAPI GameStatisticsMgrImpl_AddRef(IGameStatisticsMgr *iface)
77 GameStatisticsMgrImpl *This = impl_from_IGameStatisticsMgr( iface );
78 LONG ref;
80 ref = InterlockedIncrement(&This->ref);
82 TRACE("(%p): ref=%d\n", This, ref);
83 return ref;
86 static ULONG WINAPI GameStatisticsMgrImpl_Release(IGameStatisticsMgr *iface)
88 GameStatisticsMgrImpl *This = impl_from_IGameStatisticsMgr( iface );
89 LONG ref;
91 ref = InterlockedDecrement(&This->ref);
92 TRACE("(%p): ref=%d\n", This, ref);
94 if ( ref == 0 )
96 TRACE("freeing GameStatistics object\n");
97 HeapFree( GetProcessHeap(), 0, This);
100 return ref;
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);
111 return E_NOTIMPL;
114 static HRESULT STDMETHODCALLTYPE GameStatisticsMgrImpl_RemoveGameStatistics(
115 IGameStatisticsMgr* iface,
116 LPCWSTR GDFBinaryPath)
118 FIXME("stub (%p, %s)\n", iface, debugstr_w(GDFBinaryPath));
119 return E_NOTIMPL;
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(
132 IUnknown *pUnkOuter,
133 IUnknown **ppObj)
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);
150 return S_OK;