David Hedberg : urlmon: Add new on_error function to protocol vtbl.
Alexandre Julliard
julliard at winehq.org
Mon Jan 3 10:58:03 CST 2011
Module: wine
Branch: master
Commit: 4121ac12243ba94e6a320df9d450976dc06678e1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4121ac12243ba94e6a320df9d450976dc06678e1
Author: David Hedberg <dhedberg at codeweavers.com>
Date: Mon Jan 3 03:47:38 2011 +0100
urlmon: Add new on_error function to protocol vtbl.
---
dlls/urlmon/ftp.c | 8 +++++++-
dlls/urlmon/gopher.c | 8 +++++++-
dlls/urlmon/http.c | 8 +++++++-
dlls/urlmon/protocol.c | 40 ++++++++++++++++++++++++----------------
dlls/urlmon/urlmon_main.h | 2 ++
5 files changed, 47 insertions(+), 19 deletions(-)
diff --git a/dlls/urlmon/ftp.c b/dlls/urlmon/ftp.c
index deb611b..854f169 100644
--- a/dlls/urlmon/ftp.c
+++ b/dlls/urlmon/ftp.c
@@ -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
static const ProtocolVtbl AsyncProtocolVtbl = {
FtpProtocol_open_request,
FtpProtocol_end_request,
FtpProtocol_start_downloading,
- FtpProtocol_close_connection
+ FtpProtocol_close_connection,
+ FtpProtocol_on_error
};
static HRESULT WINAPI FtpProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
diff --git a/dlls/urlmon/gopher.c b/dlls/urlmon/gopher.c
index da241e9..5964882 100644
--- a/dlls/urlmon/gopher.c
+++ b/dlls/urlmon/gopher.c
@@ -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
static const ProtocolVtbl AsyncProtocolVtbl = {
GopherProtocol_open_request,
GopherProtocol_end_request,
GopherProtocol_start_downloading,
- GopherProtocol_close_connection
+ GopherProtocol_close_connection,
+ GopherProtocol_on_error
};
#define PROTOCOL_THIS(iface) DEFINE_THIS(GopherProtocol, IInternetProtocol, iface)
diff --git a/dlls/urlmon/http.c b/dlls/urlmon/http.c
index cfa2fc6..a62323b 100644
--- a/dlls/urlmon/http.c
+++ b/dlls/urlmon/http.c
@@ -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
static const ProtocolVtbl AsyncProtocolVtbl = {
HttpProtocol_open_request,
HttpProtocol_end_request,
HttpProtocol_start_downloading,
- HttpProtocol_close_connection
+ HttpProtocol_close_connection,
+ HttpProtocol_on_error
};
static HRESULT WINAPI HttpProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
diff --git a/dlls/urlmon/protocol.c b/dlls/urlmon/protocol.c
index 2ca1629..1b8b5e3 100644
--- a/dlls/urlmon/protocol.c
+++ b/dlls/urlmon/protocol.c
@@ -76,25 +76,27 @@ static void request_complete(Protocol *protocol, INTERNET_ASYNC_RESULT *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 */
memset(&data, 0, sizeof(data));
data.dwState = 0xf1000000;
- if(protocol->flags & FLAG_FIRST_CONTINUE_COMPLETE)
- data.pData = (LPVOID)BINDSTATUS_ENDDOWNLOADCOMPONENTS;
- else
- data.pData = (LPVOID)BINDSTATUS_DOWNLOADINGDATA;
+
+ if(ar->dwResult) {
+ protocol->flags |= FLAG_REQUEST_COMPLETE;
+
+ 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)
IInternetProtocolSink_Switch(protocol->protocol_sink, &data);
@@ -301,6 +303,12 @@ HRESULT protocol_continue(Protocol *protocol, PROTOCOLDATA *data)
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)
return write_post_stream(protocol);
diff --git a/dlls/urlmon/urlmon_main.h b/dlls/urlmon/urlmon_main.h
index dc6d3fc..719c2eb 100644
--- a/dlls/urlmon/urlmon_main.h
+++ b/dlls/urlmon/urlmon_main.h
@@ -113,6 +113,7 @@ struct ProtocolVtbl {
HRESULT (*end_request)(Protocol*);
HRESULT (*start_downloading)(Protocol*);
void (*close_connection)(Protocol*);
+ void (*on_error)(Protocol*,DWORD);
};
/* 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_LAST_DATA_REPORTED 0x0010
#define FLAG_RESULT_REPORTED 0x0020
+#define FLAG_ERROR 0x0040
HRESULT protocol_start(Protocol*,IInternetProtocol*,IUri*,IInternetProtocolSink*,IInternetBindInfo*);
HRESULT protocol_continue(Protocol*,PROTOCOLDATA*);
More information about the wine-cvs
mailing list