The code always fails in httpqueryinfo with an error code of 4262896. The rest of the code will just use InternetReadFile to download the html file. Its pointless though to continue until I figure out why httpqueryinfo fails.
The purpose of httpqueryinfo is to get the size of the html site.
Also, its not the website that I'm trying to access, I've been trying dozens of sites and the same error pops up.
Code:
hInternet = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
if(hInternet == NULL)
{
printf("InternetOpen(%d", GetLastError);
return EXIT_FAILURE;
}
hFile = InternetOpenUrl(hInternet, lpszUrl, NULL, 0, INTERNET_FLAG_RELOAD, 0);
if(hInternet == NULL)
{
printf("InternetOpenUrl(%d)", GetLastError);
return EXIT_FAILURE;
}
if(HttpQueryInfo(hFile, HTTP_QUERY_CONTENT_LENGTH, lpvBuffer, &lpdwBufferLength, NULL) == FALSE)
{
printf("HttpQueryInfo(%d)", GetLastError);
return EXIT_FAILURE;
}