From f0b10f9771134f4230f8adfa1d646ad5d7e040d5 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Mariusz=20Pluci=C5=84ski?= Date: Mon, 7 Jun 2010 22:55:57 +0200 Subject: gameux: Add IGameStatisticsMgr implementation stub --- dlls/gameux/Makefile.in | 1 + dlls/gameux/factory.c | 7 ++- dlls/gameux/gamestatistics.c | 148 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 155 insertions(+), 1 deletions(-) create mode 100644 dlls/gameux/gamestatistics.c diff --git a/dlls/gameux/Makefile.in b/dlls/gameux/Makefile.in index fa131f1..4c0158f 100644 --- a/dlls/gameux/Makefile.in +++ b/dlls/gameux/Makefile.in @@ -10,6 +10,7 @@ EXTRALIBS = -luuid C_SRCS = \ factory.c \ gameexplorer.c \ + gamestatistics.c \ main.c \ regsvr.c diff --git a/dlls/gameux/factory.c b/dlls/gameux/factory.c index 365a792..26d19ee 100644 --- a/dlls/gameux/factory.c +++ b/dlls/gameux/factory.c @@ -124,9 +124,10 @@ static const struct IClassFactoryVtbl gameuxcf_vtbl = }; extern HRESULT GameExplorer_create(IUnknown *pUnkOuter, LPVOID *ppObj); +extern HRESULT GameStatistics_create(IUnknown* pUnkOuter, LPVOID *ppObj); static gameuxcf gameexplorercf = { &gameuxcf_vtbl, GameExplorer_create }; - +static gameuxcf gamestatisticscf = { &gameuxcf_vtbl, GameStatistics_create }; /****************************************************************** * DllGetClassObject (GAMEUX.@) @@ -141,6 +142,10 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv ) { cf = (IClassFactory*) &gameexplorercf.lpVtbl; } + else if( IsEqualCLSID( rclsid, &CLSID_GameStatistics )) + { + cf = (IClassFactory*) &gamestatisticscf.lpVtbl; + } if ( !cf ) return CLASS_E_CLASSNOTAVAILABLE; diff --git a/dlls/gameux/gamestatistics.c b/dlls/gameux/gamestatistics.c new file mode 100644 index 0000000..81206d6 --- /dev/null +++ b/dlls/gameux/gamestatistics.c @@ -0,0 +1,148 @@ +/* + * gameux: IGameStatisticsMgr implementation + * + * Copyright (C) 2010 Mariusz PluciƄski + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ +#define COBJMACROS + +#include "config.h" + +#include +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" + +#include + +#include "wine/debug.h" + + +WINE_DEFAULT_DEBUG_CHANNEL(gameux); + +/* + * IGameStatisticsMgr + */ + +typedef struct _GameStatisticsMgrImpl +{ + const struct IGameStatisticsMgrVtbl *lpVtbl; + LONG ref; +} GameStatisticsMgrImpl; + +static inline GameStatisticsMgrImpl *impl_from_IGameStatisticsMgr( IGameStatisticsMgr *iface ) +{ + return (GameStatisticsMgrImpl *)((char*)iface - FIELD_OFFSET(GameStatisticsMgrImpl, lpVtbl)); +} + + +static HRESULT WINAPI GameStatisticsMgrImpl_QueryInterface(IGameStatisticsMgr *iface, REFIID riid, void **ppvObject) +{ + GameStatisticsMgrImpl *This = impl_from_IGameStatisticsMgr( iface ); + + TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject ); + + *ppvObject = NULL; + + if ( IsEqualGUID( riid, &IID_IUnknown ) || + IsEqualGUID( riid, &IID_IGameStatisticsMgr ) ) + { + *ppvObject = iface; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + + IGameStatisticsMgr_AddRef( iface ); + + return S_OK; +} + +static ULONG WINAPI GameStatisticsMgrImpl_AddRef(IGameStatisticsMgr *iface) +{ + GameStatisticsMgrImpl *This = impl_from_IGameStatisticsMgr( iface ); + TRACE("%p\n", This ); + return InterlockedIncrement( &This->ref ); +} + +static ULONG WINAPI GameStatisticsMgrImpl_Release(IGameStatisticsMgr *iface) +{ + GameStatisticsMgrImpl *This = impl_from_IGameStatisticsMgr( iface ); + LONG ref; + + TRACE("%p\n", This ); + + ref = InterlockedDecrement( &This->ref ); + if ( ref == 0 ) + { + HeapFree( GetProcessHeap(), 0, iface ); + } + + return ref; +} + +static HRESULT STDMETHODCALLTYPE GameStatisticsMgrImpl_GetGameStatistics( + IGameStatisticsMgr* iface, + LPCWSTR GDFBinaryPath, + GAMESTATS_OPEN_TYPE openType, + GAMESTATS_OPEN_RESULT *pOpenResult, + IGameStatistics **ppiStats) +{ + TRACE("(%p, %s, 0x%x, %p, %p)\n", iface, debugstr_w(GDFBinaryPath), openType, pOpenResult, ppiStats); + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE GameStatisticsMgrImpl_RemoveGameStatistics( + IGameStatisticsMgr* iface, + LPCWSTR GDFBinaryPath) +{ + TRACE("(%p, %s)\n", iface, debugstr_w(GDFBinaryPath)); + FIXME("stub\n"); + return E_NOTIMPL; +} + +static const struct IGameStatisticsMgrVtbl GameStatisticsMgrImplVtbl = +{ + GameStatisticsMgrImpl_QueryInterface, + GameStatisticsMgrImpl_AddRef, + GameStatisticsMgrImpl_Release, + GameStatisticsMgrImpl_GetGameStatistics, + GameStatisticsMgrImpl_RemoveGameStatistics, +}; + +HRESULT GameStatistics_create(IUnknown *pUnkOuter, LPVOID *ppObj) +{ + GameStatisticsMgrImpl *pGameStatistics; + + TRACE("(%p, %p)\n", pUnkOuter, ppObj); + + pGameStatistics = HeapAlloc( GetProcessHeap(), 0, sizeof (*pGameStatistics) ); + if( !pGameStatistics ) + return E_OUTOFMEMORY; + + pGameStatistics->lpVtbl = &GameStatisticsMgrImplVtbl; + pGameStatistics->ref = 0; + + *ppObj = &pGameStatistics->lpVtbl; + + TRACE("returning iface %p\n", *ppObj); + return S_OK; +} + -- 1.6.2.5