Module: wine Branch: master Commit: 601b240f1e3649afac64d48e4966d16cf59c165d URL: http://source.winehq.org/git/wine.git/?a=commit;h=601b240f1e3649afac64d48e49...
Author: Vincent Povirk vincent@codeweavers.com Date: Fri Oct 1 15:37:25 2010 -0500
mscoree: Use the .NET 4 interfaces to implement CorBindToRuntimeEx.
---
dlls/mscoree/corruntimehost.c | 27 --------------------------- dlls/mscoree/mscoree_main.c | 20 ++++++++++++++------ dlls/mscoree/mscoree_private.h | 2 -- 3 files changed, 14 insertions(+), 35 deletions(-)
diff --git a/dlls/mscoree/corruntimehost.c b/dlls/mscoree/corruntimehost.c index 831f6de..1e9cc7f 100644 --- a/dlls/mscoree/corruntimehost.c +++ b/dlls/mscoree/corruntimehost.c @@ -42,7 +42,6 @@ struct RuntimeHost const CLRRuntimeInfo *version; const loaded_mono *mono; LONG ref; - BOOL legacy; /* if True, this was created by create_corruntimehost, and Release frees it */ };
static inline RuntimeHost *impl_from_ICorRuntimeHost( ICorRuntimeHost *iface ) @@ -86,10 +85,6 @@ static ULONG WINAPI corruntimehost_Release(ICorRuntimeHost* iface) ULONG ref;
ref = InterlockedDecrement( &This->ref ); - if ( ref == 0 && This->legacy ) - { - RuntimeHost_Destroy(This); - }
return ref; } @@ -289,7 +284,6 @@ HRESULT RuntimeHost_Construct(const CLRRuntimeInfo *runtime_version, This->ref = 1; This->version = runtime_version; This->mono = loaded_mono; - This->legacy = FALSE;
*result = This;
@@ -318,24 +312,3 @@ HRESULT RuntimeHost_Destroy(RuntimeHost *This) HeapFree( GetProcessHeap(), 0, This ); return S_OK; } - -IUnknown* create_corruntimehost(void) -{ - RuntimeHost *This; - IUnknown *result; - - if (FAILED(RuntimeHost_Construct(NULL, NULL, &This))) - return NULL; - - This->legacy = TRUE; - - if (FAILED(RuntimeHost_GetInterface(This, &CLSID_CorRuntimeHost, &IID_IUnknown, (void**)&result))) - { - RuntimeHost_Destroy(This); - return NULL; - } - - FIXME("return iface %p\n", result); - - return result; -} diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c index d2d7445..e528360 100644 --- a/dlls/mscoree/mscoree_main.c +++ b/dlls/mscoree/mscoree_main.c @@ -628,16 +628,24 @@ HRESULT WINAPI LoadStringRC(UINT resId, LPWSTR pBuffer, int iBufLen, int bQuiet) HRESULT WINAPI CorBindToRuntimeEx(LPWSTR szVersion, LPWSTR szBuildFlavor, DWORD nflags, REFCLSID rslsid, REFIID riid, LPVOID *ppv) { - FIXME("%s %s %d %s %s %p\n", debugstr_w(szVersion), debugstr_w(szBuildFlavor), nflags, debugstr_guid( rslsid ), + HRESULT ret; + ICLRRuntimeInfo *info; + + TRACE("%s %s %d %s %s %p\n", debugstr_w(szVersion), debugstr_w(szBuildFlavor), nflags, debugstr_guid( rslsid ), debugstr_guid( riid ), ppv);
- if(IsEqualGUID( riid, &IID_ICorRuntimeHost )) + *ppv = NULL; + + ret = get_runtime_info(NULL, szVersion, NULL, nflags, 0, TRUE, &info); + + if (SUCCEEDED(ret)) { - *ppv = create_corruntimehost(); - return S_OK; + ret = ICLRRuntimeInfo_GetInterface(info, rslsid, riid, ppv); + + ICLRRuntimeInfo_Release(info); } - *ppv = NULL; - return E_NOTIMPL; + + return ret; }
HRESULT WINAPI CorBindToCurrentRuntime(LPCWSTR filename, REFCLSID rclsid, REFIID riid, LPVOID *ppv) diff --git a/dlls/mscoree/mscoree_private.h b/dlls/mscoree/mscoree_private.h index 62fa0bf..a77de0a 100644 --- a/dlls/mscoree/mscoree_private.h +++ b/dlls/mscoree/mscoree_private.h @@ -20,8 +20,6 @@ #ifndef __MSCOREE_PRIVATE__ #define __MSCOREE_PRIVATE__
-extern IUnknown* create_corruntimehost(void); - extern HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj);
typedef struct tagASSEMBLY ASSEMBLY;