void process_document_response_headers(HTMLDocumentNode *doc, IBinding *binding) { IWinInetHttpInfo *http_info; char buf[1024]; DWORD size; HRESULT hres; hres = IBinding_QueryInterface(binding, &IID_IWinInetHttpInfo, (void**)&http_info); if(FAILED(hres)) { TRACE("No IWinInetHttpInfo\n"); return; } size = sizeof(buf); strcpy(buf, "X-UA-Compatible"); hres = IWinInetHttpInfo_QueryInfo(http_info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL); if(hres == S_OK && size) { compat_mode_t document_mode; WCHAR *header; TRACE("size %u\n", size); header = heap_strdupAtoW(buf); if(header && parse_ua_compatible(header, &document_mode)) { TRACE("setting document mode %d\n", document_mode); set_document_mode(doc, document_mode, FALSE); } heap_free(header); } IWinInetHttpInfo_Release(http_info); }
static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv) { Binding *This = BINDING_THIS(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); *ppv = BINDING(This); } else if(IsEqualGUID(&IID_IBinding, riid)) { TRACE("(%p)->(IID_IBinding %p)\n", This, ppv); *ppv = BINDING(This); } else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) { TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv); *ppv = PROTSINK(This); } else if(IsEqualGUID(&IID_IInternetBindInfo, riid)) { TRACE("(%p)->(IID_IInternetBindInfo %p)\n", This, ppv); *ppv = BINDINF(This); } else if(IsEqualGUID(&IID_IServiceProvider, riid)) { TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv); *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) { IBinding_AddRef(BINDING(This)); return S_OK; } WARN("Unsupported interface %s\n", debugstr_guid(riid)); return E_NOINTERFACE; }
static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv) { Binding *This = impl_from_IBinding(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); *ppv = &This->IBinding_iface; }else if(IsEqualGUID(&IID_IBinding, riid)) { TRACE("(%p)->(IID_IBinding %p)\n", This, ppv); *ppv = &This->IBinding_iface; }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) { TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv); *ppv = &This->IInternetProtocolSink_iface; }else if(IsEqualGUID(&IID_IInternetBindInfo, riid)) { TRACE("(%p)->(IID_IInternetBindInfo %p)\n", This, ppv); *ppv = &This->IInternetBindInfo_iface; }else if(IsEqualGUID(&IID_IServiceProvider, riid)) { TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv); *ppv = &This->IServiceProvider_iface; }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(!This->protocol->wininet_info) return E_NOINTERFACE; *ppv = &This->IWinInetHttpInfo_iface; }else if(IsEqualGUID(&IID_IWinInetHttpInfo, riid)) { IWinInetHttpInfo *http_info; HRESULT hres; TRACE("(%p)->(IID_IWinInetHttpInfo %p)\n", This, ppv); if(!This->protocol->wininet_info) return E_NOINTERFACE; hres = IWinInetInfo_QueryInterface(This->protocol->wininet_info, &IID_IWinInetHttpInfo, (void**)&http_info); if(FAILED(hres)) return E_NOINTERFACE; IWinInetHttpInfo_Release(http_info); *ppv = &This->IWinInetHttpInfo_iface; } if(*ppv) { IBinding_AddRef(&This->IBinding_iface); return S_OK; } WARN("Unsupported interface %s\n", debugstr_guid(riid)); return E_NOINTERFACE; }
static DWORD get_http_status_code(IBinding *binding) { IWinInetHttpInfo *http_info; DWORD status, size = sizeof(DWORD); HRESULT hres; hres = IBinding_QueryInterface(binding, &IID_IWinInetHttpInfo, (void**)&http_info); if(FAILED(hres)) return HTTP_STATUS_OK; hres = IWinInetHttpInfo_QueryInfo(http_info, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL, NULL); IWinInetHttpInfo_Release(http_info); if(FAILED(hres)) return HTTP_STATUS_OK; return status; }
static ULONG WINAPI BindProtocol_Release(IInternetProtocolEx *iface) { BindProtocol *This = impl_from_IInternetProtocolEx(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); if(!ref) { if(This->wininet_info) IWinInetInfo_Release(This->wininet_info); if(This->wininet_http_info) IWinInetHttpInfo_Release(This->wininet_http_info); if(This->protocol) IInternetProtocol_Release(This->protocol); if(This->bind_info) IInternetBindInfo_Release(This->bind_info); if(This->protocol_handler && This->protocol_handler != &This->default_protocol_handler.IInternetProtocol_iface) IInternetProtocol_Release(This->protocol_handler); if(This->protocol_sink_handler && This->protocol_sink_handler != &This->default_protocol_handler.IInternetProtocolSink_iface) IInternetProtocolSink_Release(This->protocol_sink_handler); if(This->uri) IUri_Release(This->uri); SysFreeString(This->display_uri); set_binding_sink(This, NULL, NULL); if(This->notif_hwnd) release_notif_hwnd(This->notif_hwnd); This->section.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->section); heap_free(This->mime); heap_free(This); URLMON_UnlockModule(); } return ref; }
static HRESULT WINAPI BindProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv) { BindProtocol *This = impl_from_IInternetProtocolEx(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); *ppv = &This->IInternetProtocolEx_iface; }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) { TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv); *ppv = &This->IInternetProtocolEx_iface; }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv); *ppv = &This->IInternetProtocolEx_iface; }else if(IsEqualGUID(&IID_IInternetProtocolEx, riid)) { TRACE("(%p)->(IID_IInternetProtocolEx %p)\n", This, ppv); *ppv = &This->IInternetProtocolEx_iface; }else if(IsEqualGUID(&IID_IInternetBindInfo, riid)) { TRACE("(%p)->(IID_IInternetBindInfo %p)\n", This, ppv); *ppv = &This->IInternetBindInfo_iface; }else if(IsEqualGUID(&IID_IInternetPriority, riid)) { TRACE("(%p)->(IID_IInternetPriority %p)\n", This, ppv); *ppv = &This->IInternetPriority_iface; }else if(IsEqualGUID(&IID_IAuthenticate, riid)) { FIXME("(%p)->(IID_IAuthenticate %p)\n", This, ppv); }else if(IsEqualGUID(&IID_IServiceProvider, riid)) { TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv); *ppv = &This->IServiceProvider_iface; }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) { TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv); *ppv = &This->IInternetProtocolSink_iface; }else if(IsEqualGUID(&IID_IWinInetInfo, riid)) { TRACE("(%p)->(IID_IWinInetInfo %p)\n", This, ppv); if(This->protocol) { IWinInetInfo *inet_info; HRESULT hres; hres = IInternetProtocol_QueryInterface(This->protocol, &IID_IWinInetInfo, (void**)&inet_info); if(SUCCEEDED(hres)) { *ppv = &This->IWinInetHttpInfo_iface; IWinInetInfo_Release(inet_info); } } }else if(IsEqualGUID(&IID_IWinInetHttpInfo, riid)) { TRACE("(%p)->(IID_IWinInetHttpInfo %p)\n", This, ppv); if(This->protocol) { IWinInetHttpInfo *http_info; HRESULT hres; hres = IInternetProtocol_QueryInterface(This->protocol, &IID_IWinInetHttpInfo, (void**)&http_info); if(SUCCEEDED(hres)) { *ppv = &This->IWinInetHttpInfo_iface; IWinInetHttpInfo_Release(http_info); } } }else { WARN("not supported interface %s\n", debugstr_guid(riid)); } if(!*ppv) return E_NOINTERFACE; IUnknown_AddRef((IUnknown*)*ppv); return S_OK; }