Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
b529b3bb
Commit
b529b3bb
authored
Dec 08, 2007
by
Hans Leidekker
Committed by
Alexandre Julliard
Dec 10, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Make FtpGetCurrentDirectoryA pass all todo_wine tests.
parent
c6dd1f15
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
23 deletions
+20
-23
ftp.c
dlls/wininet/ftp.c
+17
-15
ftp.c
dlls/wininet/tests/ftp.c
+3
-8
No files found.
dlls/wininet/ftp.c
View file @
b529b3bb
...
...
@@ -844,13 +844,12 @@ BOOL WINAPI FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDire
}
}
ret
=
FtpGetCurrentDirectoryW
(
hFtpSession
,
lpszCurrentDirectory
?
dir
:
NULL
,
lpdwCurrentDirectory
?&
len
:
NULL
);
if
(
lpdwCurrentDirectory
)
{
*
lpdwCurrentDirectory
=
len
;
if
(
lpszCurrentDirectory
)
{
WideCharToMultiByte
(
CP_ACP
,
0
,
dir
,
len
,
lpszCurrentDirectory
,
*
lpdwCurrentDirectory
,
NULL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
dir
);
}
}
if
(
ret
&&
lpszCurrentDirectory
)
WideCharToMultiByte
(
CP_ACP
,
0
,
dir
,
-
1
,
lpszCurrentDirectory
,
len
,
NULL
,
NULL
);
if
(
lpdwCurrentDirectory
)
*
lpdwCurrentDirectory
=
len
;
HeapFree
(
GetProcessHeap
(),
0
,
dir
);
return
ret
;
}
...
...
@@ -965,8 +964,6 @@ BOOL WINAPI FTP_FtpGetCurrentDirectoryW(LPWININETFTPSESSIONW lpwfs, LPWSTR lpszC
/* Clear any error information */
INTERNET_SetLastError
(
0
);
ZeroMemory
(
lpszCurrentDirectory
,
*
lpdwCurrentDirectory
);
hIC
=
lpwfs
->
lpAppInfo
;
if
(
!
FTP_SendCommand
(
lpwfs
->
sndSocket
,
FTP_CMD_PWD
,
NULL
,
lpwfs
->
hdr
.
lpfnStatusCB
,
&
lpwfs
->
hdr
,
lpwfs
->
hdr
.
dwContext
))
...
...
@@ -978,7 +975,7 @@ BOOL WINAPI FTP_FtpGetCurrentDirectoryW(LPWININETFTPSESSIONW lpwfs, LPWSTR lpszC
if
(
nResCode
==
257
)
/* Extract directory name */
{
DWORD
firstpos
,
lastpos
,
len
;
LPWSTR
lpszResponseBuffer
=
WININET_strdup_AtoW
(
INTERNET_GetResponseBuffer
());
LPWSTR
lpszResponseBuffer
=
WININET_strdup_AtoW
(
INTERNET_GetResponseBuffer
());
for
(
firstpos
=
0
,
lastpos
=
0
;
lpszResponseBuffer
[
lastpos
];
lastpos
++
)
{
...
...
@@ -988,14 +985,19 @@ BOOL WINAPI FTP_FtpGetCurrentDirectoryW(LPWININETFTPSESSIONW lpwfs, LPWSTR lpszC
firstpos
=
lastpos
;
else
break
;
}
}
}
len
=
lastpos
-
firstpos
;
if
(
*
lpdwCurrentDirectory
>=
len
)
{
memcpy
(
lpszCurrentDirectory
,
&
lpszResponseBuffer
[
firstpos
+
1
],
len
*
sizeof
(
WCHAR
));
lpszCurrentDirectory
[
len
-
1
]
=
0
;
*
lpdwCurrentDirectory
=
len
;
bSuccess
=
TRUE
;
}
else
INTERNET_SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
len
=
lastpos
-
firstpos
-
1
;
lstrcpynW
(
lpszCurrentDirectory
,
&
lpszResponseBuffer
[
firstpos
+
1
],
*
lpdwCurrentDirectory
);
HeapFree
(
GetProcessHeap
(),
0
,
lpszResponseBuffer
);
*
lpdwCurrentDirectory
=
len
;
bSuccess
=
TRUE
;
}
else
FTP_SetResponseError
(
nResCode
);
...
...
dlls/wininet/tests/ftp.c
View file @
b529b3bb
...
...
@@ -746,21 +746,17 @@ static void test_get_current_dir(HINTERNET hFtp, HINTERNET hConnect)
SetLastError
(
0xdeadbeef
);
bRet
=
FtpGetCurrentDirectoryA
(
hFtp
,
lpszCurrentDirectory
,
&
dwCurrentDirectoryLen
);
ok
(
bRet
==
TRUE
,
"Expected FtpGetCurrentDirectoryA to pass
\n
"
);
todo_wine
ok
(
lstrcmp
(
lpszCurrentDirectory
,
"/pub"
)
==
0
,
"Expected returned value
\"
%s
\"
to match
\"
%s
\"\n
"
,
(
char
*
)
lpszCurrentDirectory
,
"/pub"
);
ok
(
!
strcmp
(
lpszCurrentDirectory
,
"/pub"
),
"Expected returned value
\"
%s
\"
to match
\"
/pub
\"\n
"
,
lpszCurrentDirectory
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got: %d
\n
"
,
GetLastError
());
/* test for the current directory with a size only large enough to
* fit the string and not the null terminating character */
SetLastError
(
0xdeadbeef
);
dwCurrentDirectoryLen
=
4
;
lpszCurrentDirectory
[
4
]
=
'a'
;
/* set position 4 of the array to something else to make sure a leftover \0 isn't fooling the test */
bRet
=
FtpGetCurrentDirectoryA
(
hFtp
,
lpszCurrentDirectory
,
&
dwCurrentDirectoryLen
);
todo_wine
ok
(
bRet
==
FALSE
,
"Expected FtpGetCurrentDirectoryA to fail
\n
"
);
ok
(
lstrcmp
(
lpszCurrentDirectory
,
"/pub"
)
!=
0
,
"Expected returned value
\"
%s
\"
to not match
\"
%s
\"\n
"
,
(
char
*
)
lpszCurrentDirectory
,
"/pub"
);
todo_wine
ok
(
strcmp
(
lpszCurrentDirectory
,
"/pub"
),
"Expected returned value
\"
%s
\"
to not match
\"
/pub
\"\n
"
,
lpszCurrentDirectory
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected ERROR_INSUFFICIENT_BUFFER, got: %d
\n
"
,
GetLastError
());
/* test for the current directory with a size large enough to store
...
...
@@ -769,8 +765,7 @@ todo_wine
dwCurrentDirectoryLen
=
5
;
bRet
=
FtpGetCurrentDirectoryA
(
hFtp
,
lpszCurrentDirectory
,
&
dwCurrentDirectoryLen
);
ok
(
bRet
==
TRUE
,
"Expected FtpGetCurrentDirectoryA to pass
\n
"
);
todo_wine
ok
(
lstrcmp
(
lpszCurrentDirectory
,
"/pub"
)
==
0
,
"Expected returned value
\"
%s
\"
to match
\"
%s
\"\n
"
,
(
char
*
)
lpszCurrentDirectory
,
"/pub"
);
ok
(
!
strcmp
(
lpszCurrentDirectory
,
"/pub"
),
"Expected returned value
\"
%s
\"
to match
\"
/pub
\"\n
"
,
lpszCurrentDirectory
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, 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