Discussion:
wininet problems on windows vista
(too old to reply)
Oded
2009-09-30 10:38:01 UTC
Permalink
Hi,
we are using wininet API for HTTP communication. all works well, but on
windows Vista for some reason we keep getting error 120007
(ERROR_INTERNET_NAME_NOT_RESOLVED ) when openinng HTTP request
(HttpOpenRequest call). we used a sample code provided by MS themselves, and
we get the same result (see below). Note that all is working ok on XP and
also on the windows 7 RC (and the users which is running the application are
all admin users).
any ideas?

the code we use is:
(argv[1] - the domain, argv[2] - the page)


#include <windows.h>
#include <WinINet.h>
#include <iostream>

using namespace std;

int main(int argc, char** argv)
{
HINTERNET hOpen, hConnect, hReq;
hOpen = InternetOpen("SimpleGet", INTERNET_OPEN_TYPE_PRECONFIG, NULL, 0, 0);
if(!hOpen)
{
cout << "hopen " << GetLastError() << endl;
return 0;
}
// try the following in InternetConnect to see the problem.
hConnect = InternetConnect(hOpen, argv[1], INTERNET_DEFAULT_HTTP_PORT,
NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
if(!hConnect)
{
cout << "hconnect " << GetLastError() << endl;
return 0;
}
hReq = HttpOpenRequest(hConnect, "GET", argv[2], "HTTP/1.1", NULL, NULL,
INTERNET_FLAG_NO_CACHE_WRITE, 0);
if(!hReq)
{
cout << "hreq " << GetLastError() << endl;
return 0;
}
if(HttpSendRequest(hReq, NULL, 0, NULL, 0))
{
DWORD dwSize = 0;
char Data[1024] = "\0";
DWORD dwCode, dwCodeSize;
dwCodeSize = sizeof(DWORD);
if(!HttpQueryInfo(hReq, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER,
&dwCode, &dwCodeSize, NULL))
{
cout << "queryinfo " << GetLastError() << endl;
return 0;
}
else
{
cout << "Status Code: " << dwCode << endl;
}
do
{
InternetReadFile(hReq, (LPVOID)Data, 1023, &dwSize);
if(0!=dwSize)
{
Data[dwSize]='\0';
cout << Data;
}
ZeroMemory(Data, 1024);
}while (dwSize !=0);
}
else
{
cout << "SendRequest error " << GetLastError() << endl;
}
return 0;
}
Brian Cryer
2009-09-30 13:50:55 UTC
Permalink
Post by Oded
Hi,
we are using wininet API for HTTP communication. all works well, but on
windows Vista for some reason we keep getting error 120007
(ERROR_INTERNET_NAME_NOT_RESOLVED ) when openinng HTTP request
(HttpOpenRequest call). we used a sample code provided by MS themselves, and
we get the same result (see below). Note that all is working ok on XP and
also on the windows 7 RC (and the users which is running the application are
all admin users).
any ideas?
(argv[1] - the domain, argv[2] - the page)
<snip>

It looks very much like a name resolution issue, so can you resolve the
domain name on the Vista box? so ping or nslookup at the command prompt?
--
Brian Cryer
www.cryer.co.uk/brian
Oded
2009-10-04 07:20:01 UTC
Permalink
Hey 10x.
i feel a little bit stupid not looking into this. Apperently there are other
problems we expirience in Vista (other machines) which are not related to
this DNS issue, and this specific machine wasn't configured properly, so we
were stopped at that stage and thought it cannot be that because other
machines which expirienced other problems were configured properly.
to cut things short, 10x. it is indeed just a network configuration problem.
Loading...