Module: wine Branch: master Commit: 168e915c918a38f29c4323fb24e84de56c81d5b7 URL: http://source.winehq.org/git/wine.git/?a=commit;h=168e915c918a38f29c4323fb24...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Feb 26 11:00:27 2015 +0100
urlmon: Added IInternetBindInfo implementation to BindStatusCallback object.
---
dlls/urlmon/bindctx.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ dlls/urlmon/tests/url.c | 11 +++++++++ 2 files changed, 73 insertions(+)
diff --git a/dlls/urlmon/bindctx.c b/dlls/urlmon/bindctx.c index b2d2776..d8bba1b 100644 --- a/dlls/urlmon/bindctx.c +++ b/dlls/urlmon/bindctx.c @@ -29,6 +29,7 @@ extern IID IID_IBindStatusCallbackHolder;
typedef struct { IBindStatusCallbackEx IBindStatusCallbackEx_iface; + IInternetBindInfo IInternetBindInfo_iface; IServiceProvider IServiceProvider_iface; IHttpNegotiate2 IHttpNegotiate2_iface; IAuthenticate IAuthenticate_iface; @@ -126,6 +127,9 @@ static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallbackEx *i }else if(IsEqualGUID(&IID_IAuthenticate, riid)) { TRACE("(%p)->(IID_IAuthenticate, %p)\n", This, ppv); *ppv = &This->IAuthenticate_iface; + }else if(IsEqualGUID(&IID_IInternetBindInfo, riid)) { + TRACE("(%p)->(IID_IInternetBindInfo, %p)\n", This, ppv); + *ppv = &This->IInternetBindInfo_iface; }
if(*ppv) { @@ -497,6 +501,63 @@ static const IAuthenticateVtbl BSCAuthenticateVtbl = { BSCAuthenticate_Authenticate };
+static inline BindStatusCallback *impl_from_IInternetBindInfo(IInternetBindInfo *iface) +{ + return CONTAINING_RECORD(iface, BindStatusCallback, IInternetBindInfo_iface); +} + +static HRESULT WINAPI BSCInternetBindInfo_QueryInterface(IInternetBindInfo *iface, REFIID riid, void **ppv) +{ + BindStatusCallback *This = impl_from_IInternetBindInfo(iface); + return IBindStatusCallbackEx_QueryInterface(&This->IBindStatusCallbackEx_iface, riid, ppv); +} + +static ULONG WINAPI BSCInternetBindInfo_AddRef(IInternetBindInfo *iface) +{ + BindStatusCallback *This = impl_from_IInternetBindInfo(iface); + return IBindStatusCallbackEx_AddRef(&This->IBindStatusCallbackEx_iface); +} + +static ULONG WINAPI BSCInternetBindInfo_Release(IInternetBindInfo *iface) +{ + BindStatusCallback *This = impl_from_IInternetBindInfo(iface); + return IBindStatusCallbackEx_Release(&This->IBindStatusCallbackEx_iface); +} + +static HRESULT WINAPI BSCInternetBindInfo_GetBindInfo(IInternetBindInfo *iface, DWORD *bindf, BINDINFO *bindinfo) +{ + BindStatusCallback *This = impl_from_IInternetBindInfo(iface); + FIXME("(%p)->(%p %p)\n", This, bindf, bindinfo); + return E_NOTIMPL; +} + +static HRESULT WINAPI BSCInternetBindInfo_GetBindString(IInternetBindInfo *iface, ULONG string_type, + WCHAR **strs, ULONG cnt, ULONG *fetched) +{ + BindStatusCallback *This = impl_from_IInternetBindInfo(iface); + IInternetBindInfo *bind_info; + HRESULT hres; + + TRACE("(%p)->(%d %p %d %p)\n", This, string_type, strs, cnt, fetched); + + hres = IBindStatusCallback_QueryInterface(This->callback, &IID_IInternetBindInfo, (void**)&bind_info); + if(FAILED(hres)) + return hres; + + hres = IInternetBindInfo_GetBindString(bind_info, string_type, strs, cnt, fetched); + + IInternetBindInfo_Release(bind_info); + return hres; +} + +static IInternetBindInfoVtbl BSCInternetBindInfoVtbl = { + BSCInternetBindInfo_QueryInterface, + BSCInternetBindInfo_AddRef, + BSCInternetBindInfo_Release, + BSCInternetBindInfo_GetBindInfo, + BSCInternetBindInfo_GetBindString +}; + static void set_callback(BindStatusCallback *This, IBindStatusCallback *bsc) { IServiceProvider *serv_prov; @@ -523,6 +584,7 @@ HRESULT wrap_callback(IBindStatusCallback *bsc, IBindStatusCallback **ret_iface) return E_OUTOFMEMORY;
ret->IBindStatusCallbackEx_iface.lpVtbl = &BindStatusCallbackExVtbl; + ret->IInternetBindInfo_iface.lpVtbl = &BSCInternetBindInfoVtbl; ret->IServiceProvider_iface.lpVtbl = &BSCServiceProviderVtbl; ret->IHttpNegotiate2_iface.lpVtbl = &BSCHttpNegotiateVtbl; ret->IAuthenticate_iface.lpVtbl = &BSCAuthenticateVtbl; diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c index ab564f7..dd3a52d 100644 --- a/dlls/urlmon/tests/url.c +++ b/dlls/urlmon/tests/url.c @@ -2564,6 +2564,7 @@ static BOOL test_bscholder(IBindStatusCallback *holder) IHttpNegotiate *http_negotiate, *http_negotiate_serv; IHttpNegotiate2 *http_negotiate2, *http_negotiate2_serv; IAuthenticate *authenticate, *authenticate_serv; + IInternetBindInfo *bind_info; IInternetProtocol *protocol; BINDINFO bindinfo = {sizeof(bindinfo)}; BOOL ret = TRUE; @@ -2678,6 +2679,16 @@ static BOOL test_bscholder(IBindStatusCallback *holder) IAuthenticate_Release(authenticate); IAuthenticate_Release(authenticate_serv);
+ hres = IBindStatusCallback_QueryInterface(holder, &IID_IInternetBindInfo, (void**)&bind_info); + ok(hres == S_OK || broken(hres == E_NOINTERFACE /* win2k */), "Could not get IInternetBindInfo interface: %08x\n", hres); + + if(SUCCEEDED(hres)) { + hres = IInternetBindInfo_GetBindString(bind_info, BINDSTRING_USER_AGENT, &wstr, 1, &dw); + ok(hres == E_NOINTERFACE, "GetBindString(BINDSTRING_USER_AGENT) failed: %08x\n", hres); + + IInternetBindInfo_Release(bind_info); + } + SET_EXPECT(OnStopBinding); hres = IBindStatusCallback_OnStopBinding(holder, S_OK, NULL); ok(hres == S_OK, "OnStopBinding failed: %08x\n", hres);