wininet: Return correct errors in InternetOpenUrlW.

oldstable
Mike McCormack 2006-05-15 22:02:34 +09:00 committed by Alexandre Julliard
parent f57360af52
commit 2eec6b04c0
2 changed files with 15 additions and 0 deletions

View File

@ -2934,6 +2934,7 @@ HINTERNET WINAPI INTERNET_InternetOpenUrlW(LPWININETAPPINFOW hIC, LPCWSTR lpszUr
/* gopher doesn't seem to be implemented in wine, but it's supposed
* to be supported by InternetOpenUrlA. */
default:
INTERNET_SetLastError(ERROR_INTERNET_UNRECOGNIZED_SCHEME);
break;
}
@ -2963,6 +2964,12 @@ HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
dump_INTERNET_FLAGS(dwFlags);
}
if (!lpszUrl)
{
SetLastError(ERROR_INVALID_PARAMETER);
goto lend;
}
hIC = (LPWININETAPPINFOW) WININET_GetObject( hInternet );
if (NULL == hIC || hIC->hdr.htype != WH_HINIT) {
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);

View File

@ -143,6 +143,14 @@ static void test_null(void)
ok(GetLastError() == ERROR_INVALID_HANDLE, "wrong error\n");
ok(hc == NULL, "connect failed\n");
hc = InternetOpenUrlW(hi, NULL, NULL, 0, 0, 0);
ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
ok(hc == NULL, "connect failed\n");
hc = InternetOpenUrlW(hi, szServer, NULL, 0, 0, 0);
ok(GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME, "wrong error\n");
ok(hc == NULL, "connect failed\n");
InternetCloseHandle(hi);
}