Vincent Povirk : mscoree: Add stub implementation of ICLRMetaHost.

Alexandre Julliard julliard at winehq.org
Tue Oct 5 12:03:06 CDT 2010


Module: wine
Branch: master
Commit: fce6f93b48b9bd5e13cb52a2c122f79575a476ea
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fce6f93b48b9bd5e13cb52a2c122f79575a476ea

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Wed Sep 22 14:09:04 2010 -0500

mscoree: Add stub implementation of ICLRMetaHost.

---

 dlls/mscoree/Makefile.in       |    1 +
 dlls/mscoree/metahost.c        |  154 ++++++++++++++++++++++++++++++++++++++++
 dlls/mscoree/mscoree_main.c    |    9 ++-
 dlls/mscoree/mscoree_private.h |    2 +
 dlls/mscoree/tests/metahost.c  |    4 +-
 5 files changed, 166 insertions(+), 4 deletions(-)

diff --git a/dlls/mscoree/Makefile.in b/dlls/mscoree/Makefile.in
index 9f7149d..6346aa9 100644
--- a/dlls/mscoree/Makefile.in
+++ b/dlls/mscoree/Makefile.in
@@ -3,6 +3,7 @@ IMPORTS   = uuid shell32 advapi32
 
 C_SRCS = \
 	corruntimehost.c \
+	metahost.c \
 	mscoree_main.c
 
 @MAKE_DLL_RULES@
diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c
new file mode 100644
index 0000000..a6de737
--- /dev/null
+++ b/dlls/mscoree/metahost.c
@@ -0,0 +1,154 @@
+/*
+ * ICLRMetaHost - discovery and management of available .NET runtimes
+ *
+ * Copyright 2010 Vincent Povirk for CodeWeavers
+ *
+ * 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
+ */
+
+#include <stdarg.h>
+
+#define COBJMACROS
+
+#include "wine/unicode.h"
+#include "wine/library.h"
+#include "windef.h"
+#include "winbase.h"
+#include "ole2.h"
+
+#include "mscoree.h"
+#include "metahost.h"
+#include "mscoree_private.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL( mscoree );
+
+struct CLRMetaHost
+{
+    const struct ICLRMetaHostVtbl *CLRMetaHost_vtbl;
+};
+
+static const struct CLRMetaHost GlobalCLRMetaHost;
+
+static HRESULT WINAPI CLRMetaHost_QueryInterface(ICLRMetaHost* iface,
+        REFIID riid,
+        void **ppvObject)
+{
+    TRACE("%s %p\n", debugstr_guid(riid), ppvObject);
+
+    if ( IsEqualGUID( riid, &IID_ICLRMetaHost ) ||
+         IsEqualGUID( riid, &IID_IUnknown ) )
+    {
+        *ppvObject = iface;
+    }
+    else
+    {
+        FIXME("Unsupported interface %s\n", debugstr_guid(riid));
+        return E_NOINTERFACE;
+    }
+
+    ICLRMetaHost_AddRef( iface );
+
+    return S_OK;
+}
+
+static ULONG WINAPI CLRMetaHost_AddRef(ICLRMetaHost* iface)
+{
+    return 2;
+}
+
+static ULONG WINAPI CLRMetaHost_Release(ICLRMetaHost* iface)
+{
+    return 1;
+}
+
+static HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost* iface,
+    LPCWSTR pwzVersion, REFIID iid, LPVOID *ppRuntime)
+{
+    FIXME("%s %s %p\n", debugstr_w(pwzVersion), debugstr_guid(iid), ppRuntime);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI CLRMetaHost_GetVersionFromFile(ICLRMetaHost* iface,
+    LPCWSTR pwzFilePath, LPWSTR pwzBuffer, DWORD *pcchBuffer)
+{
+    FIXME("%s %p %p\n", debugstr_w(pwzFilePath), pwzBuffer, pcchBuffer);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI CLRMetaHost_EnumerateInstalledRuntimes(ICLRMetaHost* iface,
+    IEnumUnknown **ppEnumerator)
+{
+    FIXME("%p\n", ppEnumerator);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI CLRMetaHost_EnumerateLoadedRuntimes(ICLRMetaHost* iface,
+    HANDLE hndProcess, IEnumUnknown **ppEnumerator)
+{
+    FIXME("%p %p\n", hndProcess, ppEnumerator);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI CLRMetaHost_RequestRuntimeLoadedNotification(ICLRMetaHost* iface,
+    RuntimeLoadedCallbackFnPtr pCallbackFunction)
+{
+    FIXME("%p\n", pCallbackFunction);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI CLRMetaHost_QueryLegacyV2RuntimeBinding(ICLRMetaHost* iface,
+    REFIID riid, LPVOID *ppUnk)
+{
+    FIXME("%s %p\n", debugstr_guid(riid), ppUnk);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI CLRMetaHost_ExitProcess(ICLRMetaHost* iface, INT32 iExitCode)
+{
+    FIXME("%i: stub\n", iExitCode);
+
+    ExitProcess(iExitCode);
+}
+
+static const struct ICLRMetaHostVtbl CLRMetaHost_vtbl =
+{
+    CLRMetaHost_QueryInterface,
+    CLRMetaHost_AddRef,
+    CLRMetaHost_Release,
+    CLRMetaHost_GetRuntime,
+    CLRMetaHost_GetVersionFromFile,
+    CLRMetaHost_EnumerateInstalledRuntimes,
+    CLRMetaHost_EnumerateLoadedRuntimes,
+    CLRMetaHost_RequestRuntimeLoadedNotification,
+    CLRMetaHost_QueryLegacyV2RuntimeBinding,
+    CLRMetaHost_ExitProcess
+};
+
+static const struct CLRMetaHost GlobalCLRMetaHost = {
+    &CLRMetaHost_vtbl
+};
+
+extern HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj)
+{
+    return ICLRMetaHost_QueryInterface((ICLRMetaHost*)&GlobalCLRMetaHost, riid, ppobj);
+}
diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c
index 7b33619..5203a41 100644
--- a/dlls/mscoree/mscoree_main.c
+++ b/dlls/mscoree/mscoree_main.c
@@ -642,9 +642,14 @@ BOOL WINAPI StrongNameSignatureVerificationEx(LPCWSTR filename, BOOL forceVerifi
 
 HRESULT WINAPI CLRCreateInstance(REFCLSID clsid, REFIID riid, LPVOID *ppInterface)
 {
-    FIXME("(%s,%s,%p): stub\n", debugstr_guid(clsid), debugstr_guid(riid), ppInterface);
+    TRACE("(%s,%s,%p)\n", debugstr_guid(clsid), debugstr_guid(riid), ppInterface);
 
-    return E_NOTIMPL;
+    if (IsEqualGUID(clsid, &CLSID_CLRMetaHost))
+        return CLRMetaHost_CreateInstance(riid, ppInterface);
+
+    FIXME("not implemented for class %s\n", debugstr_guid(clsid));
+
+    return CLASS_E_CLASSNOTAVAILABLE;
 }
 
 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
diff --git a/dlls/mscoree/mscoree_private.h b/dlls/mscoree/mscoree_private.h
index f14da1d..dda9bc0 100644
--- a/dlls/mscoree/mscoree_private.h
+++ b/dlls/mscoree/mscoree_private.h
@@ -22,6 +22,8 @@
 
 extern IUnknown* create_corruntimehost(void);
 
+extern HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj);
+
 /* Mono 2.6 embedding */
 typedef struct _MonoDomain MonoDomain;
 typedef struct _MonoAssembly MonoAssembly;
diff --git a/dlls/mscoree/tests/metahost.c b/dlls/mscoree/tests/metahost.c
index 27bed7f..5b3ed2c 100644
--- a/dlls/mscoree/tests/metahost.c
+++ b/dlls/mscoree/tests/metahost.c
@@ -47,7 +47,7 @@ BOOL init_pointers(void)
 
     if (FAILED(hr))
     {
-        todo_wine win_skip(".NET 4 is not installed\n");
+        win_skip(".NET 4 is not installed\n");
         FreeLibrary(hmscoree);
         return FALSE;
     }
@@ -72,7 +72,7 @@ void test_enumruntimes(void)
     WCHAR buf[MAX_PATH];
 
     hr = ICLRMetaHost_EnumerateInstalledRuntimes(metahost, &runtime_enum);
-    ok(hr == S_OK, "EnumerateInstalledRuntimes returned %x\n", hr);
+    todo_wine ok(hr == S_OK, "EnumerateInstalledRuntimes returned %x\n", hr);
     if (FAILED(hr)) return;
 
     while ((hr = IEnumUnknown_Next(runtime_enum, 1, &unk, &count)) == S_OK)




More information about the wine-cvs mailing list