From 3988ee946509478f39f8aa0af123f3709133a5ff Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 2 Oct 2013 15:48:32 +1000 Subject: [PATCH] mscoree: Add support for ICLRMetaHostPolicy interface. --- dlls/mscoree/metahost.c | 64 ++++++++++++++++++++++++++++++++++ dlls/mscoree/mscoree_main.c | 2 ++ dlls/mscoree/mscoree_private.h | 1 + 3 files changed, 67 insertions(+) diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c index f84e4558a4e..fc00522c7de 100644 --- a/dlls/mscoree/metahost.c +++ b/dlls/mscoree/metahost.c @@ -1220,6 +1220,70 @@ HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj) return ICLRMetaHost_QueryInterface(&GlobalCLRMetaHost.ICLRMetaHost_iface, riid, ppobj); } +struct CLRMetaHostPolicy +{ + ICLRMetaHostPolicy ICLRMetaHostPolicy_iface; +}; + +static struct CLRMetaHostPolicy GlobalCLRMetaHostPolicy; + +static HRESULT WINAPI metahostpolicy_QueryInterface(ICLRMetaHostPolicy *iface, REFIID riid, void **obj) +{ + TRACE("%s %p\n", debugstr_guid(riid), obj); + + if ( IsEqualGUID( riid, &IID_ICLRMetaHostPolicy ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + ICLRMetaHostPolicy_AddRef( iface ); + *obj = iface; + return S_OK; + } + + FIXME("Unsupported interface %s\n", debugstr_guid(riid)); + + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI metahostpolicy_AddRef(ICLRMetaHostPolicy *iface) +{ + return 2; +} + +static ULONG WINAPI metahostpolicy_Release(ICLRMetaHostPolicy *iface) +{ + return 1; +} + +static HRESULT WINAPI metahostpolicy_GetRequestedRuntime(ICLRMetaHostPolicy *iface, METAHOST_POLICY_FLAGS dwPolicyFlags, + LPCWSTR pwzBinary, IStream *pCfgStream, LPWSTR pwzVersion, DWORD *pcchVersion, + LPWSTR pwzImageVersion, DWORD *pcchImageVersion, DWORD *pdwConfigFlags, REFIID riid, + LPVOID *ppRuntime) +{ + FIXME("%d %p %p %p %p %p %p %p %s %p\n", dwPolicyFlags, pwzBinary, pCfgStream, + pwzVersion, pcchVersion, pwzImageVersion, pcchImageVersion, pdwConfigFlags, + debugstr_guid(riid), ppRuntime); + + return E_NOTIMPL; +} + +static const struct ICLRMetaHostPolicyVtbl CLRMetaHostPolicy_vtbl = +{ + metahostpolicy_QueryInterface, + metahostpolicy_AddRef, + metahostpolicy_Release, + metahostpolicy_GetRequestedRuntime +}; + +static struct CLRMetaHostPolicy GlobalCLRMetaHostPolicy = { + { &CLRMetaHostPolicy_vtbl } +}; + +HRESULT CLRMetaHostPolicy_CreateInstance(REFIID riid, void **ppobj) +{ + return ICLRMetaHostPolicy_QueryInterface(&GlobalCLRMetaHostPolicy.ICLRMetaHostPolicy_iface, riid, ppobj); +} + HRESULT get_file_from_strongname(WCHAR* stringnameW, WCHAR* assemblies_path, int path_length) { HRESULT hr=S_OK; diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c index 772ba01a44f..2ca0ce7160b 100644 --- a/dlls/mscoree/mscoree_main.c +++ b/dlls/mscoree/mscoree_main.c @@ -588,6 +588,8 @@ HRESULT WINAPI CLRCreateInstance(REFCLSID clsid, REFIID riid, LPVOID *ppInterfac if (IsEqualGUID(clsid, &CLSID_CLRMetaHost)) return CLRMetaHost_CreateInstance(riid, ppInterface); + if (IsEqualGUID(clsid, &CLSID_CLRMetaHostPolicy)) + return CLRMetaHostPolicy_CreateInstance(riid, ppInterface); FIXME("not implemented for class %s\n", debugstr_guid(clsid)); diff --git a/dlls/mscoree/mscoree_private.h b/dlls/mscoree/mscoree_private.h index b66669c51db..dd5b1aff522 100644 --- a/dlls/mscoree/mscoree_private.h +++ b/dlls/mscoree/mscoree_private.h @@ -23,6 +23,7 @@ extern char *WtoA(LPCWSTR wstr) DECLSPEC_HIDDEN; extern HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj) DECLSPEC_HIDDEN; +extern HRESULT CLRMetaHostPolicy_CreateInstance(REFIID riid, void **ppobj) DECLSPEC_HIDDEN; extern HRESULT WINAPI CLRMetaHost_GetVersionFromFile(ICLRMetaHost* iface, LPCWSTR pwzFilePath, LPWSTR pwzBuffer, DWORD *pcchBuffer) DECLSPEC_HIDDEN;