wininet: Handle async mode in HTTPREQ_ReadFile.
Signed-off-by: Michael Müller <michael@fds-team.de> Signed-off-by: Sebastian Lackner <sebastian@fds-team.de> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
45459965aa
commit
221590213e
|
@ -3101,23 +3101,6 @@ static BOOL drain_content(http_request_t *req, BOOL blocking)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD HTTPREQ_ReadFile(object_header_t *hdr, void *buffer, DWORD size, DWORD *read)
|
|
||||||
{
|
|
||||||
http_request_t *req = (http_request_t*)hdr;
|
|
||||||
DWORD res;
|
|
||||||
|
|
||||||
EnterCriticalSection( &req->read_section );
|
|
||||||
if(hdr->dwError == INTERNET_HANDLE_IN_USE)
|
|
||||||
hdr->dwError = ERROR_INTERNET_INTERNAL_ERROR;
|
|
||||||
|
|
||||||
res = HTTPREQ_Read(req, buffer, size, read);
|
|
||||||
if(res == ERROR_SUCCESS)
|
|
||||||
res = hdr->dwError;
|
|
||||||
LeaveCriticalSection( &req->read_section );
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
task_header_t hdr;
|
task_header_t hdr;
|
||||||
void *buf;
|
void *buf;
|
||||||
|
@ -3241,6 +3224,49 @@ static DWORD HTTPREQ_WriteFile(object_header_t *hdr, const void *buffer, DWORD s
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DWORD HTTPREQ_ReadFile(object_header_t *hdr, void *buffer, DWORD size, DWORD *read)
|
||||||
|
{
|
||||||
|
http_request_t *req = (http_request_t*)hdr;
|
||||||
|
DWORD res;
|
||||||
|
|
||||||
|
if (req->session->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
||||||
|
{
|
||||||
|
read_file_ex_task_t *task;
|
||||||
|
|
||||||
|
if (TryEnterCriticalSection( &req->read_section ))
|
||||||
|
{
|
||||||
|
if (get_avail_data(req))
|
||||||
|
{
|
||||||
|
res = HTTPREQ_Read(req, buffer, size, read);
|
||||||
|
LeaveCriticalSection( &req->read_section );
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
LeaveCriticalSection( &req->read_section );
|
||||||
|
}
|
||||||
|
|
||||||
|
task = alloc_async_task(&req->hdr, AsyncReadFileExProc, sizeof(*task));
|
||||||
|
task->buf = buffer;
|
||||||
|
task->size = size;
|
||||||
|
task->ret_read = read;
|
||||||
|
|
||||||
|
*read = 0;
|
||||||
|
INTERNET_AsyncCall(&task->hdr);
|
||||||
|
|
||||||
|
return ERROR_IO_PENDING;
|
||||||
|
}
|
||||||
|
|
||||||
|
EnterCriticalSection( &req->read_section );
|
||||||
|
if(hdr->dwError == INTERNET_HANDLE_IN_USE)
|
||||||
|
hdr->dwError = ERROR_INTERNET_INTERNAL_ERROR;
|
||||||
|
|
||||||
|
res = HTTPREQ_Read(req, buffer, size, read);
|
||||||
|
if(res == ERROR_SUCCESS)
|
||||||
|
res = hdr->dwError;
|
||||||
|
LeaveCriticalSection( &req->read_section );
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
task_header_t hdr;
|
task_header_t hdr;
|
||||||
DWORD *ret_size;
|
DWORD *ret_size;
|
||||||
|
|
Loading…
Reference in New Issue