[2/3] wininet: Fix error handling for invalid handle argument in FtpSetCurrentDirectoryW

Zac Brown zac at zacbrown.org
Tue Dec 4 09:01:28 CST 2007


Hi,

Changelog:
* Fix error handling for invalid handle argument in FtpSetCurrentDirectoryW to reflect Windows behavior
* remove todo_wine block pertaining to this bug in test case



---
 dlls/wininet/ftp.c       |    8 +++++++-
 dlls/wininet/tests/ftp.c |    1 -
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c
index ce60fa0..b31c86c 100644
--- a/dlls/wininet/ftp.c
+++ b/dlls/wininet/ftp.c
@@ -393,7 +393,13 @@ BOOL WINAPI FtpSetCurrentDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory)
     }

     lpwfs = (LPWININETFTPSESSIONW) WININET_GetObject( hConnect );
-    if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
+    if (NULL == lpwfs)
+    {
+        INTERNET_SetLastError(ERROR_INVALID_HANDLE);
+        goto lend;
+    }
+
+    if (WH_HFTPSESSION != lpwfs->hdr.htype)
     {
         INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
         goto lend;
diff --git a/dlls/wininet/tests/ftp.c b/dlls/wininet/tests/ftp.c
index 7344554..1bd8aa5 100644
--- a/dlls/wininet/tests/ftp.c
+++ b/dlls/wininet/tests/ftp.c
@@ -793,7 +793,6 @@ todo_wine
     SetLastError(0xdeadbeef);
     bRet = FtpSetCurrentDirectory(NULL, testDirectory);
     ok ( bRet == FALSE, "Expected FtpSetCurrentDirectoryA to fail\n");
-todo_wine
     ok ( GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got: %d\n", GetLastError());

     /* test with bad handle */
-- 
1.5.2.5



More information about the wine-patches mailing list