Hans Leidekker : wininet/tests: Trace extended errors in a couple of places .
Alexandre Julliard
julliard at winehq.org
Tue Dec 1 09:19:43 CST 2009
Module: wine
Branch: master
Commit: c4d12bde2bb4ff7fa63346e7f2a5a5be1a3df889
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c4d12bde2bb4ff7fa63346e7f2a5a5be1a3df889
Author: Hans Leidekker <hans at codeweavers.com>
Date: Tue Dec 1 11:35:11 2009 +0100
wininet/tests: Trace extended errors in a couple of places.
---
dlls/wininet/tests/ftp.c | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/dlls/wininet/tests/ftp.c b/dlls/wininet/tests/ftp.c
index b4de4e1..d19b9a8 100644
--- a/dlls/wininet/tests/ftp.c
+++ b/dlls/wininet/tests/ftp.c
@@ -360,6 +360,20 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
"Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
}
+static void trace_extended_error(DWORD error)
+{
+ DWORD code, buflen = 0;
+
+ if (error != ERROR_INTERNET_EXTENDED_ERROR) return;
+ if (!InternetGetLastResponseInfoA(&code, NULL, &buflen) && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
+ {
+ char *text = HeapAlloc(GetProcessHeap(), 0, ++buflen);
+ InternetGetLastResponseInfoA(&code, text, &buflen);
+ trace("%u %s\n", code, text);
+ HeapFree(GetProcessHeap(), 0, text);
+ }
+}
+
static void test_openfile(HINTERNET hFtp, HINTERNET hConnect)
{
HINTERNET hOpenFile;
@@ -414,21 +428,26 @@ static void test_openfile(HINTERNET hFtp, HINTERNET hConnect)
if (hOpenFile)
{
BOOL bRet;
+ DWORD error;
HINTERNET hOpenFile2;
HANDLE hFile;
/* We have a handle so all ftp calls should fail (TODO: Put all ftp-calls in here) */
SetLastError(0xdeadbeef);
bRet = FtpCreateDirectoryA(hFtp, "new_directory_deadbeef");
+ error = GetLastError();
ok ( bRet == FALSE, "Expected FtpCreateDirectoryA to fail\n");
- ok ( GetLastError() == ERROR_FTP_TRANSFER_IN_PROGRESS,
- "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", GetLastError());
+ ok ( error == ERROR_FTP_TRANSFER_IN_PROGRESS,
+ "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", error);
+ trace_extended_error(error);
SetLastError(0xdeadbeef);
bRet = FtpDeleteFileA(hFtp, "non_existent_file_deadbeef");
+ error = GetLastError();
ok ( bRet == FALSE, "Expected FtpDeleteFileA to fail\n");
- ok ( GetLastError() == ERROR_FTP_TRANSFER_IN_PROGRESS,
- "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", GetLastError());
+ ok ( error == ERROR_FTP_TRANSFER_IN_PROGRESS,
+ "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", error);
+ trace_extended_error(error);
SetLastError(0xdeadbeef);
bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
More information about the wine-cvs
mailing list