Hans Leidekker : wininet: Always return an error when a transfer is in progress.
Alexandre Julliard
julliard at winehq.org
Mon Oct 29 08:34:46 CDT 2007
Module: wine
Branch: master
Commit: e55531d694290975fad9f270cd6d8284d64e158e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e55531d694290975fad9f270cd6d8284d64e158e
Author: Hans Leidekker <hans at it.vu.nl>
Date: Fri Oct 26 23:19:05 2007 +0200
wininet: Always return an error when a transfer is in progress.
---
dlls/wininet/ftp.c | 61 ++++++++++++++++++++++++++++++++++++++++++----
dlls/wininet/tests/ftp.c | 5 ----
2 files changed, 56 insertions(+), 10 deletions(-)
diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c
index bbaef8a..1fce6ea 100644
--- a/dlls/wininet/ftp.c
+++ b/dlls/wininet/ftp.c
@@ -225,6 +225,12 @@ BOOL WINAPI FtpPutFileW(HINTERNET hConnect, LPCWSTR lpszLocalFile,
goto lend;
}
+ if (lpwfs->download_in_progress != NULL)
+ {
+ INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS);
+ goto lend;
+ }
+
if ((dwFlags & FTP_CONDITION_MASK) > FTP_TRANSFER_TYPE_BINARY)
{
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
@@ -392,6 +398,12 @@ BOOL WINAPI FtpSetCurrentDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory)
goto lend;
}
+ if (lpwfs->download_in_progress != NULL)
+ {
+ INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS);
+ goto lend;
+ }
+
TRACE("lpszDirectory(%s)\n", debugstr_w(lpszDirectory));
hIC = lpwfs->lpAppInfo;
@@ -532,6 +544,12 @@ BOOL WINAPI FtpCreateDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory)
goto lend;
}
+ if (lpwfs->download_in_progress != NULL)
+ {
+ INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS);
+ goto lend;
+ }
+
if (!lpszDirectory)
{
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
@@ -676,6 +694,12 @@ HINTERNET WINAPI FtpFindFirstFileW(HINTERNET hConnect,
goto lend;
}
+ if (lpwfs->download_in_progress != NULL)
+ {
+ INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS);
+ goto lend;
+ }
+
hIC = lpwfs->lpAppInfo;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
@@ -866,6 +890,12 @@ BOOL WINAPI FtpGetCurrentDirectoryW(HINTERNET hFtpSession, LPWSTR lpszCurrentDir
goto lend;
}
+ if (lpwfs->download_in_progress != NULL)
+ {
+ INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS);
+ goto lend;
+ }
+
hIC = lpwfs->lpAppInfo;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
@@ -1044,10 +1074,12 @@ HINTERNET WINAPI FtpOpenFileW(HINTERNET hFtpSession,
goto lend;
}
- if (lpwfs->download_in_progress != NULL) {
- INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS);
- goto lend;
+ if (lpwfs->download_in_progress != NULL)
+ {
+ INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS);
+ goto lend;
}
+
hIC = lpwfs->lpAppInfo;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
@@ -1255,8 +1287,9 @@ BOOL WINAPI FtpGetFileW(HINTERNET hInternet, LPCWSTR lpszRemoteFile, LPCWSTR lps
goto lend;
}
- if (lpwfs->download_in_progress != NULL) {
- INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS);
+ if (lpwfs->download_in_progress != NULL)
+ {
+ INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS);
goto lend;
}
@@ -1437,6 +1470,12 @@ BOOL WINAPI FtpDeleteFileW(HINTERNET hFtpSession, LPCWSTR lpszFileName)
goto lend;
}
+ if (lpwfs->download_in_progress != NULL)
+ {
+ INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS);
+ goto lend;
+ }
+
if (!lpszFileName)
{
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
@@ -1576,6 +1615,12 @@ BOOL WINAPI FtpRemoveDirectoryW(HINTERNET hFtpSession, LPCWSTR lpszDirectory)
goto lend;
}
+ if (lpwfs->download_in_progress != NULL)
+ {
+ INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS);
+ goto lend;
+ }
+
if (!lpszDirectory)
{
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
@@ -1720,6 +1765,12 @@ BOOL WINAPI FtpRenameFileW(HINTERNET hFtpSession, LPCWSTR lpszSrc, LPCWSTR lpszD
goto lend;
}
+ if (lpwfs->download_in_progress != NULL)
+ {
+ INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS);
+ goto lend;
+ }
+
if (!lpszSrc || !lpszDest)
{
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
diff --git a/dlls/wininet/tests/ftp.c b/dlls/wininet/tests/ftp.c
index 7aa42db..25367c1 100644
--- a/dlls/wininet/tests/ftp.c
+++ b/dlls/wininet/tests/ftp.c
@@ -496,14 +496,12 @@ static void test_openfile(void)
SetLastError(0xdeadbeef);
bRet = FtpCreateDirectoryA(hFtp, "new_directory_deadbeef");
ok ( bRet == FALSE, "Expected FtpCreateDirectoryA to fail\n");
- todo_wine
ok ( GetLastError() == ERROR_FTP_TRANSFER_IN_PROGRESS,
"Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
bRet = FtpDeleteFileA(hFtp, "non_existent_file_deadbeef");
ok ( bRet == FALSE, "Expected FtpDeleteFileA to fail\n");
- todo_wine
ok ( GetLastError() == ERROR_FTP_TRANSFER_IN_PROGRESS,
"Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", GetLastError());
@@ -529,7 +527,6 @@ static void test_openfile(void)
SetLastError(0xdeadbeef);
bRet = FtpPutFileA(hFtp, "now_existing_local", "non_existing_remote", FTP_TRANSFER_TYPE_UNKNOWN, 0);
ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
- todo_wine
ok ( GetLastError() == ERROR_FTP_TRANSFER_IN_PROGRESS,
"Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", GetLastError());
DeleteFileA("now_existing_local");
@@ -537,14 +534,12 @@ static void test_openfile(void)
SetLastError(0xdeadbeef);
bRet = FtpRemoveDirectoryA(hFtp, "should_be_non_existing_deadbeef_dir");
ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
- todo_wine
ok ( GetLastError() == ERROR_FTP_TRANSFER_IN_PROGRESS,
"Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
bRet = FtpRenameFileA(hFtp , "should_be_non_existing_deadbeef", "new");
ok ( bRet == FALSE, "Expected FtpRenameFileA to fail\n");
- todo_wine
ok ( GetLastError() == ERROR_FTP_TRANSFER_IN_PROGRESS,
"Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", GetLastError());
}
More information about the wine-cvs
mailing list