Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
f0f3e15a
Commit
f0f3e15a
authored
Feb 12, 2007
by
Paul Vriens
Committed by
Alexandre Julliard
Feb 13, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet/ftp.c: Fix some returned error codes.
parent
00b7b29c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
14 deletions
+27
-14
ftp.c
dlls/wininet/ftp.c
+26
-3
ftp.c
dlls/wininet/tests/ftp.c
+1
-11
No files found.
dlls/wininet/ftp.c
View file @
f0f3e15a
...
...
@@ -1193,6 +1193,8 @@ static void AsyncFtpGetFileProc(WORKREQUEST *workRequest)
HeapFree
(
GetProcessHeap
(),
0
,
req
->
lpszNewFile
);
}
#define FTP_CONDITION_MASK 0x0007
BOOL
WINAPI
FtpGetFileW
(
HINTERNET
hInternet
,
LPCWSTR
lpszRemoteFile
,
LPCWSTR
lpszNewFile
,
BOOL
fFailIfExists
,
DWORD
dwLocalFlagsAttribute
,
DWORD
dwInternetFlags
,
DWORD
dwContext
)
...
...
@@ -1201,13 +1203,35 @@ BOOL WINAPI FtpGetFileW(HINTERNET hInternet, LPCWSTR lpszRemoteFile, LPCWSTR lps
LPWININETAPPINFOW
hIC
=
NULL
;
BOOL
r
=
FALSE
;
if
(
!
lpszRemoteFile
||
!
lpszNewFile
)
{
INTERNET_SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
lpwfs
=
(
LPWININETFTPSESSIONW
)
WININET_GetObject
(
hInternet
);
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
;
}
/* Testing shows that Windows only accepts dwInternetFlags where the last
* 3 (yes 3) bits define FTP_TRANSFER_TYPE_UNKNOWN, FTP_TRANSFER_TYPE_ASCII or FTP_TRANSFER_TYPE_BINARY.
*/
if
((
dwInternetFlags
&
FTP_CONDITION_MASK
)
>
FTP_TRANSFER_TYPE_BINARY
)
{
INTERNET_SetLastError
(
ERROR_INVALID_PARAMETER
);
goto
lend
;
}
if
(
lpwfs
->
download_in_progress
!=
NULL
)
{
INTERNET_SetLastError
(
ERROR_FTP_TRANSFER_IN_PROGRESS
);
goto
lend
;
...
...
@@ -1238,8 +1262,7 @@ BOOL WINAPI FtpGetFileW(HINTERNET hInternet, LPCWSTR lpszRemoteFile, LPCWSTR lps
}
lend:
if
(
lpwfs
)
WININET_Release
(
&
lpwfs
->
hdr
);
WININET_Release
(
&
lpwfs
->
hdr
);
return
r
;
}
...
...
dlls/wininet/tests/ftp.c
View file @
f0f3e15a
...
...
@@ -249,7 +249,6 @@ static void test_getfile(void)
SetLastError
(
0xdeadbeef
);
bRet
=
FtpGetFileA
(
NULL
,
NULL
,
"should_be_non_existing_deadbeef"
,
FALSE
,
FILE_ATTRIBUTE_NORMAL
,
FTP_TRANSFER_TYPE_UNKNOWN
,
0
);
ok
(
bRet
==
FALSE
,
"Expected FtpGetFileA to fail
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
...
...
@@ -257,7 +256,6 @@ static void test_getfile(void)
SetLastError
(
0xdeadbeef
);
bRet
=
FtpGetFileA
(
NULL
,
"welcome.msg"
,
"should_be_non_existing_deadbeef"
,
FALSE
,
FILE_ATTRIBUTE_NORMAL
,
5
,
0
);
ok
(
bRet
==
FALSE
,
"Expected FtpGetFileA to fail
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"Expected ERROR_INVALID_HANDLE, got %d
\n
"
,
GetLastError
());
...
...
@@ -281,21 +279,16 @@ static void test_getfile(void)
SetLastError
(
0xdeadbeef
);
bRet
=
FtpGetFileA
(
hFtp
,
NULL
,
"should_be_non_existing_deadbeef"
,
FALSE
,
FILE_ATTRIBUTE_NORMAL
,
FTP_TRANSFER_TYPE_UNKNOWN
,
0
);
ok
(
bRet
==
FALSE
,
"Expected FtpGetFileA to fail
\n
"
);
todo_wine
{
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
/* Currently Wine always creates the local file (even on failure) which is not correct, hence the test */
ok
(
GetFileAttributesA
(
"should_be_non_existing_deadbeef"
)
==
INVALID_FILE_ATTRIBUTES
,
"Local file should not have been created
\n
"
);
}
DeleteFileA
(
"should_be_non_existing_deadbeef"
);
/* No local file */
SetLastError
(
0xdeadbeef
);
bRet
=
FtpGetFileA
(
hFtp
,
"welcome.msg"
,
NULL
,
FALSE
,
FILE_ATTRIBUTE_NORMAL
,
FTP_TRANSFER_TYPE_UNKNOWN
,
0
);
ok
(
bRet
==
FALSE
,
"Expected FtpGetFileA to fail
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
...
...
@@ -317,13 +310,10 @@ static void test_getfile(void)
SetLastError
(
0xdeadbeef
);
bRet
=
FtpGetFileA
(
hFtp
,
"welcome.msg"
,
"should_be_non_existing_deadbeef"
,
FALSE
,
FILE_ATTRIBUTE_NORMAL
,
5
,
0
);
ok
(
bRet
==
FALSE
,
"Expected FtpGetFileA to fail
\n
"
);
todo_wine
{
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
ok
(
GetFileAttributesA
(
"should_be_non_existing_deadbeef"
)
==
INVALID_FILE_ATTRIBUTES
,
"Local file should not have been created
\n
"
);
}
DeleteFileA
(
"should_be_non_existing_deadbeef"
);
/* Remote file doesn't exist */
...
...
@@ -334,6 +324,7 @@ static void test_getfile(void)
{
ok
(
GetLastError
()
==
ERROR_INTERNET_EXTENDED_ERROR
,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d
\n
"
,
GetLastError
());
/* Currently Wine always creates the local file (even on failure) which is not correct, hence the test */
ok
(
GetFileAttributesA
(
"should_also_be_non_existing_deadbeef"
)
==
INVALID_FILE_ATTRIBUTES
,
"Local file should not have been created
\n
"
);
}
...
...
@@ -390,7 +381,6 @@ static void test_getfile(void)
SetLastError
(
0xdeadbeef
);
bRet
=
FtpGetFileA
(
hConnect
,
NULL
,
"should_be_non_existing_deadbeef"
,
FALSE
,
FILE_ATTRIBUTE_NORMAL
,
FTP_TRANSFER_TYPE_UNKNOWN
,
0
);
ok
(
bRet
==
FALSE
,
"Expected FtpGetFileA to fail
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment