[1/5] wininet: Keep track of the number of bytes written.

Hans Leidekker hans at meelstraat.net
Wed Apr 8 08:21:28 CDT 2009


diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 7b26070..4216e55 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -1875,9 +1875,14 @@ static DWORD HTTPREQ_ReadFileExW(WININETHANDLEHEADER *hdr, INTERNET_BUFFERSW *bu
 
 static BOOL HTTPREQ_WriteFile(WININETHANDLEHEADER *hdr, const void *buffer, DWORD size, DWORD *written)
 {
+    BOOL ret;
     LPWININETHTTPREQW lpwhr = (LPWININETHTTPREQW)hdr;
 
-    return NETCON_send(&lpwhr->netConnection, buffer, size, 0, (LPINT)written);
+    *written = 0;
+    if ((ret = NETCON_send(&lpwhr->netConnection, buffer, size, 0, (LPINT)written)))
+        lpwhr->dwBytesWritten += *written;
+
+    return ret;
 }
 
 static void HTTPREQ_AsyncQueryDataAvailableProc(WORKREQUEST *workRequest)
@@ -3259,6 +3264,7 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
     {
         sprintfW(contentLengthStr, szContentLength, dwContentLength);
         HTTP_HttpAddRequestHeadersW(lpwhr, contentLengthStr, -1L, HTTP_ADDREQ_FLAG_ADD_IF_NEW);
+        lpwhr->dwBytesToWrite = dwContentLength;
     }
     if (lpwhr->lpHttpSession->lpAppInfo->lpszAgent)
     {
@@ -3357,6 +3363,8 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
         NETCON_send(&lpwhr->netConnection, ascii_req, len, 0, &cnt);
         HeapFree( GetProcessHeap(), 0, ascii_req );
 
+        lpwhr->dwBytesWritten = dwOptionalLength;
+
         INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
                               INTERNET_STATUS_REQUEST_SENT,
                               &len, sizeof(DWORD));
diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h
index fad69bd..8e92788 100644
--- a/dlls/wininet/internet.h
+++ b/dlls/wininet/internet.h
@@ -198,6 +198,8 @@ typedef struct
     LPWSTR lpszStatusText;
     DWORD dwContentLength; /* total number of bytes to be read */
     DWORD dwContentRead; /* bytes of the content read so far */
+    DWORD dwBytesToWrite;
+    DWORD dwBytesWritten;
     HTTPHEADERW *pCustHeaders;
     DWORD nCustHeaders;
     HANDLE hCacheFile;



More information about the wine-patches mailing list