From a53df53f2b3cdbb63c24f3113083a2e02a284735 Mon Sep 17 00:00:00 2001 From: Detlef Riekenberg Date: Fri, 12 Oct 2007 09:38:15 +0200 Subject: [PATCH] wininet/tests: Test NULL pointer for InternetCanonicalizeUrlA. --- dlls/wininet/tests/internet.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c index f04c399ec46..9fac11e14cf 100644 --- a/dlls/wininet/tests/internet.c +++ b/dlls/wininet/tests/internet.c @@ -83,6 +83,36 @@ static void test_InternetCanonicalizeUrlA(void) ok( res && (dwSize == urllen) && (lstrcmpA(url, buffer) == 0), "got %u and %u with size %u for '%s' (%d)\n", res, GetLastError(), dwSize, buffer, lstrlenA(buffer)); + + + /* check NULL pointers */ + memset(buffer, '#', urllen + 4); + buffer[urllen + 4] = '\0'; + dwSize = urllen+1; + SetLastError(0xdeadbeef); + res = InternetCanonicalizeUrlA(NULL, buffer, &dwSize, 0); + ok( !res && (GetLastError() == ERROR_INVALID_PARAMETER), + "got %u and %u with size %u for '%s' (%d)\n", + res, GetLastError(), dwSize, buffer, lstrlenA(buffer)); + + memset(buffer, '#', urllen + 4); + buffer[urllen + 4] = '\0'; + dwSize = urllen+1; + SetLastError(0xdeadbeef); + res = InternetCanonicalizeUrlA(url, NULL, &dwSize, 0); + ok( !res && (GetLastError() == ERROR_INVALID_PARAMETER), + "got %u and %u with size %u for '%s' (%d)\n", + res, GetLastError(), dwSize, buffer, lstrlenA(buffer)); + + memset(buffer, '#', urllen + 4); + buffer[urllen + 4] = '\0'; + dwSize = urllen+1; + SetLastError(0xdeadbeef); + res = InternetCanonicalizeUrlA(url, buffer, NULL, 0); + ok( !res && (GetLastError() == ERROR_INVALID_PARAMETER), + "got %u and %u with size %u for '%s' (%d)\n", + res, GetLastError(), dwSize, buffer, lstrlenA(buffer)); + } /* ############################### */