Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mscoree/corruntimehost.c | 10 ++++++++-- dlls/mscoree/tests/mscoree.c | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/dlls/mscoree/corruntimehost.c b/dlls/mscoree/corruntimehost.c index 2ccc7bc4f5..c638c56ab5 100644 --- a/dlls/mscoree/corruntimehost.c +++ b/dlls/mscoree/corruntimehost.c @@ -793,8 +793,14 @@ static HRESULT WINAPI corruntimehost_CurrentDomain( ICorRuntimeHost* iface, IUnknown **appDomain) { - FIXME("stub %p\n", iface); - return E_NOTIMPL; + RuntimeHost *This = impl_from_ICorRuntimeHost(iface); + + TRACE("(%p, %p)\n", iface, appDomain); + + if (!is_mono_started) + return E_FAIL; + + return RuntimeHost_GetIUnknownForDomain(This, mono_domain_get(), appDomain); }
static const struct ICorRuntimeHostVtbl corruntimehost_vtbl = diff --git a/dlls/mscoree/tests/mscoree.c b/dlls/mscoree/tests/mscoree.c index bb2a17046b..82dbb3066b 100644 --- a/dlls/mscoree/tests/mscoree.c +++ b/dlls/mscoree/tests/mscoree.c @@ -540,7 +540,7 @@ static void test_createdomain(void) ICLRRuntimeInfo *runtimeinfo; ICorRuntimeHost *runtimehost; IUnknown *domain, *defaultdomain_unk, *defaultdomain, *newdomain_unk, *newdomain, *domainsetup, - *newdomain2_unk, *newdomain2; + *newdomain2_unk, *newdomain2, *current_domain; HRESULT hr;
if (!pCLRCreateInstance) @@ -559,12 +559,20 @@ static void test_createdomain(void) (void **)&runtimehost); ok(SUCCEEDED(hr), "ICLRRuntimeInfo::GetInterface failed, hr=%#.8x\n", hr);
+ hr = ICorRuntimeHost_CurrentDomain(runtimehost, ¤t_domain); + ok(FAILED(hr), "Unexpected hr %#x.\n", hr); + hr = ICorRuntimeHost_Start(runtimehost); ok(SUCCEEDED(hr), "ICorRuntimeHost::Start failed, hr=%#.8x\n", hr);
hr = ICorRuntimeHost_GetDefaultDomain(runtimehost, &domain); ok(SUCCEEDED(hr), "ICorRuntimeHost::GetDefaultDomain failed, hr=%#.8x\n", hr);
+ hr = ICorRuntimeHost_CurrentDomain(runtimehost, ¤t_domain); + ok(SUCCEEDED(hr), "Failed to get current domain, hr %#x.\n", hr); + ok(current_domain == domain, "Unexpected domain %p, %p.\n", current_domain, domain); + IUnknown_Release(current_domain); + hr = IUnknown_QueryInterface(domain, &IID_IUnknown, (void **)&defaultdomain_unk); ok(SUCCEEDED(hr), "COM object doesn't support IUnknown?!\n");
@@ -584,6 +592,14 @@ static void test_createdomain(void)
IUnknown_Release(domain);
+ hr = ICorRuntimeHost_GetDefaultDomain(runtimehost, &domain); + ok(SUCCEEDED(hr), "ICorRuntimeHost::GetDefaultDomain failed, hr=%#.8x\n", hr); + hr = ICorRuntimeHost_CurrentDomain(runtimehost, ¤t_domain); + ok(SUCCEEDED(hr), "Failed to get current domain, hr %#x.\n", hr); + ok(current_domain == domain, "Unexpected domain %p, %p.\n", current_domain, domain); + IUnknown_Release(current_domain); + IUnknown_Release(domain); + ok(defaultdomain_unk != newdomain_unk, "New and default domain objects are the same\n");
hr = ICorRuntimeHost_CreateDomainSetup(runtimehost, &domainsetup);