Nmap Development mailing list archives

Re: Missing getaddrinfo on Windows 2000--almost solved


From: David Fifield <david () bamsoftware com>
Date: Wed, 27 Aug 2008 13:50:16 -0600

On Thu, Aug 28, 2008 at 01:07:25AM +0530, Kris Katterjohn wrote:
On Wed, Aug 27, 2008 at 10:32 PM, David Fifield <david () bamsoftware com> wrote:
So, does _WIN32_WINNT *have* to be set to _WIN32_WINNT_WIN2K, or can
it be something slightly newer, like maybe _WIN32_WINNT_WIN2KSP1?

Of course I could hack a little in6addr_any for Ncat, but if Nmap or
anything else using Nbase wants any of these really common IPv6
definitions, this will be a problem.

We compile Nmap using Visual C++ 2008, and the respective runtime components
specify Windows 2000 SP4 as a minimum requirement*, so you can probably get
away with WIN2KSP1 (although people may still be able to compile our source
themselves using another compiler). I'd also be surprised if many people are
still using WIN2K RTM anywhere, but I'm sure we'll manage to annoy someone
somewhere if we leave them out ;)

Setting it to SP4 sounds fine. The important thing is that it be set to
*something* otherwise it defaults to Vista or Longhorn.


I was looking at the "Using the Windows Headers" MSDN page you posted
which lists the NTDDI macros and values (including NTDDI_WIN2KSP*).
The thing is I was in the mindset of _WIN32_WINNT so I must've just
glazed over the NTDDI prefix when looking at this and thought I was
looking at something different.  There are only 5 _WIN32_WINNT values,
corresponding to major versions (2K, XP, Longhorn, etc) and without
SPs.

Okay, I see.

I think you can set both. Set _WIN32_WINNT to _WIN32_WINNT_WIN2K and
then set NTDDI_VERSION to NTDDI_WIN2KSP4, both in nbase_winunix.h. If
you don't set NTDDI_VERSION it gets set based on the value of
_WIN32_WINNT in sdkddkver.h. Just look at sdkddkver.h, you'll see the
logic. I don't know where that file is kept but you can open it by
right-clicking on _WIN32_WINNT_WIN2K and selecting "Go to definition."

Since I had already modified nbase_winunix.h on my box to use
_WIN32_WINNT_WINXP so I could work on Ncat before looking around for
any permanent solution to this, I just left it there and continued on
thinking that it would work fine.

So.. since it just has to be something before Vista, XP works fine for
what I need and I guess will work for this other stuff too.  But I
don't want to do anything without an OK on this.

We could use XP but I get the impression that we won't get any error if
we then use a function that's not available on Windows 2000. Just like
how if leave NTDDI_VERSION at its default of Vista, Visual Studio will
compile a program that uses Microsoft's inet_ntop, but it won't run on
XP. So try setting NTDDI_VERSION first, and if that doesn't work, then
bumping up to XP means we just have to be careful about what parts of
the API we use.

David

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


Current thread: