wininet: Avoid a crash on an invalid handle in InternetQueryOption.
This commit is contained in:
parent
f1dc1bb070
commit
01e21366cb
|
@ -1904,7 +1904,7 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
|
||||||
|
|
||||||
TRACE("INTERNET_OPTION_USER_AGENT\n");
|
TRACE("INTERNET_OPTION_USER_AGENT\n");
|
||||||
|
|
||||||
if (lpwhh->htype != INTERNET_HANDLE_TYPE_INTERNET)
|
if (!lpwhh || lpwhh->htype != INTERNET_HANDLE_TYPE_INTERNET)
|
||||||
{
|
{
|
||||||
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
|
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -149,6 +149,12 @@ static void test_InternetQueryOptionA(void)
|
||||||
hinet = InternetOpenA(useragent,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL, 0);
|
hinet = InternetOpenA(useragent,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL, 0);
|
||||||
ok((hinet != 0x0),"InternetOpen Failed\n");
|
ok((hinet != 0x0),"InternetOpen Failed\n");
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
retval=InternetQueryOptionA(NULL,INTERNET_OPTION_USER_AGENT,NULL,&len);
|
||||||
|
err=GetLastError();
|
||||||
|
ok(retval == 0,"Got wrong return value %d\n",retval);
|
||||||
|
ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code%d\n",err);
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
len=strlen(useragent)+1;
|
len=strlen(useragent)+1;
|
||||||
retval=InternetQueryOptionA(hinet,INTERNET_OPTION_USER_AGENT,NULL,&len);
|
retval=InternetQueryOptionA(hinet,INTERNET_OPTION_USER_AGENT,NULL,&len);
|
||||||
|
|
Loading…
Reference in New Issue