Nmap Development mailing list archives

Re: Missing getaddrinfo on Windows 2000--almost solved


From: David Fifield <david () bamsoftware com>
Date: Sat, 23 Aug 2008 14:51:59 -0600

On Sat, Aug 23, 2008 at 02:26:46PM +0200, Vlatko Kosturjak wrote:
I don't have a WIndows box handy to test on, so Rob could you try this
patch? Visual Studio 2008 declares inet_ntop and inet_pton, but those
functions are only actually available on Windows Vista and later. This
patch allows testing for the declaration separately from the definition,
so we declare the functions only if necessary and then always compile
nbase's versions.

Your patch has compiling errors:

Thanks for testing.

I worked on this some more today and committed what I think is a
solution. Recall that it was the NTDDI_VERSION preprecessor symbol,
defined in Visual Studio 2008, that was causing the trouble. It brought
in non-standard declarations of inet_ntop and inet_pton.

It turns out you are meant to define NTDDI_VERSION to specify the
earliest version of the Windows API you intend to support.

http://msdn.microsoft.com/en-us/library/aa383745.aspx
http://blogs.msdn.com/oldnewthing/archive/2007/04/11/2079137.aspx

If you leave it undefined it defaults to compiling for Vista, which
means that the compiler will use anything that is supported on Vista,
even if it's not supported on earlier versions. I think the solution to
our problems is just to say what is the earliest version of Windows we
support, so I added

#define _WIN32_WINNT _WIN32_WINNT_WIN2K

NTDDI_VERSION is defined in terms of _WIN32_WINNT; I was getting a
warning if I tried to define NTDDI_VERSION directly.

I don't have access to Windows 2000 to test it, but it compiles and I
can verify that the replacement getaddrinfo function is being used by
looking at the preprocessor output. I'd like someone with Windows 2000
to give r9700 a try.

David Fifield

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: