Commit ec6a17fa authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

qmgr: Job error codes are HRESULT values.

parent 13af267e
...@@ -201,7 +201,7 @@ HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner, ...@@ -201,7 +201,7 @@ HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner,
return S_OK; return S_OK;
} }
static HRESULT error_from_http_response(DWORD code) static HRESULT hresult_from_http_response(DWORD code)
{ {
switch (code) switch (code)
{ {
...@@ -239,7 +239,7 @@ static void CALLBACK progress_callback_http(HINTERNET handle, DWORD_PTR context, ...@@ -239,7 +239,7 @@ static void CALLBACK progress_callback_http(HINTERNET handle, DWORD_PTR context,
if (WinHttpQueryHeaders(handle, WINHTTP_QUERY_STATUS_CODE|WINHTTP_QUERY_FLAG_NUMBER, if (WinHttpQueryHeaders(handle, WINHTTP_QUERY_STATUS_CODE|WINHTTP_QUERY_FLAG_NUMBER,
NULL, &code, &size, NULL)) NULL, &code, &size, NULL))
{ {
if ((job->error.code = error_from_http_response(code))) if ((job->error.code = hresult_from_http_response(code)))
{ {
EnterCriticalSection(&job->cs); EnterCriticalSection(&job->cs);
...@@ -281,7 +281,7 @@ static void CALLBACK progress_callback_http(HINTERNET handle, DWORD_PTR context, ...@@ -281,7 +281,7 @@ static void CALLBACK progress_callback_http(HINTERNET handle, DWORD_PTR context,
case WINHTTP_CALLBACK_STATUS_REQUEST_ERROR: case WINHTTP_CALLBACK_STATUS_REQUEST_ERROR:
{ {
WINHTTP_ASYNC_RESULT *result = (WINHTTP_ASYNC_RESULT *)buf; WINHTTP_ASYNC_RESULT *result = (WINHTTP_ASYNC_RESULT *)buf;
job->error.code = result->dwError; job->error.code = HRESULT_FROM_WIN32(result->dwError);
transitionJobState(job, BG_JOB_STATE_TRANSFERRING, BG_JOB_STATE_ERROR); transitionJobState(job, BG_JOB_STATE_TRANSFERRING, BG_JOB_STATE_ERROR);
break; break;
} }
...@@ -386,10 +386,10 @@ static BOOL transfer_file_http(BackgroundCopyFileImpl *file, URL_COMPONENTSW *uc ...@@ -386,10 +386,10 @@ static BOOL transfer_file_http(BackgroundCopyFileImpl *file, URL_COMPONENTSW *uc
if (!set_request_credentials(req, job)) goto done; if (!set_request_credentials(req, job)) goto done;
if (!(WinHttpSendRequest(req, job->http_options.headers, ~0u, NULL, 0, 0, (DWORD_PTR)file))) goto done; if (!(WinHttpSendRequest(req, job->http_options.headers, ~0u, NULL, 0, 0, (DWORD_PTR)file))) goto done;
if (wait_for_completion(job) || job->error.code) goto done; if (wait_for_completion(job) || FAILED(job->error.code)) goto done;
if (!(WinHttpReceiveResponse(req, NULL))) goto done; if (!(WinHttpReceiveResponse(req, NULL))) goto done;
if (wait_for_completion(job) || job->error.code) goto done; if (wait_for_completion(job) || FAILED(job->error.code)) goto done;
transitionJobState(job, BG_JOB_STATE_CONNECTING, BG_JOB_STATE_TRANSFERRING); transitionJobState(job, BG_JOB_STATE_CONNECTING, BG_JOB_STATE_TRANSFERRING);
...@@ -400,7 +400,7 @@ static BOOL transfer_file_http(BackgroundCopyFileImpl *file, URL_COMPONENTSW *uc ...@@ -400,7 +400,7 @@ static BOOL transfer_file_http(BackgroundCopyFileImpl *file, URL_COMPONENTSW *uc
{ {
file->read_size = 0; file->read_size = 0;
if (!(ret = WinHttpReadData(req, buf, sizeof(buf), NULL))) break; if (!(ret = WinHttpReadData(req, buf, sizeof(buf), NULL))) break;
if (wait_for_completion(job) || job->error.code) if (wait_for_completion(job) || FAILED(job->error.code))
{ {
ret = FALSE; ret = FALSE;
break; break;
......
...@@ -371,7 +371,8 @@ static HRESULT WINAPI BackgroundCopyJob_Resume( ...@@ -371,7 +371,8 @@ static HRESULT WINAPI BackgroundCopyJob_Resume(
&& This->state != BG_JOB_STATE_TRANSFERRING) && This->state != BG_JOB_STATE_TRANSFERRING)
{ {
This->state = BG_JOB_STATE_QUEUED; This->state = BG_JOB_STATE_QUEUED;
This->error.context = This->error.code = 0; This->error.context = 0;
This->error.code = S_OK;
if (This->error.file) if (This->error.file)
{ {
IBackgroundCopyFile2_Release(This->error.file); IBackgroundCopyFile2_Release(This->error.file);
...@@ -1245,7 +1246,7 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, GUID ...@@ -1245,7 +1246,7 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, GUID
This->callback2 = FALSE; This->callback2 = FALSE;
This->error.context = 0; This->error.context = 0;
This->error.code = 0; This->error.code = S_OK;
This->error.file = NULL; This->error.file = NULL;
memset(&This->http_options, 0, sizeof(This->http_options)); memset(&This->http_options, 0, sizeof(This->http_options));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment