wininet: Use generic ReadFileEx entry in InternetReadFileExA and get rid of ReadFileExA entry.
This commit is contained in:
parent
52144829d1
commit
5554292284
|
@ -1201,12 +1201,6 @@ static DWORD FTPFILE_ReadFile(object_header_t *hdr, void *buffer, DWORD size, DW
|
||||||
return error;
|
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,
|
static DWORD FTPFILE_ReadFileEx(object_header_t *hdr, void *buf, DWORD size, DWORD *ret_size,
|
||||||
DWORD flags, DWORD_PTR context)
|
DWORD flags, DWORD_PTR context)
|
||||||
{
|
{
|
||||||
|
@ -1299,7 +1293,6 @@ static const object_vtbl_t FTPFILEVtbl = {
|
||||||
FTPFILE_QueryOption,
|
FTPFILE_QueryOption,
|
||||||
INET_SetOption,
|
INET_SetOption,
|
||||||
FTPFILE_ReadFile,
|
FTPFILE_ReadFile,
|
||||||
FTPFILE_ReadFileExA,
|
|
||||||
FTPFILE_ReadFileEx,
|
FTPFILE_ReadFileEx,
|
||||||
FTPFILE_WriteFile,
|
FTPFILE_WriteFile,
|
||||||
FTPFILE_QueryDataAvailable,
|
FTPFILE_QueryDataAvailable,
|
||||||
|
@ -3479,7 +3472,6 @@ static const object_vtbl_t FTPFINDNEXTVtbl = {
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
|
||||||
FTPFINDNEXT_FindNextFileW
|
FTPFINDNEXT_FindNextFileW
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2877,107 +2877,6 @@ static DWORD HTTPREQ_ReadFile(object_header_t *hdr, void *buffer, DWORD size, DW
|
||||||
return res;
|
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)
|
static void HTTPREQ_AsyncReadFileExWProc(WORKREQUEST *workRequest)
|
||||||
{
|
{
|
||||||
struct WORKREQ_HTTPREADFILEEX const *data = &workRequest->u.HttpReadFileEx;
|
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);
|
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)
|
DWORD flags, DWORD_PTR context)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -3144,8 +3043,7 @@ static const object_vtbl_t HTTPREQVtbl = {
|
||||||
HTTPREQ_QueryOption,
|
HTTPREQ_QueryOption,
|
||||||
HTTPREQ_SetOption,
|
HTTPREQ_SetOption,
|
||||||
HTTPREQ_ReadFile,
|
HTTPREQ_ReadFile,
|
||||||
HTTPREQ_ReadFileExA,
|
HTTPREQ_ReadFileEx,
|
||||||
HTTPREQ_ReadFileExW,
|
|
||||||
HTTPREQ_WriteFile,
|
HTTPREQ_WriteFile,
|
||||||
HTTPREQ_QueryDataAvailable,
|
HTTPREQ_QueryDataAvailable,
|
||||||
NULL
|
NULL
|
||||||
|
|
|
@ -927,7 +927,6 @@ static const object_vtbl_t APPINFOVtbl = {
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
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);
|
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);
|
hdr = get_handle_object(hFile);
|
||||||
if (!hdr) {
|
if (!hdr) {
|
||||||
INTERNET_SetLastError(ERROR_INVALID_HANDLE);
|
INTERNET_SetLastError(ERROR_INVALID_HANDLE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hdr->vtbl->ReadFileExA)
|
if(hdr->vtbl->ReadFileEx)
|
||||||
res = hdr->vtbl->ReadFileExA(hdr, lpBuffersOut, dwFlags, dwContext);
|
res = hdr->vtbl->ReadFileEx(hdr, lpBuffersOut->lpvBuffer, lpBuffersOut->dwBufferLength,
|
||||||
|
&lpBuffersOut->dwBufferLength, dwFlags, dwContext);
|
||||||
|
|
||||||
WININET_Release(hdr);
|
WININET_Release(hdr);
|
||||||
|
|
||||||
|
|
|
@ -233,7 +233,6 @@ typedef struct {
|
||||||
DWORD (*QueryOption)(object_header_t*,DWORD,void*,DWORD*,BOOL);
|
DWORD (*QueryOption)(object_header_t*,DWORD,void*,DWORD*,BOOL);
|
||||||
DWORD (*SetOption)(object_header_t*,DWORD,void*,DWORD);
|
DWORD (*SetOption)(object_header_t*,DWORD,void*,DWORD);
|
||||||
DWORD (*ReadFile)(object_header_t*,void*,DWORD,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 (*ReadFileEx)(object_header_t*,void*,DWORD,DWORD*,DWORD,DWORD_PTR);
|
||||||
DWORD (*WriteFile)(object_header_t*,const void*,DWORD,DWORD*);
|
DWORD (*WriteFile)(object_header_t*,const void*,DWORD,DWORD*);
|
||||||
DWORD (*QueryDataAvailable)(object_header_t*,DWORD*,DWORD,DWORD_PTR);
|
DWORD (*QueryDataAvailable)(object_header_t*,DWORD*,DWORD,DWORD_PTR);
|
||||||
|
@ -462,11 +461,6 @@ struct WORKREQ_INTERNETOPENURLW
|
||||||
DWORD_PTR dwContext;
|
DWORD_PTR dwContext;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct WORKREQ_INTERNETREADFILEEXA
|
|
||||||
{
|
|
||||||
LPINTERNET_BUFFERSA lpBuffersOut;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct WORKREQ_HTTPREADFILEEX
|
struct WORKREQ_HTTPREADFILEEX
|
||||||
{
|
{
|
||||||
void *buf;
|
void *buf;
|
||||||
|
@ -495,7 +489,6 @@ typedef struct WORKREQ
|
||||||
struct WORKREQ_HTTPENDREQUESTW HttpEndRequestW;
|
struct WORKREQ_HTTPENDREQUESTW HttpEndRequestW;
|
||||||
struct WORKREQ_SENDCALLBACK SendCallback;
|
struct WORKREQ_SENDCALLBACK SendCallback;
|
||||||
struct WORKREQ_INTERNETOPENURLW InternetOpenUrlW;
|
struct WORKREQ_INTERNETOPENURLW InternetOpenUrlW;
|
||||||
struct WORKREQ_INTERNETREADFILEEXA InternetReadFileExA;
|
|
||||||
struct WORKREQ_HTTPREADFILEEX HttpReadFileEx;
|
struct WORKREQ_HTTPREADFILEEX HttpReadFileEx;
|
||||||
} u;
|
} u;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue