Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Re: [nping] WINAPI becoming undefined
From: David Fifield <david () bamsoftware com>
Date: Wed, 6 Apr 2011 18:25:11 -0700

On Tue, Apr 05, 2011 at 10:20:03PM +0200, Gisle Vanem wrote:
I'm struggling with building nping using MingW. All programs in the
nmap package builds fine except for nping. Somewhere in the headers the 
'WINAPI' definition becomes undefined! So nping's use of ShellExecute()  
becomes unlinkable (the __attribute__((__stdcall__)) gets lost). I need 
help finding out where.

My theory is that there could be a local header in nmap that shadows for
one of the system headers. Is there a tool to detect that? But I'm not 
sure since the dependencies (generated using gcc -MM $(CFLAGS)) for 
winfix.cc seems correct.

Running "gcc -E -v $(CFLAGS) winfix.cc" gives me this. First the search list output:

#include "..." search starts here:
#include <...> search starts here:
.
..
../nbase
../nsock/include
../mswin32
../libpcre
../libdnet-stripped/include
../liblua
g:/MingW32/src/zlib-1.2.3
g:/MingW32/src/inet/libpcap
g:/MingW32/src/inet/libpcap/WinPcap/Include
g:/MingW32/src/inet/OpenSSL-1.1.0/outinc
g:/MingW32/include
g:\mingw32\bin\../lib/gcc/mingw32/4.5.0/include/c++
g:\mingw32\bin\../lib/gcc/mingw32/4.5.0/include/c++/mingw32
g:\mingw32\bin\../lib/gcc/mingw32/4.5.0/include/c++/backward
g:\mingw32\bin\../lib/gcc/mingw32/4.5.0/include
g:\mingw32\bin\../lib/gcc/mingw32/4.5.0/include-fixed
End of search list.

Seems okay to me; it reflects my CFLAGS (except the "g:\mingw32\bin\.."
part off-course). But the preprocessed output contains this:

 # 290 "g:/MingW32/include/shellapi.h" 2 3
 ...
 HINSTANCE ShellExecuteA(HWND,LPCSTR,LPCSTR,LPCSTR,LPCSTR,INT);

I.e. the WINAPI decoration gets dropped! 

This is getting outside of my offhand Windows header knowledge. Could
you perhaps trace the problem backwards with

#ifndef WINAPI
#error WINAPI undefined
#endif

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


  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]