urlmon: Make get_protocol_handler IUri-based.
This commit is contained in:
parent
b54ac3c628
commit
fcc1dd01f7
|
@ -541,15 +541,8 @@ static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
|
|||
if(!protocol) {
|
||||
IClassFactory *cf;
|
||||
IUnknown *unk;
|
||||
BSTR raw_uri;
|
||||
|
||||
/* FIXME: Avoid GetRawUri here */
|
||||
hres = IUri_GetRawUri(pUri, &raw_uri);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = get_protocol_handler(raw_uri, &clsid, &urlmon_protocol, &cf);
|
||||
SysFreeString(raw_uri);
|
||||
hres = get_protocol_handler(pUri, &clsid, &urlmon_protocol, &cf);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
|
|
|
@ -236,23 +236,22 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR url)
|
|||
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;
|
||||
WCHAR schema[64];
|
||||
DWORD schema_len;
|
||||
BSTR scheme;
|
||||
HRESULT hres;
|
||||
|
||||
*ret = NULL;
|
||||
|
||||
hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, sizeof(schema)/sizeof(schema[0]),
|
||||
&schema_len, 0);
|
||||
if(FAILED(hres) || !schema_len)
|
||||
return schema_len ? hres : MK_E_SYNTAX;
|
||||
/* FIXME: Avoid GetSchemeName call for known schemes */
|
||||
hres = IUri_GetSchemeName(uri, &scheme);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
EnterCriticalSection(&session_cs);
|
||||
|
||||
ns = find_name_space(schema);
|
||||
ns = find_name_space(scheme);
|
||||
if(ns) {
|
||||
*ret = ns->cf;
|
||||
IClassFactory_AddRef(*ret);
|
||||
|
@ -264,12 +263,16 @@ HRESULT get_protocol_handler(LPCWSTR url, CLSID *clsid, BOOL *urlmon_protocol, I
|
|||
|
||||
LeaveCriticalSection(&session_cs);
|
||||
|
||||
if(*ret)
|
||||
return S_OK;
|
||||
if(*ret) {
|
||||
hres = S_OK;
|
||||
}else {
|
||||
if(urlmon_protocol)
|
||||
*urlmon_protocol = FALSE;
|
||||
hres = get_protocol_cf(scheme, SysStringLen(scheme), clsid, ret);
|
||||
}
|
||||
|
||||
if(urlmon_protocol)
|
||||
*urlmon_protocol = FALSE;
|
||||
return get_protocol_cf(schema, schema_len, clsid, ret);
|
||||
SysFreeString(scheme);
|
||||
return hres;
|
||||
}
|
||||
|
||||
IInternetProtocol *get_mime_filter(LPCWSTR mime)
|
||||
|
|
|
@ -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)
|
||||
|
||||
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);
|
||||
BOOL is_registered_protocol(LPCWSTR);
|
||||
void register_urlmon_namespace(IClassFactory*,REFIID,LPCWSTR,BOOL);
|
||||
|
|
Loading…
Reference in New Issue