Commit 88ac3a38 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

wininet: Return error directly from INTERNET_AsyncCall.

parent 8b805e48
......@@ -217,6 +217,13 @@ static BOOL FTP_FtpGetFileW(ftp_session_t*, LPCWSTR lpszRemoteFile, LPCWSTR lpsz
BOOL fFailIfExists, DWORD dwLocalFlagsAttribute, DWORD dwInternetFlags,
DWORD_PTR dwContext);
/* A temporary helper until we get rid of INTERNET_GetLastError calls */
static BOOL res_to_le(DWORD res)
{
if(res != ERROR_SUCCESS)
INTERNET_SetLastError(res);
return res == ERROR_SUCCESS;
}
/***********************************************************************
* FtpPutFileA (WININET.@)
......@@ -319,7 +326,7 @@ BOOL WINAPI FtpPutFileW(HINTERNET hConnect, LPCWSTR lpszLocalFile,
req->dwFlags = dwFlags;
req->dwContext = dwContext;
r = INTERNET_AsyncCall(&workRequest);
r = res_to_le(INTERNET_AsyncCall(&workRequest));
}
else
{
......@@ -489,7 +496,7 @@ BOOL WINAPI FtpSetCurrentDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory)
req = &workRequest.u.FtpSetCurrentDirectoryW;
req->lpszDirectory = heap_strdupW(lpszDirectory);
r = INTERNET_AsyncCall(&workRequest);
r = res_to_le(INTERNET_AsyncCall(&workRequest));
}
else
{
......@@ -639,7 +646,7 @@ BOOL WINAPI FtpCreateDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory)
req = &workRequest.u.FtpCreateDirectoryW;
req->lpszDirectory = heap_strdupW(lpszDirectory);
r = INTERNET_AsyncCall(&workRequest);
r = res_to_le(INTERNET_AsyncCall(&workRequest));
}
else
{
......@@ -1000,7 +1007,7 @@ BOOL WINAPI FtpGetCurrentDirectoryW(HINTERNET hFtpSession, LPWSTR lpszCurrentDir
req->lpszDirectory = lpszCurrentDirectory;
req->lpdwDirectory = lpdwCurrentDirectory;
r = INTERNET_AsyncCall(&workRequest);
r = res_to_le(INTERNET_AsyncCall(&workRequest));
}
else
{
......@@ -1658,7 +1665,7 @@ BOOL WINAPI FtpGetFileW(HINTERNET hInternet, LPCWSTR lpszRemoteFile, LPCWSTR lps
req->dwFlags = dwInternetFlags;
req->dwContext = dwContext;
r = INTERNET_AsyncCall(&workRequest);
r = res_to_le(INTERNET_AsyncCall(&workRequest));
}
else
{
......@@ -1847,7 +1854,7 @@ BOOL WINAPI FtpDeleteFileW(HINTERNET hFtpSession, LPCWSTR lpszFileName)
req = &workRequest.u.FtpDeleteFileW;
req->lpszFilename = heap_strdupW(lpszFileName);
r = INTERNET_AsyncCall(&workRequest);
r = res_to_le(INTERNET_AsyncCall(&workRequest));
}
else
{
......@@ -1992,7 +1999,7 @@ BOOL WINAPI FtpRemoveDirectoryW(HINTERNET hFtpSession, LPCWSTR lpszDirectory)
req = &workRequest.u.FtpRemoveDirectoryW;
req->lpszDirectory = heap_strdupW(lpszDirectory);
r = INTERNET_AsyncCall(&workRequest);
r = res_to_le(INTERNET_AsyncCall(&workRequest));
}
else
{
......@@ -2143,7 +2150,7 @@ BOOL WINAPI FtpRenameFileW(HINTERNET hFtpSession, LPCWSTR lpszSrc, LPCWSTR lpszD
req->lpszSrcFile = heap_strdupW(lpszSrc);
req->lpszDestFile = heap_strdupW(lpszDest);
r = INTERNET_AsyncCall(&workRequest);
r = res_to_le(INTERNET_AsyncCall(&workRequest));
}
else
{
......
......@@ -3141,7 +3141,7 @@ static DWORD CALLBACK INTERNET_WorkerThreadFunc(LPVOID lpvParam)
* RETURNS
*
*/
BOOL INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest)
DWORD INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest)
{
BOOL bSuccess;
LPWORKREQUEST lpNewRequest;
......@@ -3150,7 +3150,7 @@ BOOL INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest)
lpNewRequest = HeapAlloc(GetProcessHeap(), 0, sizeof(WORKREQUEST));
if (!lpNewRequest)
return FALSE;
return ERROR_OUTOFMEMORY;
*lpNewRequest = *lpWorkRequest;
......@@ -3158,10 +3158,10 @@ BOOL INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest)
if (!bSuccess)
{
HeapFree(GetProcessHeap(), 0, lpNewRequest);
INTERNET_SetLastError(ERROR_INTERNET_ASYNC_THREAD_FAILED);
return ERROR_INTERNET_ASYNC_THREAD_FAILED;
}
return bSuccess;
return ERROR_SUCCESS;
}
......
......@@ -407,7 +407,7 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
void INTERNET_SetLastError(DWORD dwError);
DWORD INTERNET_GetLastError(void);
BOOL INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest);
DWORD INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest);
LPSTR INTERNET_GetResponseBuffer(void);
LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen);
......
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