Commit a23a3607 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Optimize get_protocol_info for urlmon protocols.

parent 2b90a7d6
...@@ -27,6 +27,7 @@ typedef struct name_space { ...@@ -27,6 +27,7 @@ typedef struct name_space {
LPWSTR protocol; LPWSTR protocol;
IClassFactory *cf; IClassFactory *cf;
CLSID clsid; CLSID clsid;
BOOL urlmon;
struct name_space *next; struct name_space *next;
} name_space; } name_space;
...@@ -111,6 +112,7 @@ static HRESULT register_namespace(IClassFactory *cf, REFIID clsid, LPCWSTR proto ...@@ -111,6 +112,7 @@ static HRESULT register_namespace(IClassFactory *cf, REFIID clsid, LPCWSTR proto
IClassFactory_AddRef(cf); IClassFactory_AddRef(cf);
new_name_space->cf = cf; new_name_space->cf = cf;
new_name_space->clsid = *clsid; new_name_space->clsid = *clsid;
new_name_space->urlmon = urlmon_protocol;
new_name_space->protocol = heap_strdupW(protocol); new_name_space->protocol = heap_strdupW(protocol);
new_name_space->next = name_space_list; new_name_space->next = name_space_list;
...@@ -119,7 +121,7 @@ static HRESULT register_namespace(IClassFactory *cf, REFIID clsid, LPCWSTR proto ...@@ -119,7 +121,7 @@ static HRESULT register_namespace(IClassFactory *cf, REFIID clsid, LPCWSTR proto
return S_OK; return S_OK;
} }
static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol, BOOL urlmon_protocol) static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol)
{ {
name_space *iter, *last = NULL; name_space *iter, *last = NULL;
...@@ -135,7 +137,7 @@ static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol, BOOL ur ...@@ -135,7 +137,7 @@ static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol, BOOL ur
else else
name_space_list = iter->next; name_space_list = iter->next;
if(!urlmon_protocol) if(!iter->urlmon)
IClassFactory_Release(iter->cf); IClassFactory_Release(iter->cf);
heap_free(iter->protocol); heap_free(iter->protocol);
heap_free(iter); heap_free(iter);
...@@ -150,7 +152,7 @@ void register_urlmon_namespace(IClassFactory *cf, REFIID clsid, LPCWSTR protocol ...@@ -150,7 +152,7 @@ void register_urlmon_namespace(IClassFactory *cf, REFIID clsid, LPCWSTR protocol
if(do_register) if(do_register)
register_namespace(cf, clsid, protocol, TRUE); register_namespace(cf, clsid, protocol, TRUE);
else else
unregister_namespace(cf, protocol, TRUE); unregister_namespace(cf, protocol);
} }
BOOL is_registered_protocol(LPCWSTR url) BOOL is_registered_protocol(LPCWSTR url)
...@@ -183,6 +185,9 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR url) ...@@ -183,6 +185,9 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR url)
ns = find_name_space(schema); ns = find_name_space(schema);
if(ns) { if(ns) {
if(ns->urlmon)
return NULL;
hres = IClassFactory_QueryInterface(ns->cf, &IID_IInternetProtocolInfo, (void**)&ret); hres = IClassFactory_QueryInterface(ns->cf, &IID_IInternetProtocolInfo, (void**)&ret);
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
return ret; return ret;
...@@ -283,7 +288,7 @@ static HRESULT WINAPI InternetSession_UnregisterNameSpace(IInternetSession *ifac ...@@ -283,7 +288,7 @@ static HRESULT WINAPI InternetSession_UnregisterNameSpace(IInternetSession *ifac
if(!pCF || !pszProtocol) if(!pCF || !pszProtocol)
return E_INVALIDARG; return E_INVALIDARG;
return unregister_namespace(pCF, pszProtocol, FALSE); return unregister_namespace(pCF, pszProtocol);
} }
static HRESULT WINAPI InternetSession_RegisterMimeFilter(IInternetSession *iface, static HRESULT WINAPI InternetSession_RegisterMimeFilter(IInternetSession *iface,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment