[Winpcap-users] Various fixups (was: libpcap.a)

Gianluca Varenni gianluca.varenni at cacetech.com
Sat Dec 17 06:15:30 GMT 2005


Hi Ouroborus.

Some comments about your patches
1. Ok.
2. and 7. Sounds reasonable. Where did you take the implementation of gai_strerrorA/W from? If we want to include it into the main WinPcap source code, its license should be compatible with the WinPcap one (i.e. BSD).
3. Uhm, sounds quite strange. What's the problem if you don't perform this patch?
4. It's right. I knew about this issue (it generates a compilation warning) but I was quite lazy in fixing it...
5. You should probably use wpcap.def (wpcap_no_extensions.def was created to remove some of the exports from the standard wpcap.def)
6. It seems reasonable. I need to check if this file is used by libpcap on the other supported OSes.

Will this patch work on cygnus, as well?

Have a nice day
GV


----- Original Message ----- 
  From: Ouroborus 
  To: winpcap-users at winpcap.org 
  Sent: Friday, December 16, 2005 9:46 PM
  Subject: [Winpcap-users] Various fixups (was: libpcap.a)


  I finally got the first step of the tutorial to compile with MingW. This took a number (7) of fixes:


  1. Add "-DHAVE_REMOTE" to "CFLAGS" in the relevant make files


  2. Add "../libpcap/Win32/Src/gai_strerror.o" to the object list in wpcapsrc_3_1\wpcap\PRJ\GNUmakefile


  3. Copy "struct bpf_stat {...};" from wpcapsrc_3_1\Common\Packet32.h to wpcapsrc_3_1\wpcap\libpcap\pcap-bpf.h


  4. Comment out "#define IN_MULTICAST..." from wpcap\libpcap\Win32\Include\ip6_misc.h


  5. Add 'pcap_findalldevs_ex' to Wpcap_no_extensions.def'


  6. Change line 678 in wpcapsrc_3_1\wpcap\libpcap\inet.c as per:
  ### Begin ###
  678c678,679
  <    (char*)tUstr += strlen(tAstr) + 1;;
  ---
  > //   (char*)tUstr += strlen(tAstr) + 1;;
  >    tUstr = (WCHAR*)(((char*)tUstr) + strlen(tAstr) + 1);
  ### End ###


  7. Add file wpcapsrc_3_1\wpcap\libpcap\Win32\Src\gai_strerror.c:
  ### Begin ###
  #define WIN32_LEAN_AND_MEAN
  #include <windows.h>

  #define GAI_STRERROR_BUFFER_SIZE 1024
  //#define WS2TCPIP_INLINE extern inline
  #define WS2TCPIP_INLINE __stdcall

  WS2TCPIP_INLINE
  char *
  gai_strerrorA(
      IN int ecode)
  {
      DWORD dwMsgLen;
      static char buff[GAI_STRERROR_BUFFER_SIZE + 1];

      dwMsgLen = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM
                               |FORMAT_MESSAGE_IGNORE_INSERTS
                               |FORMAT_MESSAGE_MAX_WIDTH_MASK,
                                NULL,
                                ecode,
                                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                                (LPSTR)buff,
                                GAI_STRERROR_BUFFER_SIZE,
                                NULL);

      return buff;
  }

  WS2TCPIP_INLINE
  WCHAR *
  gai_strerrorW(
      IN int ecode
      )
  {
      DWORD dwMsgLen;
      static WCHAR buff[GAI_STRERROR_BUFFER_SIZE + 1];

      dwMsgLen = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM
                               |FORMAT_MESSAGE_IGNORE_INSERTS
                               |FORMAT_MESSAGE_MAX_WIDTH_MASK,
                                NULL,
                                ecode,
                                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                                (LPWSTR)buff,
                                GAI_STRERROR_BUFFER_SIZE,
                                NULL);

      return buff;
  }
  ### End ### 



------------------------------------------------------------------------------


  _______________________________________________
  Winpcap-users mailing list
  Winpcap-users at winpcap.org
  https://www.winpcap.org/mailman/listinfo/winpcap-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20051216/47d6dcc2/attachment-0001.htm


More information about the Winpcap-users mailing list