forked from Mirrors/wine-wine
urlmon: Add new on_error function to protocol vtbl.
parent
2b5c18c35b
commit
4121ac1224
|
@ -99,13 +99,19 @@ static void FtpProtocol_close_connection(Protocol *prot)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void FtpProtocol_on_error(Protocol *prot, DWORD error)
|
||||||
|
{
|
||||||
|
FIXME("(%p) %d - stub\n", prot, error);
|
||||||
|
}
|
||||||
|
|
||||||
#undef ASYNCPROTOCOL_THIS
|
#undef ASYNCPROTOCOL_THIS
|
||||||
|
|
||||||
static const ProtocolVtbl AsyncProtocolVtbl = {
|
static const ProtocolVtbl AsyncProtocolVtbl = {
|
||||||
FtpProtocol_open_request,
|
FtpProtocol_open_request,
|
||||||
FtpProtocol_end_request,
|
FtpProtocol_end_request,
|
||||||
FtpProtocol_start_downloading,
|
FtpProtocol_start_downloading,
|
||||||
FtpProtocol_close_connection
|
FtpProtocol_close_connection,
|
||||||
|
FtpProtocol_on_error
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT WINAPI FtpProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
|
static HRESULT WINAPI FtpProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
|
||||||
|
|
|
@ -70,13 +70,19 @@ static void GopherProtocol_close_connection(Protocol *prot)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GopherProtocol_on_error(Protocol *prot, DWORD error)
|
||||||
|
{
|
||||||
|
FIXME("(%p) %d - stub\n", prot, error);
|
||||||
|
}
|
||||||
|
|
||||||
#undef ASYNCPROTOCOL_THIS
|
#undef ASYNCPROTOCOL_THIS
|
||||||
|
|
||||||
static const ProtocolVtbl AsyncProtocolVtbl = {
|
static const ProtocolVtbl AsyncProtocolVtbl = {
|
||||||
GopherProtocol_open_request,
|
GopherProtocol_open_request,
|
||||||
GopherProtocol_end_request,
|
GopherProtocol_end_request,
|
||||||
GopherProtocol_start_downloading,
|
GopherProtocol_start_downloading,
|
||||||
GopherProtocol_close_connection
|
GopherProtocol_close_connection,
|
||||||
|
GopherProtocol_on_error
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PROTOCOL_THIS(iface) DEFINE_THIS(GopherProtocol, IInternetProtocol, iface)
|
#define PROTOCOL_THIS(iface) DEFINE_THIS(GopherProtocol, IInternetProtocol, iface)
|
||||||
|
|
|
@ -388,13 +388,19 @@ static void HttpProtocol_close_connection(Protocol *prot)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void HttpProtocol_on_error(Protocol *prot, DWORD error)
|
||||||
|
{
|
||||||
|
FIXME("(%p) %d - stub\n", prot, error);
|
||||||
|
}
|
||||||
|
|
||||||
#undef ASYNCPROTOCOL_THIS
|
#undef ASYNCPROTOCOL_THIS
|
||||||
|
|
||||||
static const ProtocolVtbl AsyncProtocolVtbl = {
|
static const ProtocolVtbl AsyncProtocolVtbl = {
|
||||||
HttpProtocol_open_request,
|
HttpProtocol_open_request,
|
||||||
HttpProtocol_end_request,
|
HttpProtocol_end_request,
|
||||||
HttpProtocol_start_downloading,
|
HttpProtocol_start_downloading,
|
||||||
HttpProtocol_close_connection
|
HttpProtocol_close_connection,
|
||||||
|
HttpProtocol_on_error
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT WINAPI HttpProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
|
static HRESULT WINAPI HttpProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
|
||||||
|
|
|
@ -76,25 +76,27 @@ static void request_complete(Protocol *protocol, INTERNET_ASYNC_RESULT *ar)
|
||||||
|
|
||||||
TRACE("(%p)->(%p)\n", protocol, ar);
|
TRACE("(%p)->(%p)\n", protocol, ar);
|
||||||
|
|
||||||
if(!ar->dwResult) {
|
|
||||||
WARN("request failed: %d\n", ar->dwError);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
protocol->flags |= FLAG_REQUEST_COMPLETE;
|
|
||||||
|
|
||||||
if(!protocol->request) {
|
|
||||||
TRACE("setting request handle %p\n", (HINTERNET)ar->dwResult);
|
|
||||||
protocol->request = (HINTERNET)ar->dwResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PROTOCOLDATA same as native */
|
/* PROTOCOLDATA same as native */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
data.dwState = 0xf1000000;
|
data.dwState = 0xf1000000;
|
||||||
if(protocol->flags & FLAG_FIRST_CONTINUE_COMPLETE)
|
|
||||||
data.pData = (LPVOID)BINDSTATUS_ENDDOWNLOADCOMPONENTS;
|
if(ar->dwResult) {
|
||||||
else
|
protocol->flags |= FLAG_REQUEST_COMPLETE;
|
||||||
data.pData = (LPVOID)BINDSTATUS_DOWNLOADINGDATA;
|
|
||||||
|
if(!protocol->request) {
|
||||||
|
TRACE("setting request handle %p\n", (HINTERNET)ar->dwResult);
|
||||||
|
protocol->request = (HINTERNET)ar->dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(protocol->flags & FLAG_FIRST_CONTINUE_COMPLETE)
|
||||||
|
data.pData = (LPVOID)BINDSTATUS_ENDDOWNLOADCOMPONENTS;
|
||||||
|
else
|
||||||
|
data.pData = (LPVOID)BINDSTATUS_DOWNLOADINGDATA;
|
||||||
|
|
||||||
|
}else {
|
||||||
|
protocol->flags |= FLAG_ERROR;
|
||||||
|
data.pData = (LPVOID)ar->dwError;
|
||||||
|
}
|
||||||
|
|
||||||
if (protocol->bindf & BINDF_FROMURLMON)
|
if (protocol->bindf & BINDF_FROMURLMON)
|
||||||
IInternetProtocolSink_Switch(protocol->protocol_sink, &data);
|
IInternetProtocolSink_Switch(protocol->protocol_sink, &data);
|
||||||
|
@ -301,6 +303,12 @@ HRESULT protocol_continue(Protocol *protocol, PROTOCOLDATA *data)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(protocol->flags & FLAG_ERROR) {
|
||||||
|
protocol->flags &= ~FLAG_ERROR;
|
||||||
|
protocol->vtbl->on_error(protocol, (DWORD)data->pData);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if(protocol->post_stream)
|
if(protocol->post_stream)
|
||||||
return write_post_stream(protocol);
|
return write_post_stream(protocol);
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,7 @@ struct ProtocolVtbl {
|
||||||
HRESULT (*end_request)(Protocol*);
|
HRESULT (*end_request)(Protocol*);
|
||||||
HRESULT (*start_downloading)(Protocol*);
|
HRESULT (*start_downloading)(Protocol*);
|
||||||
void (*close_connection)(Protocol*);
|
void (*close_connection)(Protocol*);
|
||||||
|
void (*on_error)(Protocol*,DWORD);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Flags are needed for, among other things, return HRESULTs from the Read function
|
/* Flags are needed for, among other things, return HRESULTs from the Read function
|
||||||
|
@ -144,6 +145,7 @@ struct ProtocolVtbl {
|
||||||
#define FLAG_ALL_DATA_READ 0x0008
|
#define FLAG_ALL_DATA_READ 0x0008
|
||||||
#define FLAG_LAST_DATA_REPORTED 0x0010
|
#define FLAG_LAST_DATA_REPORTED 0x0010
|
||||||
#define FLAG_RESULT_REPORTED 0x0020
|
#define FLAG_RESULT_REPORTED 0x0020
|
||||||
|
#define FLAG_ERROR 0x0040
|
||||||
|
|
||||||
HRESULT protocol_start(Protocol*,IInternetProtocol*,IUri*,IInternetProtocolSink*,IInternetBindInfo*);
|
HRESULT protocol_start(Protocol*,IInternetProtocol*,IUri*,IInternetProtocolSink*,IInternetBindInfo*);
|
||||||
HRESULT protocol_continue(Protocol*,PROTOCOLDATA*);
|
HRESULT protocol_continue(Protocol*,PROTOCOLDATA*);
|
||||||
|
|
Loading…
Reference in New Issue