mscoree: Use the .NET 4 interfaces to implement CorBindToRuntimeEx.

This commit is contained in:
Vincent Povirk 2010-10-01 15:37:25 -05:00 committed by Alexandre Julliard
parent 84ef0fca57
commit 601b240f1e
3 changed files with 15 additions and 36 deletions

View File

@ -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;
}

View File

@ -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 = create_corruntimehost();
return S_OK;
}
*ppv = NULL;
return E_NOTIMPL;
ret = get_runtime_info(NULL, szVersion, NULL, nflags, 0, TRUE, &info);
if (SUCCEEDED(ret))
{
ret = ICLRRuntimeInfo_GetInterface(info, rslsid, riid, ppv);
ICLRRuntimeInfo_Release(info);
}
return ret;
}
HRESULT WINAPI CorBindToCurrentRuntime(LPCWSTR filename, REFCLSID rclsid, REFIID riid, LPVOID *ppv)

View File

@ -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;