From 0fabf540e74d502a3a51ebc2e5fe90f1e7933cd0 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Wed, 8 Apr 2009 15:21:28 +0200 Subject: [PATCH] wininet: Keep track of the number of bytes written. --- dlls/wininet/http.c | 10 +++++++++- dlls/wininet/internet.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 7b260705c5..4216e554c1 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 fad69bd3f9..8e92788018 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;