Commit 54c80612 authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

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

parent 6c050487
...@@ -1523,12 +1523,24 @@ BOOL WINAPI FtpRemoveDirectoryW(HINTERNET hFtpSession, LPCWSTR lpszDirectory) ...@@ -1523,12 +1523,24 @@ BOOL WINAPI FtpRemoveDirectoryW(HINTERNET hFtpSession, LPCWSTR lpszDirectory)
BOOL r = FALSE; BOOL r = FALSE;
lpwfs = (LPWININETFTPSESSIONW) WININET_GetObject( hFtpSession ); 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); INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
goto lend; goto lend;
} }
if (!lpszDirectory)
{
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
goto lend;
}
hIC = lpwfs->lpAppInfo; hIC = lpwfs->lpAppInfo;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
...@@ -1548,8 +1560,7 @@ BOOL WINAPI FtpRemoveDirectoryW(HINTERNET hFtpSession, LPCWSTR lpszDirectory) ...@@ -1548,8 +1560,7 @@ BOOL WINAPI FtpRemoveDirectoryW(HINTERNET hFtpSession, LPCWSTR lpszDirectory)
} }
lend: lend:
if( lpwfs ) WININET_Release( &lpwfs->hdr );
WININET_Release( &lpwfs->hdr );
return r; return r;
} }
......
...@@ -597,7 +597,6 @@ static void test_removedir(void) ...@@ -597,7 +597,6 @@ static void test_removedir(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
bRet = FtpRemoveDirectoryA(NULL, "should_be_non_existing_deadbeef_dir"); bRet = FtpRemoveDirectoryA(NULL, "should_be_non_existing_deadbeef_dir");
ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n"); ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
todo_wine
ok ( GetLastError() == ERROR_INVALID_HANDLE, ok ( GetLastError() == ERROR_INVALID_HANDLE,
"Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError()); "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
...@@ -616,7 +615,6 @@ static void test_removedir(void) ...@@ -616,7 +615,6 @@ static void test_removedir(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
bRet = FtpRemoveDirectoryA(hFtp, NULL); bRet = FtpRemoveDirectoryA(hFtp, NULL);
ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n"); ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
todo_wine
ok ( GetLastError() == ERROR_INVALID_PARAMETER, ok ( GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
......
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