"Vijay Kiran Kamuju" infyquest@gmail.com wrote:
- retval=InternetQueryOptionA(hinet,INTERNET_OPTION_USER_AGENT,NULL,&len);
- err=GetLastError();
- ok(len == strlen(useragent)+1,"Got wrong user agent length %ld len instead of %d\n",len,strlen(useragent));
- ok(retval == 0,"Got wrong return value %d\n",retval);
- ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code%ld\n",err);
You need to set last error to some bogus value before calling an API in order to make sure that the API really changes it. Usually setting last error to 0xdeadbeef works fine for that purpose.