forked from Mirrors/wine-wine
urlmon: Added IWinInetHttpInfo support to Binding object.
parent
c31e6537fb
commit
67d2fdc34a
|
@ -80,6 +80,7 @@ struct Binding {
|
||||||
const IBindingVtbl *lpBindingVtbl;
|
const IBindingVtbl *lpBindingVtbl;
|
||||||
const IInternetProtocolSinkVtbl *lpInternetProtocolSinkVtbl;
|
const IInternetProtocolSinkVtbl *lpInternetProtocolSinkVtbl;
|
||||||
const IInternetBindInfoVtbl *lpInternetBindInfoVtbl;
|
const IInternetBindInfoVtbl *lpInternetBindInfoVtbl;
|
||||||
|
const IWinInetHttpInfoVtbl *lpWinInetHttpInfoVtbl;
|
||||||
const IServiceProviderVtbl *lpServiceProviderVtbl;
|
const IServiceProviderVtbl *lpServiceProviderVtbl;
|
||||||
|
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
@ -117,6 +118,7 @@ struct Binding {
|
||||||
#define BINDING(x) ((IBinding*) &(x)->lpBindingVtbl)
|
#define BINDING(x) ((IBinding*) &(x)->lpBindingVtbl)
|
||||||
#define PROTSINK(x) ((IInternetProtocolSink*) &(x)->lpInternetProtocolSinkVtbl)
|
#define PROTSINK(x) ((IInternetProtocolSink*) &(x)->lpInternetProtocolSinkVtbl)
|
||||||
#define BINDINF(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl)
|
#define BINDINF(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl)
|
||||||
|
#define INETINFO(x) ((IWinInetHttpInfo*) &(x)->lpWinInetHttpInfoVtbl)
|
||||||
#define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
|
#define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
|
||||||
|
|
||||||
#define STREAM(x) ((IStream*) &(x)->lpStreamVtbl)
|
#define STREAM(x) ((IStream*) &(x)->lpStreamVtbl)
|
||||||
|
@ -901,6 +903,31 @@ static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void
|
||||||
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
|
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
|
||||||
TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
|
TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
|
||||||
*ppv = SERVPROV(This);
|
*ppv = SERVPROV(This);
|
||||||
|
}else if(IsEqualGUID(&IID_IWinInetInfo, riid)) {
|
||||||
|
TRACE("(%p)->(IID_IWinInetInfo %p)\n", This, ppv);
|
||||||
|
|
||||||
|
/* NOTE: This violidates COM rules, but tests prove that we should do it */
|
||||||
|
if(!get_wininet_info(This->protocol))
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
|
||||||
|
*ppv = INETINFO(This);
|
||||||
|
}else if(IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
|
||||||
|
IWinInetHttpInfo *http_info;
|
||||||
|
IWinInetInfo *info;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
TRACE("(%p)->(IID_IWinInetHttpInfo %p)\n", This, ppv);
|
||||||
|
|
||||||
|
info = get_wininet_info(This->protocol);
|
||||||
|
if(!info)
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
|
||||||
|
hres = IWinInetInfo_QueryInterface(info, &IID_IWinInetHttpInfo, (void**)&http_info);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
|
||||||
|
IWinInetHttpInfo_Release(http_info);
|
||||||
|
*ppv = INETINFO(This);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(*ppv) {
|
if(*ppv) {
|
||||||
|
@ -1448,6 +1475,52 @@ static const IInternetBindInfoVtbl InternetBindInfoVtbl = {
|
||||||
InternetBindInfo_GetBindString
|
InternetBindInfo_GetBindString
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define INETINFO_THIS(iface) DEFINE_THIS(Binding, WinInetHttpInfo, iface)
|
||||||
|
|
||||||
|
static HRESULT WINAPI WinInetHttpInfo_QueryInterface(IWinInetHttpInfo *iface, REFIID riid, void **ppv)
|
||||||
|
{
|
||||||
|
Binding *This = INETINFO_THIS(iface);
|
||||||
|
return IBinding_QueryInterface(BINDING(This), riid, ppv);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI WinInetHttpInfo_AddRef(IWinInetHttpInfo *iface)
|
||||||
|
{
|
||||||
|
Binding *This = INETINFO_THIS(iface);
|
||||||
|
return IBinding_AddRef(BINDING(This));
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI WinInetHttpInfo_Release(IWinInetHttpInfo *iface)
|
||||||
|
{
|
||||||
|
Binding *This = INETINFO_THIS(iface);
|
||||||
|
return IBinding_Release(BINDING(This));
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI WinInetHttpInfo_QueryOption(IWinInetHttpInfo *iface, DWORD dwOption,
|
||||||
|
void *pBuffer, DWORD *pcbBuffer)
|
||||||
|
{
|
||||||
|
Binding *This = INETINFO_THIS(iface);
|
||||||
|
FIXME("(%p)->(%x %p %p)\n", This, dwOption, pBuffer, pcbBuffer);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI WinInetHttpInfo_QueryInfo(IWinInetHttpInfo *iface, DWORD dwOption,
|
||||||
|
void *pBuffer, DWORD *pcbBuffer, DWORD *pdwFlags, DWORD *pdwReserved)
|
||||||
|
{
|
||||||
|
Binding *This = INETINFO_THIS(iface);
|
||||||
|
FIXME("(%p)->(%x %p %p %p %p)\n", This, dwOption, pBuffer, pcbBuffer, pdwFlags, pdwReserved);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef INETINFO_THIS
|
||||||
|
|
||||||
|
static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = {
|
||||||
|
WinInetHttpInfo_QueryInterface,
|
||||||
|
WinInetHttpInfo_AddRef,
|
||||||
|
WinInetHttpInfo_Release,
|
||||||
|
WinInetHttpInfo_QueryOption,
|
||||||
|
WinInetHttpInfo_QueryInfo
|
||||||
|
};
|
||||||
|
|
||||||
#define SERVPROV_THIS(iface) DEFINE_THIS(Binding, ServiceProvider, iface)
|
#define SERVPROV_THIS(iface) DEFINE_THIS(Binding, ServiceProvider, iface)
|
||||||
|
|
||||||
static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface,
|
static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface,
|
||||||
|
@ -1559,6 +1632,7 @@ static HRESULT Binding_Create(IMoniker *mon, Binding *binding_ctx, LPCWSTR url,
|
||||||
ret->lpBindingVtbl = &BindingVtbl;
|
ret->lpBindingVtbl = &BindingVtbl;
|
||||||
ret->lpInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl;
|
ret->lpInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl;
|
||||||
ret->lpInternetBindInfoVtbl = &InternetBindInfoVtbl;
|
ret->lpInternetBindInfoVtbl = &InternetBindInfoVtbl;
|
||||||
|
ret->lpWinInetHttpInfoVtbl = &WinInetHttpInfoVtbl;
|
||||||
ret->lpServiceProviderVtbl = &ServiceProviderVtbl;
|
ret->lpServiceProviderVtbl = &ServiceProviderVtbl;
|
||||||
|
|
||||||
ret->ref = 1;
|
ret->ref = 1;
|
||||||
|
|
|
@ -34,6 +34,7 @@ typedef struct {
|
||||||
IInternetBindInfo *bind_info;
|
IInternetBindInfo *bind_info;
|
||||||
IInternetProtocolSink *protocol_sink;
|
IInternetProtocolSink *protocol_sink;
|
||||||
IServiceProvider *service_provider;
|
IServiceProvider *service_provider;
|
||||||
|
IWinInetInfo *wininet_info;
|
||||||
|
|
||||||
LONG priority;
|
LONG priority;
|
||||||
|
|
||||||
|
@ -104,6 +105,8 @@ static ULONG WINAPI BindProtocol_Release(IInternetProtocol *iface)
|
||||||
TRACE("(%p) ref=%d\n", This, ref);
|
TRACE("(%p) ref=%d\n", This, ref);
|
||||||
|
|
||||||
if(!ref) {
|
if(!ref) {
|
||||||
|
if(This->wininet_info)
|
||||||
|
IWinInetInfo_Release(This->wininet_info);
|
||||||
if(This->protocol)
|
if(This->protocol)
|
||||||
IInternetProtocol_Release(This->protocol);
|
IInternetProtocol_Release(This->protocol);
|
||||||
if(This->bind_info)
|
if(This->bind_info)
|
||||||
|
@ -126,6 +129,7 @@ static HRESULT WINAPI BindProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl
|
||||||
IInternetProtocol *protocol = NULL;
|
IInternetProtocol *protocol = NULL;
|
||||||
IInternetPriority *priority;
|
IInternetPriority *priority;
|
||||||
IServiceProvider *service_provider;
|
IServiceProvider *service_provider;
|
||||||
|
BOOL urlmon_protocol = FALSE;
|
||||||
CLSID clsid = IID_NULL;
|
CLSID clsid = IID_NULL;
|
||||||
LPOLESTR clsid_str;
|
LPOLESTR clsid_str;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
@ -149,7 +153,7 @@ static HRESULT WINAPI BindProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl
|
||||||
IClassFactory *cf;
|
IClassFactory *cf;
|
||||||
IUnknown *unk;
|
IUnknown *unk;
|
||||||
|
|
||||||
hres = get_protocol_handler(szUrl, &clsid, &cf);
|
hres = get_protocol_handler(szUrl, &clsid, &urlmon_protocol, &cf);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
|
@ -178,6 +182,9 @@ static HRESULT WINAPI BindProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl
|
||||||
|
|
||||||
This->protocol = protocol;
|
This->protocol = protocol;
|
||||||
|
|
||||||
|
if(urlmon_protocol)
|
||||||
|
IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&This->wininet_info);
|
||||||
|
|
||||||
IInternetBindInfo_AddRef(pOIBindInfo);
|
IInternetBindInfo_AddRef(pOIBindInfo);
|
||||||
This->bind_info = pOIBindInfo;
|
This->bind_info = pOIBindInfo;
|
||||||
|
|
||||||
|
@ -304,6 +311,13 @@ void set_binding_sink(IInternetProtocol *bind_protocol, IInternetProtocolSink *s
|
||||||
IServiceProvider_Release(service_provider);
|
IServiceProvider_Release(service_provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IWinInetInfo *get_wininet_info(IInternetProtocol *bind_protocol)
|
||||||
|
{
|
||||||
|
BindProtocol *This = PROTOCOL_THIS(bind_protocol);
|
||||||
|
|
||||||
|
return This->wininet_info;
|
||||||
|
}
|
||||||
|
|
||||||
#undef PROTOCOL_THIS
|
#undef PROTOCOL_THIS
|
||||||
|
|
||||||
static const IInternetProtocolVtbl BindProtocolVtbl = {
|
static const IInternetProtocolVtbl BindProtocolVtbl = {
|
||||||
|
|
|
@ -228,7 +228,7 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR url)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT get_protocol_handler(LPCWSTR url, CLSID *clsid, IClassFactory **ret)
|
HRESULT get_protocol_handler(LPCWSTR url, CLSID *clsid, BOOL *urlmon_protocol, IClassFactory **ret)
|
||||||
{
|
{
|
||||||
name_space *ns;
|
name_space *ns;
|
||||||
WCHAR schema[64];
|
WCHAR schema[64];
|
||||||
|
@ -250,6 +250,8 @@ HRESULT get_protocol_handler(LPCWSTR url, CLSID *clsid, IClassFactory **ret)
|
||||||
IClassFactory_AddRef(*ret);
|
IClassFactory_AddRef(*ret);
|
||||||
if(clsid)
|
if(clsid)
|
||||||
*clsid = ns->clsid;
|
*clsid = ns->clsid;
|
||||||
|
if(urlmon_protocol)
|
||||||
|
*urlmon_protocol = ns->urlmon;
|
||||||
}
|
}
|
||||||
|
|
||||||
LeaveCriticalSection(&session_cs);
|
LeaveCriticalSection(&session_cs);
|
||||||
|
@ -257,6 +259,8 @@ HRESULT get_protocol_handler(LPCWSTR url, CLSID *clsid, IClassFactory **ret)
|
||||||
if(*ret)
|
if(*ret)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
|
if(urlmon_protocol)
|
||||||
|
*urlmon_protocol = FALSE;
|
||||||
return get_protocol_cf(schema, schema_len, clsid, ret);
|
return get_protocol_cf(schema, schema_len, clsid, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,7 @@ static BOOL stopped_binding = FALSE, stopped_obj_binding = FALSE, emulate_protoc
|
||||||
static DWORD read = 0, bindf = 0, prot_state = 0, thread_id, tymed;
|
static DWORD read = 0, bindf = 0, prot_state = 0, thread_id, tymed;
|
||||||
static CHAR mime_type[512];
|
static CHAR mime_type[512];
|
||||||
static IInternetProtocolSink *protocol_sink = NULL;
|
static IInternetProtocolSink *protocol_sink = NULL;
|
||||||
|
static IBinding *current_binding;
|
||||||
static HANDLE complete_event, complete_event2;
|
static HANDLE complete_event, complete_event2;
|
||||||
static HRESULT binding_hres;
|
static HRESULT binding_hres;
|
||||||
static BOOL have_IHttpNegotiate2;
|
static BOOL have_IHttpNegotiate2;
|
||||||
|
@ -1179,6 +1180,8 @@ static HRESULT WINAPI statusclb_OnStartBinding(IBindStatusCallback *iface, DWORD
|
||||||
if(pib == (void*)0xdeadbeef)
|
if(pib == (void*)0xdeadbeef)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
|
current_binding = pib;
|
||||||
|
|
||||||
hres = IBinding_QueryInterface(pib, &IID_IMoniker, (void**)&mon);
|
hres = IBinding_QueryInterface(pib, &IID_IMoniker, (void**)&mon);
|
||||||
ok(hres == E_NOINTERFACE, "IBinding should not have IMoniker interface\n");
|
ok(hres == E_NOINTERFACE, "IBinding should not have IMoniker interface\n");
|
||||||
if(SUCCEEDED(hres))
|
if(SUCCEEDED(hres))
|
||||||
|
@ -1338,6 +1341,21 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallback *iface, ULONG ulP
|
||||||
default:
|
default:
|
||||||
ok(0, "unexpected code %d\n", ulStatusCode);
|
ok(0, "unexpected code %d\n", ulStatusCode);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(current_binding) {
|
||||||
|
IWinInetHttpInfo *http_info;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = IBinding_QueryInterface(current_binding, &IID_IWinInetHttpInfo, (void**)&http_info);
|
||||||
|
if(!emulate_protocol && test_protocol != FILE_TEST && is_urlmon_protocol(test_protocol))
|
||||||
|
ok(hres == S_OK, "Could not get IWinInetHttpInfo iface: %08x\n", hres);
|
||||||
|
else
|
||||||
|
ok(hres == E_NOINTERFACE,
|
||||||
|
"QueryInterface(IID_IWinInetHttpInfo) returned: %08x, expected E_NOINTERFACE\n", hres);
|
||||||
|
if(SUCCEEDED(hres))
|
||||||
|
IWinInetHttpInfo_Release(http_info);
|
||||||
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,8 @@ static inline void URLMON_UnlockModule(void) { InterlockedDecrement( &URLMON_ref
|
||||||
#define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
|
#define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
|
||||||
#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 url);
|
IInternetProtocolInfo *get_protocol_info(LPCWSTR);
|
||||||
HRESULT get_protocol_handler(LPCWSTR url, CLSID *clsid, IClassFactory **ret);
|
HRESULT get_protocol_handler(LPCWSTR,CLSID*,BOOL*,IClassFactory**);
|
||||||
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);
|
||||||
|
|
||||||
|
@ -67,6 +67,7 @@ HRESULT bind_to_object(IMoniker *mon, LPCWSTR url, IBindCtx *pbc, REFIID riid, v
|
||||||
|
|
||||||
HRESULT create_binding_protocol(LPCWSTR url, BOOL from_urlmon, IInternetProtocol **protocol);
|
HRESULT create_binding_protocol(LPCWSTR url, BOOL from_urlmon, IInternetProtocol **protocol);
|
||||||
void set_binding_sink(IInternetProtocol *bind_protocol, IInternetProtocolSink *sink);
|
void set_binding_sink(IInternetProtocol *bind_protocol, IInternetProtocolSink *sink);
|
||||||
|
IWinInetInfo *get_wininet_info(IInternetProtocol*);
|
||||||
|
|
||||||
typedef struct ProtocolVtbl ProtocolVtbl;
|
typedef struct ProtocolVtbl ProtocolVtbl;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue