2007-01-23 19:33:30 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2007 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
#include "urlmon.h"
|
|
|
|
#include "urlmon_main.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const IInternetProtocolVtbl *lpInternetProtocolVtbl;
|
|
|
|
const IInternetBindInfoVtbl *lpInternetBindInfoVtbl;
|
2007-01-23 19:34:00 +01:00
|
|
|
const IInternetPriorityVtbl *lpInternetPriorityVtbl;
|
2007-01-23 19:45:27 +01:00
|
|
|
const IInternetProtocolSinkVtbl *lpInternetProtocolSinkVtbl;
|
2007-01-23 19:33:30 +01:00
|
|
|
|
|
|
|
LONG ref;
|
2007-01-23 19:36:09 +01:00
|
|
|
|
|
|
|
IInternetProtocol *protocol;
|
|
|
|
IInternetBindInfo *bind_info;
|
|
|
|
IInternetProtocolSink *protocol_sink;
|
2007-01-23 23:33:38 +01:00
|
|
|
|
|
|
|
LONG priority;
|
2007-01-23 19:33:30 +01:00
|
|
|
} BindProtocol;
|
|
|
|
|
|
|
|
#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl)
|
|
|
|
#define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl)
|
2007-01-23 19:34:00 +01:00
|
|
|
#define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl)
|
2007-01-23 19:45:27 +01:00
|
|
|
#define PROTSINK(x) ((IInternetProtocolSink*) &(x)->lpInternetProtocolSinkVtbl)
|
2007-01-23 19:33:30 +01:00
|
|
|
|
|
|
|
#define PROTOCOL_THIS(iface) DEFINE_THIS(BindProtocol, InternetProtocol, iface)
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
BindProtocol *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_IInternetBindInfo, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IInternetBindInfo %p)\n", This, ppv);
|
|
|
|
*ppv = BINDINFO(This);
|
2007-01-23 19:34:00 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IInternetPriority, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IInternetPriority %p)\n", This, ppv);
|
|
|
|
*ppv = PRIORITY(This);
|
|
|
|
}else if(IsEqualGUID(&IID_IAuthenticate, riid)) {
|
|
|
|
FIXME("(%p)->(IID_IAuthenticate %p)\n", This, ppv);
|
2007-01-23 19:45:27 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
|
|
|
|
FIXME("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
|
2007-01-23 19:34:00 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) {
|
2007-01-23 19:45:27 +01:00
|
|
|
TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv);
|
|
|
|
*ppv = PROTSINK(This);
|
2007-01-23 19:33:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(*ppv) {
|
|
|
|
IInternetProtocol_AddRef(iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("not supported interface %s\n", debugstr_guid(riid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
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 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) {
|
2007-01-23 19:36:09 +01:00
|
|
|
if(This->protocol)
|
|
|
|
IInternetProtocol_Release(This->protocol);
|
|
|
|
if(This->bind_info)
|
|
|
|
IInternetBindInfo_Release(This->bind_info);
|
|
|
|
if(This->protocol_sink)
|
|
|
|
IInternetProtocolSink_Release(This->protocol_sink);
|
|
|
|
|
2007-01-23 19:33:30 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
|
|
|
|
URLMON_UnlockModule();
|
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
|
|
|
|
IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
|
|
|
|
DWORD grfPI, DWORD dwReserved)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTOCOL_THIS(iface);
|
2007-01-23 19:36:09 +01:00
|
|
|
IInternetProtocol *protocol = NULL;
|
2007-01-23 23:33:38 +01:00
|
|
|
IInternetPriority *priority;
|
2007-01-23 19:36:09 +01:00
|
|
|
IServiceProvider *service_provider;
|
|
|
|
CLSID clsid = IID_NULL;
|
|
|
|
LPOLESTR clsid_str;
|
|
|
|
HRESULT hres;
|
2007-01-23 19:33:30 +01:00
|
|
|
|
2007-01-23 19:36:09 +01:00
|
|
|
TRACE("(%p)->(%s %p %p %08x %d)\n", This, debugstr_w(szUrl), pOIProtSink,
|
2007-01-23 19:33:30 +01:00
|
|
|
pOIBindInfo, grfPI, dwReserved);
|
|
|
|
|
|
|
|
if(!szUrl || !pOIProtSink || !pOIBindInfo)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2007-01-23 19:36:09 +01:00
|
|
|
hres = IInternetProtocolSink_QueryInterface(pOIProtSink, &IID_IServiceProvider,
|
|
|
|
(void**)&service_provider);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
/* FIXME: What's protocol CLSID here? */
|
|
|
|
IServiceProvider_QueryService(service_provider, &IID_IInternetProtocol,
|
|
|
|
&IID_IInternetProtocol, (void**)&protocol);
|
|
|
|
IServiceProvider_Release(service_provider);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!protocol) {
|
|
|
|
IClassFactory *cf;
|
|
|
|
IUnknown *unk;
|
|
|
|
|
|
|
|
hres = get_protocol_handler(szUrl, &clsid, &cf);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
hres = IClassFactory_CreateInstance(cf, (IUnknown*)BINDINFO(This),
|
|
|
|
&IID_IUnknown, (void**)&unk);
|
|
|
|
IClassFactory_Release(cf);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocol, (void**)&protocol);
|
|
|
|
IUnknown_Release(unk);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
StringFromCLSID(&clsid, &clsid_str);
|
|
|
|
IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_PROTOCOLCLASSID, clsid_str);
|
|
|
|
CoTaskMemFree(clsid_str);
|
|
|
|
|
|
|
|
This->protocol = protocol;
|
|
|
|
|
|
|
|
IInternetBindInfo_AddRef(pOIBindInfo);
|
|
|
|
This->bind_info = pOIBindInfo;
|
|
|
|
|
|
|
|
IInternetProtocolSink_AddRef(pOIProtSink);
|
|
|
|
This->protocol_sink = pOIProtSink;
|
|
|
|
|
2007-01-23 23:33:38 +01:00
|
|
|
hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority, (void**)&priority);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
IInternetPriority_SetPriority(priority, This->priority);
|
|
|
|
IInternetPriority_Release(priority);
|
|
|
|
}
|
|
|
|
|
2007-01-23 19:36:09 +01:00
|
|
|
return IInternetProtocol_Start(protocol, szUrl, PROTSINK(This), BINDINFO(This), 0, 0);
|
2007-01-23 19:33:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTOCOL_THIS(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, pProtocolData);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
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 BindProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTOCOL_THIS(iface);
|
2007-01-23 19:36:09 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%08x)\n", This, dwOptions);
|
|
|
|
|
|
|
|
IInternetProtocol_Terminate(This->protocol, 0);
|
|
|
|
return S_OK;
|
2007-01-23 19:33:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindProtocol_Suspend(IInternetProtocol *iface)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTOCOL_THIS(iface);
|
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindProtocol_Resume(IInternetProtocol *iface)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTOCOL_THIS(iface);
|
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindProtocol_Read(IInternetProtocol *iface, void *pv,
|
|
|
|
ULONG cb, ULONG *pcbRead)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTOCOL_THIS(iface);
|
2007-01-23 19:36:09 +01:00
|
|
|
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;
|
2007-01-23 19:33:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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 HRESULT WINAPI BindProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTOCOL_THIS(iface);
|
|
|
|
FIXME("(%p)->(%08x)\n", This, dwOptions);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindProtocol_UnlockRequest(IInternetProtocol *iface)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTOCOL_THIS(iface);
|
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef PROTOCOL_THIS
|
|
|
|
|
|
|
|
static const IInternetProtocolVtbl BindProtocolVtbl = {
|
|
|
|
BindProtocol_QueryInterface,
|
|
|
|
BindProtocol_AddRef,
|
|
|
|
BindProtocol_Release,
|
|
|
|
BindProtocol_Start,
|
|
|
|
BindProtocol_Continue,
|
|
|
|
BindProtocol_Abort,
|
|
|
|
BindProtocol_Terminate,
|
|
|
|
BindProtocol_Suspend,
|
|
|
|
BindProtocol_Resume,
|
|
|
|
BindProtocol_Read,
|
|
|
|
BindProtocol_Seek,
|
|
|
|
BindProtocol_LockRequest,
|
|
|
|
BindProtocol_UnlockRequest
|
|
|
|
};
|
|
|
|
|
|
|
|
#define BINDINFO_THIS(iface) DEFINE_THIS(BindProtocol, InternetBindInfo, iface)
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindInfo_QueryInterface(IInternetBindInfo *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
BindProtocol *This = BINDINFO_THIS(iface);
|
|
|
|
return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI BindInfo_AddRef(IInternetBindInfo *iface)
|
|
|
|
{
|
|
|
|
BindProtocol *This = BINDINFO_THIS(iface);
|
|
|
|
return IBinding_AddRef(PROTOCOL(This));
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI BindInfo_Release(IInternetBindInfo *iface)
|
|
|
|
{
|
|
|
|
BindProtocol *This = BINDINFO_THIS(iface);
|
|
|
|
return IBinding_Release(PROTOCOL(This));
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindInfo_GetBindInfo(IInternetBindInfo *iface,
|
|
|
|
DWORD *grfBINDF, BINDINFO *pbindinfo)
|
|
|
|
{
|
|
|
|
BindProtocol *This = BINDINFO_THIS(iface);
|
2007-01-23 19:36:09 +01:00
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo);
|
|
|
|
|
|
|
|
hres = IInternetBindInfo_GetBindInfo(This->bind_info, grfBINDF, pbindinfo);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("GetBindInfo failed: %08x\n", hres);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
*grfBINDF |= BINDF_FROMURLMON;
|
|
|
|
return hres;
|
2007-01-23 19:33:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI BindInfo_GetBindString(IInternetBindInfo *iface,
|
|
|
|
ULONG ulStringType, LPOLESTR *ppwzStr, ULONG cEl, ULONG *pcElFetched)
|
|
|
|
{
|
|
|
|
BindProtocol *This = BINDINFO_THIS(iface);
|
|
|
|
FIXME("(%p)->(%d %p %d %p)\n", This, ulStringType, ppwzStr, cEl, pcElFetched);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef BINDFO_THIS
|
|
|
|
|
|
|
|
static const IInternetBindInfoVtbl InternetBindInfoVtbl = {
|
|
|
|
BindInfo_QueryInterface,
|
|
|
|
BindInfo_AddRef,
|
|
|
|
BindInfo_Release,
|
|
|
|
BindInfo_GetBindInfo,
|
|
|
|
BindInfo_GetBindString
|
|
|
|
};
|
|
|
|
|
2007-01-23 19:34:00 +01:00
|
|
|
#define PRIORITY_THIS(iface) DEFINE_THIS(BindProtocol, InternetPriority, iface)
|
|
|
|
|
|
|
|
static HRESULT WINAPI InternetPriority_QueryInterface(IInternetPriority *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PRIORITY_THIS(iface);
|
|
|
|
return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InternetPriority_AddRef(IInternetPriority *iface)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PRIORITY_THIS(iface);
|
|
|
|
return IInternetProtocol_AddRef(PROTOCOL(This));
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InternetPriority_Release(IInternetPriority *iface)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PRIORITY_THIS(iface);
|
|
|
|
return IInternetProtocol_Release(PROTOCOL(This));
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InternetPriority_SetPriority(IInternetPriority *iface, LONG nPriority)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PRIORITY_THIS(iface);
|
2007-01-23 23:33:38 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%d)\n", This, nPriority);
|
|
|
|
|
|
|
|
This->priority = nPriority;
|
|
|
|
return S_OK;
|
2007-01-23 19:34:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InternetPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PRIORITY_THIS(iface);
|
2007-01-23 23:33:38 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, pnPriority);
|
|
|
|
|
|
|
|
*pnPriority = This->priority;
|
|
|
|
return S_OK;
|
2007-01-23 19:34:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#undef PRIORITY_THIS
|
|
|
|
|
|
|
|
static const IInternetPriorityVtbl InternetPriorityVtbl = {
|
|
|
|
InternetPriority_QueryInterface,
|
|
|
|
InternetPriority_AddRef,
|
|
|
|
InternetPriority_Release,
|
|
|
|
InternetPriority_SetPriority,
|
|
|
|
InternetPriority_GetPriority
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2007-01-23 19:45:27 +01:00
|
|
|
#define PROTSINK_THIS(iface) DEFINE_THIS(BindProtocol, InternetProtocolSink, iface)
|
|
|
|
|
|
|
|
static HRESULT WINAPI InternetProtocolSink_QueryInterface(IInternetProtocolSink *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTSINK_THIS(iface);
|
|
|
|
return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InternetProtocolSink_AddRef(IInternetProtocolSink *iface)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTSINK_THIS(iface);
|
|
|
|
return IInternetProtocol_AddRef(PROTOCOL(This));
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InternetProtocolSink_Release(IInternetProtocolSink *iface)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTSINK_THIS(iface);
|
|
|
|
return IInternetProtocol_Release(PROTOCOL(This));
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InternetProtocolSink_Switch(IInternetProtocolSink *iface,
|
|
|
|
PROTOCOLDATA *pProtocolData)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTSINK_THIS(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, pProtocolData);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InternetProtocolSink_ReportProgress(IInternetProtocolSink *iface,
|
|
|
|
ULONG ulStatusCode, LPCWSTR szStatusText)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTSINK_THIS(iface);
|
2007-01-23 19:36:09 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%u %s)\n", This, ulStatusCode, debugstr_w(szStatusText));
|
|
|
|
|
|
|
|
switch(ulStatusCode) {
|
|
|
|
case BINDSTATUS_SENDINGREQUEST:
|
|
|
|
return IInternetProtocolSink_ReportProgress(This->protocol_sink,
|
|
|
|
ulStatusCode, NULL);
|
|
|
|
case BINDSTATUS_CACHEFILENAMEAVAILABLE:
|
|
|
|
return IInternetProtocolSink_ReportProgress(This->protocol_sink,
|
|
|
|
ulStatusCode, szStatusText);
|
|
|
|
case BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE:
|
|
|
|
return IInternetProtocolSink_ReportProgress(This->protocol_sink,
|
|
|
|
BINDSTATUS_MIMETYPEAVAILABLE, szStatusText);
|
|
|
|
default:
|
|
|
|
FIXME("unsupported ulStatusCode %u\n", ulStatusCode);
|
|
|
|
}
|
|
|
|
|
2007-01-23 19:45:27 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InternetProtocolSink_ReportData(IInternetProtocolSink *iface,
|
|
|
|
DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTSINK_THIS(iface);
|
2007-01-23 19:36:09 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%d %u %u)\n", This, grfBSCF, ulProgress, ulProgressMax);
|
|
|
|
|
|
|
|
return S_OK;
|
2007-01-23 19:45:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InternetProtocolSink_ReportResult(IInternetProtocolSink *iface,
|
|
|
|
HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
|
|
|
|
{
|
|
|
|
BindProtocol *This = PROTSINK_THIS(iface);
|
2007-01-23 19:36:09 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult));
|
|
|
|
|
|
|
|
return IInternetProtocolSink_ReportResult(This->protocol_sink, hrResult, dwError, szResult);
|
2007-01-23 19:45:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#undef PROTSINK_THIS
|
|
|
|
|
|
|
|
static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = {
|
|
|
|
InternetProtocolSink_QueryInterface,
|
|
|
|
InternetProtocolSink_AddRef,
|
|
|
|
InternetProtocolSink_Release,
|
|
|
|
InternetProtocolSink_Switch,
|
|
|
|
InternetProtocolSink_ReportProgress,
|
|
|
|
InternetProtocolSink_ReportData,
|
|
|
|
InternetProtocolSink_ReportResult
|
|
|
|
};
|
|
|
|
|
2007-01-23 19:33:30 +01:00
|
|
|
HRESULT create_binding_protocol(LPCWSTR url, IInternetProtocol **protocol)
|
|
|
|
{
|
|
|
|
BindProtocol *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(BindProtocol));
|
|
|
|
|
|
|
|
ret->lpInternetProtocolVtbl = &BindProtocolVtbl;
|
|
|
|
ret->lpInternetBindInfoVtbl = &InternetBindInfoVtbl;
|
2007-01-23 19:34:00 +01:00
|
|
|
ret->lpInternetPriorityVtbl = &InternetPriorityVtbl;
|
2007-01-23 19:45:27 +01:00
|
|
|
ret->lpInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl;
|
2007-01-23 19:36:09 +01:00
|
|
|
|
2007-01-23 19:33:30 +01:00
|
|
|
ret->ref = 1;
|
2007-01-23 19:36:09 +01:00
|
|
|
ret->protocol = NULL;
|
|
|
|
ret->bind_info = NULL;
|
|
|
|
ret->protocol_sink = NULL;
|
2007-01-23 23:33:38 +01:00
|
|
|
ret->priority = 0;
|
2007-01-23 19:33:30 +01:00
|
|
|
|
2007-07-24 07:15:19 +02:00
|
|
|
URLMON_LockModule();
|
|
|
|
|
2007-01-23 19:33:30 +01:00
|
|
|
*protocol = PROTOCOL(ret);
|
|
|
|
return S_OK;
|
|
|
|
}
|