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

urlmon: Make get_protocol_handler IUri-based.

parent b54ac3c6
...@@ -541,15 +541,8 @@ static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr ...@@ -541,15 +541,8 @@ static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
if(!protocol) { if(!protocol) {
IClassFactory *cf; IClassFactory *cf;
IUnknown *unk; IUnknown *unk;
BSTR raw_uri;
/* FIXME: Avoid GetRawUri here */ hres = get_protocol_handler(pUri, &clsid, &urlmon_protocol, &cf);
hres = IUri_GetRawUri(pUri, &raw_uri);
if(FAILED(hres))
return hres;
hres = get_protocol_handler(raw_uri, &clsid, &urlmon_protocol, &cf);
SysFreeString(raw_uri);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
......
...@@ -236,23 +236,22 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR url) ...@@ -236,23 +236,22 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR url)
return ret; return ret;
} }
HRESULT get_protocol_handler(LPCWSTR url, CLSID *clsid, BOOL *urlmon_protocol, IClassFactory **ret) HRESULT get_protocol_handler(IUri *uri, CLSID *clsid, BOOL *urlmon_protocol, IClassFactory **ret)
{ {
name_space *ns; name_space *ns;
WCHAR schema[64]; BSTR scheme;
DWORD schema_len;
HRESULT hres; HRESULT hres;
*ret = NULL; *ret = NULL;
hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, sizeof(schema)/sizeof(schema[0]), /* FIXME: Avoid GetSchemeName call for known schemes */
&schema_len, 0); hres = IUri_GetSchemeName(uri, &scheme);
if(FAILED(hres) || !schema_len) if(FAILED(hres))
return schema_len ? hres : MK_E_SYNTAX; return hres;
EnterCriticalSection(&session_cs); EnterCriticalSection(&session_cs);
ns = find_name_space(schema); ns = find_name_space(scheme);
if(ns) { if(ns) {
*ret = ns->cf; *ret = ns->cf;
IClassFactory_AddRef(*ret); IClassFactory_AddRef(*ret);
...@@ -264,12 +263,16 @@ HRESULT get_protocol_handler(LPCWSTR url, CLSID *clsid, BOOL *urlmon_protocol, I ...@@ -264,12 +263,16 @@ HRESULT get_protocol_handler(LPCWSTR url, CLSID *clsid, BOOL *urlmon_protocol, I
LeaveCriticalSection(&session_cs); LeaveCriticalSection(&session_cs);
if(*ret) if(*ret) {
return S_OK; hres = S_OK;
}else {
if(urlmon_protocol)
*urlmon_protocol = FALSE;
hres = get_protocol_cf(scheme, SysStringLen(scheme), clsid, ret);
}
if(urlmon_protocol) SysFreeString(scheme);
*urlmon_protocol = FALSE; return hres;
return get_protocol_cf(schema, schema_len, clsid, ret);
} }
IInternetProtocol *get_mime_filter(LPCWSTR mime) IInternetProtocol *get_mime_filter(LPCWSTR mime)
......
...@@ -66,7 +66,7 @@ static inline void URLMON_UnlockModule(void) { InterlockedDecrement( &URLMON_ref ...@@ -66,7 +66,7 @@ static inline void URLMON_UnlockModule(void) { InterlockedDecrement( &URLMON_ref
#define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface) #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
IInternetProtocolInfo *get_protocol_info(LPCWSTR); IInternetProtocolInfo *get_protocol_info(LPCWSTR);
HRESULT get_protocol_handler(LPCWSTR,CLSID*,BOOL*,IClassFactory**); HRESULT get_protocol_handler(IUri*,CLSID*,BOOL*,IClassFactory**);
IInternetProtocol *get_mime_filter(LPCWSTR); IInternetProtocol *get_mime_filter(LPCWSTR);
BOOL is_registered_protocol(LPCWSTR); BOOL is_registered_protocol(LPCWSTR);
void register_urlmon_namespace(IClassFactory*,REFIID,LPCWSTR,BOOL); void register_urlmon_namespace(IClassFactory*,REFIID,LPCWSTR,BOOL);
......
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