static void test_mk_protocol(void) { IClassFactory *cf; HRESULT hres; test_protocol = MK_PROTOCOL; hres = CoGetClassObject(&CLSID_MkProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&cf); ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres); if(FAILED(hres)) return; cache_file = cache_file1; test_protocol_url(cf, blank_url3, TRUE); cache_file = cache_file2; test_protocol_url(cf, blank_url7, TRUE); cache_file = cache_file3; test_protocol_url(cf, blank_url8, FALSE); IClassFactory_Release(cf); }
static void test_its_protocol(void) { IInternetProtocolInfo *info; IClassFactory *factory; IUnknown *unk; ULONG ref; HRESULT hres; static const WCHAR wrong_url1[] = {'i','t','s',':','t','e','s','t','.','c','h','m',':',':','/','b','l','a','n','.','h','t','m','l',0}; static const WCHAR wrong_url2[] = {'i','t','s',':','t','e','s','.','c','h','m',':',':','b','/','l','a','n','k','.','h','t','m','l',0}; static const WCHAR wrong_url3[] = {'i','t','s',':','t','e','s','t','.','c','h','m','/','b','l','a','n','k','.','h','t','m','l',0}; static const WCHAR wrong_url4[] = {'m','k',':','@','M','S','I','T','S','t','o','r',':', 't','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0}; static const WCHAR wrong_url5[] = {'f','i','l','e',':', 't','e','s','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0}; test_protocol = ITS_PROTOCOL; hres = CoGetClassObject(&CLSID_ITSProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk); ok(hres == S_OK || broken(hres == REGDB_E_CLASSNOTREG), /* Some W95 and NT4 */ "CoGetClassObject failed: %08x\n", hres); if(FAILED(hres)) return; hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&info); ok(hres == E_NOINTERFACE, "Could not get IInternetProtocolInfo: %08x\n", hres); hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory); ok(hres == S_OK, "Could not get IClassFactory interface\n"); if(SUCCEEDED(hres)) { IInternetProtocol *protocol; hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&protocol); ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres); if(SUCCEEDED(hres)) { test_its_protocol_info(protocol); test_protocol_fail(protocol, wrong_url1, STG_E_FILENOTFOUND); test_protocol_fail(protocol, wrong_url2, STG_E_FILENOTFOUND); test_protocol_fail(protocol, wrong_url3, STG_E_FILENOTFOUND); hres = IInternetProtocol_Start(protocol, wrong_url4, &protocol_sink, &bind_info, 0, 0); ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "Start failed: %08x, expected INET_E_USE_DEFAULT_PROTOCOLHANDLER\n", hres); hres = IInternetProtocol_Start(protocol, wrong_url5, &protocol_sink, &bind_info, 0, 0); ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "Start failed: %08x, expected INET_E_USE_DEFAULT_PROTOCOLHANDLER\n", hres); ref = IInternetProtocol_Release(protocol); ok(!ref, "protocol ref=%d\n", ref); test_protocol_url(factory, blank_url1, TRUE); test_protocol_url(factory, blank_url2, TRUE); test_protocol_url(factory, blank_url3, TRUE); test_protocol_url(factory, blank_url4, TRUE); test_protocol_url(factory, blank_url5, TRUE); test_protocol_url(factory, blank_url6, TRUE); test_protocol_url(factory, blank_url8, TRUE); bindf = BINDF_FROMURLMON | BINDF_NEEDFILE; test_protocol_url(factory, blank_url1, TRUE); } IClassFactory_Release(factory); } IUnknown_Release(unk); }