gameux: Add IGameExplorer implementation stub

Mariusz Pluciński vshader at gmail.com
Mon Jun 7 15:29:46 CDT 2010


---
 dlls/gameux/Makefile.in    |    1 +
 dlls/gameux/factory.c      |   18 ++++-
 dlls/gameux/gameexplorer.c |  172 ++++++++++++++++++++++++++++++++++++++++++++
 dlls/gameux/regsvr.c       |   18 +++++
 4 files changed, 207 insertions(+), 2 deletions(-)
 create mode 100644 dlls/gameux/gameexplorer.c

diff --git a/dlls/gameux/Makefile.in b/dlls/gameux/Makefile.in
index d416d0d..bb120f5 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 a2499bd..8bc73d5 100644
--- a/dlls/gameux/factory.c
+++ b/dlls/gameux/factory.c
@@ -124,14 +124,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..42299df
--- /dev/null
+++ b/dlls/gameux/gameexplorer.c
@@ -0,0 +1,172 @@
+/*
+ * 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 <stdarg.h>
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "ole2.h"
+
+#include <gameux.h>
+
+#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));
+        *ppvObject = NULL;
+        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 = 1;
+
+    *ppObj = &pGameExplorer->lpVtbl;
+
+    return S_OK; 
+}
+
diff --git a/dlls/gameux/regsvr.c b/dlls/gameux/regsvr.c
index 0ed2707..523698e 100644
--- a/dlls/gameux/regsvr.c
+++ b/dlls/gameux/regsvr.c
@@ -462,6 +462,14 @@ static LONG register_key_defvalueA(
  *      coclass list
  */
 static struct regsvr_coclass const coclass_list[] = {
+    {   &CLSID_GameExplorer,
+        "GameExplorer Class",
+        NULL,
+        "gameux.dll",
+        "Both", /* apartment? */
+        "gameux.GameExplorer.1",
+        "1.0",
+    },
     { NULL }            /* list terminator */
 };
 
@@ -476,6 +484,16 @@ static struct regsvr_interface const interface_list[] = {
  *      progid list
  */
 static struct progid const progid_list[] = {
+    {   "gameux.GameExplorer",
+	    "GameExplorer Class",
+	    &CLSID_GameExplorer,
+	    NULL
+    },
+    {   "gameux.GameExplorer.1",
+	    "GameExplorer Class",
+	    &CLSID_GameExplorer,
+	    NULL
+    },
     { NULL }            /* list terminator */
 };
 
-- 
1.7.1.1


--------------000100010704010408020601--



More information about the wine-patches mailing list