Rob Shearman : urlmon: Check the return value of ReadFile and return INET_E_DOWNLOAD_FAILURE is it fails .

Alexandre Julliard julliard at winehq.org
Sat Feb 16 09:57:26 CST 2008


Module: wine
Branch: master
Commit: 229e024a53b12b152dc983bac4fd3f9389ae4b08
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=229e024a53b12b152dc983bac4fd3f9389ae4b08

Author: Rob Shearman <rob at codeweavers.com>
Date:   Fri Feb 15 10:09:25 2008 +0000

urlmon: Check the return value of ReadFile and return INET_E_DOWNLOAD_FAILURE is it fails.

Initialise *pcbRead to zero, if the parameter is not NULL.

---

 dlls/urlmon/file.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/dlls/urlmon/file.c b/dlls/urlmon/file.c
index 41ee617..91aca2c 100644
--- a/dlls/urlmon/file.c
+++ b/dlls/urlmon/file.c
@@ -229,10 +229,14 @@ static HRESULT WINAPI FileProtocol_Read(IInternetProtocol *iface, void *pv,
 
     TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
 
+    if (pcbRead)
+        *pcbRead = 0;
+
     if(!This->file)
         return INET_E_DATA_NOT_AVAILABLE;
 
-    ReadFile(This->file, pv, cb, &read, NULL);
+    if (!ReadFile(This->file, pv, cb, &read, NULL))
+        return INET_E_DOWNLOAD_FAILURE;
 
     if(pcbRead)
         *pcbRead = read;




More information about the wine-cvs mailing list