From 21621b285683059bbab63defc7f45767c4ca3c55 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sat, 27 May 2006 22:55:32 +0200 Subject: [PATCH] urlmon: Return IClassFactory in get_protocol_handler and fix get_protocol. --- dlls/urlmon/binding.c | 8 +------- dlls/urlmon/session.c | 16 +++++++++++----- dlls/urlmon/urlmon_main.h | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dlls/urlmon/binding.c b/dlls/urlmon/binding.c index 44d3e3946f1..37f2752c61f 100644 --- a/dlls/urlmon/binding.c +++ b/dlls/urlmon/binding.c @@ -929,7 +929,6 @@ static HRESULT get_callback(IBindCtx *pbc, IBindStatusCallback **callback) static HRESULT get_protocol(Binding *This, LPCWSTR url) { - IUnknown *unk = NULL; IClassFactory *cf = NULL; HRESULT hres; @@ -945,12 +944,7 @@ static HRESULT get_protocol(Binding *This, LPCWSTR url) return S_OK; } - hres = get_protocol_handler(url, &unk); - if(FAILED(hres)) - return hres; - - hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&cf); - IUnknown_Release(unk); + hres = get_protocol_handler(url, &cf); if(FAILED(hres)) return hres; diff --git a/dlls/urlmon/session.c b/dlls/urlmon/session.c index deb71465bfc..af07afcedb2 100644 --- a/dlls/urlmon/session.c +++ b/dlls/urlmon/session.c @@ -130,9 +130,10 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR url) return ret; } -HRESULT get_protocol_handler(LPCWSTR url, IUnknown **ret) +HRESULT get_protocol_handler(LPCWSTR url, IClassFactory **ret) { IClassFactory *cf; + IUnknown *unk; WCHAR schema[64]; DWORD schema_len; HRESULT hres; @@ -144,12 +145,17 @@ HRESULT get_protocol_handler(LPCWSTR url, IUnknown **ret) cf = find_name_space(schema); if(cf) { - hres = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (void**)ret); - if(SUCCEEDED(hres)) - return hres; + *ret = cf; + return S_OK; } - return get_protocol_iface(schema, schema_len, ret); + hres = get_protocol_iface(schema, schema_len, &unk); + if(FAILED(hres)) + return hres; + + hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)ret); + IUnknown_Release(unk); + return hres; } static HRESULT WINAPI InternetSession_QueryInterface(IInternetSession *iface, diff --git a/dlls/urlmon/urlmon_main.h b/dlls/urlmon/urlmon_main.h index 9b9f149304c..240fdfe544b 100644 --- a/dlls/urlmon/urlmon_main.h +++ b/dlls/urlmon/urlmon_main.h @@ -55,7 +55,7 @@ HRESULT UMCreateStreamOnCacheFile(LPCWSTR pszURL, DWORD dwSize, LPWSTR pszFileNa void UMCloseCacheFileStream(IUMCacheStream *pstr); IInternetProtocolInfo *get_protocol_info(LPCWSTR url); -HRESULT get_protocol_handler(LPCWSTR url, IUnknown **ret); +HRESULT get_protocol_handler(LPCWSTR url, IClassFactory **ret); HRESULT start_binding(LPCWSTR url, IBindCtx *pbc, REFIID riid, void **ppv);