static void test_createinstance(void) { HRESULT hr; ICLRMetaHost *host; if (no_legacy_runtimes) { /* If we don't have 1.x or 2.0 runtimes, we should at least have .NET 4. */ ok(pCreateInterface != NULL, "no legacy runtimes or .NET 4 interfaces available\n"); } 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"); } }
static 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"); } }
static void cleanup(void) { ICLRMetaHost_Release(metahost); FreeLibrary(hmscoree); }
static void test_createdomain(void) { static const WCHAR test_name[] = {'t','e','s','t',0}; static const WCHAR test2_name[] = {'t','e','s','t','2',0}; ICLRMetaHost *metahost; ICLRRuntimeInfo *runtimeinfo; ICorRuntimeHost *runtimehost; IUnknown *domain, *defaultdomain_unk, *defaultdomain, *newdomain_unk, *newdomain, *domainsetup, *newdomain2_unk, *newdomain2; HRESULT hr; if (!pCLRCreateInstance) { win_skip("Function CLRCreateInstance not found.\n"); return; } hr = pCLRCreateInstance(&CLSID_CLRMetaHost, &IID_ICLRMetaHost, (void **)&metahost); ok(SUCCEEDED(hr), "CLRCreateInstance failed, hr=%#.8x\n", hr); hr = ICLRMetaHost_GetRuntime(metahost, v4_0, &IID_ICLRRuntimeInfo, (void **)&runtimeinfo); ok(SUCCEEDED(hr), "ICLRMetaHost::GetRuntime failed, hr=%#.8x\n", hr); hr = ICLRRuntimeInfo_GetInterface(runtimeinfo, &CLSID_CorRuntimeHost, &IID_ICorRuntimeHost, (void **)&runtimehost); ok(SUCCEEDED(hr), "ICLRRuntimeInfo::GetInterface failed, hr=%#.8x\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 = IUnknown_QueryInterface(domain, &IID_IUnknown, (void **)&defaultdomain_unk); ok(SUCCEEDED(hr), "COM object doesn't support IUnknown?!\n"); hr = IUnknown_QueryInterface(domain, &IID__AppDomain, (void **)&defaultdomain); ok(SUCCEEDED(hr), "AppDomain object doesn't support _AppDomain interface\n"); IUnknown_Release(domain); hr = ICorRuntimeHost_CreateDomain(runtimehost, test_name, NULL, &domain); ok(SUCCEEDED(hr), "ICorRuntimeHost::CreateDomain failed, hr=%#.8x\n", hr); hr = IUnknown_QueryInterface(domain, &IID_IUnknown, (void **)&newdomain_unk); ok(SUCCEEDED(hr), "COM object doesn't support IUnknown?!\n"); hr = IUnknown_QueryInterface(domain, &IID__AppDomain, (void **)&newdomain); ok(SUCCEEDED(hr), "AppDomain object doesn't support _AppDomain interface\n"); IUnknown_Release(domain); ok(defaultdomain_unk != newdomain_unk, "New and default domain objects are the same\n"); hr = ICorRuntimeHost_CreateDomainSetup(runtimehost, &domainsetup); ok(SUCCEEDED(hr), "ICorRuntimeHost::CreateDomainSetup failed, hr=%#.8x\n", hr); hr = ICorRuntimeHost_CreateDomainEx(runtimehost, test2_name, domainsetup, NULL, &domain); ok(SUCCEEDED(hr), "ICorRuntimeHost::CreateDomainEx failed, hr=%#.8x\n", hr); hr = IUnknown_QueryInterface(domain, &IID_IUnknown, (void **)&newdomain2_unk); ok(SUCCEEDED(hr), "COM object doesn't support IUnknown?!\n"); hr = IUnknown_QueryInterface(domain, &IID__AppDomain, (void **)&newdomain2); ok(SUCCEEDED(hr), "AppDomain object doesn't support _AppDomain interface\n"); IUnknown_Release(domain); ok(defaultdomain_unk != newdomain2_unk, "New and default domain objects are the same\n"); ok(newdomain_unk != newdomain2_unk, "Both new domain objects are the same\n"); IUnknown_Release(newdomain2); IUnknown_Release(newdomain2_unk); IUnknown_Release(domainsetup); IUnknown_Release(newdomain); IUnknown_Release(newdomain_unk); IUnknown_Release(defaultdomain); IUnknown_Release(defaultdomain_unk); ICorRuntimeHost_Release(runtimehost); ICLRRuntimeInfo_Release(runtimeinfo); ICLRMetaHost_Release(metahost); }