Module: wine Branch: master Commit: 52144829d143a52ae868a590bd6ba7a764be1dae URL: http://source.winehq.org/git/wine.git/?a=commit;h=52144829d143a52ae868a590bd...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Nov 23 15:18:31 2012 +0100
wininet: Don't take INTERNET_BUFFERSW as argument in object's ReadFileEx entry.
---
dlls/wininet/ftp.c | 6 +++--- dlls/wininet/http.c | 33 +++++++++++++-------------------- dlls/wininet/internet.c | 10 ++++++++-- dlls/wininet/internet.h | 10 ++++++---- 4 files changed, 30 insertions(+), 29 deletions(-)
diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c index 54dd655..4233bb3 100644 --- a/dlls/wininet/ftp.c +++ b/dlls/wininet/ftp.c @@ -1207,10 +1207,10 @@ static DWORD FTPFILE_ReadFileExA(object_header_t *hdr, INTERNET_BUFFERSA *buffer return FTPFILE_ReadFile(hdr, buffers->lpvBuffer, buffers->dwBufferLength, &buffers->dwBufferLength); }
-static DWORD FTPFILE_ReadFileExW(object_header_t *hdr, INTERNET_BUFFERSW *buffers, +static DWORD FTPFILE_ReadFileEx(object_header_t *hdr, void *buf, DWORD size, DWORD *ret_size, DWORD flags, DWORD_PTR context) { - return FTPFILE_ReadFile(hdr, buffers->lpvBuffer, buffers->dwBufferLength, &buffers->dwBufferLength); + return FTPFILE_ReadFile(hdr, buf, size, ret_size); }
static DWORD FTPFILE_WriteFile(object_header_t *hdr, const void *buffer, DWORD size, DWORD *written) @@ -1300,7 +1300,7 @@ static const object_vtbl_t FTPFILEVtbl = { INET_SetOption, FTPFILE_ReadFile, FTPFILE_ReadFileExA, - FTPFILE_ReadFileExW, + FTPFILE_ReadFileEx, FTPFILE_WriteFile, FTPFILE_QueryDataAvailable, NULL diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 39978b2..c4a98e5 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -2980,31 +2980,27 @@ done:
static void HTTPREQ_AsyncReadFileExWProc(WORKREQUEST *workRequest) { - struct WORKREQ_INTERNETREADFILEEXW const *data = &workRequest->u.InternetReadFileExW; + struct WORKREQ_HTTPREADFILEEX const *data = &workRequest->u.HttpReadFileEx; http_request_t *req = (http_request_t*)workRequest->hdr; DWORD res;
TRACE("INTERNETREADFILEEXW %p\n", workRequest->hdr);
- res = HTTPREQ_Read(req, data->lpBuffersOut->lpvBuffer, - data->lpBuffersOut->dwBufferLength, &data->lpBuffersOut->dwBufferLength, TRUE); + res = HTTPREQ_Read(req, data->buf, data->size, data->ret_read, TRUE);
send_request_complete(req, res == ERROR_SUCCESS, res); }
-static DWORD HTTPREQ_ReadFileExW(object_header_t *hdr, INTERNET_BUFFERSW *buffers, +static DWORD HTTPREQ_ReadFileExW(object_header_t *hdr, void *buf, DWORD size, DWORD *ret_read, DWORD flags, DWORD_PTR context) {
http_request_t *req = (http_request_t*)hdr; - DWORD res, size, read, error = ERROR_SUCCESS; + DWORD res, read, cread, error = ERROR_SUCCESS;
if (flags & ~(IRF_ASYNC|IRF_NO_WAIT)) FIXME("these dwFlags aren't implemented: 0x%x\n", flags & ~(IRF_ASYNC|IRF_NO_WAIT));
- if (buffers->dwStructSize != sizeof(*buffers)) - return ERROR_INVALID_PARAMETER; - INTERNET_SendCallback(&req->hdr, req->hdr.dwContext, INTERNET_STATUS_RECEIVING_RESPONSE, NULL, 0);
if (hdr->dwFlags & INTERNET_FLAG_ASYNC) @@ -3015,9 +3011,7 @@ static DWORD HTTPREQ_ReadFileExW(object_header_t *hdr, INTERNET_BUFFERSW *buffer { if (get_avail_data(req)) { - res = HTTPREQ_Read(req, buffers->lpvBuffer, buffers->dwBufferLength, - &buffers->dwBufferLength, FALSE); - size = buffers->dwBufferLength; + res = HTTPREQ_Read(req, buf, size, &read, FALSE); LeaveCriticalSection( &req->read_section ); goto done; } @@ -3026,7 +3020,9 @@ static DWORD HTTPREQ_ReadFileExW(object_header_t *hdr, INTERNET_BUFFERSW *buffer
workRequest.asyncproc = HTTPREQ_AsyncReadFileExWProc; workRequest.hdr = WININET_AddRef(&req->hdr); - workRequest.u.InternetReadFileExW.lpBuffersOut = buffers; + workRequest.u.HttpReadFileEx.buf = buf; + workRequest.u.HttpReadFileEx.size = size; + workRequest.u.HttpReadFileEx.ret_read = ret_read;
INTERNET_AsyncCall(&workRequest);
@@ -3034,7 +3030,6 @@ static DWORD HTTPREQ_ReadFileExW(object_header_t *hdr, INTERNET_BUFFERSW *buffer }
read = 0; - size = buffers->dwBufferLength;
EnterCriticalSection( &req->read_section ); if(hdr->dwError == ERROR_SUCCESS) @@ -3043,19 +3038,18 @@ static DWORD HTTPREQ_ReadFileExW(object_header_t *hdr, INTERNET_BUFFERSW *buffer hdr->dwError = ERROR_INTERNET_INTERNAL_ERROR;
while(1) { - res = HTTPREQ_Read(req, (char*)buffers->lpvBuffer+read, size-read, - &buffers->dwBufferLength, !(flags & IRF_NO_WAIT)); + res = HTTPREQ_Read(req, (char*)buf+read, size-read, &cread, !(flags & IRF_NO_WAIT)); if(res != ERROR_SUCCESS) break;
- read += buffers->dwBufferLength; + read += cread; if(read == size || end_of_read_data(req)) break;
LeaveCriticalSection( &req->read_section );
INTERNET_SendCallback(&req->hdr, req->hdr.dwContext, INTERNET_STATUS_RESPONSE_RECEIVED, - &buffers->dwBufferLength, sizeof(buffers->dwBufferLength)); + &cread, sizeof(cread)); INTERNET_SendCallback(&req->hdr, req->hdr.dwContext, INTERNET_STATUS_RECEIVING_RESPONSE, NULL, 0);
@@ -3068,13 +3062,12 @@ static DWORD HTTPREQ_ReadFileExW(object_header_t *hdr, INTERNET_BUFFERSW *buffer error = hdr->dwError;
LeaveCriticalSection( &req->read_section ); - size = buffers->dwBufferLength; - buffers->dwBufferLength = read;
done: + *ret_read = read; if (res == ERROR_SUCCESS) { INTERNET_SendCallback(&req->hdr, req->hdr.dwContext, INTERNET_STATUS_RESPONSE_RECEIVED, - &size, sizeof(size)); + &read, sizeof(read)); }
return res==ERROR_SUCCESS ? error : res; diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 8d610c3..48fe41d 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -2269,14 +2269,20 @@ BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer,
TRACE("(%p %p 0x%x 0x%lx)\n", hFile, lpBuffer, dwFlags, dwContext);
+ if (lpBuffer->dwStructSize != sizeof(*lpBuffer)) { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + hdr = get_handle_object(hFile); if (!hdr) { INTERNET_SetLastError(ERROR_INVALID_HANDLE); return FALSE; }
- if(hdr->vtbl->ReadFileExW) - res = hdr->vtbl->ReadFileExW(hdr, lpBuffer, dwFlags, dwContext); + if(hdr->vtbl->ReadFileEx) + res = hdr->vtbl->ReadFileEx(hdr, lpBuffer->lpvBuffer, lpBuffer->dwBufferLength, &lpBuffer->dwBufferLength, + dwFlags, dwContext);
WININET_Release(hdr);
diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index 09db338..4e25a93 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -234,7 +234,7 @@ typedef struct { DWORD (*SetOption)(object_header_t*,DWORD,void*,DWORD); DWORD (*ReadFile)(object_header_t*,void*,DWORD,DWORD*); DWORD (*ReadFileExA)(object_header_t*,INTERNET_BUFFERSA*,DWORD,DWORD_PTR); - DWORD (*ReadFileExW)(object_header_t*,INTERNET_BUFFERSW*,DWORD,DWORD_PTR); + DWORD (*ReadFileEx)(object_header_t*,void*,DWORD,DWORD*,DWORD,DWORD_PTR); DWORD (*WriteFile)(object_header_t*,const void*,DWORD,DWORD*); DWORD (*QueryDataAvailable)(object_header_t*,DWORD*,DWORD,DWORD_PTR); DWORD (*FindNextFileW)(object_header_t*,void*); @@ -467,9 +467,11 @@ struct WORKREQ_INTERNETREADFILEEXA LPINTERNET_BUFFERSA lpBuffersOut; };
-struct WORKREQ_INTERNETREADFILEEXW +struct WORKREQ_HTTPREADFILEEX { - LPINTERNET_BUFFERSW lpBuffersOut; + void *buf; + DWORD size; + DWORD *ret_read; };
typedef struct WORKREQ @@ -494,7 +496,7 @@ typedef struct WORKREQ struct WORKREQ_SENDCALLBACK SendCallback; struct WORKREQ_INTERNETOPENURLW InternetOpenUrlW; struct WORKREQ_INTERNETREADFILEEXA InternetReadFileExA; - struct WORKREQ_INTERNETREADFILEEXW InternetReadFileExW; + struct WORKREQ_HTTPREADFILEEX HttpReadFileEx; } u;
} WORKREQUEST, *LPWORKREQUEST;