static HRESULT WINAPI ResProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) { ResProtocol *This = PROTOCOL_THIS(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv); if(This->pUnkOuter) return IUnknown_QueryInterface(This->pUnkOuter, &IID_IUnknown, ppv); *ppv = PROTOCOL(This); }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) { TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", iface, ppv); *ppv = PROTOCOL(This); }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { TRACE("(%p)->(IID_IInternetProtocol %p)\n", iface, ppv); *ppv = PROTOCOL(This); }else if(IsEqualGUID(&IID_IServiceProvider, riid)) { FIXME("IServiceProvider is not implemented\n"); return E_NOINTERFACE; } if(!*ppv) { TRACE("unknown interface %s\n", debugstr_guid(riid)); return E_NOINTERFACE; } IInternetProtocol_AddRef(iface); return S_OK; }
static HRESULT WINAPI ProtocolProxy_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) { ProtocolProxy *This = PROTOCOL_THIS(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); *ppv = PROTOCOL(This); }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) { TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv); *ppv = PROTOCOL(This); }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv); *ppv = PROTOCOL(This); }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) { TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv); *ppv = PROTSINK(This); } if(*ppv) { IInternetProtocol_AddRef(iface); return S_OK; } WARN("not supported interface %s\n", debugstr_guid(riid)); return E_NOINTERFACE; }
static HRESULT WINAPI BindProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, DWORD dwOptions) { BindProtocol *This = PROTOCOL_THIS(iface); FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions); return E_NOTIMPL; }
static HRESULT WINAPI HttpProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) { HttpProtocol *This = PROTOCOL_THIS(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); *ppv = PROTOCOL(This); }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) { TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv); *ppv = PROTOCOL(This); }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv); *ppv = PROTOCOL(This); }else if(IsEqualGUID(&IID_IInternetPriority, riid)) { TRACE("(%p)->(IID_IInternetPriority %p)\n", This, ppv); *ppv = PRIORITY(This); }else if(IsEqualGUID(&IID_IWinInetInfo, riid)) { TRACE("(%p)->(IID_IWinInetInfo %p)\n", This, ppv); *ppv = INETHTTPINFO(This); }else if(IsEqualGUID(&IID_IWinInetHttpInfo, riid)) { TRACE("(%p)->(IID_IWinInetHttpInfo %p)\n", This, ppv); *ppv = INETHTTPINFO(This); } if(*ppv) { IInternetProtocol_AddRef(iface); return S_OK; } WARN("not supported interface %s\n", debugstr_guid(riid)); return E_NOINTERFACE; }
static HRESULT WINAPI FtpProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) { FtpProtocol *This = PROTOCOL_THIS(iface); IUri *uri; HRESULT hres; static const WCHAR ftpW[] = {'f','t','p',':'}; TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, pOIBindInfo, grfPI, dwReserved); if(strncmpW(szUrl, ftpW, sizeof(ftpW)/sizeof(WCHAR))) return MK_E_SYNTAX; hres = CreateUri(szUrl, 0, 0, &uri); if(FAILED(hres)) return hres; hres = protocol_start(&This->base, PROTOCOL(This), uri, pOIProtSink, pOIBindInfo); IUri_Release(uri); return hres; }
static HRESULT WINAPI BindProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) { BindProtocol *This = PROTOCOL_THIS(iface); FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition); return E_NOTIMPL; }
static ULONG WINAPI BindProtocol_Release(IInternetProtocol *iface) { BindProtocol *This = PROTOCOL_THIS(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->protocol) IInternetProtocol_Release(This->protocol); if(This->bind_info) IInternetBindInfo_Release(This->bind_info); if(This->protocol_handler && This->protocol_handler != PROTOCOLHANDLER(This)) IInternetProtocol_Release(This->protocol_handler); if(This->filter_proxy) IInternetProtocol_Release(PROTOCOL(This->filter_proxy)); set_binding_sink(PROTOCOL(This), NULL); if(This->notif_hwnd) release_notif_hwnd(This->notif_hwnd); DeleteCriticalSection(&This->section); heap_free(This->mime); heap_free(This->url); heap_free(This); URLMON_UnlockModule(); } return ref; }
static ULONG WINAPI ResProtocol_AddRef(IInternetProtocol *iface) { ResProtocol *This = PROTOCOL_THIS(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", iface, ref); return This->pUnkOuter ? IUnknown_AddRef(This->pUnkOuter) : ref; }
static ULONG WINAPI BindProtocol_AddRef(IInternetProtocol *iface) { BindProtocol *This = PROTOCOL_THIS(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); return ref; }
static HRESULT WINAPI AboutProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, IInternetProtocolSink* pOIProtSink, IInternetBindInfo* pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) { AboutProtocol *This = PROTOCOL_THIS(iface); BINDINFO bindinfo; DWORD grfBINDF = 0; LPCWSTR text = NULL; static const WCHAR html_begin[] = {0xfeff,'<','H','T','M','L','>',0}; static const WCHAR html_end[] = {'<','/','H','T','M','L','>',0}; static const WCHAR wszBlank[] = {'b','l','a','n','k',0}; static const WCHAR wszAbout[] = {'a','b','o','u','t',':'}; static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0}; /* NOTE: * the about protocol seems not to work as I would expect. It creates html document * for a given url, eg. about:some_text -> <HTML>some_text</HTML> except for the case when * some_text = "blank", when document is blank (<HTML></HMTL>). The same happens * when the url does not have "about:" in the beginning. */ TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, pOIBindInfo, grfPI, dwReserved); memset(&bindinfo, 0, sizeof(bindinfo)); bindinfo.cbSize = sizeof(BINDINFO); IInternetBindInfo_GetBindInfo(pOIBindInfo, &grfBINDF, &bindinfo); ReleaseBindInfo(&bindinfo); TRACE("bindf %x\n", grfBINDF); if(strlenW(szUrl)>=sizeof(wszAbout)/sizeof(WCHAR) && !memcmp(wszAbout, szUrl, sizeof(wszAbout))) { text = szUrl + sizeof(wszAbout)/sizeof(WCHAR); if(!strcmpW(wszBlank, text)) text = NULL; } This->data_len = sizeof(html_begin)+sizeof(html_end)-sizeof(WCHAR) + (text ? strlenW(text)*sizeof(WCHAR) : 0); This->data = heap_alloc(This->data_len); memcpy(This->data, html_begin, sizeof(html_begin)); if(text) strcatW((LPWSTR)This->data, text); strcatW((LPWSTR)This->data, html_end); This->cur = 0; IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_MIMETYPEAVAILABLE, wszTextHtml); IInternetProtocolSink_ReportData(pOIProtSink, BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE, This->data_len, This->data_len); IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL); return S_OK; }
static HRESULT WINAPI ITSProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions) { ITSProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); return S_OK; }
static HRESULT WINAPI BindProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions) { BindProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); return IInternetProtocol_Terminate(This->protocol_handler, dwOptions); }
static HRESULT WINAPI FileProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions) { FileProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); return S_OK; }
static HRESULT WINAPI HttpProtocol_UnlockRequest(IInternetProtocol *iface) { HttpProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)\n", This); return protocol_unlock_request(&This->base); }
static HRESULT WINAPI BindProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData) { BindProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%p)\n", This, pProtocolData); return IInternetProtocol_Continue(This->protocol, pProtocolData); }
static HRESULT WINAPI HttpProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData) { HttpProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%p)\n", This, pProtocolData); return protocol_continue(&This->base, pProtocolData); }
static HRESULT WINAPI FileProtocol_UnlockRequest(IInternetProtocol *iface) { FileProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)\n", This); return S_OK; }
static HRESULT WINAPI BindProtocol_UnlockRequest(IInternetProtocol *iface) { BindProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)\n", This); return IInternetProtocol_UnlockRequest(This->protocol); }
static HRESULT WINAPI BindProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions) { BindProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); return IInternetProtocol_LockRequest(This->protocol, dwOptions); }
static HRESULT WINAPI HttpProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions) { HttpProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); return protocol_lock_request(&This->base); }
static HRESULT WINAPI ResProtocol_UnlockRequest(IInternetProtocol *iface) { ResProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)\n", This); /* test show that we don't have to do anything here */ return S_OK; }
static HRESULT WINAPI HttpProtocol_Read(IInternetProtocol *iface, void *pv, ULONG cb, ULONG *pcbRead) { HttpProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); return protocol_read(&This->base, pv, cb, pcbRead); }
static HRESULT WINAPI HttpProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions) { HttpProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); protocol_close_connection(&This->base); return S_OK; }
static HRESULT WINAPI GopherProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, DWORD dwOptions) { GopherProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%08x %08x)\n", This, hrReason, dwOptions); return protocol_abort(&This->base, hrReason); }
static HRESULT WINAPI ProtocolProxy_Read(IInternetProtocol *iface, void *pv, ULONG cb, ULONG *pcbRead) { ProtocolProxy *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); return IInternetProtocol_Read(This->protocol, pv, cb, pcbRead); }
static HRESULT WINAPI ResProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions) { ResProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%d)\n", This, dwOptions); /* test show that we don't have to do anything here */ return S_OK; }
static HRESULT WINAPI BindProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) { BindProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, pOIBindInfo, grfPI, dwReserved); return IInternetProtocol_Start(This->protocol_handler, szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved); }
static HRESULT WINAPI BindProtocol_Read(IInternetProtocol *iface, void *pv, ULONG cb, ULONG *pcbRead) { BindProtocol *This = PROTOCOL_THIS(iface); TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); if(pcbRead) *pcbRead = 0; return IInternetProtocol_Read(This->protocol_handler, pv, cb, pcbRead); }
static HRESULT WINAPI BindProtocol_Read(IInternetProtocol *iface, void *pv, ULONG cb, ULONG *pcbRead) { BindProtocol *This = PROTOCOL_THIS(iface); ULONG read = 0; HRESULT hres; TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); hres = IInternetProtocol_Read(This->protocol, pv, cb, &read); *pcbRead = read; return hres; }
static ULONG WINAPI AboutProtocol_Release(IInternetProtocol *iface) { AboutProtocol *This = PROTOCOL_THIS(iface); IUnknown *pUnkOuter = This->pUnkOuter; ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%x\n", iface, ref); if(!ref) { heap_free(This->data); heap_free(This); } return pUnkOuter ? IUnknown_Release(pUnkOuter) : ref; }