Alistair Leslie-Hughes : mscoree: Implement CreateInterface.

Alexandre Julliard julliard at winehq.org
Thu Oct 3 15:18:02 CDT 2013


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

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Tue Oct  1 10:17:50 2013 +1000

mscoree: Implement CreateInterface.

---

 dlls/mscoree/mscoree.spec    |    1 +
 dlls/mscoree/mscoree_main.c  |    7 +++++++
 dlls/mscoree/tests/mscoree.c |   29 ++++++++++++++++++++++++++++-
 3 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/dlls/mscoree/mscoree.spec b/dlls/mscoree/mscoree.spec
index ad883c6..93248e2 100644
--- a/dlls/mscoree/mscoree.spec
+++ b/dlls/mscoree/mscoree.spec
@@ -30,6 +30,7 @@
 @ stub CorTickleSvc
 @ stdcall CreateConfigStream(wstr ptr)
 @ stdcall CreateDebuggingInterfaceFromVersion(long wstr ptr)
+@ stdcall CreateInterface(ptr ptr ptr)
 @ stdcall -private DllCanUnloadNow()
 @ stdcall -private DllGetClassObject(ptr ptr ptr)
 @ stdcall -private DllRegisterServer()
diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c
index de37706..772ba01 100644
--- a/dlls/mscoree/mscoree_main.c
+++ b/dlls/mscoree/mscoree_main.c
@@ -594,6 +594,13 @@ HRESULT WINAPI CLRCreateInstance(REFCLSID clsid, REFIID riid, LPVOID *ppInterfac
     return CLASS_E_CLASSNOTAVAILABLE;
 }
 
+HRESULT WINAPI CreateInterface(REFCLSID clsid, REFIID riid, LPVOID *ppInterface)
+{
+    TRACE("(%s,%s,%p)\n", debugstr_guid(clsid), debugstr_guid(riid), ppInterface);
+
+    return CLRCreateInstance(clsid, riid, ppInterface);
+}
+
 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
 {
     mscorecf *This;
diff --git a/dlls/mscoree/tests/mscoree.c b/dlls/mscoree/tests/mscoree.c
index f8de6fa..41844ef 100644
--- a/dlls/mscoree/tests/mscoree.c
+++ b/dlls/mscoree/tests/mscoree.c
@@ -21,6 +21,7 @@
 
 #include "corerror.h"
 #include "mscoree.h"
+#include "metahost.h"
 #include "shlwapi.h"
 #include "wine/test.h"
 
@@ -31,6 +32,7 @@ static HRESULT (WINAPI *pGetCORSystemDirectory)(LPWSTR, DWORD, DWORD*);
 static HRESULT (WINAPI *pGetRequestedRuntimeInfo)(LPCWSTR, LPCWSTR, LPCWSTR, DWORD, DWORD, LPWSTR, DWORD, DWORD*, LPWSTR, DWORD, DWORD*);
 static HRESULT (WINAPI *pLoadLibraryShim)(LPCWSTR, LPCWSTR, LPVOID, HMODULE*);
 static HRESULT (WINAPI *pCreateConfigStream)(LPCWSTR, IStream**);
+static HRESULT (WINAPI *pCreateInterface)(REFCLSID, REFIID, VOID**);
 
 static BOOL init_functionpointers(void)
 {
@@ -47,8 +49,10 @@ static BOOL init_functionpointers(void)
     pGetRequestedRuntimeInfo = (void *)GetProcAddress(hmscoree, "GetRequestedRuntimeInfo");
     pLoadLibraryShim = (void *)GetProcAddress(hmscoree, "LoadLibraryShim");
     pCreateConfigStream = (void *)GetProcAddress(hmscoree, "CreateConfigStream");
+    pCreateInterface =  (void *)GetProcAddress(hmscoree, "CreateInterface");
 
-    if (!pGetCORVersion || !pGetCORSystemDirectory || !pGetRequestedRuntimeInfo || !pLoadLibraryShim)
+    if (!pGetCORVersion || !pGetCORSystemDirectory || !pGetRequestedRuntimeInfo || !pLoadLibraryShim ||
+        !pCreateInterface)
     {
         win_skip("functions not available\n");
         FreeLibrary(hmscoree);
@@ -386,6 +390,28 @@ static void test_createconfigstream(void)
     DeleteFileW(file);
 }
 
+void test_createinstance(void)
+{
+    HRESULT hr;
+    ICLRMetaHost *host;
+
+    if(!pCreateInterface)
+    {
+        win_skip("Function CreateInterface not found.\n");
+        return;
+    }
+
+    hr = pCreateInterface(&CLSID_CLRMetaHost, &IID_ICLRMetaHost, (void**)&host);
+    if(SUCCEEDED(hr))
+    {
+        ICLRMetaHost_Release(host);
+    }
+    else
+    {
+        win_skip(".NET 4 not installed.\n");
+    }
+}
+
 START_TEST(mscoree)
 {
     if (!init_functionpointers())
@@ -394,6 +420,7 @@ START_TEST(mscoree)
     test_versioninfo();
     test_loadlibraryshim();
     test_createconfigstream();
+    test_createinstance();
 
     FreeLibrary(hmscoree);
 }




More information about the wine-cvs mailing list