Re: wininet: Improve FtpOpenFile()'s parameter checking and remove the corresponding todo_wines.
Francois Gouget wrote:
Also make test_getfile_no_open() succeed on Windows 98. ---
I have had some strange results with these tests. One of them was actually succeeding in a todo_wine for a good while.
dlls/wininet/ftp.c | 12 +++++++++++- dlls/wininet/tests/ftp.c | 12 +++--------- 2 files changed, 14 insertions(+), 10 deletions(-)
This was the last one for now on my list, you beat me to it. We do have some conflicting patches now in wine-patches.
diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c index 5b073cf..2bd29fd 100644 --- a/dlls/wininet/ftp.c +++ b/dlls/wininet/ftp.c @@ -1011,11 +1011,21 @@ HINTERNET WINAPI FtpOpenFileW(HINTERNET hFtpSession, debugstr_w(lpszFileName), fdwAccess, dwFlags, dwContext);
lpwfs = (LPWININETFTPSESSIONW) WININET_GetObject( hFtpSession ); - if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype) + if (NULL == lpwfs) + { + INTERNET_SetLastError(ERROR_INTERNET_NOT_INITIALIZED); + goto lend;
Why do a 'goto lend' you could just 'return FALSE' like I did in the other ftp functions. No need do another check for lpwfs being NULL. If you do a 'return FALSE' you could also get rid of the check for lpwfs being NULL right after lend:.
+ } + if (WH_HFTPSESSION != lpwfs->hdr.htype) { INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); goto lend; } + if (dwFlags & ~(INTERNET_FLAGS_MASK|FTP_TRANSFER_TYPE_MASK)) + { + INTERNET_SetLastError(ERROR_INVALID_PARAMETER); + goto lend; + }
I think this covers the 5 in the test but not all possible combinations. I did some (loop) testing with dwFlags (also used in FtpGetFile and FtpPutFile) and it appears all boils down to the last 3 bits (see FtpGetFile). Cheers, Paul.
participants (1)
-
Paul Vriens