urlmon: Query for IHtmlNegotiate[2] interfaces when needed.
This commit is contained in:
parent
c32925aecd
commit
150f79b587
|
@ -37,13 +37,6 @@ typedef struct {
|
||||||
|
|
||||||
IBindStatusCallback *callback;
|
IBindStatusCallback *callback;
|
||||||
IServiceProvider *serv_prov;
|
IServiceProvider *serv_prov;
|
||||||
|
|
||||||
IHttpNegotiate *http_negotiate;
|
|
||||||
BOOL init_http_negotiate;
|
|
||||||
IHttpNegotiate2 *http_negotiate2;
|
|
||||||
BOOL init_http_negotiate2;
|
|
||||||
IAuthenticate *authenticate;
|
|
||||||
BOOL init_authenticate;
|
|
||||||
} BindStatusCallback;
|
} BindStatusCallback;
|
||||||
|
|
||||||
#define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
|
#define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
|
||||||
|
@ -51,6 +44,18 @@ typedef struct {
|
||||||
#define HTTPNEG2(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
|
#define HTTPNEG2(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
|
||||||
#define AUTHENTICATE(x) ((IAuthenticate*) &(x)->lpAuthenticateVtbl)
|
#define AUTHENTICATE(x) ((IAuthenticate*) &(x)->lpAuthenticateVtbl)
|
||||||
|
|
||||||
|
static void *get_callback_iface(BindStatusCallback *This, REFIID riid)
|
||||||
|
{
|
||||||
|
void *ret;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = IBindStatusCallback_QueryInterface(This->callback, riid, (void**)&ret);
|
||||||
|
if(FAILED(hres) && This->serv_prov)
|
||||||
|
IServiceProvider_QueryService(This->serv_prov, riid, riid, &ret);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
#define STATUSCLB_THIS(iface) DEFINE_THIS(BindStatusCallback, BindStatusCallback, iface)
|
#define STATUSCLB_THIS(iface) DEFINE_THIS(BindStatusCallback, BindStatusCallback, iface)
|
||||||
|
|
||||||
static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface,
|
static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface,
|
||||||
|
@ -112,12 +117,6 @@ static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
|
||||||
if(!ref) {
|
if(!ref) {
|
||||||
if(This->serv_prov)
|
if(This->serv_prov)
|
||||||
IServiceProvider_Release(This->serv_prov);
|
IServiceProvider_Release(This->serv_prov);
|
||||||
if(This->http_negotiate)
|
|
||||||
IHttpNegotiate_Release(This->http_negotiate);
|
|
||||||
if(This->http_negotiate2)
|
|
||||||
IHttpNegotiate2_Release(This->http_negotiate2);
|
|
||||||
if(This->authenticate)
|
|
||||||
IAuthenticate_Release(This->authenticate);
|
|
||||||
IBindStatusCallback_Release(This->callback);
|
IBindStatusCallback_Release(This->callback);
|
||||||
heap_free(This);
|
heap_free(This);
|
||||||
}
|
}
|
||||||
|
@ -250,46 +249,16 @@ static HRESULT WINAPI BSCServiceProvider_QueryService(IServiceProvider *iface,
|
||||||
|
|
||||||
if(IsEqualGUID(&IID_IHttpNegotiate, guidService)) {
|
if(IsEqualGUID(&IID_IHttpNegotiate, guidService)) {
|
||||||
TRACE("(%p)->(IID_IHttpNegotiate %s %p)\n", This, debugstr_guid(riid), ppv);
|
TRACE("(%p)->(IID_IHttpNegotiate %s %p)\n", This, debugstr_guid(riid), ppv);
|
||||||
|
|
||||||
if(!This->init_http_negotiate) {
|
|
||||||
This->init_http_negotiate = TRUE;
|
|
||||||
hres = IBindStatusCallback_QueryInterface(This->callback, &IID_IHttpNegotiate,
|
|
||||||
(void**)&This->http_negotiate);
|
|
||||||
if(FAILED(hres) && This->serv_prov)
|
|
||||||
IServiceProvider_QueryService(This->serv_prov, &IID_IHttpNegotiate,
|
|
||||||
&IID_IHttpNegotiate, (void**)&This->http_negotiate);
|
|
||||||
}
|
|
||||||
|
|
||||||
return IBindStatusCallback_QueryInterface(STATUSCLB(This), riid, ppv);
|
return IBindStatusCallback_QueryInterface(STATUSCLB(This), riid, ppv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(IsEqualGUID(&IID_IHttpNegotiate2, guidService)) {
|
if(IsEqualGUID(&IID_IHttpNegotiate2, guidService)) {
|
||||||
TRACE("(%p)->(IID_IHttpNegotiate2 %s %p)\n", This, debugstr_guid(riid), ppv);
|
TRACE("(%p)->(IID_IHttpNegotiate2 %s %p)\n", This, debugstr_guid(riid), ppv);
|
||||||
|
|
||||||
if(!This->init_http_negotiate2) {
|
|
||||||
This->init_http_negotiate2 = TRUE;
|
|
||||||
hres = IBindStatusCallback_QueryInterface(This->callback, &IID_IHttpNegotiate2,
|
|
||||||
(void**)&This->http_negotiate2);
|
|
||||||
if(FAILED(hres) && This->serv_prov)
|
|
||||||
IServiceProvider_QueryService(This->serv_prov, &IID_IHttpNegotiate2,
|
|
||||||
&IID_IHttpNegotiate2, (void**)&This->http_negotiate2);
|
|
||||||
}
|
|
||||||
|
|
||||||
return IBindStatusCallback_QueryInterface(STATUSCLB(This), riid, ppv);
|
return IBindStatusCallback_QueryInterface(STATUSCLB(This), riid, ppv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(IsEqualGUID(&IID_IAuthenticate, guidService)) {
|
if(IsEqualGUID(&IID_IAuthenticate, guidService)) {
|
||||||
TRACE("(%p)->(IID_IAuthenticate %s %p)\n", This, debugstr_guid(riid), ppv);
|
TRACE("(%p)->(IID_IAuthenticate %s %p)\n", This, debugstr_guid(riid), ppv);
|
||||||
|
|
||||||
if(!This->init_authenticate) {
|
|
||||||
This->init_authenticate = TRUE;
|
|
||||||
hres = IBindStatusCallback_QueryInterface(This->callback, &IID_IAuthenticate,
|
|
||||||
(void**)&This->authenticate);
|
|
||||||
if(FAILED(hres) && This->serv_prov)
|
|
||||||
IServiceProvider_QueryService(This->serv_prov, &IID_IAuthenticate,
|
|
||||||
&IID_IAuthenticate, (void**)&This->authenticate);
|
|
||||||
}
|
|
||||||
|
|
||||||
return IBindStatusCallback_QueryInterface(STATUSCLB(This), riid, ppv);
|
return IBindStatusCallback_QueryInterface(STATUSCLB(This), riid, ppv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,17 +311,22 @@ static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate2 *ifa
|
||||||
LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
|
LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
|
||||||
{
|
{
|
||||||
BindStatusCallback *This = HTTPNEG2_THIS(iface);
|
BindStatusCallback *This = HTTPNEG2_THIS(iface);
|
||||||
|
IHttpNegotiate *http_negotiate;
|
||||||
|
HRESULT hres = S_OK;
|
||||||
|
|
||||||
TRACE("(%p)->(%s %s %d %p)\n", This, debugstr_w(szURL), debugstr_w(szHeaders), dwReserved,
|
TRACE("(%p)->(%s %s %d %p)\n", This, debugstr_w(szURL), debugstr_w(szHeaders), dwReserved,
|
||||||
pszAdditionalHeaders);
|
pszAdditionalHeaders);
|
||||||
|
|
||||||
*pszAdditionalHeaders = NULL;
|
*pszAdditionalHeaders = NULL;
|
||||||
|
|
||||||
if(!This->http_negotiate)
|
http_negotiate = get_callback_iface(This, &IID_IHttpNegotiate);
|
||||||
return S_OK;
|
if(http_negotiate) {
|
||||||
|
hres = IHttpNegotiate_BeginningTransaction(http_negotiate, szURL, szHeaders,
|
||||||
|
dwReserved, pszAdditionalHeaders);
|
||||||
|
IHttpNegotiate_Release(http_negotiate);
|
||||||
|
}
|
||||||
|
|
||||||
return IHttpNegotiate_BeginningTransaction(This->http_negotiate, szURL, szHeaders,
|
return hres;
|
||||||
dwReserved, pszAdditionalHeaders);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI BSCHttpNegotiate_OnResponse(IHttpNegotiate2 *iface, DWORD dwResponseCode,
|
static HRESULT WINAPI BSCHttpNegotiate_OnResponse(IHttpNegotiate2 *iface, DWORD dwResponseCode,
|
||||||
|
@ -361,14 +335,18 @@ static HRESULT WINAPI BSCHttpNegotiate_OnResponse(IHttpNegotiate2 *iface, DWORD
|
||||||
{
|
{
|
||||||
BindStatusCallback *This = HTTPNEG2_THIS(iface);
|
BindStatusCallback *This = HTTPNEG2_THIS(iface);
|
||||||
LPWSTR additional_headers = NULL;
|
LPWSTR additional_headers = NULL;
|
||||||
|
IHttpNegotiate *http_negotiate;
|
||||||
HRESULT hres = S_OK;
|
HRESULT hres = S_OK;
|
||||||
|
|
||||||
TRACE("(%p)->(%d %s %s %p)\n", This, dwResponseCode, debugstr_w(szResponseHeaders),
|
TRACE("(%p)->(%d %s %s %p)\n", This, dwResponseCode, debugstr_w(szResponseHeaders),
|
||||||
debugstr_w(szRequestHeaders), pszAdditionalRequestHeaders);
|
debugstr_w(szRequestHeaders), pszAdditionalRequestHeaders);
|
||||||
|
|
||||||
if(This->http_negotiate)
|
http_negotiate = get_callback_iface(This, &IID_IHttpNegotiate);
|
||||||
hres = IHttpNegotiate_OnResponse(This->http_negotiate, dwResponseCode, szResponseHeaders,
|
if(http_negotiate) {
|
||||||
szRequestHeaders, &additional_headers);
|
hres = IHttpNegotiate_OnResponse(http_negotiate, dwResponseCode, szResponseHeaders,
|
||||||
|
szRequestHeaders, &additional_headers);
|
||||||
|
IHttpNegotiate_Release(http_negotiate);
|
||||||
|
}
|
||||||
|
|
||||||
if(pszAdditionalRequestHeaders)
|
if(pszAdditionalRequestHeaders)
|
||||||
*pszAdditionalRequestHeaders = additional_headers;
|
*pszAdditionalRequestHeaders = additional_headers;
|
||||||
|
@ -382,14 +360,19 @@ static HRESULT WINAPI BSCHttpNegotiate_GetRootSecurityId(IHttpNegotiate2 *iface,
|
||||||
BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
|
BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
|
||||||
{
|
{
|
||||||
BindStatusCallback *This = HTTPNEG2_THIS(iface);
|
BindStatusCallback *This = HTTPNEG2_THIS(iface);
|
||||||
|
IHttpNegotiate2 *http_negotiate2;
|
||||||
|
HRESULT hres = E_FAIL;
|
||||||
|
|
||||||
TRACE("(%p)->(%p %p %ld)\n", This, pbSecurityId, pcbSecurityId, dwReserved);
|
TRACE("(%p)->(%p %p %ld)\n", This, pbSecurityId, pcbSecurityId, dwReserved);
|
||||||
|
|
||||||
if(!This->http_negotiate2)
|
http_negotiate2 = get_callback_iface(This, &IID_IHttpNegotiate2);
|
||||||
return E_NOTIMPL;
|
if(http_negotiate2) {
|
||||||
|
hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, pbSecurityId,
|
||||||
|
pcbSecurityId, dwReserved);
|
||||||
|
IHttpNegotiate2_Release(http_negotiate2);
|
||||||
|
}
|
||||||
|
|
||||||
return IHttpNegotiate2_GetRootSecurityId(This->http_negotiate2, pbSecurityId,
|
return hres;
|
||||||
pcbSecurityId, dwReserved);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef HTTPNEG2_THIS
|
#undef HTTPNEG2_THIS
|
||||||
|
|
|
@ -601,7 +601,6 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
|
||||||
SET_EXPECT(QueryInterface_IHttpNegotiate);
|
SET_EXPECT(QueryInterface_IHttpNegotiate);
|
||||||
hres = IHttpNegotiate_BeginningTransaction(http_negotiate, urls[test_protocol],
|
hres = IHttpNegotiate_BeginningTransaction(http_negotiate, urls[test_protocol],
|
||||||
NULL, 0, &additional_headers);
|
NULL, 0, &additional_headers);
|
||||||
todo_wine
|
|
||||||
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate);
|
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate);
|
||||||
CHECK_CALLED(BeginningTransaction);
|
CHECK_CALLED(BeginningTransaction);
|
||||||
IHttpNegotiate_Release(http_negotiate);
|
IHttpNegotiate_Release(http_negotiate);
|
||||||
|
@ -618,7 +617,6 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
|
||||||
SET_EXPECT(QueryInterface_IHttpNegotiate2);
|
SET_EXPECT(QueryInterface_IHttpNegotiate2);
|
||||||
SET_EXPECT(GetRootSecurityId);
|
SET_EXPECT(GetRootSecurityId);
|
||||||
hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, sec_id, &size, 0);
|
hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, sec_id, &size, 0);
|
||||||
todo_wine
|
|
||||||
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate2);
|
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate2);
|
||||||
CHECK_CALLED(GetRootSecurityId);
|
CHECK_CALLED(GetRootSecurityId);
|
||||||
IHttpNegotiate2_Release(http_negotiate2);
|
IHttpNegotiate2_Release(http_negotiate2);
|
||||||
|
@ -773,7 +771,6 @@ static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
|
||||||
SET_EXPECT(QueryInterface_IHttpNegotiate);
|
SET_EXPECT(QueryInterface_IHttpNegotiate);
|
||||||
SET_EXPECT(OnResponse);
|
SET_EXPECT(OnResponse);
|
||||||
hres = IHttpNegotiate_OnResponse(http_negotiate, 200, header, NULL, NULL);
|
hres = IHttpNegotiate_OnResponse(http_negotiate, 200, header, NULL, NULL);
|
||||||
todo_wine
|
|
||||||
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate);
|
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate);
|
||||||
CHECK_CALLED(OnResponse);
|
CHECK_CALLED(OnResponse);
|
||||||
IHttpNegotiate_Release(http_negotiate);
|
IHttpNegotiate_Release(http_negotiate);
|
||||||
|
@ -1951,7 +1948,6 @@ static BOOL test_bscholder(IBindStatusCallback *holder)
|
||||||
SET_EXPECT(QueryInterface_IHttpNegotiate);
|
SET_EXPECT(QueryInterface_IHttpNegotiate);
|
||||||
SET_EXPECT(BeginningTransaction);
|
SET_EXPECT(BeginningTransaction);
|
||||||
hres = IHttpNegotiate_BeginningTransaction(http_negotiate_serv, urls[test_protocol], emptyW, 0, &wstr);
|
hres = IHttpNegotiate_BeginningTransaction(http_negotiate_serv, urls[test_protocol], emptyW, 0, &wstr);
|
||||||
todo_wine
|
|
||||||
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate); /* IE8 */
|
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate); /* IE8 */
|
||||||
CHECK_CALLED(BeginningTransaction);
|
CHECK_CALLED(BeginningTransaction);
|
||||||
ok(hres == S_OK, "BeginningTransaction failed: %08x\n", hres);
|
ok(hres == S_OK, "BeginningTransaction failed: %08x\n", hres);
|
||||||
|
@ -1980,7 +1976,6 @@ static BOOL test_bscholder(IBindStatusCallback *holder)
|
||||||
SET_EXPECT(GetRootSecurityId);
|
SET_EXPECT(GetRootSecurityId);
|
||||||
hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, (void*)0xdeadbeef, (void*)0xdeadbeef, 0);
|
hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, (void*)0xdeadbeef, (void*)0xdeadbeef, 0);
|
||||||
ok(hres == E_NOTIMPL, "GetRootSecurityId failed: %08x\n", hres);
|
ok(hres == E_NOTIMPL, "GetRootSecurityId failed: %08x\n", hres);
|
||||||
todo_wine
|
|
||||||
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate2); /* IE8 */
|
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate2); /* IE8 */
|
||||||
CHECK_CALLED(GetRootSecurityId);
|
CHECK_CALLED(GetRootSecurityId);
|
||||||
|
|
||||||
|
@ -2001,7 +1996,6 @@ static BOOL test_bscholder(IBindStatusCallback *holder)
|
||||||
wstr = (void*)0xdeadbeef;
|
wstr = (void*)0xdeadbeef;
|
||||||
hres = IHttpNegotiate_OnResponse(http_negotiate, 200, emptyW, NULL, NULL);
|
hres = IHttpNegotiate_OnResponse(http_negotiate, 200, emptyW, NULL, NULL);
|
||||||
ok(hres == S_OK, "OnResponse failed: %08x\n", hres);
|
ok(hres == S_OK, "OnResponse failed: %08x\n", hres);
|
||||||
todo_wine
|
|
||||||
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate); /* IE8 */
|
CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate); /* IE8 */
|
||||||
CHECK_CALLED(OnResponse);
|
CHECK_CALLED(OnResponse);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue