[Winpcap-users] struct bpf_hdr mismatch

Gisle Vanem gvanem at broadpark.no
Fri Sep 5 12:50:40 GMT 2008


"Gianluca Varenni" <gianluca.varenni at cacetech.com> wrote:

> I just tried your code snippet from the VS2008EE IDE, and it didn't compile 
> as it was. I had to change the order of the #include directives (not 
> surprising, it's always been like that. You need to include packet32.h 
> before windows.h).

Yes, I see there are warnings about redefinitions of FD_SET etc. in <winsock2.h>.
But if I define WIN32_LEAN_AND_MEAN, the header order doesn't seems
to matter. 

> After that, the result was "sizes ok". I used the developer's pack for 
> winpcap 4.1 beta4.

False alarm; my compilation was picking up another 'struct timeval' from
another header listed in %INC. It was defined the "POSIX" way:
  struct {
         time_t  tv_sec;
         long  tv_usec;
       };

That caused 'struct bpf_hdr' to be 4 bytes off.

--gv


More information about the Winpcap-users mailing list