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

urlmon: Check if protocol object implements IInternetProtocolInfo interface.

parent 46132ee2
...@@ -55,7 +55,7 @@ static name_space *find_name_space(LPCWSTR protocol) ...@@ -55,7 +55,7 @@ static name_space *find_name_space(LPCWSTR protocol)
return NULL; return NULL;
} }
static HRESULT get_protocol_iface(LPCWSTR schema, DWORD schema_len, CLSID *pclsid, IUnknown **ret) static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid, IClassFactory **ret)
{ {
WCHAR str_clsid[64]; WCHAR str_clsid[64];
HKEY hkey = NULL; HKEY hkey = NULL;
...@@ -96,14 +96,14 @@ static HRESULT get_protocol_iface(LPCWSTR schema, DWORD schema_len, CLSID *pclsi ...@@ -96,14 +96,14 @@ static HRESULT get_protocol_iface(LPCWSTR schema, DWORD schema_len, CLSID *pclsi
if(pclsid) if(pclsid)
*pclsid = clsid; *pclsid = clsid;
return CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)ret); return CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)ret);
} }
IInternetProtocolInfo *get_protocol_info(LPCWSTR url) IInternetProtocolInfo *get_protocol_info(LPCWSTR url)
{ {
IInternetProtocolInfo *ret = NULL; IInternetProtocolInfo *ret = NULL;
IClassFactory *cf;
name_space *ns; name_space *ns;
IUnknown *unk;
WCHAR schema[64]; WCHAR schema[64];
DWORD schema_len; DWORD schema_len;
HRESULT hres; HRESULT hres;
...@@ -124,19 +124,20 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR url) ...@@ -124,19 +124,20 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR url)
return ret; return ret;
} }
hres = get_protocol_iface(schema, schema_len, NULL, &unk); hres = get_protocol_cf(schema, schema_len, NULL, &cf);
if(FAILED(hres)) if(FAILED(hres))
return NULL; return NULL;
hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&ret); hres = IClassFactory_QueryInterface(cf, &IID_IInternetProtocolInfo, (void**)&ret);
IUnknown_Release(unk); if(FAILED(hres))
IClassFactory_CreateInstance(cf, NULL, &IID_IInternetProtocolInfo, (void**)&ret);
IClassFactory_Release(cf);
return ret; return ret;
} }
HRESULT get_protocol_handler(LPCWSTR url, CLSID *clsid, IClassFactory **ret) HRESULT get_protocol_handler(LPCWSTR url, CLSID *clsid, IClassFactory **ret)
{ {
IUnknown *unk;
name_space *ns; name_space *ns;
WCHAR schema[64]; WCHAR schema[64];
DWORD schema_len; DWORD schema_len;
...@@ -155,13 +156,7 @@ HRESULT get_protocol_handler(LPCWSTR url, CLSID *clsid, IClassFactory **ret) ...@@ -155,13 +156,7 @@ HRESULT get_protocol_handler(LPCWSTR url, CLSID *clsid, IClassFactory **ret)
return S_OK; return S_OK;
} }
hres = get_protocol_iface(schema, schema_len, clsid, &unk); return get_protocol_cf(schema, schema_len, clsid, ret);
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, static HRESULT WINAPI InternetSession_QueryInterface(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