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

urlmon: Don't store IWinInetInfo reference in BindProtocol.

parent 73fd4b09
......@@ -792,13 +792,23 @@ static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void
TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
*ppv = &This->IServiceProvider_iface;
}else if(IsEqualGUID(&IID_IWinInetInfo, riid)) {
IWinInetInfo *wininet_info;
HRESULT hres;
TRACE("(%p)->(IID_IWinInetInfo %p)\n", This, ppv);
/* NOTE: This violidates COM rules, but tests prove that we should do it */
if(!This->protocol->wininet_info)
if(!This->protocol->protocol_unk)
return E_NOINTERFACE;
*ppv = &This->IWinInetHttpInfo_iface;
if(This->protocol->protocol_unk) {
hres = IUnknown_QueryInterface(This->protocol->protocol_unk, &IID_IWinInetInfo,
(void**)&wininet_info);
if(SUCCEEDED(hres)) {
IWinInetInfo_Release(wininet_info);
*ppv = &This->IWinInetHttpInfo_iface;
}
}
}else if(IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
IWinInetHttpInfo *http_info;
HRESULT hres;
......@@ -1313,13 +1323,22 @@ static HRESULT WINAPI WinInetHttpInfo_QueryOption(IWinInetHttpInfo *iface, DWORD
void *pBuffer, DWORD *pcbBuffer)
{
Binding *This = impl_from_IWinInetHttpInfo(iface);
IWinInetInfo *wininet_info;
HRESULT hres;
TRACE("(%p)->(%x %p %p)\n", This, dwOption, pBuffer, pcbBuffer);
if(!This->protocol->wininet_info)
if(!This->protocol->protocol_unk)
return E_FAIL;
return IWinInetInfo_QueryOption(This->protocol->wininet_info,
dwOption, pBuffer, pcbBuffer);
hres = IUnknown_QueryInterface(This->protocol->protocol_unk, &IID_IWinInetHttpInfo,
(void**)&wininet_info);
if(FAILED(hres))
return E_FAIL;
hres = IWinInetInfo_QueryOption(wininet_info, dwOption, pBuffer, pcbBuffer);
IWinInetInfo_Release(wininet_info);
return hres;
}
static HRESULT WINAPI WinInetHttpInfo_QueryInfo(IWinInetHttpInfo *iface, DWORD dwOption,
......
......@@ -330,10 +330,6 @@ static ULONG WINAPI BindProtocol_AddRef(IInternetProtocolEx *iface)
static void release_protocol_handler(BindProtocol *This)
{
if(This->wininet_info) {
IWinInetInfo_Release(This->wininet_info);
This->wininet_info = NULL;
}
if(This->protocol_unk) {
IUnknown_Release(This->protocol_unk);
This->protocol_unk = NULL;
......@@ -497,7 +493,6 @@ static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
IInternetProtocolEx *protocolex;
IInternetPriority *priority;
IServiceProvider *service_provider;
BOOL urlmon_protocol = FALSE;
CLSID clsid = IID_NULL;
IUnknown *protocol_unk = NULL;
LPOLESTR clsid_str;
......@@ -529,7 +524,7 @@ static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
if(!protocol) {
IClassFactory *cf;
hres = get_protocol_handler(pUri, &clsid, &urlmon_protocol, &cf);
hres = get_protocol_handler(pUri, &clsid, &cf);
if(FAILED(hres))
return hres;
......@@ -562,10 +557,6 @@ static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
This->protocol_unk = protocol_unk;
This->protocol = protocol;
if(urlmon_protocol) {
IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&This->wininet_info);
}
set_binding_sink(This, pOIProtSink, pOIBindInfo);
hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority, (void**)&priority);
......
......@@ -219,7 +219,7 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR url)
return ret;
}
HRESULT get_protocol_handler(IUri *uri, CLSID *clsid, BOOL *urlmon_protocol, IClassFactory **ret)
HRESULT get_protocol_handler(IUri *uri, CLSID *clsid, IClassFactory **ret)
{
name_space *ns;
BSTR scheme;
......@@ -240,20 +240,11 @@ HRESULT get_protocol_handler(IUri *uri, CLSID *clsid, BOOL *urlmon_protocol, ICl
IClassFactory_AddRef(*ret);
if(clsid)
*clsid = ns->clsid;
if(urlmon_protocol)
*urlmon_protocol = ns->urlmon;
}
LeaveCriticalSection(&session_cs);
if(*ret) {
hres = S_OK;
}else {
if(urlmon_protocol)
*urlmon_protocol = FALSE;
hres = get_protocol_cf(scheme, SysStringLen(scheme), clsid, ret);
}
hres = *ret ? S_OK : get_protocol_cf(scheme, SysStringLen(scheme), clsid, ret);
SysFreeString(scheme);
return hres;
}
......
......@@ -66,7 +66,7 @@ static inline void URLMON_UnlockModule(void) { InterlockedDecrement( &URLMON_ref
extern HINSTANCE urlmon_instance;
IInternetProtocolInfo *get_protocol_info(LPCWSTR) DECLSPEC_HIDDEN;
HRESULT get_protocol_handler(IUri*,CLSID*,BOOL*,IClassFactory**) DECLSPEC_HIDDEN;
HRESULT get_protocol_handler(IUri*,CLSID*,IClassFactory**) DECLSPEC_HIDDEN;
IInternetProtocol *get_mime_filter(LPCWSTR) DECLSPEC_HIDDEN;
BOOL is_registered_protocol(LPCWSTR) DECLSPEC_HIDDEN;
HRESULT register_namespace(IClassFactory*,REFIID,LPCWSTR,BOOL) DECLSPEC_HIDDEN;
......@@ -178,7 +178,6 @@ typedef struct {
IUnknown *protocol_unk;
IInternetProtocol *protocol;
IWinInetInfo *wininet_info;
IInternetBindInfo *bind_info;
IInternetProtocolSink *protocol_sink;
......
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