Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

wininet problems on windows vista

22 views
Skip to first unread message

Oded

unread,
Sep 30, 2009, 6:38:01 AM9/30/09
to
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

unread,
Sep 30, 2009, 9:50:55 AM9/30/09
to
"Oded" <Od...@discussions.microsoft.com> wrote in message
news:2C37AD7C-E56B-42C2...@microsoft.com...

> 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)
<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

unread,
Oct 4, 2009, 3:20:01 AM10/4/09
to
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.

0 new messages