Paul Vriens : wininet/ftp.c: Fix some returned error codes.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 12 09:23:53 CST 2007


Module: wine
Branch: master
Commit: 6c050487568edee76621a908c24077f262156a72
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6c050487568edee76621a908c24077f262156a72

Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date:   Fri Feb  9 21:17:27 2007 +0100

wininet/ftp.c: Fix some returned error codes.

---

 dlls/wininet/ftp.c       |   17 ++++++++++++++---
 dlls/wininet/tests/ftp.c |    2 --
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c
index 1d9224b..a9f7166 100644
--- a/dlls/wininet/ftp.c
+++ b/dlls/wininet/ftp.c
@@ -1384,12 +1384,24 @@ BOOL WINAPI FtpDeleteFileW(HINTERNET hFt
     BOOL r = FALSE;
 
     lpwfs = (LPWININETFTPSESSIONW) WININET_GetObject( hFtpSession );
-    if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
+    if (!lpwfs)
+    {
+        INTERNET_SetLastError(ERROR_INVALID_HANDLE);
+        return FALSE;
+    }
+
+    if (WH_HFTPSESSION != lpwfs->hdr.htype)
     {
         INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
         goto lend;
     }
 
+    if (!lpszFileName)
+    {
+        INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
+        goto lend;
+    }
+
     hIC = lpwfs->lpAppInfo;
     if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
     {
@@ -1409,8 +1421,7 @@ BOOL WINAPI FtpDeleteFileW(HINTERNET hFt
     }
 
 lend:
-    if( lpwfs )
-        WININET_Release( &lpwfs->hdr );
+    WININET_Release( &lpwfs->hdr );
 
     return r;
 }
diff --git a/dlls/wininet/tests/ftp.c b/dlls/wininet/tests/ftp.c
index d5a4a6f..50ef6cc 100644
--- a/dlls/wininet/tests/ftp.c
+++ b/dlls/wininet/tests/ftp.c
@@ -167,7 +167,6 @@ static void test_deletefile(void)
     SetLastError(0xdeadbeef);
     bRet = FtpDeleteFileA(NULL, "non_existent_file_deadbeef");
     ok ( bRet == FALSE, "Expected FtpDeleteFileA to fail\n");
-    todo_wine
     ok ( GetLastError() == ERROR_INVALID_HANDLE,
         "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
 
@@ -186,7 +185,6 @@ static void test_deletefile(void)
     SetLastError(0xdeadbeef);
     bRet = FtpDeleteFileA(hFtp, NULL);
     ok ( bRet == FALSE, "Expected FtpDeleteFileA to fail\n");
-    todo_wine
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
         "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
 




More information about the wine-cvs mailing list