James Hawkins : wininet: Add more tests for InternetCrackurl.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jul 17 07:00:17 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: a1544731dbaf30c473be2ae254f2f24e3138babf
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=a1544731dbaf30c473be2ae254f2f24e3138babf
Author: James Hawkins <truiken at gmail.com>
Date: Fri Jul 14 16:45:46 2006 -0700
wininet: Add more tests for InternetCrackurl.
---
dlls/wininet/internet.c | 7 +++++++
dlls/wininet/tests/url.c | 18 ++++++++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 332e4f7..ebe209d 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -1323,6 +1323,13 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lp
dwUrlLength=strlenW(lpszUrl);
TRACE("(%s %lu %lx %p)\n", debugstr_w(lpszUrl), dwUrlLength, dwFlags, lpUC);
+
+ if (!lpszUrl_orig || !*lpszUrl_orig)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
if (dwFlags & ICU_DECODE)
{
lpszUrl_decode=HeapAlloc( GetProcessHeap(), 0, dwUrlLength * sizeof (WCHAR) );
diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c
index 56e38f1..ea09631 100644
--- a/dlls/wininet/tests/url.c
+++ b/dlls/wininet/tests/url.c
@@ -208,6 +208,24 @@ static void InternetCrackUrl_test(void)
ok(!strcmp(urlComponents.lpszScheme, "about"), "lpszScheme was \"%s\" instead of \"about\"\n", urlComponents.lpszScheme);
ok(!strcmp(urlComponents.lpszHostName, "host"), "lpszHostName was \"%s\" instead of \"host\"\n", urlComponents.lpszHostName);
ok(!strcmp(urlComponents.lpszUrlPath, "/blank"), "lpszUrlPath was \"%s\" instead of \"/blank\"\n", urlComponents.lpszUrlPath);
+
+ /* try a NULL lpszUrl */
+ SetLastError(0xdeadbeef);
+ copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+ ret = InternetCrackUrl(NULL, 0, 0, &urlComponents);
+ GLE = GetLastError();
+ ok(ret == FALSE, "Expected InternetCrackUrl to fail\n");
+ ok(GLE == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %ld\n", GLE);
+
+ /* try an empty lpszUrl, GetLastError returns 12006, whatever that means
+ * we just need to fail and not return success
+ */
+ SetLastError(0xdeadbeef);
+ copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+ ret = InternetCrackUrl("", 0, 0, &urlComponents);
+ GLE = GetLastError();
+ ok(ret == FALSE, "Expected InternetCrackUrl to fail\n");
+ ok(GLE != 0xdeadbeef && GLE != ERROR_SUCCESS, "Expected GLE to represent a failure\n");
}
static void InternetCrackUrlW_test(void)
More information about the wine-cvs
mailing list