From 4e236ed8b90da226360f3d69430cca065ff983c6 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Mariusz=20Pluci=C5=84ski?= Date: Mon, 7 Jun 2010 22:29:46 +0200 Subject: gameux: Add IGameExplorer implementation stub --- dlls/gameux/Makefile.in | 1 + dlls/gameux/factory.c | 18 ++++- dlls/gameux/gameexplorer.c | 171 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 188 insertions(+), 2 deletions(-) create mode 100644 dlls/gameux/gameexplorer.c diff --git a/dlls/gameux/Makefile.in b/dlls/gameux/Makefile.in index bb31630..fa131f1 100644 --- a/dlls/gameux/Makefile.in +++ b/dlls/gameux/Makefile.in @@ -9,6 +9,7 @@ EXTRALIBS = -luuid C_SRCS = \ factory.c \ + gameexplorer.c \ main.c \ regsvr.c diff --git a/dlls/gameux/factory.c b/dlls/gameux/factory.c index 50f52ef..365a792 100644 --- a/dlls/gameux/factory.c +++ b/dlls/gameux/factory.c @@ -123,14 +123,28 @@ static const struct IClassFactoryVtbl gameuxcf_vtbl = gameuxcf_LockServer }; +extern HRESULT GameExplorer_create(IUnknown *pUnkOuter, LPVOID *ppObj); + +static gameuxcf gameexplorercf = { &gameuxcf_vtbl, GameExplorer_create }; + + /****************************************************************** * DllGetClassObject (GAMEUX.@) */ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv ) { + IClassFactory *cf = NULL; + TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv ); - FIXME("stub\n"); - return CLASS_E_CLASSNOTAVAILABLE; + if( IsEqualCLSID( rclsid, &CLSID_GameExplorer )) + { + cf = (IClassFactory*) &gameexplorercf.lpVtbl; + } + + if ( !cf ) + return CLASS_E_CLASSNOTAVAILABLE; + + return IClassFactory_QueryInterface( cf, iid, ppv ); } diff --git a/dlls/gameux/gameexplorer.c b/dlls/gameux/gameexplorer.c new file mode 100644 index 0000000..39c8cde --- /dev/null +++ b/dlls/gameux/gameexplorer.c @@ -0,0 +1,171 @@ +/* + * gameux: IGameExplorer interfaces implementation + * + * Copyright (C) 2008 Alistair Leslie-Hughes + * 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); + +/* + * IGameExplorer implementation + */ + +typedef struct _GameExplorerImpl +{ + const struct IGameExplorerVtbl *lpVtbl; + LONG ref; +} GameExplorerImpl; + +static inline GameExplorerImpl *impl_from_IGameExplorer( IGameExplorer *iface ) +{ + return (GameExplorerImpl *)((char*)iface - FIELD_OFFSET(GameExplorerImpl, lpVtbl)); +} + + +static HRESULT WINAPI GameExplorerImpl_QueryInterface(IGameExplorer *iface, REFIID riid, void **ppvObject) +{ + GameExplorerImpl *This = impl_from_IGameExplorer( iface ); + + TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject ); + + *ppvObject = NULL; + + if ( IsEqualGUID( riid, &IID_IUnknown ) || + IsEqualGUID( riid, &IID_IGameExplorer ) ) + { + *ppvObject = iface; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + + IGameExplorer_AddRef( iface ); + + return S_OK; +} + +static ULONG WINAPI GameExplorerImpl_AddRef(IGameExplorer *iface) +{ + GameExplorerImpl *This = impl_from_IGameExplorer( iface ); + TRACE("%p\n", This ); + return InterlockedIncrement( &This->ref ); +} + +static ULONG WINAPI GameExplorerImpl_Release(IGameExplorer *iface) +{ + GameExplorerImpl *This = impl_from_IGameExplorer( iface ); + LONG ref; + + TRACE("%p\n", This ); + + ref = InterlockedDecrement( &This->ref ); + if ( ref == 0 ) + { + HeapFree( GetProcessHeap(), 0, iface ); + } + + return ref; +} + +static HRESULT WINAPI GameExplorerImpl_AddGame(IGameExplorer *iface, + BSTR bstrGDFBinaryPath, + BSTR sGameInstallDirectory, + GAME_INSTALL_SCOPE installScope, + GUID *pInstanceID) +{ + TRACE("(%p, %s, %s, 0x%x, %s)\n", iface, debugstr_w(bstrGDFBinaryPath), debugstr_w(sGameInstallDirectory), installScope, debugstr_guid(pInstanceID)); + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI GameExplorerImpl_RemoveGame(IGameExplorer *iface, + GUID instanceID) +{ + TRACE("(%p, %s)\n", iface, debugstr_guid(&instanceID)); + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI GameExplorerImpl_UpdateGame(IGameExplorer *iface, + GUID instanceID) +{ + TRACE("(%p, %s)\n", iface, debugstr_guid(&instanceID)); + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI GameExplorerImpl_VerifyAccess(IGameExplorer *iface, + BSTR sGDFBinaryPath, BOOL *pHasAccess) +{ + TRACE("(%p, %s, %p)\n", iface, debugstr_w(sGDFBinaryPath), pHasAccess); + FIXME("stub\n"); + *pHasAccess = TRUE; + TRACE("returning value: %d\n", *pHasAccess); + /*return E_NOTIMPL;*/ + return S_OK; +} + +static const struct IGameExplorerVtbl GameExplorerImplVtbl = +{ + GameExplorerImpl_QueryInterface, + GameExplorerImpl_AddRef, + GameExplorerImpl_Release, + GameExplorerImpl_AddGame, + GameExplorerImpl_RemoveGame, + GameExplorerImpl_UpdateGame, + GameExplorerImpl_VerifyAccess +}; + +/* + * Construction function + */ +HRESULT GameExplorer_create(IUnknown *pUnkOuter, LPVOID *ppObj) +{ + GameExplorerImpl* pGameExplorer; + + TRACE("(%p, %p)\n", pUnkOuter, ppObj); + + pGameExplorer = HeapAlloc( GetProcessHeap(), 0, sizeof(*pGameExplorer) ); + + if( !pGameExplorer ) + return E_OUTOFMEMORY; + + pGameExplorer->lpVtbl = &GameExplorerImplVtbl; + pGameExplorer->ref = 0; + + *ppObj = &pGameExplorer->lpVtbl; + + return S_OK; +} + -- 1.6.2.5