Hans Leidekker : wininet: Also set last error on NULL first parameter in InternetCreateUrl{A, W}.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Aug 10 07:31:07 CDT 2007


Module: wine
Branch: master
Commit: c1c6f4ad6bce6221fa0413ddda606067a59172d9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c1c6f4ad6bce6221fa0413ddda606067a59172d9

Author: Hans Leidekker <hans at it.vu.nl>
Date:   Thu Aug  9 18:34:09 2007 +0200

wininet: Also set last error on NULL first parameter in InternetCreateUrl{A, W}.

---

 dlls/wininet/internet.c  |   10 ++--------
 dlls/wininet/tests/url.c |    6 +++---
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 5e5bcea..d0228be 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -3663,10 +3663,7 @@ BOOL WINAPI InternetCreateUrlA(LPURL_COMPONENTSA lpUrlComponents, DWORD dwFlags,
 
     TRACE("(%p,%d,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength);
 
-    if (!lpUrlComponents)
-        return FALSE;
-
-    if (lpUrlComponents->dwStructSize != sizeof(URL_COMPONENTSW) || !lpdwUrlLength)
+    if (!lpUrlComponents || lpUrlComponents->dwStructSize != sizeof(URL_COMPONENTSW) || !lpdwUrlLength)
     {
         INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
         return FALSE;
@@ -3733,10 +3730,7 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
 
     TRACE("(%p,%d,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength);
 
-    if (!lpUrlComponents)
-        return FALSE;
-
-    if (lpUrlComponents->dwStructSize != sizeof(URL_COMPONENTSW) || !lpdwUrlLength)
+    if (!lpUrlComponents || lpUrlComponents->dwStructSize != sizeof(URL_COMPONENTSW) || !lpdwUrlLength)
     {
         INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
         return FALSE;
diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c
index 125e641..6da48be 100644
--- a/dlls/wininet/tests/url.c
+++ b/dlls/wininet/tests/url.c
@@ -404,11 +404,11 @@ static void InternetCreateUrlA_test(void)
                     host[]       = "host";
 
 	/* test NULL lpUrlComponents */
-	ret = InternetCreateUrlA(NULL, 0, NULL, &len);
 	SetLastError(0xdeadbeef);
+	ret = InternetCreateUrlA(NULL, 0, NULL, &len);
 	ok(!ret, "Expected failure\n");
-	ok(GetLastError() == 0xdeadbeef,
-		"Expected 0xdeadbeef, got %d\n", GetLastError());
+	ok(GetLastError() == ERROR_INVALID_PARAMETER,
+		"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
 	ok(len == -1, "Expected len -1, got %d\n", len);
 
 	/* test zero'ed lpUrlComponents */




More information about the wine-cvs mailing list