Jacek Caban : wininet: Use generic ReadFileEx entry in InternetReadFileExA and get rid of ReadFileExA entry .
Alexandre Julliard
julliard at winehq.org
Fri Nov 23 12:53:23 CST 2012
Module: wine
Branch: master
Commit: 5554292284db0bb5e7815a5c0419983689547984
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5554292284db0bb5e7815a5c0419983689547984
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Nov 23 15:18:52 2012 +0100
wininet: Use generic ReadFileEx entry in InternetReadFileExA and get rid of ReadFileExA entry.
---
dlls/wininet/ftp.c | 8 ----
dlls/wininet/http.c | 106 +----------------------------------------------
dlls/wininet/internet.c | 11 ++++-
dlls/wininet/internet.h | 7 ---
4 files changed, 10 insertions(+), 122 deletions(-)
diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c
index 4233bb3..f816898 100644
--- a/dlls/wininet/ftp.c
+++ b/dlls/wininet/ftp.c
@@ -1201,12 +1201,6 @@ static DWORD FTPFILE_ReadFile(object_header_t *hdr, void *buffer, DWORD size, DW
return error;
}
-static DWORD FTPFILE_ReadFileExA(object_header_t *hdr, INTERNET_BUFFERSA *buffers,
- DWORD flags, DWORD_PTR context)
-{
- return FTPFILE_ReadFile(hdr, buffers->lpvBuffer, buffers->dwBufferLength, &buffers->dwBufferLength);
-}
-
static DWORD FTPFILE_ReadFileEx(object_header_t *hdr, void *buf, DWORD size, DWORD *ret_size,
DWORD flags, DWORD_PTR context)
{
@@ -1299,7 +1293,6 @@ static const object_vtbl_t FTPFILEVtbl = {
FTPFILE_QueryOption,
INET_SetOption,
FTPFILE_ReadFile,
- FTPFILE_ReadFileExA,
FTPFILE_ReadFileEx,
FTPFILE_WriteFile,
FTPFILE_QueryDataAvailable,
@@ -3479,7 +3472,6 @@ static const object_vtbl_t FTPFINDNEXTVtbl = {
NULL,
NULL,
NULL,
- NULL,
FTPFINDNEXT_FindNextFileW
};
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index c4a98e5..383b907 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -2877,107 +2877,6 @@ static DWORD HTTPREQ_ReadFile(object_header_t *hdr, void *buffer, DWORD size, DW
return res;
}
-static void HTTPREQ_AsyncReadFileExAProc(WORKREQUEST *workRequest)
-{
- struct WORKREQ_INTERNETREADFILEEXA const *data = &workRequest->u.InternetReadFileExA;
- http_request_t *req = (http_request_t*)workRequest->hdr;
- DWORD res;
-
- TRACE("INTERNETREADFILEEXA %p\n", workRequest->hdr);
-
- res = HTTPREQ_Read(req, data->lpBuffersOut->lpvBuffer,
- data->lpBuffersOut->dwBufferLength, &data->lpBuffersOut->dwBufferLength, TRUE);
-
- send_request_complete(req, res == ERROR_SUCCESS, res);
-}
-
-static DWORD HTTPREQ_ReadFileExA(object_header_t *hdr, INTERNET_BUFFERSA *buffers,
- DWORD flags, DWORD_PTR context)
-{
- http_request_t *req = (http_request_t*)hdr;
- DWORD res, size, read, 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)
- {
- WORKREQUEST workRequest;
-
- if (TryEnterCriticalSection( &req->read_section ))
- {
- if (get_avail_data(req))
- {
- res = HTTPREQ_Read(req, buffers->lpvBuffer, buffers->dwBufferLength,
- &buffers->dwBufferLength, FALSE);
- size = buffers->dwBufferLength;
- LeaveCriticalSection( &req->read_section );
- goto done;
- }
- LeaveCriticalSection( &req->read_section );
- }
-
- workRequest.asyncproc = HTTPREQ_AsyncReadFileExAProc;
- workRequest.hdr = WININET_AddRef(&req->hdr);
- workRequest.u.InternetReadFileExA.lpBuffersOut = buffers;
-
- INTERNET_AsyncCall(&workRequest);
-
- return ERROR_IO_PENDING;
- }
-
- read = 0;
- size = buffers->dwBufferLength;
-
- EnterCriticalSection( &req->read_section );
- if(hdr->dwError == ERROR_SUCCESS)
- hdr->dwError = INTERNET_HANDLE_IN_USE;
- else if(hdr->dwError == INTERNET_HANDLE_IN_USE)
- hdr->dwError = ERROR_INTERNET_INTERNAL_ERROR;
-
- while(1) {
- res = HTTPREQ_Read(req, (char*)buffers->lpvBuffer+read, size-read,
- &buffers->dwBufferLength, !(flags & IRF_NO_WAIT));
- if(res != ERROR_SUCCESS)
- break;
-
- read += buffers->dwBufferLength;
- 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));
- INTERNET_SendCallback(&req->hdr, req->hdr.dwContext,
- INTERNET_STATUS_RECEIVING_RESPONSE, NULL, 0);
-
- EnterCriticalSection( &req->read_section );
- }
-
- if(hdr->dwError == INTERNET_HANDLE_IN_USE)
- hdr->dwError = ERROR_SUCCESS;
- else
- error = hdr->dwError;
-
- LeaveCriticalSection( &req->read_section );
- size = buffers->dwBufferLength;
- buffers->dwBufferLength = read;
-
-done:
- if (res == ERROR_SUCCESS) {
- INTERNET_SendCallback(&req->hdr, req->hdr.dwContext, INTERNET_STATUS_RESPONSE_RECEIVED,
- &size, sizeof(size));
- }
-
- return res==ERROR_SUCCESS ? error : res;
-}
-
static void HTTPREQ_AsyncReadFileExWProc(WORKREQUEST *workRequest)
{
struct WORKREQ_HTTPREADFILEEX const *data = &workRequest->u.HttpReadFileEx;
@@ -2991,7 +2890,7 @@ static void HTTPREQ_AsyncReadFileExWProc(WORKREQUEST *workRequest)
send_request_complete(req, res == ERROR_SUCCESS, res);
}
-static DWORD HTTPREQ_ReadFileExW(object_header_t *hdr, void *buf, DWORD size, DWORD *ret_read,
+static DWORD HTTPREQ_ReadFileEx(object_header_t *hdr, void *buf, DWORD size, DWORD *ret_read,
DWORD flags, DWORD_PTR context)
{
@@ -3144,8 +3043,7 @@ static const object_vtbl_t HTTPREQVtbl = {
HTTPREQ_QueryOption,
HTTPREQ_SetOption,
HTTPREQ_ReadFile,
- HTTPREQ_ReadFileExA,
- HTTPREQ_ReadFileExW,
+ HTTPREQ_ReadFileEx,
HTTPREQ_WriteFile,
HTTPREQ_QueryDataAvailable,
NULL
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 48fe41d..88fe037 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -927,7 +927,6 @@ static const object_vtbl_t APPINFOVtbl = {
NULL,
NULL,
NULL,
- NULL,
NULL
};
@@ -2237,14 +2236,20 @@ BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOu
TRACE("(%p %p 0x%x 0x%lx)\n", hFile, lpBuffersOut, dwFlags, dwContext);
+ if (lpBuffersOut->dwStructSize != sizeof(*lpBuffersOut)) {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
hdr = get_handle_object(hFile);
if (!hdr) {
INTERNET_SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
- if(hdr->vtbl->ReadFileExA)
- res = hdr->vtbl->ReadFileExA(hdr, lpBuffersOut, dwFlags, dwContext);
+ if(hdr->vtbl->ReadFileEx)
+ res = hdr->vtbl->ReadFileEx(hdr, lpBuffersOut->lpvBuffer, lpBuffersOut->dwBufferLength,
+ &lpBuffersOut->dwBufferLength, dwFlags, dwContext);
WININET_Release(hdr);
diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h
index 4e25a93..10002d4 100644
--- a/dlls/wininet/internet.h
+++ b/dlls/wininet/internet.h
@@ -233,7 +233,6 @@ typedef struct {
DWORD (*QueryOption)(object_header_t*,DWORD,void*,DWORD*,BOOL);
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 (*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);
@@ -462,11 +461,6 @@ struct WORKREQ_INTERNETOPENURLW
DWORD_PTR dwContext;
};
-struct WORKREQ_INTERNETREADFILEEXA
-{
- LPINTERNET_BUFFERSA lpBuffersOut;
-};
-
struct WORKREQ_HTTPREADFILEEX
{
void *buf;
@@ -495,7 +489,6 @@ typedef struct WORKREQ
struct WORKREQ_HTTPENDREQUESTW HttpEndRequestW;
struct WORKREQ_SENDCALLBACK SendCallback;
struct WORKREQ_INTERNETOPENURLW InternetOpenUrlW;
- struct WORKREQ_INTERNETREADFILEEXA InternetReadFileExA;
struct WORKREQ_HTTPREADFILEEX HttpReadFileEx;
} u;
More information about the wine-cvs
mailing list