wininet: Check file handles against INVALID_HANDLE_VALUE, not NULL.
Simplify the file handle handling in FTP_FtpPutFileW().
This commit is contained in:
parent
d3245723ae
commit
53e76f8370
@ -271,7 +271,7 @@ lend:
|
|||||||
BOOL WINAPI FTP_FtpPutFileW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszLocalFile,
|
BOOL WINAPI FTP_FtpPutFileW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszLocalFile,
|
||||||
LPCWSTR lpszNewRemoteFile, DWORD dwFlags, DWORD dwContext)
|
LPCWSTR lpszNewRemoteFile, DWORD dwFlags, DWORD dwContext)
|
||||||
{
|
{
|
||||||
HANDLE hFile = NULL;
|
HANDLE hFile;
|
||||||
BOOL bSuccess = FALSE;
|
BOOL bSuccess = FALSE;
|
||||||
LPWININETAPPINFOW hIC = NULL;
|
LPWININETAPPINFOW hIC = NULL;
|
||||||
INT nResCode;
|
INT nResCode;
|
||||||
@ -324,7 +324,6 @@ BOOL WINAPI FTP_FtpPutFileW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszLocalFile,
|
|||||||
&iar, sizeof(INTERNET_ASYNC_RESULT));
|
&iar, sizeof(INTERNET_ASYNC_RESULT));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hFile)
|
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
|
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
@ -1350,7 +1349,7 @@ lend:
|
|||||||
if (lpwfs->lstnSocket != -1)
|
if (lpwfs->lstnSocket != -1)
|
||||||
closesocket(lpwfs->lstnSocket);
|
closesocket(lpwfs->lstnSocket);
|
||||||
|
|
||||||
if (hFile)
|
if (INVALID_HANDLE_VALUE != hFile)
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
|
|
||||||
hIC = lpwfs->lpAppInfo;
|
hIC = lpwfs->lpAppInfo;
|
||||||
|
@ -380,7 +380,6 @@ static void test_getfile(void)
|
|||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_non_existing_deadbeef", TRUE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
|
bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_non_existing_deadbeef", TRUE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
|
||||||
ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
|
ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
|
||||||
todo_wine
|
|
||||||
ok ( GetLastError() == ERROR_FILE_EXISTS,
|
ok ( GetLastError() == ERROR_FILE_EXISTS,
|
||||||
"Expected ERROR_FILE_EXISTS, got %d\n", GetLastError());
|
"Expected ERROR_FILE_EXISTS, got %d\n", GetLastError());
|
||||||
|
|
||||||
@ -388,7 +387,6 @@ static void test_getfile(void)
|
|||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_be_non_existing_deadbeef", TRUE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
|
bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_be_non_existing_deadbeef", TRUE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
|
||||||
ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
|
ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
|
||||||
todo_wine
|
|
||||||
ok ( GetLastError() == ERROR_FILE_EXISTS,
|
ok ( GetLastError() == ERROR_FILE_EXISTS,
|
||||||
"Expected ERROR_FILE_EXISTS, got %d\n", GetLastError());
|
"Expected ERROR_FILE_EXISTS, got %d\n", GetLastError());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user